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.
- package/CHANGELOG.md +12 -0
- package/es2015/jodit.css +68 -9
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +8 -8
- package/es2015/jodit.js +221 -53
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +5 -5
- 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 +8 -8
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +5 -5
- 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 +9 -9
- package/es2021/jodit.js +217 -53
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +5 -5
- 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 +17 -17
- package/es2021.en/jodit.js +217 -53
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +17 -17
- 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 +262 -55
- 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/modules/toolbar/button/button.d.ts +10 -0
- package/esm/modules/toolbar/button/button.js +17 -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/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/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;
|
|
@@ -26122,9 +26122,20 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
|
|
|
26122
26122
|
}
|
|
26123
26123
|
return Boolean(tc && tc.shouldBeDisabled(this));
|
|
26124
26124
|
}
|
|
26125
|
-
|
|
26126
|
-
|
|
26127
|
-
|
|
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);
|
|
26128
26139
|
}
|
|
26129
26140
|
onChangeText() {
|
|
26130
26141
|
if ((0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_11__.isFunction)(this.control.template)) {
|
|
@@ -26184,6 +26195,8 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_20__.U
|
|
|
26184
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;
|
|
26185
26196
|
}
|
|
26186
26197
|
state.hasTrigger = Boolean(ctr.list || ctr.popup && ctr.exec);
|
|
26198
|
+
// UIButton's template makes every button a toggle
|
|
26199
|
+
this.onChangeActivated();
|
|
26187
26200
|
}
|
|
26188
26201
|
__initIconFromControl() {
|
|
26189
26202
|
const { control: ctr, state } = this;
|
|
@@ -26743,7 +26756,8 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
26743
26756
|
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
|
|
26744
26757
|
/* harmony import */ var jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62101);
|
|
26745
26758
|
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85932);
|
|
26746
|
-
/* 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);
|
|
26747
26761
|
/*!
|
|
26748
26762
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
26749
26763
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -26756,10 +26770,15 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
26756
26770
|
|
|
26757
26771
|
|
|
26758
26772
|
|
|
26759
|
-
|
|
26773
|
+
|
|
26774
|
+
class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton {
|
|
26760
26775
|
className() {
|
|
26761
26776
|
return 'ToolbarSelect';
|
|
26762
26777
|
}
|
|
26778
|
+
// It shows its value, rather than being on or off
|
|
26779
|
+
get isToggle() {
|
|
26780
|
+
return false;
|
|
26781
|
+
}
|
|
26763
26782
|
update() {
|
|
26764
26783
|
super.update();
|
|
26765
26784
|
this.state.icon.name = '';
|
|
@@ -26774,6 +26793,17 @@ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
|
|
|
26774
26793
|
this.state.text = this.control.textTemplate?.(this.jodit, text) ?? text;
|
|
26775
26794
|
}
|
|
26776
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
|
+
}
|
|
26777
26807
|
}
|
|
26778
26808
|
ToolbarSelect = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__._)([
|
|
26779
26809
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
|
|
@@ -28036,11 +28066,12 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
28036
28066
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
28037
28067
|
|
|
28038
28068
|
"use strict";
|
|
28039
|
-
/* harmony import */ var
|
|
28040
|
-
/* harmony import */ var
|
|
28041
|
-
/* harmony import */ var
|
|
28042
|
-
/* harmony import */ var
|
|
28043
|
-
/* 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__);
|
|
28044
28075
|
/*!
|
|
28045
28076
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28046
28077
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28054,7 +28085,8 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
28054
28085
|
|
|
28055
28086
|
|
|
28056
28087
|
|
|
28057
|
-
|
|
28088
|
+
|
|
28089
|
+
jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_4___default()));
|
|
28058
28090
|
/**
|
|
28059
28091
|
* Build color picker
|
|
28060
28092
|
*
|
|
@@ -28072,29 +28104,53 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28072
28104
|
* });
|
|
28073
28105
|
* ```
|
|
28074
28106
|
*/ const ColorPickerWidget = (editor, callback, coldColor)=>{
|
|
28075
|
-
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)=>{
|
|
28076
28108
|
const stack = [];
|
|
28077
|
-
if ((0,
|
|
28109
|
+
if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(colors)) {
|
|
28078
28110
|
Object.keys(colors).forEach((key)=>{
|
|
28079
28111
|
stack.push(`<div class="${cn}__group ${cn}__group-${key}">`);
|
|
28080
28112
|
stack.push(eachColor(colors[key]));
|
|
28081
28113
|
stack.push('</div>');
|
|
28082
28114
|
});
|
|
28083
|
-
} else if ((0,
|
|
28115
|
+
} else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isArray)(colors)) {
|
|
28084
28116
|
colors.forEach((color)=>{
|
|
28085
|
-
|
|
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>`);
|
|
28086
28119
|
});
|
|
28087
28120
|
}
|
|
28088
28121
|
return stack.join('');
|
|
28089
28122
|
};
|
|
28090
28123
|
// The group wrapper lays the colors out in rows, so a flat list needs one
|
|
28091
28124
|
// too. See #1487
|
|
28092
|
-
const groups = (0,
|
|
28093
|
-
|
|
28094
|
-
|
|
28095
|
-
|
|
28096
|
-
|
|
28097
|
-
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);
|
|
28098
28154
|
// Enter applies the value and closes the popup; removing the focused
|
|
28099
28155
|
// input then makes Chrome fire `change` on it, which would apply the
|
|
28100
28156
|
// same color a second time and toggle it off again. See #1459
|
|
@@ -28109,8 +28165,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28109
28165
|
if (!isHex && !isRgb) {
|
|
28110
28166
|
return;
|
|
28111
28167
|
}
|
|
28112
|
-
const color = (0,
|
|
28113
|
-
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)) {
|
|
28114
28170
|
appliedHexValue = raw;
|
|
28115
28171
|
callback(color);
|
|
28116
28172
|
}
|
|
@@ -28125,40 +28181,74 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28125
28181
|
e.stopPropagation();
|
|
28126
28182
|
applyHexInput();
|
|
28127
28183
|
});
|
|
28128
|
-
|
|
28129
|
-
if (editor.o.showBrowserColorPicker && (0,
|
|
28130
|
-
|
|
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>`));
|
|
28131
28187
|
editor.e.on(form, 'change', (e)=>{
|
|
28132
28188
|
e.stopPropagation();
|
|
28133
28189
|
const target = e.target;
|
|
28134
|
-
if (!target || !target.tagName || !
|
|
28190
|
+
if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(target, 'input') || target.type !== 'color') {
|
|
28135
28191
|
return;
|
|
28136
28192
|
}
|
|
28137
28193
|
const color = target.value || '';
|
|
28138
|
-
if ((0,
|
|
28194
|
+
if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
|
|
28139
28195
|
callback(color);
|
|
28140
28196
|
}
|
|
28141
28197
|
e.preventDefault();
|
|
28142
28198
|
});
|
|
28143
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;
|
|
28144
28214
|
editor.e.on(form, 'mousedown touchend', (e)=>{
|
|
28145
28215
|
// let the hex/native inputs receive focus and clicks
|
|
28146
|
-
if (
|
|
28216
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(e.target, 'input')) {
|
|
28147
28217
|
e.stopPropagation();
|
|
28148
28218
|
return;
|
|
28149
28219
|
}
|
|
28150
28220
|
e.stopPropagation();
|
|
28151
28221
|
e.preventDefault();
|
|
28152
|
-
|
|
28153
|
-
if (
|
|
28154
|
-
|
|
28222
|
+
const color = colorOf(e.target);
|
|
28223
|
+
if (color !== undefined) {
|
|
28224
|
+
pointerPressed = e.type === 'mousedown';
|
|
28225
|
+
apply(color);
|
|
28155
28226
|
}
|
|
28156
|
-
|
|
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)) {
|
|
28157
28243
|
return;
|
|
28158
28244
|
}
|
|
28159
|
-
|
|
28160
|
-
|
|
28161
|
-
|
|
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));
|
|
28162
28252
|
}
|
|
28163
28253
|
});
|
|
28164
28254
|
editor.e.fire('afterGenerateColorPicker', form, extra, callback, valueHex);
|
|
@@ -29321,7 +29411,8 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
29321
29411
|
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
29322
29412
|
/* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(59400);
|
|
29323
29413
|
/* harmony import */ var jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(5658);
|
|
29324
|
-
/* 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);
|
|
29325
29416
|
/*!
|
|
29326
29417
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
29327
29418
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -29341,14 +29432,21 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
29341
29432
|
|
|
29342
29433
|
|
|
29343
29434
|
|
|
29344
|
-
|
|
29345
|
-
const MARKER = [
|
|
29346
|
-
'id',
|
|
29347
|
-
'name'
|
|
29348
|
-
].map((key)=>`.jodit-wysiwyg a[${key}]:not([href]):empty::before`).join(',');
|
|
29435
|
+
|
|
29349
29436
|
/**
|
|
29350
|
-
*
|
|
29351
|
-
|
|
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
|
+
}
|
|
29352
29450
|
/**
|
|
29353
29451
|
* The attribute `markAnchor` gives an anchor: an empty `<a>` with no `href`
|
|
29354
29452
|
*/ const MARK = ' contenteditable="false"';
|
|
@@ -29357,8 +29455,14 @@ const MARKER = [
|
|
|
29357
29455
|
* `#name`, and renames and removes them
|
|
29358
29456
|
*/ class anchor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
29359
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
|
+
}
|
|
29360
29464
|
// It goes in the editing document, so iframe mode has it whatever `iframeStyle` holds
|
|
29361
|
-
(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 : '');
|
|
29362
29466
|
jodit.e.on('generateAnchorForm.anchor', this.__generateForm).on('clickA touchstartA', this.__onClickA, {
|
|
29363
29467
|
top: true
|
|
29364
29468
|
});
|
|
@@ -29390,6 +29494,24 @@ const MARKER = [
|
|
|
29390
29494
|
*/ onAfterGetValueFromEditor(data) {
|
|
29391
29495
|
data.value = unmarkAnchors(data.value);
|
|
29392
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
|
+
}
|
|
29393
29515
|
/**
|
|
29394
29516
|
* The form that names a new anchor, or renames or removes `target`
|
|
29395
29517
|
*/ __generateForm(target, close) {
|
|
@@ -29529,8 +29651,51 @@ const MARKER = [
|
|
|
29529
29651
|
}
|
|
29530
29652
|
});
|
|
29531
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
|
+
}
|
|
29532
29696
|
/** @override */ beforeDestruct(jodit) {
|
|
29533
29697
|
this.__dropForm();
|
|
29698
|
+
jodit.editor.classList.remove(WITH_ANCHORS);
|
|
29534
29699
|
jodit.e.off('generateAnchorForm.anchor', this.__generateForm).off('clickA touchstartA', this.__onClickA);
|
|
29535
29700
|
}
|
|
29536
29701
|
constructor(...args){
|
|
@@ -29560,6 +29725,9 @@ const MARKER = [
|
|
|
29560
29725
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
29561
29726
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':afterGetValueFromEditor')
|
|
29562
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);
|
|
29563
29731
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
29564
29732
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
29565
29733
|
], anchor.prototype, "__generateForm", null);
|
|
@@ -36218,6 +36386,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.fullsize = {
|
|
|
36218
36386
|
exec: (editor)=>{
|
|
36219
36387
|
editor.toggleFullSize();
|
|
36220
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,
|
|
36221
36391
|
update (editor, button) {
|
|
36222
36392
|
const mode = editor.isFullSize ? 'shrink' : 'fullsize';
|
|
36223
36393
|
button.state.activated = editor.isFullSize;
|
|
@@ -36587,9 +36757,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('hotkeys', hotke
|
|
|
36587
36757
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__.Icon.set('hr', (_hr_svg__WEBPACK_IMPORTED_MODULE_4___default()));
|
|
36588
36758
|
jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.hr = {
|
|
36589
36759
|
command: 'insertHorizontalRule',
|
|
36590
|
-
tags: [
|
|
36591
|
-
'hr'
|
|
36592
|
-
],
|
|
36593
36760
|
tooltip: 'Insert Horizontal Line'
|
|
36594
36761
|
};
|
|
36595
36762
|
function hr(editor) {
|
|
@@ -41213,9 +41380,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.defaultLineHeight = n
|
|
|
41213
41380
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__.Icon.set('line-height', (_line_height_svg__WEBPACK_IMPORTED_MODULE_3___default()));
|
|
41214
41381
|
jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.lineHeight = {
|
|
41215
41382
|
command: 'applyLineHeight',
|
|
41216
|
-
tags: [
|
|
41217
|
-
'ol'
|
|
41218
|
-
],
|
|
41219
41383
|
tooltip: 'Line height',
|
|
41220
41384
|
list: [
|
|
41221
41385
|
1,
|