import { Node } from 'tiptap' export default class IframeNode extends Node { get name() { return 'iframe' } get schema() { return { attrs: { src: { default: null, }, }, group: 'block', selectable: false, parseDOM: [{ tag: 'iframe', getAttrs: dom => ({ src: dom.getAttribute('src'), }), }], toDOM: node => ['iframe', { src: node.attrs.src, frameborder: 0, allowfullscreen: 'true', }], } } get view() { return { props: ['node', 'updateAttrs', 'editable'], data() { return { url: this.node.attrs.src, } }, methods: { onChange(event) { this.url = event.target.value this.updateAttrs({ src: this.url, }) }, }, template: `
`, } } }