Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(engine-render): inherit default list marker sizes (#7450)
Univer5aca3d76e764
diff --git a/packages/core/src/docs/data-model/__tests__/preset-list-type.spec.ts b/packages/core/src/docs/data-model/__tests__/preset-list-type.spec.tsnew file mode 100644index 0000000000..b176f88039--- /dev/null+++ b/packages/core/src/docs/data-model/__tests__/preset-list-type.spec.ts@@ -0,0 +1,29 @@+/**+ * Copyright 2023-present DreamNum Co., Ltd.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import { describe, expect, it } from 'vitest';+import { PRESET_LIST_TYPE } from '../preset-list-type';++describe('preset list types', () => {+ // TODO(@ai-review): Confirm every built-in marker inherits paragraph font size unless its document data explicitly provides one.+ it('does not assign absolute font sizes to built-in list markers', () => {+ for (const [listType, listData] of Object.entries(PRESET_LIST_TYPE)) {+ for (const [level, nesting] of listData.nestingLevel.entries()) {+ expect(nesting.textStyle?.fs, `${listType} level ${level}`).toBeUndefined();+ }+ }+ });+});diff --git a/packages/core/src/docs/data-model/preset-list-type.ts b/packages/core/src/docs/data-model/preset-list-type.tsindex 2f9797bf12..3835ac33c8 100644--- a/packages/core/src/docs/data-model/preset-list-type.ts+++ b/packages/core/src/docs/data-model/preset-list-type.ts@@ -96,6 +96,7 @@ const orderListSymbolMap = {};type BulletSymbols = [string, string, string];+// TODO(@ai-review): Verify built-in markers inherit effective paragraph fonts while imported marker styles remain explicit overrides.const bulletListFactory = (symbols: BulletSymbols): INestingLevel[] => {return [...symbols,@@ -105,9 +106,6 @@ const bulletListFactory = (symbols: BulletSymbols): INestingLevel[] => {glyphFormat: ` %${i + 1}`,glyphSymbol: templateSymbol,bulletAlignment: BulletAlignment.START,- textStyle: {- fs: 12,- },startNumber: 0,paragraphProperties: {hanging: { v: 21 },@@ -120,9 +118,6 @@ const orderListFactory = (options: { glyphFormat: string; glyphType: ListGlyphTyreturn options.map((format, i) => ({...format,bulletAlignment: BulletAlignment.START,- textStyle: {- fs: 12,- },startNumber: 0,paragraphProperties: {hanging: { v: 21 },@@ -136,9 +131,6 @@ const checkListFactory = (symbol: string, textStyle?: ITextStyle): INestingLevelglyphFormat: ` %${i + 1}`,glyphSymbol: symbol,bulletAlignment: BulletAlignment.START,- textStyle: {- fs: 16,- },startNumber: 0,paragraphProperties: {hanging: { v: 21 },diff --git a/packages/engine-render/src/components/docs/layout/block/paragraph/__tests__/bullet.spec.ts b/packages/engine-render/src/components/docs/layout/block/paragraph/__tests__/bullet.spec.tsindex 927fb6456a..ecdd8ba169 100644--- a/packages/engine-render/src/components/docs/layout/block/paragraph/__tests__/bullet.spec.ts+++ b/packages/engine-render/src/components/docs/layout/block/paragraph/__tests__/bullet.spec.ts@@ -251,12 +251,13 @@ describe('bullet', () => {});describe('getDefaultBulletSke', () => {- it('returns default bullet skeleton', () => {+ // TODO(@ai-review): Confirm fallback markers inherit effective paragraph fonts instead of imposing a hidden default.+ it('returns a default bullet skeleton without an absolute font style', () => {const result = getDefaultBulletSke('list-default');expect(result.listId).toBe('list-default');expect(result.symbol).toBe('\u25CF');- expect(result.ts.ff).toBe('Arial');- expect(result.ts.fs).toBe(9);+ expect(result.ts.ff).toBeUndefined();+ expect(result.ts.fs).toBeUndefined();expect(result.startIndexItem).toBe(1);expect(result.paragraphProperties).toBeDefined();});diff --git a/packages/engine-render/src/components/docs/layout/block/paragraph/bullet.ts b/packages/engine-render/src/components/docs/layout/block/paragraph/bullet.tsindex 2451f38d43..728e286eec 100644--- a/packages/engine-render/src/components/docs/layout/block/paragraph/bullet.ts+++ b/packages/engine-render/src/components/docs/layout/block/paragraph/bullet.ts@@ -62,14 +62,11 @@ export function dealWithBullet(}export function getDefaultBulletSke(listId: string, startIndex: number = 1): IDocumentSkeletonBullet {+ // TODO(@ai-review): Confirm fallback markers inherit the paragraph font without weakening explicit imported marker styles.return {listId,symbol: '\u25CF', // symbol list content- ts: {- // TODO: @jikkai @DR-Univer should read default font from configuration, not from locale service- ff: 'Arial',- fs: 9,- }, // text style+ ts: {},startIndexItem: startIndex,// bBox: {// width: 8.4560546875,