mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
29 lines
589 B
TypeScript
29 lines
589 B
TypeScript
import { mergeAttributes, Node } from "@tiptap/core";
|
|
import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
|
|
import InfoCalloutComponent from "./InfoCalloutComponent";
|
|
|
|
export default Node.create({
|
|
name: "calloutInfo",
|
|
group: "block",
|
|
draggable: true,
|
|
content: "text*",
|
|
|
|
// TODO : multi line support
|
|
|
|
parseHTML() {
|
|
return [
|
|
{
|
|
tag: "callout-info",
|
|
},
|
|
];
|
|
},
|
|
|
|
renderHTML({ HTMLAttributes }) {
|
|
return ["callout-info", mergeAttributes(HTMLAttributes), 0];
|
|
},
|
|
|
|
addNodeView() {
|
|
return ReactNodeViewRenderer(InfoCalloutComponent);
|
|
},
|
|
});
|