jodit 4.12.16 → 4.12.18

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 (60) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +172 -34
  5. package/es2015/jodit.min.js +4 -4
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +4 -4
  13. package/es2018/jodit.min.js +4 -4
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +5 -5
  18. package/es2021/jodit.js +170 -34
  19. package/es2021/jodit.min.js +5 -5
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +6 -6
  28. package/es2021.en/jodit.js +170 -34
  29. package/es2021.en/jodit.min.js +6 -6
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +185 -34
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.js +1 -1
  51. package/esm/core/helpers/utils/config-proto.js +15 -0
  52. package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +8 -1
  53. package/esm/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +21 -0
  54. package/esm/plugins/drag-and-drop-element/drag-and-drop-element.js +48 -3
  55. package/esm/plugins/enter/enter.js +11 -6
  56. package/esm/plugins/select/select.d.ts +14 -0
  57. package/esm/plugins/select/select.js +69 -0
  58. package/package.json +1 -1
  59. package/types/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +21 -0
  60. package/types/plugins/select/select.d.ts +14 -0
package/es2015/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.12.16
4
+ * Version: v4.12.18
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1808,7 +1808,7 @@ __webpack_require__.r(__webpack_exports__);
1808
1808
  * ```
1809
1809
  * @packageDocumentation
1810
1810
  * @module constants
1811
- */ const APP_VERSION = "4.12.16";
1811
+ */ const APP_VERSION = "4.12.18";
1812
1812
  // prettier-ignore
1813
1813
  const ES = "es2015";
1814
1814
  const IS_ES_MODERN = true;
@@ -7661,6 +7661,18 @@ const completeUrl = (url)=>{
7661
7661
 
7662
7662
 
7663
7663
 
7664
+ /**
7665
+ * Keys that must never be copied from a (potentially untrusted) config object —
7666
+ * assigning them during a recursive merge can reach and mutate
7667
+ * `Object.prototype` (prototype pollution, CWE-1321).
7668
+ */ const UNSAFE_PROTO_KEYS = [
7669
+ '__proto__',
7670
+ 'constructor',
7671
+ 'prototype'
7672
+ ];
7673
+ function isUnsafeProtoKey(key) {
7674
+ return UNSAFE_PROTO_KEYS.indexOf(key) !== -1;
7675
+ }
7664
7676
  /**
7665
7677
  * @example
7666
7678
  * ```js
@@ -7709,6 +7721,9 @@ const completeUrl = (url)=>{
7709
7721
  }
7710
7722
  const newOpt = {};
7711
7723
  Object.keys(options).forEach((key)=>{
7724
+ if (isUnsafeProtoKey(key)) {
7725
+ return;
7726
+ }
7712
7727
  const opt = options[key], protoKey = proto ? proto[key] : null;
7713
7728
  if ((0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(opt) && (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(protoKey) && !(0,_extend__WEBPACK_IMPORTED_MODULE_5__.isAtom)(opt)) {
7714
7729
  newOpt[key] = ConfigProto(opt, protoKey, deep + 1);
@@ -7770,6 +7785,9 @@ function ConfigFlatten(obj) {
7770
7785
  * @see {@link ConfigProto} for the prototype-chain variant used at editor creation time
7771
7786
  */ function ConfigMerge(target, source) {
7772
7787
  Object.keys(source).forEach((key)=>{
7788
+ if (isUnsafeProtoKey(key)) {
7789
+ return;
7790
+ }
7773
7791
  const srcVal = source[key];
7774
7792
  const tgtVal = target[key];
7775
7793
  if ((0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(srcVal) && (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(tgtVal) && !(0,_extend__WEBPACK_IMPORTED_MODULE_5__.isAtom)(srcVal)) {
@@ -28194,7 +28212,11 @@ function filterStyleProperties(style, allowed) {
28194
28212
  if (!jodit.o.cleanHTML.removeEmptyElements) {
28195
28213
  return false;
28196
28214
  }
28197
- return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && node.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_INLINE) != null && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTemporary(node) && (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__.trimInv)(node.innerHTML).length === 0 && (current == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, current));
28215
+ // Never drop an empty inline element that currently holds the caret it is
28216
+ // a pending-format marker the user is about to type into (#1291). `current`
28217
+ // is captured before a click moves the caret, so also check the live caret.
28218
+ const liveCaret = jodit.s.isCollapsed() ? jodit.s.range.startContainer : null;
28219
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && node.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_INLINE) != null && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTemporary(node) && (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__.trimInv)(node.innerHTML).length === 0 && (current == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, current)) && (liveCaret == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, liveCaret));
28198
28220
  }
28199
28221
 
28200
28222
 
@@ -29324,11 +29346,33 @@ var DragState = /*#__PURE__*/ function(DragState) {
29324
29346
  */ class dragAndDropElement extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
29325
29347
  /** @override */ afterInit() {
29326
29348
  this.dragList = this.j.o.draggableTags ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.splitArray)(this.j.o.draggableTags).filter(Boolean).map((item)=>item.toLowerCase()) : [];
29349
+ // Allow another plugin (e.g. a drag handle/anchor) to start dragging
29350
+ // an element programmatically, regardless of the `draggableTags` list.
29351
+ this.j.e.on('startDragElement', this.onStartDragElement);
29327
29352
  if (!this.dragList.length) {
29328
29353
  return;
29329
29354
  }
29330
29355
  this.j.e.on('mousedown dragstart', this.onDragStart);
29331
29356
  }
29357
+ /**
29358
+ * Start dragging a specific element programmatically.
29359
+ *
29360
+ * Allows a separate UI element (for example a drag handle/anchor shown next
29361
+ * to a block) to initiate the drag without the user pressing directly on the
29362
+ * draggable element itself.
29363
+ *
29364
+ * @example
29365
+ * ```js
29366
+ * handle.addEventListener('mousedown', e => {
29367
+ * editor.e.fire('startDragElement', preBlock, e);
29368
+ * });
29369
+ * ```
29370
+ */ onStartDragElement(element, event) {
29371
+ if (this.isInDestruct || this.state > 0 || !element) {
29372
+ return;
29373
+ }
29374
+ this.startDragging(element, event);
29375
+ }
29332
29376
  /**
29333
29377
  * Drag start handler
29334
29378
  */ onDragStart(event) {
@@ -29350,11 +29394,18 @@ var DragState = /*#__PURE__*/ function(DragState) {
29350
29394
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(lastTarget.parentElement, 'a') && lastTarget.parentElement.firstChild === lastTarget && lastTarget.parentElement.lastChild === lastTarget) {
29351
29395
  lastTarget = lastTarget.parentElement;
29352
29396
  }
29397
+ this.startDragging(lastTarget, event);
29398
+ }
29399
+ /**
29400
+ * Prepare the ghost element and switch to the waiting state.
29401
+ * Shared by the native mousedown handler and the programmatic
29402
+ * `startDragElement` event handler.
29403
+ */ startDragging(target, event) {
29353
29404
  this.startX = event.clientX;
29354
29405
  this.startY = event.clientY;
29355
29406
  this.isCopyMode = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.ctrlKey)(event); // we can move only element from editor
29356
- this.draggable = lastTarget.cloneNode(true);
29357
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(this.draggable, 'target', lastTarget);
29407
+ this.draggable = target.cloneNode(true);
29408
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(this.draggable, 'target', target);
29358
29409
  this.state = 1;
29359
29410
  this.addDragListeners();
29360
29411
  }
@@ -29424,6 +29475,18 @@ var DragState = /*#__PURE__*/ function(DragState) {
29424
29475
  }
29425
29476
  const { parentElement } = fragment;
29426
29477
  this.j.s.insertNode(fragment, true, false);
29478
+ // Dropping a non-editable block (e.g. a `<pre>` code sample) can leave an
29479
+ // invisible filler text node beside it. Remove it so the drop does not
29480
+ // introduce a stray empty line (which clean-html would otherwise strip
29481
+ // later, causing a flash).
29482
+ [
29483
+ fragment.previousSibling,
29484
+ fragment.nextSibling
29485
+ ].forEach((node)=>{
29486
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isEmptyTextNode(node)) {
29487
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(node);
29488
+ }
29489
+ });
29427
29490
  if (parentElement && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isEmpty(parentElement) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isCell(parentElement)) {
29428
29491
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(parentElement);
29429
29492
  }
@@ -29450,7 +29513,7 @@ var DragState = /*#__PURE__*/ function(DragState) {
29450
29513
  }
29451
29514
  /** @override */ beforeDestruct() {
29452
29515
  this.onDragEnd();
29453
- this.j.e.off('mousedown dragstart', this.onDragStart);
29516
+ this.j.e.off('mousedown dragstart', this.onDragStart).off('startDragElement', this.onStartDragElement);
29454
29517
  this.removeDragListeners();
29455
29518
  }
29456
29519
  constructor(...args){
@@ -29459,6 +29522,9 @@ var DragState = /*#__PURE__*/ function(DragState) {
29459
29522
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "diffStep", 10), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startY", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "state", 0);
29460
29523
  }
29461
29524
  }
29525
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
29526
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
29527
+ ], dragAndDropElement.prototype, "onStartDragElement", null);
29462
29528
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
29463
29529
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
29464
29530
  ], dragAndDropElement.prototype, "onDragStart", null);
@@ -29960,12 +30026,17 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('dtd', dtd);
29960
30026
  if (beforeEnter !== undefined) {
29961
30027
  return beforeEnter;
29962
30028
  }
29963
- if (!editor.s.isCollapsed()) {
29964
- editor.execCommand('Delete');
29965
- }
29966
- editor.s.focus();
29967
- this.onEnter(event);
29968
- editor.e.fire('afterEnter', event);
30029
+ // Delete-of-selection + new block must be a single history step,
30030
+ // otherwise pressing Enter over a selection needs two Ctrl+Z to undo
30031
+ // (the first only reverts to the intermediate empty state). #1292
30032
+ editor.history.snapshot.transaction(()=>{
30033
+ if (!editor.s.isCollapsed()) {
30034
+ editor.execCommand('Delete');
30035
+ }
30036
+ editor.s.focus();
30037
+ this.onEnter(event);
30038
+ editor.e.fire('afterEnter', event);
30039
+ });
29969
30040
  editor.synchronizeValues(); // fire change
29970
30041
  return false;
29971
30042
  }
@@ -39523,13 +39594,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39523
39594
  /* unused harmony export select */
39524
39595
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
39525
39596
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
39526
- /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
39527
- /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
39528
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
39529
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(57821);
39530
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
39531
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4099);
39532
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(47670);
39597
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
39598
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
39599
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
39600
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
39601
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
39602
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
39603
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
39604
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47670);
39533
39605
  /*!
39534
39606
  * Jodit Editor (https://xdsoft.net/jodit/)
39535
39607
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -39547,6 +39619,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39547
39619
 
39548
39620
 
39549
39621
 
39622
+
39550
39623
  /**
39551
39624
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
39552
39625
  *
@@ -39557,7 +39630,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39557
39630
  * console.log(img.src);
39558
39631
  * })
39559
39632
  * ```
39560
- */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
39633
+ */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
39561
39634
  afterInit(jodit) {
39562
39635
  this.proxyEventsList.forEach((eventName)=>{
39563
39636
  jodit.e.on(eventName + '.select', this.onStartSelection);
@@ -39572,7 +39645,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39572
39645
  const { j } = this;
39573
39646
  let result, target = e.target;
39574
39647
  while(result === undefined && target && target !== j.editor){
39575
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_5__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
39648
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
39576
39649
  target = target.parentElement;
39577
39650
  }
39578
39651
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -39583,10 +39656,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39583
39656
  * @event outsideClick(e) - when user clicked on the outside of editor
39584
39657
  */ onOutsideClick(e) {
39585
39658
  const node = e.target;
39586
- if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.up(node, (elm)=>elm === this.j.editor)) {
39659
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(node, (elm)=>elm === this.j.editor)) {
39587
39660
  return;
39588
39661
  }
39589
- const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_7__.Popup);
39662
+ const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
39590
39663
  if (!box) {
39591
39664
  this.j.e.fire('outsideClick', e);
39592
39665
  }
@@ -39595,7 +39668,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39595
39668
  const { s } = this.j;
39596
39669
  if (!s.isCollapsed()) {
39597
39670
  const current = s.current();
39598
- if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(this.j.editor, current)) {
39671
+ if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, current)) {
39599
39672
  this.onCopyNormalizeSelectionBound();
39600
39673
  }
39601
39674
  }
@@ -39607,6 +39680,61 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39607
39680
  s.expandSelection();
39608
39681
  return false;
39609
39682
  }
39683
+ /**
39684
+ * Fix caret position when clicking to the right of a list item that has a
39685
+ * nested list. Blink/WebKit place the caret at the start of the line instead
39686
+ * of the end (#1296); move it to the end of the item's own text.
39687
+ */ onClickRightOfNestedListItem(e) {
39688
+ const { s } = this.j;
39689
+ const range = s.range;
39690
+ if (!range.collapsed || range.startOffset !== 0 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(range.startContainer)) {
39691
+ return;
39692
+ }
39693
+ const text = range.startContainer;
39694
+ const li = text.parentNode;
39695
+ // The text must be the direct content of a list item that has a nested
39696
+ // list (the last level has no nested list and behaves correctly).
39697
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(li, 'li') || !(li.querySelector('ul') || li.querySelector('ol'))) {
39698
+ return;
39699
+ }
39700
+ const measure = this.j.ed.createRange();
39701
+ measure.selectNodeContents(text);
39702
+ const rect = measure.getBoundingClientRect();
39703
+ // Only when the click happened to the right of the text.
39704
+ if (e.clientX > rect.right) {
39705
+ s.setCursorAfter(text);
39706
+ }
39707
+ }
39708
+ /**
39709
+ * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
39710
+ * a collapsed cursor leaves empty marker elements with the caret inside; a
39711
+ * click puts the caret right before them (outside), so they get cleaned up
39712
+ * and the formatting is lost. Move the caret back into the innermost marker
39713
+ * so the next typed character keeps every pending format (#1291).
39714
+ */ onClickKeepPendingFormat() {
39715
+ var _ref;
39716
+ var _text_nodeValue;
39717
+ const { s } = this.j;
39718
+ const range = s.range;
39719
+ if (!range.collapsed || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(range.startContainer)) {
39720
+ return;
39721
+ }
39722
+ const text = range.startContainer;
39723
+ // Caret must sit at the very end of the text, right before the markers.
39724
+ if (range.startOffset !== ((_ref = (_text_nodeValue = text.nodeValue) === null || _text_nodeValue === void 0 ? void 0 : _text_nodeValue.length) !== null && _ref !== void 0 ? _ref : 0)) {
39725
+ return;
39726
+ }
39727
+ const marker = text.nextSibling;
39728
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(marker) || !marker.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_INLINE) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmpty(marker)) {
39729
+ return;
39730
+ }
39731
+ let inner = marker;
39732
+ // Descend into the innermost empty formatting marker.
39733
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(inner.firstElementChild) && inner.firstElementChild.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_INLINE)){
39734
+ inner = inner.firstElementChild;
39735
+ }
39736
+ s.setCursorIn(inner);
39737
+ }
39610
39738
  /**
39611
39739
  * Normalize selection after triple click
39612
39740
  */ onTripleClickNormalizeSelection(e) {
@@ -39615,8 +39743,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39615
39743
  }
39616
39744
  const { s } = this.j;
39617
39745
  const { startContainer, startOffset } = s.range;
39618
- if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(startContainer)) {
39619
- s.select(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(startContainer, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isBlock, this.j.editor) || startContainer, true);
39746
+ if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(startContainer)) {
39747
+ s.select(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(startContainer, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock, this.j.editor) || startContainer, true);
39620
39748
  }
39621
39749
  }
39622
39750
  onCopyNormalizeSelectionBound(e) {
@@ -39624,7 +39752,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39624
39752
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
39625
39753
  return;
39626
39754
  }
39627
- if (e && (!e.isTrusted || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isNode(e.target) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(editor, e.target))) {
39755
+ if (e && (!e.isTrusted || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isNode(e.target) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(editor, e.target))) {
39628
39756
  return;
39629
39757
  }
39630
39758
  this.jodit.s.expandSelection();
@@ -39640,33 +39768,43 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39640
39768
  }
39641
39769
  }
39642
39770
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39643
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
39771
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
39644
39772
  ], select.prototype, "onStartSelection", null);
39645
39773
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39646
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('ow:click')
39774
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)('ow:click')
39647
39775
  ], select.prototype, "onOutsideClick", null);
39648
39776
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39649
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
39777
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39650
39778
  ':beforeCommandCut'
39651
39779
  ])
39652
39780
  ], select.prototype, "beforeCommandCut", null);
39653
39781
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39654
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
39782
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39655
39783
  ':beforeCommandSelectall'
39656
39784
  ])
39657
39785
  ], select.prototype, "beforeCommandSelectAll", null);
39658
39786
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39659
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
39787
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39788
+ ':click'
39789
+ ])
39790
+ ], select.prototype, "onClickRightOfNestedListItem", null);
39791
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39792
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39793
+ ':click'
39794
+ ])
39795
+ ], select.prototype, "onClickKeepPendingFormat", null);
39796
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39797
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39660
39798
  ':click'
39661
39799
  ])
39662
39800
  ], select.prototype, "onTripleClickNormalizeSelection", null);
39663
39801
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39664
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
39802
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39665
39803
  ':copy',
39666
39804
  ':cut'
39667
39805
  ])
39668
39806
  ], select.prototype, "onCopyNormalizeSelectionBound", null);
39669
- jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('select', select);
39807
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('select', select);
39670
39808
 
39671
39809
 
39672
39810
  /***/ }),