mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
- Use DOMPurify(window) to avoid global hook pollution - Fix controls default from boolean to empty string (HTML attribute semantics) - Remove redundant non-null assertion on featured_image_url
31 lines
678 B
TypeScript
31 lines
678 B
TypeScript
import { Node, mergeAttributes } from '@tiptap/core';
|
|
|
|
/**
|
|
* TipTap extension for inline <video> elements.
|
|
*
|
|
* Without this extension, TipTap does not recognize <video> tags and
|
|
* serializes them as escaped text when calling editor.getHTML().
|
|
*/
|
|
export const VideoExtension = Node.create({
|
|
name: 'video',
|
|
group: 'block',
|
|
atom: true,
|
|
|
|
addAttributes() {
|
|
return {
|
|
src: { default: null },
|
|
controls: { default: '' },
|
|
class: { default: null },
|
|
preload: { default: 'metadata' },
|
|
};
|
|
},
|
|
|
|
parseHTML() {
|
|
return [{ tag: 'video' }];
|
|
},
|
|
|
|
renderHTML({ HTMLAttributes }) {
|
|
return ['video', mergeAttributes(HTMLAttributes)];
|
|
},
|
|
});
|