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/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.20.1
4
+ * Version: v4.20.3
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1824,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
1824
1824
  * ```
1825
1825
  * @packageDocumentation
1826
1826
  * @module constants
1827
- */ const APP_VERSION = "4.20.1";
1827
+ */ const APP_VERSION = "4.20.3";
1828
1828
  // prettier-ignore
1829
1829
  const ES = "es2021";
1830
1830
  const IS_ES_MODERN = true;
@@ -21535,11 +21535,12 @@ const CLASS_PREVIEW = 'jodit-file-browser-preview', preview_tpl_next = (next = '
21535
21535
  }), 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)=>{
21536
21536
  const image = self.c.element('img');
21537
21537
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'src', src);
21538
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'alt', ga('data-name'));
21538
21539
  const onload = ()=>{
21539
21540
  if (self.isInDestruct) {
21540
21541
  return;
21541
21542
  }
21542
- self.e.off(image, 'load');
21543
+ self.e.off(image, 'load error');
21543
21544
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.detach(temp_content);
21544
21545
  if (opt.showPreviewNavigation) {
21545
21546
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.prevWithClass(item, self.files.getFullElName('item'))) {
@@ -21554,7 +21555,10 @@ const CLASS_PREVIEW = 'jodit-file-browser-preview', preview_tpl_next = (next = '
21554
21555
  preview.setPosition();
21555
21556
  self?.events?.fire('previewOpenedAndLoaded');
21556
21557
  };
21557
- self.e.on(image, 'load', onload);
21558
+ // An image that can't load is shown too,
21559
+ // broken with the file's name, rather
21560
+ // than the loader for good
21561
+ self.e.on(image, 'load error', onload);
21558
21562
  if (image.complete) {
21559
21563
  onload();
21560
21564
  }
@@ -26146,9 +26150,20 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
26146
26150
  }
26147
26151
  return Boolean(tc && tc.shouldBeDisabled(this));
26148
26152
  }
26149
- onChangeActivated() {
26150
- ;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_18__.attr)(this.button, 'aria-pressed', this.state.activated);
26151
- super.onChangeActivated();
26153
+ /**
26154
+ * A button that its control can show as on is a toggle, and says whether
26155
+ * it's pressed
26156
+ */ get isToggle() {
26157
+ const { isActive, tags, css } = this.control;
26158
+ return Boolean(isActive || tags || css);
26159
+ }
26160
+ /**
26161
+ * The pressed look comes from the mod, as any button looks pressed while
26162
+ * its list is open, and the container is a `listitem`, which can't have
26163
+ * `aria-pressed`
26164
+ */ onChangeActivated() {
26165
+ ;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_18__.attr)(this.button, 'aria-pressed', this.isToggle ? this.state.activated : null);
26166
+ this.setMod('activated', this.state.activated || null);
26152
26167
  }
26153
26168
  onChangeText() {
26154
26169
  if ((0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_11__.isFunction)(this.control.template)) {
@@ -26208,6 +26223,8 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
26208
26223
  state.tooltip = (0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_11__.isFunction)(ctr.tooltip) ? ctr.tooltip(this.j, ctr, this) : ctr.tooltip;
26209
26224
  }
26210
26225
  state.hasTrigger = Boolean(ctr.list || ctr.popup && ctr.exec);
26226
+ // UIButton's template makes every button a toggle
26227
+ this.onChangeActivated();
26211
26228
  }
26212
26229
  __initIconFromControl() {
26213
26230
  const { control: ctr, state } = this;
@@ -26767,7 +26784,8 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
26767
26784
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
26768
26785
  /* harmony import */ var jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62101);
26769
26786
  /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85932);
26770
- /* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22533);
26787
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7909);
26788
+ /* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22533);
26771
26789
  /*!
26772
26790
  * Jodit Editor (https://xdsoft.net/jodit/)
26773
26791
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26780,10 +26798,15 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
26780
26798
 
26781
26799
 
26782
26800
 
26783
- class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
26801
+
26802
+ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton {
26784
26803
  className() {
26785
26804
  return 'ToolbarSelect';
26786
26805
  }
26806
+ // It shows its value, rather than being on or off
26807
+ get isToggle() {
26808
+ return false;
26809
+ }
26787
26810
  update() {
26788
26811
  super.update();
26789
26812
  this.state.icon.name = '';
@@ -26798,6 +26821,17 @@ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
26798
26821
  this.state.text = this.control.textTemplate?.(this.jodit, text) ?? text;
26799
26822
  }
26800
26823
  }
26824
+ /**
26825
+ * The button shows only the value, so its name says which control it
26826
+ * is too: "Font size, 16px"
26827
+ */ updateAriaLabel() {
26828
+ super.updateAriaLabel();
26829
+ const { tooltip } = this.state;
26830
+ const value = this.text.textContent?.trim();
26831
+ if (tooltip && value) {
26832
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__.attr)(this.button, 'aria-label', `${this.jodit.i18n(tooltip)}, ${value}`);
26833
+ }
26834
+ }
26801
26835
  }
26802
26836
  ToolbarSelect = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__._)([
26803
26837
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
@@ -27133,7 +27167,9 @@ ToolbarEditorCollection = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1
27133
27167
  }
27134
27168
  function makeSelect(view, control, target = null) {
27135
27169
  const ToolbarSelect = (0,jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_0__.getComponentClass)('ToolbarSelect');
27136
- return new ToolbarSelect(view, control, target);
27170
+ const select = new ToolbarSelect(view, control, target);
27171
+ select.state.tabIndex = view.o.allowTabNavigation ? 0 : -1;
27172
+ return select;
27137
27173
  }
27138
27174
 
27139
27175
 
@@ -28060,11 +28096,12 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
28060
28096
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
28061
28097
 
28062
28098
  "use strict";
28063
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
28064
- /* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
28065
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4099);
28066
- /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(54522);
28067
- /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_palette_svg__WEBPACK_IMPORTED_MODULE_3__);
28099
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
28100
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
28101
+ /* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65946);
28102
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4099);
28103
+ /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54522);
28104
+ /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_palette_svg__WEBPACK_IMPORTED_MODULE_4__);
28068
28105
  /*!
28069
28106
  * Jodit Editor (https://xdsoft.net/jodit/)
28070
28107
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28078,7 +28115,8 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
28078
28115
 
28079
28116
 
28080
28117
 
28081
- jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_3___default()));
28118
+
28119
+ jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_4___default()));
28082
28120
  /**
28083
28121
  * Build color picker
28084
28122
  *
@@ -28096,29 +28134,53 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
28096
28134
  * });
28097
28135
  * ```
28098
28136
  */ const ColorPickerWidget = (editor, callback, coldColor)=>{
28099
- 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)=>{
28137
+ 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)=>{
28100
28138
  const stack = [];
28101
- if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(colors)) {
28139
+ if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(colors)) {
28102
28140
  Object.keys(colors).forEach((key)=>{
28103
28141
  stack.push(`<div class="${cn}__group ${cn}__group-${key}">`);
28104
28142
  stack.push(eachColor(colors[key]));
28105
28143
  stack.push('</div>');
28106
28144
  });
28107
- } else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isArray)(colors)) {
28145
+ } else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isArray)(colors)) {
28108
28146
  colors.forEach((color)=>{
28109
- stack.push(`<span class='${cn}__color-item ${valueHex === color ? cn + '__color-item_active_true' : ''}' title="${color}" style="background-color:${color}" data-color="${color}"></span>`);
28147
+ const active = valueHex === color;
28148
+ 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>`);
28110
28149
  });
28111
28150
  }
28112
28151
  return stack.join('');
28113
28152
  };
28114
28153
  // The group wrapper lays the colors out in rows, so a flat list needs one
28115
28154
  // too. See #1487
28116
- 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);
28117
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(form, editor.c.fromHTML(`<div class="${cn}__groups">${groups}</div>`));
28118
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(form, editor.c.fromHTML(`<div data-ref="extra" class="${cn}__extra"></div>`));
28119
- const { extra } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.refs)(form);
28120
- 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>`));
28121
- const { hexInput } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.refs)(form);
28155
+ 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);
28156
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div class="${cn}__groups">${groups}</div>`));
28157
+ const items = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.toArray)(form.querySelectorAll(`.${cn}__color-item`));
28158
+ // Tab stops at one color, the current one or the first, and the arrow
28159
+ // keys move from it
28160
+ const tabStop = items.find((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'aria-pressed') === 'true') ?? items[0];
28161
+ if (tabStop) {
28162
+ (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(tabStop, 'tabindex', 0);
28163
+ }
28164
+ // Along a row, or to the nearest color in the row above or below, as the
28165
+ // palette is laid out
28166
+ const nextItem = (item, key)=>{
28167
+ const index = items.indexOf(item);
28168
+ if (key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT || key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT) {
28169
+ const step = key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT ? -1 : 1;
28170
+ const rtl = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.css)(item, 'direction') === 'rtl';
28171
+ return items[index + (rtl ? -step : step)];
28172
+ }
28173
+ 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);
28174
+ if (!rows.length) {
28175
+ return;
28176
+ }
28177
+ const top = (down ? Math.min : Math.max)(...rows.map((other)=>other.offsetTop)), distance = (other)=>Math.abs(other.offsetLeft - item.offsetLeft);
28178
+ return rows.filter((other)=>other.offsetTop === top).reduce((nearest, other)=>distance(other) < distance(nearest) ? other : nearest);
28179
+ };
28180
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div data-ref="extra" class="${cn}__extra"></div>`));
28181
+ const { extra } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
28182
+ 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>`));
28183
+ const { hexInput } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
28122
28184
  // Enter applies the value and closes the popup; removing the focused
28123
28185
  // input then makes Chrome fire `change` on it, which would apply the
28124
28186
  // same color a second time and toggle it off again. See #1459
@@ -28133,8 +28195,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
28133
28195
  if (!isHex && !isRgb) {
28134
28196
  return;
28135
28197
  }
28136
- const color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.normalizeColor)(isHex && !raw.startsWith('#') ? '#' + raw : raw);
28137
- if (color && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isFunction)(callback)) {
28198
+ const color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.normalizeColor)(isHex && !raw.startsWith('#') ? '#' + raw : raw);
28199
+ if (color && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
28138
28200
  appliedHexValue = raw;
28139
28201
  callback(color);
28140
28202
  }
@@ -28149,40 +28211,74 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
28149
28211
  e.stopPropagation();
28150
28212
  applyHexInput();
28151
28213
  });
28152
- 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>`));
28153
- if (editor.o.showBrowserColorPicker && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.hasBrowserColorPicker)()) {
28154
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(extra, editor.c.fromHTML(`<div class="${cn}__native">${iconPalette}<input type="color" value="#ffffff"/></div>`));
28214
+ 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>`));
28215
+ if (editor.o.showBrowserColorPicker && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.hasBrowserColorPicker)()) {
28216
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(extra, editor.c.fromHTML(`<div class="${cn}__native">${iconPalette}<input type="color" value="#ffffff"/></div>`));
28155
28217
  editor.e.on(form, 'change', (e)=>{
28156
28218
  e.stopPropagation();
28157
28219
  const target = e.target;
28158
- if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(target, 'input') || target.type !== 'color') {
28220
+ if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(target, 'input') || target.type !== 'color') {
28159
28221
  return;
28160
28222
  }
28161
28223
  const color = target.value || '';
28162
- if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isFunction)(callback)) {
28224
+ if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
28163
28225
  callback(color);
28164
28226
  }
28165
28227
  e.preventDefault();
28166
28228
  });
28167
28229
  }
28230
+ // The color of a swatch, or '' for Remove, from an event on it or its icon
28231
+ const colorOf = (node)=>{
28232
+ 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);
28233
+ return button ? (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(button, '-color') || '' : undefined;
28234
+ };
28235
+ const apply = (color)=>{
28236
+ if (callback && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
28237
+ callback(color);
28238
+ }
28239
+ };
28240
+ // A pointer applies the color on `mousedown`, which keeps the selection.
28241
+ // The keyboard and screen readers press the button, which sends only
28242
+ // `click`, so a click after the pointer's `mousedown` is skipped
28243
+ let pointerPressed = false;
28168
28244
  editor.e.on(form, 'mousedown touchend', (e)=>{
28169
28245
  // let the hex/native inputs receive focus and clicks
28170
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(e.target, 'input')) {
28246
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(e.target, 'input')) {
28171
28247
  e.stopPropagation();
28172
28248
  return;
28173
28249
  }
28174
28250
  e.stopPropagation();
28175
28251
  e.preventDefault();
28176
- let target = e.target;
28177
- 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) {
28178
- target = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(target.parentNode, 'span', editor.editor);
28252
+ const color = colorOf(e.target);
28253
+ if (color !== undefined) {
28254
+ pointerPressed = e.type === 'mousedown';
28255
+ apply(color);
28179
28256
  }
28180
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(target, 'span') || !target.classList.contains(cn + '__color-item') && !target.classList.contains(cn + '__remove')) {
28257
+ });
28258
+ editor.e.on(form, 'click', (e)=>{
28259
+ const color = colorOf(e.target);
28260
+ if (color !== undefined && !pointerPressed) {
28261
+ apply(color);
28262
+ }
28263
+ pointerPressed = false;
28264
+ }).on(form, 'keydown', (e)=>{
28265
+ pointerPressed = false;
28266
+ const item = e.target;
28267
+ if (!items.includes(item) || ![
28268
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT,
28269
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT,
28270
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_UP,
28271
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_DOWN
28272
+ ].includes(e.key)) {
28181
28273
  return;
28182
28274
  }
28183
- const color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.attr)(target, '-color') || '';
28184
- if (callback && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isFunction)(callback)) {
28185
- callback(color);
28275
+ // The toolbar's dropdown would walk every color one by one
28276
+ e.preventDefault();
28277
+ e.stopPropagation();
28278
+ nextItem(item, e.key)?.focus();
28279
+ }).on(form, 'focusin', (e)=>{
28280
+ if (items.includes(e.target)) {
28281
+ items.forEach((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'tabindex', item === e.target ? 0 : -1));
28186
28282
  }
28187
28283
  });
28188
28284
  editor.e.fire('afterGenerateColorPicker', form, extra, callback, valueHex);
@@ -29395,7 +29491,8 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29395
29491
  /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
29396
29492
  /* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(59400);
29397
29493
  /* harmony import */ var jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(5658);
29398
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(95085);
29494
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(29434);
29495
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(95085);
29399
29496
  /*!
29400
29497
  * Jodit Editor (https://xdsoft.net/jodit/)
29401
29498
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -29415,14 +29512,21 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29415
29512
 
29416
29513
 
29417
29514
 
29418
- 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\")";
29419
- const MARKER = [
29420
- 'id',
29421
- 'name'
29422
- ].map((key)=>`.jodit-wysiwyg a[${key}]:not([href]):empty::before`).join(',');
29515
+
29516
+ /**
29517
+ * The editing area of an editor with the plugin, when it shares its document
29518
+ * with the page and so with any other editor on it
29519
+ */ const WITH_ANCHORS = 'jodit-wysiwyg_anchors';
29423
29520
  /**
29424
- * Each anchor's marker, in the editing area only
29425
- */ 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:''}`;
29521
+ * Each anchor's marker, in the editing areas `scope` picks out
29522
+ */ function markerStyle(scope) {
29523
+ const marker = [
29524
+ 'id',
29525
+ 'name'
29526
+ ].map((key)=>`.jodit-wysiwyg${scope} a[${key}]:not([href]):empty::before`).join(',');
29527
+ const icon = `url("data:image/svg+xml,${encodeURIComponent(jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__.Icon.get('anchor'))}") center/contain no-repeat`;
29528
+ 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:''}`;
29529
+ }
29426
29530
  /**
29427
29531
  * The attribute `markAnchor` gives an anchor: an empty `<a>` with no `href`
29428
29532
  */ const MARK = ' contenteditable="false"';
@@ -29431,8 +29535,14 @@ const MARKER = [
29431
29535
  * `#name`, and renames and removes them
29432
29536
  */ class anchor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
29433
29537
  /** @override */ afterInit(jodit) {
29538
+ // An iframe's document is the editor's alone, and its body is part of
29539
+ // the value with `editHTMLDocumentMode`, so it gets no class
29540
+ const shared = jodit.ed === jodit.od;
29541
+ if (shared) {
29542
+ jodit.editor.classList.add(WITH_ANCHORS);
29543
+ }
29434
29544
  // It goes in the editing document, so iframe mode has it whatever `iframeStyle` holds
29435
- (0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent = MARKER_STYLE;
29545
+ ;(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent = markerStyle(shared ? '.' + WITH_ANCHORS : '');
29436
29546
  jodit.e.on('generateAnchorForm.anchor', this.__generateForm).on('clickA touchstartA', this.__onClickA, {
29437
29547
  top: true
29438
29548
  });
@@ -29464,6 +29574,24 @@ const MARKER = [
29464
29574
  */ onAfterGetValueFromEditor(data) {
29465
29575
  data.value = unmarkAnchors(data.value);
29466
29576
  }
29577
+ /**
29578
+ * A pasted or dropped copy of an anchor the document already has gets the
29579
+ * next free name, as `fees-2`, and the links that came with it follow it
29580
+ */ onBeforePasteInsert(html) {
29581
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(html) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isFragment(html)) {
29582
+ this.__renameCopies(html);
29583
+ return;
29584
+ }
29585
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) || !/<a\s/i.test(html)) {
29586
+ return;
29587
+ }
29588
+ // Inert, so nothing in it loads
29589
+ const template = this.j.createInside.element('template');
29590
+ template.innerHTML = html;
29591
+ if (this.__renameCopies(template.content)) {
29592
+ return template.innerHTML;
29593
+ }
29594
+ }
29467
29595
  /**
29468
29596
  * The form that names a new anchor, or renames or removes `target`
29469
29597
  */ __generateForm(target, close) {
@@ -29603,8 +29731,51 @@ const MARKER = [
29603
29731
  }
29604
29732
  });
29605
29733
  }
29734
+ /**
29735
+ * Gives each anchor in `root` whose name the document already has the
29736
+ * next free one, avoiding the names in `root` too, and points the links
29737
+ * in `root` to it at the new name. Whether any was renamed
29738
+ */ __renameCopies(root) {
29739
+ 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')));
29740
+ const renamed = new Map();
29741
+ const anchors = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isAnchor)(root) ? [
29742
+ root
29743
+ ] : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchors)(root);
29744
+ anchors.forEach((anchor)=>{
29745
+ const name = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchorName)(anchor);
29746
+ if (!this.__isTaken(name, null)) {
29747
+ return;
29748
+ }
29749
+ let copy = name;
29750
+ for(let n = 2; inRoot.has(copy) || this.__isTaken(copy, null); n += 1){
29751
+ copy = `${name}-${n}`;
29752
+ }
29753
+ [
29754
+ 'id',
29755
+ 'name'
29756
+ ].forEach((key)=>{
29757
+ if (anchor.hasAttribute(key)) {
29758
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(anchor, key, copy);
29759
+ }
29760
+ });
29761
+ inRoot.add(copy);
29762
+ renamed.set(name, copy);
29763
+ });
29764
+ if (!renamed.size) {
29765
+ return false;
29766
+ }
29767
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.toArray)(root.querySelectorAll('a[href]')).forEach((link)=>{
29768
+ const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') ?? '';
29769
+ const copy = href[0] === '#' && renamed.get(href.slice(1));
29770
+ if (copy) {
29771
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href', '#' + copy);
29772
+ }
29773
+ });
29774
+ return true;
29775
+ }
29606
29776
  /** @override */ beforeDestruct(jodit) {
29607
29777
  this.__dropForm();
29778
+ jodit.editor.classList.remove(WITH_ANCHORS);
29608
29779
  jodit.e.off('generateAnchorForm.anchor', this.__generateForm).off('clickA touchstartA', this.__onClickA);
29609
29780
  }
29610
29781
  constructor(...args){
@@ -29634,6 +29805,9 @@ const MARKER = [
29634
29805
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29635
29806
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':afterGetValueFromEditor')
29636
29807
  ], anchor.prototype, "onAfterGetValueFromEditor", null);
29808
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29809
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':beforePasteInsert')
29810
+ ], anchor.prototype, "onBeforePasteInsert", null);
29637
29811
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29638
29812
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
29639
29813
  ], anchor.prototype, "__generateForm", null);
@@ -30367,7 +30541,7 @@ function moveContentAndRemoveEmpty(jodit, mainClosestBox, sibling, backspace) {
30367
30541
  * @private
30368
30542
  */ function checkNotCollapsed(jodit) {
30369
30543
  if (!jodit.s.isCollapsed()) {
30370
- jodit.execCommand('Delete');
30544
+ jodit.execCommand('delete', false, true);
30371
30545
  return true;
30372
30546
  }
30373
30547
  return false;
@@ -33796,6 +33970,13 @@ const KEEPS_SPACES = new Set([
33796
33970
  'pre-wrap',
33797
33971
  'break-spaces'
33798
33972
  ]);
33973
+ /**
33974
+ * Formatting that the next letter keeps once all of the text in it is
33975
+ * deleted with a key: a formatting tag, or a span with styles of its own.
33976
+ * Not a link, which new text isn't added to, or a wrapper such as a video's
33977
+ */ function keepsFormat(node) {
33978
+ 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'));
33979
+ }
33799
33980
  /**
33800
33981
  * A plain space beside this neighbor isn't shown: there is none, or it's a
33801
33982
  * line break, a block or text starting (or ending) with a plain space
@@ -33843,7 +34024,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
33843
34024
  jodit.s.removeNode(node);
33844
34025
  }
33845
34026
  }
33846
- __onDeleteCommand() {
34027
+ __onDeleteCommand(command, showUI, keepFormat) {
33847
34028
  const { jodit } = this;
33848
34029
  if (jodit.s.isCollapsed()) {
33849
34030
  return;
@@ -33851,6 +34032,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
33851
34032
  jodit.s.expandSelection();
33852
34033
  const range = jodit.s.range;
33853
34034
  this.__moveEdgesIntoCells(range);
34035
+ const format = keepFormat === true ? this.__formatTakenWhole(range) : [];
33854
34036
  const caret = this.__clearSelectedCells(range);
33855
34037
  if (caret && range.collapsed) {
33856
34038
  jodit.s.selectRange(caret);
@@ -33866,8 +34048,12 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
33866
34048
  this.__keepSpacesVisibleBesideTable(fake);
33867
34049
  range.setStartBefore(fake);
33868
34050
  range.collapse(true);
33869
- this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
33870
- this.__addBrInEmptyBlock(fake, range);
34051
+ if (format.length && !caret) {
34052
+ this.__keepFormat(format, fake, range);
34053
+ } else {
34054
+ this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
34055
+ this.__addBrInEmptyBlock(fake, range);
34056
+ }
33871
34057
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
33872
34058
  jodit.s.selectRange(caret ?? range);
33873
34059
  return false;
@@ -33888,6 +34074,45 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugi
33888
34074
  range.setEnd(last, last.childNodes.length);
33889
34075
  }
33890
34076
  }
34077
+ /**
34078
+ * The formatting elements the deletion takes whole from its start,
34079
+ * outermost first: `<strong>` and `<em>` for all of the text in
34080
+ * `<strong><em>cd</em></strong>`
34081
+ */ __formatTakenWhole(range) {
34082
+ const format = [];
34083
+ const whole = this.jodit.s.createRange();
34084
+ const { startContainer, startOffset } = range;
34085
+ let node = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(startContainer) ? null : startContainer.childNodes[startOffset];
34086
+ // Through a block taken whole, as a line holding only the word is
34087
+ while(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isHTMLElement(node)){
34088
+ whole.selectNode(node);
34089
+ if (range.compareBoundaryPoints(Range.END_TO_END, whole) < 0) {
34090
+ break;
34091
+ }
34092
+ if (keepsFormat(node)) {
34093
+ format.push(node);
34094
+ } else if (format.length || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(node)) {
34095
+ break;
34096
+ }
34097
+ node = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(node.childNodes).find((child)=>!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(child) || (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.trimInv)(child.nodeValue ?? ''));
34098
+ }
34099
+ return format;
34100
+ }
34101
+ /**
34102
+ * As the browsers do, the next letter typed keeps the formatting that was
34103
+ * deleted whole: empty copies go where it was, round an invisible space,
34104
+ * as Bold does at a collapsed caret, and the caret goes inside (#1784)
34105
+ */ __keepFormat(format, fake, range) {
34106
+ const copies = format.map((element)=>element.cloneNode(false));
34107
+ for(let i = 1; i < copies.length; i += 1){
34108
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(copies[i - 1], copies[i]);
34109
+ }
34110
+ const text = this.jodit.createInside.text(jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE);
34111
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(copies[copies.length - 1], text);
34112
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.before(fake, copies[0]);
34113
+ range.setStartAfter(text);
34114
+ range.collapse(true);
34115
+ }
33891
34116
  /**
33892
34117
  * A selection that starts or ends in a table cell clears the selected part
33893
34118
  * of each cell it covers and keeps the cells, as the browsers do.
@@ -34630,7 +34855,13 @@ const brBoxes = new Set([
34630
34855
  // text; moving it before the `<br>` would put it on a line of its own
34631
34856
  // below the block (#1315)
34632
34857
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isOrContains(node, jodit.s.range.startContainer)) {
34633
- jodit.s.setCursorBefore(br);
34858
+ // Not with setCursorBefore: the text node it adds for the caret
34859
+ // stays after the inserted element once the `<br>` has gone, and
34860
+ // Right or End then take the caret into it, out of the element
34861
+ const range = jodit.s.createRange();
34862
+ range.setStartBefore(br);
34863
+ range.collapse(true);
34864
+ jodit.s.selectRange(range);
34634
34865
  }
34635
34866
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(br);
34636
34867
  }
@@ -36605,6 +36836,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.fullsize = {
36605
36836
  exec: (editor)=>{
36606
36837
  editor.toggleFullSize();
36607
36838
  },
36839
+ // Makes it a toggle. `update` sets the state, which holds while the editor doesn't have the focus
36840
+ isActive: (editor)=>editor.isFullSize,
36608
36841
  update (editor, button) {
36609
36842
  const mode = editor.isFullSize ? 'shrink' : 'fullsize';
36610
36843
  button.state.activated = editor.isFullSize;
@@ -36974,9 +37207,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('hotkeys', hotke
36974
37207
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__.Icon.set('hr', (_hr_svg__WEBPACK_IMPORTED_MODULE_4___default()));
36975
37208
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.hr = {
36976
37209
  command: 'insertHorizontalRule',
36977
- tags: [
36978
- 'hr'
36979
- ],
36980
37210
  tooltip: 'Insert Horizontal Line'
36981
37211
  };
36982
37212
  function hr(editor) {
@@ -41600,9 +41830,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.defaultLineHeight = n
41600
41830
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__.Icon.set('line-height', (_line_height_svg__WEBPACK_IMPORTED_MODULE_3___default()));
41601
41831
  jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.lineHeight = {
41602
41832
  command: 'applyLineHeight',
41603
- tags: [
41604
- 'ol'
41605
- ],
41606
41833
  tooltip: 'Line height',
41607
41834
  list: [
41608
41835
  1,
@@ -44586,10 +44813,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
44586
44813
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
44587
44814
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
44588
44815
  /* harmony import */ var jodit_core_helpers_checker_is_marker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23175);
44589
- /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7909);
44590
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(80991);
44591
- /* harmony import */ var jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(18855);
44592
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(8257);
44816
+ /* harmony import */ var jodit_core_helpers_utils_anchor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(85371);
44817
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7909);
44818
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(80991);
44819
+ /* harmony import */ var jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(18855);
44820
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8257);
44593
44821
  /*!
44594
44822
  * Jodit Editor (https://xdsoft.net/jodit/)
44595
44823
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -44611,6 +44839,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
44611
44839
 
44612
44840
 
44613
44841
 
44842
+
44614
44843
  /**
44615
44844
  * Check if root node is empty
44616
44845
  * @private
@@ -44635,18 +44864,19 @@ function isBlank(root) {
44635
44864
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(first) && !next) {
44636
44865
  return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(first);
44637
44866
  }
44638
- 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')));
44867
+ // An anchor has no text, but it's content, shown as a marker
44868
+ 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')));
44639
44869
  }
44640
44870
  /**
44641
44871
  * Show placeholder inside empty editor
44642
- */ class placeholder extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_9__.Plugin {
44872
+ */ class placeholder extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_10__.Plugin {
44643
44873
  afterInit(editor) {
44644
44874
  if (!editor.o.showPlaceholder) {
44645
44875
  return;
44646
44876
  }
44647
44877
  this.placeholderElm = editor.c.fromHTML(`<span data-ref="placeholder" style="display: none;" class="jodit-placeholder">${editor.i18n(editor.o.placeholder)}</span>`);
44648
44878
  if (editor.o.direction === 'rtl') {
44649
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(this.placeholderElm, {
44879
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__.css)(this.placeholderElm, {
44650
44880
  right: 0,
44651
44881
  direction: 'rtl'
44652
44882
  });
@@ -44675,19 +44905,19 @@ function isBlank(root) {
44675
44905
  const style2 = editor.ew.getComputedStyle(firstChild);
44676
44906
  marginTop = parseInt(style2.getPropertyValue('margin-top'), 10);
44677
44907
  marginLeft = parseInt(style2.getPropertyValue('margin-left'), 10);
44678
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(this.placeholderElm, {
44908
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__.css)(this.placeholderElm, {
44679
44909
  fontFamily: style2.getPropertyValue('font-family'),
44680
44910
  fontSize: parseInt(style2.getPropertyValue('font-size'), 10),
44681
44911
  lineHeight: style2.getPropertyValue('line-height')
44682
44912
  });
44683
44913
  } else {
44684
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(this.placeholderElm, {
44914
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__.css)(this.placeholderElm, {
44685
44915
  fontFamily: style.getPropertyValue('font-family'),
44686
44916
  fontSize: parseInt(style.getPropertyValue('font-size'), 10),
44687
44917
  lineHeight: style.getPropertyValue('line-height')
44688
44918
  });
44689
44919
  }
44690
- ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(this.placeholderElm, {
44920
+ ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_9__.css)(this.placeholderElm, {
44691
44921
  display: 'block',
44692
44922
  textAlign: style.getPropertyValue('text-align'),
44693
44923
  paddingTop: parseInt(styleEditor.paddingTop, 10) + 'px',
@@ -44725,7 +44955,7 @@ function isBlank(root) {
44725
44955
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "addEvents", ()=>{
44726
44956
  const editor = this.j;
44727
44957
  if (editor.o.useInputsPlaceholder && editor.element.hasAttribute('placeholder')) {
44728
- this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(editor.element, 'placeholder') || '';
44958
+ this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_8__.attr)(editor.element, 'placeholder') || '';
44729
44959
  }
44730
44960
  editor.e.fire('placeholder', this.placeholderElm.innerHTML);
44731
44961
  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);