yks-element 1.0.0 → 1.0.4
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/LICENSE +21 -0
- package/README.md +49 -4
- package/lib/theme-chalk/alert.css +1 -0
- package/lib/theme-chalk/aside.css +1 -0
- package/lib/theme-chalk/autocomplete.css +1 -0
- package/lib/theme-chalk/avatar.css +1 -0
- package/lib/theme-chalk/backtop.css +1 -0
- package/lib/theme-chalk/badge.css +1 -0
- package/lib/theme-chalk/base.css +1 -0
- package/lib/theme-chalk/breadcrumb-item.css +0 -0
- package/lib/theme-chalk/breadcrumb.css +1 -0
- package/lib/theme-chalk/button-group.css +0 -0
- package/lib/theme-chalk/button.css +1 -0
- package/lib/theme-chalk/buttons.css +1 -0
- package/lib/theme-chalk/calendar.css +1 -0
- package/lib/theme-chalk/card.css +1 -0
- package/lib/theme-chalk/carousel-item.css +1 -0
- package/lib/theme-chalk/carousel.css +1 -0
- package/lib/theme-chalk/cascader-panel.css +1 -0
- package/lib/theme-chalk/cascader.css +1 -0
- package/lib/theme-chalk/checkbox-button.css +0 -0
- package/lib/theme-chalk/checkbox-group.css +0 -0
- package/lib/theme-chalk/checkbox.css +1 -0
- package/lib/theme-chalk/col.css +1 -0
- package/lib/theme-chalk/collapse-item.css +0 -0
- package/lib/theme-chalk/collapse.css +1 -0
- package/lib/theme-chalk/color-picker.css +1 -0
- package/lib/theme-chalk/common.css +1 -0
- package/lib/theme-chalk/container.css +1 -0
- package/lib/theme-chalk/date-picker.css +1 -0
- package/lib/theme-chalk/descriptions-item.css +1 -0
- package/lib/theme-chalk/descriptions.css +1 -0
- package/lib/theme-chalk/dialog.css +1 -0
- package/lib/theme-chalk/display.css +1 -0
- package/lib/theme-chalk/divider.css +1 -0
- package/lib/theme-chalk/drawer.css +1 -0
- package/lib/theme-chalk/dropdown-item.css +0 -0
- package/lib/theme-chalk/dropdown-menu.css +0 -0
- package/lib/theme-chalk/dropdown.css +1 -0
- package/lib/theme-chalk/element-ui.css +1 -0
- package/lib/theme-chalk/element-variables.css +0 -0
- package/lib/theme-chalk/element.css +1 -0
- package/lib/theme-chalk/empty.css +1 -0
- package/{dist/fonts/element-icons.732389de.ttf → lib/theme-chalk/fonts/element-icons.ttf} +0 -0
- package/{dist/fonts/element-icons.535877f5.woff → lib/theme-chalk/fonts/element-icons.woff} +0 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/footer.css +1 -0
- package/lib/theme-chalk/form-item.css +0 -0
- package/lib/theme-chalk/form.css +1 -0
- package/lib/theme-chalk/header.css +1 -0
- package/lib/theme-chalk/icon.css +1 -0
- package/lib/theme-chalk/icons.css +1 -0
- package/lib/theme-chalk/image.css +1 -0
- package/lib/theme-chalk/index.css +1 -0
- package/lib/theme-chalk/infinite-scroll.css +0 -0
- package/lib/theme-chalk/infiniteScroll.css +0 -0
- package/lib/theme-chalk/input-number.css +1 -0
- package/lib/theme-chalk/input.css +1 -0
- package/lib/theme-chalk/link.css +1 -0
- package/lib/theme-chalk/loading.css +1 -0
- package/lib/theme-chalk/main.css +1 -0
- package/lib/theme-chalk/menu-item-group.css +0 -0
- package/lib/theme-chalk/menu-item.css +0 -0
- package/lib/theme-chalk/menu.css +1 -0
- package/lib/theme-chalk/message-box.css +1 -0
- package/lib/theme-chalk/message.css +1 -0
- package/lib/theme-chalk/multimedia.css +1 -0
- package/lib/theme-chalk/notification.css +1 -0
- package/lib/theme-chalk/option-group.css +1 -0
- package/lib/theme-chalk/option.css +1 -0
- package/lib/theme-chalk/page-header.css +1 -0
- package/lib/theme-chalk/pagination.css +1 -0
- package/lib/theme-chalk/paginations.css +1 -0
- package/lib/theme-chalk/popconfirm.css +1 -0
- package/lib/theme-chalk/popover.css +1 -0
- package/lib/theme-chalk/popper.css +1 -0
- package/lib/theme-chalk/progress.css +1 -0
- package/lib/theme-chalk/radio-button.css +1 -0
- package/lib/theme-chalk/radio-group.css +1 -0
- package/lib/theme-chalk/radio.css +1 -0
- package/lib/theme-chalk/rate.css +1 -0
- package/lib/theme-chalk/reset.css +1 -0
- package/lib/theme-chalk/result.css +1 -0
- package/lib/theme-chalk/row.css +1 -0
- package/lib/theme-chalk/scrollbar.css +1 -0
- package/lib/theme-chalk/scrollbars.css +1 -0
- package/lib/theme-chalk/select-dropdown.css +1 -0
- package/lib/theme-chalk/select.css +1 -0
- package/lib/theme-chalk/selects.css +1 -0
- package/lib/theme-chalk/skeleton-item.css +1 -0
- package/lib/theme-chalk/skeleton.css +1 -0
- package/lib/theme-chalk/slider.css +1 -0
- package/lib/theme-chalk/spinner.css +1 -0
- package/lib/theme-chalk/step.css +1 -0
- package/lib/theme-chalk/steps.css +1 -0
- package/lib/theme-chalk/submenu.css +0 -0
- package/lib/theme-chalk/switch.css +1 -0
- package/lib/theme-chalk/tab-pane.css +0 -0
- package/lib/theme-chalk/table-column.css +1 -0
- package/lib/theme-chalk/table.css +1 -0
- package/lib/theme-chalk/tables.css +1 -0
- package/lib/theme-chalk/tabs.css +1 -0
- package/lib/theme-chalk/tag.css +1 -0
- package/lib/theme-chalk/time-picker.css +1 -0
- package/lib/theme-chalk/time-select.css +1 -0
- package/lib/theme-chalk/timeline-item.css +1 -0
- package/lib/theme-chalk/timeline.css +1 -0
- package/lib/theme-chalk/tinymce.css +1 -0
- package/lib/theme-chalk/tooltip.css +1 -0
- package/lib/theme-chalk/topic.css +1 -0
- package/lib/theme-chalk/transfer.css +1 -0
- package/lib/theme-chalk/tree.css +1 -0
- package/lib/theme-chalk/upload.css +1 -0
- package/lib/theme-chalk/uploadfile.css +1 -0
- package/lib/theme-chalk/video.css +1 -0
- package/lib/yks.js +1 -0
- package/package.json +101 -51
- package/packages/Dialog/index.js +8 -0
- package/packages/Dialog/src/index.vue +89 -0
- package/packages/Multimedia/index.js +8 -0
- package/packages/Multimedia/src/index.vue +136 -0
- package/packages/Pagination/index.js +8 -0
- package/packages/Pagination/src/index.vue +111 -0
- package/packages/Scrollbar/index.js +8 -0
- package/packages/Scrollbar/src/index.vue +20 -0
- package/packages/Select/index.js +8 -0
- package/packages/Select/src/index.vue +350 -0
- package/packages/Select/src/option.vue +29 -0
- package/packages/Table/index.js +8 -0
- package/packages/Table/src/index.vue +141 -0
- package/packages/Tinymce/index.js +8 -0
- package/packages/Tinymce/src/config.js +25 -0
- package/packages/Tinymce/src/index.vue +450 -0
- package/packages/Topic/index.js +23 -0
- package/packages/Topic/src/attachment.vue +114 -0
- package/packages/Topic/src/audioFrequency.vue +114 -0
- package/packages/Topic/src/clozeFillInBlanks.vue +237 -0
- package/packages/Topic/src/compound.vue +191 -0
- package/packages/Topic/src/config.js +132 -0
- package/packages/Topic/src/fillInBlanks.vue +242 -0
- package/packages/Topic/src/indefiniteChoice.vue +0 -0
- package/packages/Topic/src/judgment.vue +110 -0
- package/packages/Topic/src/matching.vue +0 -0
- package/packages/Topic/src/multiple.vue +163 -0
- package/packages/Topic/src/pictureAnswer.vue +113 -0
- package/packages/Topic/src/shortAnswer.vue +124 -0
- package/packages/Topic/src/single.vue +163 -0
- package/packages/UploadFile/index.js +8 -0
- package/packages/UploadFile/src/index.vue +358 -0
- package/packages/Video/index.js +8 -0
- package/packages/Video/src/index.vue +204 -0
- package/packages/assets/mixins/topic.js +137 -0
- package/packages/assets/utils/index.js +83 -0
- package/packages/assets/utils/topic.js +132 -0
- package/packages/icon/default/icons.js +182 -0
- package/packages/icon/default/icons.min.js +1 -0
- package/packages/icon/default/index.js +7 -0
- package/packages/icon/ks-pdf.png +0 -0
- package/packages/icon/ks-ppt.png +0 -0
- package/packages/icon/ks-word.png +0 -0
- package/packages/icon/ks-xslx.png +0 -0
- package/packages/icon/music-bg.png +0 -0
- package/packages/icon/video-bg.png +0 -0
- package/packages/index.js +221 -0
- package/packages/option/index.js +6 -0
- package/packages/styles/_mixin.scss +93 -0
- package/packages/styles/_variables.scss +40 -0
- package/packages/styles/alert.scss +147 -0
- package/packages/styles/aside.scss +7 -0
- package/packages/styles/autocomplete.scss +80 -0
- package/packages/styles/avatar.scss +51 -0
- package/packages/styles/backtop.scss +22 -0
- package/packages/styles/badge.scss +57 -0
- package/packages/styles/base.scss +2 -0
- package/packages/styles/breadcrumb-item.scss +0 -0
- package/packages/styles/breadcrumb.scss +55 -0
- package/packages/styles/button-group.scss +0 -0
- package/packages/styles/button.scss +262 -0
- package/packages/styles/buttons.scss +59 -0
- package/packages/styles/calendar.scss +79 -0
- package/packages/styles/card.scss +32 -0
- package/packages/styles/carousel-item.scss +50 -0
- package/packages/styles/carousel.scss +161 -0
- package/packages/styles/cascader-panel.scss +120 -0
- package/packages/styles/cascader.scss +182 -0
- package/packages/styles/checkbox-button.scss +0 -0
- package/packages/styles/checkbox-group.scss +0 -0
- package/packages/styles/checkbox.scss +359 -0
- package/packages/styles/col.scss +156 -0
- package/packages/styles/collapse-item.scss +0 -0
- package/packages/styles/collapse.scss +63 -0
- package/packages/styles/color-picker.scss +384 -0
- package/packages/styles/common/popup.scss +42 -0
- package/packages/styles/common/transition.scss +99 -0
- package/packages/styles/common/var.scss +1028 -0
- package/packages/styles/common.scss +204 -0
- package/packages/styles/container.scss +14 -0
- package/packages/styles/date-picker/date-picker.scss +97 -0
- package/packages/styles/date-picker/date-range-picker.scss +101 -0
- package/packages/styles/date-picker/date-table.scss +151 -0
- package/packages/styles/date-picker/month-table.scss +82 -0
- package/packages/styles/date-picker/picker-panel.scss +117 -0
- package/packages/styles/date-picker/picker.scss +197 -0
- package/packages/styles/date-picker/time-picker.scss +85 -0
- package/packages/styles/date-picker/time-range-picker.scss +31 -0
- package/packages/styles/date-picker/time-spinner.scss +110 -0
- package/packages/styles/date-picker/year-table.scss +51 -0
- package/packages/styles/date-picker.scss +12 -0
- package/packages/styles/descriptions-item.scss +42 -0
- package/packages/styles/descriptions.scss +111 -0
- package/packages/styles/dialog.scss +123 -0
- package/packages/styles/display.scss +12 -0
- package/packages/styles/divider.scss +47 -0
- package/packages/styles/drawer.scss +219 -0
- package/packages/styles/dropdown-item.scss +0 -0
- package/packages/styles/dropdown-menu.scss +0 -0
- package/packages/styles/dropdown.scss +182 -0
- package/packages/styles/element-ui.scss +135 -0
- package/packages/styles/element-variables.scss +794 -0
- package/packages/styles/element.scss +86 -0
- package/packages/styles/empty.scss +45 -0
- package/packages/styles/fonts/element-icons.ttf +0 -0
- package/packages/styles/fonts/element-icons.woff +0 -0
- package/packages/styles/fonts/iconfont.ttf +0 -0
- package/packages/styles/fonts/iconfont.woff +0 -0
- package/packages/styles/footer.scss +8 -0
- package/packages/styles/form-item.scss +0 -0
- package/packages/styles/form.scss +167 -0
- package/packages/styles/header.scss +8 -0
- package/packages/styles/icon.scss +1167 -0
- package/packages/styles/icons.scss +69 -0
- package/packages/styles/image.scss +179 -0
- package/packages/styles/index.scss +18 -0
- package/packages/styles/infinite-scroll.scss +0 -0
- package/packages/styles/infiniteScroll.scss +0 -0
- package/packages/styles/input-number.scss +180 -0
- package/packages/styles/input.scss +360 -0
- package/packages/styles/link.scss +81 -0
- package/packages/styles/loading.scss +96 -0
- package/packages/styles/main.scss +12 -0
- package/packages/styles/menu-item-group.scss +0 -0
- package/packages/styles/menu-item.scss +0 -0
- package/packages/styles/menu.scss +289 -0
- package/packages/styles/message-box.scss +226 -0
- package/packages/styles/message.scss +120 -0
- package/packages/styles/mixins/_button.scss +81 -0
- package/packages/styles/mixins/config.scss +4 -0
- package/packages/styles/mixins/function.scss +44 -0
- package/packages/styles/mixins/mixins.scss +190 -0
- package/packages/styles/mixins/utils.scss +39 -0
- package/packages/styles/multimedia.scss +58 -0
- package/packages/styles/notification.scss +99 -0
- package/packages/styles/option-group.scss +42 -0
- package/packages/styles/option.scss +36 -0
- package/packages/styles/page-header.scss +41 -0
- package/packages/styles/pagination.scss +295 -0
- package/packages/styles/paginations.scss +33 -0
- package/packages/styles/popconfirm.scss +16 -0
- package/packages/styles/popover.scss +40 -0
- package/packages/styles/popper.scss +101 -0
- package/packages/styles/progress.scss +141 -0
- package/packages/styles/radio-button.scss +113 -0
- package/packages/styles/radio-group.scss +9 -0
- package/packages/styles/radio.scss +199 -0
- package/packages/styles/rate.scss +49 -0
- package/packages/styles/reset.scss +79 -0
- package/packages/styles/result.scss +61 -0
- package/packages/styles/row.scss +43 -0
- package/packages/styles/scrollbar.scss +72 -0
- package/packages/styles/scrollbars.scss +5 -0
- package/packages/styles/select-dropdown.scss +62 -0
- package/packages/styles/select.scss +152 -0
- package/packages/styles/selects.scss +98 -0
- package/packages/styles/skeleton-item.scss +84 -0
- package/packages/styles/skeleton.scss +40 -0
- package/packages/styles/slider.scss +250 -0
- package/packages/styles/spinner.scss +44 -0
- package/packages/styles/step.scss +317 -0
- package/packages/styles/steps.scss +20 -0
- package/packages/styles/submenu.scss +0 -0
- package/packages/styles/switch.scss +116 -0
- package/packages/styles/tab-pane.scss +0 -0
- package/packages/styles/table-column.scss +97 -0
- package/packages/styles/table.scss +564 -0
- package/packages/styles/tables.scss +45 -0
- package/packages/styles/tabs.scss +602 -0
- package/packages/styles/tag.scss +163 -0
- package/packages/styles/time-picker.scss +8 -0
- package/packages/styles/time-select.scss +37 -0
- package/packages/styles/timeline-item.scss +86 -0
- package/packages/styles/timeline.scss +14 -0
- package/packages/styles/tinymce.scss +43 -0
- package/packages/styles/tooltip.scss +141 -0
- package/packages/styles/topic.scss +57 -0
- package/packages/styles/transfer.scss +227 -0
- package/packages/styles/tree.scss +123 -0
- package/packages/styles/upload.scss +603 -0
- package/packages/styles/uploadfile.scss +34 -0
- package/packages/styles/video.scss +98 -0
- package/types/index.d.ts +4 -0
- package/dist/demo.html +0 -10
- package/dist/yks.common.js +0 -64801
- package/dist/yks.css +0 -1
- package/dist/yks.umd.js +0 -64811
- package/dist/yks.umd.min.js +0 -15
- package/packages/button/index.vue +0 -16
- package/packages/index.ts +0 -12
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="{ 'yks-fullscreen': fullscreen }"
|
|
4
|
+
class="yks-tinymce-container"
|
|
5
|
+
:style="{ width: containerWidth }"
|
|
6
|
+
>
|
|
7
|
+
<TinymceEditor
|
|
8
|
+
:id="tinymceId"
|
|
9
|
+
ref="tinymceEditor"
|
|
10
|
+
:key="tinymceId"
|
|
11
|
+
v-model="tinymceContent"
|
|
12
|
+
:init="initOptions"
|
|
13
|
+
:class="{ 'tinymce-inline': inline }"
|
|
14
|
+
/>
|
|
15
|
+
<div v-if="fileParams.length !== 0" class="ti-multimedia">
|
|
16
|
+
<div
|
|
17
|
+
v-for="(values, index) in fileParams"
|
|
18
|
+
:key="`fileParams${index}${Math.random()}`"
|
|
19
|
+
class="media-file"
|
|
20
|
+
>
|
|
21
|
+
<yks-multimedia
|
|
22
|
+
:data="values"
|
|
23
|
+
visibleDel
|
|
24
|
+
@delete="handleCloseFile(values, index)"
|
|
25
|
+
></yks-multimedia>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<yks-uploadfile
|
|
29
|
+
:show.sync="show"
|
|
30
|
+
:fileData="fileData"
|
|
31
|
+
:title="title"
|
|
32
|
+
:uploadFileFunction="uploadFileFunction"
|
|
33
|
+
@sure="onSure"
|
|
34
|
+
></yks-uploadfile>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
// Docs: https://armour.github.io/vue-typescript-admin-docs/features/components/rich-editor.html#tinymce
|
|
40
|
+
import 'tinymce/tinymce'
|
|
41
|
+
import 'tinymce/themes/silver' // Import themes
|
|
42
|
+
import 'tinymce/themes/mobile'
|
|
43
|
+
import 'tinymce/plugins/advlist' // Any plugins you want to use has to be imported
|
|
44
|
+
import 'tinymce/plugins/anchor'
|
|
45
|
+
import 'tinymce/plugins/autolink'
|
|
46
|
+
import 'tinymce/plugins/autosave'
|
|
47
|
+
import 'tinymce/plugins/charmap'
|
|
48
|
+
import 'tinymce/plugins/code'
|
|
49
|
+
import 'tinymce/plugins/codesample'
|
|
50
|
+
import 'tinymce/plugins/directionality'
|
|
51
|
+
import 'tinymce/plugins/emoticons'
|
|
52
|
+
import 'tinymce/plugins/fullscreen'
|
|
53
|
+
import 'tinymce/plugins/hr'
|
|
54
|
+
import 'tinymce/plugins/image'
|
|
55
|
+
import 'tinymce/plugins/imagetools'
|
|
56
|
+
import 'tinymce/plugins/insertdatetime'
|
|
57
|
+
import 'tinymce/plugins/link'
|
|
58
|
+
import 'tinymce/plugins/lists'
|
|
59
|
+
import 'tinymce/plugins/media'
|
|
60
|
+
import 'tinymce/plugins/nonbreaking'
|
|
61
|
+
import 'tinymce/plugins/noneditable'
|
|
62
|
+
import 'tinymce/plugins/pagebreak'
|
|
63
|
+
import 'tinymce/plugins/paste'
|
|
64
|
+
import 'tinymce/plugins/preview'
|
|
65
|
+
import 'tinymce/plugins/print'
|
|
66
|
+
import 'tinymce/plugins/save'
|
|
67
|
+
import 'tinymce/plugins/searchreplace'
|
|
68
|
+
import 'tinymce/plugins/spellchecker'
|
|
69
|
+
import 'tinymce/plugins/tabfocus'
|
|
70
|
+
import 'tinymce/plugins/table'
|
|
71
|
+
import 'tinymce/plugins/template'
|
|
72
|
+
import 'tinymce/plugins/textpattern'
|
|
73
|
+
import 'tinymce/plugins/visualblocks'
|
|
74
|
+
import 'tinymce/plugins/visualchars'
|
|
75
|
+
import 'tinymce/plugins/wordcount'
|
|
76
|
+
import 'yks/icon/default'
|
|
77
|
+
import TinymceEditor from '@tinymce/tinymce-vue' // TinyMCE vue wrapper
|
|
78
|
+
// eslint-disable-next-line no-duplicate-imports
|
|
79
|
+
import tinymce from 'tinymce/tinymce'
|
|
80
|
+
import { uploadAudio, uploadVideo, uploadFile, uploadRecording, plugins, toolbar } from './config'
|
|
81
|
+
|
|
82
|
+
import { Loading } from 'element-ui'
|
|
83
|
+
|
|
84
|
+
export default {
|
|
85
|
+
name: 'YksTinymce',
|
|
86
|
+
components: {
|
|
87
|
+
TinymceEditor
|
|
88
|
+
},
|
|
89
|
+
props: {
|
|
90
|
+
value: {
|
|
91
|
+
required: true
|
|
92
|
+
},
|
|
93
|
+
/* 语言包 */
|
|
94
|
+
language: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: 'zh_CN'
|
|
97
|
+
},
|
|
98
|
+
/* 扩展bar */
|
|
99
|
+
toolbar: {
|
|
100
|
+
type: [String, Array],
|
|
101
|
+
default: () => []
|
|
102
|
+
},
|
|
103
|
+
/* 字数限制 */
|
|
104
|
+
charLimit: {
|
|
105
|
+
type: Number,
|
|
106
|
+
default: 5000
|
|
107
|
+
},
|
|
108
|
+
/* 插件 */
|
|
109
|
+
plugins: {
|
|
110
|
+
type: [String, Array],
|
|
111
|
+
default: () => []
|
|
112
|
+
},
|
|
113
|
+
menubar: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: 'file edit insert view format table'
|
|
116
|
+
},
|
|
117
|
+
height: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: '660px'
|
|
120
|
+
},
|
|
121
|
+
width: {
|
|
122
|
+
type: String,
|
|
123
|
+
default: 'auto'
|
|
124
|
+
},
|
|
125
|
+
inline: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: false
|
|
128
|
+
},
|
|
129
|
+
/* 音视频数据 */
|
|
130
|
+
fileParams: {
|
|
131
|
+
type: Array,
|
|
132
|
+
default: () => []
|
|
133
|
+
},
|
|
134
|
+
/*
|
|
135
|
+
上传文件函数
|
|
136
|
+
抛出blobInfo函数
|
|
137
|
+
接收data src
|
|
138
|
+
*/
|
|
139
|
+
uploadFileToHwCloud: {
|
|
140
|
+
required: true,
|
|
141
|
+
type: Function
|
|
142
|
+
},
|
|
143
|
+
/*
|
|
144
|
+
上传音视频文件函数
|
|
145
|
+
抛出数组文件信息
|
|
146
|
+
接收data src
|
|
147
|
+
*/
|
|
148
|
+
uploadFileFunction: {
|
|
149
|
+
required: true,
|
|
150
|
+
type: Function
|
|
151
|
+
},
|
|
152
|
+
/* 扩展插件 */
|
|
153
|
+
externalPlugins: {
|
|
154
|
+
type: Object,
|
|
155
|
+
default: () => {
|
|
156
|
+
return {}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
data() {
|
|
161
|
+
return {
|
|
162
|
+
hasChange: false,
|
|
163
|
+
hasInit: false,
|
|
164
|
+
fullscreen: false,
|
|
165
|
+
isComposition: false,
|
|
166
|
+
show: false,
|
|
167
|
+
fileData: {
|
|
168
|
+
fileType: '',
|
|
169
|
+
typeList: [],
|
|
170
|
+
fileSize: 0
|
|
171
|
+
},
|
|
172
|
+
limitNum: 0
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
computed: {
|
|
176
|
+
tinymceContent: {
|
|
177
|
+
get() {
|
|
178
|
+
return this.value
|
|
179
|
+
},
|
|
180
|
+
set(value) {
|
|
181
|
+
this.$emit('input', value)
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
containerWidth() {
|
|
185
|
+
const width = this.width
|
|
186
|
+
// Test matches `100`, `'100'`
|
|
187
|
+
if (/^[\d]+(\.[\d]+)?$/.test(width.toString())) {
|
|
188
|
+
return `${width}px`
|
|
189
|
+
}
|
|
190
|
+
return width
|
|
191
|
+
},
|
|
192
|
+
title() {
|
|
193
|
+
const params = {
|
|
194
|
+
recording: '音频录制',
|
|
195
|
+
video: '视频上传',
|
|
196
|
+
audio: '音频上传',
|
|
197
|
+
file: '文件上传'
|
|
198
|
+
}
|
|
199
|
+
return params[this.fileData.fileType]
|
|
200
|
+
},
|
|
201
|
+
mediaTypeList() {
|
|
202
|
+
return this.fileParams.map((v) => v.fileType)
|
|
203
|
+
},
|
|
204
|
+
initOptions() {
|
|
205
|
+
return {
|
|
206
|
+
selector: `#${this.tinymceId}`,
|
|
207
|
+
height: this.height,
|
|
208
|
+
charLimit: this.charLimit,
|
|
209
|
+
body_class: 'panel-body ',
|
|
210
|
+
object_resizing: false,
|
|
211
|
+
inline: this.inline,
|
|
212
|
+
toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,
|
|
213
|
+
menubar: this.menubar,
|
|
214
|
+
plugins: this.plugins.length > 0 ? this.plugins : plugins,
|
|
215
|
+
language: this.language,
|
|
216
|
+
language_url: `https://pub-static.yks365.net/assets/tinymce/langs/${this.language}.js`,
|
|
217
|
+
skin_url: 'https://pub-static.yks365.net/assets/tinymce/skins',
|
|
218
|
+
emoticons_database_url:
|
|
219
|
+
'https://pub-static.yks365.net/assets/tinymce/emojis.min.js',
|
|
220
|
+
end_container_on_empty_block: true,
|
|
221
|
+
powerpaste_word_import: 'clean',
|
|
222
|
+
code_dialog_height: 450,
|
|
223
|
+
code_dialog_width: 1000,
|
|
224
|
+
advlist_bullet_styles: 'square',
|
|
225
|
+
advlist_number_styles: 'default',
|
|
226
|
+
imagetools_cors_hosts: ['www.tinymce.com', 'codepen.io'],
|
|
227
|
+
default_link_target: '_blank',
|
|
228
|
+
link_title: false,
|
|
229
|
+
nonbreaking_force_tab: true,
|
|
230
|
+
branding: false,
|
|
231
|
+
convert_urls: false,
|
|
232
|
+
resize: false,
|
|
233
|
+
elementpath: false,
|
|
234
|
+
paste_as_text: false,
|
|
235
|
+
paste_data_image: true,
|
|
236
|
+
paste_data_images: true,
|
|
237
|
+
external_plugins: {
|
|
238
|
+
...this.externalPlugins,
|
|
239
|
+
powerpaste: `https://pub-static.yks365.net/assets/tinymce/powerpaste/plugin.min.js`,
|
|
240
|
+
'kityformula-editor': `https://pub-static.yks365.net/assets/tinymce/kityformula-editor/plugin.min.js`
|
|
241
|
+
},
|
|
242
|
+
images_upload_handler: async (blobInfo, success) => {
|
|
243
|
+
const loading = Loading.service({
|
|
244
|
+
lock: true,
|
|
245
|
+
text: '上传中...',
|
|
246
|
+
spinner: 'el-icon-loading',
|
|
247
|
+
background: 'rgba(0, 0, 0, 0.7)'
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
try {
|
|
251
|
+
const data = await this.uploadFileToHwCloud(blobInfo)
|
|
252
|
+
success(data)
|
|
253
|
+
} catch (error) {
|
|
254
|
+
console.log(error)
|
|
255
|
+
success('')
|
|
256
|
+
}
|
|
257
|
+
loading.close()
|
|
258
|
+
},
|
|
259
|
+
paste_preprocess: (e, args) => {
|
|
260
|
+
const tinymax = this.charLimit
|
|
261
|
+
const text = this.tinymceContent.replace(/(<([^>]+)>)/gi, '')
|
|
262
|
+
const contentOnBlur = args.content.replace(/(<([^>]+)>)/gi, '')
|
|
263
|
+
// 粘贴字数限制
|
|
264
|
+
if (tinymax - text.length < contentOnBlur.length) {
|
|
265
|
+
this.$message.error(`长度限制为${tinymax}个字符`)
|
|
266
|
+
this.limitNum++
|
|
267
|
+
if (tinymax > text.length) {
|
|
268
|
+
args.content = contentOnBlur.substr(0, tinymax - text.length)
|
|
269
|
+
} else {
|
|
270
|
+
args.content = ''
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
init_instance_callback: (editor) => {
|
|
275
|
+
if (this.value) {
|
|
276
|
+
editor.setContent(this.value)
|
|
277
|
+
}
|
|
278
|
+
this.hasInit = true
|
|
279
|
+
editor.on('NodeChange Change KeyUp SetContent', () => {
|
|
280
|
+
this.hasChange = true
|
|
281
|
+
this.$emit('input', editor.getContent())
|
|
282
|
+
})
|
|
283
|
+
},
|
|
284
|
+
setup: (editor) => {
|
|
285
|
+
editor.on('FullscreenStateChanged', (e) => {
|
|
286
|
+
this.fullscreen = e.state
|
|
287
|
+
})
|
|
288
|
+
editor.on('compositionstart', () => {
|
|
289
|
+
this.isComposition = false
|
|
290
|
+
})
|
|
291
|
+
editor.on('compositionend', () => {
|
|
292
|
+
this.isComposition = true
|
|
293
|
+
})
|
|
294
|
+
editor.on('input', (e) => {
|
|
295
|
+
this.wordLimit(e, editor)
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
editor.ui.registry.addButton('uploadRecording', {
|
|
299
|
+
text: uploadRecording,
|
|
300
|
+
onAction: () => {
|
|
301
|
+
if (this.mediaTypeList.includes('recording')) {
|
|
302
|
+
this.$message.warning('最多选择一种!')
|
|
303
|
+
return
|
|
304
|
+
}
|
|
305
|
+
this.show = true
|
|
306
|
+
this.fileData.fileType = 'recording'
|
|
307
|
+
this.fileData.typeList = []
|
|
308
|
+
this.fileData.fileSize = 600
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
editor.ui.registry.addButton('uploadVideo', {
|
|
313
|
+
text: uploadVideo,
|
|
314
|
+
onAction: () => {
|
|
315
|
+
if (this.mediaTypeList.includes('video')) {
|
|
316
|
+
this.$message.warning('最多选择一种!')
|
|
317
|
+
return
|
|
318
|
+
}
|
|
319
|
+
this.fileData.fileType = 'video'
|
|
320
|
+
this.fileData.typeList = ['mp4']
|
|
321
|
+
this.fileData.fileSize = 20
|
|
322
|
+
this.show = true
|
|
323
|
+
}
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
editor.ui.registry.addButton('uploadAudio', {
|
|
327
|
+
text: uploadAudio,
|
|
328
|
+
onAction: () => {
|
|
329
|
+
if (this.mediaTypeList.includes('audio')) {
|
|
330
|
+
this.$message.warning('最多选择一种!')
|
|
331
|
+
return
|
|
332
|
+
}
|
|
333
|
+
this.fileData.fileType = 'audio'
|
|
334
|
+
this.show = true
|
|
335
|
+
this.fileData.typeList = ['mp3']
|
|
336
|
+
this.fileData.fileSize = 20
|
|
337
|
+
}
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
editor.ui.registry.addButton('uploadFile', {
|
|
341
|
+
text: uploadFile,
|
|
342
|
+
onAction: () => {
|
|
343
|
+
if (this.mediaTypeList.includes('file')) {
|
|
344
|
+
this.$message.warning('最多选择一种!')
|
|
345
|
+
return
|
|
346
|
+
}
|
|
347
|
+
this.fileData.fileType = 'file'
|
|
348
|
+
this.fileData.typeList = ['pptx', 'docx', 'pdf', 'xlsx']
|
|
349
|
+
this.fileData.fileSize = 20
|
|
350
|
+
this.show = true
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
tinymceId() {
|
|
357
|
+
return 'vue-tinymce-' + Number(new Date()) + String((Math.random() * 1000).toFixed(0))
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
destroy() {
|
|
361
|
+
const tinymce = window.tinymce.get(this.tinymceId)
|
|
362
|
+
tinymce.destroy()
|
|
363
|
+
},
|
|
364
|
+
methods: {
|
|
365
|
+
handleCloseFile(row, index) {
|
|
366
|
+
this.$emit('delte', {
|
|
367
|
+
row: row,
|
|
368
|
+
index: index
|
|
369
|
+
})
|
|
370
|
+
},
|
|
371
|
+
handleFillInBlanks(value, id) {
|
|
372
|
+
const editor = this.$refs.tinymceEditor.editor
|
|
373
|
+
editor.editorManager.get(editor.id).focus()
|
|
374
|
+
tinymce.activeEditor.insertContent(
|
|
375
|
+
`<input type="text" class="fill-icon ${id}" disabled readonly value="${value}">`
|
|
376
|
+
)
|
|
377
|
+
},
|
|
378
|
+
deleFillItem(index) {
|
|
379
|
+
const el = this.$refs.tinymceEditor.editor
|
|
380
|
+
el.editorManager.get(el.id).focus()
|
|
381
|
+
const elList =
|
|
382
|
+
tinymce.activeEditor && tinymce.activeEditor.iframeElement
|
|
383
|
+
? tinymce.activeEditor.iframeElement.contentWindow &&
|
|
384
|
+
tinymce.activeEditor.iframeElement.contentWindow.document.getElementsByTagName(
|
|
385
|
+
'input'
|
|
386
|
+
)
|
|
387
|
+
: []
|
|
388
|
+
elList[index].remove()
|
|
389
|
+
for (let i = 0; i < elList.length; i++) {
|
|
390
|
+
elList[i].setAttribute('value', i + 1)
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
onSure(value) {
|
|
394
|
+
this.$emit('change', {
|
|
395
|
+
value: this.tinymceContent,
|
|
396
|
+
itemAttr: { type: this.fileData.fileType, content: value }
|
|
397
|
+
})
|
|
398
|
+
},
|
|
399
|
+
wordLimit(e, editor) {
|
|
400
|
+
const tinymax = editor.settings.charLimit
|
|
401
|
+
const text = e.target.innerText
|
|
402
|
+
const html = e.target.innerHTML
|
|
403
|
+
let last = ''
|
|
404
|
+
let lastIndex = ''
|
|
405
|
+
let startVal = ''
|
|
406
|
+
let endVal = ''
|
|
407
|
+
if (text.length === tinymax) {
|
|
408
|
+
this.tinymceContent = html
|
|
409
|
+
// 兼容输入法有可能会跳过最大值
|
|
410
|
+
} else if (!this.isComposition && text.length === tinymax + 1) {
|
|
411
|
+
last = text.substr(text.length - 1, 1)
|
|
412
|
+
lastIndex = html.lastIndexOf(last)
|
|
413
|
+
startVal = html.substring(0, lastIndex)
|
|
414
|
+
endVal = html.substring(lastIndex + 1, html.length)
|
|
415
|
+
this.tinymceContent = startVal + endVal
|
|
416
|
+
}
|
|
417
|
+
if (text.length > tinymax) {
|
|
418
|
+
e.target.innerHTML = this.tinymceContent
|
|
419
|
+
this.keepLastIndex()
|
|
420
|
+
editor.focus()
|
|
421
|
+
if (!this.limitNum) {
|
|
422
|
+
this.$message.error(`长度限制为${tinymax}个字符`)
|
|
423
|
+
this.limitNum++
|
|
424
|
+
}
|
|
425
|
+
} else {
|
|
426
|
+
this.limitNum = 0
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
keepLastIndex() {
|
|
430
|
+
const tinymce = window.tinymce.get(this.tinymceId)
|
|
431
|
+
const wind = tinymce.contentWindow
|
|
432
|
+
const obj = wind.document.getElementById('tinymce')
|
|
433
|
+
if (wind.getSelection) {
|
|
434
|
+
// ie11 10 9 ff safari
|
|
435
|
+
obj.focus() // 解决ff不获取焦点无法定位问题
|
|
436
|
+
const range = wind.getSelection() // 创建range
|
|
437
|
+
console.log(range)
|
|
438
|
+
range.selectAllChildren(obj) // range 选择obj下所有子内容
|
|
439
|
+
range.collapseToEnd() // 光标移至最后
|
|
440
|
+
} else if (document.selection) {
|
|
441
|
+
// ie10 9 8 7 6 5
|
|
442
|
+
const range = document.selection.createRange() // 创建选择对象
|
|
443
|
+
range.moveToElementText(obj) // range定位到obj
|
|
444
|
+
range.collapse(false) // 光标移至最后
|
|
445
|
+
range.select()
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Single from './src/single'
|
|
2
|
+
import Multiple from './src/multiple'
|
|
3
|
+
import Judgment from './src/judgment'
|
|
4
|
+
import FillInBlanks from './src/fillInBlanks'
|
|
5
|
+
import ShortAnswer from './src/shortAnswer'
|
|
6
|
+
import PictureAnswer from './src/pictureAnswer'
|
|
7
|
+
import Compound from './src/compound'
|
|
8
|
+
import AudioFrequency from './src/audioFrequency'
|
|
9
|
+
import Attachment from './src/attachment'
|
|
10
|
+
|
|
11
|
+
const components = [
|
|
12
|
+
Single,
|
|
13
|
+
Multiple,
|
|
14
|
+
Judgment,
|
|
15
|
+
FillInBlanks,
|
|
16
|
+
ShortAnswer,
|
|
17
|
+
PictureAnswer,
|
|
18
|
+
Compound,
|
|
19
|
+
AudioFrequency,
|
|
20
|
+
Attachment
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
export default components
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="topic-stem__label required__label">题干</div>
|
|
4
|
+
<yks-tinymce
|
|
5
|
+
key="itemContent"
|
|
6
|
+
v-model="fromData.itemContent"
|
|
7
|
+
:toolbar="toolbar"
|
|
8
|
+
:plugins="plugins"
|
|
9
|
+
:charLimit="topicDataExtent.itemContentLength || 20000"
|
|
10
|
+
:fileParams="getFileTypes('stem', fromData.stemAttrs)"
|
|
11
|
+
:uploadFileToHwCloud="uploadFileToHwCloud"
|
|
12
|
+
:uploadFileFunction="uploadFileFunction"
|
|
13
|
+
menubar=""
|
|
14
|
+
height="200px"
|
|
15
|
+
@change="($event) => getTinymceEdit($event, 'stem')"
|
|
16
|
+
@delte="($event) => handleDelteAttrs($event, 'stem', fromData.stemAttrs)"
|
|
17
|
+
/>
|
|
18
|
+
<div class="topic-stem__label required__label">标准答案</div>
|
|
19
|
+
<yks-tinymce
|
|
20
|
+
key="answer"
|
|
21
|
+
v-model="fromData.answer"
|
|
22
|
+
:toolbar="toolbar"
|
|
23
|
+
:plugins="plugins"
|
|
24
|
+
:charLimit="topicDataExtent.answerLength || 5000"
|
|
25
|
+
:fileParams="getFileTypes('answer', fromData.answerAttrs)"
|
|
26
|
+
:uploadFileToHwCloud="uploadFileToHwCloud"
|
|
27
|
+
:uploadFileFunction="uploadFileFunction"
|
|
28
|
+
menubar=""
|
|
29
|
+
height="200px"
|
|
30
|
+
@change="($event) => getTinymceEdit($event, 'answer')"
|
|
31
|
+
@delte="($event) => handleDelteAttrs($event, 'answer', fromData.answerAttrs)"
|
|
32
|
+
/>
|
|
33
|
+
<div class="topic-stem__label">答案解析</div>
|
|
34
|
+
<yks-tinymce
|
|
35
|
+
key="description"
|
|
36
|
+
v-model="fromData.description"
|
|
37
|
+
:toolbar="toolbar"
|
|
38
|
+
:plugins="plugins"
|
|
39
|
+
:charLimit="topicDataExtent.descriptionLength || 20000"
|
|
40
|
+
:fileParams="getFileTypes('analysis', fromData.descriptionAttrs)"
|
|
41
|
+
:uploadFileToHwCloud="uploadFileToHwCloud"
|
|
42
|
+
:uploadFileFunction="uploadFileFunction"
|
|
43
|
+
menubar=""
|
|
44
|
+
height="200px"
|
|
45
|
+
@change="($event) => getTinymceEdit($event, 'analysis')"
|
|
46
|
+
@delte="($event) => handleDelteAttrs($event, 'analysis', fromData.descriptionAttrs)"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
<script>
|
|
51
|
+
import TopicMixins from 'yks/assets/mixins/topic'
|
|
52
|
+
import { stemItemType, shortItemType, analysisItemType } from './config'
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
name: 'YksAttachment',
|
|
56
|
+
mixins: [TopicMixins],
|
|
57
|
+
methods: {
|
|
58
|
+
/**
|
|
59
|
+
* data 富文本数据
|
|
60
|
+
* field 对象名
|
|
61
|
+
* type 类型
|
|
62
|
+
*/
|
|
63
|
+
getTinymceEdit(data, type) {
|
|
64
|
+
switch (type) {
|
|
65
|
+
case 'stem':
|
|
66
|
+
data.itemAttr.type = stemItemType[data.itemAttr.type]
|
|
67
|
+
this.fromData.itemContent = data.value
|
|
68
|
+
if (data.itemAttr.type && data.itemAttr.content) {
|
|
69
|
+
this.fromData.stemAttrs.push(data.itemAttr)
|
|
70
|
+
}
|
|
71
|
+
break
|
|
72
|
+
case 'answer':
|
|
73
|
+
data.itemAttr.type = shortItemType[data.itemAttr.type]
|
|
74
|
+
this.fromData.answer = data.value
|
|
75
|
+
if (data.itemAttr.type && data.itemAttr.content) {
|
|
76
|
+
this.fromData.answerAttrs.push(data.itemAttr)
|
|
77
|
+
}
|
|
78
|
+
break
|
|
79
|
+
case 'analysis':
|
|
80
|
+
data.itemAttr.type = analysisItemType[data.itemAttr.type]
|
|
81
|
+
this.fromData.description = data.value
|
|
82
|
+
|
|
83
|
+
if (data.itemAttr.type && data.itemAttr.content) {
|
|
84
|
+
this.fromData.descriptionAttrs.push(data.itemAttr)
|
|
85
|
+
}
|
|
86
|
+
break
|
|
87
|
+
default:
|
|
88
|
+
break
|
|
89
|
+
}
|
|
90
|
+
this.$emit('change', this.fromData)
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
handleDelteAttrs(data, type, list, row = {}) {
|
|
94
|
+
const listAttrs = list
|
|
95
|
+
listAttrs.splice(data.index, 1)
|
|
96
|
+
switch (type) {
|
|
97
|
+
case 'stem':
|
|
98
|
+
this.fromData.stemAttrs = listAttrs
|
|
99
|
+
break
|
|
100
|
+
case 'answer':
|
|
101
|
+
this.fromData.answerAttrs = listAttrs
|
|
102
|
+
break
|
|
103
|
+
case 'analysis':
|
|
104
|
+
this.fromData.descriptionAttrs = listAttrs
|
|
105
|
+
break
|
|
106
|
+
default:
|
|
107
|
+
break
|
|
108
|
+
}
|
|
109
|
+
this.$emit('change', this.fromData)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
</script>
|
|
114
|
+
|