imatrix-ui 0.0.15 → 0.1.1-up

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 (171) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +7 -0
  3. package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
  4. package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
  5. package/components/dynamic-source-select/events.js +77 -0
  6. package/components/fs-preview/fs-preview.vue +287 -0
  7. package/components/index.js +26 -0
  8. package/components/plugins/export-data-new.js +623 -0
  9. package/components/plugins/export-data.js +431 -0
  10. package/components/plugins/index.js +15 -0
  11. package/components/plugins/public-method.js +47 -0
  12. package/components/rich-editor/index-bak.vue +306 -0
  13. package/components/rich-editor/index.vue +236 -0
  14. package/components/rich-editor/langs/zh-Hans.js +438 -0
  15. package/components/rich-editor/viewer.vue +105 -0
  16. package/components/super-grid/apis.js +1065 -0
  17. package/components/super-grid/columns-config.vue +430 -0
  18. package/components/super-grid/custom-formatter.js +330 -0
  19. package/components/super-grid/dynamic-input.vue +1706 -0
  20. package/components/super-grid/eventBus.js +2 -0
  21. package/components/super-grid/events.js +56 -0
  22. package/components/super-grid/formValidatorUtil.js +300 -0
  23. package/components/super-grid/formatter.js +190 -0
  24. package/components/super-grid/group-column.vue +100 -0
  25. package/components/super-grid/header-context-menu.vue +82 -0
  26. package/components/super-grid/index-column.vue +69 -0
  27. package/components/super-grid/normal-column.vue +1148 -0
  28. package/components/super-grid/public-methods.js +30 -0
  29. package/components/super-grid/row-operation.vue +193 -0
  30. package/components/super-grid/search-button.vue +74 -0
  31. package/components/super-grid/search-condition-input.vue +73 -0
  32. package/components/super-grid/search-condition-list.vue +68 -0
  33. package/components/super-grid/search-form-advancedQuery.vue +820 -0
  34. package/components/super-grid/search-form-dialog.vue +77 -0
  35. package/components/super-grid/search-form-item.vue +470 -0
  36. package/components/super-grid/search-form-number.vue +111 -0
  37. package/components/super-grid/search-form-open.vue +178 -0
  38. package/components/super-grid/search-form-ordinarySearch.vue +218 -0
  39. package/components/super-grid/search-form.vue +756 -0
  40. package/components/super-grid/search-methods.js +484 -0
  41. package/components/super-grid/selection-column.vue +46 -0
  42. package/components/super-grid/store.js +3 -0
  43. package/components/super-grid/super-grid-service.js +682 -0
  44. package/components/super-grid/super-grid.vue +2893 -0
  45. package/components/super-grid/utils.js +851 -0
  46. package/components/super-grid/view-image-dialog.vue +173 -0
  47. package/components/utils/gogocodeTransfer.js +59 -0
  48. package/components/utils/utils.js +180 -0
  49. package/components/utils/value-set.js +98 -0
  50. package/components/z-test-utton/index.vue +82 -0
  51. package/package.json +29 -40
  52. package/public/index.html +13 -0
  53. package/public/vite.svg +1 -0
  54. package/src/api/sso-service.js +172 -19
  55. package/src/api/tab.js +36 -0
  56. package/src/api/user-service.js +11 -11
  57. package/src/assets/401/401.gif +0 -0
  58. package/src/assets/404/404-cloud.png +0 -0
  59. package/src/assets/404/404.png +0 -0
  60. package/src/assets/cloud.png +0 -0
  61. package/src/directives/permission/index.js +13 -13
  62. package/src/directives/permission/permission.js +20 -15
  63. package/src/i18n/i18n.js +16 -0
  64. package/src/i18n/langs/cn.js +254 -0
  65. package/src/i18n/langs/en.js +264 -0
  66. package/src/permission.js +157 -71
  67. package/src/plugins.js +18 -18
  68. package/src/router/index.js +96 -69
  69. package/src/store/getters.js +15 -10
  70. package/src/store/index.js +19 -19
  71. package/src/store/modules/app.js +54 -42
  72. package/src/store/modules/permission.js +137 -73
  73. package/src/store/modules/tab-content.js +36 -0
  74. package/src/store/modules/user.js +293 -80
  75. package/src/styles/display-layout.scss +34 -0
  76. package/src/styles/element-ui.scss +29 -29
  77. package/src/styles/index.scss +157 -78
  78. package/src/styles/mixin.scss +27 -27
  79. package/src/styles/theme/black/font-style.scss +70 -0
  80. package/src/styles/theme/black/index.scss +306 -0
  81. package/src/styles/theme/black/sidebar.scss +189 -0
  82. package/src/styles/theme/blue/font-style.scss +46 -0
  83. package/src/styles/theme/blue/index.scss +172 -0
  84. package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
  85. package/src/styles/theme/blue2/font-style.scss +70 -0
  86. package/src/styles/theme/blue2/index.scss +188 -0
  87. package/src/styles/theme/blue2/sidebar.scss +201 -0
  88. package/src/styles/theme/dark-blue/button.scss +9 -0
  89. package/src/styles/theme/dark-blue/card.scss +62 -0
  90. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  91. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  92. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  93. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  94. package/src/styles/theme/dark-blue/font.scss +71 -0
  95. package/src/styles/theme/dark-blue/form.scss +51 -0
  96. package/src/styles/theme/dark-blue/index.scss +269 -0
  97. package/src/styles/theme/dark-blue/input.scss +15 -0
  98. package/src/styles/theme/dark-blue/message.scss +8 -0
  99. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  100. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  101. package/src/styles/theme/dark-blue/sidebar.scss +266 -0
  102. package/src/styles/theme/dark-blue/tab.scss +83 -0
  103. package/src/styles/theme/dark-blue/table.scss +60 -0
  104. package/src/styles/theme/dark-blue/tree.scss +31 -0
  105. package/src/styles/theme/dark-blue/var.scss +1028 -0
  106. package/src/styles/theme/gray/card-style.scss +54 -0
  107. package/src/styles/theme/gray/font-style.scss +70 -0
  108. package/src/styles/theme/gray/index.scss +172 -0
  109. package/src/styles/theme/gray/input-style.scss +19 -0
  110. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  111. package/src/styles/theme/gray/sidebar.scss +231 -0
  112. package/src/styles/theme/gray/tab-style.scss +81 -0
  113. package/src/styles/transition.scss +47 -46
  114. package/src/utils/auth-api.js +159 -0
  115. package/src/utils/auth.js +61 -15
  116. package/src/utils/calculator/calculator-factory-wf.js +558 -0
  117. package/src/utils/calculator/calculator-factory.js +145 -0
  118. package/src/utils/calculator/calculator-util.js +166 -0
  119. package/src/utils/common-util.js +305 -0
  120. package/src/utils/eventBus.js +2 -0
  121. package/src/utils/iconUtils.js +28 -0
  122. package/src/utils/index.js +102 -86
  123. package/src/utils/jump-page-utils.js +814 -0
  124. package/src/utils/local-storage.js +33 -31
  125. package/src/utils/menu.js +19 -0
  126. package/src/utils/permission.js +31 -26
  127. package/src/utils/permissionAuth.js +90 -0
  128. package/src/utils/range-selector.js +188 -0
  129. package/src/utils/request.js +270 -116
  130. package/src/utils/restful-interface-utils.js +57 -0
  131. package/src/utils/util.js +698 -0
  132. package/src/utils/validate.js +34 -33
  133. package/src/utils/watermark.js +108 -0
  134. package/src/utils/workflow-util.js +93 -0
  135. package/src/views/404.vue +248 -228
  136. package/src/views/dsc-component/Sidebar/Item.vue +84 -0
  137. package/src/views/dsc-component/Sidebar/Link.vue +38 -0
  138. package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
  139. package/src/views/dsc-component/Sidebar/index.vue +220 -0
  140. package/src/views/dsc-component/tabs/tab-content.vue +199 -0
  141. package/src/views/error-page/401.vue +106 -91
  142. package/src/views/error-page/404.vue +248 -228
  143. package/src/views/layout/EmptyLayout.vue +3 -0
  144. package/src/views/layout/Layout.vue +81 -68
  145. package/src/views/layout/NewLayout.vue +18 -0
  146. package/src/views/layout/components/AppMain.vue +39 -29
  147. package/src/views/layout/components/Breadcrumb/index.vue +156 -0
  148. package/src/views/layout/components/Menubar/Item.vue +57 -0
  149. package/src/views/layout/components/Menubar/Link.vue +38 -0
  150. package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
  151. package/src/views/layout/components/Menubar/index.vue +210 -0
  152. package/src/views/layout/components/Sidebar/Item.vue +53 -29
  153. package/src/views/layout/components/Sidebar/Link.vue +38 -39
  154. package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
  155. package/src/views/layout/components/Sidebar/index.vue +141 -48
  156. package/src/views/layout/components/iframe-page.vue +38 -0
  157. package/src/views/layout/components/index.js +4 -3
  158. package/src/views/layout/components/tabs/tab-content.vue +207 -0
  159. package/src/views/layout/mixin/ResizeHandler.js +41 -41
  160. package/src/views/layout/tab-content-iframe-index.vue +38 -0
  161. package/src/views/layout/tab-content-index.vue +93 -0
  162. package/src/views/login/authredirect.vue +10 -10
  163. package/src/views/login/index.vue +296 -203
  164. package/src/views/login/update-password.vue +243 -0
  165. package/src/views/redirect/index.vue +14 -12
  166. package/src/views/wf-history/tache-subprocess-history.vue +45 -0
  167. package/vite.config.js +31 -0
  168. package/lib/super-ui.css +0 -1
  169. package/lib/super-ui.umd.min.js +0 -2
  170. package/src/styles/variables.scss +0 -4
  171. package/src/views/layout/components/Navbar.vue +0 -92
@@ -0,0 +1,306 @@
1
+ <template>
2
+ <div :style="{ maxHeight: maxHeight + 'px' }">
3
+ <!--<Editor-->
4
+ <!-- v-if="!disabled"-->
5
+ <!-- v-model:value="contentValue"-->
6
+ <!-- :init="init"-->
7
+ <!-- :disabled="disabled"-->
8
+ <!--/>-->
9
+ <div>
10
+ <div
11
+ :id="viewerId"
12
+ :style="{ maxHeight: maxHeight + 'px' }"
13
+ style="overflow: auto; border: 1px solid #dcdfe6; padding: 2px"
14
+ />
15
+ <el-tooltip
16
+ :content="$t('imatrixUIPublicModel.fullScreen')"
17
+ class="item"
18
+ effect="dark"
19
+ placement="top"
20
+ >
21
+ <em
22
+ class="el-icon-full-screen"
23
+ style="z-index: 1; right: 20px; position: absolute; top: 2px"
24
+ @click="fullScreenContent"
25
+ />
26
+ </el-tooltip>
27
+ <el-image
28
+ ref="previewImg"
29
+ :src="srcList[0]"
30
+ :preview-src-list="srcList"
31
+ style="display: none; width: 100px; height: 100px"
32
+ />
33
+ </div>
34
+ <el-dialog
35
+ v-model="dialogVisible"
36
+ :title="title"
37
+ destroy-on-close
38
+ append-to-body
39
+ fullscreen
40
+ >
41
+ <div :id="fullscreenViewerId" />
42
+ </el-dialog>
43
+ </div>
44
+ </template>
45
+
46
+ <script>
47
+ import { $on, $off, $once, $emit } from '../utils/gogocodeTransfer'
48
+
49
+ import { getLanguageWithLocale } from '../../src/utils/util'
50
+ // 引入tinymce编辑器
51
+ // import Editor from '@tinymce/tinymce-vue'
52
+ // // 引入node_modules里的tinymce相关文件文件
53
+ // import * as tinymce from 'tinymce/tinymce' // tinymce默认hidden,不引入则不显示编辑器
54
+ // import 'tinymce/themes/silver' // 编辑器主题,不引入则报错
55
+ // import 'tinymce/icons/default' // 引入编辑器图标icon,不引入则不显示对应图标
56
+ //
57
+ // // 引入编辑器插件
58
+ // import 'tinymce/plugins/advlist' // 高级列表
59
+ // // import 'tinymce/plugins/anchor' // 锚点
60
+ // // import 'tinymce/plugins/autolink' // 自动链接
61
+ // // import 'tinymce/plugins/autoresize' // 编辑器高度自适应,注:plugins里引入此插件时,Init里设置的height将失效
62
+ // // import 'tinymce/plugins/autosave' // 自动存稿
63
+ // import 'tinymce/plugins/directionality' // 文字方向
64
+ // // import 'tinymce/plugins/fullpage' // 文档属性
65
+ // import 'tinymce/plugins/fullscreen' // 全屏
66
+ // // import 'tinymce/plugins/hr' // 水平分割线
67
+ // import 'tinymce/plugins/image' // 插入编辑图片
68
+ // // import 'tinymce/plugins/importcss' // 引入css
69
+ // // import 'tinymce/plugins/insertdatetime' // 插入日期时间
70
+ // import 'tinymce/plugins/link' // 超链接
71
+ // import 'tinymce/plugins/lists' // 列表插件
72
+ // // import 'tinymce/plugins/media' // 插入编辑媒体
73
+ // // import 'tinymce/plugins/nonbreaking' // 插入不间断空格
74
+ // // import 'tinymce/plugins/pagebreak' // 插入分页符
75
+ // // import 'tinymce/plugins/paste' // 粘贴插件
76
+ // import 'tinymce/plugins/preview' // 预览
77
+ // // import 'tinymce/plugins/print' // 打印
78
+ // import 'tinymce/plugins/quickbars' // 快速工具栏
79
+ // import 'tinymce/plugins/save' // 保存
80
+ // import 'tinymce/plugins/searchreplace' // 查找替换
81
+ // // import 'tinymce/plugins/spellchecker' //拼写检查,暂未加入汉化,不建议使用
82
+ // // import 'tinymce/plugins/tabfocus' // 切入切出,按tab键切出编辑器,切入页面其他输入框中
83
+ // import 'tinymce/plugins/table' // 表格
84
+ // // import 'tinymce/plugins/template' // 内容模板
85
+ // // import 'tinymce/plugins/textcolor' // 文字颜色
86
+ // // import 'tinymce/plugins/textpattern' // 快速排版
87
+ // // import 'tinymce/plugins/toc' // 目录生成器
88
+ // // import 'tinymce/plugins/visualblocks' // 显示元素范围
89
+ // // import 'tinymce/plugins/visualchars' // 显示不可见字符
90
+ // import 'tinymce/plugins/wordcount' // 字数统计
91
+ // // 样式
92
+ // // import 'tinymce/skins/content/default/content.min.css'
93
+ // import 'tinymce/skins/ui/oxide/skin.min.css'
94
+ // import 'tinymce/skins/ui/oxide/content.min.css'
95
+ // // 主题
96
+ // import 'tinymce/themes/silver'
97
+ import * as Vue from 'vue'
98
+ export default {
99
+ name: 'RichEditor',
100
+ components: {
101
+ // Editor,
102
+ },
103
+ props: {
104
+ entity: {
105
+ type: Object,
106
+ default: null,
107
+ },
108
+ prop: {
109
+ type: String,
110
+ default: null,
111
+ },
112
+ value: {
113
+ type: String,
114
+ default: '',
115
+ },
116
+ disabled: {
117
+ type: Boolean,
118
+ default: false,
119
+ },
120
+ options: {
121
+ type: Object,
122
+ default: null,
123
+ },
124
+ title: {
125
+ type: String,
126
+ default: '',
127
+ },
128
+ plugins: {
129
+ type: [String, Array],
130
+ default:
131
+ 'paste print preview searchreplace directionality fullscreen image link table hr advlist lists wordcount ',
132
+ },
133
+ toolbar: {
134
+ type: [String, Array],
135
+ default:
136
+ ' undo redo | formatselect fontsizeselect bold italic strikethrough underline hr forecolor backcolor | image | ' +
137
+ ' lineheight bullist numlist table | print fullscreen preview ',
138
+ },
139
+ },
140
+ data() {
141
+ const _that = this
142
+ if (getLanguageWithLocale() === 'zh_CN') {
143
+ require('./langs/zh-Hans.js')
144
+ }
145
+ let maxHeight = '400'
146
+ if (this.options && this.options.maxHeight) {
147
+ maxHeight = this.options.maxHeight
148
+ }
149
+ return {
150
+ maxHeight,
151
+ init: {
152
+ height: maxHeight,
153
+ language: 'zh-Hans', // 语言类型
154
+ plugins: this.plugins, // 插件配置
155
+ toolbar: this.toolbar, // 工具栏配置,设为false则隐藏
156
+ menubar: false, // 菜单栏配置,设为false则隐藏,不配置则默认显示全部菜单,也可自定义配置--查看 http://tinymce.ax-z.cn/configure/editor-appearance.php --搜索“自定义菜单”
157
+ fontsize_formats:
158
+ '12px 14px 16px 18px 20px 22px 24px 28px 32px 36px 48px 56px 72px', // 字体大小
159
+ font_formats:
160
+ '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;', // 字体样式
161
+ // 自带默认字体:'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats'
162
+ lineheight_formats: '0.5 0.8 1 1.2 1.5 1.75 2 2.5 3 4 5', // 行高配置,也可配置成"12px 14px 16px 20px"这种形式
163
+ placeholder: '在这里输入文字',
164
+ branding: false, // tiny技术支持信息是否显示
165
+ resize: false, // 编辑器宽高是否可变,false-否,true-高可变,'both'-宽高均可,注意引号
166
+ // statusbar: false, //最下方的元素路径和字数统计那一栏是否显示
167
+ elementpath: false, // 元素路径是否显示
168
+ // image_caption: true,
169
+ // relative_urls: false, //false: tinymce将不再自动将文件路径由绝对转为相对
170
+ // convert_urls: false, //false: tinymce将不再自动处理文件路径
171
+ // file_picker_callback: () => {
172
+ // alert(11)
173
+ // },
174
+ image_description: false,
175
+ content_style: 'img {width:400px;height:300px}', // 直接自定义可编辑区域的css样式
176
+ // content_css: '/tinycontent.css', //以css文件方式自定义可编辑区域的css样式,css文件需自己创建并引入
177
+ // images_upload_url: '/apib/api-upload/uploadimg', //后端处理程序的url,建议直接自定义上传函数image_upload_handler,这个就可以不用了
178
+ // images_upload_base_path: '/demo', //相对基本路径--关于图片上传建议查看--http://tinymce.ax-z.cn/general/upload-images.php
179
+ paste_data_images: true, // 图片是否可粘贴'
180
+ urlconverter_callback: (url, node, onSave, name) => {
181
+ if (node === 'img' && url.startsWith('blob:')) {
182
+ console.log('urlconverter_callback ....')
183
+ tinymce.activeEditor && tinymce.activeEditor.uploadImages()
184
+ return url
185
+ }
186
+ return url
187
+ },
188
+ images_upload_handler: (blobInfo, success, failure, progress) => {
189
+ let file
190
+ if (blobInfo.blob() instanceof File) {
191
+ console.log('images_upload_handler .File')
192
+ file = blobInfo.blob()
193
+ } else {
194
+ console.log('images_upload_handler .base64')
195
+ file = _that.base64ToFile(blobInfo.base64(), 'a.png')
196
+ }
197
+ const params = new FormData()
198
+ params.append('file', file)
199
+ const config = {
200
+ headers: {
201
+ 'Content-Type': 'multipart/form-data',
202
+ },
203
+ }
204
+ _that.$http
205
+ .post('/common/fs-upload/rich-editor-image', params, config)
206
+ .then((res) => {
207
+ console.log(res)
208
+ success(res.url)
209
+ })
210
+ .catch(() => {
211
+ failure('上传出错,服务器开小差了呢')
212
+ })
213
+ },
214
+ },
215
+ contentValue: this.value,
216
+ markValue: '',
217
+ srcList: [],
218
+ psrcList: [],
219
+ viewerId: 'aglie_rich_editor_' + new Date().getTime(),
220
+ dialogVisible: false,
221
+ fullscreenViewerId: 'editor_viewer_' + new Date().getTime(),
222
+ ImageComponent: null,
223
+ }
224
+ },
225
+ watch: {
226
+ value: {
227
+ deep: true,
228
+ handler(newValue, oldValue) {
229
+ this.contentValue = newValue
230
+ this.entity[this.prop] = newValue
231
+ },
232
+ },
233
+ contentValue: {
234
+ deep: true,
235
+ handler(newValue, oldValue) {
236
+ $emit(this, 'update:value', newValue)
237
+ this.entity[this.prop] = newValue
238
+ },
239
+ },
240
+ disabled: {
241
+ deep: true,
242
+ handler(newValue, oldValue) {
243
+ if (newValue) {
244
+ this.initViewer()
245
+ }
246
+ },
247
+ },
248
+ },
249
+ created() {},
250
+ mounted() {
251
+ // if (this.disabled) {
252
+ // this.initViewer()
253
+ // } else {
254
+ // tinymce.init(this.init)
255
+ // }
256
+ },
257
+ methods: {
258
+ showImage($event) {
259
+ console.log(this.$refs.previewImg)
260
+ this.srcList = [$event.target.currentSrc]
261
+ this.$refs.previewImg.showViewer = true
262
+ },
263
+ fullScreenContent() {
264
+ this.dialogVisible = true
265
+ this.$nextTick(() => {
266
+ // 必须得再new一个, 不然会导致表单里显示。弹框不显示,弹框显示,表单不显示内容
267
+ const viewContent = new this.ImageComponent().$mount()
268
+ document
269
+ .getElementById(this.fullscreenViewerId)
270
+ .appendChild(viewContent.$el)
271
+ })
272
+ },
273
+ initViewer() {
274
+ const that = this
275
+ let m = this.value.replaceAll('<img', '<img @click="showImage" ')
276
+ m = '<div> ' + m + ' </div> '
277
+ this.ImageComponent = {
278
+ methods: {
279
+ showImage($event) {
280
+ console.log($event)
281
+ that.showImage($event)
282
+ },
283
+ },
284
+ template: m,
285
+ emits: ['update:value'],
286
+ }
287
+ const viewContent = new this.ImageComponent().$mount()
288
+ this.$nextTick(() => {
289
+ document.getElementById(this.viewerId).appendChild(viewContent.$el)
290
+ })
291
+ },
292
+ base64ToFile(data, filename) {
293
+ var bstr = atob(data)
294
+ var n = bstr.length
295
+ var u8arr = new Uint8Array(n)
296
+ filename =
297
+ new Date().getTime() + '-' + Math.floor(Math.random() * 10000) + '.png'
298
+ while (n--) {
299
+ u8arr[n] = bstr.charCodeAt(n)
300
+ }
301
+ return new File([u8arr], filename, { type: 'image/png' })
302
+ },
303
+ },
304
+ emits: ['update:value'],
305
+ }
306
+ </script>
@@ -0,0 +1,236 @@
1
+ <template>
2
+ <main id="sample">
3
+ <Editor
4
+ api-key="no-api-key"
5
+ :init="{
6
+ plugins: 'lists link image table code help wordcount'
7
+ }"
8
+ />
9
+ </main>
10
+ </template>
11
+ <style scoped>
12
+ .logo {
13
+ display: block;
14
+ margin: 0 auto 2rem;
15
+ }
16
+
17
+ @media (min-width: 1024px) {
18
+ #sample {
19
+ display: flex;
20
+ flex-direction: column;
21
+ place-items: center;
22
+ width: 1000px;
23
+ }
24
+ }
25
+ </style>
26
+ <script>
27
+ import Editor from '@tinymce/tinymce-vue'
28
+ export default {
29
+ name: 'RichEditor',
30
+ components: {
31
+ // Editor,
32
+ },
33
+ props: {
34
+ entity: {
35
+ type: Object,
36
+ default: null,
37
+ },
38
+ prop: {
39
+ type: String,
40
+ default: null,
41
+ },
42
+ value: {
43
+ type: String,
44
+ default: '',
45
+ },
46
+ disabled: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ options: {
51
+ type: Object,
52
+ default: null,
53
+ },
54
+ title: {
55
+ type: String,
56
+ default: '',
57
+ },
58
+ plugins: {
59
+ type: [String, Array],
60
+ default:
61
+ 'paste print preview searchreplace directionality fullscreen image link table hr advlist lists wordcount ',
62
+ },
63
+ toolbar: {
64
+ type: [String, Array],
65
+ default:
66
+ ' undo redo | formatselect fontsizeselect bold italic strikethrough underline hr forecolor backcolor | image | ' +
67
+ ' lineheight bullist numlist table | print fullscreen preview ',
68
+ },
69
+ },
70
+ data() {
71
+ const _that = this
72
+ if (getLanguageWithLocale() === 'zh_CN') {
73
+ require('./langs/zh-Hans.js')
74
+ }
75
+ let maxHeight = '400'
76
+ if (this.options && this.options.maxHeight) {
77
+ maxHeight = this.options.maxHeight
78
+ }
79
+ return {
80
+ maxHeight,
81
+ init: {
82
+ height: maxHeight,
83
+ language: 'zh-Hans', // 语言类型
84
+ plugins: this.plugins, // 插件配置
85
+ toolbar: this.toolbar, // 工具栏配置,设为false则隐藏
86
+ menubar: false, // 菜单栏配置,设为false则隐藏,不配置则默认显示全部菜单,也可自定义配置--查看 http://tinymce.ax-z.cn/configure/editor-appearance.php --搜索“自定义菜单”
87
+ fontsize_formats:
88
+ '12px 14px 16px 18px 20px 22px 24px 28px 32px 36px 48px 56px 72px', // 字体大小
89
+ font_formats:
90
+ '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;', // 字体样式
91
+ // 自带默认字体:'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats'
92
+ lineheight_formats: '0.5 0.8 1 1.2 1.5 1.75 2 2.5 3 4 5', // 行高配置,也可配置成"12px 14px 16px 20px"这种形式
93
+ placeholder: '在这里输入文字',
94
+ branding: false, // tiny技术支持信息是否显示
95
+ resize: false, // 编辑器宽高是否可变,false-否,true-高可变,'both'-宽高均可,注意引号
96
+ // statusbar: false, //最下方的元素路径和字数统计那一栏是否显示
97
+ elementpath: false, // 元素路径是否显示
98
+ // image_caption: true,
99
+ // relative_urls: false, //false: tinymce将不再自动将文件路径由绝对转为相对
100
+ // convert_urls: false, //false: tinymce将不再自动处理文件路径
101
+ // file_picker_callback: () => {
102
+ // alert(11)
103
+ // },
104
+ image_description: false,
105
+ content_style: 'img {width:400px;height:300px}', // 直接自定义可编辑区域的css样式
106
+ // content_css: '/tinycontent.css', //以css文件方式自定义可编辑区域的css样式,css文件需自己创建并引入
107
+ // images_upload_url: '/apib/api-upload/uploadimg', //后端处理程序的url,建议直接自定义上传函数image_upload_handler,这个就可以不用了
108
+ // images_upload_base_path: '/demo', //相对基本路径--关于图片上传建议查看--http://tinymce.ax-z.cn/general/upload-images.php
109
+ paste_data_images: true, // 图片是否可粘贴'
110
+ urlconverter_callback: (url, node, onSave, name) => {
111
+ if (node === 'img' && url.startsWith('blob:')) {
112
+ console.log('urlconverter_callback ....')
113
+ tinymce.activeEditor && tinymce.activeEditor.uploadImages()
114
+ return url
115
+ }
116
+ return url
117
+ },
118
+ images_upload_handler: (blobInfo, success, failure, progress) => {
119
+ let file
120
+ if (blobInfo.blob() instanceof File) {
121
+ console.log('images_upload_handler .File')
122
+ file = blobInfo.blob()
123
+ } else {
124
+ console.log('images_upload_handler .base64')
125
+ file = _that.base64ToFile(blobInfo.base64(), 'a.png')
126
+ }
127
+ const params = new FormData()
128
+ params.append('file', file)
129
+ const config = {
130
+ headers: {
131
+ 'Content-Type': 'multipart/form-data',
132
+ },
133
+ }
134
+ _that.$http
135
+ .post('/common/fs-upload/rich-editor-image', params, config)
136
+ .then((res) => {
137
+ console.log(res)
138
+ success(res.url)
139
+ })
140
+ .catch(() => {
141
+ failure('上传出错,服务器开小差了呢')
142
+ })
143
+ },
144
+ },
145
+ contentValue: this.value,
146
+ markValue: '',
147
+ srcList: [],
148
+ psrcList: [],
149
+ viewerId: 'aglie_rich_editor_' + new Date().getTime(),
150
+ dialogVisible: false,
151
+ fullscreenViewerId: 'editor_viewer_' + new Date().getTime(),
152
+ ImageComponent: null,
153
+ }
154
+ },
155
+ watch: {
156
+ value: {
157
+ deep: true,
158
+ handler(newValue, oldValue) {
159
+ this.contentValue = newValue
160
+ this.entity[this.prop] = newValue
161
+ },
162
+ },
163
+ contentValue: {
164
+ deep: true,
165
+ handler(newValue, oldValue) {
166
+ $emit(this, 'update:value', newValue)
167
+ this.entity[this.prop] = newValue
168
+ },
169
+ },
170
+ disabled: {
171
+ deep: true,
172
+ handler(newValue, oldValue) {
173
+ if (newValue) {
174
+ this.initViewer()
175
+ }
176
+ },
177
+ },
178
+ },
179
+ created() {},
180
+ mounted() {
181
+ // if (this.disabled) {
182
+ // this.initViewer()
183
+ // } else {
184
+ // tinymce.init(this.init)
185
+ // }
186
+ },
187
+ methods: {
188
+ showImage($event) {
189
+ console.log(this.$refs.previewImg)
190
+ this.srcList = [$event.target.currentSrc]
191
+ this.$refs.previewImg.showViewer = true
192
+ },
193
+ fullScreenContent() {
194
+ this.dialogVisible = true
195
+ this.$nextTick(() => {
196
+ // 必须得再new一个, 不然会导致表单里显示。弹框不显示,弹框显示,表单不显示内容
197
+ const viewContent = new this.ImageComponent().$mount()
198
+ document
199
+ .getElementById(this.fullscreenViewerId)
200
+ .appendChild(viewContent.$el)
201
+ })
202
+ },
203
+ initViewer() {
204
+ const that = this
205
+ let m = this.value.replaceAll('<img', '<img @click="showImage" ')
206
+ m = '<div> ' + m + ' </div> '
207
+ this.ImageComponent = {
208
+ methods: {
209
+ showImage($event) {
210
+ console.log($event)
211
+ that.showImage($event)
212
+ },
213
+ },
214
+ template: m,
215
+ emits: ['update:value'],
216
+ }
217
+ const viewContent = new this.ImageComponent().$mount()
218
+ this.$nextTick(() => {
219
+ document.getElementById(this.viewerId).appendChild(viewContent.$el)
220
+ })
221
+ },
222
+ base64ToFile(data, filename) {
223
+ var bstr = atob(data)
224
+ var n = bstr.length
225
+ var u8arr = new Uint8Array(n)
226
+ filename =
227
+ new Date().getTime() + '-' + Math.floor(Math.random() * 10000) + '.png'
228
+ while (n--) {
229
+ u8arr[n] = bstr.charCodeAt(n)
230
+ }
231
+ return new File([u8arr], filename, { type: 'image/png' })
232
+ },
233
+ },
234
+ emits: ['update:value'],
235
+ }
236
+ </script>