From aec9abbca4ab0e99082b0037cd98db4d0677f56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E9=BB=9B=E6=B7=B3=E5=8D=8E?= Date: Mon, 3 Jun 2024 10:09:20 +0800 Subject: [PATCH] format --- .../lib/modelToDom/optimizers/optimize.ts | 4 ++-- .../lib/modelToDom/optimizers/removeUnnecessarySpan.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/optimize.ts b/packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/optimize.ts index f4903239a02..cf4b605b7bd 100644 --- a/packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/optimize.ts +++ b/packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/optimize.ts @@ -13,14 +13,14 @@ export function optimize(root: Node, isRecursive = false) { return; } if (!isRecursive && root.parentElement != null) { - let computedAttributes = {} as Record; + const computedAttributes = {} as Record; // html doesn't provide computed attributes, use parent's attributes directly Array.from(root.parentElement.attributes).forEach((attr) => { computedAttributes[attr.name] = attr; }); removeUnnecessaryAttribute(root, computedAttributes); - let computedStyle = {} as Record>; + const computedStyle = {} as Record>; enumerateComputedStyle(root.parentElement, (key, values) => { computedStyle[key] = values; }); diff --git a/packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/removeUnnecessarySpan.ts b/packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/removeUnnecessarySpan.ts index 0f0e93d34fc..8f339ddb739 100644 --- a/packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/removeUnnecessarySpan.ts +++ b/packages/roosterjs-content-model-dom/lib/modelToDom/optimizers/removeUnnecessarySpan.ts @@ -7,7 +7,7 @@ export function removeUnnecessaryAttribute(root: Node, computedAttributes: Recor if (!isNodeOfType(root, 'ELEMENT_NODE')) { return } - let newComputedAttributes = { + const newComputedAttributes = { ...computedAttributes, }; for (let i = root.attributes.length - 1; i >= 0; i--) { @@ -34,7 +34,7 @@ export function enumerateComputedStyle(element: HTMLElement, handler: (key: stri return; } key = key.trim(); - let values = new Set(valueText.split(",").map((value) => value.trim())); + const values = new Set(valueText.split(",").map((value) => value.trim())); handler(key, values); }); @@ -47,7 +47,7 @@ export function removeUnnecessaryStyle(root: Node, computedCSS: Record { @@ -71,7 +71,7 @@ export function removeUnnecessaryStyle(root: Node, computedCSS: Record