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.en/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
|
}
|
|
@@ -26120,13 +26122,26 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
|
|
|
26120
26122
|
}
|
|
26121
26123
|
return Boolean(tc && tc.shouldBeDisabled(this));
|
|
26122
26124
|
}
|
|
26123
|
-
|
|
26124
|
-
|
|
26125
|
-
|
|
26125
|
+
/**
|
|
26126
|
+
* A button that its control can show as on is a toggle, and says whether
|
|
26127
|
+
* it's pressed
|
|
26128
|
+
*/ get isToggle() {
|
|
26129
|
+
const { isActive, tags, css } = this.control;
|
|
26130
|
+
return Boolean(isActive || tags || css);
|
|
26131
|
+
}
|
|
26132
|
+
/**
|
|
26133
|
+
* The pressed look comes from the mod, as any button looks pressed while
|
|
26134
|
+
* its list is open, and the container is a `listitem`, which can't have
|
|
26135
|
+
* `aria-pressed`
|
|
26136
|
+
*/ onChangeActivated() {
|
|
26137
|
+
;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_18__.attr)(this.button, 'aria-pressed', this.isToggle ? this.state.activated : null);
|
|
26138
|
+
this.setMod('activated', this.state.activated || null);
|
|
26126
26139
|
}
|
|
26127
26140
|
onChangeText() {
|
|
26128
26141
|
if ((0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_11__.isFunction)(this.control.template)) {
|
|
26129
26142
|
this.text.innerHTML = this.control.template(this.j, this.control.name, this.j.i18n(this.state.text));
|
|
26143
|
+
// The name given before the text came would otherwise stay
|
|
26144
|
+
this.updateAriaLabel();
|
|
26130
26145
|
} else {
|
|
26131
26146
|
super.onChangeText();
|
|
26132
26147
|
}
|
|
@@ -26180,6 +26195,8 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
|
|
|
26180
26195
|
state.tooltip = (0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_11__.isFunction)(ctr.tooltip) ? ctr.tooltip(this.j, ctr, this) : ctr.tooltip;
|
|
26181
26196
|
}
|
|
26182
26197
|
state.hasTrigger = Boolean(ctr.list || ctr.popup && ctr.exec);
|
|
26198
|
+
// UIButton's template makes every button a toggle
|
|
26199
|
+
this.onChangeActivated();
|
|
26183
26200
|
}
|
|
26184
26201
|
__initIconFromControl() {
|
|
26185
26202
|
const { control: ctr, state } = this;
|
|
@@ -26739,7 +26756,8 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
26739
26756
|
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
|
|
26740
26757
|
/* harmony import */ var jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62101);
|
|
26741
26758
|
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85932);
|
|
26742
|
-
/* harmony import */ var
|
|
26759
|
+
/* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7909);
|
|
26760
|
+
/* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22533);
|
|
26743
26761
|
/*!
|
|
26744
26762
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
26745
26763
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -26752,10 +26770,15 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
26752
26770
|
|
|
26753
26771
|
|
|
26754
26772
|
|
|
26755
|
-
|
|
26773
|
+
|
|
26774
|
+
class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton {
|
|
26756
26775
|
className() {
|
|
26757
26776
|
return 'ToolbarSelect';
|
|
26758
26777
|
}
|
|
26778
|
+
// It shows its value, rather than being on or off
|
|
26779
|
+
get isToggle() {
|
|
26780
|
+
return false;
|
|
26781
|
+
}
|
|
26759
26782
|
update() {
|
|
26760
26783
|
super.update();
|
|
26761
26784
|
this.state.icon.name = '';
|
|
@@ -26770,6 +26793,17 @@ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
|
|
|
26770
26793
|
this.state.text = this.control.textTemplate?.(this.jodit, text) ?? text;
|
|
26771
26794
|
}
|
|
26772
26795
|
}
|
|
26796
|
+
/**
|
|
26797
|
+
* The button shows only the value, so its name says which control it
|
|
26798
|
+
* is too: "Font size, 16px"
|
|
26799
|
+
*/ updateAriaLabel() {
|
|
26800
|
+
super.updateAriaLabel();
|
|
26801
|
+
const { tooltip } = this.state;
|
|
26802
|
+
const value = this.text.textContent?.trim();
|
|
26803
|
+
if (tooltip && value) {
|
|
26804
|
+
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__.attr)(this.button, 'aria-label', `${this.jodit.i18n(tooltip)}, ${value}`);
|
|
26805
|
+
}
|
|
26806
|
+
}
|
|
26773
26807
|
}
|
|
26774
26808
|
ToolbarSelect = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__._)([
|
|
26775
26809
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
|
|
@@ -28032,11 +28066,12 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
28032
28066
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
28033
28067
|
|
|
28034
28068
|
"use strict";
|
|
28035
|
-
/* harmony import */ var
|
|
28036
|
-
/* harmony import */ var
|
|
28037
|
-
/* harmony import */ var
|
|
28038
|
-
/* harmony import */ var
|
|
28039
|
-
/* harmony import */ var
|
|
28069
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
|
|
28070
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
|
|
28071
|
+
/* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65946);
|
|
28072
|
+
/* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4099);
|
|
28073
|
+
/* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54522);
|
|
28074
|
+
/* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_palette_svg__WEBPACK_IMPORTED_MODULE_4__);
|
|
28040
28075
|
/*!
|
|
28041
28076
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28042
28077
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28050,7 +28085,8 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
28050
28085
|
|
|
28051
28086
|
|
|
28052
28087
|
|
|
28053
|
-
|
|
28088
|
+
|
|
28089
|
+
jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_4___default()));
|
|
28054
28090
|
/**
|
|
28055
28091
|
* Build color picker
|
|
28056
28092
|
*
|
|
@@ -28068,29 +28104,53 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28068
28104
|
* });
|
|
28069
28105
|
* ```
|
|
28070
28106
|
*/ const ColorPickerWidget = (editor, callback, coldColor)=>{
|
|
28071
|
-
const cn = 'jodit-color-picker', valueHex = (0,
|
|
28107
|
+
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)=>{
|
|
28072
28108
|
const stack = [];
|
|
28073
|
-
if ((0,
|
|
28109
|
+
if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(colors)) {
|
|
28074
28110
|
Object.keys(colors).forEach((key)=>{
|
|
28075
28111
|
stack.push(`<div class="${cn}__group ${cn}__group-${key}">`);
|
|
28076
28112
|
stack.push(eachColor(colors[key]));
|
|
28077
28113
|
stack.push('</div>');
|
|
28078
28114
|
});
|
|
28079
|
-
} else if ((0,
|
|
28115
|
+
} else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isArray)(colors)) {
|
|
28080
28116
|
colors.forEach((color)=>{
|
|
28081
|
-
|
|
28117
|
+
const active = valueHex === color;
|
|
28118
|
+
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>`);
|
|
28082
28119
|
});
|
|
28083
28120
|
}
|
|
28084
28121
|
return stack.join('');
|
|
28085
28122
|
};
|
|
28086
28123
|
// The group wrapper lays the colors out in rows, so a flat list needs one
|
|
28087
28124
|
// too. See #1487
|
|
28088
|
-
const groups = (0,
|
|
28089
|
-
|
|
28090
|
-
|
|
28091
|
-
|
|
28092
|
-
|
|
28093
|
-
const
|
|
28125
|
+
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);
|
|
28126
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div class="${cn}__groups">${groups}</div>`));
|
|
28127
|
+
const items = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.toArray)(form.querySelectorAll(`.${cn}__color-item`));
|
|
28128
|
+
// Tab stops at one color, the current one or the first, and the arrow
|
|
28129
|
+
// keys move from it
|
|
28130
|
+
const tabStop = items.find((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'aria-pressed') === 'true') ?? items[0];
|
|
28131
|
+
if (tabStop) {
|
|
28132
|
+
(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(tabStop, 'tabindex', 0);
|
|
28133
|
+
}
|
|
28134
|
+
// Along a row, or to the nearest color in the row above or below, as the
|
|
28135
|
+
// palette is laid out
|
|
28136
|
+
const nextItem = (item, key)=>{
|
|
28137
|
+
const index = items.indexOf(item);
|
|
28138
|
+
if (key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT || key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT) {
|
|
28139
|
+
const step = key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT ? -1 : 1;
|
|
28140
|
+
const rtl = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.css)(item, 'direction') === 'rtl';
|
|
28141
|
+
return items[index + (rtl ? -step : step)];
|
|
28142
|
+
}
|
|
28143
|
+
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);
|
|
28144
|
+
if (!rows.length) {
|
|
28145
|
+
return;
|
|
28146
|
+
}
|
|
28147
|
+
const top = (down ? Math.min : Math.max)(...rows.map((other)=>other.offsetTop)), distance = (other)=>Math.abs(other.offsetLeft - item.offsetLeft);
|
|
28148
|
+
return rows.filter((other)=>other.offsetTop === top).reduce((nearest, other)=>distance(other) < distance(nearest) ? other : nearest);
|
|
28149
|
+
};
|
|
28150
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div data-ref="extra" class="${cn}__extra"></div>`));
|
|
28151
|
+
const { extra } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
|
|
28152
|
+
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>`));
|
|
28153
|
+
const { hexInput } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
|
|
28094
28154
|
// Enter applies the value and closes the popup; removing the focused
|
|
28095
28155
|
// input then makes Chrome fire `change` on it, which would apply the
|
|
28096
28156
|
// same color a second time and toggle it off again. See #1459
|
|
@@ -28105,8 +28165,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28105
28165
|
if (!isHex && !isRgb) {
|
|
28106
28166
|
return;
|
|
28107
28167
|
}
|
|
28108
|
-
const color = (0,
|
|
28109
|
-
if (color && (0,
|
|
28168
|
+
const color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.normalizeColor)(isHex && !raw.startsWith('#') ? '#' + raw : raw);
|
|
28169
|
+
if (color && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
|
|
28110
28170
|
appliedHexValue = raw;
|
|
28111
28171
|
callback(color);
|
|
28112
28172
|
}
|
|
@@ -28121,40 +28181,74 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28121
28181
|
e.stopPropagation();
|
|
28122
28182
|
applyHexInput();
|
|
28123
28183
|
});
|
|
28124
|
-
|
|
28125
|
-
if (editor.o.showBrowserColorPicker && (0,
|
|
28126
|
-
|
|
28184
|
+
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>`));
|
|
28185
|
+
if (editor.o.showBrowserColorPicker && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.hasBrowserColorPicker)()) {
|
|
28186
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(extra, editor.c.fromHTML(`<div class="${cn}__native">${iconPalette}<input type="color" value="#ffffff"/></div>`));
|
|
28127
28187
|
editor.e.on(form, 'change', (e)=>{
|
|
28128
28188
|
e.stopPropagation();
|
|
28129
28189
|
const target = e.target;
|
|
28130
|
-
if (!target || !target.tagName || !
|
|
28190
|
+
if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(target, 'input') || target.type !== 'color') {
|
|
28131
28191
|
return;
|
|
28132
28192
|
}
|
|
28133
28193
|
const color = target.value || '';
|
|
28134
|
-
if ((0,
|
|
28194
|
+
if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
|
|
28135
28195
|
callback(color);
|
|
28136
28196
|
}
|
|
28137
28197
|
e.preventDefault();
|
|
28138
28198
|
});
|
|
28139
28199
|
}
|
|
28200
|
+
// The color of a swatch, or '' for Remove, from an event on it or its icon
|
|
28201
|
+
const colorOf = (node)=>{
|
|
28202
|
+
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);
|
|
28203
|
+
return button ? (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(button, '-color') || '' : undefined;
|
|
28204
|
+
};
|
|
28205
|
+
const apply = (color)=>{
|
|
28206
|
+
if (callback && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
|
|
28207
|
+
callback(color);
|
|
28208
|
+
}
|
|
28209
|
+
};
|
|
28210
|
+
// A pointer applies the color on `mousedown`, which keeps the selection.
|
|
28211
|
+
// The keyboard and screen readers press the button, which sends only
|
|
28212
|
+
// `click`, so a click after the pointer's `mousedown` is skipped
|
|
28213
|
+
let pointerPressed = false;
|
|
28140
28214
|
editor.e.on(form, 'mousedown touchend', (e)=>{
|
|
28141
28215
|
// let the hex/native inputs receive focus and clicks
|
|
28142
|
-
if (
|
|
28216
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(e.target, 'input')) {
|
|
28143
28217
|
e.stopPropagation();
|
|
28144
28218
|
return;
|
|
28145
28219
|
}
|
|
28146
28220
|
e.stopPropagation();
|
|
28147
28221
|
e.preventDefault();
|
|
28148
|
-
|
|
28149
|
-
if (
|
|
28150
|
-
|
|
28222
|
+
const color = colorOf(e.target);
|
|
28223
|
+
if (color !== undefined) {
|
|
28224
|
+
pointerPressed = e.type === 'mousedown';
|
|
28225
|
+
apply(color);
|
|
28151
28226
|
}
|
|
28152
|
-
|
|
28227
|
+
});
|
|
28228
|
+
editor.e.on(form, 'click', (e)=>{
|
|
28229
|
+
const color = colorOf(e.target);
|
|
28230
|
+
if (color !== undefined && !pointerPressed) {
|
|
28231
|
+
apply(color);
|
|
28232
|
+
}
|
|
28233
|
+
pointerPressed = false;
|
|
28234
|
+
}).on(form, 'keydown', (e)=>{
|
|
28235
|
+
pointerPressed = false;
|
|
28236
|
+
const item = e.target;
|
|
28237
|
+
if (!items.includes(item) || ![
|
|
28238
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT,
|
|
28239
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT,
|
|
28240
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_UP,
|
|
28241
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_DOWN
|
|
28242
|
+
].includes(e.key)) {
|
|
28153
28243
|
return;
|
|
28154
28244
|
}
|
|
28155
|
-
|
|
28156
|
-
|
|
28157
|
-
|
|
28245
|
+
// The toolbar's dropdown would walk every color one by one
|
|
28246
|
+
e.preventDefault();
|
|
28247
|
+
e.stopPropagation();
|
|
28248
|
+
nextItem(item, e.key)?.focus();
|
|
28249
|
+
}).on(form, 'focusin', (e)=>{
|
|
28250
|
+
if (items.includes(e.target)) {
|
|
28251
|
+
items.forEach((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'tabindex', item === e.target ? 0 : -1));
|
|
28158
28252
|
}
|
|
28159
28253
|
});
|
|
28160
28254
|
editor.e.fire('afterGenerateColorPicker', form, extra, callback, valueHex);
|
|
@@ -29317,7 +29411,8 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
29317
29411
|
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
29318
29412
|
/* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(59400);
|
|
29319
29413
|
/* harmony import */ var jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(5658);
|
|
29320
|
-
/* harmony import */ var
|
|
29414
|
+
/* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(29434);
|
|
29415
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(95085);
|
|
29321
29416
|
/*!
|
|
29322
29417
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
29323
29418
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -29337,14 +29432,21 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
29337
29432
|
|
|
29338
29433
|
|
|
29339
29434
|
|
|
29340
|
-
|
|
29341
|
-
const MARKER = [
|
|
29342
|
-
'id',
|
|
29343
|
-
'name'
|
|
29344
|
-
].map((key)=>`.jodit-wysiwyg a[${key}]:not([href]):empty::before`).join(',');
|
|
29435
|
+
|
|
29345
29436
|
/**
|
|
29346
|
-
*
|
|
29347
|
-
|
|
29437
|
+
* The editing area of an editor with the plugin, when it shares its document
|
|
29438
|
+
* with the page and so with any other editor on it
|
|
29439
|
+
*/ const WITH_ANCHORS = 'jodit-wysiwyg_anchors';
|
|
29440
|
+
/**
|
|
29441
|
+
* Each anchor's marker, in the editing areas `scope` picks out
|
|
29442
|
+
*/ function markerStyle(scope) {
|
|
29443
|
+
const marker = [
|
|
29444
|
+
'id',
|
|
29445
|
+
'name'
|
|
29446
|
+
].map((key)=>`.jodit-wysiwyg${scope} a[${key}]:not([href]):empty::before`).join(',');
|
|
29447
|
+
const icon = `url("data:image/svg+xml,${encodeURIComponent(jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__.Icon.get('anchor'))}") center/contain no-repeat`;
|
|
29448
|
+
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:''}`;
|
|
29449
|
+
}
|
|
29348
29450
|
/**
|
|
29349
29451
|
* The attribute `markAnchor` gives an anchor: an empty `<a>` with no `href`
|
|
29350
29452
|
*/ const MARK = ' contenteditable="false"';
|
|
@@ -29353,8 +29455,14 @@ const MARKER = [
|
|
|
29353
29455
|
* `#name`, and renames and removes them
|
|
29354
29456
|
*/ class anchor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
29355
29457
|
/** @override */ afterInit(jodit) {
|
|
29458
|
+
// An iframe's document is the editor's alone, and its body is part of
|
|
29459
|
+
// the value with `editHTMLDocumentMode`, so it gets no class
|
|
29460
|
+
const shared = jodit.ed === jodit.od;
|
|
29461
|
+
if (shared) {
|
|
29462
|
+
jodit.editor.classList.add(WITH_ANCHORS);
|
|
29463
|
+
}
|
|
29356
29464
|
// It goes in the editing document, so iframe mode has it whatever `iframeStyle` holds
|
|
29357
|
-
(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent =
|
|
29465
|
+
;(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent = markerStyle(shared ? '.' + WITH_ANCHORS : '');
|
|
29358
29466
|
jodit.e.on('generateAnchorForm.anchor', this.__generateForm).on('clickA touchstartA', this.__onClickA, {
|
|
29359
29467
|
top: true
|
|
29360
29468
|
});
|
|
@@ -29386,6 +29494,24 @@ const MARKER = [
|
|
|
29386
29494
|
*/ onAfterGetValueFromEditor(data) {
|
|
29387
29495
|
data.value = unmarkAnchors(data.value);
|
|
29388
29496
|
}
|
|
29497
|
+
/**
|
|
29498
|
+
* A pasted or dropped copy of an anchor the document already has gets the
|
|
29499
|
+
* next free name, as `fees-2`, and the links that came with it follow it
|
|
29500
|
+
*/ onBeforePasteInsert(html) {
|
|
29501
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(html) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isFragment(html)) {
|
|
29502
|
+
this.__renameCopies(html);
|
|
29503
|
+
return;
|
|
29504
|
+
}
|
|
29505
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) || !/<a\s/i.test(html)) {
|
|
29506
|
+
return;
|
|
29507
|
+
}
|
|
29508
|
+
// Inert, so nothing in it loads
|
|
29509
|
+
const template = this.j.createInside.element('template');
|
|
29510
|
+
template.innerHTML = html;
|
|
29511
|
+
if (this.__renameCopies(template.content)) {
|
|
29512
|
+
return template.innerHTML;
|
|
29513
|
+
}
|
|
29514
|
+
}
|
|
29389
29515
|
/**
|
|
29390
29516
|
* The form that names a new anchor, or renames or removes `target`
|
|
29391
29517
|
*/ __generateForm(target, close) {
|
|
@@ -29525,8 +29651,51 @@ const MARKER = [
|
|
|
29525
29651
|
}
|
|
29526
29652
|
});
|
|
29527
29653
|
}
|
|
29654
|
+
/**
|
|
29655
|
+
* Gives each anchor in `root` whose name the document already has the
|
|
29656
|
+
* next free one, avoiding the names in `root` too, and points the links
|
|
29657
|
+
* in `root` to it at the new name. Whether any was renamed
|
|
29658
|
+
*/ __renameCopies(root) {
|
|
29659
|
+
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')));
|
|
29660
|
+
const renamed = new Map();
|
|
29661
|
+
const anchors = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isAnchor)(root) ? [
|
|
29662
|
+
root
|
|
29663
|
+
] : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchors)(root);
|
|
29664
|
+
anchors.forEach((anchor)=>{
|
|
29665
|
+
const name = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchorName)(anchor);
|
|
29666
|
+
if (!this.__isTaken(name, null)) {
|
|
29667
|
+
return;
|
|
29668
|
+
}
|
|
29669
|
+
let copy = name;
|
|
29670
|
+
for(let n = 2; inRoot.has(copy) || this.__isTaken(copy, null); n += 1){
|
|
29671
|
+
copy = `${name}-${n}`;
|
|
29672
|
+
}
|
|
29673
|
+
[
|
|
29674
|
+
'id',
|
|
29675
|
+
'name'
|
|
29676
|
+
].forEach((key)=>{
|
|
29677
|
+
if (anchor.hasAttribute(key)) {
|
|
29678
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(anchor, key, copy);
|
|
29679
|
+
}
|
|
29680
|
+
});
|
|
29681
|
+
inRoot.add(copy);
|
|
29682
|
+
renamed.set(name, copy);
|
|
29683
|
+
});
|
|
29684
|
+
if (!renamed.size) {
|
|
29685
|
+
return false;
|
|
29686
|
+
}
|
|
29687
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.toArray)(root.querySelectorAll('a[href]')).forEach((link)=>{
|
|
29688
|
+
const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') ?? '';
|
|
29689
|
+
const copy = href[0] === '#' && renamed.get(href.slice(1));
|
|
29690
|
+
if (copy) {
|
|
29691
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href', '#' + copy);
|
|
29692
|
+
}
|
|
29693
|
+
});
|
|
29694
|
+
return true;
|
|
29695
|
+
}
|
|
29528
29696
|
/** @override */ beforeDestruct(jodit) {
|
|
29529
29697
|
this.__dropForm();
|
|
29698
|
+
jodit.editor.classList.remove(WITH_ANCHORS);
|
|
29530
29699
|
jodit.e.off('generateAnchorForm.anchor', this.__generateForm).off('clickA touchstartA', this.__onClickA);
|
|
29531
29700
|
}
|
|
29532
29701
|
constructor(...args){
|
|
@@ -29556,6 +29725,9 @@ const MARKER = [
|
|
|
29556
29725
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
29557
29726
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':afterGetValueFromEditor')
|
|
29558
29727
|
], anchor.prototype, "onAfterGetValueFromEditor", null);
|
|
29728
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
29729
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':beforePasteInsert')
|
|
29730
|
+
], anchor.prototype, "onBeforePasteInsert", null);
|
|
29559
29731
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
29560
29732
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
29561
29733
|
], anchor.prototype, "__generateForm", null);
|
|
@@ -36214,6 +36386,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.fullsize = {
|
|
|
36214
36386
|
exec: (editor)=>{
|
|
36215
36387
|
editor.toggleFullSize();
|
|
36216
36388
|
},
|
|
36389
|
+
// Makes it a toggle. `update` sets the state, which holds while the editor doesn't have the focus
|
|
36390
|
+
isActive: (editor)=>editor.isFullSize,
|
|
36217
36391
|
update (editor, button) {
|
|
36218
36392
|
const mode = editor.isFullSize ? 'shrink' : 'fullsize';
|
|
36219
36393
|
button.state.activated = editor.isFullSize;
|
|
@@ -36583,9 +36757,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('hotkeys', hotke
|
|
|
36583
36757
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__.Icon.set('hr', (_hr_svg__WEBPACK_IMPORTED_MODULE_4___default()));
|
|
36584
36758
|
jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.hr = {
|
|
36585
36759
|
command: 'insertHorizontalRule',
|
|
36586
|
-
tags: [
|
|
36587
|
-
'hr'
|
|
36588
|
-
],
|
|
36589
36760
|
tooltip: 'Insert Horizontal Line'
|
|
36590
36761
|
};
|
|
36591
36762
|
function hr(editor) {
|
|
@@ -41209,9 +41380,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.defaultLineHeight = n
|
|
|
41209
41380
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__.Icon.set('line-height', (_line_height_svg__WEBPACK_IMPORTED_MODULE_3___default()));
|
|
41210
41381
|
jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.lineHeight = {
|
|
41211
41382
|
command: 'applyLineHeight',
|
|
41212
|
-
tags: [
|
|
41213
|
-
'ol'
|
|
41214
|
-
],
|
|
41215
41383
|
tooltip: 'Line height',
|
|
41216
41384
|
list: [
|
|
41217
41385
|
1,
|
|
@@ -42151,7 +42319,9 @@ const formTemplate = (editor)=>{
|
|
|
42151
42319
|
new jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIBlock(editor, [
|
|
42152
42320
|
new jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIInput(editor, {
|
|
42153
42321
|
name: 'url',
|
|
42154
|
-
|
|
42322
|
+
// Touch keyboards leave a URL field as typed, with no capital or
|
|
42323
|
+
// correction. The form is `novalidate`, so any address still goes in
|
|
42324
|
+
type: 'url',
|
|
42155
42325
|
ref: 'url_input',
|
|
42156
42326
|
label: 'URL',
|
|
42157
42327
|
placeholder: 'http://',
|
|
@@ -45179,6 +45349,13 @@ const IFRAME_WRAPPER = '[data-jodit_iframe_wrapper]';
|
|
|
45179
45349
|
this.addEventListeners();
|
|
45180
45350
|
this.__onChangeEditor();
|
|
45181
45351
|
}
|
|
45352
|
+
/**
|
|
45353
|
+
* A tap that selects an image sends no `click` (iPadOS), so `touchend`
|
|
45354
|
+
* stands in for it. A tick later, after `onClickOutside` has had the same
|
|
45355
|
+
* `touchend`, as `click` comes after `mouseup`
|
|
45356
|
+
*/ onEditorTouchEnd(e) {
|
|
45357
|
+
this.j.async.setTimeout(()=>this.onEditorClick(e), 1);
|
|
45358
|
+
}
|
|
45182
45359
|
/**
|
|
45183
45360
|
* Click in the editor area
|
|
45184
45361
|
*/ onEditorClick(e) {
|
|
@@ -45603,6 +45780,9 @@ const IFRAME_WRAPPER = '[data-jodit_iframe_wrapper]';
|
|
|
45603
45780
|
}
|
|
45604
45781
|
}
|
|
45605
45782
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
45783
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':touchend')
|
|
45784
|
+
], resizer.prototype, "onEditorTouchEnd", null);
|
|
45785
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
45606
45786
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':click')
|
|
45607
45787
|
], resizer.prototype, "onEditorClick", null);
|
|
45608
45788
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|