jodit 4.20.1 → 4.20.2

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 (75) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/es2015/jodit.css +68 -9
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +8 -8
  5. package/es2015/jodit.js +221 -53
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +5 -5
  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 +8 -8
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +5 -5
  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 +9 -9
  23. package/es2021/jodit.js +217 -53
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +5 -5
  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 +17 -17
  35. package/es2021.en/jodit.js +217 -53
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +17 -17
  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 +262 -55
  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/toolbar/button/button.d.ts +10 -0
  61. package/esm/modules/toolbar/button/button.js +17 -2
  62. package/esm/modules/toolbar/button/select/select.d.ts +6 -0
  63. package/esm/modules/toolbar/button/select/select.js +18 -0
  64. package/esm/modules/widget/color-picker/color-picker.js +76 -18
  65. package/esm/plugins/anchor/anchor.d.ts +11 -0
  66. package/esm/plugins/anchor/anchor.js +84 -8
  67. package/esm/plugins/fullsize/config.js +2 -0
  68. package/esm/plugins/hr/hr.js +0 -1
  69. package/esm/plugins/line-height/config.js +0 -1
  70. package/esm/types/toolbar.d.ts +2 -0
  71. package/package.json +1 -1
  72. package/types/modules/toolbar/button/button.d.ts +10 -0
  73. package/types/modules/toolbar/button/select/select.d.ts +6 -0
  74. package/types/plugins/anchor/anchor.d.ts +11 -0
  75. 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.2
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.2";
1828
1828
  // prettier-ignore
1829
1829
  const ES = "es2021";
1830
1830
  const IS_ES_MODERN = true;
@@ -26146,9 +26146,20 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
26146
26146
  }
26147
26147
  return Boolean(tc && tc.shouldBeDisabled(this));
26148
26148
  }
26149
- onChangeActivated() {
26150
- ;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_18__.attr)(this.button, 'aria-pressed', this.state.activated);
26151
- super.onChangeActivated();
26149
+ /**
26150
+ * A button that its control can show as on is a toggle, and says whether
26151
+ * it's pressed
26152
+ */ get isToggle() {
26153
+ const { isActive, tags, css } = this.control;
26154
+ return Boolean(isActive || tags || css);
26155
+ }
26156
+ /**
26157
+ * The pressed look comes from the mod, as any button looks pressed while
26158
+ * its list is open, and the container is a `listitem`, which can't have
26159
+ * `aria-pressed`
26160
+ */ onChangeActivated() {
26161
+ ;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_18__.attr)(this.button, 'aria-pressed', this.isToggle ? this.state.activated : null);
26162
+ this.setMod('activated', this.state.activated || null);
26152
26163
  }
26153
26164
  onChangeText() {
26154
26165
  if ((0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_11__.isFunction)(this.control.template)) {
@@ -26208,6 +26219,8 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
26208
26219
  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
26220
  }
26210
26221
  state.hasTrigger = Boolean(ctr.list || ctr.popup && ctr.exec);
26222
+ // UIButton's template makes every button a toggle
26223
+ this.onChangeActivated();
26211
26224
  }
26212
26225
  __initIconFromControl() {
26213
26226
  const { control: ctr, state } = this;
@@ -26767,7 +26780,8 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
26767
26780
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
26768
26781
  /* harmony import */ var jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62101);
26769
26782
  /* 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);
26783
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7909);
26784
+ /* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22533);
26771
26785
  /*!
26772
26786
  * Jodit Editor (https://xdsoft.net/jodit/)
26773
26787
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26780,10 +26794,15 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
26780
26794
 
26781
26795
 
26782
26796
 
26783
- class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
26797
+
26798
+ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton {
26784
26799
  className() {
26785
26800
  return 'ToolbarSelect';
26786
26801
  }
26802
+ // It shows its value, rather than being on or off
26803
+ get isToggle() {
26804
+ return false;
26805
+ }
26787
26806
  update() {
26788
26807
  super.update();
26789
26808
  this.state.icon.name = '';
@@ -26798,6 +26817,17 @@ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
26798
26817
  this.state.text = this.control.textTemplate?.(this.jodit, text) ?? text;
26799
26818
  }
26800
26819
  }
26820
+ /**
26821
+ * The button shows only the value, so its name says which control it
26822
+ * is too: "Font size, 16px"
26823
+ */ updateAriaLabel() {
26824
+ super.updateAriaLabel();
26825
+ const { tooltip } = this.state;
26826
+ const value = this.text.textContent?.trim();
26827
+ if (tooltip && value) {
26828
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__.attr)(this.button, 'aria-label', `${this.jodit.i18n(tooltip)}, ${value}`);
26829
+ }
26830
+ }
26801
26831
  }
26802
26832
  ToolbarSelect = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__._)([
26803
26833
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
@@ -28060,11 +28090,12 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
28060
28090
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
28061
28091
 
28062
28092
  "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__);
28093
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
28094
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
28095
+ /* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65946);
28096
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4099);
28097
+ /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54522);
28098
+ /* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_palette_svg__WEBPACK_IMPORTED_MODULE_4__);
28068
28099
  /*!
28069
28100
  * Jodit Editor (https://xdsoft.net/jodit/)
28070
28101
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -28078,7 +28109,8 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
28078
28109
 
28079
28110
 
28080
28111
 
28081
- jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_3___default()));
28112
+
28113
+ jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_4___default()));
28082
28114
  /**
28083
28115
  * Build color picker
28084
28116
  *
@@ -28096,29 +28128,53 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
28096
28128
  * });
28097
28129
  * ```
28098
28130
  */ 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)=>{
28131
+ 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
28132
  const stack = [];
28101
- if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(colors)) {
28133
+ if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(colors)) {
28102
28134
  Object.keys(colors).forEach((key)=>{
28103
28135
  stack.push(`<div class="${cn}__group ${cn}__group-${key}">`);
28104
28136
  stack.push(eachColor(colors[key]));
28105
28137
  stack.push('</div>');
28106
28138
  });
28107
- } else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isArray)(colors)) {
28139
+ } else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isArray)(colors)) {
28108
28140
  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>`);
28141
+ const active = valueHex === color;
28142
+ 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
28143
  });
28111
28144
  }
28112
28145
  return stack.join('');
28113
28146
  };
28114
28147
  // The group wrapper lays the colors out in rows, so a flat list needs one
28115
28148
  // 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);
28149
+ 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);
28150
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div class="${cn}__groups">${groups}</div>`));
28151
+ const items = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.toArray)(form.querySelectorAll(`.${cn}__color-item`));
28152
+ // Tab stops at one color, the current one or the first, and the arrow
28153
+ // keys move from it
28154
+ const tabStop = items.find((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'aria-pressed') === 'true') ?? items[0];
28155
+ if (tabStop) {
28156
+ (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(tabStop, 'tabindex', 0);
28157
+ }
28158
+ // Along a row, or to the nearest color in the row above or below, as the
28159
+ // palette is laid out
28160
+ const nextItem = (item, key)=>{
28161
+ const index = items.indexOf(item);
28162
+ if (key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT || key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT) {
28163
+ const step = key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT ? -1 : 1;
28164
+ const rtl = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.css)(item, 'direction') === 'rtl';
28165
+ return items[index + (rtl ? -step : step)];
28166
+ }
28167
+ 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);
28168
+ if (!rows.length) {
28169
+ return;
28170
+ }
28171
+ const top = (down ? Math.min : Math.max)(...rows.map((other)=>other.offsetTop)), distance = (other)=>Math.abs(other.offsetLeft - item.offsetLeft);
28172
+ return rows.filter((other)=>other.offsetTop === top).reduce((nearest, other)=>distance(other) < distance(nearest) ? other : nearest);
28173
+ };
28174
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div data-ref="extra" class="${cn}__extra"></div>`));
28175
+ const { extra } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
28176
+ 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>`));
28177
+ const { hexInput } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
28122
28178
  // Enter applies the value and closes the popup; removing the focused
28123
28179
  // input then makes Chrome fire `change` on it, which would apply the
28124
28180
  // same color a second time and toggle it off again. See #1459
@@ -28133,8 +28189,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
28133
28189
  if (!isHex && !isRgb) {
28134
28190
  return;
28135
28191
  }
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)) {
28192
+ const color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.normalizeColor)(isHex && !raw.startsWith('#') ? '#' + raw : raw);
28193
+ if (color && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
28138
28194
  appliedHexValue = raw;
28139
28195
  callback(color);
28140
28196
  }
@@ -28149,40 +28205,74 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
28149
28205
  e.stopPropagation();
28150
28206
  applyHexInput();
28151
28207
  });
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>`));
28208
+ 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>`));
28209
+ if (editor.o.showBrowserColorPicker && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.hasBrowserColorPicker)()) {
28210
+ 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
28211
  editor.e.on(form, 'change', (e)=>{
28156
28212
  e.stopPropagation();
28157
28213
  const target = e.target;
28158
- if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(target, 'input') || target.type !== 'color') {
28214
+ if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(target, 'input') || target.type !== 'color') {
28159
28215
  return;
28160
28216
  }
28161
28217
  const color = target.value || '';
28162
- if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__.isFunction)(callback)) {
28218
+ if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
28163
28219
  callback(color);
28164
28220
  }
28165
28221
  e.preventDefault();
28166
28222
  });
28167
28223
  }
28224
+ // The color of a swatch, or '' for Remove, from an event on it or its icon
28225
+ const colorOf = (node)=>{
28226
+ 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);
28227
+ return button ? (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(button, '-color') || '' : undefined;
28228
+ };
28229
+ const apply = (color)=>{
28230
+ if (callback && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
28231
+ callback(color);
28232
+ }
28233
+ };
28234
+ // A pointer applies the color on `mousedown`, which keeps the selection.
28235
+ // The keyboard and screen readers press the button, which sends only
28236
+ // `click`, so a click after the pointer's `mousedown` is skipped
28237
+ let pointerPressed = false;
28168
28238
  editor.e.on(form, 'mousedown touchend', (e)=>{
28169
28239
  // let the hex/native inputs receive focus and clicks
28170
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(e.target, 'input')) {
28240
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(e.target, 'input')) {
28171
28241
  e.stopPropagation();
28172
28242
  return;
28173
28243
  }
28174
28244
  e.stopPropagation();
28175
28245
  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);
28246
+ const color = colorOf(e.target);
28247
+ if (color !== undefined) {
28248
+ pointerPressed = e.type === 'mousedown';
28249
+ apply(color);
28179
28250
  }
28180
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(target, 'span') || !target.classList.contains(cn + '__color-item') && !target.classList.contains(cn + '__remove')) {
28251
+ });
28252
+ editor.e.on(form, 'click', (e)=>{
28253
+ const color = colorOf(e.target);
28254
+ if (color !== undefined && !pointerPressed) {
28255
+ apply(color);
28256
+ }
28257
+ pointerPressed = false;
28258
+ }).on(form, 'keydown', (e)=>{
28259
+ pointerPressed = false;
28260
+ const item = e.target;
28261
+ if (!items.includes(item) || ![
28262
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT,
28263
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT,
28264
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_UP,
28265
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_DOWN
28266
+ ].includes(e.key)) {
28181
28267
  return;
28182
28268
  }
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);
28269
+ // The toolbar's dropdown would walk every color one by one
28270
+ e.preventDefault();
28271
+ e.stopPropagation();
28272
+ nextItem(item, e.key)?.focus();
28273
+ }).on(form, 'focusin', (e)=>{
28274
+ if (items.includes(e.target)) {
28275
+ items.forEach((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'tabindex', item === e.target ? 0 : -1));
28186
28276
  }
28187
28277
  });
28188
28278
  editor.e.fire('afterGenerateColorPicker', form, extra, callback, valueHex);
@@ -29395,7 +29485,8 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29395
29485
  /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
29396
29486
  /* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(59400);
29397
29487
  /* 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);
29488
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(29434);
29489
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(95085);
29399
29490
  /*!
29400
29491
  * Jodit Editor (https://xdsoft.net/jodit/)
29401
29492
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -29415,14 +29506,21 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29415
29506
 
29416
29507
 
29417
29508
 
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(',');
29509
+
29423
29510
  /**
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:''}`;
29511
+ * The editing area of an editor with the plugin, when it shares its document
29512
+ * with the page and so with any other editor on it
29513
+ */ const WITH_ANCHORS = 'jodit-wysiwyg_anchors';
29514
+ /**
29515
+ * Each anchor's marker, in the editing areas `scope` picks out
29516
+ */ function markerStyle(scope) {
29517
+ const marker = [
29518
+ 'id',
29519
+ 'name'
29520
+ ].map((key)=>`.jodit-wysiwyg${scope} a[${key}]:not([href]):empty::before`).join(',');
29521
+ const icon = `url("data:image/svg+xml,${encodeURIComponent(jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__.Icon.get('anchor'))}") center/contain no-repeat`;
29522
+ 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:''}`;
29523
+ }
29426
29524
  /**
29427
29525
  * The attribute `markAnchor` gives an anchor: an empty `<a>` with no `href`
29428
29526
  */ const MARK = ' contenteditable="false"';
@@ -29431,8 +29529,14 @@ const MARKER = [
29431
29529
  * `#name`, and renames and removes them
29432
29530
  */ class anchor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
29433
29531
  /** @override */ afterInit(jodit) {
29532
+ // An iframe's document is the editor's alone, and its body is part of
29533
+ // the value with `editHTMLDocumentMode`, so it gets no class
29534
+ const shared = jodit.ed === jodit.od;
29535
+ if (shared) {
29536
+ jodit.editor.classList.add(WITH_ANCHORS);
29537
+ }
29434
29538
  // 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;
29539
+ ;(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent = markerStyle(shared ? '.' + WITH_ANCHORS : '');
29436
29540
  jodit.e.on('generateAnchorForm.anchor', this.__generateForm).on('clickA touchstartA', this.__onClickA, {
29437
29541
  top: true
29438
29542
  });
@@ -29464,6 +29568,24 @@ const MARKER = [
29464
29568
  */ onAfterGetValueFromEditor(data) {
29465
29569
  data.value = unmarkAnchors(data.value);
29466
29570
  }
29571
+ /**
29572
+ * A pasted or dropped copy of an anchor the document already has gets the
29573
+ * next free name, as `fees-2`, and the links that came with it follow it
29574
+ */ onBeforePasteInsert(html) {
29575
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(html) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isFragment(html)) {
29576
+ this.__renameCopies(html);
29577
+ return;
29578
+ }
29579
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) || !/<a\s/i.test(html)) {
29580
+ return;
29581
+ }
29582
+ // Inert, so nothing in it loads
29583
+ const template = this.j.createInside.element('template');
29584
+ template.innerHTML = html;
29585
+ if (this.__renameCopies(template.content)) {
29586
+ return template.innerHTML;
29587
+ }
29588
+ }
29467
29589
  /**
29468
29590
  * The form that names a new anchor, or renames or removes `target`
29469
29591
  */ __generateForm(target, close) {
@@ -29603,8 +29725,51 @@ const MARKER = [
29603
29725
  }
29604
29726
  });
29605
29727
  }
29728
+ /**
29729
+ * Gives each anchor in `root` whose name the document already has the
29730
+ * next free one, avoiding the names in `root` too, and points the links
29731
+ * in `root` to it at the new name. Whether any was renamed
29732
+ */ __renameCopies(root) {
29733
+ 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')));
29734
+ const renamed = new Map();
29735
+ const anchors = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isAnchor)(root) ? [
29736
+ root
29737
+ ] : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchors)(root);
29738
+ anchors.forEach((anchor)=>{
29739
+ const name = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchorName)(anchor);
29740
+ if (!this.__isTaken(name, null)) {
29741
+ return;
29742
+ }
29743
+ let copy = name;
29744
+ for(let n = 2; inRoot.has(copy) || this.__isTaken(copy, null); n += 1){
29745
+ copy = `${name}-${n}`;
29746
+ }
29747
+ [
29748
+ 'id',
29749
+ 'name'
29750
+ ].forEach((key)=>{
29751
+ if (anchor.hasAttribute(key)) {
29752
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(anchor, key, copy);
29753
+ }
29754
+ });
29755
+ inRoot.add(copy);
29756
+ renamed.set(name, copy);
29757
+ });
29758
+ if (!renamed.size) {
29759
+ return false;
29760
+ }
29761
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.toArray)(root.querySelectorAll('a[href]')).forEach((link)=>{
29762
+ const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') ?? '';
29763
+ const copy = href[0] === '#' && renamed.get(href.slice(1));
29764
+ if (copy) {
29765
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href', '#' + copy);
29766
+ }
29767
+ });
29768
+ return true;
29769
+ }
29606
29770
  /** @override */ beforeDestruct(jodit) {
29607
29771
  this.__dropForm();
29772
+ jodit.editor.classList.remove(WITH_ANCHORS);
29608
29773
  jodit.e.off('generateAnchorForm.anchor', this.__generateForm).off('clickA touchstartA', this.__onClickA);
29609
29774
  }
29610
29775
  constructor(...args){
@@ -29634,6 +29799,9 @@ const MARKER = [
29634
29799
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29635
29800
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':afterGetValueFromEditor')
29636
29801
  ], anchor.prototype, "onAfterGetValueFromEditor", null);
29802
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29803
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':beforePasteInsert')
29804
+ ], anchor.prototype, "onBeforePasteInsert", null);
29637
29805
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
29638
29806
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
29639
29807
  ], anchor.prototype, "__generateForm", null);
@@ -36605,6 +36773,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.fullsize = {
36605
36773
  exec: (editor)=>{
36606
36774
  editor.toggleFullSize();
36607
36775
  },
36776
+ // Makes it a toggle. `update` sets the state, which holds while the editor doesn't have the focus
36777
+ isActive: (editor)=>editor.isFullSize,
36608
36778
  update (editor, button) {
36609
36779
  const mode = editor.isFullSize ? 'shrink' : 'fullsize';
36610
36780
  button.state.activated = editor.isFullSize;
@@ -36974,9 +37144,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('hotkeys', hotke
36974
37144
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__.Icon.set('hr', (_hr_svg__WEBPACK_IMPORTED_MODULE_4___default()));
36975
37145
  jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.hr = {
36976
37146
  command: 'insertHorizontalRule',
36977
- tags: [
36978
- 'hr'
36979
- ],
36980
37147
  tooltip: 'Insert Horizontal Line'
36981
37148
  };
36982
37149
  function hr(editor) {
@@ -41600,9 +41767,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.defaultLineHeight = n
41600
41767
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__.Icon.set('line-height', (_line_height_svg__WEBPACK_IMPORTED_MODULE_3___default()));
41601
41768
  jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.lineHeight = {
41602
41769
  command: 'applyLineHeight',
41603
- tags: [
41604
- 'ol'
41605
- ],
41606
41770
  tooltip: 'Line height',
41607
41771
  list: [
41608
41772
  1,