Browse Source

Fix incorrect WYSIWYG image insertion position

Kailash Nadh 5 years ago
parent
commit
3e755596c7
1 changed files with 5 additions and 1 deletions
  1. 5 1
      frontend/src/components/Editor.vue

+ 5 - 1
frontend/src/components/Editor.vue

@@ -193,7 +193,11 @@ export default {
     },
 
     onMediaSelect(m) {
-      this.$refs.quill.quill.insertEmbed(10, 'image', m.url);
+      const sel = this.$refs.quill.quill.getSelection();
+      if (!sel) {
+        return;
+      }
+      this.$refs.quill.quill.insertEmbed(sel.index, 'image', m.url);
     },
   },