From 0084ed114366bfcf980ec9e2d634b463ca57f20c Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Thu, 12 Jun 2025 19:06:30 +0200 Subject: [PATCH] lint --- src/types/YText.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/types/YText.js b/src/types/YText.js index 5a79594e..5ba588b8 100644 --- a/src/types/YText.js +++ b/src/types/YText.js @@ -944,7 +944,7 @@ export class YText extends AbstractType { * that is not attributed. * @type {import('../utils/Delta.js').FormattingAttributes} */ - let previousUnattributedAttributes = {} // contains previously known unattributed formatting + const previousUnattributedAttributes = {} // contains previously known unattributed formatting /** * @type {import('../utils/Delta.js').FormattingAttributes} */ @@ -1026,7 +1026,7 @@ export class YText extends AbstractType { case ContentFormat: { const { key, value } = /** @type {ContentFormat} */ (c.content) const currAttrVal = currentAttributes[key] ?? null - if (attribution != null && (c.deleted || !previousUnattributedAttributes.hasOwnProperty(key))) { + if (attribution != null && (c.deleted || !object.hasProperty(previousUnattributedAttributes, key))) { previousUnattributedAttributes[key] = c.deleted ? value : currAttrVal } // @todo write a function "updateCurrentAttributes" and "updateChangedAttributes" @@ -1088,13 +1088,12 @@ export class YText extends AbstractType { previousAttributes[key] = value } // # Update Attributions - if (attribution != null || previousUnattributedAttributes.hasOwnProperty(key)) { + if (attribution != null || object.hasProperty(previousUnattributedAttributes, key)) { /** * @type {import('../utils/Delta.js').Attribution} */ const formattingAttribution = object.assign({}, d.usedAttribution) const changedAttributedAttributes = /** @type {{ [key: string]: Array }} */ (formattingAttribution.attributes = object.assign({}, formattingAttribution.attributes ?? {})) - if (attribution == null || equalAttrs(previousUnattributedAttributes[key], currentAttributes[key] ?? null)) { // an unattributed formatting attribute was found or an attributed formatting // attribute was found that resets to the previous status