diff --git a/src/components/VueEditor.vue b/src/components/VueEditor.vue index 5cd4592..66fe072 100755 --- a/src/components/VueEditor.vue +++ b/src/components/VueEditor.vue @@ -167,12 +167,27 @@ export default { else if (range && !oldRange) this.$emit("focus", this.quill); }, - handleTextChange() { + handleTextChange(delta, oldContents) { let editorContent = this.quill.getHTML() === "


" ? "" : this.quill.getHTML(); this.$emit("input", editorContent); + + if (this.useCustomImageHandler) + this.handleImageRemoved(delta, oldContents); }, + handleImageRemoved(delta, oldContents) { + const currrentContents = this.quill.getContents(); + const deletedContents = currrentContents.diff(oldContents); + const operations = deletedContents.ops; + + operations.map(operation => { + if (operation.insert && operation.insert.hasOwnProperty("image")) { + const { image } = operation.insert; + this.$emit("imageRemoved", image); + } + }); + }, checkForCustomImageHandler() { this.useCustomImageHandler === true ? this.setupCustomImageHandler() : ""; },