fix: change html tag name for callout (#5924)

This commit is contained in:
Aaryan Khandelwal 2024-10-29 14:12:12 +05:30 committed by GitHub
parent b67f352b90
commit b4bbe3a8ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 205 additions and 6 deletions

View file

@ -58,11 +58,15 @@ export const CustomCalloutExtensionConfig = Node.create({
},
parseHTML() {
return [{ tag: "callout-component" }];
return [
{
tag: `div[${EAttributeNames.BLOCK_TYPE}="${DEFAULT_CALLOUT_BLOCK_ATTRIBUTES[EAttributeNames.BLOCK_TYPE]}"]`,
},
];
},
// Render HTML for the callout node
renderHTML({ HTMLAttributes }) {
return ["callout-component", mergeAttributes(HTMLAttributes), 0];
return ["div", mergeAttributes(HTMLAttributes), 0];
},
});

View file

@ -5,6 +5,7 @@ export enum EAttributeNames {
EMOJI_URL = "data-emoji-url",
LOGO_IN_USE = "data-logo-in-use",
BACKGROUND = "data-background",
BLOCK_TYPE = "data-block-type",
}
export type TCalloutBlockIconAttributes = {
@ -20,5 +21,6 @@ export type TCalloutBlockEmojiAttributes = {
export type TCalloutBlockAttributes = {
[EAttributeNames.LOGO_IN_USE]: "emoji" | "icon";
[EAttributeNames.BACKGROUND]: string;
[EAttributeNames.BLOCK_TYPE]: "callout-component";
} & TCalloutBlockIconAttributes &
TCalloutBlockEmojiAttributes;

View file

@ -17,6 +17,7 @@ export const DEFAULT_CALLOUT_BLOCK_ATTRIBUTES: TCalloutBlockAttributes = {
"data-emoji-unicode": "128161",
"data-emoji-url": "https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64/1f4a1.png",
"data-background": null,
"data-block-type": "callout-component",
};
type TStoredLogoValue = Pick<TCalloutBlockAttributes, EAttributeNames.LOGO_IN_USE> &