@jx3box/jx3box-editor 0.9.4 → 0.9.5

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/Markdown.vue +20 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-editor",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "JX3BOX Article & Editor",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "build": "vue-cli-service build",
10
10
  "lint": "vue-cli-service lint",
11
11
  "inspect": "vue inspect > output.js",
12
- "update": "npm --registry https://registry.npmjs.org install @jx3box/jx3box-common@latest @jx3box/jx3box-macro@latest @jx3box/jx3box-talent@latest @jx3box/jx3box-emotion@latest @jx3box/jx3box-data@latest",
12
+ "update": "npm --registry https://registry.npmjs.org install @jx3box/jx3box-common@latest @jx3box/jx3box-macro@latest @jx3box/jx3box-talent@latest @jx3box/jx3box-emotion@latest @jx3box/jx3box-data@latest @jx3box/markdown@latest",
13
13
  "article": "vue-cli-service build --target lib --name jx3box_article src/Article.vue --mode production",
14
14
  "tinymce": "vue-cli-service build --target lib --name tinymce src/Tinymce.vue && cp public/tinymce.html dist/tinymce.html"
15
15
  },
@@ -36,7 +36,7 @@
36
36
  "@jx3box/jx3box-emotion": "^1.0.10",
37
37
  "@jx3box/jx3box-macro": "^1.0.1",
38
38
  "@jx3box/jx3box-talent": "^1.1.2",
39
- "@jx3box/markdown": "0.0.5",
39
+ "@jx3box/markdown": "0.0.7",
40
40
  "@tinymce/tinymce-vue": "^3.2.2",
41
41
  "axios": "^0.19.2",
42
42
  "core-js": "^3.6.5",
package/src/Markdown.vue CHANGED
@@ -2,7 +2,7 @@
2
2
  <div class="c-markdown">
3
3
  <input class="c-markdown-store-item" id="c-markdown-store-images" type="file" @change="uploadImages" ref="markdownImages" multiple :accept="allow_image_types" />
4
4
  <input class="c-markdown-store-item" id="c-markdown-store-files" type="file" @change="uploadFiles" ref="markdownFiles" multiple />
5
- <mavon-editor class="c-markdown-box" ref="md" v-model="data" :editable="true" :navigation="false">
5
+ <mavon-editor class="c-markdown-box" ref="md" v-model="data" :editable="editable" :navigation="false" @change="updateData">
6
6
  <template slot="left-toolbar-after">
7
7
  <span class="c-markdown-toolbar-image c-markdown-toolbar-item" title="上传图片" @click="selectImages"><i class="el-icon-picture-outline-round"></i></span>
8
8
  <span class="c-markdown-toolbar-file c-markdown-toolbar-item" title="上传附件" @click="selectFiles"><i class="el-icon-paperclip"></i></span>
@@ -52,24 +52,13 @@ export default {
52
52
  },
53
53
  },
54
54
  computed: {
55
- // 将fileList类数组转为标准数组
56
- // images_list: function() {
57
- // let images = Array.from(this.images);
58
- // let _images = [];
59
- // for (let item of images) {
60
- // if (this.allow_image_types.includes(item.type)) {
61
- // _images.push(item);
62
- // }
63
- // }
64
- // return _images;
65
- // },
66
55
  files_list: function() {
67
56
  let files = Array.from(this.files);
68
57
  return files;
69
58
  },
70
- $md : function (){
71
- return this.$refs.md
72
- }
59
+ $md: function() {
60
+ return this.$refs.md;
61
+ },
73
62
  },
74
63
  methods: {
75
64
  // 点击上传按钮
@@ -108,12 +97,12 @@ export default {
108
97
  this.resolved_files.push({
109
98
  url: url,
110
99
  filename: list[i]["name"],
111
- type : list[i]['type'],
112
- ext : list[i]["name"].split('.').pop()
100
+ type: list[i]["type"],
101
+ ext: list[i]["name"].split(".").pop(),
113
102
  });
114
103
  }
115
104
  });
116
- this.insertFiles()
105
+ this.insertFiles();
117
106
  })
118
107
  .finally(() => {
119
108
  // 上传完成后清空input
@@ -123,17 +112,17 @@ export default {
123
112
  });
124
113
  },
125
114
  // 插入正文
126
- insertFiles : function (){
127
- for(let item of this.resolved_files){
115
+ insertFiles: function() {
116
+ for (let item of this.resolved_files) {
128
117
  // 插入图片
129
- if(this.image_ext.includes(item.ext)){
118
+ if (this.image_ext.includes(item.ext)) {
130
119
  this.$md.insertText(this.$md.getTextareaDom(), {
131
120
  prefix: `![${item.filename}](${item.url})`,
132
121
  subfix: "",
133
122
  str: "",
134
123
  });
135
- // 插入文字链接
136
- }else{
124
+ // 插入文字链接
125
+ } else {
137
126
  this.$md.insertText(this.$md.getTextareaDom(), {
138
127
  prefix: `[${item.filename}](${item.url})`,
139
128
  subfix: "",
@@ -141,8 +130,14 @@ export default {
141
130
  });
142
131
  }
143
132
  }
144
- }
145
-
133
+ },
134
+ // 更新触发
135
+ updateData: function(data, render) {
136
+ this.$emit("updateData", {
137
+ data,
138
+ render,
139
+ });
140
+ },
146
141
  },
147
142
  filters: {},
148
143
  created: function() {},