2023-07-09 08:55:56 +05:30
|
|
|
import { Node, mergeAttributes } from '@tiptap/core';
|
2021-11-11 11:23:49 +05:30
|
|
|
|
|
|
|
export default Node.create({
|
|
|
|
name: 'figure',
|
|
|
|
content: 'block+',
|
|
|
|
group: 'block',
|
|
|
|
defining: true,
|
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
addOptions() {
|
|
|
|
return {
|
|
|
|
HTMLAttributes: {
|
|
|
|
dir: 'auto',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
parseHTML() {
|
|
|
|
return [{ tag: 'figure' }];
|
|
|
|
},
|
|
|
|
|
|
|
|
renderHTML({ HTMLAttributes }) {
|
2023-07-09 08:55:56 +05:30
|
|
|
return ['figure', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
2021-11-11 11:23:49 +05:30
|
|
|
},
|
|
|
|
});
|