From 4ffcdd826713b72aa6d14e1e669aa3b51de6e015 Mon Sep 17 00:00:00 2001 From: nimishclickup <109546805+nimishclickup@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:55:20 -0800 Subject: [PATCH] Fix the test case --- src/types/YText.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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