From bbc4974d5c325e1a1d4ee41827ec6bfda7a38684 Mon Sep 17 00:00:00 2001 From: Petyo Ivanov Date: Thu, 7 Dec 2023 09:12:27 +0200 Subject: [PATCH] fix: decrease priority for jsx compared to HTML Fixes #223 --- src/examples/jsx.tsx | 17 +++++++++++++++++ src/plugins/jsx/LexicalJsxVisitor.ts | 3 ++- src/plugins/jsx/MdastMdxJsxElementVisitor.ts | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/examples/jsx.tsx b/src/examples/jsx.tsx index 50676ee5..7d1de1e0 100644 --- a/src/examples/jsx.tsx +++ b/src/examples/jsx.tsx @@ -7,6 +7,7 @@ import { toolbarPlugin } from '../plugins/toolbar' import { Button } from '../plugins/toolbar/primitives/toolbar' import { NestedLexicalEditor } from '../plugins/core/NestedLexicalEditor' import { MdxJsxTextElement } from 'mdast-util-mdx' +import { headingsPlugin } from '..' const jsxComponentDescriptors: JsxComponentDescriptor[] = [ { @@ -99,3 +100,19 @@ export const Example = () => { /> ) } + +const markdown = ` +# Hello world + +
+ Content +
+` + +export const Html = () => { + return ( +
+ +
+ ) +} diff --git a/src/plugins/jsx/LexicalJsxVisitor.ts b/src/plugins/jsx/LexicalJsxVisitor.ts index 206be35d..05b0b169 100644 --- a/src/plugins/jsx/LexicalJsxVisitor.ts +++ b/src/plugins/jsx/LexicalJsxVisitor.ts @@ -22,5 +22,6 @@ export const LexicalJsxVisitor: LexicalExportVisitor = }, visitNode({ lexicalParent, mdastNode }) { ;(lexicalParent as ElementNode).append($createLexicalJsxNode(mdastNode)) - } + }, + priority: -200 }