From a6b2dd1d66e080564a704f628c4c4137f8b91c83 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Thu, 24 Apr 2025 18:59:40 +0200 Subject: [PATCH] more perf improvements on getContent with attributedContent --- src/utils/Delta.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/Delta.js b/src/utils/Delta.js index e9a15f91..402550b7 100644 --- a/src/utils/Delta.js +++ b/src/utils/Delta.js @@ -178,9 +178,9 @@ export class DeltaBuilder extends Delta { * @return {this} */ insert (insert, attributes = null, attribution = null) { - const mergedAttributes = mergeAttrs(this.usedAttributes, attributes) - const mergedAttribution = mergeAttrs(this.usedAttribution, attribution) - if (this._lastOp instanceof InsertOp && fun.equalityDeep(mergedAttributes, this._lastOp.attributes) && fun.equalityDeep(mergedAttribution, this._lastOp.attribution)) { + const mergedAttributes = attributes == null ? this.usedAttributes : mergeAttrs(this.usedAttributes, attributes) + const mergedAttribution = attribution == null ? this.usedAttribution : mergeAttrs(this.usedAttribution, attribution) + if (this._lastOp instanceof InsertOp && (mergedAttributes === this._lastOp.attributes || fun.equalityDeep(mergedAttributes, this._lastOp.attributes)) && (mergedAttribution === this._lastOp.attribution || fun.equalityDeep(mergedAttribution, this._lastOp.attribution))) { this._lastOp.insert += insert } else { this.ops.push(this._lastOp = new InsertOp(insert, mergedAttributes, mergedAttribution))