debian-mirror-gitlab/app/assets/javascripts/content_editor/extensions/figure.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
443 B
JavaScript
Raw Normal View History

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
},
});