Replace the selected range instead of force-setting it

This gives people the option of cutting parts or all of their message.
pull/21833/head
Travis Ralston 2020-01-15 21:04:18 -07:00
parent be3ef2b50e
commit b137cd21d3
1 changed files with 2 additions and 3 deletions

View File

@ -209,9 +209,8 @@ export default class BasicMessageEditor extends React.Component {
const selectedParts = range.parts.map(p => p.serialize());
event.clipboardData.setData("application/x-riot-composer", JSON.stringify(selectedParts));
if (type === "cut") {
// Remove the text from the composer
const {caret} = getCaretOffsetAndText(this._editorRef, selection);
this.props.model.update("", event.inputType, caret);
// Remove the text, updating the model as appropriate
replaceRangeAndMoveCaret(range, []);
}
event.preventDefault();
}