@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.9 → 1.0.2

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 (120) hide show
  1. package/es/LcdpUeditor.d.ts +1 -0
  2. package/es/LcdpUeditor.d.ts.map +1 -0
  3. package/es/LcdpUeditor.js +72 -61
  4. package/es/const.d.ts.map +1 -0
  5. package/es/const.js +4 -4
  6. package/es/defaultConfig.json +76 -76
  7. package/es/index.d.ts.map +1 -0
  8. package/es/tools/UeditorResourceLoader.d.ts.map +1 -0
  9. package/es/tools/UeditorResourceLoader.js +11 -16
  10. package/es/tools/filterHtmlNode.d.ts +5 -0
  11. package/es/tools/filterHtmlNode.d.ts.map +1 -0
  12. package/es/tools/filterHtmlNode.js +41 -0
  13. package/es/tools/loadScript.d.ts.map +1 -0
  14. package/es/tools/loadScript.js +5 -7
  15. package/es/type.d.ts +6 -0
  16. package/es/type.d.ts.map +1 -0
  17. package/lib/LcdpUeditor.d.ts +1 -0
  18. package/lib/LcdpUeditor.js +24 -8
  19. package/lib/defaultConfig.json +76 -76
  20. package/lib/tools/filterHtmlNode.d.ts +5 -0
  21. package/lib/tools/filterHtmlNode.js +61 -0
  22. package/lib/type.d.ts +6 -0
  23. package/package.json +35 -34
  24. package/ueditor-resource/dialogs/anchor/anchor.html +62 -62
  25. package/ueditor-resource/dialogs/attachment/attachment.css +716 -716
  26. package/ueditor-resource/dialogs/attachment/attachment.html +61 -61
  27. package/ueditor-resource/dialogs/attachment/attachment.js +803 -803
  28. package/ueditor-resource/dialogs/audio/audio.css +879 -879
  29. package/ueditor-resource/dialogs/audio/audio.html +93 -93
  30. package/ueditor-resource/dialogs/audio/audio.js +815 -815
  31. package/ueditor-resource/dialogs/background/background.css +193 -193
  32. package/ueditor-resource/dialogs/background/background.html +59 -59
  33. package/ueditor-resource/dialogs/background/background.js +370 -370
  34. package/ueditor-resource/dialogs/contentimport/contentimport.html +176 -176
  35. package/ueditor-resource/dialogs/contentimport/contentimport.js +91 -91
  36. package/ueditor-resource/dialogs/emotion/emotion.css +129 -129
  37. package/ueditor-resource/dialogs/emotion/emotion.html +70 -70
  38. package/ueditor-resource/dialogs/emotion/emotion.js +186 -186
  39. package/ueditor-resource/dialogs/formula/formula.html +98 -98
  40. package/ueditor-resource/dialogs/formula/formula.js +147 -147
  41. package/ueditor-resource/dialogs/help/help.css +37 -37
  42. package/ueditor-resource/dialogs/help/help.html +82 -82
  43. package/ueditor-resource/dialogs/help/help.js +57 -57
  44. package/ueditor-resource/dialogs/image/image.css +768 -768
  45. package/ueditor-resource/dialogs/image/image.html +144 -144
  46. package/ueditor-resource/dialogs/image/image.js +1060 -1060
  47. package/ueditor-resource/dialogs/insertframe/insertframe.html +135 -135
  48. package/ueditor-resource/dialogs/internal.js +81 -81
  49. package/ueditor-resource/dialogs/link/link.html +148 -148
  50. package/ueditor-resource/dialogs/preview/preview.html +45 -45
  51. package/ueditor-resource/dialogs/scrawl/scrawl.css +324 -324
  52. package/ueditor-resource/dialogs/scrawl/scrawl.html +95 -95
  53. package/ueditor-resource/dialogs/scrawl/scrawl.js +682 -682
  54. package/ueditor-resource/dialogs/searchreplace/searchreplace.html +144 -144
  55. package/ueditor-resource/dialogs/searchreplace/searchreplace.js +174 -174
  56. package/ueditor-resource/dialogs/spechars/spechars.html +42 -42
  57. package/ueditor-resource/dialogs/spechars/spechars.js +86 -86
  58. package/ueditor-resource/dialogs/table/edittable.css +85 -85
  59. package/ueditor-resource/dialogs/table/edittable.html +69 -69
  60. package/ueditor-resource/dialogs/table/edittable.js +241 -241
  61. package/ueditor-resource/dialogs/table/edittd.html +62 -62
  62. package/ueditor-resource/dialogs/table/edittip.html +33 -33
  63. package/ueditor-resource/dialogs/template/config.js +42 -42
  64. package/ueditor-resource/dialogs/template/template.css +99 -99
  65. package/ueditor-resource/dialogs/template/template.html +26 -26
  66. package/ueditor-resource/dialogs/template/template.js +53 -53
  67. package/ueditor-resource/dialogs/video/video.css +909 -909
  68. package/ueditor-resource/dialogs/video/video.html +114 -114
  69. package/ueditor-resource/dialogs/video/video.js +867 -867
  70. package/ueditor-resource/dialogs/wordimage/wordimage.html +221 -221
  71. package/ueditor-resource/dialogs/wordimage/wordimage.js +93 -93
  72. package/ueditor-resource/lang/en/en.js +686 -686
  73. package/ueditor-resource/lang/zh-cn/zh-cn.js +748 -748
  74. package/ueditor-resource/lang/zh-tw/zh-tw.js +748 -748
  75. package/ueditor-resource/plugins/demo/demo.js +3 -3
  76. package/ueditor-resource/themes/default/css/ueditor.css +2149 -2148
  77. package/ueditor-resource/themes/default/dialog.css +17 -17
  78. package/ueditor-resource/themes/default/dialogbase.css +132 -132
  79. package/ueditor-resource/themes/default/exts/ai.svg +12 -12
  80. package/ueditor-resource/themes/default/exts/apk.svg +12 -12
  81. package/ueditor-resource/themes/default/exts/chm.svg +12 -12
  82. package/ueditor-resource/themes/default/exts/css.svg +12 -12
  83. package/ueditor-resource/themes/default/exts/doc.svg +22 -22
  84. package/ueditor-resource/themes/default/exts/docx.svg +22 -22
  85. package/ueditor-resource/themes/default/exts/dwg.svg +16 -16
  86. package/ueditor-resource/themes/default/exts/folder.svg +3 -3
  87. package/ueditor-resource/themes/default/exts/gif.svg +14 -14
  88. package/ueditor-resource/themes/default/exts/html.svg +12 -12
  89. package/ueditor-resource/themes/default/exts/jpeg.svg +14 -14
  90. package/ueditor-resource/themes/default/exts/jpg.svg +14 -14
  91. package/ueditor-resource/themes/default/exts/log.svg +12 -12
  92. package/ueditor-resource/themes/default/exts/mp3.svg +14 -14
  93. package/ueditor-resource/themes/default/exts/mp4.svg +12 -12
  94. package/ueditor-resource/themes/default/exts/pdf.svg +14 -14
  95. package/ueditor-resource/themes/default/exts/png.svg +14 -14
  96. package/ueditor-resource/themes/default/exts/ppt.svg +24 -24
  97. package/ueditor-resource/themes/default/exts/pptx.svg +24 -24
  98. package/ueditor-resource/themes/default/exts/psd.svg +12 -12
  99. package/ueditor-resource/themes/default/exts/rar.svg +12 -12
  100. package/ueditor-resource/themes/default/exts/svg.svg +12 -12
  101. package/ueditor-resource/themes/default/exts/torrent.svg +14 -14
  102. package/ueditor-resource/themes/default/exts/txt.svg +14 -14
  103. package/ueditor-resource/themes/default/exts/unknown.svg +12 -12
  104. package/ueditor-resource/themes/default/exts/xls.svg +25 -25
  105. package/ueditor-resource/themes/default/exts/xlsx.svg +25 -25
  106. package/ueditor-resource/themes/default/exts/zip.svg +12 -12
  107. package/ueditor-resource/themes/iframe.css +63 -63
  108. package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3655 -3655
  109. package/ueditor-resource/third-party/clipboard/clipboard.js +752 -752
  110. package/ueditor-resource/third-party/codemirror/codemirror.css +106 -106
  111. package/ueditor-resource/third-party/codemirror/codemirror.js +3581 -3581
  112. package/ueditor-resource/third-party/jquery-3.5.1.js +1 -1
  113. package/ueditor-resource/third-party/jquery-3.5.1_1.js +4314 -4314
  114. package/ueditor-resource/third-party/webuploader/webuploader.css +88 -88
  115. package/ueditor-resource/third-party/webuploader/webuploader.js +3 -3
  116. package/ueditor-resource/third-party/zeroclipboard/ZeroClipboard.js +1255 -1255
  117. package/ueditor-resource/{lcdp-ueditor.all.js → ueditor.all.js} +5270 -5269
  118. package/ueditor-resource/ueditor.config.js +655 -655
  119. package/ueditor-resource/{lcdp-ueditor.parse.js → ueditor.parse.js} +13 -13
  120. package/ueditor-resource/index.html +0 -146
@@ -1,176 +1,176 @@
1
- <!DOCTYPE html>
2
- <head>
3
- <title></title>
4
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
5
- <script type="text/javascript" src="../internal.js?32939b8e"></script>
6
- <style type="text/css">
7
- .wrapper {
8
- width: 600px;
9
- padding: 10px;
10
- height: 352px;
11
- overflow: hidden;
12
- position: relative;
13
- border-bottom: 1px solid #d7d7d7;
14
- }
15
-
16
- .wrapper .file-upload {
17
- display: flex;
18
- align-items: center;
19
- }
20
-
21
- .wrapper .file-upload .file-tip {
22
- color: #999;
23
- font-size: 12px;
24
- padding-left: 10px;
25
- flex-grow: 1;
26
- }
27
-
28
- .wrapper .file-manual {
29
- background: #EEE;
30
- padding: 10px;
31
- border-radius: 5px;
32
- margin-top: 10px;
33
- line-height: 2;
34
- }
35
-
36
- .wrapper .file-manual .title {
37
- font-weight: bold;
38
- font-size: 120%;
39
- }
40
-
41
- .wrapper .file-manual .body {
42
- }
43
-
44
- .wrapper .file-manual .body li {
45
- list-style: disc;
46
- margin-left: 20px;
47
- }
48
-
49
- .wrapper .upload-button {
50
- width: 100px;
51
- height: 30px;
52
- background-color: #F8F8F8;
53
- border: 1px solid #EEE;
54
- border-radius: 4px;
55
- text-align: center;
56
- line-height: 28px;
57
- cursor: pointer;
58
- position: relative;
59
- flex-shrink: 0;
60
- margin-right: 5px;
61
- }
62
-
63
- .wrapper .upload-button .text {
64
- display: inline-block;
65
- vertical-align: middle;
66
- }
67
-
68
- .wrapper .upload-button input {
69
- position: absolute;
70
- left: 0;
71
- top: 0;
72
- opacity: 0;
73
- cursor: pointer;
74
- height: 100%;
75
- width: 100%;
76
- }
77
-
78
- .wrapper .file-result {
79
- border: 1px solid #333;
80
- padding: 10px;
81
- border-radius: 5px;
82
- position: absolute;
83
- left: 10px;
84
- right: 10px;
85
- top: 50px;
86
- background: #FFF;
87
- bottom: 10px;
88
- overflow: auto;
89
- display: none;
90
- }
91
- .wrapper .file-input{
92
- position: absolute;
93
- left: 10px;
94
- right: 10px;
95
- top: 50px;
96
- background: #EEE;
97
- bottom: 10px;
98
- border-radius: 5px;
99
- display:none;
100
- }
101
- .wrapper .file-input textarea{
102
- position: absolute;
103
- left: 10px;
104
- right: 10px;
105
- bottom: 10px;
106
- border: none;
107
- resize: none;
108
- border-radius: 5px;
109
- padding: 5px;
110
- outline: none;
111
- top: 30px;
112
- }
113
- .wrapper .file-input .tool{
114
- text-align: right;
115
- padding: 5px 10px;
116
- }
117
- .wrapper .file-input .tool a{
118
- display: inline-block;
119
- text-decoration: none;
120
- color: #333;
121
- background: #FFF;
122
- padding: 0 10px;
123
- line-height: 20px;
124
- border-radius: 3px;
125
- }
126
- </style>
127
- </head>
128
- <body>
129
- <div class="wrapper">
130
- <div class="file-upload">
131
- <div class="upload-button">
132
- <div class="text">选择本地文件</div>
133
- <input type="file" id="contentImport"/>
134
- </div>
135
- <div class="upload-button">
136
- <div class="text" onclick="$('.file-input').show();">粘贴Markdown</div>
137
- </div>
138
- <div class="file-tip"></div>
139
- </div>
140
- <div class="file-manual">
141
- <div class="title">
142
- 支持文档格式
143
- </div>
144
- <div class="body">
145
- <ul>
146
- <li><b>Word</b>:docx</li>
147
- <li><b>Markdown</b>:md</li>
148
- </ul>
149
- </div>
150
- </div>
151
- <div class="file-result"></div>
152
- <div class="file-input">
153
- <textarea id="fileInputContent"></textarea>
154
- <div class="tool">
155
- <a href="javascript:;" id="fileInputConfirm">
156
- 确定
157
- </a>
158
- <a href="javascript:;" onclick="$(this).closest('.file-input').hide();">
159
- 关闭
160
- </a>
161
- </div>
162
- </div>
163
- </div>
164
- <script src="../../third-party/jquery-3.5.1.js?89c36344"></script>
165
- <script src="https://cdn.bootcdn.net/ajax/libs/mammoth/1.6.0/mammoth.browser.min.js"></script>
166
- <script src="https://cdn.bootcdn.net/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
167
- <script type="text/javascript" src="contentimport.js?34705cde"></script>
168
- <script type="text/javascript">
169
- utils.domReady(function () {
170
- var options = {};
171
- var callbacks = {};
172
- contentImport.init(options, callbacks);
173
- });
174
- </script>
175
- </body>
176
- </html>
1
+ <!DOCTYPE html>
2
+ <head>
3
+ <title></title>
4
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
5
+ <script type="text/javascript" src="../internal.js?aea0c61c"></script>
6
+ <style type="text/css">
7
+ .wrapper {
8
+ width: 600px;
9
+ padding: 10px;
10
+ height: 352px;
11
+ overflow: hidden;
12
+ position: relative;
13
+ border-bottom: 1px solid #d7d7d7;
14
+ }
15
+
16
+ .wrapper .file-upload {
17
+ display: flex;
18
+ align-items: center;
19
+ }
20
+
21
+ .wrapper .file-upload .file-tip {
22
+ color: #999;
23
+ font-size: 12px;
24
+ padding-left: 10px;
25
+ flex-grow: 1;
26
+ }
27
+
28
+ .wrapper .file-manual {
29
+ background: #EEE;
30
+ padding: 10px;
31
+ border-radius: 5px;
32
+ margin-top: 10px;
33
+ line-height: 2;
34
+ }
35
+
36
+ .wrapper .file-manual .title {
37
+ font-weight: bold;
38
+ font-size: 120%;
39
+ }
40
+
41
+ .wrapper .file-manual .body {
42
+ }
43
+
44
+ .wrapper .file-manual .body li {
45
+ list-style: disc;
46
+ margin-left: 20px;
47
+ }
48
+
49
+ .wrapper .upload-button {
50
+ width: 100px;
51
+ height: 30px;
52
+ background-color: #F8F8F8;
53
+ border: 1px solid #EEE;
54
+ border-radius: 4px;
55
+ text-align: center;
56
+ line-height: 28px;
57
+ cursor: pointer;
58
+ position: relative;
59
+ flex-shrink: 0;
60
+ margin-right: 5px;
61
+ }
62
+
63
+ .wrapper .upload-button .text {
64
+ display: inline-block;
65
+ vertical-align: middle;
66
+ }
67
+
68
+ .wrapper .upload-button input {
69
+ position: absolute;
70
+ left: 0;
71
+ top: 0;
72
+ opacity: 0;
73
+ cursor: pointer;
74
+ height: 100%;
75
+ width: 100%;
76
+ }
77
+
78
+ .wrapper .file-result {
79
+ border: 1px solid #333;
80
+ padding: 10px;
81
+ border-radius: 5px;
82
+ position: absolute;
83
+ left: 10px;
84
+ right: 10px;
85
+ top: 50px;
86
+ background: #FFF;
87
+ bottom: 10px;
88
+ overflow: auto;
89
+ display: none;
90
+ }
91
+ .wrapper .file-input{
92
+ position: absolute;
93
+ left: 10px;
94
+ right: 10px;
95
+ top: 50px;
96
+ background: #EEE;
97
+ bottom: 10px;
98
+ border-radius: 5px;
99
+ display:none;
100
+ }
101
+ .wrapper .file-input textarea{
102
+ position: absolute;
103
+ left: 10px;
104
+ right: 10px;
105
+ bottom: 10px;
106
+ border: none;
107
+ resize: none;
108
+ border-radius: 5px;
109
+ padding: 5px;
110
+ outline: none;
111
+ top: 30px;
112
+ }
113
+ .wrapper .file-input .tool{
114
+ text-align: right;
115
+ padding: 5px 10px;
116
+ }
117
+ .wrapper .file-input .tool a{
118
+ display: inline-block;
119
+ text-decoration: none;
120
+ color: #333;
121
+ background: #FFF;
122
+ padding: 0 10px;
123
+ line-height: 20px;
124
+ border-radius: 3px;
125
+ }
126
+ </style>
127
+ </head>
128
+ <body>
129
+ <div class="wrapper">
130
+ <div class="file-upload">
131
+ <div class="upload-button">
132
+ <div class="text">选择本地文件</div>
133
+ <input type="file" id="contentImport"/>
134
+ </div>
135
+ <div class="upload-button">
136
+ <div class="text" onclick="$('.file-input').show();">粘贴Markdown</div>
137
+ </div>
138
+ <div class="file-tip"></div>
139
+ </div>
140
+ <div class="file-manual">
141
+ <div class="title">
142
+ 支持文档格式
143
+ </div>
144
+ <div class="body">
145
+ <ul>
146
+ <li><b>Word</b>:docx</li>
147
+ <li><b>Markdown</b>:md</li>
148
+ </ul>
149
+ </div>
150
+ </div>
151
+ <div class="file-result"></div>
152
+ <div class="file-input">
153
+ <textarea id="fileInputContent"></textarea>
154
+ <div class="tool">
155
+ <a href="javascript:;" id="fileInputConfirm">
156
+ 确定
157
+ </a>
158
+ <a href="javascript:;" onclick="$(this).closest('.file-input').hide();">
159
+ 关闭
160
+ </a>
161
+ </div>
162
+ </div>
163
+ </div>
164
+ <script src="../../third-party/jquery-3.5.1.js?064a9f9e"></script>
165
+ <script src="https://cdn.bootcdn.net/ajax/libs/mammoth/1.6.0/mammoth.browser.min.js"></script>
166
+ <script src="https://cdn.bootcdn.net/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
167
+ <script type="text/javascript" src="contentimport.js?5760833a"></script>
168
+ <script type="text/javascript">
169
+ utils.domReady(function () {
170
+ var options = {};
171
+ var callbacks = {};
172
+ contentImport.init(options, callbacks);
173
+ });
174
+ </script>
175
+ </body>
176
+ </html>
@@ -1,91 +1,91 @@
1
- var contentImport = {};
2
- var g = $G;
3
-
4
- contentImport.data = {
5
- result: null,
6
- };
7
- contentImport.init = function (opt, callbacks) {
8
- addUploadButtonListener();
9
- addOkListener();
10
- };
11
-
12
- function processWord(file) {
13
- $('.file-tip').html('正在转换Word文件,请稍后...');
14
- $('.file-result').html('').hide();
15
- var reader = new FileReader();
16
- reader.onload = function (loadEvent) {
17
- mammoth.convertToHtml({
18
- arrayBuffer: loadEvent.target.result
19
- })
20
- .then(function displayResult(result) {
21
- $('.file-tip').html('转换成功');
22
- contentImport.data.result = result.value;
23
- $('.file-result').html(result.value).show();
24
- }, function (error) {
25
- $('.file-tip').html('Word文件转换失败:' + error);
26
- });
27
- };
28
- reader.onerror = function (loadEvent) {
29
- $('.file-tip').html('Word文件转换失败:' + loadEvent);
30
- };
31
- reader.readAsArrayBuffer(file);
32
- }
33
-
34
- function processMarkdown( markdown ){
35
- var converter = new showdown.Converter();
36
- var html = converter.makeHtml(markdown);
37
- $('.file-tip').html('转换成功');
38
- contentImport.data.result = html;
39
- $('.file-result').html(html).show();
40
- }
41
-
42
- function processMarkdownFile(file) {
43
- $('.file-tip').html('正在转换Markdown文件,请稍后...');
44
- $('.file-result').html('').hide();
45
- var reader = new FileReader();
46
- reader.onload = function (loadEvent) {
47
- processMarkdown( loadEvent.target.result );
48
- };
49
- reader.onerror = function (loadEvent) {
50
- $('.file-tip').html('Markdown文件转换失败:' + loadEvent);
51
- };
52
- reader.readAsText(file, "UTF-8");
53
- }
54
-
55
- function addUploadButtonListener() {
56
- g('contentImport').addEventListener('change', function () {
57
- const file = this.files[0];
58
- const fileName = file.name;
59
- const fileExt = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
60
- switch (fileExt) {
61
- case 'docx':
62
- case 'doc':
63
- processWord(file);
64
- break;
65
- case 'md':
66
- processMarkdownFile(file);
67
- break;
68
- default:
69
- $('.file-tip').html('不支持的文件格式:' + fileExt);
70
- break;
71
- }
72
- });
73
- g('fileInputConfirm').addEventListener('click', function () {
74
- processMarkdown( g('fileInputContent').value );
75
- $('.file-input').hide();
76
- });
77
- }
78
-
79
- function addOkListener() {
80
- dialog.onok = function () {
81
- if (!contentImport.data.result) {
82
- alert('请先上传文件识别内容');
83
- return false;
84
- }
85
- editor.fireEvent('saveScene');
86
- editor.execCommand("inserthtml", contentImport.data.result);
87
- editor.fireEvent('saveScene');
88
- };
89
- dialog.oncancel = function () {
90
- };
91
- }
1
+ var contentImport = {};
2
+ var g = $G;
3
+
4
+ contentImport.data = {
5
+ result: null,
6
+ };
7
+ contentImport.init = function (opt, callbacks) {
8
+ addUploadButtonListener();
9
+ addOkListener();
10
+ };
11
+
12
+ function processWord(file) {
13
+ $('.file-tip').html('正在转换Word文件,请稍后...');
14
+ $('.file-result').html('').hide();
15
+ var reader = new FileReader();
16
+ reader.onload = function (loadEvent) {
17
+ mammoth.convertToHtml({
18
+ arrayBuffer: loadEvent.target.result
19
+ })
20
+ .then(function displayResult(result) {
21
+ $('.file-tip').html('转换成功');
22
+ contentImport.data.result = result.value;
23
+ $('.file-result').html(result.value).show();
24
+ }, function (error) {
25
+ $('.file-tip').html('Word文件转换失败:' + error);
26
+ });
27
+ };
28
+ reader.onerror = function (loadEvent) {
29
+ $('.file-tip').html('Word文件转换失败:' + loadEvent);
30
+ };
31
+ reader.readAsArrayBuffer(file);
32
+ }
33
+
34
+ function processMarkdown( markdown ){
35
+ var converter = new showdown.Converter();
36
+ var html = converter.makeHtml(markdown);
37
+ $('.file-tip').html('转换成功');
38
+ contentImport.data.result = html;
39
+ $('.file-result').html(html).show();
40
+ }
41
+
42
+ function processMarkdownFile(file) {
43
+ $('.file-tip').html('正在转换Markdown文件,请稍后...');
44
+ $('.file-result').html('').hide();
45
+ var reader = new FileReader();
46
+ reader.onload = function (loadEvent) {
47
+ processMarkdown( loadEvent.target.result );
48
+ };
49
+ reader.onerror = function (loadEvent) {
50
+ $('.file-tip').html('Markdown文件转换失败:' + loadEvent);
51
+ };
52
+ reader.readAsText(file, "UTF-8");
53
+ }
54
+
55
+ function addUploadButtonListener() {
56
+ g('contentImport').addEventListener('change', function () {
57
+ const file = this.files[0];
58
+ const fileName = file.name;
59
+ const fileExt = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
60
+ switch (fileExt) {
61
+ case 'docx':
62
+ case 'doc':
63
+ processWord(file);
64
+ break;
65
+ case 'md':
66
+ processMarkdownFile(file);
67
+ break;
68
+ default:
69
+ $('.file-tip').html('不支持的文件格式:' + fileExt);
70
+ break;
71
+ }
72
+ });
73
+ g('fileInputConfirm').addEventListener('click', function () {
74
+ processMarkdown( g('fileInputContent').value );
75
+ $('.file-input').hide();
76
+ });
77
+ }
78
+
79
+ function addOkListener() {
80
+ dialog.onok = function () {
81
+ if (!contentImport.data.result) {
82
+ alert('请先上传文件识别内容');
83
+ return false;
84
+ }
85
+ editor.fireEvent('saveScene');
86
+ editor.execCommand("inserthtml", contentImport.data.result);
87
+ editor.fireEvent('saveScene');
88
+ };
89
+ dialog.oncancel = function () {
90
+ };
91
+ }