From adb93d0fd9113d7e659a1a36cb9e6042d10154fa Mon Sep 17 00:00:00 2001 From: Ian Elizondo Date: Mon, 28 Nov 2022 22:45:34 +0000 Subject: [PATCH 1/2] Remove coloring when removing a quote inside a LI --- .../lib/plugins/ContentEdit/features/quoteFeatures.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/quoteFeatures.ts b/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/quoteFeatures.ts index f1d891ac35c..095c030b750 100644 --- a/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/quoteFeatures.ts +++ b/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/quoteFeatures.ts @@ -82,10 +82,13 @@ function splitQuote(event: PluginKeyboardEvent, editor: IEditor) { } parent = splitBalancedNodeRange(childOfQuote); shouldClearFormat = isStyledBlockquote(parent); - unwrap(parent); + const newParent = unwrap(parent); editor.select(childOfQuote, PositionType.Begin); if (shouldClearFormat) { + if (safeInstanceOf(newParent, 'HTMLLIElement')) { + newParent.style.removeProperty('color'); + } clearFormat(editor); } }); From 8985159eb2e8db5a38661014d7fce91f32e42eb7 Mon Sep 17 00:00:00 2001 From: Ian Elizondo Date: Mon, 28 Nov 2022 22:45:54 +0000 Subject: [PATCH 2/2] Prevent list items from being removed before quote --- .../lib/plugins/ContentEdit/features/listFeatures.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/listFeatures.ts b/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/listFeatures.ts index 2e75079636f..6486971a0b7 100644 --- a/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/listFeatures.ts +++ b/packages/roosterjs-editor-plugins/lib/plugins/ContentEdit/features/listFeatures.ts @@ -131,7 +131,12 @@ const OutdentWhenBackOn1stEmptyLine: BuildInEditFeature = { keys: [Keys.BACKSPACE], shouldHandleEvent: (event, editor) => { let li = editor.getElementAtCursor('LI', null /*startFrom*/, event); - return li && isNodeEmpty(li) && !li.previousSibling; + return ( + li && + isNodeEmpty(li) && + !li.previousSibling && + !li.getElementsByTagName('blockquote').length + ); }, handleEvent: toggleListAndPreventDefault, }; @@ -371,7 +376,9 @@ const isFirstItemOfAList = (item: string) => { const MaintainListChain: BuildInEditFeature = { keys: [Keys.ENTER, Keys.TAB, Keys.DELETE, Keys.BACKSPACE, Keys.RANGE], shouldHandleEvent: (event, editor) => - editor.queryElements('li', QueryScope.OnSelection).length > 0, + editor + .queryElements('li', QueryScope.OnSelection) + .filter(li => !li.getElementsByTagName('blockquote').length).length > 0, handleEvent: (event, editor) => { const chains = getListChains(editor); editor.runAsync(editor => commitListChains(editor, chains));