diff --git a/src/types/YText.js b/src/types/YText.js index 167841b9..a2121a99 100644 --- a/src/types/YText.js +++ b/src/types/YText.js @@ -272,7 +272,7 @@ const formatText = (transaction, parent, left, right, currentAttributes, length, // iterate until first non-format or null is found // delete all formats with attributes[format.key] != null while (length > 0 && right !== null) { - if (right.deleted === false) { + if (!right.deleted) { switch (right.content.constructor) { case ContentFormat: const { key, value } = /** @type {ContentFormat} */ (right.content) diff --git a/src/types/YXmlFragment.js b/src/types/YXmlFragment.js index 62fa543e..247f4b1b 100644 --- a/src/types/YXmlFragment.js +++ b/src/types/YXmlFragment.js @@ -151,6 +151,10 @@ export class YXmlFragment extends AbstractType { return new YXmlFragment() } + get length () { + return this._prelimContent === null ? this._length : this._prelimContent.length + } + /** * Create a subtree of childNodes. *