diff --git a/src/types/YText.js b/src/types/YText.js index 5739b733..9fff3ca3 100644 --- a/src/types/YText.js +++ b/src/types/YText.js @@ -64,6 +64,9 @@ export class ItemTextListPosition { } switch (this.right.content.constructor) { case ContentFormat: + if (!this.right.deleted) { + updateCurrentNonNullAttributes(this.currentAttributes, /** @type {ContentFormat} */ (this.right.content)) + } break default: if (!this.right.deleted) { @@ -209,6 +212,20 @@ const updateCurrentAttributes = (currentAttributes, format) => { } } +/** + * @param {Map} currentAttributes + * @param {ContentFormat} format + * + * @private + * @function + */ +const updateCurrentNonNullAttributes = (/** @type {Map} */ currentAttributes, /** @type {ContentFormat} */ format) => { + const { key, value } = format + if (value !== null) { + currentAttributes.set(key, value) + } +} + /** * @param {ItemTextListPosition} currPos * @param {Object} attributes