From 3da1c826d143ea8248db8a70eb60c69899fc0b9e Mon Sep 17 00:00:00 2001 From: Mathias Mogensen Date: Fri, 13 Sep 2024 15:46:41 +0200 Subject: [PATCH] fix: odd toggle behavior continuous markdown --- .../format_single_character/format_single_character.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/editor/editor_component/service/shortcuts/character/format_single_character/format_single_character.dart b/lib/src/editor/editor_component/service/shortcuts/character/format_single_character/format_single_character.dart index 0f65c4f14..43e2b7be8 100644 --- a/lib/src/editor/editor_component/service/shortcuts/character/format_single_character/format_single_character.dart +++ b/lib/src/editor/editor_component/service/shortcuts/character/format_single_character/format_single_character.dart @@ -56,6 +56,11 @@ bool handleFormatByWrappingWithSingleCharacter({ return false; } + // 5. If the text inbetween is empty (continuous) + if (plainText.substring(lastCharIndex + 1, selection.end.offset).isEmpty) { + return false; + } + // Before deletion we need to insert the character in question so that undo manager // will undo only the style applied and keep the character. final insertion = editorState.transaction