mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
also process first part when processing empty and mergeable parts
this was preventing clearing an emtpy plain part when inserting a pill-candidate at the beginning of the model, which prevented a caret node from being inserted before the pill.
This commit is contained in:
parent
75fc769742
commit
607fc328ed
1 changed files with 3 additions and 3 deletions
|
@ -158,11 +158,11 @@ export default class EditorModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
_mergeAdjacentParts(docPos) {
|
_mergeAdjacentParts(docPos) {
|
||||||
let prevPart = this._parts[0];
|
let prevPart;
|
||||||
for (let i = 1; i < this._parts.length; ++i) {
|
for (let i = 0; i < this._parts.length; ++i) {
|
||||||
let part = this._parts[i];
|
let part = this._parts[i];
|
||||||
const isEmpty = !part.text.length;
|
const isEmpty = !part.text.length;
|
||||||
const isMerged = !isEmpty && prevPart.merge(part);
|
const isMerged = !isEmpty && prevPart && prevPart.merge(part);
|
||||||
if (isEmpty || isMerged) {
|
if (isEmpty || isMerged) {
|
||||||
// remove empty or merged part
|
// remove empty or merged part
|
||||||
part = prevPart;
|
part = prevPart;
|
||||||
|
|
Loading…
Reference in a new issue