askbot-dragon 1.6.21-beta → 1.6.21

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 (72) hide show
  1. package/package.json +8 -11
  2. package/public/index.html +9 -8
  3. package/src/assets/image/default_avt_ui.png +0 -0
  4. package/src/assets/image/filtType/audio.png +0 -0
  5. package/src/assets/image/filtType/excel1.png +0 -0
  6. package/src/assets/image/filtType/general.png +0 -0
  7. package/src/assets/image/filtType/image1.png +0 -0
  8. package/src/assets/image/filtType/link.png +0 -0
  9. package/src/assets/image/filtType/md2.png +0 -0
  10. package/src/assets/image/filtType/mode.png +0 -0
  11. package/src/assets/image/filtType/news.png +0 -0
  12. package/src/assets/image/filtType/pdf1.png +0 -0
  13. package/src/assets/image/filtType/ppt1.png +0 -0
  14. package/src/assets/image/filtType/selfadd1.png +0 -0
  15. package/src/assets/image/filtType/txt1.png +0 -0
  16. package/src/assets/image/filtType/video.png +0 -0
  17. package/src/assets/image/filtType/wechat.png +0 -0
  18. package/src/assets/image/filtType/word1.png +0 -0
  19. package/src/assets/image/loading.gif +0 -0
  20. package/src/assets/js/AliyunlssUtil.js +35 -10
  21. package/src/assets/js/common.js +241 -0
  22. package/src/components/ActionAlertIframe.vue +1 -0
  23. package/src/components/AiGuide.vue +7 -4
  24. package/src/components/AnswerDocknowledge.vue +930 -389
  25. package/src/components/ConversationContainer.vue +7111 -1058
  26. package/src/components/MyEditor.vue +342 -0
  27. package/src/components/QwFeedback.vue +303 -0
  28. package/src/components/actionSatisfaction.vue +2 -2
  29. package/src/components/actionSendToBot.vue +2 -2
  30. package/src/components/answerRadio.vue +145 -64
  31. package/src/components/askVideo.vue +3 -6
  32. package/src/components/assetDetails.vue +14 -6
  33. package/src/components/assetMessage.vue +14 -13
  34. package/src/components/associationIntention.vue +31 -6
  35. package/src/components/fielListView.vue +1 -1
  36. package/src/components/file/AliyunOssComponents.vue +1 -1
  37. package/src/components/formTemplate.vue +1590 -1674
  38. package/src/components/imgView.vue +32 -0
  39. package/src/components/intelligentSummary.vue +231 -0
  40. package/src/components/markDownText.vue +198 -0
  41. package/src/components/myPopup.vue +14 -11
  42. package/src/components/pagination.vue +129 -0
  43. package/src/components/pdfPosition.vue +112 -90
  44. package/src/components/popup.vue +8 -7
  45. package/src/components/preview/docView.vue +114 -0
  46. package/src/components/preview/excelView.vue +187 -0
  47. package/src/components/preview/newPositionPreview.vue +370 -0
  48. package/src/components/preview/pdfView.vue +824 -0
  49. package/src/components/previewDoc.vue +6 -0
  50. package/src/components/previewPdf.vue +963 -200
  51. package/src/components/receiverMessagePlatform.vue +25 -21
  52. package/src/components/recommend.vue +2 -2
  53. package/src/components/senderMessagePlatform.vue +21 -13
  54. package/src/components/tree.vue +116 -103
  55. package/src/components/utils/AliyunIssUtil.js +35 -13
  56. package/src/components/utils/ckeditor.js +64 -56
  57. package/src/components/welcomeKnowledgeFile.vue +344 -0
  58. package/src/components/welcomeLlmCard.vue +141 -0
  59. package/src/components/welcomeSuggest.vue +98 -0
  60. package/src/locales/cn.json +62 -0
  61. package/src/locales/en.json +62 -0
  62. package/src/main.js +19 -3
  63. package/vue.config.js +0 -1
  64. package/src/assets/js/obsBrowser.js +0 -63
  65. package/src/components/utils/ckeditorImageUpload/command.js +0 -112
  66. package/src/components/utils/ckeditorImageUpload/editing.js +0 -12
  67. package/src/components/utils/ckeditorImageUpload/plugin-image.js +0 -12
  68. package/src/components/utils/ckeditorImageUpload/toolbar-ui.js +0 -41
  69. package/src/components/utils/ckeditorfileUpload/common.js +0 -175
  70. package/src/components/utils/ckeditorfileUpload/editing.js +0 -12
  71. package/src/components/utils/ckeditorfileUpload/plugin_file.js +0 -12
  72. package/src/components/utils/ckeditorfileUpload/toolbar_ui.js +0 -35
@@ -0,0 +1,141 @@
1
+ <template>
2
+ <div class="message_list-welcome-m">
3
+ <div class="mlwm-title" v-if="msgContent.enableTitle">{{ msgContent.title }}</div>
4
+ <div class="mlwm-des" v-if="msgContent.enableDescription">
5
+ <span class="mlwm-des-pre">{{ msgContent.description }}</span>
6
+ </div>
7
+ <div class="mlwm-msg-type" v-if="msgContent.enableRadioBtn">
8
+ <div
9
+ v-for="(item, itemIndex) in msgContent.items"
10
+ :key="item.id"
11
+ :class="['mmt-cell', 'mmt-cell-' + itemIndex]"
12
+ @click="clickFun(item)"
13
+ >
14
+ <div class="mmt-cell-img" v-if="msgContent.enableRadioIcon && item.icon">
15
+ <img :src="item.icon" alt srcset />
16
+ </div>
17
+ <div class="mmt-cell-des">
18
+ <span class="mmt-cell-des-title" v-if="msgContent.enableRadioTitle">{{item.title}}</span>
19
+ <span class="mmt-cell-des-detail" v-if="msgContent.enableRadioDesc">{{item.description}}</span>
20
+ </div>
21
+ </div>
22
+ <div v-if="msgContent.items.length % 2 != 0" class="mmt-cell booth_elements"></div>
23
+ </div>
24
+ </div>
25
+ </template>
26
+
27
+ <script>
28
+ export default {
29
+ name: "welcomeLlmCard",
30
+ props: {
31
+ msgContent: {
32
+ type: Object,
33
+ default () {
34
+ return {}
35
+ }
36
+ }
37
+ },
38
+ methods: {
39
+ clickFun (item) {
40
+ this.$emit('llmCardClickFun', item)
41
+ }
42
+ }
43
+ };
44
+ </script>
45
+
46
+ <style scoped lang="less">
47
+ .message_list-welcome-m {
48
+ .mlwm-title {
49
+ font-size: 18px;
50
+ font-weight: 600;
51
+ color: #333333;
52
+ }
53
+ .mlwm-des {
54
+ color: #666666;
55
+ margin-top: 9px;
56
+ font-size: 14px;
57
+ font-weight: 500;
58
+ .mlwm-des-after {
59
+ display: flex;
60
+ align-items: center;
61
+ height: 28px;
62
+ line-height: 28px;
63
+ .mlwm-des-after-cir {
64
+ flex: none;
65
+ width: 6px;
66
+ height: 6px;
67
+ background: #366aff;
68
+ border-radius: 50%;
69
+ margin-right: 6px;
70
+ }
71
+ }
72
+ }
73
+
74
+ .mlwm-msg-type {
75
+ margin-top: 9px;
76
+ .mmt-cell {
77
+ flex: 1;
78
+ padding: 10px;
79
+ background: #f0f4ff;
80
+ border-radius: 8px;
81
+ margin: 8px 0;
82
+ display: flex;
83
+ justify-content: space-between;
84
+ align-items: center;
85
+ cursor: pointer;
86
+ .mmt-cell-img {
87
+ flex: none;
88
+ width: 46px;
89
+ margin-right: 8px;
90
+ img {
91
+ height: 46px;
92
+ width: 46px;
93
+ }
94
+ }
95
+ .mmt-cell-des {
96
+ flex: auto;
97
+ text-align: left;
98
+ display: flex;
99
+ flex-direction: column;
100
+ padding-right: 12px;
101
+ .mmt-cell-des-title {
102
+ font-size: 14px;
103
+ color: #000000;
104
+ font-weight: 600;
105
+ margin-bottom: 6px;
106
+ }
107
+ .mmt-cell-des-detail {
108
+ font-size: 12px;
109
+ display: flex;
110
+ align-items: center;
111
+ .mmt-cell-avatar {
112
+ flex: none;
113
+ width: 20px;
114
+ margin-right: 8px;
115
+ display: flex;
116
+ align-items: center;
117
+ img {
118
+ height: 20px;
119
+ width: 20px;
120
+ border-radius: 50%;
121
+ }
122
+ }
123
+ .mmt-creator-name {
124
+ padding-right: 6px;
125
+ border-right: 1px solid #666666;
126
+ color: #666666;
127
+ }
128
+ .mmt-update-time {
129
+ color: #666666;
130
+ padding-left: 6px;
131
+ }
132
+ }
133
+ }
134
+ }
135
+ .booth_elements {
136
+ background: #FFFFFF;
137
+ cursor: default !important;
138
+ }
139
+ }
140
+ }
141
+ </style>
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <div class="welcome_suggest">
3
+ <div class="title">
4
+ <div class="title_desc">{{ msg.content.problemRecommendationDesc }}</div>
5
+ <div class="title_change_batch" v-if="msg.content.page && msg.content.problemRecommendationValue.length > msg.content.pageCount" @click="changeBatch">
6
+ <i class="iconfont guoran-tongyichicun-huanyipi"></i>
7
+ <span>{{$t('dragonCommon.refresh')}}</span>
8
+ </div>
9
+ </div>
10
+ <div class="content">
11
+ <div
12
+ class="welcome_item"
13
+ v-for="(item,index) in suggestList"
14
+ :key="index"
15
+ @click="handleWelcome(item)"
16
+ >{{ item }}</div>
17
+ </div>
18
+ <div class></div>
19
+ </div>
20
+ </template>
21
+ <script>
22
+ export default {
23
+ props: ["msg"],
24
+ data () {
25
+ return {
26
+ pageCount: 1,
27
+ suggestList: []
28
+ }
29
+ },
30
+ mounted () {
31
+ if(this.msg.content.page) {
32
+ this.changeBatch()
33
+ } else {
34
+ this.suggestList = this.msg.content.problemRecommendationValue
35
+ }
36
+ },
37
+ methods: {
38
+ changeBatch () {
39
+ let msgSuggestList = JSON.parse(JSON.stringify(this.msg.content.problemRecommendationValue))
40
+ this.suggestList = msgSuggestList.splice((this.pageCount - 1) * this.msg.content.pageCount, this.msg.content.pageCount)
41
+ if (this.pageCount == Math.ceil(this.msg.content.problemRecommendationValue.length / this.msg.content.pageCount)) {
42
+ this.pageCount = 1
43
+ } else {
44
+ this.pageCount = this.pageCount + 1
45
+ }
46
+ },
47
+ handleWelcome (item) {
48
+ this.$emit('handleWelcome', item)
49
+ }
50
+ }
51
+ }
52
+ </script>
53
+ <style lang="less" scoped>
54
+ .welcome_suggest {
55
+ width: 100%;
56
+ height: auto;
57
+ .title {
58
+ width: 100%;
59
+ height: 28px;
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: space-between;
63
+ .title_desc {
64
+ flex: 1 0;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ white-space: nowrap;
68
+ }
69
+ .title_change_batch {
70
+ cursor: pointer;
71
+ color: #366aff;
72
+ height: 28px;
73
+ width: 70px;
74
+ display: flex;
75
+ align-items: center;
76
+ font-size: 14px;
77
+ i {
78
+ margin-right: 5px;
79
+ }
80
+ }
81
+ }
82
+ .content {
83
+ display: flex;
84
+ align-items: center;
85
+ flex-wrap: wrap;
86
+ margin-top: 8px;
87
+ .welcome_item {
88
+ padding: 3px 8px;
89
+ background: #EEF1FF;
90
+ color: #366aff;
91
+ margin-right: 5px;
92
+ margin-bottom: 5px;
93
+ border-radius: 28px;
94
+ cursor: pointer;
95
+ }
96
+ }
97
+ }
98
+ </style>
@@ -0,0 +1,62 @@
1
+ {
2
+ "组件多语言使用说明": "在使用多语言配置文件时,需要在使用的项目中添加对应的配置,默认都配置在dragonCommon字段中,也可以看看有没有其他方式",
3
+ "dragonCommon": {
4
+ "download": "下载",
5
+ "smartSummary": "智能摘要",
6
+ "chat": "聊一聊",
7
+ "viewDetails": "查看详情",
8
+ "folderName": "文件夹名称",
9
+ "loading": "加载中...",
10
+ "Safaridownload": "下载地址已复制,请前往Safari浏览器访问下载",
11
+ "reduce": "缩小",
12
+ "zoom": "放大",
13
+ "selectScale": "请选择",
14
+ "previous": "上一段",
15
+ "next": "下一段",
16
+ "answersGeneratedByPre": "答案由",
17
+ "answersGeneratedByAfter": "段内容生成",
18
+ "scaleAuto": "自动缩放",
19
+ "scaleReality": "实际比例",
20
+ "firstParagraph": "当前已经是第一段了",
21
+ "lastParagraph": "当前已经是最后一段了",
22
+ "fileloadException": "文件加载异常",
23
+ "regenerate": "重新生成",
24
+ "generating": "生成中",
25
+ "close": "关闭",
26
+ "summaryGeneratedByAI": "AI为您总结生成了以下摘要",
27
+ "viewMore": "查看更多",
28
+ "from": "出自",
29
+ "viewOriginal": "查看原文",
30
+ "lastUpdateTime": "最后更新时间",
31
+ "owner": "所有者",
32
+ "enterprise": "所属企业",
33
+ "source": "文件来源",
34
+ "folder": "文件夹",
35
+ "personalknowledge": "个人知识",
36
+ "enterpriseknowledge": "企业知识",
37
+ "satisfaction": "满意",
38
+ "unsatisfied": "不满意",
39
+ "refresh": "换一批",
40
+ "AIrecommends": "AI为您推荐以下内容",
41
+ "youareconsulting": "您正在咨询",
42
+ "description": "描述",
43
+ "location": "位置",
44
+ "user": "使用者",
45
+ "department": "部门",
46
+ "manager": "管理者",
47
+ "uploadImgFile": "上传图片或附件",
48
+ "cancel": "取消",
49
+ "confirm": "确定",
50
+ "noMore": "没有更多了",
51
+ "establishConversationWith": "与",
52
+ "you": "您",
53
+ "bot": "机器人",
54
+ "transferTo": "您将会话转接给",
55
+ "transferFrom": "将会话转接给您",
56
+ "imService": "IM人工",
57
+ "botService": "机器人",
58
+ "willServeYou": "将为您服务",
59
+ "check": "查看",
60
+ "clickme": "点我"
61
+ }
62
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "组件多语言使用说明": "在使用多语言配置文件时,需要在使用的项目中添加对应的配置,默认都配置在dragonCommon字段中,也可以看看有没有其他方式",
3
+ "dragonCommon": {
4
+ "download": "Download",
5
+ "smartSummary": "Smart Summary",
6
+ "chat": "Chat",
7
+ "viewDetails": "View Details",
8
+ "folderName": "Folder Name",
9
+ "loading": "Loading...",
10
+ "Safaridownload": "The download address has been copied, please go to Safari to access the download",
11
+ "reduce": "Reduce",
12
+ "zoom": "Zoom",
13
+ "selectScale": "Select Scale",
14
+ "previous": "Previous",
15
+ "next": "Next",
16
+ "answersGeneratedByPre": "Answers generated by ",
17
+ "answersGeneratedByAfter": " segments of content",
18
+ "scaleAuto": "Auto",
19
+ "scaleReality": "Reality",
20
+ "firstParagraph": "It's already the first paragraph",
21
+ "lastParagraph": "It's already the last paragraph",
22
+ "fileloadException": "File load exception",
23
+ "regenerate": "Regenerate",
24
+ "generating": "Generating",
25
+ "close": "Close",
26
+ "summaryGeneratedByAI": "AI has generated the following summary for you",
27
+ "viewMore": "View More",
28
+ "from": "From",
29
+ "viewOriginal": "View Original",
30
+ "lastUpdateTime": "Last Update Time",
31
+ "owner": "Owner",
32
+ "enterprise": "Enterprise",
33
+ "source": "Source",
34
+ "folder": "Folder",
35
+ "personalknowledge": "Personal Knowledge",
36
+ "enterpriseknowledge": "Enterprise Knowledge",
37
+ "satisfaction": "Satisfaction",
38
+ "unsatisfied": "Unsatisfied",
39
+ "refresh": "Refresh",
40
+ "AIrecommends": "AI recommends the following for you",
41
+ "youareconsulting": "You are consulting",
42
+ "description": "Description",
43
+ "location": "Location",
44
+ "user": "User",
45
+ "department": "Department",
46
+ "manager": "Manager",
47
+ "uploadImgFile": "Upload",
48
+ "cancel": "Cancel",
49
+ "confirm": "Confirm",
50
+ "noMore": "No more",
51
+ "establishConversationWith": "Establish conversation with",
52
+ "you": "You",
53
+ "bot": "Bot",
54
+ "transferTo": "You will transfer the conversation to",
55
+ "transferFrom": "will transfer the conversation to you",
56
+ "imService": "IM agent",
57
+ "botService": "Bot",
58
+ "willServeYou": "will serve you",
59
+ "check": "Check",
60
+ "clickme": "Click me"
61
+ }
62
+ }
package/src/main.js CHANGED
@@ -10,9 +10,6 @@ import 'video.js/dist/video-js.css'
10
10
  import Vant from 'vant';
11
11
  import 'vant/lib/index.css';
12
12
 
13
- import CKEditor from '@ckeditor/ckeditor5-vue2';
14
- Vue.use(CKEditor);
15
-
16
13
  /*import VConsole from 'vconsole'
17
14
  const vConsole = new VConsole();
18
15
  Vue.use(vConsole);*/
@@ -50,11 +47,30 @@ Viewer.setDefaults({
50
47
  Options: { "inline": true, "button": true, "navbar": true, "title": true, "toolbar": true, "tooltip": true, "movable": true, "zoomable": true, "rotatable": true, "scalable": true, "transition": true, "fullscreen": true, "keyboard": true, "url": "data-source" }
51
48
  })
52
49
 
50
+ import VueI18n from 'vue-i18n'; //多语言
51
+
52
+ // 导入多语言的 JSON 文件
53
+ import enLocale from './locales/en.json';
54
+ import cnLocale from './locales/cn.json';
55
+
56
+ Vue.use(VueI18n);
53
57
 
58
+ console.log("askbot-dragon: systemLanguage", sessionStorage.getItem("systemLanguage"));
59
+
60
+ // 创建 VueI18n 实例,并设置默认语言和多语言内容
61
+ const i18n = new VueI18n({
62
+ locale: sessionStorage.getItem("systemLanguage") || 'cn', // 默认语言
63
+ messages: {
64
+ en: enLocale, // 英文
65
+ cn: cnLocale, // 中文
66
+ // 其他语言...
67
+ }
68
+ });
54
69
 
55
70
  Vue.prototype.requestUrl = requestUrl;
56
71
  Vue.prototype.utils = utils;
57
72
 
58
73
  new Vue({
59
74
  render: h => h(App),
75
+ i18n
60
76
  }).$mount('#app')
package/vue.config.js CHANGED
@@ -49,7 +49,6 @@ module.exports = {
49
49
  // 不去 node_modules 中找,而是去找 全局变量 ELEMENT
50
50
  // 'element-ui': 'ELEMENT',
51
51
  // 'vant': 'Vant',
52
- 'ckeditor': 'ClassicEditor',
53
52
  },
54
53
  },
55
54
 
@@ -1,63 +0,0 @@
1
- // 创建ObsClient实例
2
- import ObsClient from 'esdk-obs-browserjs';
3
- const obsClient = new ObsClient({
4
- access_key_id: "EE4MAFWH4YLQSQF7NNIP",
5
- secret_access_key: "Dq9giqqwZoX77dqSIzhA1Yhhe9tarA3LRBGBF4eO",
6
- server : 'https://obs.cn-east-3.myhuaweicloud.com',
7
- timeout : 1000
8
- });
9
- let mainId = sessionStorage.getItem('_mainId') ? sessionStorage.getItem('_mainId') : "";
10
- let IDX = 256, HEX = [], SIZE = 256, BUFFER;
11
- while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
12
- function uid(len) {
13
- let i = 0, tmp = (len || 11);
14
- if (!BUFFER || ((IDX + tmp) > SIZE * 2)) {
15
- for (BUFFER = '', IDX = 0; i < SIZE; i++) {
16
- BUFFER += HEX[Math.random() * 256 | 0];
17
- }
18
- }
19
-
20
- return BUFFER.substring(IDX, IDX++ + tmp);
21
- }
22
-
23
- function dataFormat(fmt, date = new Date()) {
24
- const o = {
25
- "M+": date.getMonth() + 1, //月份
26
- "d+": date.getDate(), //日
27
- "h+": date.getHours(), //小时
28
- "m+": date.getMinutes(), //分
29
- "s+": date.getSeconds(), //秒
30
- "q+": Math.floor((date.getMonth() + 3) / 3), //季度
31
- "S": date.getMilliseconds() //毫秒
32
- };
33
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
34
- for (const k in o)
35
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
36
- return fmt;
37
- }
38
- async function putObject(file,callback){
39
- let fileUrl = ''
40
- let objName = (process.env.VUE_APP_ENV === 'development' ? 'dev_' : 'pro_') + file.name;
41
- let fileName = "front-oss/" + mainId + '/' + dataFormat("yyyy/MM/dd/hh/mm/") + uid(32) + "/" + objName;
42
- await obsClient.putObject({
43
- Bucket: 'askbot-uat',
44
- Key : fileName,
45
- SourceFile : file,
46
- ACL : obsClient.enums.AclPublicRead,
47
- ProgressCallback: callback
48
- }).then(function(result) {
49
- if(result.CommonMsg.Status < 300){
50
- console.log('Create object:' + JSON.stringify(result) + ' successfully!\n',process.env.VUE_APP_ENV);
51
- let domain = process.env.VUE_APP_ENV ==='development' ? 'https://askbot-uat.obs.cn-east-3.myhuaweicloud.com/' : ''
52
- fileUrl = {
53
- url: domain + fileName,
54
- name:file.name
55
- }
56
- }
57
- });
58
- return fileUrl
59
- }
60
-
61
- export {
62
- putObject
63
- }
@@ -1,112 +0,0 @@
1
- import Command from "@ckeditor/ckeditor5-core/src/command";
2
- import { multipartUpload, ossFileUrl } from "../AliyunIssUtil";
3
- import { putObject } from "../../../assets/js/obsBrowser";
4
- const ossConfig = {
5
- region: "oss-cn-zhangjiakou",
6
- //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
7
- accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
8
- accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
9
- // stsToken: '<Your securityToken(STS)>',
10
- bucket: "guoranopen-zjk",
11
- }
12
- export default class ImageCommand extends Command {
13
- refresh() {
14
- this.isEnabled = true;
15
- }
16
- execute(file) {
17
- if (file){
18
- this.forEachFiles(file.file)
19
- return
20
- }
21
- var inputObj = document.createElement('input')
22
- inputObj.setAttribute('id', '_ef');
23
- inputObj.setAttribute('type', 'file');
24
- inputObj.setAttribute('accept','image/jpeg,image/png,image/gif,image/bmp,image/webp,image/tiff')
25
- inputObj.setAttribute("style", 'visibility:hidden');
26
- document.body.appendChild(inputObj);
27
- inputObj.click();
28
- inputObj.onchange = () => {
29
- // 循环上传文件
30
- let files = inputObj.files;
31
- for (let index = 0; index < files.length; index++) {
32
- const filed = files[index];
33
- let command = this.editor.commands.get("insertAskComponent");
34
- command.execute({
35
- tag: "span-editable",
36
- options: {
37
- name: filed.name + '正在上传...',
38
- data: index,
39
- editable:false,
40
- type:'upload'
41
- },
42
- })
43
- this.upload(filed).then(res =>{
44
- // let command = this.editor.commands.get("insertAskComponent");
45
- command.execute({
46
- tag: "img",
47
- options: {
48
- width:'100%',
49
- alt: filed.name + index,
50
- src: res.default
51
- },
52
- });
53
- })
54
- }
55
- }
56
- }
57
- forEachFiles(files){
58
- for (let index = 0; index < files.length; index++) {
59
- const filed = files[index];
60
- let command = this.editor.commands.get("insertAskComponent");
61
- command.execute({
62
- tag: "span-editable",
63
- options: {
64
- name: filed.name + '正在上传...',
65
- data: index,
66
- editable: false,
67
- type: 'upload'
68
- },
69
- })
70
- this.upload(filed).then(res => {
71
- // let command = this.editor.commands.get("insertAskComponent");
72
- command.execute({
73
- tag: "img",
74
- options: {
75
- width: '100%',
76
- alt: filed.name + index,
77
- src: res.default
78
- },
79
- });
80
- })
81
- }
82
- }
83
- upload(file) {
84
- return new Promise((resolve) => {
85
- /* this._initRequest();
86
- this._initListeners( resolve, reject, file );
87
- this._sendRequest( file );*/
88
- this.uploadFile(file, resolve)
89
- })
90
- }
91
- uploadFile(file, resolve) {
92
- let imgInfo = {
93
- url: '',
94
- }
95
- // let res = multipartUpload(
96
- // ossConfig,
97
- // file,
98
- // null,
99
- // imgInfo
100
- // );
101
- let res = putObject(file)
102
- console.log(res,'resprespresp');
103
- res.then(resp => {
104
- imgInfo.url = resp.url;
105
- console.log(resp,'resprespresp');
106
- console.log(imgInfo)
107
- resolve({
108
- default: imgInfo.url
109
- })
110
- })
111
- }
112
- }
@@ -1,12 +0,0 @@
1
- import Plugin from "@ckeditor/ckeditor5-core/src/plugin";
2
- import ImageCommand from "./command";
3
- export default class MyimageUpload extends Plugin {
4
- static get pluginName() {
5
- return "imageUpload";
6
- }
7
- init() {
8
- const editor = this.editor;
9
- // 注册一个 BoldCommand 命令
10
- editor.commands.add('imageUpload', new ImageCommand(editor));
11
- }
12
- }
@@ -1,12 +0,0 @@
1
- import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
2
- import ToolbarUI from './toolbar-ui'
3
- import ImageUpload from './editing'
4
-
5
- export default class MyimageUpload extends Plugin {
6
- static get requires() {
7
- return [ImageUpload, ToolbarUI];
8
- }
9
- static get pluginName() {
10
- return 'MyimageUpload';
11
- }
12
- }
@@ -1,41 +0,0 @@
1
- /* eslint-disable */
2
- import Plugin from "@ckeditor/ckeditor5-core/src/plugin";
3
- import ButtonView from "@ckeditor/ckeditor5-ui/src/button/buttonview";
4
- // import aoteman from "@ckeditor/ckeditor5-basic-styles/theme/icons/bold.svg";
5
-
6
- // console.log(aoteman.replace('/',''));
7
- export default class BoldToolbarUI extends Plugin {
8
- init() {
9
- this._createToolbarButton();
10
- }
11
-
12
- _createToolbarButton() {
13
- const editor = this.editor;
14
- const command = editor.commands.get('imageUpload');
15
- editor.ui.componentFactory.add('MyimageUpload', (locale) => {
16
- const view = new ButtonView(locale);
17
- view.set({
18
- label: '上传图片',
19
- tooltip: true,
20
- withText: true, // 在按钮上展示 label
21
- // icon:`<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
22
- // viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
23
- // <path d="M182,4.2H18c-9.9,0-18,8-18,18l0,0v156c0.2,9.7,8.3,17.5,18,17.5h164c9.7,0,17.8-7.8,18-17.5v-156C200,12.3,192,4.2,182,4.2
24
- // z M152.5,101.2c-3.1-2.3-7.5-2.3-10.6,0l-31.1,26.1L67.9,58.5c-3.4-3.7-8.9-3.9-12.6-0.6c-0.2,0.2-0.3,0.3-0.6,0.6L18,99.3V22.2h164
25
- // v91.3L152.5,101.2z" fill="#333333"/>
26
- // <path d="M145.8,38.3c-14,0-25.3,11.3-25.3,25.3s11.3,25.3,25.3,25.3s25.3-11.3,25.3-25.3l0,0C171.1,49.6,159.7,38.3,145.8,38.3z
27
- // M145.8,70.3c-4,0-7.3-3.2-7.3-7.3s3.2-7.3,7.3-7.3s7.3,3.2,7.3,7.3c0.2,4-2.8,7.4-6.8,7.6c-0.1,0-0.3,0-0.4,0V70.3z" fill="#333333"/>
28
- // </svg>`,
29
- class:'icon'
30
- });
31
-
32
- // console.log(Template);
33
- // 将按钮的状态关联到命令对应值上
34
- view.bind("isOn", "isEnabled").to(command, "value", "isEnabled");
35
- // 点击按钮时触发相应命令
36
- this.listenTo(view, "execute", () => editor.execute('imageUpload'));
37
- return view;
38
-
39
- })
40
- }
41
- }