rhino-editor
Version:
A custom element wrapped rich text editor
55 lines (52 loc) • 1.06 kB
JavaScript
import {
findAttribute
} from "./chunk-4PTK2Z3Z.js";
// src/exports/extensions/image.ts
import { Node, mergeAttributes } from "@tiptap/core";
var Image = Node.create({
name: "attachment-image",
selectable: false,
draggable: false,
group: "block",
addOptions() {
return {
HTMLAttributes: {}
};
},
addAttributes() {
return {
src: {
default: "",
parseHTML: (element) => findAttribute(element, "url")
},
height: {
default: "",
parseHTML: (element) => findAttribute(element, "height")
},
width: {
default: "",
parseHTML: (element) => findAttribute(element, "width")
},
attachmentId: {
default: null
}
};
},
parseHTML() {
return [
{
tag: "figure[data-trix-attachment] img[src]"
}
];
},
renderHTML({ HTMLAttributes }) {
return [
"img",
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)
];
}
});
export {
Image
};
//# sourceMappingURL=chunk-ICMESUON.js.map