mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
remove special casing for moving caret after newline and pills
not needed anymore with new caret logic and having caret nodes
This commit is contained in:
parent
a229641985
commit
f0271b593d
@ -103,8 +103,7 @@ export default class EditorModel {
|
|||||||
}
|
}
|
||||||
this._mergeAdjacentParts();
|
this._mergeAdjacentParts();
|
||||||
const caretOffset = diff.at - removedOffsetDecrease + addedLen;
|
const caretOffset = diff.at - removedOffsetDecrease + addedLen;
|
||||||
let newPosition = this.positionForOffset(caretOffset, true);
|
const newPosition = this.positionForOffset(caretOffset, true);
|
||||||
newPosition = newPosition.skipUneditableParts(this._parts);
|
|
||||||
this._setActivePart(newPosition);
|
this._setActivePart(newPosition);
|
||||||
this._updateCallback(newPosition);
|
this._updateCallback(newPosition);
|
||||||
}
|
}
|
||||||
@ -140,10 +139,9 @@ export default class EditorModel {
|
|||||||
let pos;
|
let pos;
|
||||||
if (replacePart) {
|
if (replacePart) {
|
||||||
this._replacePart(this._autoCompletePartIdx, replacePart);
|
this._replacePart(this._autoCompletePartIdx, replacePart);
|
||||||
let index = this._autoCompletePartIdx;
|
const index = this._autoCompletePartIdx;
|
||||||
if (caretOffset === undefined) {
|
if (caretOffset === undefined) {
|
||||||
caretOffset = 0;
|
caretOffset = replacePart.text.length;
|
||||||
index += 1;
|
|
||||||
}
|
}
|
||||||
pos = new DocumentPosition(index, caretOffset);
|
pos = new DocumentPosition(index, caretOffset);
|
||||||
}
|
}
|
||||||
@ -283,13 +281,4 @@ class DocumentPosition {
|
|||||||
get offset() {
|
get offset() {
|
||||||
return this._offset;
|
return this._offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
skipUneditableParts(parts) {
|
|
||||||
const part = parts[this.index];
|
|
||||||
if (part && !part.canEdit) {
|
|
||||||
return new DocumentPosition(this.index + 1, 0);
|
|
||||||
} else {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user