jodit 4.20.0 → 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.
- package/CHANGELOG.md +20 -0
- package/es2015/jodit.css +68 -9
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +11 -11
- package/es2015/jodit.js +238 -54
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +8 -8
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +11 -11
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +8 -8
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +68 -9
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +12 -12
- package/es2021/jodit.js +234 -54
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +8 -8
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +68 -9
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +19 -19
- package/es2021.en/jodit.js +234 -54
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +19 -19
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +45 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +285 -56
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/ui/form/inputs/input/input.js +2 -0
- package/esm/modules/toolbar/button/button.d.ts +10 -0
- package/esm/modules/toolbar/button/button.js +19 -2
- package/esm/modules/toolbar/button/select/select.d.ts +6 -0
- package/esm/modules/toolbar/button/select/select.js +18 -0
- package/esm/modules/widget/color-picker/color-picker.js +76 -18
- package/esm/plugins/anchor/anchor.d.ts +11 -0
- package/esm/plugins/anchor/anchor.js +84 -8
- package/esm/plugins/fullsize/config.js +2 -0
- package/esm/plugins/hr/hr.js +0 -1
- package/esm/plugins/line-height/config.js +0 -1
- package/esm/plugins/link/template.js +3 -1
- package/esm/plugins/resizer/resizer.d.ts +6 -0
- package/esm/plugins/resizer/resizer.js +11 -0
- package/esm/types/toolbar.d.ts +2 -0
- package/package.json +1 -1
- package/types/modules/toolbar/button/button.d.ts +10 -0
- package/types/modules/toolbar/button/select/select.d.ts +6 -0
- package/types/plugins/anchor/anchor.d.ts +11 -0
- package/types/plugins/resizer/resizer.d.ts +6 -0
- 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.
|
|
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.
|
|
1827
|
+
*/ const APP_VERSION = "4.20.2";
|
|
1828
1828
|
// prettier-ignore
|
|
1829
1829
|
const ES = "es2021";
|
|
1830
1830
|
const IS_ES_MODERN = true;
|
|
@@ -16925,6 +16925,8 @@ class UIInput extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__.UIEleme
|
|
|
16925
16925
|
if (label) {
|
|
16926
16926
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.before(this.wrapper, this.label);
|
|
16927
16927
|
this.label.innerText = this.j.i18n(label);
|
|
16928
|
+
// The label is a span, so it names the input only this way
|
|
16929
|
+
(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_5__.attr)(input, 'aria-label', this.j.i18n(label));
|
|
16928
16930
|
} else {
|
|
16929
16931
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(this.label);
|
|
16930
16932
|
}
|
|
@@ -26144,13 +26146,26 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
|
|
|
26144
26146
|
}
|
|
26145
26147
|
return Boolean(tc && tc.shouldBeDisabled(this));
|
|
26146
26148
|
}
|
|
26147
|
-
|
|
26148
|
-
|
|
26149
|
-
|
|
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);
|
|
26150
26163
|
}
|
|
26151
26164
|
onChangeText() {
|
|
26152
26165
|
if ((0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_11__.isFunction)(this.control.template)) {
|
|
26153
26166
|
this.text.innerHTML = this.control.template(this.j, this.control.name, this.j.i18n(this.state.text));
|
|
26167
|
+
// The name given before the text came would otherwise stay
|
|
26168
|
+
this.updateAriaLabel();
|
|
26154
26169
|
} else {
|
|
26155
26170
|
super.onChangeText();
|
|
26156
26171
|
}
|
|
@@ -26204,6 +26219,8 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
|
|
|
26204
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;
|
|
26205
26220
|
}
|
|
26206
26221
|
state.hasTrigger = Boolean(ctr.list || ctr.popup && ctr.exec);
|
|
26222
|
+
// UIButton's template makes every button a toggle
|
|
26223
|
+
this.onChangeActivated();
|
|
26207
26224
|
}
|
|
26208
26225
|
__initIconFromControl() {
|
|
26209
26226
|
const { control: ctr, state } = this;
|
|
@@ -26763,7 +26780,8 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
26763
26780
|
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
|
|
26764
26781
|
/* harmony import */ var jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62101);
|
|
26765
26782
|
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85932);
|
|
26766
|
-
/* harmony import */ var
|
|
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);
|
|
26767
26785
|
/*!
|
|
26768
26786
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
26769
26787
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -26776,10 +26794,15 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
26776
26794
|
|
|
26777
26795
|
|
|
26778
26796
|
|
|
26779
|
-
|
|
26797
|
+
|
|
26798
|
+
class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton {
|
|
26780
26799
|
className() {
|
|
26781
26800
|
return 'ToolbarSelect';
|
|
26782
26801
|
}
|
|
26802
|
+
// It shows its value, rather than being on or off
|
|
26803
|
+
get isToggle() {
|
|
26804
|
+
return false;
|
|
26805
|
+
}
|
|
26783
26806
|
update() {
|
|
26784
26807
|
super.update();
|
|
26785
26808
|
this.state.icon.name = '';
|
|
@@ -26794,6 +26817,17 @@ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
|
|
|
26794
26817
|
this.state.text = this.control.textTemplate?.(this.jodit, text) ?? text;
|
|
26795
26818
|
}
|
|
26796
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
|
+
}
|
|
26797
26831
|
}
|
|
26798
26832
|
ToolbarSelect = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__._)([
|
|
26799
26833
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
|
|
@@ -28056,11 +28090,12 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
28056
28090
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
28057
28091
|
|
|
28058
28092
|
"use strict";
|
|
28059
|
-
/* harmony import */ var
|
|
28060
|
-
/* harmony import */ var
|
|
28061
|
-
/* harmony import */ var
|
|
28062
|
-
/* harmony import */ var
|
|
28063
|
-
/* harmony import */ var
|
|
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__);
|
|
28064
28099
|
/*!
|
|
28065
28100
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28066
28101
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28074,7 +28109,8 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
28074
28109
|
|
|
28075
28110
|
|
|
28076
28111
|
|
|
28077
|
-
|
|
28112
|
+
|
|
28113
|
+
jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_4___default()));
|
|
28078
28114
|
/**
|
|
28079
28115
|
* Build color picker
|
|
28080
28116
|
*
|
|
@@ -28092,29 +28128,53 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28092
28128
|
* });
|
|
28093
28129
|
* ```
|
|
28094
28130
|
*/ const ColorPickerWidget = (editor, callback, coldColor)=>{
|
|
28095
|
-
const cn = 'jodit-color-picker', valueHex = (0,
|
|
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)=>{
|
|
28096
28132
|
const stack = [];
|
|
28097
|
-
if ((0,
|
|
28133
|
+
if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(colors)) {
|
|
28098
28134
|
Object.keys(colors).forEach((key)=>{
|
|
28099
28135
|
stack.push(`<div class="${cn}__group ${cn}__group-${key}">`);
|
|
28100
28136
|
stack.push(eachColor(colors[key]));
|
|
28101
28137
|
stack.push('</div>');
|
|
28102
28138
|
});
|
|
28103
|
-
} else if ((0,
|
|
28139
|
+
} else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isArray)(colors)) {
|
|
28104
28140
|
colors.forEach((color)=>{
|
|
28105
|
-
|
|
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>`);
|
|
28106
28143
|
});
|
|
28107
28144
|
}
|
|
28108
28145
|
return stack.join('');
|
|
28109
28146
|
};
|
|
28110
28147
|
// The group wrapper lays the colors out in rows, so a flat list needs one
|
|
28111
28148
|
// too. See #1487
|
|
28112
|
-
const groups = (0,
|
|
28113
|
-
|
|
28114
|
-
|
|
28115
|
-
|
|
28116
|
-
|
|
28117
|
-
const
|
|
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);
|
|
28118
28178
|
// Enter applies the value and closes the popup; removing the focused
|
|
28119
28179
|
// input then makes Chrome fire `change` on it, which would apply the
|
|
28120
28180
|
// same color a second time and toggle it off again. See #1459
|
|
@@ -28129,8 +28189,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28129
28189
|
if (!isHex && !isRgb) {
|
|
28130
28190
|
return;
|
|
28131
28191
|
}
|
|
28132
|
-
const color = (0,
|
|
28133
|
-
if (color && (0,
|
|
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)) {
|
|
28134
28194
|
appliedHexValue = raw;
|
|
28135
28195
|
callback(color);
|
|
28136
28196
|
}
|
|
@@ -28145,40 +28205,74 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28145
28205
|
e.stopPropagation();
|
|
28146
28206
|
applyHexInput();
|
|
28147
28207
|
});
|
|
28148
|
-
|
|
28149
|
-
if (editor.o.showBrowserColorPicker && (0,
|
|
28150
|
-
|
|
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>`));
|
|
28151
28211
|
editor.e.on(form, 'change', (e)=>{
|
|
28152
28212
|
e.stopPropagation();
|
|
28153
28213
|
const target = e.target;
|
|
28154
|
-
if (!target || !target.tagName || !
|
|
28214
|
+
if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(target, 'input') || target.type !== 'color') {
|
|
28155
28215
|
return;
|
|
28156
28216
|
}
|
|
28157
28217
|
const color = target.value || '';
|
|
28158
|
-
if ((0,
|
|
28218
|
+
if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
|
|
28159
28219
|
callback(color);
|
|
28160
28220
|
}
|
|
28161
28221
|
e.preventDefault();
|
|
28162
28222
|
});
|
|
28163
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;
|
|
28164
28238
|
editor.e.on(form, 'mousedown touchend', (e)=>{
|
|
28165
28239
|
// let the hex/native inputs receive focus and clicks
|
|
28166
|
-
if (
|
|
28240
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(e.target, 'input')) {
|
|
28167
28241
|
e.stopPropagation();
|
|
28168
28242
|
return;
|
|
28169
28243
|
}
|
|
28170
28244
|
e.stopPropagation();
|
|
28171
28245
|
e.preventDefault();
|
|
28172
|
-
|
|
28173
|
-
if (
|
|
28174
|
-
|
|
28246
|
+
const color = colorOf(e.target);
|
|
28247
|
+
if (color !== undefined) {
|
|
28248
|
+
pointerPressed = e.type === 'mousedown';
|
|
28249
|
+
apply(color);
|
|
28175
28250
|
}
|
|
28176
|
-
|
|
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)) {
|
|
28177
28267
|
return;
|
|
28178
28268
|
}
|
|
28179
|
-
|
|
28180
|
-
|
|
28181
|
-
|
|
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));
|
|
28182
28276
|
}
|
|
28183
28277
|
});
|
|
28184
28278
|
editor.e.fire('afterGenerateColorPicker', form, extra, callback, valueHex);
|
|
@@ -29391,7 +29485,8 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
29391
29485
|
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
29392
29486
|
/* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(59400);
|
|
29393
29487
|
/* harmony import */ var jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(5658);
|
|
29394
|
-
/* harmony import */ var
|
|
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);
|
|
29395
29490
|
/*!
|
|
29396
29491
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
29397
29492
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -29411,14 +29506,21 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
29411
29506
|
|
|
29412
29507
|
|
|
29413
29508
|
|
|
29414
|
-
|
|
29415
|
-
const MARKER = [
|
|
29416
|
-
'id',
|
|
29417
|
-
'name'
|
|
29418
|
-
].map((key)=>`.jodit-wysiwyg a[${key}]:not([href]):empty::before`).join(',');
|
|
29509
|
+
|
|
29419
29510
|
/**
|
|
29420
|
-
*
|
|
29421
|
-
|
|
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
|
+
}
|
|
29422
29524
|
/**
|
|
29423
29525
|
* The attribute `markAnchor` gives an anchor: an empty `<a>` with no `href`
|
|
29424
29526
|
*/ const MARK = ' contenteditable="false"';
|
|
@@ -29427,8 +29529,14 @@ const MARKER = [
|
|
|
29427
29529
|
* `#name`, and renames and removes them
|
|
29428
29530
|
*/ class anchor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
29429
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
|
+
}
|
|
29430
29538
|
// It goes in the editing document, so iframe mode has it whatever `iframeStyle` holds
|
|
29431
|
-
(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent =
|
|
29539
|
+
;(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent = markerStyle(shared ? '.' + WITH_ANCHORS : '');
|
|
29432
29540
|
jodit.e.on('generateAnchorForm.anchor', this.__generateForm).on('clickA touchstartA', this.__onClickA, {
|
|
29433
29541
|
top: true
|
|
29434
29542
|
});
|
|
@@ -29460,6 +29568,24 @@ const MARKER = [
|
|
|
29460
29568
|
*/ onAfterGetValueFromEditor(data) {
|
|
29461
29569
|
data.value = unmarkAnchors(data.value);
|
|
29462
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
|
+
}
|
|
29463
29589
|
/**
|
|
29464
29590
|
* The form that names a new anchor, or renames or removes `target`
|
|
29465
29591
|
*/ __generateForm(target, close) {
|
|
@@ -29599,8 +29725,51 @@ const MARKER = [
|
|
|
29599
29725
|
}
|
|
29600
29726
|
});
|
|
29601
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
|
+
}
|
|
29602
29770
|
/** @override */ beforeDestruct(jodit) {
|
|
29603
29771
|
this.__dropForm();
|
|
29772
|
+
jodit.editor.classList.remove(WITH_ANCHORS);
|
|
29604
29773
|
jodit.e.off('generateAnchorForm.anchor', this.__generateForm).off('clickA touchstartA', this.__onClickA);
|
|
29605
29774
|
}
|
|
29606
29775
|
constructor(...args){
|
|
@@ -29630,6 +29799,9 @@ const MARKER = [
|
|
|
29630
29799
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
29631
29800
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':afterGetValueFromEditor')
|
|
29632
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);
|
|
29633
29805
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
29634
29806
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
29635
29807
|
], anchor.prototype, "__generateForm", null);
|
|
@@ -36601,6 +36773,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.fullsize = {
|
|
|
36601
36773
|
exec: (editor)=>{
|
|
36602
36774
|
editor.toggleFullSize();
|
|
36603
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,
|
|
36604
36778
|
update (editor, button) {
|
|
36605
36779
|
const mode = editor.isFullSize ? 'shrink' : 'fullsize';
|
|
36606
36780
|
button.state.activated = editor.isFullSize;
|
|
@@ -36970,9 +37144,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('hotkeys', hotke
|
|
|
36970
37144
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__.Icon.set('hr', (_hr_svg__WEBPACK_IMPORTED_MODULE_4___default()));
|
|
36971
37145
|
jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.hr = {
|
|
36972
37146
|
command: 'insertHorizontalRule',
|
|
36973
|
-
tags: [
|
|
36974
|
-
'hr'
|
|
36975
|
-
],
|
|
36976
37147
|
tooltip: 'Insert Horizontal Line'
|
|
36977
37148
|
};
|
|
36978
37149
|
function hr(editor) {
|
|
@@ -41596,9 +41767,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.defaultLineHeight = n
|
|
|
41596
41767
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__.Icon.set('line-height', (_line_height_svg__WEBPACK_IMPORTED_MODULE_3___default()));
|
|
41597
41768
|
jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.lineHeight = {
|
|
41598
41769
|
command: 'applyLineHeight',
|
|
41599
|
-
tags: [
|
|
41600
|
-
'ol'
|
|
41601
|
-
],
|
|
41602
41770
|
tooltip: 'Line height',
|
|
41603
41771
|
list: [
|
|
41604
41772
|
1,
|
|
@@ -42904,7 +43072,9 @@ const formTemplate = (editor)=>{
|
|
|
42904
43072
|
new jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIBlock(editor, [
|
|
42905
43073
|
new jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIInput(editor, {
|
|
42906
43074
|
name: 'url',
|
|
42907
|
-
|
|
43075
|
+
// Touch keyboards leave a URL field as typed, with no capital or
|
|
43076
|
+
// correction. The form is `novalidate`, so any address still goes in
|
|
43077
|
+
type: 'url',
|
|
42908
43078
|
ref: 'url_input',
|
|
42909
43079
|
label: 'URL',
|
|
42910
43080
|
placeholder: 'http://',
|
|
@@ -45932,6 +46102,13 @@ const IFRAME_WRAPPER = '[data-jodit_iframe_wrapper]';
|
|
|
45932
46102
|
this.addEventListeners();
|
|
45933
46103
|
this.__onChangeEditor();
|
|
45934
46104
|
}
|
|
46105
|
+
/**
|
|
46106
|
+
* A tap that selects an image sends no `click` (iPadOS), so `touchend`
|
|
46107
|
+
* stands in for it. A tick later, after `onClickOutside` has had the same
|
|
46108
|
+
* `touchend`, as `click` comes after `mouseup`
|
|
46109
|
+
*/ onEditorTouchEnd(e) {
|
|
46110
|
+
this.j.async.setTimeout(()=>this.onEditorClick(e), 1);
|
|
46111
|
+
}
|
|
45935
46112
|
/**
|
|
45936
46113
|
* Click in the editor area
|
|
45937
46114
|
*/ onEditorClick(e) {
|
|
@@ -46356,6 +46533,9 @@ const IFRAME_WRAPPER = '[data-jodit_iframe_wrapper]';
|
|
|
46356
46533
|
}
|
|
46357
46534
|
}
|
|
46358
46535
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
46536
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':touchend')
|
|
46537
|
+
], resizer.prototype, "onEditorTouchEnd", null);
|
|
46538
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
46359
46539
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':click')
|
|
46360
46540
|
], resizer.prototype, "onEditorClick", null);
|
|
46361
46541
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|