tinymce+5.10.9.patch 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. diff --git a/node_modules/tinymce/plugins/ax_wordlimit/index.js b/node_modules/tinymce/plugins/ax_wordlimit/index.js
  2. new file mode 100644
  3. index 0000000..02edc4d
  4. --- /dev/null
  5. +++ b/node_modules/tinymce/plugins/ax_wordlimit/index.js
  6. @@ -0,0 +1,7 @@
  7. +// Exports the "ax_wordlimit" plugin for usage with module loaders
  8. +// Usage:
  9. +// CommonJS:
  10. +// require('tinymce/plugins/ax_wordlimit')
  11. +// ES2015:
  12. +// import 'tinymce/plugins/ax_wordlimit'
  13. +require('./plugin.js');
  14. diff --git a/node_modules/tinymce/plugins/ax_wordlimit/plugin.js b/node_modules/tinymce/plugins/ax_wordlimit/plugin.js
  15. new file mode 100644
  16. index 0000000..bd4704d
  17. --- /dev/null
  18. +++ b/node_modules/tinymce/plugins/ax_wordlimit/plugin.js
  19. @@ -0,0 +1,55 @@
  20. +tinymce.PluginManager.add('ax_wordlimit', function(editor) {
  21. + var pluginName='字数限制';
  22. + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
  23. + var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
  24. + var ax_wordlimit_type = editor.getParam('ax_wordlimit_type', 'letter' );
  25. + var ax_wordlimit_num = editor.getParam('ax_wordlimit_num', false );
  26. + var ax_wordlimit_delay = editor.getParam('ax_wordlimit_delay', 500 );
  27. + var ax_wordlimit_callback = editor.getParam('ax_wordlimit_callback', function(){} );
  28. + var ax_wordlimit_event = editor.getParam('ax_wordlimit_event', 'SetContent Undo Redo Keyup' );
  29. + var onsign=1;
  30. + //统计方法1:计算总字符数
  31. + var sumLetter = function(){
  32. + var html = editor.getContent();
  33. + var re1 = new RegExp("<.+?>","g");
  34. + var txt = html.replace(re1,'');
  35. + txt = txt.replace(/\n/g,'');
  36. + txt = txt.replace(/&nbsp;/g,' ');
  37. + var num=txt.length;
  38. + return {txt:txt,num:num}
  39. + }
  40. + var onAct = function(){
  41. + if(onsign){
  42. + onsign=0;
  43. + //此处预留更多统计方法
  44. + switch(ax_wordlimit_type){
  45. + case 'letter':
  46. + default:
  47. + var res = sumLetter();
  48. + }
  49. + if( res.num > ax_wordlimit_num ){
  50. + ax_wordlimit_callback(editor, res.txt, ax_wordlimit_num);
  51. + }
  52. + setTimeout(function(){onsign=1}, ax_wordlimit_delay);
  53. + }
  54. +
  55. + }
  56. + var setup = function(){
  57. + if( ax_wordlimit_num>0 ){
  58. + global$2.setEditorTimeout(editor, function(){
  59. + var doth = editor.on(ax_wordlimit_event, onAct);
  60. + }, 300);
  61. + }
  62. + };
  63. +
  64. + setup();
  65. +
  66. + return {
  67. + getMetadata: function () {
  68. + return {
  69. + name: pluginName,
  70. + url: "http://tinymce.ax-z.cn/more-plugins/ax_wordlimit.php",
  71. + };
  72. + }
  73. + };
  74. +});
  75. diff --git a/node_modules/tinymce/plugins/ax_wordlimit/plugin.min.js b/node_modules/tinymce/plugins/ax_wordlimit/plugin.min.js
  76. new file mode 100644
  77. index 0000000..143777e
  78. --- /dev/null
  79. +++ b/node_modules/tinymce/plugins/ax_wordlimit/plugin.min.js
  80. @@ -0,0 +1,55 @@
  81. +tinymce.PluginManager.add('ax_wordlimit', function(editor) {
  82. + var pluginName='字数限制';
  83. + var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
  84. + var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
  85. + var ax_wordlimit_type = editor.getParam('ax_wordlimit_type', 'letter' );
  86. + var ax_wordlimit_num = editor.getParam('ax_wordlimit_num', false );
  87. + var ax_wordlimit_delay = editor.getParam('ax_wordlimit_delay', 500 );
  88. + var ax_wordlimit_callback = editor.getParam('ax_wordlimit_callback', function(){} );
  89. + var ax_wordlimit_event = editor.getParam('ax_wordlimit_event', 'SetContent Undo Redo Keyup' );
  90. + var onsign=1;
  91. + //统计方法1:计算总字符数
  92. + var sumLetter = function(){
  93. + var html = editor.getContent();
  94. + var re1 = new RegExp("<.+?>","g");
  95. + var txt = html.replace(re1,'');
  96. + txt = txt.replace(/\n/g,'');
  97. + txt = txt.replace(/&nbsp;/g,' ');
  98. + var num=txt.length;
  99. + return {txt:txt,num:num}
  100. + }
  101. + var onAct = function(){
  102. + if(onsign){
  103. + onsign=0;
  104. + //此处预留更多统计方法
  105. + switch(ax_wordlimit_type){
  106. + case 'letter':
  107. + default:
  108. + var res = sumLetter();
  109. + }
  110. + if( res.num > ax_wordlimit_num ){
  111. + ax_wordlimit_callback(editor, res.txt, ax_wordlimit_num);
  112. + }
  113. + setTimeout(function(){onsign=1}, ax_wordlimit_delay);
  114. + }
  115. +
  116. + }
  117. + var setup = function(){
  118. + if( ax_wordlimit_num>0 ){
  119. + global$2.setEditorTimeout(editor, function(){
  120. + var doth = editor.on(ax_wordlimit_event, onAct);
  121. + }, 300);
  122. + }
  123. + };
  124. +
  125. + setup();
  126. +
  127. + return {
  128. + getMetadata: function () {
  129. + return {
  130. + name: pluginName,
  131. + url: "http://tinymce.ax-z.cn/more-plugins/ax_wordlimit.php",
  132. + };
  133. + }
  134. + };
  135. +});
  136. diff --git a/node_modules/tinymce/plugins/image/plugin.js b/node_modules/tinymce/plugins/image/plugin.js
  137. index 1691b27..5255b8c 100644
  138. --- a/node_modules/tinymce/plugins/image/plugin.js
  139. +++ b/node_modules/tinymce/plugins/image/plugin.js
  140. @@ -8,7 +8,6 @@
  141. */
  142. (function () {
  143. 'use strict';
  144. -
  145. var global$6 = tinymce.util.Tools.resolve('tinymce.PluginManager');
  146. var __assign = function () {
  147. @@ -1407,7 +1406,7 @@
  148. meta: {}
  149. }
  150. });
  151. - api.showTab('general');
  152. + // api.showTab('general'); 切换 tab 为普通
  153. changeSrc(helpers, info, state, api);
  154. };
  155. blobToDataUri(file).then(function (dataUrl) {
  156. @@ -1416,6 +1415,8 @@
  157. helpers.uploadImage(blobInfo).then(function (result) {
  158. updateSrcAndSwitchTab(result.url);
  159. finalize();
  160. + helpers.onSubmit(info)(api); // 上传成功后,触发保存事件
  161. + updateSrcAndSwitchTab(""); // 保存事件成功后,清空 src
  162. }).catch(function (err) {
  163. finalize();
  164. helpers.alertErr(err);
  165. diff --git a/node_modules/tinymce/tinymce.js b/node_modules/tinymce/tinymce.js
  166. index 3955a24..2988ecd 100644
  167. --- a/node_modules/tinymce/tinymce.js
  168. +++ b/node_modules/tinymce/tinymce.js
  169. @@ -810,7 +810,7 @@
  170. var lTrim = blank(/^\s+/g);
  171. var rTrim = blank(/\s+$/g);
  172. var isNotEmpty = function (s) {
  173. - return s.length > 0;
  174. + return s?.length > 0;
  175. };
  176. var isEmpty$3 = function (s) {
  177. return !isNotEmpty(s);