diff --git a/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/external.html index 49b9ce6858..bc3cb38f5c 100644 --- a/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/external.html +++ b/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/external.html @@ -1 +1 @@ -

This is text with a custom fontSize

\ No newline at end of file +

This is text with a custom fontSize

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html b/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html index 3fe864246c..717b1ad7d4 100644 --- a/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html +++ b/packages/core/src/api/exporters/html/__snapshots__/fontSize/basic/internal.html @@ -1 +1 @@ -

This is text with a custom fontSize

\ No newline at end of file +

This is text with a custom fontSize

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/mention/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/mention/basic/external.html index 2e6f533ca1..dbec651469 100644 --- a/packages/core/src/api/exporters/html/__snapshots__/mention/basic/external.html +++ b/packages/core/src/api/exporters/html/__snapshots__/mention/basic/external.html @@ -1 +1 @@ -

I enjoy working with@Matthew

\ No newline at end of file +

I enjoy working with@Matthew

\ No newline at end of file diff --git a/packages/core/src/api/exporters/html/__snapshots__/small/basic/external.html b/packages/core/src/api/exporters/html/__snapshots__/small/basic/external.html index 35c3d5c232..50ef98b2ce 100644 --- a/packages/core/src/api/exporters/html/__snapshots__/small/basic/external.html +++ b/packages/core/src/api/exporters/html/__snapshots__/small/basic/external.html @@ -1 +1 @@ -

This is a small text

\ No newline at end of file +

This is a small text

\ No newline at end of file diff --git a/packages/core/src/extensions/Blocks/api/inlineContent/createSpec.ts b/packages/core/src/extensions/Blocks/api/inlineContent/createSpec.ts index 7408ab81bc..ca2989c899 100644 --- a/packages/core/src/extensions/Blocks/api/inlineContent/createSpec.ts +++ b/packages/core/src/extensions/Blocks/api/inlineContent/createSpec.ts @@ -49,7 +49,15 @@ export function getInlineContentParseRules( return [ { tag: `[data-inline-content-type="${config.type}"]`, - contentElement: "[data-editable]", + contentElement: (element) => { + const htmlElement = element as HTMLElement; + + if (htmlElement.matches("[data-editable]")) { + return htmlElement; + } + + return htmlElement.querySelector("[data-editable]") || htmlElement; + }, }, ]; } @@ -65,10 +73,11 @@ export function createInlineContentSpec< name: inlineContentConfig.type, inline: true, group: "inline", - content: - inlineContentConfig.content === "styled" - ? "inline*" - : ("inline" as T["content"] extends "styled" ? "inline*" : "inline"), + selectable: inlineContentConfig.content === "styled", + atom: inlineContentConfig.content === "none", + content: (inlineContentConfig.content === "styled" + ? "inline*" + : "") as T["content"] extends "styled" ? "inline*" : "", addAttributes() { return propsToAttributes(inlineContentConfig.propSchema); diff --git a/packages/core/src/extensions/Blocks/api/styles/createSpec.ts b/packages/core/src/extensions/Blocks/api/styles/createSpec.ts index 5f69980656..49015a30df 100644 --- a/packages/core/src/extensions/Blocks/api/styles/createSpec.ts +++ b/packages/core/src/extensions/Blocks/api/styles/createSpec.ts @@ -26,7 +26,15 @@ export function getStyleParseRules(config: StyleConfig): ParseRule[] { return [ { tag: `[data-style-type="${config.type}"]`, - contentElement: "[data-editable]", + contentElement: (element) => { + const htmlElement = element as HTMLElement; + + if (htmlElement.matches("[data-editable]")) { + return htmlElement; + } + + return htmlElement.querySelector("[data-editable]") || htmlElement; + }, }, ]; } diff --git a/packages/react/src/test/__snapshots__/fontSize/basic/external.html b/packages/react/src/test/__snapshots__/fontSize/basic/external.html index 6c8910692f..0271307b91 100644 --- a/packages/react/src/test/__snapshots__/fontSize/basic/external.html +++ b/packages/react/src/test/__snapshots__/fontSize/basic/external.html @@ -1 +1 @@ -

This is text with a custom fontSize

\ No newline at end of file +

This is text with a custom fontSize

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/fontSize/basic/internal.html b/packages/react/src/test/__snapshots__/fontSize/basic/internal.html index 998d9bcf8b..4b0f00259b 100644 --- a/packages/react/src/test/__snapshots__/fontSize/basic/internal.html +++ b/packages/react/src/test/__snapshots__/fontSize/basic/internal.html @@ -1 +1 @@ -

This is text with a custom fontSize

\ No newline at end of file +

This is text with a custom fontSize

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/mention/basic/external.html b/packages/react/src/test/__snapshots__/mention/basic/external.html index 2e6f533ca1..dbec651469 100644 --- a/packages/react/src/test/__snapshots__/mention/basic/external.html +++ b/packages/react/src/test/__snapshots__/mention/basic/external.html @@ -1 +1 @@ -

I enjoy working with@Matthew

\ No newline at end of file +

I enjoy working with@Matthew

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/mention/basic/internal.html b/packages/react/src/test/__snapshots__/mention/basic/internal.html index 6ca7d81c2c..3e00d69a9c 100644 --- a/packages/react/src/test/__snapshots__/mention/basic/internal.html +++ b/packages/react/src/test/__snapshots__/mention/basic/internal.html @@ -1 +1 @@ -

I enjoy working with@Matthew

\ No newline at end of file +

I enjoy working with@Matthew

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/basic/internal.html b/packages/react/src/test/__snapshots__/reactCustomParagraph/basic/internal.html index edde3826ef..c9e89afa27 100644 --- a/packages/react/src/test/__snapshots__/reactCustomParagraph/basic/internal.html +++ b/packages/react/src/test/__snapshots__/reactCustomParagraph/basic/internal.html @@ -1 +1 @@ -

React Custom Paragraph

\ No newline at end of file +

React Custom Paragraph

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/internal.html b/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/internal.html index faec73f053..a1c64daac7 100644 --- a/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/internal.html +++ b/packages/react/src/test/__snapshots__/reactCustomParagraph/nested/internal.html @@ -1 +1 @@ -

React Custom Paragraph

Nested React Custom Paragraph 1

Nested React Custom Paragraph 2

\ No newline at end of file +

React Custom Paragraph

Nested React Custom Paragraph 1

Nested React Custom Paragraph 2

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/internal.html b/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/internal.html index dd2e249332..eebeaab1cb 100644 --- a/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/internal.html +++ b/packages/react/src/test/__snapshots__/reactCustomParagraph/styled/internal.html @@ -1 +1 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file +

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/external.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/external.html index a12e18e1e3..e60c23faa1 100644 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/external.html +++ b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/external.html @@ -1 +1 @@ -

React Custom Paragraph

\ No newline at end of file +

React Custom Paragraph

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/internal.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/internal.html index ef4a1496c0..10e606f71a 100644 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/internal.html +++ b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/basic/internal.html @@ -1 +1 @@ -

React Custom Paragraph

\ No newline at end of file +

React Custom Paragraph

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/external.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/external.html index f34364cb2a..a8354335ca 100644 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/external.html +++ b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/external.html @@ -1 +1 @@ -

Custom React Paragraph

Nested React Custom Paragraph 1

Nested React Custom Paragraph 2

\ No newline at end of file +

Custom React Paragraph

Nested React Custom Paragraph 1

Nested React Custom Paragraph 2

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/internal.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/internal.html index b036c67a6d..17437945b5 100644 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/internal.html +++ b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/nested/internal.html @@ -1 +1 @@ -

Custom React Paragraph

Nested React Custom Paragraph 1

Nested React Custom Paragraph 2

\ No newline at end of file +

Custom React Paragraph

Nested React Custom Paragraph 1

Nested React Custom Paragraph 2

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/external.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/external.html index df6c3a0e11..970057fffe 100644 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/external.html +++ b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/external.html @@ -1 +1 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file +

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/internal.html b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/internal.html index fdc04d2f52..4d9598bcca 100644 --- a/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/internal.html +++ b/packages/react/src/test/__snapshots__/simpleReactCustomParagraph/styled/internal.html @@ -1 +1 @@ -

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file +

Plain Red Text Blue Background Mixed Colors

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/small/basic/external.html b/packages/react/src/test/__snapshots__/small/basic/external.html index 35c3d5c232..50ef98b2ce 100644 --- a/packages/react/src/test/__snapshots__/small/basic/external.html +++ b/packages/react/src/test/__snapshots__/small/basic/external.html @@ -1 +1 @@ -

This is a small text

\ No newline at end of file +

This is a small text

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/small/basic/internal.html b/packages/react/src/test/__snapshots__/small/basic/internal.html index 73836f647d..2c4b0446df 100644 --- a/packages/react/src/test/__snapshots__/small/basic/internal.html +++ b/packages/react/src/test/__snapshots__/small/basic/internal.html @@ -1 +1 @@ -

This is a small text

\ No newline at end of file +

This is a small text

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/tag/basic/external.html b/packages/react/src/test/__snapshots__/tag/basic/external.html index b8387e9a55..c243b63eb2 100644 --- a/packages/react/src/test/__snapshots__/tag/basic/external.html +++ b/packages/react/src/test/__snapshots__/tag/basic/external.html @@ -1 +1 @@ -

I love #BlockNote

\ No newline at end of file +

I love #BlockNote

\ No newline at end of file diff --git a/packages/react/src/test/__snapshots__/tag/basic/internal.html b/packages/react/src/test/__snapshots__/tag/basic/internal.html index bac28633b0..dcb80c2f33 100644 --- a/packages/react/src/test/__snapshots__/tag/basic/internal.html +++ b/packages/react/src/test/__snapshots__/tag/basic/internal.html @@ -1 +1 @@ -

I love #BlockNote

\ No newline at end of file +

I love #BlockNote

\ No newline at end of file