You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-17 17:42:41 +03:00
Remove all text when cutting in the composer
The previous function did in fact remove the elements, but left the model thinking there was a zero-length string. This approach deletes the text from the model and the DOM, resulting in the placeholder being shown when cutting all the text. Part of https://github.com/vector-im/riot-web/issues/11378
This commit is contained in:
@@ -209,8 +209,9 @@ export default class BasicMessageEditor extends React.Component {
|
|||||||
const selectedParts = range.parts.map(p => p.serialize());
|
const selectedParts = range.parts.map(p => p.serialize());
|
||||||
event.clipboardData.setData("application/x-riot-composer", JSON.stringify(selectedParts));
|
event.clipboardData.setData("application/x-riot-composer", JSON.stringify(selectedParts));
|
||||||
if (type === "cut") {
|
if (type === "cut") {
|
||||||
selection.deleteFromDocument();
|
// Remove the text from the composer
|
||||||
range.replace([]);
|
const {caret} = getCaretOffsetAndText(this._editorRef, selection);
|
||||||
|
this.props.model.update("", event.inputType, caret);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user