@ajaxjs/ui 1.0.5 → 1.1.0

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 (53) hide show
  1. package/dist/components/form/HtmlEditor/HtmlEditor.js +69 -76
  2. package/dist/components/form/HtmlEditor/HtmlEditor.js.map +1 -1
  3. package/dist/components/form/HtmlEditor/HtmlEditor.less +5 -1
  4. package/dist/components/form/HtmlEditor/HtmlEditor.ts +78 -84
  5. package/dist/components/form/HtmlEditor/HtmlEditor.vue +19 -19
  6. package/package.json +7 -3
  7. package/.browserslistrc +0 -3
  8. package/.eslintrc.js +0 -25
  9. package/babel.config.js +0 -5
  10. package/public/favicon.ico +0 -0
  11. package/public/index.html +0 -24
  12. package/src/App.vue +0 -32
  13. package/src/assets/logo.png +0 -0
  14. package/src/components/form/AjSelect.vue +0 -33
  15. package/src/components/form/HtmlEditor/HtmlEditor.less +0 -161
  16. package/src/components/form/HtmlEditor/HtmlEditor.ts +0 -339
  17. package/src/components/form/HtmlEditor/HtmlEditor.vue +0 -70
  18. package/src/components/form/HtmlEditor/html-editor-HtmlSanitizer.js +0 -103
  19. package/src/components/form/TreeLikeSelect.vue +0 -125
  20. package/src/components/list/attachment-picture-list.ts +0 -57
  21. package/src/components/list/list.js +0 -227
  22. package/src/components/list/list.ts +0 -261
  23. package/src/components/widgets/AccordionMenu.vue +0 -138
  24. package/src/components/widgets/AdjustFontSize.vue +0 -66
  25. package/src/components/widgets/AjAvatar.vue +0 -42
  26. package/src/components/widgets/Article.vue +0 -49
  27. package/src/components/widgets/BaiduSearch.vue +0 -50
  28. package/src/components/widgets/Expander.vue +0 -65
  29. package/src/components/widgets/ImageEnlarger.vue +0 -42
  30. package/src/components/widgets/OpacityBanner.vue +0 -124
  31. package/src/components/widgets/ProcessLine.vue +0 -133
  32. package/src/globalDeclare/shims.d.ts +0 -4
  33. package/src/index.ts +0 -8
  34. package/src/main.ts +0 -12
  35. package/src/pages/Nav.vue +0 -23
  36. package/src/pages/common.less +0 -10
  37. package/src/pages/demo/Article.vue +0 -30
  38. package/src/pages/demo/Form.vue +0 -35
  39. package/src/pages/demo/Wdigets.vue +0 -168
  40. package/src/router/index.js +0 -39
  41. package/src/router/index.js.map +0 -1
  42. package/src/router/index.ts +0 -39
  43. package/src/shims-tsx.d.ts +0 -13
  44. package/src/shims-vue.d.ts +0 -4
  45. package/src/style/common-functions.less +0 -171
  46. package/src/style/reset.less +0 -18
  47. package/src/views/About.vue +0 -5
  48. package/src/views/Home.vue +0 -49
  49. package/src/views/desktop/Desktop.vue +0 -251
  50. package/src/views/desktop/Window.vue +0 -62
  51. package/src/views/desktop/desktop.md +0 -14
  52. package/tsconfig.json +0 -31
  53. package/vue.config.js +0 -17
package/public/index.html DELETED
@@ -1,24 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
- <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8
-
9
- <!-- <script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
10
- <script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script> -->
11
-
12
- <!-- <link href="https://cdn.bootcdn.net/ajax/libs/ionicons/3.0.0/css/ionicons-core.min.css" rel="stylesheet">
13
- <link href="https://cdn.bootcdn.net/ajax/libs/ionicons/3.0.0/css/ionicons.min.css" rel="stylesheet"> -->
14
- <!-- <link href="//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" /> -->
15
- <title><%= htmlWebpackPlugin.options.title %></title>
16
- </head>
17
- <body>
18
- <noscript>
19
- <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
20
- </noscript>
21
- <div id="app"></div>
22
- <!-- built files will be auto injected -->
23
- </body>
24
- </html>
package/src/App.vue DELETED
@@ -1,32 +0,0 @@
1
- <template>
2
- <div id="app">
3
- <div id="nav">
4
- <router-link to="/">Home</router-link> |
5
- <router-link to="/about">About</router-link>
6
- </div>
7
- <router-view />
8
- </div>
9
- </template>
10
-
11
- <style lang="less">
12
- #app {
13
- font-family: Avenir, Helvetica, Arial, sans-serif;
14
- -webkit-font-smoothing: antialiased;
15
- -moz-osx-font-smoothing: grayscale;
16
- text-align: center;
17
- color: #2c3e50;
18
- }
19
-
20
- #nav {
21
- padding: 30px;
22
-
23
- a {
24
- font-weight: bold;
25
- color: #2c3e50;
26
-
27
- &.router-link-exact-active {
28
- color: #42b983;
29
- }
30
- }
31
- }
32
- </style>
Binary file
@@ -1,33 +0,0 @@
1
- <template>
2
- <select :name="name" class="aj-form-select">
3
- <template v-for="value, key, index in options">
4
- <option v-if="index === selectedIndex" selected :value="value" :key="index">{{key}}</option>
5
- <option v-else :value="value" :key="index">{{key}}</option>
6
- </template>
7
- </select>
8
- </template>
9
-
10
- <script>
11
- /**
12
- * 最简单的下拉列表
13
- */
14
- export default {
15
- props: {
16
- name: { type: String, required: true }, // name for form
17
- options: { type: Object, required: true }, // JSON input data
18
- selectedIndex: { type: Number }, // starts form 0
19
- },
20
- };
21
- </script>
22
-
23
- <style lang="less" scoped>
24
- .aj-form-select {
25
- padding: 1px 4px;
26
- -moz-appearance: none;
27
- -webkit-appearance: none;
28
- border-color: #abadb3;
29
- background: white
30
- url("data:image/gif;base64,R0lGODlhCwAGAIABAGBgYP///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0MzQyLCAyMDEwLzAxLzEwLTE4OjA2OjQzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjc1MEE0M0UzRTU5RDExRTVBNjNDRDVBNzRBRkUxMjYxIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjc1MEE0M0U0RTU5RDExRTVBNjNDRDVBNzRBRkUxMjYxIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NzUwQTQzRTFFNTlEMTFFNUE2M0NENUE3NEFGRTEyNjEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NzUwQTQzRTJFNTlEMTFFNUE2M0NENUE3NEFGRTEyNjEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4B//79/Pv6+fj39vX08/Lx8O/u7ezr6uno5+bl5OPi4eDf3t3c29rZ2NfW1dTT0tHQz87NzMvKycjHxsXEw8LBwL++vby7urm4t7a1tLOysbCvrq2sq6qpqKempaSjoqGgn56dnJuamZiXlpWUk5KRkI+OjYyLiomIh4aFhIOCgYB/fn18e3p5eHd2dXRzcnFwb25tbGtqaWhnZmVkY2JhYF9eXVxbWllYV1ZVVFNSUVBPTk1MS0pJSEdGRURDQkFAPz49PDs6OTg3NjU0MzIxMC8uLSwrKikoJyYlJCMiISAfHh0cGxoZGBcWFRQTEhEQDw4NDAsKCQgHBgUEAwIBAAAh+QQBAAABACwAAAAACwAGAAACD0R+hqDB6B5radL1ILynAAA7")
31
- no-repeat right;
32
- }
33
- </style>
@@ -1,161 +0,0 @@
1
- @import 'https://netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css';
2
-
3
- .aj-form-html-editor {
4
- ul.toolbar {
5
- border : 1px solid #C5C5C5;
6
- border-radius : 4px 4px 0 0;
7
- border-bottom : 0;
8
- background-color: #E8E7E4;
9
- width : 100%;
10
- height : 30px;
11
- margin : 0;
12
- box-sizing : border-box;
13
- padding : 3px 4px;
14
-
15
- &>li {
16
- list-style: none;
17
- float : left;
18
- cursor : pointer;
19
-
20
- &>i {
21
- border : 1px solid transparent;
22
- min-width : 25px;
23
- height : 20px;
24
- line-height: 20px;
25
- text-align : center;
26
- display : block;
27
- padding-top: 2px;
28
- font : normal normal normal 18px/1 FontAwesome;
29
-
30
- &:hover {
31
- border-right-color : #aaa;
32
- border-bottom-color: #aaa;
33
- border-top-color : #fff;
34
- border-left-color : #fff;
35
- }
36
-
37
- &:active {
38
- border-right-color : #f3f8fc;
39
- border-bottom-color: #f3f8fc;
40
- border-top-color : #ccc;
41
- border-left-color : #ccc;
42
- }
43
- }
44
-
45
- ul li {
46
- padding: 3px;
47
- cursor : pointer;
48
-
49
- &:hover {
50
- background-color: lightgray;
51
- }
52
- }
53
-
54
- .cleanHTML {
55
- background-size: 16px 16px;
56
- }
57
-
58
- .noBg {
59
- background-image: none;
60
- }
61
- }
62
- }
63
-
64
- .editorBody {
65
- iframe,
66
- textarea {
67
- border : 1px solid #C5C5C5;
68
- border-radius : 0 0 4px 4px;
69
- border-top-width: 0;
70
- box-sizing : border-box;
71
- background-color: white;
72
- height : 600px;
73
- width : 100%;
74
- }
75
-
76
- textarea {
77
- resize: none;
78
- }
79
- }
80
-
81
- .colorPicker {
82
- width : 210px;
83
- border : 1px solid #D3D3D3;
84
- position: absolute;
85
-
86
- table {
87
- border-collapse: collapse;
88
- }
89
-
90
- .colorhead {
91
- height : 23px;
92
- line-height: 23px;
93
- font-weight: bold;
94
- width : 100%;
95
- }
96
-
97
- .colortitle {
98
- margin-left: 6px;
99
- font-size : 12px;
100
- }
101
-
102
- .colorpanel td {
103
- border : 1px solid #000;
104
- height : 10px;
105
- width : 10px;
106
- overflow : hidden;
107
- font-size: 1px;
108
- cursor : pointer;
109
- }
110
- }
111
-
112
- // 字体演示
113
- .fontfamilyChoser,
114
- .fontsizeChoser {
115
- a {
116
- padding-right : 2px;
117
- display : block;
118
- padding-left : 2px;
119
- padding-bottom : 2px;
120
- color : #000;
121
- line-height : 120%;
122
- padding-top : 2px;
123
- text-decoration: none;
124
-
125
- &:hover {
126
- background: #e5e5e5
127
- }
128
- }
129
- }
130
-
131
- // 登录面板 和忘记密码
132
- .dorpdown {
133
- position: relative;
134
-
135
- &:hover .fontfamilyChoser,
136
- .fontfamilyChoser:hover,
137
- &:hover .fontsizeChoser,
138
- .fontsizeChoser:hover,
139
- &:hover .colorPicker,
140
- .colorPicker:hover {
141
- display: block;
142
- }
143
-
144
- &>div {
145
- display : none;
146
- position : absolute;
147
- top : 22px;
148
- left : 0;
149
- background-color: #f5f5f5;
150
- border : 1px solid lightgray;
151
- border-top : 0;
152
- padding : 5px;
153
- width : 230px;
154
- }
155
-
156
- .fontsizeChoser {
157
- top : inherit;
158
- right: 0;
159
- }
160
- }
161
- }
@@ -1,339 +0,0 @@
1
- export default {
2
- props: {
3
- fieldName: { type: String, required: true }, // 表单 name,字段名
4
- uploadImageActionUrl: String // 图片上传路径
5
- },
6
- data() {
7
- return {
8
- mode: 'iframe',
9
- toolbarEl: null,
10
- sourceEditor: null,
11
- iframeEl: null,
12
- };
13
- },
14
- mounted(): void {
15
- const el = this.$el;
16
- this.toolbarEl = <HTMLElement>el.querySelector('.toolbar');
17
- this.iframeEl = <HTMLIFrameElement>el.querySelector('iframe');
18
-
19
- // 这个方法只能写在 onload 事件里面, 不写 onload 里还不执行
20
- (<Window>this.iframeEl.contentWindow).onload = (ev: Event) => {
21
- const iframeDoc = (<Window>this.iframeEl.contentWindow).document;
22
- iframeDoc.designMode = 'on';
23
- iframeDoc.addEventListener('paste', onImagePaste.bind(this));// 直接剪切板粘贴上传图片
24
-
25
- this.iframeDoc = iframeDoc;
26
-
27
- new MutationObserver((mutationsList: MutationRecord[], observer: MutationObserver) => {
28
- if (this.mode === 'iframe')
29
- this.sourceEditor.value = this.iframeDoc.body.innerHTML;
30
- }).observe(iframeDoc.body, { attributes: true, childList: true, subtree: true, characterData: true });
31
-
32
- this.sourceEditor.value && this.setIframeBody(this.sourceEditor.value);// 有内容
33
- }
34
-
35
- this.sourceEditor = <HTMLTextAreaElement>el.querySelector('textarea');
36
- this.sourceEditor.classList.add("hide");
37
- this.sourceEditor.name = this.fieldName;
38
- this.sourceEditor.oninput = (ev: Event) => {
39
- if (this.mode === 'textarea')
40
- this.setIframeBody(this.sourceEditor.value);
41
- }
42
-
43
- this.uploadImgMgr = this.$refs.uploadLayer;
44
- },
45
- methods: {
46
- /**
47
- * 输入 HTML 内容
48
- *
49
- * @param html
50
- */
51
- setIframeBody(html: string): void {
52
- this.iframeDoc.body.innerHTML = html;
53
- },
54
-
55
- /**
56
- * 获取内容的 HTML
57
- *
58
- * @param cleanWord
59
- * @param encode
60
- */
61
- getValue(cleanWord: boolean, encode: boolean): string {
62
- let result: string = this.iframeDoc.body.innerHTML;
63
-
64
- if (cleanWord)
65
- result = cleanPaste(result);
66
-
67
- if (encode)
68
- result = encodeURIComponent(result);
69
-
70
- return result;
71
- },
72
-
73
- /**
74
- * 切換 HTML 編輯 or 可視化編輯
75
- *
76
- */
77
- setMode(): void {
78
- if (this.mode == 'iframe') {
79
- this.iframeEl.classList.add('hide');
80
- this.sourceEditor.classList.remove('hide');
81
- this.mode = 'textarea';
82
- grayImg.call(this, true);
83
- } else {
84
- this.iframeEl.classList.remove('hide');
85
- this.sourceEditor.classList.add('hide');
86
- this.mode = 'iframe';
87
- grayImg.call(this, false);
88
- }
89
- },
90
-
91
- /**
92
- * 当工具条点击的时候触发
93
- *
94
- * @param ev
95
- */
96
- onToolBarClk(ev: Event): void {
97
- let el: HTMLElement = <HTMLElement>ev.target,
98
- clsName = <string>el.className.split(' ').shift();
99
-
100
- switch (clsName) {
101
- case 'createLink':
102
- // let result: string = prompt("请输入 URL 地址");
103
- // if (result)
104
- // this.format("createLink", result);
105
- break;
106
- case 'insertImage':
107
- // @ts-ignore
108
- if (window.isCreate)
109
- alert('请保存记录后再上传图片。');
110
- else {
111
- this.uploadImgMgr.show((json: any) => {
112
- if (json && json.isOk)
113
- this.format("insertImage", json.fullUrl);
114
- });
115
- }
116
-
117
- break;
118
- case 'switchMode':
119
- this.setMode();
120
- break;
121
- case 'cleanHTML':
122
- // @ts-ignore
123
- this.setIframeBody(HtmlSanitizer.SanitizeHtml(this.iframeDoc.body.innerHTML)); // 清理冗余 HTML
124
- break;
125
- case 'saveRemoteImage2Local':
126
- saveRemoteImage2Local.call(this);
127
- break;
128
- default:
129
- this.format(clsName);
130
- }
131
- },
132
-
133
- /**
134
- * 通过 document.execCommand() 来操纵可编辑内容区域的元素
135
- *
136
- * @param type 命令的名称
137
- * @param para 一些命令(例如 insertImage)需要额外的参数(insertImage 需要提供插入 image 的 url),默认为 null
138
- */
139
- format(type: string, para?: string): void {
140
- if (para)
141
- this.iframeDoc.execCommand(type, false, para);
142
- else
143
- this.iframeDoc.execCommand(type, false);
144
-
145
- (<Window>this.iframeEl.contentWindow).focus();
146
- },
147
-
148
- /**
149
- * 选择字号大小
150
- *
151
- * @param ev
152
- */
153
- onFontsizeChoserClk(ev: Event): void {
154
- let el: HTMLElement = <HTMLElement>ev.target,
155
- els = (<HTMLElement>ev.currentTarget).children;
156
-
157
- let i, j;
158
- for (i = 0, j = els.length; i < j; i++)
159
- if (el == els[i])
160
- break;
161
-
162
- this.format('fontsize', i + "");
163
- },
164
-
165
- onFontColorPicker(ev: Event): void {
166
- this.format('foreColor', (<HTMLElement>ev.target).title);
167
- },
168
-
169
- onFontBgColorPicker(ev: Event): void {
170
- this.format('backColor', (<HTMLElement>ev.target).title);
171
- },
172
-
173
- /**
174
- * 选择字体
175
- *
176
- * @param ev
177
- */
178
- onFontfamilyChoserClk(ev: Event): void {
179
- let el: HTMLElement = <HTMLElement>ev.target;
180
- this.format('fontname', el.innerHTML);
181
-
182
- /* 如何解决点击之后马上隐藏面板?由于 js(单击事件) 没有控制 CSS 的 :hover 伪类的方法,故所以必须使用以下技巧:*/
183
- let menuPanel: HTMLElement = <HTMLElement>el.parentNode;
184
- menuPanel.style.display = 'none';
185
- setTimeout(() => menuPanel.style.display = '', 300);
186
- },
187
-
188
- /**
189
- * 创建颜色选择器
190
- */
191
- createColorPickerHTML(): string {
192
- let cl: string[] = ['00', '33', '66', '99', 'CC', 'FF'],
193
- b: string, d: string, e: string, f: string,
194
- h: string[] = ['<div class="colorhead"><span class="colortitle">颜色选择</span></div><div class="colorbody"><table cellspaci="0" cellpadding="0"><tr>'];
195
-
196
- // 创建 body [6 x 6的色盘]
197
- for (let i = 0; i < 6; ++i) {
198
- h.push('<td><table class="colorpanel" cellspacing="0" cellpadding="0">');
199
-
200
- for (let j = 0, a = cl[i]; j < 6; ++j) {
201
- h.push('<tr>');
202
-
203
- for (let k = 0, c = cl[j]; k < 6; ++k) {
204
- b = cl[k];
205
- e = (k == 5 && i != 2 && i != 5) ? ';border-right:none;' : '';
206
- f = (j == 5 && i < 3) ? ';border-bottom:none' : '';
207
- d = '#' + a + b + c;
208
- // T = document.all ? '&nbsp;' : '';
209
- h.push('<td unselectable="on" style="background-color: ' + d + e + f + '" title="' + d + '"></td>');
210
- }
211
-
212
- h.push('</tr>');
213
- }
214
-
215
- h.push('</table></td>');
216
-
217
- if (cl[i] == '66')
218
- h.push('</tr><tr>');
219
- }
220
-
221
- h.push('</tr></table></div>');
222
-
223
- return h.join('');
224
- }
225
- }
226
- };
227
-
228
- /**
229
- * 粘贴图片
230
- *
231
- * @param this
232
- * @param ev
233
- */
234
- function onImagePaste(ev: ClipboardEvent): void {
235
- if (!this.uploadImageActionUrl) {
236
- alert('未提供图片上传地址');
237
- return;
238
- }
239
-
240
- let items: DataTransferItemList | null = ev.clipboardData && ev.clipboardData.items,
241
- file: File | null = null; // file 就是剪切板中的图片文件
242
-
243
- if (items && items.length) {// 检索剪切板 items
244
- for (let i = 0; i < items.length; i++) {
245
- const item: DataTransferItem = items[i];
246
-
247
- if (item.type.indexOf('image') !== -1) {
248
- // @ts-ignore
249
- if (window.isCreate) { // 有图片
250
- alert('请保存记录后再上传图片。');
251
- return;
252
- }
253
-
254
- file = item.getAsFile();
255
- break;
256
- }
257
- }
258
- }
259
-
260
- if (file) {
261
- // ev.preventDefault();
262
- // img.changeBlobImageQuality(file, (newBlob: Blob): void => {
263
- // // 复用上传的方法
264
- // Vue.options.components["aj-xhr-upload"].extendOptions.methods.doUpload.call({
265
- // action: this.uploadImageActionUrl,
266
- // progress: 0,
267
- // uploadOk_callback(j: ImgUploadRepsonseResult) {
268
- // if (j.isOk)
269
- // this.format("insertImage", this.ajResources.imgPerfix + j.imgUrl);
270
- // },
271
- // $blob: newBlob,
272
- // $fileName: 'foo.jpg' // 文件名不重要,反正上传到云空间会重命名
273
- // });
274
- // });
275
- }
276
- }
277
-
278
- /**
279
- * 一键存图
280
- *
281
- * @param this
282
- */
283
- function saveRemoteImage2Local(): void {
284
- const arr: NodeListOf<HTMLImageElement> = this.iframeDoc.querySelectorAll('img'),
285
- remotePicArr: HTMLImageElement[] = new Array<HTMLImageElement>(),
286
- srcs: string[] = [];
287
-
288
- for (let i = 0, j = arr.length; i < j; i++) {
289
- const imgEl: HTMLImageElement = arr[i],
290
- src: string = <string>imgEl.getAttribute('src');
291
-
292
- if (/^http/.test(src)) {
293
- remotePicArr.push(imgEl);
294
- srcs.push(src);
295
- }
296
- }
297
-
298
- if (srcs.length) {
299
- // xhr.post('../downAllPics/', (json: any) => {
300
- // const _arr: string[] = json.pics;
301
-
302
- // for (let i = 0, j = _arr.length; i < j; i++)
303
- // remotePicArr[i].src = "images/" + _arr[i]; // 改变 DOM 的旧图片地址为新的
304
-
305
- // alert('所有图片下载完成。');
306
- // }, { pics: srcs.join('|') });
307
- } else
308
- alert('未发现有远程图片');
309
- }
310
-
311
- /**
312
- * 使图标变灰色
313
- *
314
- * @param this
315
- * @param isGray
316
- */
317
- function grayImg(isGray: boolean): void {
318
- this.toolbarEl.querySelectorAll('i').forEach((item: HTMLElement) => {
319
- if (item.className.indexOf('switchMode') != -1)
320
- return;
321
- item.style.color = isGray ? 'lightgray' : '';
322
- });
323
- }
324
-
325
- /**
326
- * Remove additional MS Word content
327
- * MSWordHtmlCleaners.js https://gist.github.com/ronanguilloux/2915995
328
- *
329
- * @param html
330
- */
331
- function cleanPaste(html: string): string {
332
- html = html.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ''); // Unwanted tags
333
- html = html.replace(/(class|style|type|start)=("(.*?)"|(\w*))/gi, ''); // Unwanted sttributes
334
- html = html.replace(/<style(.*?)style>/gi, ''); // Style tags
335
- html = html.replace(/<script(.*?)script>/gi, ''); // Script tags
336
- html = html.replace(/<!--(.*?)-->/gi, ''); // HTML comments
337
-
338
- return html;
339
- }
@@ -1,70 +0,0 @@
1
- <template>
2
- <div class="aj-form-html-editor">
3
- <ul class="toolbar" @click="onToolBarClk">
4
- <li class="dorpdown">
5
- <i title="字体" class="fa-font"></i>
6
- <div class="fontfamilyChoser" @click="onFontfamilyChoserClk">
7
- <a style="font-family: '宋体'">宋体</a>
8
- <a style="font-family: '黑体'">黑体</a>
9
- <a style="font-family: '楷体'">楷体</a>
10
- <a style="font-family: '隶书'">隶书</a>
11
- <a style="font-family: '幼圆'">幼圆</a>
12
- <a style="font-family: 'Microsoft YaHei'">Microsoft YaHei</a>
13
- <a style="font-family: Arial">Arial</a>
14
- <a style="font-family: 'Arial Narrow'">Arial Narrow</a>
15
- <a style="font-family: 'Arial Black'">Arial Black</a>
16
- <a style="font-family: 'Comic Sans MS'">Comic Sans MS</a>
17
- <a style="font-family: Courier">Courier</a>
18
- <a style="font-family: System">System</a>
19
- <a style="font-family: 'Times New Roman'">Times New Roman</a>
20
- <a style="font-family: Verdana">Verdana</a>
21
- </div>
22
- </li>
23
- <li class="dorpdown">
24
- <i title="字号" class="fa-header"></i>
25
- <div class="fontsizeChoser" @click="onFontsizeChoserClk">
26
- <a style="font-size: xx-small; ">极小</a>
27
- <a style="font-size: x-small; ">特小</a>
28
- <a style="font-size: small; ">小</a>
29
- <a style="font-size: medium; ">中</a>
30
- <a style="font-size: large; ">大</a>
31
- <a style="font-size: x-large; ">特大</a>
32
- <a style="font-size: xx-large; line-height: 140%">极大</a>
33
- </div>
34
- </li>
35
- <li><i title="加粗" class="bold fa-bold"></i></li>
36
- <li><i title="斜体" class="italic fa-italic"></i></li>
37
- <li><i title="下划线" class="underline fa-underline"></i></li>
38
- <li><i title="左对齐" class="justifyleft fa-align-left"></i></li>
39
- <li><i title="中间对齐" class="justifycenter fa-align-center"></i></li>
40
- <li><i title="右对齐" class="justifyright fa-align-right"></i></li>
41
- <li><i title="数字编号" class="insertorderedlist fa-list-ol"></i></li>
42
- <li><i title="项目编号" class="insertunorderedlist fa-list-ul"></i></li>
43
- <li><i title="增加缩进" class="outdent fa-outdent"></i></li>
44
- <li><i title="减少缩进" class="indent fa-indent"></i></li>
45
- <li class="dorpdown">
46
- <i title="字体颜色" class="fa-paint-brush"></i>
47
- <div class="fontColor colorPicker" v-html="createColorPickerHTML()" @click="onFontColorPicker"></div>
48
- </li>
49
- <li class="dorpdown">
50
- <i title="背景颜色" class="fa-pencil"></i>
51
- <div class="bgColor colorPicker" v-html="createColorPickerHTML()" @click="onFontBgColorPicker"></div>
52
- </li>
53
- <li><i title="增加链接" class="createLink fa-link"></i></li>
54
- <li><i title="增加图片" class="insertImage fa-file-image-o"></i></li>
55
- <li><i title="一键存图" class="saveRemoteImage2Local fa-hdd-o"></i></li>
56
- <li><i title="清理 HTML" class="cleanHTML fa-eraser"></i></li>
57
- <li><i title="切换到代码" class="switchMode fa-code"></i></li>
58
- </ul>
59
-
60
- <div class="editorBody">
61
- <iframe srcdoc="<html><body></body></html>"></iframe>
62
- <slot></slot>
63
- </div>
64
- <!-- <aj-form-popup-upload ref="uploadLayer" :upload-url="uploadImageActionUrl"></aj-form-popup-upload> -->
65
- </div>
66
- </template>
67
-
68
- <script lang="ts" src="./HtmlEditor.ts"></script>
69
-
70
- <style lang="less" src="./HtmlEditor.less"></style>