@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.8 → 1.0.1

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 (117) hide show
  1. package/es/LcdpUeditor.js +64 -61
  2. package/es/const.js +4 -4
  3. package/es/defaultConfig.json +76 -76
  4. package/es/tools/UeditorResourceLoader.js +11 -16
  5. package/es/tools/filterHtmlNode.d.ts +5 -0
  6. package/es/tools/filterHtmlNode.js +41 -0
  7. package/es/tools/loadScript.js +5 -7
  8. package/es/type.d.ts +6 -0
  9. package/lib/LcdpUeditor.js +18 -8
  10. package/lib/defaultConfig.json +76 -76
  11. package/lib/tools/filterHtmlNode.d.ts +5 -0
  12. package/lib/tools/filterHtmlNode.js +61 -0
  13. package/lib/type.d.ts +6 -0
  14. package/package.json +35 -34
  15. package/ueditor-resource/dialogs/anchor/anchor.html +62 -62
  16. package/ueditor-resource/dialogs/attachment/attachment.css +716 -716
  17. package/ueditor-resource/dialogs/attachment/attachment.html +61 -61
  18. package/ueditor-resource/dialogs/attachment/attachment.js +803 -803
  19. package/ueditor-resource/dialogs/audio/audio.css +879 -879
  20. package/ueditor-resource/dialogs/audio/audio.html +93 -93
  21. package/ueditor-resource/dialogs/audio/audio.js +815 -815
  22. package/ueditor-resource/dialogs/background/background.css +193 -193
  23. package/ueditor-resource/dialogs/background/background.html +59 -59
  24. package/ueditor-resource/dialogs/background/background.js +370 -370
  25. package/ueditor-resource/dialogs/contentimport/contentimport.html +176 -176
  26. package/ueditor-resource/dialogs/contentimport/contentimport.js +91 -91
  27. package/ueditor-resource/dialogs/emotion/emotion.css +129 -129
  28. package/ueditor-resource/dialogs/emotion/emotion.html +70 -70
  29. package/ueditor-resource/dialogs/emotion/emotion.js +186 -186
  30. package/ueditor-resource/dialogs/formula/formula.html +98 -98
  31. package/ueditor-resource/dialogs/formula/formula.js +147 -147
  32. package/ueditor-resource/dialogs/help/help.css +37 -37
  33. package/ueditor-resource/dialogs/help/help.html +82 -82
  34. package/ueditor-resource/dialogs/help/help.js +57 -57
  35. package/ueditor-resource/dialogs/image/image.css +768 -768
  36. package/ueditor-resource/dialogs/image/image.html +144 -144
  37. package/ueditor-resource/dialogs/image/image.js +1060 -1060
  38. package/ueditor-resource/dialogs/insertframe/insertframe.html +135 -135
  39. package/ueditor-resource/dialogs/internal.js +81 -81
  40. package/ueditor-resource/dialogs/link/link.html +148 -148
  41. package/ueditor-resource/dialogs/preview/preview.html +45 -45
  42. package/ueditor-resource/dialogs/scrawl/scrawl.css +324 -324
  43. package/ueditor-resource/dialogs/scrawl/scrawl.html +95 -95
  44. package/ueditor-resource/dialogs/scrawl/scrawl.js +682 -682
  45. package/ueditor-resource/dialogs/searchreplace/searchreplace.html +144 -144
  46. package/ueditor-resource/dialogs/searchreplace/searchreplace.js +174 -174
  47. package/ueditor-resource/dialogs/spechars/spechars.html +42 -42
  48. package/ueditor-resource/dialogs/spechars/spechars.js +86 -86
  49. package/ueditor-resource/dialogs/table/edittable.css +85 -85
  50. package/ueditor-resource/dialogs/table/edittable.html +69 -69
  51. package/ueditor-resource/dialogs/table/edittable.js +241 -241
  52. package/ueditor-resource/dialogs/table/edittd.html +62 -62
  53. package/ueditor-resource/dialogs/table/edittip.html +33 -33
  54. package/ueditor-resource/dialogs/template/config.js +42 -42
  55. package/ueditor-resource/dialogs/template/template.css +99 -99
  56. package/ueditor-resource/dialogs/template/template.html +26 -26
  57. package/ueditor-resource/dialogs/template/template.js +53 -53
  58. package/ueditor-resource/dialogs/video/video.css +909 -909
  59. package/ueditor-resource/dialogs/video/video.html +114 -114
  60. package/ueditor-resource/dialogs/video/video.js +867 -867
  61. package/ueditor-resource/dialogs/wordimage/wordimage.html +221 -221
  62. package/ueditor-resource/dialogs/wordimage/wordimage.js +93 -93
  63. package/ueditor-resource/lang/en/en.js +686 -686
  64. package/ueditor-resource/lang/zh-cn/zh-cn.js +748 -748
  65. package/ueditor-resource/lang/zh-tw/zh-tw.js +748 -748
  66. package/ueditor-resource/plugins/demo/demo.js +3 -3
  67. package/ueditor-resource/themes/default/css/ueditor.css +2148 -2148
  68. package/ueditor-resource/themes/default/dialog.css +17 -17
  69. package/ueditor-resource/themes/default/dialogbase.css +132 -132
  70. package/ueditor-resource/themes/default/exts/ai.svg +12 -12
  71. package/ueditor-resource/themes/default/exts/apk.svg +12 -12
  72. package/ueditor-resource/themes/default/exts/chm.svg +12 -12
  73. package/ueditor-resource/themes/default/exts/css.svg +12 -12
  74. package/ueditor-resource/themes/default/exts/doc.svg +22 -22
  75. package/ueditor-resource/themes/default/exts/docx.svg +22 -22
  76. package/ueditor-resource/themes/default/exts/dwg.svg +16 -16
  77. package/ueditor-resource/themes/default/exts/folder.svg +3 -3
  78. package/ueditor-resource/themes/default/exts/gif.svg +14 -14
  79. package/ueditor-resource/themes/default/exts/html.svg +12 -12
  80. package/ueditor-resource/themes/default/exts/jpeg.svg +14 -14
  81. package/ueditor-resource/themes/default/exts/jpg.svg +14 -14
  82. package/ueditor-resource/themes/default/exts/log.svg +12 -12
  83. package/ueditor-resource/themes/default/exts/mp3.svg +14 -14
  84. package/ueditor-resource/themes/default/exts/mp4.svg +12 -12
  85. package/ueditor-resource/themes/default/exts/pdf.svg +14 -14
  86. package/ueditor-resource/themes/default/exts/png.svg +14 -14
  87. package/ueditor-resource/themes/default/exts/ppt.svg +24 -24
  88. package/ueditor-resource/themes/default/exts/pptx.svg +24 -24
  89. package/ueditor-resource/themes/default/exts/psd.svg +12 -12
  90. package/ueditor-resource/themes/default/exts/rar.svg +12 -12
  91. package/ueditor-resource/themes/default/exts/svg.svg +12 -12
  92. package/ueditor-resource/themes/default/exts/torrent.svg +14 -14
  93. package/ueditor-resource/themes/default/exts/txt.svg +14 -14
  94. package/ueditor-resource/themes/default/exts/unknown.svg +12 -12
  95. package/ueditor-resource/themes/default/exts/xls.svg +25 -25
  96. package/ueditor-resource/themes/default/exts/xlsx.svg +25 -25
  97. package/ueditor-resource/themes/default/exts/zip.svg +12 -12
  98. package/ueditor-resource/themes/iframe.css +63 -63
  99. package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3655 -3655
  100. package/ueditor-resource/third-party/clipboard/clipboard.js +752 -752
  101. package/ueditor-resource/third-party/codemirror/codemirror.css +106 -106
  102. package/ueditor-resource/third-party/codemirror/codemirror.js +3581 -3581
  103. package/ueditor-resource/third-party/jquery-3.5.1.js +1 -1
  104. package/ueditor-resource/third-party/jquery-3.5.1_1.js +4314 -4314
  105. package/ueditor-resource/third-party/webuploader/webuploader.css +88 -88
  106. package/ueditor-resource/third-party/webuploader/webuploader.js +3 -3
  107. package/ueditor-resource/third-party/zeroclipboard/ZeroClipboard.js +1255 -1255
  108. package/ueditor-resource/ueditor.all.js +5271 -5270
  109. package/ueditor-resource/ueditor.config.js +655 -656
  110. package/ueditor-resource/ueditor.parse.js +13 -13
  111. package/es/LcdpUeditor.d.ts.map +0 -1
  112. package/es/const.d.ts.map +0 -1
  113. package/es/index.d.ts.map +0 -1
  114. package/es/tools/UeditorResourceLoader.d.ts.map +0 -1
  115. package/es/tools/loadScript.d.ts.map +0 -1
  116. package/es/type.d.ts.map +0 -1
  117. package/ueditor-resource/index.html +0 -146
@@ -1,144 +1,144 @@
1
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
- "http://www.w3.org/TR/html4/loose.dtd">
3
- <html>
4
- <head>
5
- <title></title>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
7
- <script type="text/javascript" src="../internal.js?32939b8e"></script>
8
- <style type="text/css">
9
- .warpper {
10
- position: relative;
11
- width: 380px;
12
- height: 100%;
13
- margin: 10px auto;
14
- }
15
-
16
- .tabbody {
17
- height: 160px;
18
- }
19
-
20
- .tabbody table {
21
- width: 100%;
22
- border-collapse: separate;
23
- border-spacing: 3px;
24
- line-height: 36px;
25
- }
26
-
27
- .tabbody .panel {
28
- width: 373px;
29
- height: 100%;
30
- padding-left: 5px;
31
- position: absolute;
32
- background-color: #fff;
33
- }
34
-
35
- .tabbody input.int {
36
- width: 190px;
37
- height: 30px;
38
- border: 1px solid #d7d7d7;
39
- line-height: 21px;
40
- border-radius: 3px;
41
- outline: none;
42
- padding: 0 5px;
43
- }
44
-
45
- .tabbody input.btn {
46
- text-align: center;
47
- line-height: 28px;
48
- text-decoration: none;
49
- height: 30px;
50
- border: 1px solid #ccc;
51
- background: #FFF;
52
- border-radius: 3px;
53
- padding: 0 5px;
54
- font-size: 12px;
55
- cursor: pointer;
56
- }
57
- </style>
58
- </head>
59
- <body>
60
- <div class="warpper" id="searchtab">
61
- <div id="head" class="tabhead">
62
- <span tabsrc="find" class="focus"><var id="lang_tab_search"></var></span>
63
- <span tabsrc="replace"><var id="lang_tab_replace"></var></span>
64
- </div>
65
- <div class="tabbody">
66
- <div class="panel" id="find">
67
- <table>
68
- <tr>
69
- <td width="80"><var id="lang_search1"></var>:</td>
70
- <td><input id="findtxt" type="text" class="int"/></td>
71
- </tr>
72
- <!--<tr>-->
73
-
74
- <!--<td colspan="2"><span style="color:red"><var id="lang_searchReg"></var></span></td>-->
75
- <!--</tr>-->
76
- <tr>
77
- <td><var id="lang_case_sensitive1"></var></td>
78
- <td>
79
- <input id="matchCase" type="checkbox"/>
80
- </td>
81
- </tr>
82
- <tr>
83
- <td colspan="2">
84
- <input id="nextFindBtn" type="button" class="btn"/>
85
- <input id="preFindBtn" type="button" class="btn"/>
86
- </td>
87
- </tr>
88
- <tr>
89
- <td colspan="2">
90
- &nbsp;
91
- </td>
92
- </tr>
93
- <tr>
94
- <td colspan="2">
95
- <span id="search-msg" style="color:red"></span>
96
- </td>
97
- </tr>
98
- </table>
99
- </div>
100
- <div class="panel" id="replace">
101
- <table>
102
- <tr>
103
- <td width="80"><var id="lang_search2"></var>:</td>
104
- <td><input id="findtxt1" type="text" class="int"/></td>
105
- </tr>
106
- <!--<tr>-->
107
-
108
- <!--<td colspan="2"><span style="color:red"><var id="lang_searchReg1"></var></span></td>-->
109
- <!--</tr>-->
110
- <tr>
111
- <td><var id="lang_replace"></var>:</td>
112
- <td><input id="replacetxt" type="text" class="int"/></td>
113
- </tr>
114
- <tr>
115
- <td><var id="lang_case_sensitive2"></var></td>
116
- <td>
117
- <input id="matchCase1" type="checkbox"/>
118
- </td>
119
- </tr>
120
- <tr>
121
- <td colspan="2">
122
- <input id="nextReplaceBtn" type="button" class="btn"/>
123
- <input id="preReplaceBtn" type="button" class="btn"/>
124
- <input id="repalceBtn" type="button" class="btn"/>
125
- <input id="repalceAllBtn" type="button" class="btn"/>
126
- </td>
127
- </tr>
128
- <tr>
129
- <td colspan="2">
130
- &nbsp;
131
- </td>
132
- </tr>
133
- <tr>
134
- <td colspan="2">
135
- <span id="replace-msg" style="color:red"></span>
136
- </td>
137
- </tr>
138
- </table>
139
- </div>
140
- </div>
141
- </div>
142
- <script type="text/javascript" src="searchreplace.js?8bc07778"></script>
143
- </body>
144
- </html>
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <title></title>
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
7
+ <script type="text/javascript" src="../internal.js?aea0c61c"></script>
8
+ <style type="text/css">
9
+ .warpper {
10
+ position: relative;
11
+ width: 380px;
12
+ height: 100%;
13
+ margin: 10px auto;
14
+ }
15
+
16
+ .tabbody {
17
+ height: 160px;
18
+ }
19
+
20
+ .tabbody table {
21
+ width: 100%;
22
+ border-collapse: separate;
23
+ border-spacing: 3px;
24
+ line-height: 36px;
25
+ }
26
+
27
+ .tabbody .panel {
28
+ width: 373px;
29
+ height: 100%;
30
+ padding-left: 5px;
31
+ position: absolute;
32
+ background-color: #fff;
33
+ }
34
+
35
+ .tabbody input.int {
36
+ width: 190px;
37
+ height: 30px;
38
+ border: 1px solid #d7d7d7;
39
+ line-height: 21px;
40
+ border-radius: 3px;
41
+ outline: none;
42
+ padding: 0 5px;
43
+ }
44
+
45
+ .tabbody input.btn {
46
+ text-align: center;
47
+ line-height: 28px;
48
+ text-decoration: none;
49
+ height: 30px;
50
+ border: 1px solid #ccc;
51
+ background: #FFF;
52
+ border-radius: 3px;
53
+ padding: 0 5px;
54
+ font-size: 12px;
55
+ cursor: pointer;
56
+ }
57
+ </style>
58
+ </head>
59
+ <body>
60
+ <div class="warpper" id="searchtab">
61
+ <div id="head" class="tabhead">
62
+ <span tabsrc="find" class="focus"><var id="lang_tab_search"></var></span>
63
+ <span tabsrc="replace"><var id="lang_tab_replace"></var></span>
64
+ </div>
65
+ <div class="tabbody">
66
+ <div class="panel" id="find">
67
+ <table>
68
+ <tr>
69
+ <td width="80"><var id="lang_search1"></var>:</td>
70
+ <td><input id="findtxt" type="text" class="int"/></td>
71
+ </tr>
72
+ <!--<tr>-->
73
+
74
+ <!--<td colspan="2"><span style="color:red"><var id="lang_searchReg"></var></span></td>-->
75
+ <!--</tr>-->
76
+ <tr>
77
+ <td><var id="lang_case_sensitive1"></var></td>
78
+ <td>
79
+ <input id="matchCase" type="checkbox"/>
80
+ </td>
81
+ </tr>
82
+ <tr>
83
+ <td colspan="2">
84
+ <input id="nextFindBtn" type="button" class="btn"/>
85
+ <input id="preFindBtn" type="button" class="btn"/>
86
+ </td>
87
+ </tr>
88
+ <tr>
89
+ <td colspan="2">
90
+ &nbsp;
91
+ </td>
92
+ </tr>
93
+ <tr>
94
+ <td colspan="2">
95
+ <span id="search-msg" style="color:red"></span>
96
+ </td>
97
+ </tr>
98
+ </table>
99
+ </div>
100
+ <div class="panel" id="replace">
101
+ <table>
102
+ <tr>
103
+ <td width="80"><var id="lang_search2"></var>:</td>
104
+ <td><input id="findtxt1" type="text" class="int"/></td>
105
+ </tr>
106
+ <!--<tr>-->
107
+
108
+ <!--<td colspan="2"><span style="color:red"><var id="lang_searchReg1"></var></span></td>-->
109
+ <!--</tr>-->
110
+ <tr>
111
+ <td><var id="lang_replace"></var>:</td>
112
+ <td><input id="replacetxt" type="text" class="int"/></td>
113
+ </tr>
114
+ <tr>
115
+ <td><var id="lang_case_sensitive2"></var></td>
116
+ <td>
117
+ <input id="matchCase1" type="checkbox"/>
118
+ </td>
119
+ </tr>
120
+ <tr>
121
+ <td colspan="2">
122
+ <input id="nextReplaceBtn" type="button" class="btn"/>
123
+ <input id="preReplaceBtn" type="button" class="btn"/>
124
+ <input id="repalceBtn" type="button" class="btn"/>
125
+ <input id="repalceAllBtn" type="button" class="btn"/>
126
+ </td>
127
+ </tr>
128
+ <tr>
129
+ <td colspan="2">
130
+ &nbsp;
131
+ </td>
132
+ </tr>
133
+ <tr>
134
+ <td colspan="2">
135
+ <span id="replace-msg" style="color:red"></span>
136
+ </td>
137
+ </tr>
138
+ </table>
139
+ </div>
140
+ </div>
141
+ </div>
142
+ <script type="text/javascript" src="searchreplace.js?2c3cf2d3"></script>
143
+ </body>
144
+ </html>
@@ -1,174 +1,174 @@
1
- /**
2
- * Created with JetBrains PhpStorm.
3
- * User: xuheng
4
- * Date: 12-9-26
5
- * Time: 下午12:29
6
- * To change this template use File | Settings | File Templates.
7
- */
8
-
9
- //清空上次查选的痕迹
10
- editor.firstForSR = 0;
11
- editor.currentRangeForSR = null;
12
-
13
- //给tab注册切换事件
14
- /**
15
- * tab点击处理事件
16
- * @param tabHeads
17
- * @param tabBodys
18
- * @param obj
19
- */
20
- function clickHandler(tabHeads, tabBodys, obj) {
21
- //head样式更改
22
- for (var k = 0, len = tabHeads.length; k < len; k++) {
23
- tabHeads[k].className = "";
24
- }
25
- obj.className = "focus";
26
- //body显隐
27
- var tabSrc = obj.getAttribute("tabSrc");
28
- for (var j = 0, length = tabBodys.length; j < length; j++) {
29
- var body = tabBodys[j],
30
- id = body.getAttribute("id");
31
- if (id != tabSrc) {
32
- body.style.zIndex = 1;
33
- } else {
34
- body.style.zIndex = 200;
35
- }
36
- }
37
-
38
- }
39
-
40
- /**
41
- * TAB切换
42
- * @param tabParentId tab的父节点ID或者对象本身
43
- */
44
- function switchTab(tabParentId) {
45
- var tabElements = $G(tabParentId).children,
46
- tabHeads = tabElements[0].children,
47
- tabBodys = tabElements[1].children;
48
-
49
- for (var i = 0, length = tabHeads.length; i < length; i++) {
50
- var head = tabHeads[i];
51
- if (head.className === "focus") clickHandler(tabHeads, tabBodys, head);
52
- head.onclick = function () {
53
- clickHandler(tabHeads, tabBodys, this);
54
- }
55
- }
56
- }
57
-
58
- $G('searchtab').onmousedown = function () {
59
- $G('search-msg').innerHTML = '';
60
- $G('replace-msg').innerHTML = ''
61
- }
62
-
63
- //是否区分大小写
64
- function getMatchCase(id) {
65
- return $G(id).checked ? true : false;
66
- }
67
-
68
- //查找
69
- $G("nextFindBtn").onclick = function (txt, dir, mcase) {
70
- var findtxt = $G("findtxt").value, obj;
71
- if (!findtxt) {
72
- return false;
73
- }
74
- obj = {
75
- searchStr: findtxt,
76
- dir: 1,
77
- casesensitive: getMatchCase("matchCase")
78
- };
79
- if (!frCommond(obj)) {
80
- var bk = editor.selection.getRange().createBookmark();
81
- $G('search-msg').innerHTML = lang.getEnd;
82
- editor.selection.getRange().moveToBookmark(bk).select();
83
-
84
-
85
- }
86
- };
87
- $G("nextReplaceBtn").onclick = function (txt, dir, mcase) {
88
- var findtxt = $G("findtxt1").value, obj;
89
- if (!findtxt) {
90
- return false;
91
- }
92
- obj = {
93
- searchStr: findtxt,
94
- dir: 1,
95
- casesensitive: getMatchCase("matchCase1")
96
- };
97
- frCommond(obj);
98
- };
99
- $G("preFindBtn").onclick = function (txt, dir, mcase) {
100
- var findtxt = $G("findtxt").value, obj;
101
- if (!findtxt) {
102
- return false;
103
- }
104
- obj = {
105
- searchStr: findtxt,
106
- dir: -1,
107
- casesensitive: getMatchCase("matchCase")
108
- };
109
- if (!frCommond(obj)) {
110
- $G('search-msg').innerHTML = lang.getStart;
111
- }
112
- };
113
- $G("preReplaceBtn").onclick = function (txt, dir, mcase) {
114
- var findtxt = $G("findtxt1").value, obj;
115
- if (!findtxt) {
116
- return false;
117
- }
118
- obj = {
119
- searchStr: findtxt,
120
- dir: -1,
121
- casesensitive: getMatchCase("matchCase1")
122
- };
123
- frCommond(obj);
124
- };
125
- //替换
126
- $G("repalceBtn").onclick = function () {
127
- editor.trigger('clearLastSearchResult');
128
- var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj,
129
- replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, "");
130
- if (!findtxt) {
131
- return false;
132
- }
133
- if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) {
134
- return false;
135
- }
136
- obj = {
137
- searchStr: findtxt,
138
- dir: 1,
139
- casesensitive: getMatchCase("matchCase1"),
140
- replaceStr: replacetxt
141
- };
142
- frCommond(obj);
143
- };
144
- //全部替换
145
- $G("repalceAllBtn").onclick = function () {
146
- var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj,
147
- replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, "");
148
- if (!findtxt) {
149
- return false;
150
- }
151
- if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) {
152
- return false;
153
- }
154
- obj = {
155
- searchStr: findtxt,
156
- casesensitive: getMatchCase("matchCase1"),
157
- replaceStr: replacetxt,
158
- all: true
159
- };
160
- var num = frCommond(obj);
161
- if (num) {
162
- $G('replace-msg').innerHTML = lang.countMsg.replace("{#count}", num);
163
- }
164
- };
165
- //执行
166
- var frCommond = function (obj) {
167
- return editor.execCommand("searchreplace", obj);
168
- };
169
- switchTab("searchtab");
170
-
171
-
172
- dialog.onclose = function () {
173
- editor.trigger('clearLastSearchResult')
174
- };
1
+ /**
2
+ * Created with JetBrains PhpStorm.
3
+ * User: xuheng
4
+ * Date: 12-9-26
5
+ * Time: 下午12:29
6
+ * To change this template use File | Settings | File Templates.
7
+ */
8
+
9
+ //清空上次查选的痕迹
10
+ editor.firstForSR = 0;
11
+ editor.currentRangeForSR = null;
12
+
13
+ //给tab注册切换事件
14
+ /**
15
+ * tab点击处理事件
16
+ * @param tabHeads
17
+ * @param tabBodys
18
+ * @param obj
19
+ */
20
+ function clickHandler(tabHeads, tabBodys, obj) {
21
+ //head样式更改
22
+ for (var k = 0, len = tabHeads.length; k < len; k++) {
23
+ tabHeads[k].className = "";
24
+ }
25
+ obj.className = "focus";
26
+ //body显隐
27
+ var tabSrc = obj.getAttribute("tabSrc");
28
+ for (var j = 0, length = tabBodys.length; j < length; j++) {
29
+ var body = tabBodys[j],
30
+ id = body.getAttribute("id");
31
+ if (id != tabSrc) {
32
+ body.style.zIndex = 1;
33
+ } else {
34
+ body.style.zIndex = 200;
35
+ }
36
+ }
37
+
38
+ }
39
+
40
+ /**
41
+ * TAB切换
42
+ * @param tabParentId tab的父节点ID或者对象本身
43
+ */
44
+ function switchTab(tabParentId) {
45
+ var tabElements = $G(tabParentId).children,
46
+ tabHeads = tabElements[0].children,
47
+ tabBodys = tabElements[1].children;
48
+
49
+ for (var i = 0, length = tabHeads.length; i < length; i++) {
50
+ var head = tabHeads[i];
51
+ if (head.className === "focus") clickHandler(tabHeads, tabBodys, head);
52
+ head.onclick = function () {
53
+ clickHandler(tabHeads, tabBodys, this);
54
+ }
55
+ }
56
+ }
57
+
58
+ $G('searchtab').onmousedown = function () {
59
+ $G('search-msg').innerHTML = '';
60
+ $G('replace-msg').innerHTML = ''
61
+ }
62
+
63
+ //是否区分大小写
64
+ function getMatchCase(id) {
65
+ return $G(id).checked ? true : false;
66
+ }
67
+
68
+ //查找
69
+ $G("nextFindBtn").onclick = function (txt, dir, mcase) {
70
+ var findtxt = $G("findtxt").value, obj;
71
+ if (!findtxt) {
72
+ return false;
73
+ }
74
+ obj = {
75
+ searchStr: findtxt,
76
+ dir: 1,
77
+ casesensitive: getMatchCase("matchCase")
78
+ };
79
+ if (!frCommond(obj)) {
80
+ var bk = editor.selection.getRange().createBookmark();
81
+ $G('search-msg').innerHTML = lang.getEnd;
82
+ editor.selection.getRange().moveToBookmark(bk).select();
83
+
84
+
85
+ }
86
+ };
87
+ $G("nextReplaceBtn").onclick = function (txt, dir, mcase) {
88
+ var findtxt = $G("findtxt1").value, obj;
89
+ if (!findtxt) {
90
+ return false;
91
+ }
92
+ obj = {
93
+ searchStr: findtxt,
94
+ dir: 1,
95
+ casesensitive: getMatchCase("matchCase1")
96
+ };
97
+ frCommond(obj);
98
+ };
99
+ $G("preFindBtn").onclick = function (txt, dir, mcase) {
100
+ var findtxt = $G("findtxt").value, obj;
101
+ if (!findtxt) {
102
+ return false;
103
+ }
104
+ obj = {
105
+ searchStr: findtxt,
106
+ dir: -1,
107
+ casesensitive: getMatchCase("matchCase")
108
+ };
109
+ if (!frCommond(obj)) {
110
+ $G('search-msg').innerHTML = lang.getStart;
111
+ }
112
+ };
113
+ $G("preReplaceBtn").onclick = function (txt, dir, mcase) {
114
+ var findtxt = $G("findtxt1").value, obj;
115
+ if (!findtxt) {
116
+ return false;
117
+ }
118
+ obj = {
119
+ searchStr: findtxt,
120
+ dir: -1,
121
+ casesensitive: getMatchCase("matchCase1")
122
+ };
123
+ frCommond(obj);
124
+ };
125
+ //替换
126
+ $G("repalceBtn").onclick = function () {
127
+ editor.trigger('clearLastSearchResult');
128
+ var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj,
129
+ replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, "");
130
+ if (!findtxt) {
131
+ return false;
132
+ }
133
+ if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) {
134
+ return false;
135
+ }
136
+ obj = {
137
+ searchStr: findtxt,
138
+ dir: 1,
139
+ casesensitive: getMatchCase("matchCase1"),
140
+ replaceStr: replacetxt
141
+ };
142
+ frCommond(obj);
143
+ };
144
+ //全部替换
145
+ $G("repalceAllBtn").onclick = function () {
146
+ var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj,
147
+ replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, "");
148
+ if (!findtxt) {
149
+ return false;
150
+ }
151
+ if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) {
152
+ return false;
153
+ }
154
+ obj = {
155
+ searchStr: findtxt,
156
+ casesensitive: getMatchCase("matchCase1"),
157
+ replaceStr: replacetxt,
158
+ all: true
159
+ };
160
+ var num = frCommond(obj);
161
+ if (num) {
162
+ $G('replace-msg').innerHTML = lang.countMsg.replace("{#count}", num);
163
+ }
164
+ };
165
+ //执行
166
+ var frCommond = function (obj) {
167
+ return editor.execCommand("searchreplace", obj);
168
+ };
169
+ switchTab("searchtab");
170
+
171
+
172
+ dialog.onclose = function () {
173
+ editor.trigger('clearLastSearchResult')
174
+ };