diff --git a/apps/front-end/src/plugins/MarkdownShortcutPlugin/transformers.ts b/apps/front-end/src/plugins/MarkdownShortcutPlugin/transformers.ts index b00c282..c17eba3 100644 --- a/apps/front-end/src/plugins/MarkdownShortcutPlugin/transformers.ts +++ b/apps/front-end/src/plugins/MarkdownShortcutPlugin/transformers.ts @@ -1,11 +1,13 @@ import { + CHECK_LIST, + ElementTransformer, TRANSFORMERS as LEXICAL_TRANSFORMERS, TextMatchTransformer, } from "@lexical/markdown"; import { - ImageNode, - $isImageNode, $createImageNode, + $isImageNode, + ImageNode, } from "../ImagePlugin/ImageNode"; const IMAGE_TRANFORMER: TextMatchTransformer = { @@ -31,9 +33,13 @@ const IMAGE_TRANFORMER: TextMatchTransformer = { }, }; +const CHECK_LIST_TRANSFORMER: ElementTransformer = CHECK_LIST; +CHECK_LIST_TRANSFORMER.regExp = /^(\s*)(?:-)?\s?(\[(\s|x)?\])\s/i; + // Register all transformers here const MARKDOWN_TRANFORMS: typeof LEXICAL_TRANSFORMERS = [ IMAGE_TRANFORMER, + CHECK_LIST_TRANSFORMER, ...LEXICAL_TRANSFORMERS, ];