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/es2015/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
|
*/
|
|
@@ -1830,7 +1830,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1830
1830
|
* ```
|
|
1831
1831
|
* @packageDocumentation
|
|
1832
1832
|
* @module constants
|
|
1833
|
-
*/ const APP_VERSION = "4.20.
|
|
1833
|
+
*/ const APP_VERSION = "4.20.2";
|
|
1834
1834
|
// prettier-ignore
|
|
1835
1835
|
const ES = "es2015";
|
|
1836
1836
|
const IS_ES_MODERN = true;
|
|
@@ -26358,9 +26358,20 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_22__.U
|
|
|
26358
26358
|
}
|
|
26359
26359
|
return Boolean(tc && tc.shouldBeDisabled(this));
|
|
26360
26360
|
}
|
|
26361
|
-
|
|
26362
|
-
|
|
26363
|
-
|
|
26361
|
+
/**
|
|
26362
|
+
* A button that its control can show as on is a toggle, and says whether
|
|
26363
|
+
* it's pressed
|
|
26364
|
+
*/ get isToggle() {
|
|
26365
|
+
const { isActive, tags, css } = this.control;
|
|
26366
|
+
return Boolean(isActive || tags || css);
|
|
26367
|
+
}
|
|
26368
|
+
/**
|
|
26369
|
+
* The pressed look comes from the mod, as any button looks pressed while
|
|
26370
|
+
* its list is open, and the container is a `listitem`, which can't have
|
|
26371
|
+
* `aria-pressed`
|
|
26372
|
+
*/ onChangeActivated() {
|
|
26373
|
+
;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_20__.attr)(this.button, 'aria-pressed', this.isToggle ? this.state.activated : null);
|
|
26374
|
+
this.setMod('activated', this.state.activated || null);
|
|
26364
26375
|
}
|
|
26365
26376
|
onChangeText() {
|
|
26366
26377
|
if ((0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_13__.isFunction)(this.control.template)) {
|
|
@@ -26421,6 +26432,8 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_22__.U
|
|
|
26421
26432
|
state.tooltip = (0,jodit_core_helpers_checker_is_function__WEBPACK_IMPORTED_MODULE_13__.isFunction)(ctr.tooltip) ? ctr.tooltip(this.j, ctr, this) : ctr.tooltip;
|
|
26422
26433
|
}
|
|
26423
26434
|
state.hasTrigger = Boolean(ctr.list || ctr.popup && ctr.exec);
|
|
26435
|
+
// UIButton's template makes every button a toggle
|
|
26436
|
+
this.onChangeActivated();
|
|
26424
26437
|
}
|
|
26425
26438
|
__initIconFromControl() {
|
|
26426
26439
|
const { control: ctr, state } = this;
|
|
@@ -26991,7 +27004,8 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
26991
27004
|
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84839);
|
|
26992
27005
|
/* harmony import */ var jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62101);
|
|
26993
27006
|
/* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(85932);
|
|
26994
|
-
/* harmony import */ var
|
|
27007
|
+
/* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7909);
|
|
27008
|
+
/* harmony import */ var _button__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22533);
|
|
26995
27009
|
/*!
|
|
26996
27010
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
26997
27011
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -27004,10 +27018,15 @@ ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
27004
27018
|
|
|
27005
27019
|
|
|
27006
27020
|
|
|
27007
|
-
|
|
27021
|
+
|
|
27022
|
+
class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_5__.ToolbarButton {
|
|
27008
27023
|
className() {
|
|
27009
27024
|
return 'ToolbarSelect';
|
|
27010
27025
|
}
|
|
27026
|
+
// It shows its value, rather than being on or off
|
|
27027
|
+
get isToggle() {
|
|
27028
|
+
return false;
|
|
27029
|
+
}
|
|
27011
27030
|
update() {
|
|
27012
27031
|
super.update();
|
|
27013
27032
|
this.state.icon.name = '';
|
|
@@ -27024,6 +27043,18 @@ class ToolbarSelect extends _button__WEBPACK_IMPORTED_MODULE_4__.ToolbarButton {
|
|
|
27024
27043
|
this.state.text = (_ref = (_this_control_textTemplate = (_this_control = this.control).textTemplate) === null || _this_control_textTemplate === void 0 ? void 0 : _this_control_textTemplate.call(_this_control, this.jodit, text)) !== null && _ref !== void 0 ? _ref : text;
|
|
27025
27044
|
}
|
|
27026
27045
|
}
|
|
27046
|
+
/**
|
|
27047
|
+
* The button shows only the value, so its name says which control it
|
|
27048
|
+
* is too: "Font size, 16px"
|
|
27049
|
+
*/ updateAriaLabel() {
|
|
27050
|
+
var _this_text_textContent;
|
|
27051
|
+
super.updateAriaLabel();
|
|
27052
|
+
const { tooltip } = this.state;
|
|
27053
|
+
const value = (_this_text_textContent = this.text.textContent) === null || _this_text_textContent === void 0 ? void 0 : _this_text_textContent.trim();
|
|
27054
|
+
if (tooltip && value) {
|
|
27055
|
+
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_4__.attr)(this.button, 'aria-label', `${this.jodit.i18n(tooltip)}, ${value}`);
|
|
27056
|
+
}
|
|
27057
|
+
}
|
|
27027
27058
|
}
|
|
27028
27059
|
ToolbarSelect = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__._)([
|
|
27029
27060
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_1__.component
|
|
@@ -28300,11 +28331,12 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
28300
28331
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
28301
28332
|
|
|
28302
28333
|
"use strict";
|
|
28303
|
-
/* harmony import */ var
|
|
28304
|
-
/* harmony import */ var
|
|
28305
|
-
/* harmony import */ var
|
|
28306
|
-
/* harmony import */ var
|
|
28307
|
-
/* harmony import */ var
|
|
28334
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
|
|
28335
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
|
|
28336
|
+
/* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(65946);
|
|
28337
|
+
/* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4099);
|
|
28338
|
+
/* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(54522);
|
|
28339
|
+
/* harmony import */ var _palette_svg__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_palette_svg__WEBPACK_IMPORTED_MODULE_4__);
|
|
28308
28340
|
/*!
|
|
28309
28341
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
28310
28342
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -28318,7 +28350,8 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
28318
28350
|
|
|
28319
28351
|
|
|
28320
28352
|
|
|
28321
|
-
|
|
28353
|
+
|
|
28354
|
+
jodit_core_ui__WEBPACK_IMPORTED_MODULE_3__.Icon.set('palette', (_palette_svg__WEBPACK_IMPORTED_MODULE_4___default()));
|
|
28322
28355
|
/**
|
|
28323
28356
|
* Build color picker
|
|
28324
28357
|
*
|
|
@@ -28336,29 +28369,54 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28336
28369
|
* });
|
|
28337
28370
|
* ```
|
|
28338
28371
|
*/ const ColorPickerWidget = (editor, callback, coldColor)=>{
|
|
28339
|
-
|
|
28372
|
+
var _items_find;
|
|
28373
|
+
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)=>{
|
|
28340
28374
|
const stack = [];
|
|
28341
|
-
if ((0,
|
|
28375
|
+
if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(colors)) {
|
|
28342
28376
|
Object.keys(colors).forEach((key)=>{
|
|
28343
28377
|
stack.push(`<div class="${cn}__group ${cn}__group-${key}">`);
|
|
28344
28378
|
stack.push(eachColor(colors[key]));
|
|
28345
28379
|
stack.push('</div>');
|
|
28346
28380
|
});
|
|
28347
|
-
} else if ((0,
|
|
28381
|
+
} else if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isArray)(colors)) {
|
|
28348
28382
|
colors.forEach((color)=>{
|
|
28349
|
-
|
|
28383
|
+
const active = valueHex === color;
|
|
28384
|
+
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>`);
|
|
28350
28385
|
});
|
|
28351
28386
|
}
|
|
28352
28387
|
return stack.join('');
|
|
28353
28388
|
};
|
|
28354
28389
|
// The group wrapper lays the colors out in rows, so a flat list needs one
|
|
28355
28390
|
// too. See #1487
|
|
28356
|
-
const groups = (0,
|
|
28357
|
-
|
|
28358
|
-
|
|
28359
|
-
|
|
28360
|
-
|
|
28361
|
-
const
|
|
28391
|
+
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);
|
|
28392
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div class="${cn}__groups">${groups}</div>`));
|
|
28393
|
+
const items = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.toArray)(form.querySelectorAll(`.${cn}__color-item`));
|
|
28394
|
+
// Tab stops at one color, the current one or the first, and the arrow
|
|
28395
|
+
// keys move from it
|
|
28396
|
+
const tabStop = (_items_find = items.find((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'aria-pressed') === 'true')) !== null && _items_find !== void 0 ? _items_find : items[0];
|
|
28397
|
+
if (tabStop) {
|
|
28398
|
+
(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(tabStop, 'tabindex', 0);
|
|
28399
|
+
}
|
|
28400
|
+
// Along a row, or to the nearest color in the row above or below, as the
|
|
28401
|
+
// palette is laid out
|
|
28402
|
+
const nextItem = (item, key)=>{
|
|
28403
|
+
const index = items.indexOf(item);
|
|
28404
|
+
if (key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT || key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT) {
|
|
28405
|
+
const step = key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT ? -1 : 1;
|
|
28406
|
+
const rtl = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.css)(item, 'direction') === 'rtl';
|
|
28407
|
+
return items[index + (rtl ? -step : step)];
|
|
28408
|
+
}
|
|
28409
|
+
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);
|
|
28410
|
+
if (!rows.length) {
|
|
28411
|
+
return;
|
|
28412
|
+
}
|
|
28413
|
+
const top = (down ? Math.min : Math.max)(...rows.map((other)=>other.offsetTop)), distance = (other)=>Math.abs(other.offsetLeft - item.offsetLeft);
|
|
28414
|
+
return rows.filter((other)=>other.offsetTop === top).reduce((nearest, other)=>distance(other) < distance(nearest) ? other : nearest);
|
|
28415
|
+
};
|
|
28416
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(form, editor.c.fromHTML(`<div data-ref="extra" class="${cn}__extra"></div>`));
|
|
28417
|
+
const { extra } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
|
|
28418
|
+
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>`));
|
|
28419
|
+
const { hexInput } = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.refs)(form);
|
|
28362
28420
|
// Enter applies the value and closes the popup; removing the focused
|
|
28363
28421
|
// input then makes Chrome fire `change` on it, which would apply the
|
|
28364
28422
|
// same color a second time and toggle it off again. See #1459
|
|
@@ -28373,8 +28431,8 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28373
28431
|
if (!isHex && !isRgb) {
|
|
28374
28432
|
return;
|
|
28375
28433
|
}
|
|
28376
|
-
const color = (0,
|
|
28377
|
-
if (color && (0,
|
|
28434
|
+
const color = (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.normalizeColor)(isHex && !raw.startsWith('#') ? '#' + raw : raw);
|
|
28435
|
+
if (color && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
|
|
28378
28436
|
appliedHexValue = raw;
|
|
28379
28437
|
callback(color);
|
|
28380
28438
|
}
|
|
@@ -28389,40 +28447,75 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
28389
28447
|
e.stopPropagation();
|
|
28390
28448
|
applyHexInput();
|
|
28391
28449
|
});
|
|
28392
|
-
|
|
28393
|
-
if (editor.o.showBrowserColorPicker && (0,
|
|
28394
|
-
|
|
28450
|
+
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>`));
|
|
28451
|
+
if (editor.o.showBrowserColorPicker && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.hasBrowserColorPicker)()) {
|
|
28452
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(extra, editor.c.fromHTML(`<div class="${cn}__native">${iconPalette}<input type="color" value="#ffffff"/></div>`));
|
|
28395
28453
|
editor.e.on(form, 'change', (e)=>{
|
|
28396
28454
|
e.stopPropagation();
|
|
28397
28455
|
const target = e.target;
|
|
28398
|
-
if (!target || !target.tagName || !
|
|
28456
|
+
if (!target || !target.tagName || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(target, 'input') || target.type !== 'color') {
|
|
28399
28457
|
return;
|
|
28400
28458
|
}
|
|
28401
28459
|
const color = target.value || '';
|
|
28402
|
-
if ((0,
|
|
28460
|
+
if ((0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
|
|
28403
28461
|
callback(color);
|
|
28404
28462
|
}
|
|
28405
28463
|
e.preventDefault();
|
|
28406
28464
|
});
|
|
28407
28465
|
}
|
|
28466
|
+
// The color of a swatch, or '' for Remove, from an event on it or its icon
|
|
28467
|
+
const colorOf = (node)=>{
|
|
28468
|
+
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);
|
|
28469
|
+
return button ? (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(button, '-color') || '' : undefined;
|
|
28470
|
+
};
|
|
28471
|
+
const apply = (color)=>{
|
|
28472
|
+
if (callback && (0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.isFunction)(callback)) {
|
|
28473
|
+
callback(color);
|
|
28474
|
+
}
|
|
28475
|
+
};
|
|
28476
|
+
// A pointer applies the color on `mousedown`, which keeps the selection.
|
|
28477
|
+
// The keyboard and screen readers press the button, which sends only
|
|
28478
|
+
// `click`, so a click after the pointer's `mousedown` is skipped
|
|
28479
|
+
let pointerPressed = false;
|
|
28408
28480
|
editor.e.on(form, 'mousedown touchend', (e)=>{
|
|
28409
28481
|
// let the hex/native inputs receive focus and clicks
|
|
28410
|
-
if (
|
|
28482
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(e.target, 'input')) {
|
|
28411
28483
|
e.stopPropagation();
|
|
28412
28484
|
return;
|
|
28413
28485
|
}
|
|
28414
28486
|
e.stopPropagation();
|
|
28415
28487
|
e.preventDefault();
|
|
28416
|
-
|
|
28417
|
-
if (
|
|
28418
|
-
|
|
28488
|
+
const color = colorOf(e.target);
|
|
28489
|
+
if (color !== undefined) {
|
|
28490
|
+
pointerPressed = e.type === 'mousedown';
|
|
28491
|
+
apply(color);
|
|
28419
28492
|
}
|
|
28420
|
-
|
|
28493
|
+
});
|
|
28494
|
+
editor.e.on(form, 'click', (e)=>{
|
|
28495
|
+
const color = colorOf(e.target);
|
|
28496
|
+
if (color !== undefined && !pointerPressed) {
|
|
28497
|
+
apply(color);
|
|
28498
|
+
}
|
|
28499
|
+
pointerPressed = false;
|
|
28500
|
+
}).on(form, 'keydown', (e)=>{
|
|
28501
|
+
var _nextItem;
|
|
28502
|
+
pointerPressed = false;
|
|
28503
|
+
const item = e.target;
|
|
28504
|
+
if (!items.includes(item) || ![
|
|
28505
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT,
|
|
28506
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_RIGHT,
|
|
28507
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_UP,
|
|
28508
|
+
jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_DOWN
|
|
28509
|
+
].includes(e.key)) {
|
|
28421
28510
|
return;
|
|
28422
28511
|
}
|
|
28423
|
-
|
|
28424
|
-
|
|
28425
|
-
|
|
28512
|
+
// The toolbar's dropdown would walk every color one by one
|
|
28513
|
+
e.preventDefault();
|
|
28514
|
+
e.stopPropagation();
|
|
28515
|
+
(_nextItem = nextItem(item, e.key)) === null || _nextItem === void 0 ? void 0 : _nextItem.focus();
|
|
28516
|
+
}).on(form, 'focusin', (e)=>{
|
|
28517
|
+
if (items.includes(e.target)) {
|
|
28518
|
+
items.forEach((item)=>(0,jodit_core_helpers___WEBPACK_IMPORTED_MODULE_2__.attr)(item, 'tabindex', item === e.target ? 0 : -1));
|
|
28426
28519
|
}
|
|
28427
28520
|
});
|
|
28428
28521
|
editor.e.fire('afterGenerateColorPicker', form, extra, callback, valueHex);
|
|
@@ -29639,7 +29732,8 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
29639
29732
|
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
29640
29733
|
/* harmony import */ var jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(59400);
|
|
29641
29734
|
/* harmony import */ var jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(5658);
|
|
29642
|
-
/* harmony import */ var
|
|
29735
|
+
/* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(29434);
|
|
29736
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(95085);
|
|
29643
29737
|
/*!
|
|
29644
29738
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
29645
29739
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -29659,14 +29753,21 @@ UiAiAssistant = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
|
29659
29753
|
|
|
29660
29754
|
|
|
29661
29755
|
|
|
29662
|
-
|
|
29663
|
-
const MARKER = [
|
|
29664
|
-
'id',
|
|
29665
|
-
'name'
|
|
29666
|
-
].map((key)=>`.jodit-wysiwyg a[${key}]:not([href]):empty::before`).join(',');
|
|
29756
|
+
|
|
29667
29757
|
/**
|
|
29668
|
-
*
|
|
29669
|
-
|
|
29758
|
+
* The editing area of an editor with the plugin, when it shares its document
|
|
29759
|
+
* with the page and so with any other editor on it
|
|
29760
|
+
*/ const WITH_ANCHORS = 'jodit-wysiwyg_anchors';
|
|
29761
|
+
/**
|
|
29762
|
+
* Each anchor's marker, in the editing areas `scope` picks out
|
|
29763
|
+
*/ function markerStyle(scope) {
|
|
29764
|
+
const marker = [
|
|
29765
|
+
'id',
|
|
29766
|
+
'name'
|
|
29767
|
+
].map((key)=>`.jodit-wysiwyg${scope} a[${key}]:not([href]):empty::before`).join(',');
|
|
29768
|
+
const icon = `url("data:image/svg+xml,${encodeURIComponent(jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_10__.Icon.get('anchor'))}") center/contain no-repeat`;
|
|
29769
|
+
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:''}`;
|
|
29770
|
+
}
|
|
29670
29771
|
/**
|
|
29671
29772
|
* The attribute `markAnchor` gives an anchor: an empty `<a>` with no `href`
|
|
29672
29773
|
*/ const MARK = ' contenteditable="false"';
|
|
@@ -29675,8 +29776,14 @@ const MARKER = [
|
|
|
29675
29776
|
* `#name`, and renames and removes them
|
|
29676
29777
|
*/ class anchor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
29677
29778
|
/** @override */ afterInit(jodit) {
|
|
29779
|
+
// An iframe's document is the editor's alone, and its body is part of
|
|
29780
|
+
// the value with `editHTMLDocumentMode`, so it gets no class
|
|
29781
|
+
const shared = jodit.ed === jodit.od;
|
|
29782
|
+
if (shared) {
|
|
29783
|
+
jodit.editor.classList.add(WITH_ANCHORS);
|
|
29784
|
+
}
|
|
29678
29785
|
// It goes in the editing document, so iframe mode has it whatever `iframeStyle` holds
|
|
29679
|
-
(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent =
|
|
29786
|
+
;(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.getContainer)(jodit, 'anchor', 'style', true).textContent = markerStyle(shared ? '.' + WITH_ANCHORS : '');
|
|
29680
29787
|
jodit.e.on('generateAnchorForm.anchor', this.__generateForm).on('clickA touchstartA', this.__onClickA, {
|
|
29681
29788
|
top: true
|
|
29682
29789
|
});
|
|
@@ -29709,6 +29816,24 @@ const MARKER = [
|
|
|
29709
29816
|
*/ onAfterGetValueFromEditor(data) {
|
|
29710
29817
|
data.value = unmarkAnchors(data.value);
|
|
29711
29818
|
}
|
|
29819
|
+
/**
|
|
29820
|
+
* A pasted or dropped copy of an anchor the document already has gets the
|
|
29821
|
+
* next free name, as `fees-2`, and the links that came with it follow it
|
|
29822
|
+
*/ onBeforePasteInsert(html) {
|
|
29823
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(html) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isFragment(html)) {
|
|
29824
|
+
this.__renameCopies(html);
|
|
29825
|
+
return;
|
|
29826
|
+
}
|
|
29827
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) || !/<a\s/i.test(html)) {
|
|
29828
|
+
return;
|
|
29829
|
+
}
|
|
29830
|
+
// Inert, so nothing in it loads
|
|
29831
|
+
const template = this.j.createInside.element('template');
|
|
29832
|
+
template.innerHTML = html;
|
|
29833
|
+
if (this.__renameCopies(template.content)) {
|
|
29834
|
+
return template.innerHTML;
|
|
29835
|
+
}
|
|
29836
|
+
}
|
|
29712
29837
|
/**
|
|
29713
29838
|
* The form that names a new anchor, or renames or removes `target`
|
|
29714
29839
|
*/ __generateForm(target, close) {
|
|
@@ -29848,8 +29973,52 @@ const MARKER = [
|
|
|
29848
29973
|
}
|
|
29849
29974
|
});
|
|
29850
29975
|
}
|
|
29976
|
+
/**
|
|
29977
|
+
* Gives each anchor in `root` whose name the document already has the
|
|
29978
|
+
* next free one, avoiding the names in `root` too, and points the links
|
|
29979
|
+
* in `root` to it at the new name. Whether any was renamed
|
|
29980
|
+
*/ __renameCopies(root) {
|
|
29981
|
+
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')));
|
|
29982
|
+
const renamed = new Map();
|
|
29983
|
+
const anchors = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isAnchor)(root) ? [
|
|
29984
|
+
root
|
|
29985
|
+
] : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchors)(root);
|
|
29986
|
+
anchors.forEach((anchor)=>{
|
|
29987
|
+
const name = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getAnchorName)(anchor);
|
|
29988
|
+
if (!this.__isTaken(name, null)) {
|
|
29989
|
+
return;
|
|
29990
|
+
}
|
|
29991
|
+
let copy = name;
|
|
29992
|
+
for(let n = 2; inRoot.has(copy) || this.__isTaken(copy, null); n += 1){
|
|
29993
|
+
copy = `${name}-${n}`;
|
|
29994
|
+
}
|
|
29995
|
+
[
|
|
29996
|
+
'id',
|
|
29997
|
+
'name'
|
|
29998
|
+
].forEach((key)=>{
|
|
29999
|
+
if (anchor.hasAttribute(key)) {
|
|
30000
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(anchor, key, copy);
|
|
30001
|
+
}
|
|
30002
|
+
});
|
|
30003
|
+
inRoot.add(copy);
|
|
30004
|
+
renamed.set(name, copy);
|
|
30005
|
+
});
|
|
30006
|
+
if (!renamed.size) {
|
|
30007
|
+
return false;
|
|
30008
|
+
}
|
|
30009
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.toArray)(root.querySelectorAll('a[href]')).forEach((link)=>{
|
|
30010
|
+
var _attr;
|
|
30011
|
+
const href = (_attr = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href')) !== null && _attr !== void 0 ? _attr : '';
|
|
30012
|
+
const copy = href[0] === '#' && renamed.get(href.slice(1));
|
|
30013
|
+
if (copy) {
|
|
30014
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href', '#' + copy);
|
|
30015
|
+
}
|
|
30016
|
+
});
|
|
30017
|
+
return true;
|
|
30018
|
+
}
|
|
29851
30019
|
/** @override */ beforeDestruct(jodit) {
|
|
29852
30020
|
this.__dropForm();
|
|
30021
|
+
jodit.editor.classList.remove(WITH_ANCHORS);
|
|
29853
30022
|
jodit.e.off('generateAnchorForm.anchor', this.__generateForm).off('clickA touchstartA', this.__onClickA);
|
|
29854
30023
|
}
|
|
29855
30024
|
constructor(...args){
|
|
@@ -29879,6 +30048,9 @@ const MARKER = [
|
|
|
29879
30048
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
29880
30049
|
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':afterGetValueFromEditor')
|
|
29881
30050
|
], anchor.prototype, "onAfterGetValueFromEditor", null);
|
|
30051
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
30052
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':beforePasteInsert')
|
|
30053
|
+
], anchor.prototype, "onBeforePasteInsert", null);
|
|
29882
30054
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
29883
30055
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
29884
30056
|
], anchor.prototype, "__generateForm", null);
|
|
@@ -36905,6 +37077,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.fullsize = {
|
|
|
36905
37077
|
exec: (editor)=>{
|
|
36906
37078
|
editor.toggleFullSize();
|
|
36907
37079
|
},
|
|
37080
|
+
// Makes it a toggle. `update` sets the state, which holds while the editor doesn't have the focus
|
|
37081
|
+
isActive: (editor)=>editor.isFullSize,
|
|
36908
37082
|
update (editor, button) {
|
|
36909
37083
|
const mode = editor.isFullSize ? 'shrink' : 'fullsize';
|
|
36910
37084
|
button.state.activated = editor.isFullSize;
|
|
@@ -37275,9 +37449,6 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('hotkeys', hotke
|
|
|
37275
37449
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_2__.Icon.set('hr', (_hr_svg__WEBPACK_IMPORTED_MODULE_4___default()));
|
|
37276
37450
|
jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.hr = {
|
|
37277
37451
|
command: 'insertHorizontalRule',
|
|
37278
|
-
tags: [
|
|
37279
|
-
'hr'
|
|
37280
|
-
],
|
|
37281
37452
|
tooltip: 'Insert Horizontal Line'
|
|
37282
37453
|
};
|
|
37283
37454
|
function hr(editor) {
|
|
@@ -41958,9 +42129,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.defaultLineHeight = n
|
|
|
41958
42129
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_1__.Icon.set('line-height', (_line_height_svg__WEBPACK_IMPORTED_MODULE_3___default()));
|
|
41959
42130
|
jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.lineHeight = {
|
|
41960
42131
|
command: 'applyLineHeight',
|
|
41961
|
-
tags: [
|
|
41962
|
-
'ol'
|
|
41963
|
-
],
|
|
41964
42132
|
tooltip: 'Line height',
|
|
41965
42133
|
list: [
|
|
41966
42134
|
1,
|