import { Node as t, mergeAttributes as e } from "@tiptap/core"
import { ReactNodeViewRenderer as l } from "@tiptap/react"
import { NODE_ATTR as n } from "../constants.js"
export const FileBase = t.create({
atom: !0,
draggable: !0,
inline() {
return this.options.inline
},
group() {
return this.options.inline ? "inline" : "block"
},
addOptions: { inline: !1, HTMLAttributes: {} },
addAttributes: () => ({
[n.ID]: { default: "" },
src: { default: null },
preview: { default: null },
name: { default: null },
alt: { default: null },
type: { default: null },
title: { default: null },
style: { default: "" },
dimensions: { default: null },
}),
parseHTML() {
return [{ tag: this.name }]
},
renderHTML({ HTMLAttributes: t }) {
return [this.name, e(t)]
},
addNodeView() {
return l(this.options.Component, {
attrs: { style: "display: inline-block; vertical-align: top" },
})
},
})