mirror of
https://github.com/docmost/docmost.git
synced 2025-11-12 17:22:37 +10:00
feat: emoji callout icon (#1323)
This commit is contained in:
@ -18,6 +18,10 @@ export interface CalloutAttributes {
|
||||
* The type of callout.
|
||||
*/
|
||||
type: CalloutType;
|
||||
/**
|
||||
* The custom icon name for the callout.
|
||||
*/
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
declare module "@tiptap/core" {
|
||||
@ -27,6 +31,7 @@ declare module "@tiptap/core" {
|
||||
unsetCallout: () => ReturnType;
|
||||
toggleCallout: (attributes?: CalloutAttributes) => ReturnType;
|
||||
updateCalloutType: (type: CalloutType) => ReturnType;
|
||||
updateCalloutIcon: (icon: string) => ReturnType;
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -58,6 +63,13 @@ export const Callout = Node.create<CalloutOptions>({
|
||||
"data-callout-type": attributes.type,
|
||||
}),
|
||||
},
|
||||
icon: {
|
||||
default: null,
|
||||
parseHTML: (element) => element.getAttribute("data-callout-icon"),
|
||||
renderHTML: (attributes) => ({
|
||||
"data-callout-icon": attributes.icon,
|
||||
}),
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@ -107,6 +119,13 @@ export const Callout = Node.create<CalloutOptions>({
|
||||
commands.updateAttributes("callout", {
|
||||
type: getValidCalloutType(type),
|
||||
}),
|
||||
|
||||
updateCalloutIcon:
|
||||
(icon: string) =>
|
||||
({ commands }) =>
|
||||
commands.updateAttributes("callout", {
|
||||
icon: icon || null,
|
||||
}),
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user