Merge pull request #3848 from matrix-org/travis/fix-cut
Remove all text when cutting in the composer
This commit is contained in:
commit
43f97af805
2 changed files with 3 additions and 3 deletions
|
@ -210,8 +210,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") {
|
||||||
selection.deleteFromDocument();
|
// Remove the text, updating the model as appropriate
|
||||||
range.replace([]);
|
replaceRangeAndMoveCaret(range, []);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ export default class DocumentPosition {
|
||||||
}
|
}
|
||||||
offset += this.offset;
|
offset += this.offset;
|
||||||
const lastPart = model.parts[this.index];
|
const lastPart = model.parts[this.index];
|
||||||
const atEnd = offset >= lastPart.text.length;
|
const atEnd = !lastPart || offset >= lastPart.text.length; // if no last part, we're at the end
|
||||||
return new DocumentOffset(offset, atEnd);
|
return new DocumentOffset(offset, atEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue