mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: video not rendering — add TipTap Video extension, allow HTTP src
TipTap didn't recognize <video> tags without a custom node extension, serializing them as escaped text. Also revert video src to allow HTTP since request.base_url returns http:// behind reverse proxy.
This commit is contained in:
30
src/lib/tiptap-video.ts
Normal file
30
src/lib/tiptap-video.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
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: true },
|
||||
class: { default: null },
|
||||
preload: { default: 'metadata' },
|
||||
};
|
||||
},
|
||||
|
||||
parseHTML() {
|
||||
return [{ tag: 'video' }];
|
||||
},
|
||||
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return ['video', mergeAttributes(HTMLAttributes, { controls: '' })];
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user