suneditor 2.44.7 → 2.44.9

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 (130) hide show
  1. package/LICENSE.txt +20 -20
  2. package/README.md +1585 -1585
  3. package/dist/suneditor.min.js +2 -2
  4. package/package.json +71 -71
  5. package/src/assets/css/suneditor-contents.css +556 -556
  6. package/src/assets/css/suneditor.css +0 -0
  7. package/src/assets/defaultIcons.js +103 -103
  8. package/src/lang/Lang.d.ts +143 -143
  9. package/src/lang/ckb.d.ts +4 -4
  10. package/src/lang/ckb.js +187 -187
  11. package/src/lang/da.d.ts +4 -4
  12. package/src/lang/da.js +191 -191
  13. package/src/lang/de.d.ts +4 -4
  14. package/src/lang/de.js +187 -187
  15. package/src/lang/en.d.ts +4 -4
  16. package/src/lang/en.js +187 -187
  17. package/src/lang/es.d.ts +4 -4
  18. package/src/lang/es.js +187 -187
  19. package/src/lang/fr.d.ts +4 -4
  20. package/src/lang/fr.js +188 -188
  21. package/src/lang/he.d.ts +4 -4
  22. package/src/lang/he.js +188 -188
  23. package/src/lang/index.d.ts +22 -22
  24. package/src/lang/index.js +25 -25
  25. package/src/lang/it.d.ts +4 -4
  26. package/src/lang/it.js +188 -188
  27. package/src/lang/ja.d.ts +4 -4
  28. package/src/lang/ja.js +187 -187
  29. package/src/lang/ko.d.ts +4 -4
  30. package/src/lang/ko.js +187 -187
  31. package/src/lang/lv.d.ts +4 -4
  32. package/src/lang/lv.js +187 -187
  33. package/src/lang/nl.d.ts +4 -4
  34. package/src/lang/nl.js +187 -187
  35. package/src/lang/pl.d.ts +4 -4
  36. package/src/lang/pl.js +187 -187
  37. package/src/lang/pt_br.d.ts +4 -4
  38. package/src/lang/pt_br.js +189 -189
  39. package/src/lang/ro.d.ts +4 -4
  40. package/src/lang/ro.js +187 -187
  41. package/src/lang/ru.d.ts +4 -4
  42. package/src/lang/ru.js +187 -187
  43. package/src/lang/se.d.ts +4 -4
  44. package/src/lang/se.js +191 -191
  45. package/src/lang/ua.d.ts +5 -5
  46. package/src/lang/ua.js +188 -188
  47. package/src/lang/ur.d.ts +4 -4
  48. package/src/lang/ur.js +187 -187
  49. package/src/lang/zh_cn.d.ts +4 -4
  50. package/src/lang/zh_cn.js +187 -187
  51. package/src/lib/constructor.js +1 -1
  52. package/src/lib/context.d.ts +42 -42
  53. package/src/lib/context.js +0 -0
  54. package/src/lib/core.d.ts +1101 -1101
  55. package/src/lib/core.js +146 -97
  56. package/src/lib/history.d.ts +48 -48
  57. package/src/lib/history.js +218 -218
  58. package/src/lib/util.d.ts +677 -677
  59. package/src/lib/util.js +9 -11
  60. package/src/options.d.ts +608 -608
  61. package/src/plugins/CommandPlugin.d.ts +7 -7
  62. package/src/plugins/DialogPlugin.d.ts +19 -19
  63. package/src/plugins/FileBrowserPlugin.d.ts +29 -29
  64. package/src/plugins/Module.d.ts +14 -14
  65. package/src/plugins/Plugin.d.ts +41 -41
  66. package/src/plugins/SubmenuPlugin.d.ts +7 -7
  67. package/src/plugins/command/blockquote.d.ts +4 -4
  68. package/src/plugins/command/blockquote.js +46 -46
  69. package/src/plugins/dialog/audio.d.ts +4 -4
  70. package/src/plugins/dialog/audio.js +556 -556
  71. package/src/plugins/dialog/image.d.ts +4 -4
  72. package/src/plugins/dialog/image.js +1122 -1122
  73. package/src/plugins/dialog/link.d.ts +4 -4
  74. package/src/plugins/dialog/link.js +223 -223
  75. package/src/plugins/dialog/math.d.ts +4 -4
  76. package/src/plugins/dialog/math.js +294 -294
  77. package/src/plugins/dialog/mention.d.ts +5 -5
  78. package/src/plugins/dialog/mention.js +242 -242
  79. package/src/plugins/dialog/video.d.ts +4 -4
  80. package/src/plugins/dialog/video.js +983 -983
  81. package/src/plugins/fileBrowser/imageGallery.d.ts +4 -4
  82. package/src/plugins/fileBrowser/imageGallery.js +63 -63
  83. package/src/plugins/index.d.ts +79 -79
  84. package/src/plugins/index.js +32 -32
  85. package/src/plugins/modules/_anchor.js +461 -461
  86. package/src/plugins/modules/_colorPicker.d.ts +59 -59
  87. package/src/plugins/modules/_colorPicker.js +0 -0
  88. package/src/plugins/modules/_notice.d.ts +20 -20
  89. package/src/plugins/modules/_notice.js +72 -72
  90. package/src/plugins/modules/_selectMenu.js +118 -118
  91. package/src/plugins/modules/component.d.ts +24 -24
  92. package/src/plugins/modules/component.js +82 -82
  93. package/src/plugins/modules/dialog.d.ts +27 -27
  94. package/src/plugins/modules/dialog.js +174 -174
  95. package/src/plugins/modules/fileBrowser.d.ts +41 -41
  96. package/src/plugins/modules/fileBrowser.js +373 -373
  97. package/src/plugins/modules/fileManager.d.ts +66 -66
  98. package/src/plugins/modules/fileManager.js +325 -325
  99. package/src/plugins/modules/index.d.ts +10 -10
  100. package/src/plugins/modules/index.js +8 -8
  101. package/src/plugins/modules/resizing.d.ts +153 -153
  102. package/src/plugins/modules/resizing.js +895 -895
  103. package/src/plugins/submenu/align.d.ts +4 -4
  104. package/src/plugins/submenu/align.js +160 -160
  105. package/src/plugins/submenu/font.d.ts +4 -4
  106. package/src/plugins/submenu/font.js +120 -120
  107. package/src/plugins/submenu/fontColor.d.ts +4 -4
  108. package/src/plugins/submenu/fontColor.js +0 -0
  109. package/src/plugins/submenu/fontSize.d.ts +4 -4
  110. package/src/plugins/submenu/fontSize.js +112 -112
  111. package/src/plugins/submenu/formatBlock.d.ts +4 -4
  112. package/src/plugins/submenu/formatBlock.js +273 -273
  113. package/src/plugins/submenu/hiliteColor.d.ts +4 -4
  114. package/src/plugins/submenu/hiliteColor.js +0 -0
  115. package/src/plugins/submenu/horizontalRule.d.ts +4 -4
  116. package/src/plugins/submenu/horizontalRule.js +98 -98
  117. package/src/plugins/submenu/lineHeight.d.ts +4 -4
  118. package/src/plugins/submenu/lineHeight.js +104 -104
  119. package/src/plugins/submenu/list.d.ts +4 -4
  120. package/src/plugins/submenu/list.js +456 -456
  121. package/src/plugins/submenu/paragraphStyle.d.ts +4 -4
  122. package/src/plugins/submenu/paragraphStyle.js +135 -135
  123. package/src/plugins/submenu/table.d.ts +4 -4
  124. package/src/plugins/submenu/template.d.ts +4 -4
  125. package/src/plugins/submenu/template.js +71 -71
  126. package/src/plugins/submenu/textStyle.d.ts +4 -4
  127. package/src/plugins/submenu/textStyle.js +167 -167
  128. package/src/suneditor.d.ts +9 -9
  129. package/src/suneditor.js +75 -75
  130. package/src/suneditor_build.js +17 -17
package/src/lib/core.js CHANGED
@@ -2134,6 +2134,21 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
2134
2134
  this._resetRangeToTextNode();
2135
2135
 
2136
2136
  const range = this.getRange();
2137
+ const isStartEdge = range.startOffset === 0;
2138
+ const isEndEdge = core.isEdgePoint(range.endContainer, range.endOffset);
2139
+ let prevContainer = null;
2140
+ let startPrevEl = null;
2141
+ let endNextEl = null;
2142
+ if (isStartEdge) {
2143
+ startPrevEl = util.getFormatElement(range.startContainer);
2144
+ prevContainer = startPrevEl.previousElementSibling;
2145
+ startPrevEl = startPrevEl ? prevContainer : startPrevEl;
2146
+ }
2147
+ if (isEndEdge) {
2148
+ endNextEl = util.getFormatElement(range.endContainer);
2149
+ endNextEl = endNextEl ? endNextEl.nextElementSibling : endNextEl;
2150
+ }
2151
+
2137
2152
  let container, offset = 0;
2138
2153
  let startCon = range.startContainer;
2139
2154
  let endCon = range.endContainer;
@@ -2269,6 +2284,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
2269
2284
  offset = container.textContent.length;
2270
2285
  } else {
2271
2286
  container = endCon && endCon.parentNode ? endCon : startCon && startCon.parentNode ? startCon : (range.endContainer || range.startContainer);
2287
+ offset = (!isStartEdge && !isEndEdge) ? offset : isEndEdge ? container.textContent.length : 0;
2272
2288
  }
2273
2289
 
2274
2290
  if (!util.isWysiwygDiv(container) && container.childNodes.length === 0) {
@@ -2276,6 +2292,16 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
2276
2292
  if (rc) container = rc.sc || rc.ec || context.element.wysiwyg;
2277
2293
  }
2278
2294
 
2295
+ if (!util.getFormatElement(container) && !(startCon && startCon.parentNode)) {
2296
+ if (endNextEl) {
2297
+ container = endNextEl;
2298
+ offset = 0;
2299
+ } else if (startPrevEl) {
2300
+ container = startPrevEl;
2301
+ offset = 1;
2302
+ }
2303
+ }
2304
+
2279
2305
  // set range
2280
2306
  this.setRange(container, offset, container, offset);
2281
2307
  // history stack
@@ -2284,7 +2310,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
2284
2310
  return {
2285
2311
  container: container,
2286
2312
  offset: offset,
2287
- prevContainer: startCon && startCon.parentNode ? startCon : null
2313
+ prevContainer: prevContainer
2288
2314
  };
2289
2315
  },
2290
2316
 
@@ -5262,7 +5288,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
5262
5288
  if (style) {
5263
5289
  const allowedStyle = [];
5264
5290
  for (let i = 0, len = style.length, r; i < len; i++) {
5265
- r = style[i].match(/([a-zA-Z0-9-]+)(:)([^:]+$)/);
5291
+ r = style[i].match(/([a-zA-Z0-9-]+)(:)([^"]+)/);
5266
5292
  if (r && !/inherit|initial|revert|unset/i.test(r[3])) {
5267
5293
  const k = util.kebabToCamelCase(r[1].trim());
5268
5294
  const v = this.wwComputedStyle[k].replace(/"/g, '');
@@ -5447,7 +5473,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
5447
5473
  * @returns {String}
5448
5474
  */
5449
5475
  cleanHTML: function (html, whitelist, blacklist) {
5450
- html = this._deleteDisallowedTags(this._parser.parseFromString(html, 'text/html').body.innerHTML).replace(/(<[a-zA-Z0-9\-]+)[^>]*(?=>)/g, this._cleanTags.bind(this, true));
5476
+ html = this._deleteDisallowedTags(this._parser.parseFromString(html, 'text/html').body.innerHTML).replace(/(<[a-zA-Z0-9\-]+)[^>]*(?=>)/g, this._cleanTags.bind(this, true)).replace(/<br\/?>$/i, '');
5451
5477
  const dom = _d.createRange().createContextualFragment(html);
5452
5478
  try {
5453
5479
  util._consistencyCheckOfHTML(dom, this._htmlCheckWhitelistRegExp, this._htmlCheckBlacklistRegExp, true);
@@ -6222,14 +6248,16 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
6222
6248
  this.history.reset(true);
6223
6249
 
6224
6250
  _w.setTimeout(function () {
6251
+ if (typeof core._resourcesStateChange !== 'function') return;
6252
+
6225
6253
  // observer
6226
6254
  if (event._resizeObserver) event._resizeObserver.observe(context.element.wysiwygFrame);
6227
6255
  if (event._toolbarObserver) event._toolbarObserver.observe(context.element._toolbarShadow);
6228
6256
  // resource state
6229
- this._resourcesStateChange();
6257
+ core._resourcesStateChange();
6230
6258
  // user event
6231
6259
  if (typeof functions.onload === 'function') functions.onload(core, reload);
6232
- }.bind(this));
6260
+ });
6233
6261
  },
6234
6262
 
6235
6263
  /**
@@ -6544,7 +6572,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
6544
6572
  }
6545
6573
  }
6546
6574
 
6547
- _w.setTimeout(core._editorRange.bind(core));
6548
6575
  core._editorRange();
6549
6576
 
6550
6577
  const selectionNode = core.getSelectionNode();
@@ -7315,6 +7342,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
7315
7342
  if (!shift) {
7316
7343
  const formatEndEdge = core._isEdgeFormat(range.endContainer, range.endOffset, 'end');
7317
7344
  const formatStartEdge = core._isEdgeFormat(range.startContainer, range.startOffset, 'start');
7345
+
7318
7346
  // add default format line
7319
7347
  if (formatEndEdge && (/^H[1-6]$/i.test(formatEl.nodeName) || /^HR$/i.test(formatEl.nodeName))) {
7320
7348
  e.preventDefault();
@@ -7333,66 +7361,48 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
7333
7361
  temp = !temp ? newFormat.firstChild : temp.appendChild(newFormat.firstChild);
7334
7362
  core.setRange(temp, 0, temp, 0);
7335
7363
  break;
7336
- }
7337
-
7338
- // set format attrs - edge
7339
- if (formatStartEdge || formatEndEdge) {
7340
- e.preventDefault();
7341
- const focusBR = util.createElement('BR');
7342
- const newFormat = util.createElement(formatEl.nodeName);
7343
- newFormat.appendChild(focusBR);
7344
-
7345
- util.copyTagAttributes(newFormat, formatEl, ['id'].concat(options.lineAttrReset));
7346
-
7347
- formatEl.parentNode.insertBefore(newFormat, formatStartEdge ? formatEl : formatEl.nextElementSibling);
7348
- if (formatEndEdge) {
7349
- core.setRange(focusBR, 1, focusBR, 1);
7364
+ } else if (rangeEl && formatEl && !util.isCell(rangeEl) && !/^FIGCAPTION$/i.test(rangeEl.nodeName)) {
7365
+ const range = core.getRange();
7366
+ if(core.isEdgePoint(range.endContainer, range.endOffset) && util.isList(selectionNode.nextSibling)) {
7367
+ e.preventDefault();
7368
+ const newEl = util.createElement('LI');
7369
+ const br = util.createElement('BR');
7370
+ newEl.appendChild(br);
7371
+
7372
+ formatEl.parentNode.insertBefore(newEl, formatEl.nextElementSibling);
7373
+ newEl.appendChild(selectionNode.nextSibling);
7374
+
7375
+ core.setRange(br, 1, br, 1);
7376
+ break;
7350
7377
  }
7351
-
7352
- break;
7353
- } else {
7354
- core._formatAttrsTemp = formatEl.attributes;
7355
- }
7356
-
7357
- if (options.lineAttrReset && formatEl && !util.isListCell(formatEl)) {
7358
- e.preventDefault();
7359
- e.stopPropagation();
7360
-
7361
- let newEl;
7362
- if (!range.collapsed) {
7363
- const isMultiLine = util.getFormatElement(range.startContainer, null) !== util.getFormatElement(range.endContainer, null);
7364
- const r = core.removeNode();
7365
- if (isMultiLine) {
7366
- newEl = util.getFormatElement(r.container, null);
7367
-
7368
- if (!r.prevContainer) {
7369
- const newFormat = formatEl.cloneNode(false);
7370
- newFormat.innerHTML = '<br>';
7371
- newEl.parentNode.insertBefore(newFormat, newEl);
7372
- } else if (newEl !== formatEl && newEl.nextElementSibling === formatEl) {
7373
- newEl = formatEl;
7378
+
7379
+ if ((range.commonAncestorContainer.nodeType === 3 ? !range.commonAncestorContainer.nextElementSibling : true) && util.onlyZeroWidthSpace(formatEl.innerText.trim()) && !util.isListCell(formatEl.nextElementSibling)) {
7380
+ e.preventDefault();
7381
+ let newEl = null;
7382
+
7383
+ if (util.isListCell(rangeEl.parentNode)) {
7384
+ rangeEl = formatEl.parentNode.parentNode.parentNode;
7385
+ newEl = util.splitElement(formatEl, null, util.getElementDepth(formatEl) - 2);
7386
+ if (!newEl) {
7387
+ const newListCell = util.createElement('LI');
7388
+ newListCell.innerHTML = '<br>';
7389
+ util.copyTagAttributes(newListCell, formatEl, options.lineAttrReset);
7390
+ rangeEl.insertBefore(newListCell, newEl);
7391
+ newEl = newListCell;
7374
7392
  }
7375
7393
  } else {
7376
- newEl = util.splitElement(r.container, r.offset, 0);
7377
- }
7378
- } else {
7379
- if (util.onlyZeroWidthSpace(formatEl)) newEl = core.appendFormatTag(formatEl, formatEl.cloneNode(false));
7380
- else newEl = util.splitElement(range.endContainer, range.endOffset, 0);
7381
- }
7382
-
7383
- const resetAttr = options.lineAttrReset;
7384
- const attrs = newEl.attributes;
7385
- let i = 0;
7386
- while (attrs[i]) {
7387
- if (resetAttr && resetAttr.indexOf(attrs[i].name.toLowerCase()) > -1) {
7388
- i++;
7389
- continue;
7394
+ const newFormat = util.isCell(rangeEl.parentNode) ? 'DIV' : util.isList(rangeEl.parentNode) ? 'LI' : (util.isFormatElement(rangeEl.nextElementSibling) && !util.isRangeFormatElement(rangeEl.nextElementSibling)) ? rangeEl.nextElementSibling.nodeName : (util.isFormatElement(rangeEl.previousElementSibling) && !util.isRangeFormatElement(rangeEl.previousElementSibling)) ? rangeEl.previousElementSibling.nodeName : options.defaultTag;
7395
+ newEl = util.createElement(newFormat);
7396
+ util.copyTagAttributes(newEl, formatEl, options.lineAttrReset);
7397
+ const edge = core.detachRangeFormatElement(rangeEl, [formatEl], null, true, true);
7398
+ edge.cc.insertBefore(newEl, edge.ec);
7390
7399
  }
7391
- newEl.removeAttribute(attrs[i].name);
7400
+
7401
+ newEl.innerHTML = '<br>';
7402
+ util.removeItemAllParents(formatEl, null, null);
7403
+ core.setRange(newEl, 1, newEl, 1);
7404
+ break;
7392
7405
  }
7393
- core.setRange(newEl.firstChild, 0, newEl.firstChild, 0);
7394
-
7395
- break;
7396
7406
  }
7397
7407
 
7398
7408
  if (freeFormatEl) {
@@ -7438,52 +7448,90 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
7438
7448
  event._onShortcutKey = true;
7439
7449
  break;
7440
7450
  }
7441
- }
7442
-
7443
- if (selectRange) break;
7444
-
7445
- if (rangeEl && formatEl && !util.isCell(rangeEl) && !/^FIGCAPTION$/i.test(rangeEl.nodeName)) {
7446
- const range = core.getRange();
7447
- if(core.isEdgePoint(range.endContainer, range.endOffset) && util.isList(selectionNode.nextSibling)) {
7451
+
7452
+ // set format attrs - edge
7453
+ if (range.collapsed && (formatStartEdge || formatEndEdge)) {
7448
7454
  e.preventDefault();
7449
- const newEl = util.createElement('LI');
7450
- const br = util.createElement('BR');
7451
- newEl.appendChild(br);
7455
+ const focusBR = util.createElement('BR');
7456
+ const newFormat = util.createElement(formatEl.nodeName);
7457
+ newFormat.appendChild(focusBR);
7458
+
7459
+ util.copyTagAttributes(newFormat, formatEl, options.lineAttrReset);
7452
7460
 
7453
- formatEl.parentNode.insertBefore(newEl, formatEl.nextElementSibling);
7454
- newEl.appendChild(selectionNode.nextSibling);
7461
+ formatEl.parentNode.insertBefore(newFormat, formatStartEdge ? formatEl : formatEl.nextElementSibling);
7462
+ if (formatEndEdge) {
7463
+ core.setRange(focusBR, 1, focusBR, 1);
7464
+ }
7455
7465
 
7456
- core.setRange(br, 1, br, 1);
7457
7466
  break;
7458
7467
  }
7468
+
7469
+ if (formatEl) {
7470
+ e.stopPropagation();
7459
7471
 
7460
- if ((range.commonAncestorContainer.nodeType === 3 ? !range.commonAncestorContainer.nextElementSibling : true) && util.onlyZeroWidthSpace(formatEl.innerText.trim())) {
7461
- e.preventDefault();
7462
- let newEl = null;
7463
-
7464
- if (util.isListCell(rangeEl.parentNode)) {
7465
- rangeEl = formatEl.parentNode.parentNode.parentNode;
7466
- newEl = util.splitElement(formatEl, null, util.getElementDepth(formatEl) - 2);
7472
+ let newEl;
7473
+ let offset = 0;
7474
+ if (!range.collapsed) {
7475
+ const isMultiLine = util.getFormatElement(range.startContainer, null) !== util.getFormatElement(range.endContainer, null);
7476
+ const newFormat = formatEl.cloneNode(false);
7477
+ newFormat.innerHTML = '<br>';
7478
+ const r = core.removeNode();
7479
+ newEl = util.getFormatElement(r.container, null);
7467
7480
  if (!newEl) {
7468
- const newListCell = util.createElement('LI');
7469
- newListCell.innerHTML = '<br>';
7470
- rangeEl.insertBefore(newListCell, newEl);
7471
- newEl = newListCell;
7481
+ if (util.isWysiwygDiv(r.container)) {
7482
+ e.preventDefault();
7483
+ context.element.wysiwyg.appendChild(newFormat);
7484
+ newEl = newFormat;
7485
+ util.copyTagAttributes(newEl, formatEl, options.lineAttrReset);
7486
+ core.setRange(newEl, offset, newEl, offset);
7487
+ }
7488
+ break;
7489
+ }
7490
+
7491
+ const innerRange = util.getRangeFormatElement(r.container);
7492
+ newEl = newEl.contains(innerRange) ? util.getChildElement(innerRange, util.getFormatElement.bind(util)) : newEl;
7493
+ if (isMultiLine) {
7494
+ if (formatEndEdge && !formatStartEdge) {
7495
+ newEl.parentNode.insertBefore(newFormat, (!r.prevContainer || r.container === r.prevContainer) ? newEl.nextElementSibling : newEl);
7496
+ newEl = newFormat;
7497
+ offset = 0;
7498
+ } else {
7499
+ offset = r.offset;
7500
+ if (formatStartEdge) {
7501
+ const tempEl = newEl.parentNode.insertBefore(newFormat, newEl);
7502
+ if (formatEndEdge) {
7503
+ newEl = tempEl;
7504
+ offset = 0;
7505
+ }
7506
+ }
7507
+ }
7508
+ } else {
7509
+ if (formatEndEdge && formatStartEdge) {
7510
+ newEl.parentNode.insertBefore(newFormat, (r.prevContainer && r.container === r.prevContainer) ? newEl.nextElementSibling : newEl);
7511
+ newEl = newFormat;
7512
+ offset = 0;
7513
+ } else {
7514
+ newEl = util.splitElement(r.container, r.offset, util.getElementDepth(formatEl));
7515
+ }
7472
7516
  }
7473
7517
  } else {
7474
- const newFormat = util.isCell(rangeEl.parentNode) ? 'DIV' : util.isList(rangeEl.parentNode) ? 'LI' : (util.isFormatElement(rangeEl.nextElementSibling) && !util.isRangeFormatElement(rangeEl.nextElementSibling)) ? rangeEl.nextElementSibling.nodeName : (util.isFormatElement(rangeEl.previousElementSibling) && !util.isRangeFormatElement(rangeEl.previousElementSibling)) ? rangeEl.previousElementSibling.nodeName : options.defaultTag;
7475
- newEl = util.createElement(newFormat);
7476
- const edge = core.detachRangeFormatElement(rangeEl, [formatEl], null, true, true);
7477
- edge.cc.insertBefore(newEl, edge.ec);
7518
+ if (util.onlyZeroWidthSpace(formatEl)) {
7519
+ newEl = core.appendFormatTag(formatEl, formatEl.cloneNode(false));
7520
+ } else {
7521
+ newEl = util.splitElement(range.endContainer, range.endOffset, util.getElementDepth(formatEl));
7522
+ }
7478
7523
  }
7479
-
7480
- newEl.innerHTML = '<br>';
7481
- util.removeItemAllParents(formatEl, null, null);
7482
- core.setRange(newEl, 1, newEl, 1);
7524
+
7525
+ e.preventDefault();
7526
+ util.copyTagAttributes(newEl, formatEl, options.lineAttrReset);
7527
+ core.setRange(newEl, offset, newEl, offset);
7528
+
7483
7529
  break;
7484
7530
  }
7485
7531
  }
7486
7532
 
7533
+ if (selectRange) break;
7534
+
7487
7535
  if (rangeEl && util.getParentElement(rangeEl, 'FIGCAPTION') && util.getParentElement(rangeEl, util.isList)) {
7488
7536
  e.preventDefault();
7489
7537
  formatEl = core.appendFormatTag(formatEl, null);
@@ -7675,6 +7723,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
7675
7723
 
7676
7724
  onMouseDown_resizingBar: function (e) {
7677
7725
  e.stopPropagation();
7726
+ _w.setTimeout(core._editorRange.bind(core));
7678
7727
 
7679
7728
  core.submenuOff();
7680
7729
  core.controllersOff();
@@ -8134,10 +8183,9 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
8134
8183
  context.element.lineBreaker_t.addEventListener('mousedown', event._lineBreakerBind.t, false);
8135
8184
  context.element.lineBreaker_b.addEventListener('mousedown', event._lineBreakerBind.b, false);
8136
8185
 
8137
- /** Events are registered only when there is a table plugin. */
8138
- if (core.plugins.table) {
8139
- eventWysiwyg.addEventListener('touchstart', event.onMouseDown_wysiwyg, {passive: true, useCapture: false});
8140
- }
8186
+ /** Events are registered mobile. */
8187
+ eventWysiwyg.addEventListener('touchstart', event.onMouseDown_wysiwyg, {passive: true, useCapture: false});
8188
+ eventWysiwyg.addEventListener('touchend', event.onClick_wysiwyg, {passive: true, useCapture: false});
8141
8189
 
8142
8190
  /** code view area auto line */
8143
8191
  if (options.height === 'auto' && !options.codeMirrorEditor) {
@@ -8194,6 +8242,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
8194
8242
  event._lineBreakerBind = null;
8195
8243
 
8196
8244
  eventWysiwyg.removeEventListener('touchstart', event.onMouseDown_wysiwyg, {passive: true, useCapture: false});
8245
+ eventWysiwyg.removeEventListener('touchend', event.onClick_wysiwyg, {passive: true, useCapture: false});
8197
8246
  eventWysiwyg.removeEventListener('focus', event.onFocus_wysiwyg);
8198
8247
  eventWysiwyg.removeEventListener('blur', event.onBlur_wysiwyg);
8199
8248
 
@@ -1,48 +1,48 @@
1
- import { Core } from "./core";
2
-
3
- export interface History {
4
- /**
5
- * @description History stack
6
- */
7
- stack: any[];
8
- /**
9
- * @description Saving the current status to the history object stack
10
- * If "delay" is true, it will be saved after (options.historyStackDelayTime || 400) miliseconds
11
- * If the function is called again with the "delay" argument true before it is saved, the delay time is renewal
12
- * You can specify the delay time by sending a number.
13
- * @param {Boolean} delay If true, Add stack without delay time.
14
- */
15
- push: (delay: boolean | number) => void;
16
- /**
17
- * @description Undo function
18
- */
19
- undo: () => void;
20
- /**
21
- * @description Redo function
22
- */
23
- redo: () => void;
24
- /**
25
- * @description Go to the history stack for that index.
26
- * If "index" is -1, go to the last stack
27
- * @param {Number} index Stack index
28
- */
29
- go: (index: number) => void;
30
-
31
- /**
32
- * @description Get the current history stack index.
33
- * @returns
34
- */
35
- getCurrentIndex: () => number;
36
-
37
- /**
38
- * @description Reset the history object
39
- */
40
- reset: (ignoreChangeEvent: any) => void;
41
- /**
42
- * @description Remove all stacks and remove the timeout function.
43
- * @private
44
- */
45
- _destroy: () => void;
46
- }
47
-
48
- export default function _default(core: Core, change: any): History;
1
+ import { Core } from "./core";
2
+
3
+ export interface History {
4
+ /**
5
+ * @description History stack
6
+ */
7
+ stack: any[];
8
+ /**
9
+ * @description Saving the current status to the history object stack
10
+ * If "delay" is true, it will be saved after (options.historyStackDelayTime || 400) miliseconds
11
+ * If the function is called again with the "delay" argument true before it is saved, the delay time is renewal
12
+ * You can specify the delay time by sending a number.
13
+ * @param {Boolean} delay If true, Add stack without delay time.
14
+ */
15
+ push: (delay: boolean | number) => void;
16
+ /**
17
+ * @description Undo function
18
+ */
19
+ undo: () => void;
20
+ /**
21
+ * @description Redo function
22
+ */
23
+ redo: () => void;
24
+ /**
25
+ * @description Go to the history stack for that index.
26
+ * If "index" is -1, go to the last stack
27
+ * @param {Number} index Stack index
28
+ */
29
+ go: (index: number) => void;
30
+
31
+ /**
32
+ * @description Get the current history stack index.
33
+ * @returns
34
+ */
35
+ getCurrentIndex: () => number;
36
+
37
+ /**
38
+ * @description Reset the history object
39
+ */
40
+ reset: (ignoreChangeEvent: any) => void;
41
+ /**
42
+ * @description Remove all stacks and remove the timeout function.
43
+ * @private
44
+ */
45
+ _destroy: () => void;
46
+ }
47
+
48
+ export default function _default(core: Core, change: any): History;