UNPKG

rhino-editor

Version:

A custom element wrapped rich text editor

58 lines (55 loc) 1.07 kB
import { findAttribute } from "./chunk-DM4WISIL.js"; import { Node, mergeAttributes } from "./chunk-TVRRLXKH.js"; // src/exports/extensions/image.ts 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-2TUJN2ZR.js.map