askbot-dragon 1.3.84 → 1.3.86

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.3.84",
3
+ "version": "1.3.86",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -757,7 +757,7 @@ import { forMatTime } from "./utils/format_date";
757
757
  let that
758
758
  import {multipartUpload,ossFileUrl} from "./utils/AliyunIssUtil";
759
759
  import {MyCustomUploadAdapterPlugin} from "./utils/ckeditor";
760
- import MyimageUpload from './utils/ckeditorImageUpload/plugin-image'
760
+ // import MyimageUpload from './utils/ckeditorImageUpload/plugin-image'
761
761
  import MyFileUpload from './utils/ckeditorfileUpload/plugin_file'
762
762
  import CKEDITOR from 'ckeditor'
763
763
 
@@ -853,9 +853,8 @@ export default {
853
853
  ckeditor: {
854
854
  editor: CKEDITOR.ClassicEditor,
855
855
  editorConfig: {
856
- extraPlugins: [MyimageUpload,MyFileUpload,MyCustomUploadAdapterPlugin],
856
+ extraPlugins: [MyFileUpload,MyCustomUploadAdapterPlugin],
857
857
  toolbar: [
858
- 'MyimageUpload',
859
858
  'MyFileUpload'
860
859
  ]
861
860
  },
@@ -24,9 +24,9 @@
24
24
  <div v-show="fileType == 'VIDEO'" style="width: 100%;height: calc(100% - 70px)">
25
25
  <video :src="url" controls width="100%;" height="98%"></video>
26
26
  </div>
27
- <div style="width: 100%;height: calc(100% - 70px)" v-show="fileType !== 'VIDEO' && fileType !== 'OTHER' && (url.includes('https://www') || url.includes('http://www') || fileType == 'HTML')">
27
+ <div style="width: 100%;height: calc(100% - 70px)" v-show="fileType !== 'VIDEO' && fileType !== 'OTHER' && (url.includes('https://www') || url.includes('http://www'))">
28
28
  <iframe class="preview_iframe"
29
- :src="fileType !== 'VIDEO' && fileType !== 'OTHER' && (url.includes('https://www') || url.includes('http://www') || fileType == 'HTML') ? url : ''"
29
+ :src="fileType !== 'VIDEO' && fileType !== 'OTHER' && (url.includes('https://www') || url.includes('http://www')) ? url : ''"
30
30
  width="100%"
31
31
  height="100%"
32
32
  scrolling="100%"
@@ -19,7 +19,7 @@ export default class FileCommand extends Command {
19
19
  this.forEachFiles(file.file)
20
20
  return
21
21
  }
22
- var inputObj = document.createElement('input')
22
+ let inputObj = document.createElement('input')
23
23
  inputObj.setAttribute('id', '_ef');
24
24
  inputObj.setAttribute('type', 'file');
25
25
  inputObj.setAttribute('accept','*')
@@ -31,34 +31,56 @@ export default class FileCommand extends Command {
31
31
  let files = inputObj.files;
32
32
  for (let index = 0; index < files.length; index++) {
33
33
  const filed = files[index];
34
- let uid = uuidv4()
35
34
  let command = this.editor.commands.get("insertAskComponent");
36
- command.execute({
37
- tag: "span-editable",
38
- options: {
39
- name: filed.name,
40
- data: uid,
41
- editable:false,
42
- type:'FileUpload'
43
- },
44
- })
45
- this.upload(filed).then(res =>{
46
- // 需要回调通知父组件 上传成功
47
- let data = JSON.stringify({
48
- id: uid,
49
- default:res.default
35
+ if(filed.type.includes('image')) {
36
+ command.execute({
37
+ tag: "span-editable",
38
+ options: {
39
+ name: filed.name + '正在上传...',
40
+ data: index,
41
+ editable:false,
42
+ type:'upload'
43
+ },
50
44
  })
45
+ this.upload(filed).then(res =>{
46
+ command.execute({
47
+ tag: "img",
48
+ options: {
49
+ width:'100%',
50
+ alt: filed.name + index,
51
+ src: res.default
52
+ },
53
+ });
54
+ })
55
+ } else {
56
+ let uid = uuidv4()
51
57
  command.execute({
52
58
  tag: "span-editable",
53
59
  options: {
54
60
  name: filed.name,
55
- data: data ,
61
+ data: uid,
56
62
  editable:false,
57
- type:'MyFile'
63
+ type:'FileUpload'
58
64
  },
59
- // src: res.default
60
65
  })
61
- })
66
+ this.upload(filed).then(res =>{
67
+ // 需要回调通知父组件 上传成功
68
+ let data = JSON.stringify({
69
+ id: uid,
70
+ default:res.default
71
+ })
72
+ command.execute({
73
+ tag: "span-editable",
74
+ options: {
75
+ name: filed.name,
76
+ data: data ,
77
+ editable:false,
78
+ type:'MyFile'
79
+ },
80
+ })
81
+ })
82
+ }
83
+
62
84
  }
63
85
  }
64
86
  }
@@ -15,7 +15,7 @@ export default class BoldToolbarUI extends Plugin {
15
15
  editor.ui.componentFactory.add('MyFileUpload', (locale) => {
16
16
  const view = new ButtonView(locale);
17
17
  view.set({
18
- label: '上传附件',
18
+ label: '上传图片或附件',
19
19
  tooltip: true,
20
20
  withText: true, // 在按钮上展示 label
21
21
  // icon:`<svg t="1674962541538" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="30473" width="14" height="14"><path d="M81.92 432.64L0 732.672V156.672C0 126.976 24.064 102.4 54.272 102.4h256c14.336 0 27.648 5.632 38.4 15.872l110.08 110.08c2.048 2.048 4.608 3.072 7.68 3.072h385.024c29.696 0 54.272 24.064 54.272 54.272v75.776H176.128c-44.544 0-82.944 28.672-94.208 71.168z m931.328-7.168c-9.728-13.824-26.112-20.992-43.008-20.992H175.616c-24.064 0-45.568 16.384-51.712 39.936L12.288 852.992c-7.68 28.672 8.704 58.368 37.888 66.048 4.608 1.024 9.216 2.048 14.336 2.048h794.112c24.064 0 45.568-16.384 51.712-39.936l111.616-409.088c4.608-16.384 1.024-33.28-8.704-46.592z" p-id="30474"></path></svg>`,