diff --git a/assets/scripts/editor.js b/assets/scripts/editor.js index 468967c..7306c77 100644 --- a/assets/scripts/editor.js +++ b/assets/scripts/editor.js @@ -111,10 +111,11 @@ let app = new Vue({ // 图片上传结束 uploaded(response, file, fileList) { if (response.success) { - // 上传成功 + // 上传成功,获取光标 const cursor = this.editor.getCursor(); const imageUrl = response.data.url const markdownImage = `![](${imageUrl})` + // 将 Markdown 形式的 URL 插入编辑框光标所在位置 this.editor.replaceSelection(`\n${markdownImage}\n`, cursor); this.refresh(); diff --git a/index.html b/index.html index e6e0042..a9ca8b4 100644 --- a/index.html +++ b/index.html @@ -34,9 +34,10 @@