From 7489c6d6c13cda1662e3929d5ccf69557980d26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Roldi?= Date: Mon, 1 Apr 2024 18:05:03 -0300 Subject: [PATCH] fix demo site --- .../sidePane/editorOptions/codes/AutoFormatCode.ts | 7 ++++++- .../lib/autoFormat/list/getListTypeStyle.ts | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/demo/scripts/controlsV2/sidePane/editorOptions/codes/AutoFormatCode.ts b/demo/scripts/controlsV2/sidePane/editorOptions/codes/AutoFormatCode.ts index 27e536b6488..ba9f5c37100 100644 --- a/demo/scripts/controlsV2/sidePane/editorOptions/codes/AutoFormatCode.ts +++ b/demo/scripts/controlsV2/sidePane/editorOptions/codes/AutoFormatCode.ts @@ -7,6 +7,11 @@ export class AutoFormatCode extends CodeElement { } getCode() { - return `new roosterjs.AutoFormatPlugin('${this.options}')`; + return `new roosterjs.AutoFormatPlugin({ + autoBullet: ${this.options.autoBullet}, + autoLink: ${this.options.autoLink}, + autoNumbering: ${this.options.autoNumbering}, + autoUnlink: ${this.options.autoUnlink}, + })`; } } diff --git a/packages/roosterjs-content-model-plugins/lib/autoFormat/list/getListTypeStyle.ts b/packages/roosterjs-content-model-plugins/lib/autoFormat/list/getListTypeStyle.ts index 2e566bbf2bb..7a6c64dc584 100644 --- a/packages/roosterjs-content-model-plugins/lib/autoFormat/list/getListTypeStyle.ts +++ b/packages/roosterjs-content-model-plugins/lib/autoFormat/list/getListTypeStyle.ts @@ -44,7 +44,7 @@ export function getListTypeStyle( listMarkerSegment && listMarkerSegment.segmentType == 'Text' ) { - const listMarker = listMarkerSegment.text; + const listMarker = listMarkerSegment.text.trim(); const bulletType = bulletListType[listMarker]; if (bulletType && shouldSearchForBullet) { @@ -125,7 +125,7 @@ const bulletListType: Record = { }; const isNewList = (listMarker: string) => { - const marker = listMarker.replace(/[^\w\s]/g, '').trim(); + const marker = listMarker.replace(/[^\w\s]/g, ''); const pattern = /^[1aAiI]$/; return pattern.test(marker); };