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