@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.
@@ -13,6 +13,9 @@
13
13
 
14
14
  .c-markdown{
15
15
  .h(780px);
16
+ .v-note-wrapper{
17
+ .h(780px);
18
+ }
16
19
  }
17
20
 
18
21
  .c-markdown-toolbar-item {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-editor",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "description": "JX3BOX Article & Editor",
5
5
  "main": "index.js",
6
6
  "scripts": {
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="false" />
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="false">
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
- // TODO:
169
- // tinyMCE.editors["tinymce"].insertContent(data.html);
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: `![${item.name}](${item.url})`,
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: