Commit f78b7789 authored by chenqikuai's avatar chenqikuai

fix: 修复图片链接上传、图片选中

parent 25abfa76
@import './variables.scss'; @import './variables.scss';
.el-tiptap-editor { .el-tiptap-editor {
.ProseMirror-selectednode{
border: 3px solid skyblue;
}
word-wrap: break-word; word-wrap: break-word;
white-space: break-spaces; white-space: break-spaces;
$root: &; $root: &;
......
...@@ -47,6 +47,7 @@ import vue2Dropzone from 'vue2-dropzone' ...@@ -47,6 +47,7 @@ import vue2Dropzone from 'vue2-dropzone'
import 'vue2-dropzone/dist/vue2Dropzone.min.css' import 'vue2-dropzone/dist/vue2Dropzone.min.css'
import FileService from '@/service/FileService/index' import FileService from '@/service/FileService/index'
import { Editor } from '@tiptap/vue-2' import { Editor } from '@tiptap/vue-2'
import { message } from 'ant-design-vue'
export default Vue.extend({ export default Vue.extend({
components: { vueDropzone: vue2Dropzone }, components: { vueDropzone: vue2Dropzone },
...@@ -91,6 +92,10 @@ export default Vue.extend({ ...@@ -91,6 +92,10 @@ export default Vue.extend({
}, },
handleOk(e: Event) { handleOk(e: Event) {
if (this.imageSrc) { if (this.imageSrc) {
if(!this.imageSrc.match(/^https:\/\//)){
message.error('请输入正确的图片链接')
return;
}
this.editor.chain().focus().setImage({ src: this.imageSrc }).run() this.editor.chain().focus().setImage({ src: this.imageSrc }).run()
this.cursorToEnd() this.cursorToEnd()
} else if (this.$refs.myVueDropzone as any) { } else if (this.$refs.myVueDropzone as any) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment