From f835ea686ba6955b4ee4a8e74d721105b2955868 Mon Sep 17 00:00:00 2001 From: "SOUTHAMERICA\\bvalverde" Date: Thu, 29 Jun 2023 14:42:27 -0600 Subject: [PATCH] small fix --- packages/roosterjs-editor-core/lib/coreApi/selectTable.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/roosterjs-editor-core/lib/coreApi/selectTable.ts b/packages/roosterjs-editor-core/lib/coreApi/selectTable.ts index c8474fef28a..67ae0a4e82f 100644 --- a/packages/roosterjs-editor-core/lib/coreApi/selectTable.ts +++ b/packages/roosterjs-editor-core/lib/coreApi/selectTable.ts @@ -24,6 +24,7 @@ const CONTENT_DIV_ID = 'contentDiv_'; const STYLE_ID = 'tableStyle'; const SELECTED_CSS_RULE = '{background-color: rgb(198,198,198) !important; caret-color: transparent}'; +const MAX_RULE_SELECTOR_LENGTH = 9000; /** * @internal @@ -72,7 +73,6 @@ export const selectTable: SelectTable = ( return null; }; -const MAX_RULE_SELECTOR_LENGTH = 8000; function buildCss( table: HTMLTableElement, coordinates: TableSelection, @@ -93,7 +93,10 @@ function buildCss( let currentRules: string = ''; while (selectors.length > 0) { currentRules += (currentRules.length > 0 ? ',' : '') + selectors.shift() || ''; - if (currentRules.length > MAX_RULE_SELECTOR_LENGTH || selectors.length == 0) { + if ( + currentRules.length + (selectors[0]?.length || 0) > MAX_RULE_SELECTOR_LENGTH || + selectors.length == 0 + ) { cssRules.push(currentRules + ' ' + SELECTED_CSS_RULE); currentRules = ''; }