mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add Flipcard component support with configuration and styling for enhanced interactivity
This commit is contained in:
parent
0b02bb4a76
commit
98dfad76aa
6 changed files with 465 additions and 0 deletions
|
|
@ -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);
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue