jodit 4.20.1 → 4.20.3

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 (85) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/es2015/jodit.css +68 -9
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +10 -10
  5. package/es2015/jodit.js +309 -72
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +7 -7
  8. package/es2015/plugins/debug/debug.css +1 -1
  9. package/es2015/plugins/debug/debug.js +1 -1
  10. package/es2015/plugins/debug/debug.min.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +10 -10
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +7 -7
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +68 -9
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +11 -11
  23. package/es2021/jodit.js +302 -72
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +7 -7
  26. package/es2021/plugins/debug/debug.css +1 -1
  27. package/es2021/plugins/debug/debug.js +1 -1
  28. package/es2021/plugins/debug/debug.min.js +1 -1
  29. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  32. package/es2021.en/jodit.css +68 -9
  33. package/es2021.en/jodit.fat.min.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +19 -19
  35. package/es2021.en/jodit.js +302 -72
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +19 -19
  38. package/es2021.en/plugins/debug/debug.css +1 -1
  39. package/es2021.en/plugins/debug/debug.js +1 -1
  40. package/es2021.en/plugins/debug/debug.min.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  44. package/es5/jodit.css +45 -2
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +358 -74
  48. package/es5/jodit.min.css +3 -3
  49. package/es5/jodit.min.js +2 -2
  50. package/es5/plugins/debug/debug.css +1 -1
  51. package/es5/plugins/debug/debug.js +1 -1
  52. package/es5/plugins/debug/debug.min.js +1 -1
  53. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  56. package/es5/polyfills.fat.min.js +1 -1
  57. package/es5/polyfills.js +1 -1
  58. package/es5/polyfills.min.js +1 -1
  59. package/esm/core/constants.js +1 -1
  60. package/esm/modules/file-browser/builders/context-menu.js +6 -2
  61. package/esm/modules/toolbar/button/button.d.ts +10 -0
  62. package/esm/modules/toolbar/button/button.js +17 -2
  63. package/esm/modules/toolbar/button/select/select.d.ts +6 -0
  64. package/esm/modules/toolbar/button/select/select.js +18 -0
  65. package/esm/modules/toolbar/factory.js +3 -1
  66. package/esm/modules/widget/color-picker/color-picker.js +76 -18
  67. package/esm/plugins/anchor/anchor.d.ts +11 -0
  68. package/esm/plugins/anchor/anchor.js +84 -8
  69. package/esm/plugins/backspace/cases/check-not-collapsed.js +1 -1
  70. package/esm/plugins/delete/delete.d.ts +12 -0
  71. package/esm/plugins/delete/delete.js +66 -4
  72. package/esm/plugins/delete/interface.d.ts +4 -2
  73. package/esm/plugins/dtd/after-insert/remove-extra-br.js +7 -1
  74. package/esm/plugins/fullsize/config.js +2 -0
  75. package/esm/plugins/hr/hr.js +0 -1
  76. package/esm/plugins/line-height/config.js +0 -1
  77. package/esm/plugins/placeholder/placeholder.js +3 -1
  78. package/esm/types/toolbar.d.ts +2 -0
  79. package/package.json +1 -1
  80. package/types/modules/toolbar/button/button.d.ts +10 -0
  81. package/types/modules/toolbar/button/select/select.d.ts +6 -0
  82. package/types/plugins/anchor/anchor.d.ts +11 -0
  83. package/types/plugins/delete/delete.d.ts +12 -0
  84. package/types/plugins/delete/interface.d.ts +4 -2
  85. package/types/types/toolbar.d.ts +2 -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.20.1
4
+ * Version: v4.20.3
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1830,7 +1830,7 @@ __webpack_require__.r(__webpack_exports__);
1830
1830
  * ```
1831
1831
  * @packageDocumentation
1832
1832
  * @module constants
1833
- */ const APP_VERSION = "4.20.1";
1833
+ */ const APP_VERSION = "4.20.3";
1834
1834
  // prettier-ignore
1835
1835
  const ES = "es2015";
1836
1836
  const IS_ES_MODERN = true;
@@ -21704,12 +21704,13 @@ const CLASS_PREVIEW = 'jodit-file-browser-preview', preview_tpl_next = (next = '
21704
21704
  }), temp_content = self.c.div(CLASS_PREVIEW, '<div class="jodit-icon_loader"></div>'), preview_box = self.c.div(CLASS_PREVIEW + '__box'), next = self.c.fromHTML(preview_tpl_next()), prev = self.c.fromHTML(preview_tpl_next('prev', 'left')), addLoadHandler = (src)=>{
21705
21705
  const image = self.c.element('img');
21706
21706
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src', src);
21707
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'alt', ga('data-name'));
21707
21708
  const onload = ()=>{
21708
21709
  var _self_events;
21709
21710
  if (self.isInDestruct) {
21710
21711
  return;
21711
21712
  }
21712
- self.e.off(image, 'load');
21713
+ self.e.off(image, 'load error');
21713
21714
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(temp_content);
21714
21715
  if (opt.showPreviewNavigation) {
21715
21716
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.prevWithClass(item, self.files.getFullElName('item'))) {
@@ -21724,7 +21725,10 @@ const CLASS_PREVIEW = 'jodit-file-browser-preview', preview_tpl_next = (next = '
21724
21725
  preview.setPosition();
21725
21726
  self === null || self === void 0 ? void 0 : (_self_events = self.events) === null || _self_events === void 0 ? void 0 : _self_events.fire('previewOpenedAndLoaded');
21726
21727
  };
21727
- self.e.on(image, 'load', onload);
21728
+ // An image that can't load is shown too,
21729
+ // broken with the file's name, rather
21730
+ // than the loader for good
21731
+ self.e.on(image, 'load error', onload);
21728
21732
  if (image.complete) {
21729
21733
  onload();
21730
21734
  }
@@ -26358,9 +26362,20 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_22__.U
26358
26362
  }
26359
26363
  return Boolean(tc && tc.shouldBeDisabled(this));
26360
26364
  }
26361
- onChangeActivated() {
26362
- ;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_20__.attr)(this.button, 'aria-pressed', this.state.activated);
26363
- super.onChangeActivated();
26365
+ /**
26366
+ * A button that its control can show as on is a toggle, and says whether
26367
+ * it's pressed
26368
+ */ get isToggle() {
26369
+ const { isActive, tags, css } = this.control;
26370
+ return Boolean(isActive || tags || css);
26371
+ }
26372
+ /**
26373
+ * The pressed look comes from the mod, as any button looks pressed while
26374
+ * its list is open, and the container is a `listitem`, which can't have
26375
+ * `aria-pressed`
26376
+ */ onChangeActivated() {
26377
+ ;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_20__.attr)(this.button, 'aria-pressed', this.isToggle ? this.state.activated : null);
26378
+ this.setMod('activated', this.state.activated || null);
26364
26379
  }
26365
26380
  onChangeText() {
26366
26381
  if ((0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_13__.isFunction)(this.control.template)) {
@@ -26421,6 +26436,8 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_22__.U
26421
26436
  state.tooltip = (0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_13__.isFunction)(ctr.tooltip) ? ctr.tooltip(this.j, ctr, this) : ctr.tooltip;
26422
26437
  }
26423
26438
  state.hasTrigger = Boolean(ctr.list || ctr.popup && ctr.exec);
26439
+ // UIButton's template makes every button a toggle
26440
+ this.onChangeActivated();
26424
26441
  }
26425
26442
  __initIconFromControl() {
26426
26443
  const { control: ctr, state } = this;
@@ -26991,7 +27008,8 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
26991
27008
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
26992
27009
  /* harmony import */ var jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62101);
26993
27010
  /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85932);
26994
- /* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22533);
27011
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7909);
27012
+ /* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22533);
26995
27013
  /*!
26996
27014
  * Jodit Editor (https://xdsoft.net/jodit/)
26997
27015
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -27004,10 +27022,15 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
27004
27022
 
27005
27023
 
27006
27024
 
27007
- class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
27025
+
27026
+ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton {
27008
27027
  className() {
27009
27028
  return 'ToolbarSelect';
27010
27029
  }
27030
+ // It shows its value, rather than being on or off
27031
+ get isToggle() {
27032
+ return false;
27033
+ }
27011
27034
  update() {
27012
27035
  super.update();
27013
27036
  this.state.icon.name = '';
@@ -27024,6 +27047,18 @@ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
27024
27047
  this.state.text = (_ref = (_this_control_textTemplate = (_this_control = this.control).textTemplate) === null || _this_control_textTemplate === void 0 ? void 0 : _this_control_textTemplate.call(_this_control, this.jodit, text)) !== null && _ref !== void 0 ? _ref : text;
27025
27048
  }
27026
27049
  }
27050
+ /**
27051
+ * The button shows only the value, so its name says which control it
27052
+ * is too: "Font size, 16px"
27053
+ */ updateAriaLabel() {
27054
+ var _this_text_textContent;
27055
+ super.updateAriaLabel();
27056
+ const { tooltip } = this.state;
27057
+ const value = (_this_text_textContent = this.text.textContent) === null || _this_text_textContent === void 0 ? void 0 : _this_text_textContent.trim();
27058
+ if (tooltip && value) {
27059
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__.attr)(this.button, 'aria-label', `${this.jodit.i18n(tooltip)}, ${value}`);
27060
+ }
27061
+ }
27027
27062
  }
27028
27063
  ToolbarSelect = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__._)([
27029
27064
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
@@ -27359,7 +27394,9 @@ ToolbarEditorCollection = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1
27359
27394
  }
27360
27395
  function makeSelect(view, control, target = null) {
27361
27396
  const ToolbarSelect = (0,jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_0__.getComponentClass)('ToolbarSelect');
27362
- return new ToolbarSelect(view, control, target);
27397
+ const select = new ToolbarSelect(view, control, target);
27398
+ select.state.tabIndex = view.o.allowTabNavigation ? 0 : -1;
27399
+ return select;
27363
27400
  }
27364
27401
 
27365
27402
 
@@ -28300,11 +28337,12 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
28300
28337
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
28301
28338
 
28302
28339
  "use strict";
28303
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
28304
- /* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
28305
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
28306
- /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(54522);
28307
- /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_palette_svg__WEBPACK_IMPORTED_MODULE_3__);
28340
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
28341
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
28342
+ /* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65946);
28343
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4099);
28344
+ /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54522);
28345
+ /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_palette_svg__WEBPACK_IMPORTED_MODULE_4__);
28308
28346
  /*!
28309
28347
  * Jodit Editor (https://xdsoft.net/jodit/)
28310
28348
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28318,7 +28356,8 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
28318
28356
 
28319
28357
 
28320
28358
 
28321
- jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_3___default()));
28359
+
28360
+ jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_4___default()));
28322
28361
  /**
28323
28362
  * Build color picker
28324
28363
  *
@@ -28336,29 +28375,54 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
28336
28375
  * });
28337
28376
  * ```
28338
28377
  */ const ColorPickerWidget = (editor, callback, coldColor)=>{
28339
- const cn = 'jodit-color-picker', valueHex = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.normalizeColor)(coldColor), form = editor.c.div(cn), iconPalette = editor.o.textIcons ? `<span>${editor.i18n('palette')}</span>` : jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.get('palette'), eachColor = (colors)=>{
28378
+ var _items_find;
28379
+ const cn = 'jodit-color-picker', valueHex = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.normalizeColor)(coldColor), form = editor.c.div(cn), iconPalette = editor.o.textIcons ? `<span>${editor.i18n('palette')}</span>` : jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__.Icon.get('palette'), eachColor = (colors)=>{
28340
28380
  const stack = [];
28341
- if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(colors)) {
28381
+ if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(colors)) {
28342
28382
  Object.keys(colors).forEach((key)=>{
28343
28383
  stack.push(`<div class="${cn}__group ${cn}__group-${key}">`);
28344
28384
  stack.push(eachColor(colors[key]));
28345
28385
  stack.push('</div>');
28346
28386
  });
28347
- } else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isArray)(colors)) {
28387
+ } else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isArray)(colors)) {
28348
28388
  colors.forEach((color)=>{
28349
- stack.push(`<span class='${cn}__color-item ${valueHex === color ? cn + '__color-item_active_true' : ''}' title="${color}" style="background-color:${color}" data-color="${color}"></span>`);
28389
+ const active = valueHex === color;
28390
+ stack.push(`<button type="button" class='${cn}__color-item ${active ? cn + '__color-item_active_true' : ''}' title="${color}" aria-pressed="${active}" tabindex="-1" style="background-color:${color}" data-color="${color}"></button>`);
28350
28391
  });
28351
28392
  }
28352
28393
  return stack.join('');
28353
28394
  };
28354
28395
  // The group wrapper lays the colors out in rows, so a flat list needs one
28355
28396
  // too. See #1487
28356
- const groups = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isArray)(editor.o.colors) ? `<div class="${cn}__group">${eachColor(editor.o.colors)}</div>` : eachColor(editor.o.colors);
28357
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(form, editor.c.fromHTML(`<div class="${cn}__groups">${groups}</div>`));
28358
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(form, editor.c.fromHTML(`<div data-ref="extra" class="${cn}__extra"></div>`));
28359
- const { extra } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.refs)(form);
28360
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(extra, editor.c.fromHTML(`<div class="${cn}__hex"><input data-ref="hexInput" type="text" spellcheck="false" aria-label="HEX" placeholder="#FF0000" value="${valueHex || ''}"/></div>`));
28361
- const { hexInput } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.refs)(form);
28397
+ const groups = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isArray)(editor.o.colors) ? `<div class="${cn}__group">${eachColor(editor.o.colors)}</div>` : eachColor(editor.o.colors);
28398
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div class="${cn}__groups">${groups}</div>`));
28399
+ const items = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.toArray)(form.querySelectorAll(`.${cn}__color-item`));
28400
+ // Tab stops at one color, the current one or the first, and the arrow
28401
+ // keys move from it
28402
+ const tabStop = (_items_find = items.find((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'aria-pressed') === 'true')) !== null && _items_find !== void 0 ? _items_find : items[0];
28403
+ if (tabStop) {
28404
+ (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(tabStop, 'tabindex', 0);
28405
+ }
28406
+ // Along a row, or to the nearest color in the row above or below, as the
28407
+ // palette is laid out
28408
+ const nextItem = (item, key)=>{
28409
+ const index = items.indexOf(item);
28410
+ if (key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT || key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT) {
28411
+ const step = key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT ? -1 : 1;
28412
+ const rtl = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.css)(item, 'direction') === 'rtl';
28413
+ return items[index + (rtl ? -step : step)];
28414
+ }
28415
+ const down = key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_DOWN, rows = items.filter((other)=>down ? other.offsetTop > item.offsetTop : other.offsetTop < item.offsetTop);
28416
+ if (!rows.length) {
28417
+ return;
28418
+ }
28419
+ const top = (down ? Math.min : Math.max)(...rows.map((other)=>other.offsetTop)), distance = (other)=>Math.abs(other.offsetLeft - item.offsetLeft);
28420
+ return rows.filter((other)=>other.offsetTop === top).reduce((nearest, other)=>distance(other) < distance(nearest) ? other : nearest);
28421
+ };
28422
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div data-ref="extra" class="${cn}__extra"></div>`));
28423
+ const { extra } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
28424
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(extra, editor.c.fromHTML(`<div class="${cn}__hex"><input data-ref="hexInput" type="text" spellcheck="false" aria-label="HEX" placeholder="#FF0000" value="${valueHex || ''}"/></div>`));
28425
+ const { hexInput } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
28362
28426
  // Enter applies the value and closes the popup; removing the focused
28363
28427
  // input then makes Chrome fire `change` on it, which would apply the
28364
28428
  // same color a second time and toggle it off again. See #1459
@@ -28373,8 +28437,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
28373
28437
  if (!isHex && !isRgb) {
28374
28438
  return;
28375
28439
  }
28376
- const color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.normalizeColor)(isHex && !raw.startsWith('#') ? '#' + raw : raw);
28377
- if (color && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isFunction)(callback)) {
28440
+ const color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.normalizeColor)(isHex && !raw.startsWith('#') ? '#' + raw : raw);
28441
+ if (color && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
28378
28442
  appliedHexValue = raw;
28379
28443
  callback(color);
28380
28444
  }
@@ -28389,40 +28453,75 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
28389
28453
  e.stopPropagation();
28390
28454
  applyHexInput();
28391
28455
  });
28392
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(extra, editor.c.fromHTML(`<span class="${cn}__remove" data-color="" title="${editor.i18n('Remove')}">${editor.o.textIcons ? editor.i18n('Remove') : jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.get('eraser')}</span>`));
28393
- if (editor.o.showBrowserColorPicker && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.hasBrowserColorPicker)()) {
28394
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(extra, editor.c.fromHTML(`<div class="${cn}__native">${iconPalette}<input type="color" value="#ffffff"/></div>`));
28456
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(extra, editor.c.fromHTML(`<button type="button" class="${cn}__remove" data-color="" title="${editor.i18n('Remove')}">${editor.o.textIcons ? editor.i18n('Remove') : jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__.Icon.get('eraser')}</button>`));
28457
+ if (editor.o.showBrowserColorPicker && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.hasBrowserColorPicker)()) {
28458
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(extra, editor.c.fromHTML(`<div class="${cn}__native">${iconPalette}<input type="color" value="#ffffff"/></div>`));
28395
28459
  editor.e.on(form, 'change', (e)=>{
28396
28460
  e.stopPropagation();
28397
28461
  const target = e.target;
28398
- if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(target, 'input') || target.type !== 'color') {
28462
+ if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(target, 'input') || target.type !== 'color') {
28399
28463
  return;
28400
28464
  }
28401
28465
  const color = target.value || '';
28402
- if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isFunction)(callback)) {
28466
+ if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
28403
28467
  callback(color);
28404
28468
  }
28405
28469
  e.preventDefault();
28406
28470
  });
28407
28471
  }
28472
+ // The color of a swatch, or '' for Remove, from an event on it or its icon
28473
+ const colorOf = (node)=>{
28474
+ const button = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(node, (elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isHTMLElement(elm) && (elm.classList.contains(cn + '__color-item') || elm.classList.contains(cn + '__remove')), form);
28475
+ return button ? (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(button, '-color') || '' : undefined;
28476
+ };
28477
+ const apply = (color)=>{
28478
+ if (callback && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
28479
+ callback(color);
28480
+ }
28481
+ };
28482
+ // A pointer applies the color on `mousedown`, which keeps the selection.
28483
+ // The keyboard and screen readers press the button, which sends only
28484
+ // `click`, so a click after the pointer's `mousedown` is skipped
28485
+ let pointerPressed = false;
28408
28486
  editor.e.on(form, 'mousedown touchend', (e)=>{
28409
28487
  // let the hex/native inputs receive focus and clicks
28410
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(e.target, 'input')) {
28488
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(e.target, 'input')) {
28411
28489
  e.stopPropagation();
28412
28490
  return;
28413
28491
  }
28414
28492
  e.stopPropagation();
28415
28493
  e.preventDefault();
28416
- let target = e.target;
28417
- if ((!target || !target.tagName || jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(target, 'svg') || jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(target, 'path')) && target.parentNode) {
28418
- target = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(target.parentNode, 'span', editor.editor);
28494
+ const color = colorOf(e.target);
28495
+ if (color !== undefined) {
28496
+ pointerPressed = e.type === 'mousedown';
28497
+ apply(color);
28419
28498
  }
28420
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(target, 'span') || !target.classList.contains(cn + '__color-item') && !target.classList.contains(cn + '__remove')) {
28499
+ });
28500
+ editor.e.on(form, 'click', (e)=>{
28501
+ const color = colorOf(e.target);
28502
+ if (color !== undefined && !pointerPressed) {
28503
+ apply(color);
28504
+ }
28505
+ pointerPressed = false;
28506
+ }).on(form, 'keydown', (e)=>{
28507
+ var _nextItem;
28508
+ pointerPressed = false;
28509
+ const item = e.target;
28510
+ if (!items.includes(item) || ![
28511
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT,
28512
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT,
28513
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_UP,
28514
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_DOWN
28515
+ ].includes(e.key)) {
28421
28516
  return;
28422
28517
  }
28423
- const color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.attr)(target, '-color') || '';
28424
- if (callback && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isFunction)(callback)) {
28425
- callback(color);
28518
+ // The toolbar's dropdown would walk every color one by one
28519
+ e.preventDefault();
28520
+ e.stopPropagation();
28521
+ (_nextItem = nextItem(item, e.key)) === null || _nextItem === void 0 ? void 0 : _nextItem.focus();
28522
+ }).on(form, 'focusin', (e)=>{
28523
+ if (items.includes(e.target)) {
28524
+ items.forEach((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'tabindex', item === e.target ? 0 : -1));
28426
28525
  }
28427
28526
  });
28428
28527
  editor.e.fire('afterGenerateColorPicker', form, extra, callback, valueHex);
@@ -29639,7 +29738,8 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29639
29738
  /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
29640
29739
  /* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(59400);
29641
29740
  /* harmony import */ var jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(5658);
29642
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(95085);
29741
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(29434);
29742
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(95085);
29643
29743
  /*!
29644
29744
  * Jodit Editor (https://xdsoft.net/jodit/)
29645
29745
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -29659,14 +29759,21 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29659
29759
 
29660
29760
 
29661
29761
 
29662
- const ICON = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e88e5' stroke-width='2.5' stroke-linejoin='round'%3E%3Cpath d='M6 3h12v18l-6-4-6 4z'/%3E%3C/svg%3E\")";
29663
- const MARKER = [
29664
- 'id',
29665
- 'name'
29666
- ].map((key)=>`.jodit-wysiwyg a[${key}]:not([href]):empty::before`).join(',');
29762
+
29667
29763
  /**
29668
- * Each anchor's marker, in the editing area only
29669
- */ const MARKER_STYLE = `${MARKER}{display:inline-block;width:.75em;height:1em;margin:0 .1em;vertical-align:-.15em;background:${ICON} center/contain no-repeat;cursor:pointer;content:''}`;
29764
+ * The editing area of an editor with the plugin, when it shares its document
29765
+ * with the page and so with any other editor on it
29766
+ */ const WITH_ANCHORS = 'jodit-wysiwyg_anchors';
29767
+ /**
29768
+ * Each anchor's marker, in the editing areas `scope` picks out
29769
+ */ function markerStyle(scope) {
29770
+ const marker = [
29771
+ 'id',
29772
+ 'name'
29773
+ ].map((key)=>`.jodit-wysiwyg${scope} a[${key}]:not([href]):empty::before`).join(',');
29774
+ const icon = `url("data:image/svg+xml,${encodeURIComponent(jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__.Icon.get('anchor'))}") center/contain no-repeat`;
29775
+ return `${marker}{display:inline-block;width:.75em;height:1em;margin:0 .1em;vertical-align:-.15em;background-color:var(--jd-color-icon,#4c4c4c);-webkit-mask:${icon};mask:${icon};cursor:pointer;content:''}`;
29776
+ }
29670
29777
  /**
29671
29778
  * The attribute `markAnchor` gives an anchor: an empty `<a>` with no `href`
29672
29779
  */ const MARK = ' contenteditable="false"';
@@ -29675,8 +29782,14 @@ const MARKER = [
29675
29782
  * `#name`, and renames and removes them
29676
29783
  */ class anchor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
29677
29784
  /** @override */ afterInit(jodit) {
29785
+ // An iframe's document is the editor's alone, and its body is part of
29786
+ // the value with `editHTMLDocumentMode`, so it gets no class
29787
+ const shared = jodit.ed === jodit.od;
29788
+ if (shared) {
29789
+ jodit.editor.classList.add(WITH_ANCHORS);
29790
+ }
29678
29791
  // It goes in the editing document, so iframe mode has it whatever `iframeStyle` holds
29679
- (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent = MARKER_STYLE;
29792
+ ;(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent = markerStyle(shared ? '.' + WITH_ANCHORS : '');
29680
29793
  jodit.e.on('generateAnchorForm.anchor', this.__generateForm).on('clickA touchstartA', this.__onClickA, {
29681
29794
  top: true
29682
29795
  });
@@ -29709,6 +29822,24 @@ const MARKER = [
29709
29822
  */ onAfterGetValueFromEditor(data) {
29710
29823
  data.value = unmarkAnchors(data.value);
29711
29824
  }
29825
+ /**
29826
+ * A pasted or dropped copy of an anchor the document already has gets the
29827
+ * next free name, as `fees-2`, and the links that came with it follow it
29828
+ */ onBeforePasteInsert(html) {
29829
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(html) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isFragment(html)) {
29830
+ this.__renameCopies(html);
29831
+ return;
29832
+ }
29833
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) || !/<a\s/i.test(html)) {
29834
+ return;
29835
+ }
29836
+ // Inert, so nothing in it loads
29837
+ const template = this.j.createInside.element('template');
29838
+ template.innerHTML = html;
29839
+ if (this.__renameCopies(template.content)) {
29840
+ return template.innerHTML;
29841
+ }
29842
+ }
29712
29843
  /**
29713
29844
  * The form that names a new anchor, or renames or removes `target`
29714
29845
  */ __generateForm(target, close) {
@@ -29848,8 +29979,52 @@ const MARKER = [
29848
29979
  }
29849
29980
  });
29850
29981
  }
29982
+ /**
29983
+ * Gives each anchor in `root` whose name the document already has the
29984
+ * next free one, avoiding the names in `root` too, and points the links
29985
+ * in `root` to it at the new name. Whether any was renamed
29986
+ */ __renameCopies(root) {
29987
+ const inRoot = new Set((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.toArray)(root.querySelectorAll('[id], a[name]')).map((elm)=>elm.id || (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(elm, 'name')));
29988
+ const renamed = new Map();
29989
+ const anchors = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isAnchor)(root) ? [
29990
+ root
29991
+ ] : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchors)(root);
29992
+ anchors.forEach((anchor)=>{
29993
+ const name = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchorName)(anchor);
29994
+ if (!this.__isTaken(name, null)) {
29995
+ return;
29996
+ }
29997
+ let copy = name;
29998
+ for(let n = 2; inRoot.has(copy) || this.__isTaken(copy, null); n += 1){
29999
+ copy = `${name}-${n}`;
30000
+ }
30001
+ [
30002
+ 'id',
30003
+ 'name'
30004
+ ].forEach((key)=>{
30005
+ if (anchor.hasAttribute(key)) {
30006
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(anchor, key, copy);
30007
+ }
30008
+ });
30009
+ inRoot.add(copy);
30010
+ renamed.set(name, copy);
30011
+ });
30012
+ if (!renamed.size) {
30013
+ return false;
30014
+ }
30015
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.toArray)(root.querySelectorAll('a[href]')).forEach((link)=>{
30016
+ var _attr;
30017
+ const href = (_attr = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href')) !== null && _attr !== void 0 ? _attr : '';
30018
+ const copy = href[0] === '#' && renamed.get(href.slice(1));
30019
+ if (copy) {
30020
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href', '#' + copy);
30021
+ }
30022
+ });
30023
+ return true;
30024
+ }
29851
30025
  /** @override */ beforeDestruct(jodit) {
29852
30026
  this.__dropForm();
30027
+ jodit.editor.classList.remove(WITH_ANCHORS);
29853
30028
  jodit.e.off('generateAnchorForm.anchor', this.__generateForm).off('clickA touchstartA', this.__onClickA);
29854
30029
  }
29855
30030
  constructor(...args){
@@ -29879,6 +30054,9 @@ const MARKER = [
29879
30054
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29880
30055
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':afterGetValueFromEditor')
29881
30056
  ], anchor.prototype, "onAfterGetValueFromEditor", null);
30057
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
30058
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':beforePasteInsert')
30059
+ ], anchor.prototype, "onBeforePasteInsert", null);
29882
30060
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29883
30061
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
29884
30062
  ], anchor.prototype, "__generateForm", null);
@@ -30618,7 +30796,7 @@ function moveContentAndRemoveEmpty(jodit, mainClosestBox, sibling, backspace) {
30618
30796
  * @private
30619
30797
  */ function checkNotCollapsed(jodit) {
30620
30798
  if (!jodit.s.isCollapsed()) {
30621
- jodit.execCommand('Delete');
30799
+ jodit.execCommand('delete', false, true);
30622
30800
  return true;
30623
30801
  }
30624
30802
  return false;
@@ -34061,6 +34239,13 @@ const KEEPS_SPACES = new Set([
34061
34239
  'pre-wrap',
34062
34240
  'break-spaces'
34063
34241
  ]);
34242
+ /**
34243
+ * Formatting that the next letter keeps once all of the text in it is
34244
+ * deleted with a key: a formatting tag, or a span with styles of its own.
34245
+ * Not a link, which new text isn't added to, or a wrapper such as a video's
34246
+ */ function keepsFormat(node) {
34247
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isHTMLElement(node) && !node.hasAttribute('contenteditable') && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTemporary(node) && (/^(STRONG|B|EM|I|U|S|SUB|SUP)$/.test(node.nodeName) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(node, 'span') && node.hasAttribute('style'));
34248
+ }
34064
34249
  /**
34065
34250
  * A plain space beside this neighbor isn't shown: there is none, or it's a
34066
34251
  * line break, a block or text starting (or ending) with a plain space
@@ -34109,7 +34294,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
34109
34294
  jodit.s.removeNode(node);
34110
34295
  }
34111
34296
  }
34112
- __onDeleteCommand() {
34297
+ __onDeleteCommand(command, showUI, keepFormat) {
34113
34298
  const { jodit } = this;
34114
34299
  if (jodit.s.isCollapsed()) {
34115
34300
  return;
@@ -34117,6 +34302,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
34117
34302
  jodit.s.expandSelection();
34118
34303
  const range = jodit.s.range;
34119
34304
  this.__moveEdgesIntoCells(range);
34305
+ const format = keepFormat === true ? this.__formatTakenWhole(range) : [];
34120
34306
  const caret = this.__clearSelectedCells(range);
34121
34307
  if (caret && range.collapsed) {
34122
34308
  jodit.s.selectRange(caret);
@@ -34132,8 +34318,12 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
34132
34318
  this.__keepSpacesVisibleBesideTable(fake);
34133
34319
  range.setStartBefore(fake);
34134
34320
  range.collapse(true);
34135
- this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
34136
- this.__addBrInEmptyBlock(fake, range);
34321
+ if (format.length && !caret) {
34322
+ this.__keepFormat(format, fake, range);
34323
+ } else {
34324
+ this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
34325
+ this.__addBrInEmptyBlock(fake, range);
34326
+ }
34137
34327
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
34138
34328
  jodit.s.selectRange(caret !== null && caret !== void 0 ? caret : range);
34139
34329
  return false;
@@ -34154,6 +34344,48 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
34154
34344
  range.setEnd(last, last.childNodes.length);
34155
34345
  }
34156
34346
  }
34347
+ /**
34348
+ * The formatting elements the deletion takes whole from its start,
34349
+ * outermost first: `<strong>` and `<em>` for all of the text in
34350
+ * `<strong><em>cd</em></strong>`
34351
+ */ __formatTakenWhole(range) {
34352
+ const format = [];
34353
+ const whole = this.jodit.s.createRange();
34354
+ const { startContainer, startOffset } = range;
34355
+ let node = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(startContainer) ? null : startContainer.childNodes[startOffset];
34356
+ // Through a block taken whole, as a line holding only the word is
34357
+ while(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isHTMLElement(node)){
34358
+ whole.selectNode(node);
34359
+ if (range.compareBoundaryPoints(Range.END_TO_END, whole) < 0) {
34360
+ break;
34361
+ }
34362
+ if (keepsFormat(node)) {
34363
+ format.push(node);
34364
+ } else if (format.length || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(node)) {
34365
+ break;
34366
+ }
34367
+ node = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(node.childNodes).find((child)=>{
34368
+ var _child_nodeValue;
34369
+ return !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(child) || (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.trimInv)((_child_nodeValue = child.nodeValue) !== null && _child_nodeValue !== void 0 ? _child_nodeValue : '');
34370
+ });
34371
+ }
34372
+ return format;
34373
+ }
34374
+ /**
34375
+ * As the browsers do, the next letter typed keeps the formatting that was
34376
+ * deleted whole: empty copies go where it was, round an invisible space,
34377
+ * as Bold does at a collapsed caret, and the caret goes inside (#1784)
34378
+ */ __keepFormat(format, fake, range) {
34379
+ const copies = format.map((element)=>element.cloneNode(false));
34380
+ for(let i = 1; i < copies.length; i += 1){
34381
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(copies[i - 1], copies[i]);
34382
+ }
34383
+ const text = this.jodit.createInside.text(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE);
34384
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(copies[copies.length - 1], text);
34385
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.before(fake, copies[0]);
34386
+ range.setStartAfter(text);
34387
+ range.collapse(true);
34388
+ }
34157
34389
  /**
34158
34390
  * A selection that starts or ends in a table cell clears the selected part
34159
34391
  * of each cell it covers and keeps the cells, as the browsers do.
@@ -34903,7 +35135,13 @@ const brBoxes = new Set([
34903
35135
  // text; moving it before the `<br>` would put it on a line of its own
34904
35136
  // below the block (#1315)
34905
35137
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isOrContains(node, jodit.s.range.startContainer)) {
34906
- jodit.s.setCursorBefore(br);
35138
+ // Not with setCursorBefore: the text node it adds for the caret
35139
+ // stays after the inserted element once the `<br>` has gone, and
35140
+ // Right or End then take the caret into it, out of the element
35141
+ const range = jodit.s.createRange();
35142
+ range.setStartBefore(br);
35143
+ range.collapse(true);
35144
+ jodit.s.selectRange(range);
34907
35145
  }
34908
35146
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(br);
34909
35147
  }
@@ -36905,6 +37143,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.fullsize = {
36905
37143
  exec: (editor)=>{
36906
37144
  editor.toggleFullSize();
36907
37145
  },
37146
+ // Makes it a toggle. `update` sets the state, which holds while the editor doesn't have the focus
37147
+ isActive: (editor)=>editor.isFullSize,
36908
37148
  update (editor, button) {
36909
37149
  const mode = editor.isFullSize ? 'shrink' : 'fullsize';
36910
37150
  button.state.activated = editor.isFullSize;
@@ -37275,9 +37515,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('hotkeys', hotke
37275
37515
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__.Icon.set('hr', (_hr_svg__WEBPACK_IMPORTED_MODULE_4___default()));
37276
37516
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.hr = {
37277
37517
  command: 'insertHorizontalRule',
37278
- tags: [
37279
- 'hr'
37280
- ],
37281
37518
  tooltip: 'Insert Horizontal Line'
37282
37519
  };
37283
37520
  function hr(editor) {
@@ -41958,9 +42195,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.defaultLineHeight = n
41958
42195
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__.Icon.set('line-height', (_line_height_svg__WEBPACK_IMPORTED_MODULE_3___default()));
41959
42196
  jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.lineHeight = {
41960
42197
  command: 'applyLineHeight',
41961
- tags: [
41962
- 'ol'
41963
- ],
41964
42198
  tooltip: 'Line height',
41965
42199
  list: [
41966
42200
  1,
@@ -44969,10 +45203,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
44969
45203
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
44970
45204
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
44971
45205
  /* harmony import */ var jodit_core_helpers_checker_is_marker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23175);
44972
- /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7909);
44973
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(80991);
44974
- /* harmony import */ var jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(18855);
44975
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(8257);
45206
+ /* harmony import */ var jodit_core_helpers_utils_anchor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(85371);
45207
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7909);
45208
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(80991);
45209
+ /* harmony import */ var jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(18855);
45210
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8257);
44976
45211
  /*!
44977
45212
  * Jodit Editor (https://xdsoft.net/jodit/)
44978
45213
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -44994,6 +45229,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
44994
45229
 
44995
45230
 
44996
45231
 
45232
+
44997
45233
  /**
44998
45234
  * Check if root node is empty
44999
45235
  * @private
@@ -45020,18 +45256,19 @@ function isBlank(root) {
45020
45256
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(first) && !next) {
45021
45257
  return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(first);
45022
45258
  }
45023
- return !next && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.each(first, (elm)=>!(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isLeaf(elm) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isList(elm)) && (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmpty(elm) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'br')));
45259
+ // An anchor has no text, but it's content, shown as a marker
45260
+ return !next && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.each(first, (elm)=>!(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isLeaf(elm) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isList(elm) || (0,jodit_core_helpers_utils_anchor__WEBPACK_IMPORTED_MODULE_7__.isAnchor)(elm)) && (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmpty(elm) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'br')));
45024
45261
  }
45025
45262
  /**
45026
45263
  * Show placeholder inside empty editor
45027
- */ class placeholder extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_9__.Plugin {
45264
+ */ class placeholder extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_10__.Plugin {
45028
45265
  afterInit(editor) {
45029
45266
  if (!editor.o.showPlaceholder) {
45030
45267
  return;
45031
45268
  }
45032
45269
  this.placeholderElm = editor.c.fromHTML(`<span data-ref="placeholder" style="display: none;" class="jodit-placeholder">${editor.i18n(editor.o.placeholder)}</span>`);
45033
45270
  if (editor.o.direction === 'rtl') {
45034
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(this.placeholderElm, {
45271
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__.css)(this.placeholderElm, {
45035
45272
  right: 0,
45036
45273
  direction: 'rtl'
45037
45274
  });
@@ -45060,19 +45297,19 @@ function isBlank(root) {
45060
45297
  const style2 = editor.ew.getComputedStyle(firstChild);
45061
45298
  marginTop = parseInt(style2.getPropertyValue('margin-top'), 10);
45062
45299
  marginLeft = parseInt(style2.getPropertyValue('margin-left'), 10);
45063
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(this.placeholderElm, {
45300
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__.css)(this.placeholderElm, {
45064
45301
  fontFamily: style2.getPropertyValue('font-family'),
45065
45302
  fontSize: parseInt(style2.getPropertyValue('font-size'), 10),
45066
45303
  lineHeight: style2.getPropertyValue('line-height')
45067
45304
  });
45068
45305
  } else {
45069
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(this.placeholderElm, {
45306
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__.css)(this.placeholderElm, {
45070
45307
  fontFamily: style.getPropertyValue('font-family'),
45071
45308
  fontSize: parseInt(style.getPropertyValue('font-size'), 10),
45072
45309
  lineHeight: style.getPropertyValue('line-height')
45073
45310
  });
45074
45311
  }
45075
- ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(this.placeholderElm, {
45312
+ ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__.css)(this.placeholderElm, {
45076
45313
  display: 'block',
45077
45314
  textAlign: style.getPropertyValue('text-align'),
45078
45315
  paddingTop: parseInt(styleEditor.paddingTop, 10) + 'px',
@@ -45110,7 +45347,7 @@ function isBlank(root) {
45110
45347
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "addEvents", ()=>{
45111
45348
  const editor = this.j;
45112
45349
  if (editor.o.useInputsPlaceholder && editor.element.hasAttribute('placeholder')) {
45113
- this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(editor.element, 'placeholder') || '';
45350
+ this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_8__.attr)(editor.element, 'placeholder') || '';
45114
45351
  }
45115
45352
  editor.e.fire('placeholder', this.placeholderElm.innerHTML);
45116
45353
  editor.e.off('.placeholder').on('changePlace.placeholder', this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder afterCommand.placeholder resize.placeholder', this.toggle).on(window, 'load', this.toggle);