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
This is text with a custom fontSize
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
This is text with a custom fontSize
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
I enjoy working with@Matthew
React Custom Paragraph
React Custom Paragraph
React Custom Paragraph
Nested React Custom Paragraph 1
Nested React Custom Paragraph 2
React Custom Paragraph
Nested React Custom Paragraph 1
Nested React Custom Paragraph 2
Plain Red Text Blue Background Mixed Colors
Plain Red Text Blue Background Mixed Colors
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
React Custom Paragraph
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
Custom React Paragraph
Nested React Custom Paragraph 1
Nested React Custom Paragraph 2
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
Plain Red Text Blue Background Mixed Colors
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
This is a small text
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
I love #BlockNote