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
parent
be3ef2b50e
commit
b137cd21d3
|
@ -209,9 +209,8 @@ 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") {
|
||||||
// Remove the text from the composer
|
// Remove the text, updating the model as appropriate
|
||||||
const {caret} = getCaretOffsetAndText(this._editorRef, selection);
|
replaceRangeAndMoveCaret(range, []);
|
||||||
this.props.model.update("", event.inputType, caret);
|
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue