Skip to content

Commit

Permalink
Add CheckListTransformer
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisNivar committed Jan 24, 2024
1 parent 503a2fd commit de08694
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -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,
];

Expand Down

0 comments on commit de08694

Please sign in to comment.