21 lines
536 B
JavaScript
21 lines
536 B
JavaScript
import { Quill } from "@vueup/vue-quill";
|
|
let BlockEmbed = Quill.import("blots/block/embed");
|
|
class ImageBlot extends BlockEmbed {
|
|
static create(value) {
|
|
let node = super.create();
|
|
node.setAttribute("src", value.url);
|
|
node.setAttribute("id", value.id);
|
|
return node;
|
|
}
|
|
|
|
static value(node) {
|
|
return {
|
|
url: node.getAttribute("src"),
|
|
id: node.getAttribute("id")
|
|
};
|
|
}
|
|
}
|
|
ImageBlot.blotName = "image";
|
|
ImageBlot.tagName = "img";
|
|
export default ImageBlot;
|