feat: add Flipcard component support with configuration and styling for enhanced interactivity

This commit is contained in:
swve 2025-09-21 22:25:51 +02:00
parent 0b02bb4a76
commit 98dfad76aa
6 changed files with 465 additions and 0 deletions

View file

@ -0,0 +1,46 @@
import { ReactNodeViewRenderer } from "@tiptap/react";
import { mergeAttributes, Node } from "@tiptap/core";
import FlipcardExtension from "./FlipcardExtension";
export default Node.create({
name: "flipcard",
group: "block",
draggable: true,
content: "text*",
addAttributes() {
return {
question: {
default: 'Click to reveal the answer',
},
answer: {
default: 'This is the answer',
},
color: {
default: 'blue',
},
alignment: {
default: 'center',
},
size: {
default: 'medium',
},
};
},
parseHTML() {
return [
{
tag: "flipcard-block",
},
];
},
renderHTML({ HTMLAttributes }) {
return ["flipcard-block", mergeAttributes(HTMLAttributes), 0];
},
addNodeView() {
return ReactNodeViewRenderer(FlipcardExtension);
},
});