PR feedback, cleanup
This commit is contained in:
@@ -66,8 +66,6 @@ export default class EditorModel {
|
||||
}
|
||||
|
||||
_diff(newValue, inputType, caret) {
|
||||
// handle deleteContentForward (Delete key)
|
||||
// and deleteContentBackward (Backspace)
|
||||
const previousValue = this.parts.reduce((text, p) => text + p.text, "");
|
||||
// can't use caret position with drag and drop
|
||||
if (inputType === "deleteByDrag") {
|
||||
@@ -80,8 +78,6 @@ export default class EditorModel {
|
||||
update(newValue, inputType, caret) {
|
||||
const diff = this._diff(newValue, inputType, caret);
|
||||
const position = this._positionForOffset(diff.at, caret.atNodeEnd);
|
||||
// const valueWithCaret = newValue.slice(0, caret.offset) + "|" + newValue.slice(caret.offset);
|
||||
// console.log("update at", {diff, valueWithCaret});
|
||||
let removedOffsetDecrease = 0;
|
||||
if (diff.removed) {
|
||||
removedOffsetDecrease = this._removeText(position, diff.removed.length);
|
||||
@@ -93,7 +89,6 @@ export default class EditorModel {
|
||||
this._mergeAdjacentParts();
|
||||
const caretOffset = diff.at - removedOffsetDecrease + addedLen;
|
||||
const newPosition = this._positionForOffset(caretOffset, true);
|
||||
// console.log("caretOffset", {at: diff.at, removedOffsetDecrease, addedLen}, newPosition);
|
||||
this._setActivePart(newPosition);
|
||||
this._updateCallback(newPosition);
|
||||
}
|
||||
@@ -146,12 +141,6 @@ export default class EditorModel {
|
||||
this._updateCallback(pos);
|
||||
}
|
||||
|
||||
/*
|
||||
updateCaret(caret) {
|
||||
// update active part here as well, hiding/showing autocomplete if needed
|
||||
}
|
||||
*/
|
||||
|
||||
_mergeAdjacentParts(docPos) {
|
||||
let prevPart = this._parts[0];
|
||||
for (let i = 1; i < this._parts.length; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user