jodit 4.12.17 → 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 +16 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +145 -37
  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 +143 -37
  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 +143 -37
  29. package/es2021.en/jodit.min.js +5 -5
  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 +155 -37
  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 +8 -0
  57. package/esm/plugins/select/select.js +37 -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 +8 -0
package/es2021/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.17
4
+ * Version: v4.12.18
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1802,7 +1802,7 @@ __webpack_require__.r(__webpack_exports__);
1802
1802
  * ```
1803
1803
  * @packageDocumentation
1804
1804
  * @module constants
1805
- */ const APP_VERSION = "4.12.17";
1805
+ */ const APP_VERSION = "4.12.18";
1806
1806
  // prettier-ignore
1807
1807
  const ES = "es2021";
1808
1808
  const IS_ES_MODERN = true;
@@ -7635,6 +7635,18 @@ const completeUrl = (url)=>{
7635
7635
 
7636
7636
 
7637
7637
 
7638
+ /**
7639
+ * Keys that must never be copied from a (potentially untrusted) config object —
7640
+ * assigning them during a recursive merge can reach and mutate
7641
+ * `Object.prototype` (prototype pollution, CWE-1321).
7642
+ */ const UNSAFE_PROTO_KEYS = [
7643
+ '__proto__',
7644
+ 'constructor',
7645
+ 'prototype'
7646
+ ];
7647
+ function isUnsafeProtoKey(key) {
7648
+ return UNSAFE_PROTO_KEYS.indexOf(key) !== -1;
7649
+ }
7638
7650
  /**
7639
7651
  * @example
7640
7652
  * ```js
@@ -7683,6 +7695,9 @@ const completeUrl = (url)=>{
7683
7695
  }
7684
7696
  const newOpt = {};
7685
7697
  Object.keys(options).forEach((key)=>{
7698
+ if (isUnsafeProtoKey(key)) {
7699
+ return;
7700
+ }
7686
7701
  const opt = options[key], protoKey = proto ? proto[key] : null;
7687
7702
  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)) {
7688
7703
  newOpt[key] = ConfigProto(opt, protoKey, deep + 1);
@@ -7744,6 +7759,9 @@ function ConfigFlatten(obj) {
7744
7759
  * @see {@link ConfigProto} for the prototype-chain variant used at editor creation time
7745
7760
  */ function ConfigMerge(target, source) {
7746
7761
  Object.keys(source).forEach((key)=>{
7762
+ if (isUnsafeProtoKey(key)) {
7763
+ return;
7764
+ }
7747
7765
  const srcVal = source[key];
7748
7766
  const tgtVal = target[key];
7749
7767
  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)) {
@@ -28001,7 +28019,11 @@ function filterStyleProperties(style, allowed) {
28001
28019
  if (!jodit.o.cleanHTML.removeEmptyElements) {
28002
28020
  return false;
28003
28021
  }
28004
- 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));
28022
+ // Never drop an empty inline element that currently holds the caret it is
28023
+ // a pending-format marker the user is about to type into (#1291). `current`
28024
+ // is captured before a click moves the caret, so also check the live caret.
28025
+ const liveCaret = jodit.s.isCollapsed() ? jodit.s.range.startContainer : null;
28026
+ 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));
28005
28027
  }
28006
28028
 
28007
28029
 
@@ -29127,11 +29149,33 @@ var DragState = /*#__PURE__*/ function(DragState) {
29127
29149
  */ class dragAndDropElement extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
29128
29150
  /** @override */ afterInit() {
29129
29151
  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()) : [];
29152
+ // Allow another plugin (e.g. a drag handle/anchor) to start dragging
29153
+ // an element programmatically, regardless of the `draggableTags` list.
29154
+ this.j.e.on('startDragElement', this.onStartDragElement);
29130
29155
  if (!this.dragList.length) {
29131
29156
  return;
29132
29157
  }
29133
29158
  this.j.e.on('mousedown dragstart', this.onDragStart);
29134
29159
  }
29160
+ /**
29161
+ * Start dragging a specific element programmatically.
29162
+ *
29163
+ * Allows a separate UI element (for example a drag handle/anchor shown next
29164
+ * to a block) to initiate the drag without the user pressing directly on the
29165
+ * draggable element itself.
29166
+ *
29167
+ * @example
29168
+ * ```js
29169
+ * handle.addEventListener('mousedown', e => {
29170
+ * editor.e.fire('startDragElement', preBlock, e);
29171
+ * });
29172
+ * ```
29173
+ */ onStartDragElement(element, event) {
29174
+ if (this.isInDestruct || this.state > 0 || !element) {
29175
+ return;
29176
+ }
29177
+ this.startDragging(element, event);
29178
+ }
29135
29179
  /**
29136
29180
  * Drag start handler
29137
29181
  */ onDragStart(event) {
@@ -29153,11 +29197,18 @@ var DragState = /*#__PURE__*/ function(DragState) {
29153
29197
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(lastTarget.parentElement, 'a') && lastTarget.parentElement.firstChild === lastTarget && lastTarget.parentElement.lastChild === lastTarget) {
29154
29198
  lastTarget = lastTarget.parentElement;
29155
29199
  }
29200
+ this.startDragging(lastTarget, event);
29201
+ }
29202
+ /**
29203
+ * Prepare the ghost element and switch to the waiting state.
29204
+ * Shared by the native mousedown handler and the programmatic
29205
+ * `startDragElement` event handler.
29206
+ */ startDragging(target, event) {
29156
29207
  this.startX = event.clientX;
29157
29208
  this.startY = event.clientY;
29158
29209
  this.isCopyMode = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.ctrlKey)(event); // we can move only element from editor
29159
- this.draggable = lastTarget.cloneNode(true);
29160
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(this.draggable, 'target', lastTarget);
29210
+ this.draggable = target.cloneNode(true);
29211
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(this.draggable, 'target', target);
29161
29212
  this.state = 1;
29162
29213
  this.addDragListeners();
29163
29214
  }
@@ -29226,6 +29277,18 @@ var DragState = /*#__PURE__*/ function(DragState) {
29226
29277
  }
29227
29278
  const { parentElement } = fragment;
29228
29279
  this.j.s.insertNode(fragment, true, false);
29280
+ // Dropping a non-editable block (e.g. a `<pre>` code sample) can leave an
29281
+ // invisible filler text node beside it. Remove it so the drop does not
29282
+ // introduce a stray empty line (which clean-html would otherwise strip
29283
+ // later, causing a flash).
29284
+ [
29285
+ fragment.previousSibling,
29286
+ fragment.nextSibling
29287
+ ].forEach((node)=>{
29288
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isEmptyTextNode(node)) {
29289
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(node);
29290
+ }
29291
+ });
29229
29292
  if (parentElement && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isEmpty(parentElement) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isCell(parentElement)) {
29230
29293
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(parentElement);
29231
29294
  }
@@ -29252,7 +29315,7 @@ var DragState = /*#__PURE__*/ function(DragState) {
29252
29315
  }
29253
29316
  /** @override */ beforeDestruct() {
29254
29317
  this.onDragEnd();
29255
- this.j.e.off('mousedown dragstart', this.onDragStart);
29318
+ this.j.e.off('mousedown dragstart', this.onDragStart).off('startDragElement', this.onStartDragElement);
29256
29319
  this.removeDragListeners();
29257
29320
  }
29258
29321
  constructor(...args){
@@ -29261,6 +29324,9 @@ var DragState = /*#__PURE__*/ function(DragState) {
29261
29324
  */ (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);
29262
29325
  }
29263
29326
  }
29327
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
29328
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
29329
+ ], dragAndDropElement.prototype, "onStartDragElement", null);
29264
29330
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
29265
29331
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
29266
29332
  ], dragAndDropElement.prototype, "onDragStart", null);
@@ -29760,12 +29826,17 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('dtd', dtd);
29760
29826
  if (beforeEnter !== undefined) {
29761
29827
  return beforeEnter;
29762
29828
  }
29763
- if (!editor.s.isCollapsed()) {
29764
- editor.execCommand('Delete');
29765
- }
29766
- editor.s.focus();
29767
- this.onEnter(event);
29768
- editor.e.fire('afterEnter', event);
29829
+ // Delete-of-selection + new block must be a single history step,
29830
+ // otherwise pressing Enter over a selection needs two Ctrl+Z to undo
29831
+ // (the first only reverts to the intermediate empty state). #1292
29832
+ editor.history.snapshot.transaction(()=>{
29833
+ if (!editor.s.isCollapsed()) {
29834
+ editor.execCommand('Delete');
29835
+ }
29836
+ editor.s.focus();
29837
+ this.onEnter(event);
29838
+ editor.e.fire('afterEnter', event);
29839
+ });
29769
29840
  editor.synchronizeValues(); // fire change
29770
29841
  return false;
29771
29842
  }
@@ -39236,13 +39307,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39236
39307
  /* unused harmony export select */
39237
39308
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
39238
39309
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
39239
- /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
39240
- /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
39241
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
39242
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(57821);
39243
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
39244
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4099);
39245
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(47670);
39310
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
39311
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
39312
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
39313
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
39314
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
39315
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
39316
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
39317
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47670);
39246
39318
  /*!
39247
39319
  * Jodit Editor (https://xdsoft.net/jodit/)
39248
39320
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -39260,6 +39332,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39260
39332
 
39261
39333
 
39262
39334
 
39335
+
39263
39336
  /**
39264
39337
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
39265
39338
  *
@@ -39270,7 +39343,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39270
39343
  * console.log(img.src);
39271
39344
  * })
39272
39345
  * ```
39273
- */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
39346
+ */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
39274
39347
  afterInit(jodit) {
39275
39348
  this.proxyEventsList.forEach((eventName)=>{
39276
39349
  jodit.e.on(eventName + '.select', this.onStartSelection);
@@ -39285,7 +39358,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39285
39358
  const { j } = this;
39286
39359
  let result, target = e.target;
39287
39360
  while(result === undefined && target && target !== j.editor){
39288
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_5__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
39361
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
39289
39362
  target = target.parentElement;
39290
39363
  }
39291
39364
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -39296,10 +39369,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39296
39369
  * @event outsideClick(e) - when user clicked on the outside of editor
39297
39370
  */ onOutsideClick(e) {
39298
39371
  const node = e.target;
39299
- if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.up(node, (elm)=>elm === this.j.editor)) {
39372
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(node, (elm)=>elm === this.j.editor)) {
39300
39373
  return;
39301
39374
  }
39302
- const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_7__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_7__.Popup);
39375
+ const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
39303
39376
  if (!box) {
39304
39377
  this.j.e.fire('outsideClick', e);
39305
39378
  }
@@ -39308,7 +39381,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39308
39381
  const { s } = this.j;
39309
39382
  if (!s.isCollapsed()) {
39310
39383
  const current = s.current();
39311
- if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(this.j.editor, current)) {
39384
+ if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, current)) {
39312
39385
  this.onCopyNormalizeSelectionBound();
39313
39386
  }
39314
39387
  }
@@ -39327,14 +39400,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39327
39400
  */ onClickRightOfNestedListItem(e) {
39328
39401
  const { s } = this.j;
39329
39402
  const range = s.range;
39330
- if (!range.collapsed || range.startOffset !== 0 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(range.startContainer)) {
39403
+ if (!range.collapsed || range.startOffset !== 0 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(range.startContainer)) {
39331
39404
  return;
39332
39405
  }
39333
39406
  const text = range.startContainer;
39334
39407
  const li = text.parentNode;
39335
39408
  // The text must be the direct content of a list item that has a nested
39336
39409
  // list (the last level has no nested list and behaves correctly).
39337
- if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(li, 'li') || !(li.querySelector('ul') || li.querySelector('ol'))) {
39410
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(li, 'li') || !(li.querySelector('ul') || li.querySelector('ol'))) {
39338
39411
  return;
39339
39412
  }
39340
39413
  const measure = this.j.ed.createRange();
@@ -39345,6 +39418,34 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39345
39418
  s.setCursorAfter(text);
39346
39419
  }
39347
39420
  }
39421
+ /**
39422
+ * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
39423
+ * a collapsed cursor leaves empty marker elements with the caret inside; a
39424
+ * click puts the caret right before them (outside), so they get cleaned up
39425
+ * and the formatting is lost. Move the caret back into the innermost marker
39426
+ * so the next typed character keeps every pending format (#1291).
39427
+ */ onClickKeepPendingFormat() {
39428
+ const { s } = this.j;
39429
+ const range = s.range;
39430
+ if (!range.collapsed || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(range.startContainer)) {
39431
+ return;
39432
+ }
39433
+ const text = range.startContainer;
39434
+ // Caret must sit at the very end of the text, right before the markers.
39435
+ if (range.startOffset !== (text.nodeValue?.length ?? 0)) {
39436
+ return;
39437
+ }
39438
+ const marker = text.nextSibling;
39439
+ 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)) {
39440
+ return;
39441
+ }
39442
+ let inner = marker;
39443
+ // Descend into the innermost empty formatting marker.
39444
+ 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)){
39445
+ inner = inner.firstElementChild;
39446
+ }
39447
+ s.setCursorIn(inner);
39448
+ }
39348
39449
  /**
39349
39450
  * Normalize selection after triple click
39350
39451
  */ onTripleClickNormalizeSelection(e) {
@@ -39353,8 +39454,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39353
39454
  }
39354
39455
  const { s } = this.j;
39355
39456
  const { startContainer, startOffset } = s.range;
39356
- if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(startContainer)) {
39357
- 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);
39457
+ if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(startContainer)) {
39458
+ 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);
39358
39459
  }
39359
39460
  }
39360
39461
  onCopyNormalizeSelectionBound(e) {
@@ -39362,7 +39463,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39362
39463
  if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
39363
39464
  return;
39364
39465
  }
39365
- 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))) {
39466
+ 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))) {
39366
39467
  return;
39367
39468
  }
39368
39469
  this.jodit.s.expandSelection();
@@ -39378,38 +39479,43 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
39378
39479
  }
39379
39480
  }
39380
39481
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39381
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
39482
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
39382
39483
  ], select.prototype, "onStartSelection", null);
39383
39484
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39384
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)('ow:click')
39485
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)('ow:click')
39385
39486
  ], select.prototype, "onOutsideClick", null);
39386
39487
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39387
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
39488
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39388
39489
  ':beforeCommandCut'
39389
39490
  ])
39390
39491
  ], select.prototype, "beforeCommandCut", null);
39391
39492
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39392
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
39493
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39393
39494
  ':beforeCommandSelectall'
39394
39495
  ])
39395
39496
  ], select.prototype, "beforeCommandSelectAll", null);
39396
39497
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39397
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
39498
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39398
39499
  ':click'
39399
39500
  ])
39400
39501
  ], select.prototype, "onClickRightOfNestedListItem", null);
39401
39502
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39402
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
39503
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39504
+ ':click'
39505
+ ])
39506
+ ], select.prototype, "onClickKeepPendingFormat", null);
39507
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39508
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39403
39509
  ':click'
39404
39510
  ])
39405
39511
  ], select.prototype, "onTripleClickNormalizeSelection", null);
39406
39512
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
39407
- (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
39513
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
39408
39514
  ':copy',
39409
39515
  ':cut'
39410
39516
  ])
39411
39517
  ], select.prototype, "onCopyNormalizeSelectionBound", null);
39412
- jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('select', select);
39518
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('select', select);
39413
39519
 
39414
39520
 
39415
39521
  /***/ }),