@jx3box/jx3box-editor 0.9.8 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/markdown.less +3 -0
- package/package.json +1 -1
- package/src/Markdown.vue +24 -4
package/assets/css/markdown.less
CHANGED
package/package.json
CHANGED
package/src/Markdown.vue
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
<slot name="prepend"></slot>
|
|
5
5
|
|
|
6
6
|
<div class="c-editor-header">
|
|
7
|
-
<Upload v-if="attachmentEnable" @insert="insertAttachments" :enable="
|
|
7
|
+
<Upload v-if="attachmentEnable" @insert="insertAttachments" :enable="true" />
|
|
8
8
|
<Resource v-if="resourceEnable" @insert="insertResource" :enable="false" />
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
11
|
<slot></slot>
|
|
12
12
|
|
|
13
|
-
<mavon-editor class="c-markdown" ref="md" v-model="data" :editable="editable" :navigation="false" @change="updateData" :subfield="false" :readOnly="
|
|
13
|
+
<mavon-editor class="c-markdown" ref="md" v-model="data" :editable="editable" :navigation="false" @change="updateData" :subfield="false" :readOnly="readOnly">
|
|
14
14
|
<template slot="left-toolbar-after">
|
|
15
15
|
<span class="c-markdown-toolbar-image c-markdown-toolbar-item" title="上传图片" @click="selectImages"><i class="el-icon-picture-outline-round"></i></span>
|
|
16
16
|
<span class="c-markdown-toolbar-file c-markdown-toolbar-item" title="上传附件" @click="selectFiles"><i class="el-icon-paperclip"></i></span>
|
|
@@ -45,6 +45,10 @@ export default {
|
|
|
45
45
|
type: Boolean,
|
|
46
46
|
default: true,
|
|
47
47
|
},
|
|
48
|
+
readOnly : {
|
|
49
|
+
type : Boolean,
|
|
50
|
+
default : false,
|
|
51
|
+
}
|
|
48
52
|
},
|
|
49
53
|
components: {
|
|
50
54
|
Upload,
|
|
@@ -165,8 +169,24 @@ export default {
|
|
|
165
169
|
},
|
|
166
170
|
// 插入附件
|
|
167
171
|
insertAttachments: function(data) {
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
let list = data?.list || []
|
|
173
|
+
for(let item of list){
|
|
174
|
+
// 插入图片
|
|
175
|
+
if (item.is_img) {
|
|
176
|
+
this.$md.insertText(this.$md.getTextareaDom(), {
|
|
177
|
+
prefix: ``,
|
|
178
|
+
subfix: "",
|
|
179
|
+
str: "",
|
|
180
|
+
});
|
|
181
|
+
// 插入文字链接
|
|
182
|
+
} else {
|
|
183
|
+
this.$md.insertText(this.$md.getTextareaDom(), {
|
|
184
|
+
prefix: `[${item.name}](${item.url})`,
|
|
185
|
+
subfix: "",
|
|
186
|
+
str: "",
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
170
190
|
},
|
|
171
191
|
insertResource: function(data) {
|
|
172
192
|
// TODO:
|