jodit 3.8.8 → 3.9.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/.github/workflows/tests.yml +23 -0
- package/.idea/dictionaries/v_chupurnov.xml +1 -0
- package/.idea/workspace.xml +295 -286
- package/CHANGELOG.MD +110 -24
- package/README.md +3 -3
- package/build/jodit.css +2 -2
- package/build/jodit.es2018.css +1 -1
- package/build/jodit.es2018.en.css +1 -1
- package/build/jodit.es2018.en.js +329 -210
- package/build/jodit.es2018.en.min.js +1 -1
- package/build/jodit.es2018.js +329 -210
- package/build/jodit.es2018.min.js +1 -1
- package/build/jodit.js +1066 -881
- package/build/jodit.min.css +1 -1
- package/build/jodit.min.js +1 -1
- package/package.json +1 -1
- package/src/core/async.ts +1 -1
- package/src/core/constants.ts +2 -0
- package/src/core/dom.ts +113 -99
- package/src/core/events/{events-native.ts → event-emitter.ts} +14 -9
- package/src/core/events/index.ts +1 -1
- package/src/core/global.ts +2 -2
- package/src/core/helpers/array/to-array.ts +1 -0
- package/src/core/helpers/data-bind.ts +2 -2
- package/src/core/helpers/utils/utils.ts +20 -4
- package/src/core/request/ajax.ts +212 -0
- package/src/core/request/config.ts +37 -0
- package/{build-system/minimizer/index.js → src/core/request/index.ts} +2 -1
- package/src/core/request/response.ts +39 -0
- package/src/core/selection/select.ts +59 -27
- package/src/core/selection/style/api/element-has-same-style.ts +13 -0
- package/src/core/selection/style/api/get-suit-parent.ts +1 -1
- package/src/core/selection/style/api/is-suit-element.ts +24 -4
- package/src/core/selection/style/api/unwrap-children.ts +45 -16
- package/src/core/selection/style/api/wrap-unwrapped-text.ts +28 -23
- package/src/core/selection/style/apply-style.ts +14 -8
- package/src/core/traits/elms.ts +1 -0
- package/src/core/ui/helpers/get-control-type.ts +3 -1
- package/src/core/view/view.ts +3 -3
- package/src/modules/context-menu/context-menu.ts +1 -1
- package/src/modules/file-browser/README.MD +1 -1
- package/src/modules/file-browser/data-provider.ts +22 -42
- package/src/modules/file-browser/file-browser.ts +3 -0
- package/src/modules/index.ts +1 -1
- package/src/modules/table.ts +106 -101
- package/src/modules/uploader/uploader.ts +4 -3
- package/src/plugins/fix/clean-html.ts +37 -16
- package/src/plugins/indent.ts +25 -18
- package/src/plugins/size/resize-handler.ts +1 -1
- package/src/plugins/size/size.ts +1 -3
- package/src/plugins/source/source.ts +1 -1
- package/src/plugins/table/select-cells.ts +23 -5
- package/src/types/ajax.d.ts +15 -6
- package/src/types/async.d.ts +1 -1
- package/src/types/events.d.ts +12 -12
- package/src/types/view.d.ts +2 -2
- package/types/core/async.d.ts +1 -1
- package/types/core/constants.d.ts +1 -0
- package/types/core/dom.d.ts +25 -19
- package/types/core/events/{events-native.d.ts → event-emitter.d.ts} +8 -3
- package/types/core/events/index.d.ts +1 -1
- package/types/core/global.d.ts +2 -2
- package/types/core/helpers/utils/utils.d.ts +12 -4
- package/types/core/{ajax.d.ts → request/ajax.d.ts} +4 -14
- package/types/core/request/config.d.ts +14 -0
- package/{build-system/rules/css.js → types/core/request/index.d.ts} +2 -7
- package/types/core/request/response.d.ts +16 -0
- package/types/core/selection/style/api/element-has-same-style.d.ts +4 -0
- package/types/core/selection/style/api/is-suit-element.d.ts +1 -0
- package/types/core/selection/style/api/wrap-unwrapped-text.d.ts +2 -2
- package/types/core/view/view.d.ts +2 -2
- package/types/modules/file-browser/data-provider.d.ts +1 -1
- package/types/modules/index.d.ts +1 -1
- package/types/plugins/fix/clean-html.d.ts +4 -0
- package/types/plugins/size/resize-handler.d.ts +1 -1
- package/types/plugins/source/source.d.ts +1 -1
- package/types/types/ajax.d.ts +15 -6
- package/types/types/async.d.ts +1 -1
- package/types/types/events.d.ts +12 -12
- package/types/types/view.d.ts +2 -2
- package/.editorconfig +0 -15
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -109
- package/.prettierrc.json +0 -9
- package/.stylelintrc +0 -17
- package/app.css +0 -112
- package/build-system/index.js +0 -78
- package/build-system/loaders/css-variables-prefixes.js +0 -12
- package/build-system/loaders/lang-loader.js +0 -57
- package/build-system/loaders/style.js +0 -31
- package/build-system/loaders/svg-loader.js +0 -21
- package/build-system/minimizer/css.js +0 -20
- package/build-system/minimizer/js.js +0 -41
- package/build-system/plugins/banner.js +0 -15
- package/build-system/plugins/define.js +0 -22
- package/build-system/plugins/extract-css.js +0 -14
- package/build-system/plugins/index.js +0 -31
- package/build-system/plugins/post-build.js +0 -52
- package/build-system/rules/extra-typescript.js +0 -22
- package/build-system/rules/index.js +0 -17
- package/build-system/rules/internal-typescript.js +0 -23
- package/build-system/rules/langs.js +0 -20
- package/build-system/rules/svg.js +0 -19
- package/build-system/utils/filename.js +0 -17
- package/build-system/utils/post-build.js +0 -28
- package/build-system/variables.js +0 -53
- package/composer.json +0 -12
- package/src/core/ajax.ts +0 -266
- package/src/types/core.d.ts +0 -7
- package/src/types/core.js +0 -8
- package/src/types/core.js.map +0 -1
- package/src/types/storage.d.ts +0 -13
- package/src/types/storage.js +0 -8
- package/src/types/storage.js.map +0 -1
- package/types/types/core.js +0 -8
- package/types/types/core.js.map +0 -1
- package/types/types/storage.js +0 -8
- package/types/types/storage.js.map +0 -1
package/build/jodit.es2018.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/)
|
|
4
|
-
* Version: v3.
|
|
4
|
+
* Version: v3.9.2
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -395,7 +395,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
395
395
|
/* harmony export */ "SAFE_COUNT_CHANGE_CALL": function() { return /* binding */ SAFE_COUNT_CHANGE_CALL; },
|
|
396
396
|
/* harmony export */ "IS_MAC": function() { return /* binding */ IS_MAC; },
|
|
397
397
|
/* harmony export */ "KEY_ALIASES": function() { return /* binding */ KEY_ALIASES; },
|
|
398
|
-
/* harmony export */ "BASE_PATH": function() { return /* binding */ BASE_PATH; }
|
|
398
|
+
/* harmony export */ "BASE_PATH": function() { return /* binding */ BASE_PATH; },
|
|
399
|
+
/* harmony export */ "TEMP_ATTR": function() { return /* binding */ TEMP_ATTR; }
|
|
399
400
|
/* harmony export */ });
|
|
400
401
|
/*!
|
|
401
402
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
@@ -507,6 +508,7 @@ const BASE_PATH = (() => {
|
|
|
507
508
|
}
|
|
508
509
|
return window.location.href;
|
|
509
510
|
})();
|
|
511
|
+
const TEMP_ATTR = 'data-jodit-temp';
|
|
510
512
|
|
|
511
513
|
|
|
512
514
|
/***/ }),
|
|
@@ -517,6 +519,7 @@ const BASE_PATH = (() => {
|
|
|
517
519
|
|
|
518
520
|
// EXPORTS
|
|
519
521
|
__webpack_require__.d(__webpack_exports__, {
|
|
522
|
+
"vp": function() { return /* reexport */ EventEmitter; },
|
|
520
523
|
"DG": function() { return /* reexport */ EventHandlersStore; },
|
|
521
524
|
"ng": function() { return /* reexport */ EventsNative; },
|
|
522
525
|
"P5": function() { return /* reexport */ ObserveObject; },
|
|
@@ -586,7 +589,7 @@ var is_function = __webpack_require__(6);
|
|
|
586
589
|
var is_array = __webpack_require__(7);
|
|
587
590
|
// EXTERNAL MODULE: ./src/core/helpers/type.ts
|
|
588
591
|
var type = __webpack_require__(4);
|
|
589
|
-
;// CONCATENATED MODULE: ./src/core/events/
|
|
592
|
+
;// CONCATENATED MODULE: ./src/core/events/event-emitter.ts
|
|
590
593
|
/*!
|
|
591
594
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
592
595
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -597,10 +600,10 @@ var type = __webpack_require__(4);
|
|
|
597
600
|
|
|
598
601
|
|
|
599
602
|
|
|
600
|
-
class
|
|
603
|
+
class EventEmitter {
|
|
601
604
|
constructor(doc) {
|
|
602
605
|
this.mutedEvents = new Set();
|
|
603
|
-
this.__key = '
|
|
606
|
+
this.__key = '__JoditEventEmitterNamespaces';
|
|
604
607
|
this.doc = document;
|
|
605
608
|
this.prepareEvent = (event) => {
|
|
606
609
|
if (event.cancelBubble) {
|
|
@@ -972,6 +975,8 @@ class EventsNative {
|
|
|
972
975
|
delete this[this.__key];
|
|
973
976
|
}
|
|
974
977
|
}
|
|
978
|
+
class EventsNative extends EventEmitter {
|
|
979
|
+
}
|
|
975
980
|
|
|
976
981
|
// EXTERNAL MODULE: ./node_modules/tslib/tslib.es6.js
|
|
977
982
|
var tslib_es6 = __webpack_require__(18);
|
|
@@ -2887,7 +2892,7 @@ function getContainer(jodit, classFunc, tag = 'div', createInsideEditor = false)
|
|
|
2887
2892
|
data[key].classList.add(`jodit_theme_${view.o.theme || 'default'}`);
|
|
2888
2893
|
return data[key];
|
|
2889
2894
|
}
|
|
2890
|
-
const eventEmitter = new _events__WEBPACK_IMPORTED_MODULE_3__/* .
|
|
2895
|
+
const eventEmitter = new _events__WEBPACK_IMPORTED_MODULE_3__/* .EventEmitter */ .vp();
|
|
2891
2896
|
|
|
2892
2897
|
|
|
2893
2898
|
/***/ }),
|
|
@@ -3064,6 +3069,7 @@ PluginSystem.styles = new Set();
|
|
|
3064
3069
|
|
|
3065
3070
|
|
|
3066
3071
|
|
|
3072
|
+
|
|
3067
3073
|
class Dom {
|
|
3068
3074
|
static detach(node) {
|
|
3069
3075
|
while (node.firstChild) {
|
|
@@ -3124,22 +3130,6 @@ class Dom {
|
|
|
3124
3130
|
Dom.safeRemove(node);
|
|
3125
3131
|
}
|
|
3126
3132
|
}
|
|
3127
|
-
static each(elm, callback) {
|
|
3128
|
-
let node = elm.firstChild;
|
|
3129
|
-
if (node) {
|
|
3130
|
-
while (node) {
|
|
3131
|
-
const next = Dom.next(node, Boolean, elm);
|
|
3132
|
-
if (callback(node) === false) {
|
|
3133
|
-
return false;
|
|
3134
|
-
}
|
|
3135
|
-
if (node.parentNode && !Dom.each(node, callback)) {
|
|
3136
|
-
return false;
|
|
3137
|
-
}
|
|
3138
|
-
node = next;
|
|
3139
|
-
}
|
|
3140
|
-
}
|
|
3141
|
-
return true;
|
|
3142
|
-
}
|
|
3143
3133
|
static between(start, end, callback) {
|
|
3144
3134
|
let next = start;
|
|
3145
3135
|
while (next && next !== end) {
|
|
@@ -3282,10 +3272,10 @@ class Dom {
|
|
|
3282
3272
|
return null;
|
|
3283
3273
|
}
|
|
3284
3274
|
static prev(node, condition, root, withChild = true) {
|
|
3285
|
-
return Dom.find(node, condition, root, false,
|
|
3275
|
+
return Dom.find(node, condition, root, false, withChild);
|
|
3286
3276
|
}
|
|
3287
3277
|
static next(node, condition, root, withChild = true) {
|
|
3288
|
-
return Dom.find(node, condition, root,
|
|
3278
|
+
return Dom.find(node, condition, root, true, withChild);
|
|
3289
3279
|
}
|
|
3290
3280
|
static prevWithClass(node, className) {
|
|
3291
3281
|
return Dom.prev(node, node => {
|
|
@@ -3295,28 +3285,63 @@ class Dom {
|
|
|
3295
3285
|
static nextWithClass(node, className) {
|
|
3296
3286
|
return Dom.next(node, elm => Dom.isElement(elm) && elm.classList.contains(className), node.parentNode);
|
|
3297
3287
|
}
|
|
3298
|
-
static find(node, condition, root,
|
|
3299
|
-
|
|
3300
|
-
|
|
3288
|
+
static find(node, condition, root, leftToRight = true, withChild = true) {
|
|
3289
|
+
const gen = this.nextGen(node, root, leftToRight, withChild);
|
|
3290
|
+
let item = gen.next();
|
|
3291
|
+
while (!item.done) {
|
|
3292
|
+
if (condition(item.value)) {
|
|
3293
|
+
return item.value;
|
|
3294
|
+
}
|
|
3295
|
+
item = gen.next();
|
|
3301
3296
|
}
|
|
3302
|
-
|
|
3297
|
+
return null;
|
|
3298
|
+
}
|
|
3299
|
+
static *nextGen(start, root, leftToRight = true, withChild = true) {
|
|
3300
|
+
const stack = [];
|
|
3301
|
+
let currentNode = start;
|
|
3303
3302
|
do {
|
|
3304
|
-
next =
|
|
3305
|
-
|
|
3306
|
-
|
|
3303
|
+
let next = leftToRight
|
|
3304
|
+
? currentNode.nextSibling
|
|
3305
|
+
: currentNode.previousSibling;
|
|
3306
|
+
while (next) {
|
|
3307
|
+
stack.unshift(next);
|
|
3308
|
+
next = leftToRight ? next.nextSibling : next.previousSibling;
|
|
3309
|
+
}
|
|
3310
|
+
yield* this.runInStack(start, stack, leftToRight, withChild);
|
|
3311
|
+
currentNode = currentNode.parentNode;
|
|
3312
|
+
} while (currentNode !== root);
|
|
3313
|
+
return null;
|
|
3314
|
+
}
|
|
3315
|
+
static each(elm, callback, leftToRight = true) {
|
|
3316
|
+
const gen = this.eachGen(elm, leftToRight);
|
|
3317
|
+
let item = gen.next();
|
|
3318
|
+
while (!item.done) {
|
|
3319
|
+
if (callback(item.value) === false) {
|
|
3320
|
+
return false;
|
|
3307
3321
|
}
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3322
|
+
item = gen.next();
|
|
3323
|
+
}
|
|
3324
|
+
return true;
|
|
3325
|
+
}
|
|
3326
|
+
static eachGen(root, leftToRight = true) {
|
|
3327
|
+
return this.runInStack(root, [root], leftToRight);
|
|
3328
|
+
}
|
|
3329
|
+
static *runInStack(start, stack, leftToRight, withChild = true) {
|
|
3330
|
+
while (stack.length) {
|
|
3331
|
+
const item = stack.pop();
|
|
3332
|
+
if (start !== item) {
|
|
3333
|
+
yield item;
|
|
3313
3334
|
}
|
|
3314
|
-
if (
|
|
3315
|
-
|
|
3335
|
+
if (withChild) {
|
|
3336
|
+
let child = leftToRight ? item.lastChild : item.firstChild;
|
|
3337
|
+
while (child) {
|
|
3338
|
+
stack.push(child);
|
|
3339
|
+
child = leftToRight
|
|
3340
|
+
? child.previousSibling
|
|
3341
|
+
: child.nextSibling;
|
|
3342
|
+
}
|
|
3316
3343
|
}
|
|
3317
|
-
|
|
3318
|
-
} while (start && start !== root);
|
|
3319
|
-
return null;
|
|
3344
|
+
}
|
|
3320
3345
|
}
|
|
3321
3346
|
static findWithCurrent(node, condition, root, sibling = 'nextSibling', child = 'firstChild') {
|
|
3322
3347
|
let next = node;
|
|
@@ -3495,21 +3520,20 @@ class Dom {
|
|
|
3495
3520
|
}
|
|
3496
3521
|
static markTemporary(element, attributes) {
|
|
3497
3522
|
attributes && (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element, attributes);
|
|
3498
|
-
(0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element,
|
|
3523
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element, _constants__WEBPACK_IMPORTED_MODULE_0__.TEMP_ATTR, true);
|
|
3499
3524
|
return element;
|
|
3500
3525
|
}
|
|
3501
3526
|
static isTemporary(element) {
|
|
3502
3527
|
if (!Dom.isElement(element)) {
|
|
3503
3528
|
return false;
|
|
3504
3529
|
}
|
|
3505
|
-
return
|
|
3506
|
-
(0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element, 'data-jodit-temp') === 'true');
|
|
3530
|
+
return _selection__WEBPACK_IMPORTED_MODULE_2__/* .Select.isMarker */ .P.isMarker(element) || (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(element, _constants__WEBPACK_IMPORTED_MODULE_0__.TEMP_ATTR) === 'true';
|
|
3507
3531
|
}
|
|
3508
3532
|
static replaceTemporaryFromString(value) {
|
|
3509
3533
|
return value.replace(/<([a-z]+)[^>]+data-jodit-temp[^>]+>(.+?)<\/\1>/gi, '$2');
|
|
3510
3534
|
}
|
|
3511
3535
|
static temporaryList(root) {
|
|
3512
|
-
return (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.$$)(
|
|
3536
|
+
return (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.$$)(`[${_constants__WEBPACK_IMPORTED_MODULE_0__.TEMP_ATTR}]`, root);
|
|
3513
3537
|
}
|
|
3514
3538
|
}
|
|
3515
3539
|
|
|
@@ -3564,6 +3588,11 @@ function elementHasSameStyle(elm, rules) {
|
|
|
3564
3588
|
.toLowerCase() === value.toString().toLowerCase());
|
|
3565
3589
|
}));
|
|
3566
3590
|
}
|
|
3591
|
+
function elementHasSameStyleKeys(elm, rules) {
|
|
3592
|
+
return Boolean(!dom/* Dom.isTag */.i.isTag(elm, 'font') &&
|
|
3593
|
+
dom/* Dom.isHTMLElement */.i.isHTMLElement(elm) &&
|
|
3594
|
+
Object.keys(rules).every(property => !(0,helpers.isVoid)((0,helpers.css)(elm, property, true))));
|
|
3595
|
+
}
|
|
3567
3596
|
|
|
3568
3597
|
;// CONCATENATED MODULE: ./src/core/selection/style/api/is-suit-element.ts
|
|
3569
3598
|
|
|
@@ -3580,10 +3609,16 @@ function isSuitElement(commitStyle, elm, strict) {
|
|
|
3580
3609
|
(elmHasSameStyle && isNormalNode(elm))) {
|
|
3581
3610
|
return true;
|
|
3582
3611
|
}
|
|
3583
|
-
|
|
3584
|
-
|
|
3612
|
+
return Boolean(!elmIsSame && !strict && elementIsDefault && dom/* Dom.isInlineBlock */.i.isInlineBlock(elm));
|
|
3613
|
+
}
|
|
3614
|
+
function isSameStyleChild(commitStyle, elm) {
|
|
3615
|
+
const { element, options } = commitStyle;
|
|
3616
|
+
if (!elm || !isNormalNode(elm)) {
|
|
3617
|
+
return false;
|
|
3585
3618
|
}
|
|
3586
|
-
|
|
3619
|
+
const elmIsSame = elm.nodeName.toLowerCase() === element;
|
|
3620
|
+
const elmHasSameStyle = Boolean(options.style && elementHasSameStyleKeys(elm, options.style));
|
|
3621
|
+
return elmIsSame && elmHasSameStyle;
|
|
3587
3622
|
}
|
|
3588
3623
|
|
|
3589
3624
|
;// CONCATENATED MODULE: ./src/core/selection/style/api/get-suit-parent.ts
|
|
@@ -3597,7 +3632,7 @@ function isSuitElement(commitStyle, elm, strict) {
|
|
|
3597
3632
|
|
|
3598
3633
|
function getSuitParent(style, node, root) {
|
|
3599
3634
|
const { parentNode } = node;
|
|
3600
|
-
if (parentNode &&
|
|
3635
|
+
if (dom/* Dom.isHTMLElement */.i.isHTMLElement(parentNode) &&
|
|
3601
3636
|
!dom/* Dom.next */.i.next(node, isNormalNode, parentNode) &&
|
|
3602
3637
|
!dom/* Dom.prev */.i.prev(node, isNormalNode, parentNode) &&
|
|
3603
3638
|
isSuitElement(style, parentNode, false) &&
|
|
@@ -4090,24 +4125,48 @@ class Select {
|
|
|
4090
4125
|
this.j.e.fire('afterInsertImage', image);
|
|
4091
4126
|
}
|
|
4092
4127
|
eachSelection(callback) {
|
|
4128
|
+
var _a;
|
|
4093
4129
|
const sel = this.sel;
|
|
4094
4130
|
if (sel && sel.rangeCount) {
|
|
4095
4131
|
const range = sel.getRangeAt(0);
|
|
4096
|
-
|
|
4097
|
-
|
|
4132
|
+
let root = range.commonAncestorContainer;
|
|
4133
|
+
if (!dom/* Dom.isHTMLElement */.i.isHTMLElement(root)) {
|
|
4134
|
+
root = root.parentElement;
|
|
4135
|
+
}
|
|
4136
|
+
const nodes = [], startOffset = range.startOffset, length = root.childNodes.length, elementOffset = startOffset < length ? startOffset : length - 1;
|
|
4137
|
+
let start = range.startContainer === this.area
|
|
4138
|
+
? root.childNodes[elementOffset]
|
|
4098
4139
|
: range.startContainer, end = range.endContainer === this.area
|
|
4099
|
-
?
|
|
4140
|
+
? root.childNodes[range.endOffset - 1]
|
|
4100
4141
|
: range.endContainer;
|
|
4101
|
-
dom/* Dom.
|
|
4142
|
+
if (dom/* Dom.isText */.i.isText(start) &&
|
|
4143
|
+
start === range.startContainer &&
|
|
4144
|
+
range.startOffset === ((_a = start.nodeValue) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
4145
|
+
start.nextSibling) {
|
|
4146
|
+
start = start.nextSibling;
|
|
4147
|
+
}
|
|
4148
|
+
if (dom/* Dom.isText */.i.isText(end) &&
|
|
4149
|
+
end === range.endContainer &&
|
|
4150
|
+
range.endOffset === 0 &&
|
|
4151
|
+
end.previousSibling) {
|
|
4152
|
+
end = end.previousSibling;
|
|
4153
|
+
}
|
|
4154
|
+
const checkElm = (node) => {
|
|
4102
4155
|
if (node &&
|
|
4103
|
-
node !==
|
|
4156
|
+
node !== root &&
|
|
4104
4157
|
!dom/* Dom.isEmptyTextNode */.i.isEmptyTextNode(node) &&
|
|
4105
4158
|
!Select.isMarker(node)) {
|
|
4106
4159
|
nodes.push(node);
|
|
4107
4160
|
}
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4161
|
+
};
|
|
4162
|
+
checkElm(start);
|
|
4163
|
+
if (start !== end) {
|
|
4164
|
+
dom/* Dom.find */.i.find(start, node => {
|
|
4165
|
+
checkElm(node);
|
|
4166
|
+
return (node === end ||
|
|
4167
|
+
(node && node.contains && node.contains(end)));
|
|
4168
|
+
}, root, true, false);
|
|
4169
|
+
}
|
|
4111
4170
|
const forEvery = (current) => {
|
|
4112
4171
|
if (!dom/* Dom.isOrContains */.i.isOrContains(this.j.editor, current, true)) {
|
|
4113
4172
|
return;
|
|
@@ -4495,25 +4554,49 @@ function extractAndMove(wrapper, range, left) {
|
|
|
4495
4554
|
*/
|
|
4496
4555
|
|
|
4497
4556
|
|
|
4557
|
+
|
|
4498
4558
|
function unwrapChildren(style, font) {
|
|
4499
4559
|
const needUnwrap = [];
|
|
4560
|
+
const needChangeStyle = [];
|
|
4500
4561
|
let firstElementSuit;
|
|
4562
|
+
const cssStyle = style.options.style;
|
|
4501
4563
|
if (font.firstChild) {
|
|
4502
|
-
dom/* Dom.
|
|
4503
|
-
|
|
4564
|
+
const gen = dom/* Dom.eachGen */.i.eachGen(font);
|
|
4565
|
+
let item = gen.next();
|
|
4566
|
+
while (!item.done) {
|
|
4567
|
+
const elm = item.value;
|
|
4568
|
+
if (isSuitElement(style, elm, true)) {
|
|
4504
4569
|
if (firstElementSuit === undefined) {
|
|
4505
4570
|
firstElementSuit = true;
|
|
4506
4571
|
}
|
|
4507
4572
|
needUnwrap.push(elm);
|
|
4508
4573
|
}
|
|
4509
|
-
else {
|
|
4574
|
+
else if (cssStyle && isSameStyleChild(style, elm)) {
|
|
4510
4575
|
if (firstElementSuit === undefined) {
|
|
4511
4576
|
firstElementSuit = false;
|
|
4512
4577
|
}
|
|
4578
|
+
needChangeStyle.push(() => {
|
|
4579
|
+
(0,helpers.css)(elm, Object.keys(cssStyle).reduce((acc, key) => {
|
|
4580
|
+
acc[key] = null;
|
|
4581
|
+
return acc;
|
|
4582
|
+
}, {}));
|
|
4583
|
+
if (!(0,helpers.attr)(elm, 'style')) {
|
|
4584
|
+
(0,helpers.attr)(elm, 'style', null);
|
|
4585
|
+
}
|
|
4586
|
+
if (elm.nodeName.toLowerCase() === style.element) {
|
|
4587
|
+
needUnwrap.push(elm);
|
|
4588
|
+
}
|
|
4589
|
+
});
|
|
4513
4590
|
}
|
|
4514
|
-
|
|
4515
|
-
|
|
4591
|
+
else if (!dom/* Dom.isEmptyTextNode */.i.isEmptyTextNode(elm)) {
|
|
4592
|
+
if (firstElementSuit === undefined) {
|
|
4593
|
+
firstElementSuit = false;
|
|
4594
|
+
}
|
|
4595
|
+
}
|
|
4596
|
+
item = gen.next();
|
|
4597
|
+
}
|
|
4516
4598
|
}
|
|
4599
|
+
needChangeStyle.forEach(clb => clb());
|
|
4517
4600
|
needUnwrap.forEach(dom/* Dom.unwrap */.i.unwrap);
|
|
4518
4601
|
return Boolean(firstElementSuit);
|
|
4519
4602
|
}
|
|
@@ -4544,10 +4627,13 @@ function postProcessListElement(style, wrapper, ci) {
|
|
|
4544
4627
|
*/
|
|
4545
4628
|
|
|
4546
4629
|
|
|
4547
|
-
function wrapUnwrappedText(style, elm,
|
|
4548
|
-
const edge = (n, key = 'previousSibling') => {
|
|
4630
|
+
function wrapUnwrappedText(style, elm, jodit, getRange) {
|
|
4631
|
+
const root = jodit.editor, ci = jodit.createInside, edge = (n, key = 'previousSibling') => {
|
|
4549
4632
|
let edgeNode = n, node = n;
|
|
4550
4633
|
while (node) {
|
|
4634
|
+
if (dom/* Dom.isTag */.i.isTag(node, jodit.o.enter)) {
|
|
4635
|
+
break;
|
|
4636
|
+
}
|
|
4551
4637
|
edgeNode = node;
|
|
4552
4638
|
if (node[key]) {
|
|
4553
4639
|
node = node[key];
|
|
@@ -4651,19 +4737,20 @@ function toggleStyles(style, elm, wrap) {
|
|
|
4651
4737
|
|
|
4652
4738
|
|
|
4653
4739
|
function ApplyStyle(jodit, style) {
|
|
4654
|
-
const { s: sel
|
|
4740
|
+
const { s: sel } = jodit, rng = () => sel.createRange();
|
|
4655
4741
|
let wrap = null;
|
|
4656
4742
|
sel.save();
|
|
4657
4743
|
(0,helpers.normalizeNode)(sel.area.firstChild);
|
|
4658
4744
|
const gen = jodit.s.wrapInTagGen();
|
|
4659
4745
|
let font = gen.next();
|
|
4660
4746
|
while (!font.done) {
|
|
4661
|
-
wrap = applyToElement(style, font.value,
|
|
4747
|
+
wrap = applyToElement(style, font.value, rng, jodit, wrap);
|
|
4662
4748
|
font = gen.next();
|
|
4663
4749
|
}
|
|
4664
4750
|
sel.restore();
|
|
4665
4751
|
}
|
|
4666
|
-
function applyToElement(style, font,
|
|
4752
|
+
function applyToElement(style, font, range, jodit, wrap) {
|
|
4753
|
+
const root = jodit.editor;
|
|
4667
4754
|
if (checkSpecialElements(font, root)) {
|
|
4668
4755
|
return wrap;
|
|
4669
4756
|
}
|
|
@@ -4698,13 +4785,13 @@ function applyToElement(style, font, root, range, ci, wrap) {
|
|
|
4698
4785
|
wrapper = box;
|
|
4699
4786
|
}
|
|
4700
4787
|
else {
|
|
4701
|
-
wrapper = wrapUnwrappedText(style, font,
|
|
4788
|
+
wrapper = wrapUnwrappedText(style, font, jodit, range);
|
|
4702
4789
|
}
|
|
4703
4790
|
}
|
|
4704
|
-
const newWrapper = dom/* Dom.replace */.i.replace(wrapper, style.element,
|
|
4791
|
+
const newWrapper = dom/* Dom.replace */.i.replace(wrapper, style.element, jodit.createInside, true);
|
|
4705
4792
|
(0,helpers.attr)(newWrapper, 'size', null);
|
|
4706
4793
|
if (style.elementIsBlock) {
|
|
4707
|
-
postProcessListElement(style, newWrapper,
|
|
4794
|
+
postProcessListElement(style, newWrapper, jodit.createInside);
|
|
4708
4795
|
}
|
|
4709
4796
|
if (style.options.style && style.elementIsDefault) {
|
|
4710
4797
|
(0,helpers.css)(newWrapper, style.options.style);
|
|
@@ -7415,8 +7502,9 @@ UIList = (0,tslib_es6/* __decorate */.gn)([
|
|
|
7415
7502
|
|
|
7416
7503
|
function getControlType(button, controls) {
|
|
7417
7504
|
let buttonControl;
|
|
7418
|
-
if (!controls)
|
|
7505
|
+
if (!controls) {
|
|
7419
7506
|
controls = _config__WEBPACK_IMPORTED_MODULE_1__/* .Config.defaultOptions.controls */ .D.defaultOptions.controls;
|
|
7507
|
+
}
|
|
7420
7508
|
if (!(0,_helpers__WEBPACK_IMPORTED_MODULE_0__.isString)(button)) {
|
|
7421
7509
|
buttonControl = { name: 'empty', ...(0,_helpers__WEBPACK_IMPORTED_MODULE_0__.ConfigFlatten)(button) };
|
|
7422
7510
|
if (controls[buttonControl.name] !== undefined) {
|
|
@@ -13870,6 +13958,7 @@ __webpack_require__.d(modules_namespaceObject, {
|
|
|
13870
13958
|
"Create": function() { return Create; },
|
|
13871
13959
|
"Dialog": function() { return Dialog; },
|
|
13872
13960
|
"Dom": function() { return dom/* Dom */.i; },
|
|
13961
|
+
"EventEmitter": function() { return events/* EventEmitter */.vp; },
|
|
13873
13962
|
"EventHandlersStore": function() { return events/* EventHandlersStore */.DG; },
|
|
13874
13963
|
"EventsNative": function() { return events/* EventsNative */.ng; },
|
|
13875
13964
|
"FileBrowser": function() { return FileBrowser; },
|
|
@@ -13883,6 +13972,7 @@ __webpack_require__.d(modules_namespaceObject, {
|
|
|
13883
13972
|
"Popup": function() { return ui/* Popup */.GI; },
|
|
13884
13973
|
"ProgressBar": function() { return ui/* ProgressBar */.ko; },
|
|
13885
13974
|
"Prompt": function() { return Prompt; },
|
|
13975
|
+
"Response": function() { return response_Response; },
|
|
13886
13976
|
"STATUSES": function() { return component/* STATUSES */.n$; },
|
|
13887
13977
|
"Select": function() { return selection/* Select */.P; },
|
|
13888
13978
|
"Snapshot": function() { return Snapshot; },
|
|
@@ -14258,15 +14348,39 @@ class Async {
|
|
|
14258
14348
|
}
|
|
14259
14349
|
}
|
|
14260
14350
|
|
|
14261
|
-
;// CONCATENATED MODULE: ./src/core/
|
|
14351
|
+
;// CONCATENATED MODULE: ./src/core/request/response.ts
|
|
14262
14352
|
/*!
|
|
14263
14353
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
14264
14354
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
14265
14355
|
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
14266
14356
|
*/
|
|
14357
|
+
class response_Response {
|
|
14358
|
+
constructor(request, status, statusText, body) {
|
|
14359
|
+
this.request = request;
|
|
14360
|
+
this.status = status;
|
|
14361
|
+
this.statusText = statusText;
|
|
14362
|
+
this.body = body;
|
|
14363
|
+
}
|
|
14364
|
+
get url() {
|
|
14365
|
+
return this.request.url;
|
|
14366
|
+
}
|
|
14367
|
+
async json() {
|
|
14368
|
+
return JSON.parse(this.body);
|
|
14369
|
+
}
|
|
14370
|
+
text() {
|
|
14371
|
+
return Promise.resolve(this.body);
|
|
14372
|
+
}
|
|
14373
|
+
}
|
|
14267
14374
|
|
|
14375
|
+
;// CONCATENATED MODULE: ./src/core/request/config.ts
|
|
14376
|
+
/*!
|
|
14377
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
14378
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
14379
|
+
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
14380
|
+
*/
|
|
14268
14381
|
|
|
14269
14382
|
config/* Config.prototype.defaultAjaxOptions */.D.prototype.defaultAjaxOptions = {
|
|
14383
|
+
successStatuses: [200, 201, 202],
|
|
14270
14384
|
dataType: 'json',
|
|
14271
14385
|
method: 'GET',
|
|
14272
14386
|
url: '',
|
|
@@ -14280,15 +14394,25 @@ config/* Config.prototype.defaultAjaxOptions */.D.prototype.defaultAjaxOptions =
|
|
|
14280
14394
|
return new XMLHttpRequest();
|
|
14281
14395
|
}
|
|
14282
14396
|
};
|
|
14397
|
+
|
|
14398
|
+
;// CONCATENATED MODULE: ./src/core/request/ajax.ts
|
|
14399
|
+
/*!
|
|
14400
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
14401
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
14402
|
+
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
14403
|
+
*/
|
|
14404
|
+
|
|
14405
|
+
|
|
14406
|
+
|
|
14407
|
+
|
|
14283
14408
|
class Ajax {
|
|
14284
14409
|
constructor(jodit, options) {
|
|
14285
14410
|
this.jodit = jodit;
|
|
14286
|
-
this.successResponseCodes = [200, 201, 202];
|
|
14287
14411
|
this.resolved = false;
|
|
14288
14412
|
this.activated = false;
|
|
14289
14413
|
this.options = (0,helpers.ConfigProto)(options || {}, config/* Config.prototype.defaultAjaxOptions */.D.prototype.defaultAjaxOptions);
|
|
14290
14414
|
this.xhr = this.o.xhr ? this.o.xhr() : new XMLHttpRequest();
|
|
14291
|
-
jodit && jodit.e && jodit.e.on('beforeDestruct', () => this.
|
|
14415
|
+
jodit && jodit.e && jodit.e.on('beforeDestruct', () => this.destruct());
|
|
14292
14416
|
}
|
|
14293
14417
|
__buildParams(obj, prefix) {
|
|
14294
14418
|
if ((0,helpers.isFunction)(this.o.queryBuild)) {
|
|
@@ -14316,33 +14440,22 @@ class Ajax {
|
|
|
14316
14440
|
}
|
|
14317
14441
|
send() {
|
|
14318
14442
|
this.activated = true;
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
if (!result) {
|
|
14326
|
-
throw (0,helpers.error)('No JSON format');
|
|
14327
|
-
}
|
|
14328
|
-
return result;
|
|
14329
|
-
};
|
|
14330
|
-
this.xhr.onabort = () => {
|
|
14331
|
-
reject((0,helpers.error)(this.xhr.statusText));
|
|
14332
|
-
};
|
|
14333
|
-
this.xhr.onerror = () => {
|
|
14334
|
-
reject((0,helpers.error)(this.xhr.statusText));
|
|
14335
|
-
};
|
|
14336
|
-
this.xhr.ontimeout = () => {
|
|
14337
|
-
reject((0,helpers.error)(this.xhr.statusText));
|
|
14443
|
+
const { xhr, o } = this;
|
|
14444
|
+
const request = this.prepareRequest();
|
|
14445
|
+
return this.j.async.promise((resolve, reject) => {
|
|
14446
|
+
var _a;
|
|
14447
|
+
const onReject = () => {
|
|
14448
|
+
reject((0,helpers.error)('Connection error'));
|
|
14338
14449
|
};
|
|
14339
|
-
|
|
14340
|
-
this.response = this.xhr.responseText;
|
|
14341
|
-
this.status = this.xhr.status;
|
|
14450
|
+
const onResolve = () => {
|
|
14342
14451
|
this.resolved = true;
|
|
14343
|
-
resolve
|
|
14452
|
+
resolve(new response_Response(request, xhr.status, xhr.statusText, xhr.responseText));
|
|
14344
14453
|
};
|
|
14345
|
-
|
|
14454
|
+
xhr.onabort = onReject;
|
|
14455
|
+
xhr.onerror = onReject;
|
|
14456
|
+
xhr.ontimeout = onReject;
|
|
14457
|
+
xhr.onload = onResolve;
|
|
14458
|
+
xhr.onprogress = (e) => {
|
|
14346
14459
|
var _a, _b;
|
|
14347
14460
|
let percentComplete = 0;
|
|
14348
14461
|
if (e.lengthComputable) {
|
|
@@ -14350,37 +14463,32 @@ class Ajax {
|
|
|
14350
14463
|
}
|
|
14351
14464
|
(_b = (_a = this.options).onProgress) === null || _b === void 0 ? void 0 : _b.call(_a, percentComplete);
|
|
14352
14465
|
};
|
|
14353
|
-
|
|
14466
|
+
xhr.onreadystatechange = () => {
|
|
14354
14467
|
var _a, _b;
|
|
14355
14468
|
(_b = (_a = this.options).onProgress) === null || _b === void 0 ? void 0 : _b.call(_a, 10);
|
|
14356
|
-
if (
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
this.status = this.xhr.status;
|
|
14360
|
-
this.resolved = true;
|
|
14361
|
-
if (this.successResponseCodes.indexOf(this.xhr.status) >
|
|
14362
|
-
-1) {
|
|
14363
|
-
resolve.call(this.xhr, __parse(resp));
|
|
14469
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
14470
|
+
if (o.successStatuses.includes(xhr.status)) {
|
|
14471
|
+
onResolve();
|
|
14364
14472
|
}
|
|
14365
14473
|
else {
|
|
14366
|
-
reject
|
|
14367
|
-
this.j.i18n('Connection error!')));
|
|
14474
|
+
reject((0,helpers.error)(xhr.statusText || 'Connection error'));
|
|
14368
14475
|
}
|
|
14369
14476
|
}
|
|
14370
14477
|
};
|
|
14371
|
-
|
|
14372
|
-
const { url, data, method } =
|
|
14373
|
-
|
|
14374
|
-
if (
|
|
14375
|
-
|
|
14376
|
-
}
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
|
|
14478
|
+
xhr.withCredentials = (_a = o.withCredentials) !== null && _a !== void 0 ? _a : false;
|
|
14479
|
+
const { url, data, method } = request;
|
|
14480
|
+
xhr.open(method, url, true);
|
|
14481
|
+
if (o.contentType && xhr.setRequestHeader) {
|
|
14482
|
+
xhr.setRequestHeader('Content-type', o.contentType);
|
|
14483
|
+
}
|
|
14484
|
+
const { headers } = o;
|
|
14485
|
+
if (headers && xhr.setRequestHeader) {
|
|
14486
|
+
Object.keys(headers).forEach(key => {
|
|
14487
|
+
xhr.setRequestHeader(key, headers[key]);
|
|
14380
14488
|
});
|
|
14381
14489
|
}
|
|
14382
14490
|
this.j.async.setTimeout(() => {
|
|
14383
|
-
|
|
14491
|
+
xhr.send(data ? this.__buildParams(data) : undefined);
|
|
14384
14492
|
}, 0);
|
|
14385
14493
|
});
|
|
14386
14494
|
}
|
|
@@ -14422,6 +14530,15 @@ class Ajax {
|
|
|
14422
14530
|
}
|
|
14423
14531
|
Ajax.log = [];
|
|
14424
14532
|
|
|
14533
|
+
;// CONCATENATED MODULE: ./src/core/request/index.ts
|
|
14534
|
+
/*!
|
|
14535
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
14536
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
14537
|
+
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
14538
|
+
*/
|
|
14539
|
+
|
|
14540
|
+
|
|
14541
|
+
|
|
14425
14542
|
// EXTERNAL MODULE: ./src/core/component/index.ts + 3 modules
|
|
14426
14543
|
var component = __webpack_require__(12);
|
|
14427
14544
|
// EXTERNAL MODULE: ./src/core/ui/popup/index.ts + 1 modules
|
|
@@ -14445,7 +14562,7 @@ class ContextMenu extends ui_popup/* Popup */.G {
|
|
|
14445
14562
|
return 'ContextMenu';
|
|
14446
14563
|
}
|
|
14447
14564
|
show(x, y, actions) {
|
|
14448
|
-
const self = this, content = this.j.c.div('
|
|
14565
|
+
const self = this, content = this.j.c.div(this.getFullElName('actions'));
|
|
14449
14566
|
if (!(0,checker/* isArray */.kJ)(actions)) {
|
|
14450
14567
|
return;
|
|
14451
14568
|
}
|
|
@@ -14644,7 +14761,7 @@ class View extends component/* Component */.wA {
|
|
|
14644
14761
|
this.isView = true;
|
|
14645
14762
|
this.mods = {};
|
|
14646
14763
|
this.components = new Set();
|
|
14647
|
-
this.version = "3.
|
|
14764
|
+
this.version = "3.9.2";
|
|
14648
14765
|
this.async = new Async();
|
|
14649
14766
|
this.buffer = Storage.makeStorage();
|
|
14650
14767
|
this.storage = Storage.makeStorage(true, this.componentName);
|
|
@@ -14657,7 +14774,7 @@ class View extends component/* Component */.wA {
|
|
|
14657
14774
|
this.buffer = Storage.makeStorage();
|
|
14658
14775
|
this.initOptions(options);
|
|
14659
14776
|
this.initOwners();
|
|
14660
|
-
this.events = new events/*
|
|
14777
|
+
this.events = new events/* EventEmitter */.vp(this.od);
|
|
14661
14778
|
this.create = new Create(this.od);
|
|
14662
14779
|
this.container = this.c.div();
|
|
14663
14780
|
this.container.classList.add('jodit');
|
|
@@ -14742,10 +14859,10 @@ class View extends component/* Component */.wA {
|
|
|
14742
14859
|
return this.__isFullSize;
|
|
14743
14860
|
}
|
|
14744
14861
|
getVersion() {
|
|
14745
|
-
return "3.
|
|
14862
|
+
return "3.9.2";
|
|
14746
14863
|
}
|
|
14747
14864
|
static getVersion() {
|
|
14748
|
-
return "3.
|
|
14865
|
+
return "3.9.2";
|
|
14749
14866
|
}
|
|
14750
14867
|
initOptions(options) {
|
|
14751
14868
|
this.options = (0,helpers.ConfigProto)(options || {}, (0,helpers.ConfigProto)(this.options || {}, View.defaultOptions));
|
|
@@ -16628,7 +16745,7 @@ class DataProvider {
|
|
|
16628
16745
|
get o() {
|
|
16629
16746
|
return this.options;
|
|
16630
16747
|
}
|
|
16631
|
-
get(name
|
|
16748
|
+
get(name) {
|
|
16632
16749
|
const ai = this.ajaxInstances;
|
|
16633
16750
|
if (ai.has(name)) {
|
|
16634
16751
|
const ajax = ai.get(name);
|
|
@@ -16644,25 +16761,21 @@ class DataProvider {
|
|
|
16644
16761
|
opts.data = opts.prepareData.call(this, opts.data);
|
|
16645
16762
|
}
|
|
16646
16763
|
const ajax = new Ajax(this.parent, opts);
|
|
16647
|
-
let promise = ajax.send();
|
|
16648
16764
|
ai.set(name, ajax);
|
|
16649
|
-
promise =
|
|
16650
|
-
|
|
16651
|
-
throw new Error(this.getMessage(resp));
|
|
16652
|
-
}
|
|
16653
|
-
return resp;
|
|
16654
|
-
});
|
|
16655
|
-
if (success) {
|
|
16656
|
-
promise = promise.then(success);
|
|
16657
|
-
}
|
|
16658
|
-
if (error) {
|
|
16659
|
-
promise = promise.catch(error);
|
|
16660
|
-
}
|
|
16661
|
-
return promise.finally(() => {
|
|
16765
|
+
const promise = ajax.send();
|
|
16766
|
+
promise.finally(() => {
|
|
16662
16767
|
ajax.destruct();
|
|
16663
16768
|
ai.delete(name);
|
|
16664
16769
|
this.progressHandler(100);
|
|
16665
16770
|
});
|
|
16771
|
+
return promise
|
|
16772
|
+
.then(resp => resp.json())
|
|
16773
|
+
.then(resp => {
|
|
16774
|
+
if (resp && !this.isSuccess(resp)) {
|
|
16775
|
+
throw new Error(this.getMessage(resp));
|
|
16776
|
+
}
|
|
16777
|
+
return resp;
|
|
16778
|
+
});
|
|
16666
16779
|
}
|
|
16667
16780
|
onProgress(callback) {
|
|
16668
16781
|
this.progressHandler = callback;
|
|
@@ -16764,7 +16877,7 @@ class DataProvider {
|
|
|
16764
16877
|
}
|
|
16765
16878
|
getPathByUrl(url) {
|
|
16766
16879
|
(0,helpers.set)('options.getLocalFileByUrl.data.url', url, this);
|
|
16767
|
-
return this.get('getLocalFileByUrl'
|
|
16880
|
+
return this.get('getLocalFileByUrl').then(resp => {
|
|
16768
16881
|
if (this.isSuccess(resp)) {
|
|
16769
16882
|
return resp.data;
|
|
16770
16883
|
}
|
|
@@ -16816,9 +16929,6 @@ class DataProvider {
|
|
|
16816
16929
|
if (fr.process) {
|
|
16817
16930
|
resp = fr.process.call(this, resp);
|
|
16818
16931
|
}
|
|
16819
|
-
if (!this.isSuccess(resp)) {
|
|
16820
|
-
throw (0,helpers.error)(this.getMessage(resp));
|
|
16821
|
-
}
|
|
16822
16932
|
return this.getMessage(resp);
|
|
16823
16933
|
});
|
|
16824
16934
|
}
|
|
@@ -16841,9 +16951,6 @@ class DataProvider {
|
|
|
16841
16951
|
if (fr.process) {
|
|
16842
16952
|
resp = fr.process.call(self, resp);
|
|
16843
16953
|
}
|
|
16844
|
-
if (!this.isSuccess(resp)) {
|
|
16845
|
-
throw (0,helpers.error)(this.getMessage(resp));
|
|
16846
|
-
}
|
|
16847
16954
|
return this.getMessage(resp);
|
|
16848
16955
|
});
|
|
16849
16956
|
}
|
|
@@ -16872,11 +16979,8 @@ class DataProvider {
|
|
|
16872
16979
|
query.data.path = path;
|
|
16873
16980
|
query.data.name = name;
|
|
16874
16981
|
query.data.source = source;
|
|
16875
|
-
return this.get(type).then(
|
|
16876
|
-
|
|
16877
|
-
return true;
|
|
16878
|
-
}
|
|
16879
|
-
throw (0,helpers.error)(this.getMessage(resp));
|
|
16982
|
+
return this.get(type).then(() => {
|
|
16983
|
+
return true;
|
|
16880
16984
|
});
|
|
16881
16985
|
}
|
|
16882
16986
|
crop(path, source, name, newname, box) {
|
|
@@ -18840,9 +18944,7 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
18840
18944
|
}
|
|
18841
18945
|
static getColumnsCount(table) {
|
|
18842
18946
|
const matrix = Table.formalMatrix(table);
|
|
18843
|
-
return matrix.reduce((max_count, cells) =>
|
|
18844
|
-
return Math.max(max_count, cells.length);
|
|
18845
|
-
}, 0);
|
|
18947
|
+
return matrix.reduce((max_count, cells) => Math.max(max_count, cells.length), 0);
|
|
18846
18948
|
}
|
|
18847
18949
|
static formalMatrix(table, callback) {
|
|
18848
18950
|
const matrix = [[]];
|
|
@@ -18897,6 +18999,7 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
18897
18999
|
return [i, j, width, height];
|
|
18898
19000
|
}
|
|
18899
19001
|
static appendRow(table, line, after, create) {
|
|
19002
|
+
var _a;
|
|
18900
19003
|
let row;
|
|
18901
19004
|
if (!line) {
|
|
18902
19005
|
const columnsCount = Table.getColumnsCount(table);
|
|
@@ -18926,7 +19029,7 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
18926
19029
|
line.parentNode && line.parentNode.insertBefore(row, line);
|
|
18927
19030
|
}
|
|
18928
19031
|
else {
|
|
18929
|
-
((
|
|
19032
|
+
(((_a = table.getElementsByTagName('tbody')) === null || _a === void 0 ? void 0 : _a[0]) || table).appendChild(row);
|
|
18930
19033
|
}
|
|
18931
19034
|
}
|
|
18932
19035
|
static removeRow(table, rowIndex) {
|
|
@@ -18946,12 +19049,14 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
18946
19049
|
while (box[rowIndex + 1][nextCell] === cell) {
|
|
18947
19050
|
nextCell += 1;
|
|
18948
19051
|
}
|
|
18949
|
-
const nextRow = dom/* Dom.next */.i.next(cell.parentNode,
|
|
18950
|
-
if (
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
19052
|
+
const nextRow = dom/* Dom.next */.i.next(cell.parentNode, elm => dom/* Dom.isTag */.i.isTag(elm, 'tr'), table);
|
|
19053
|
+
if (nextRow) {
|
|
19054
|
+
if (box[rowIndex + 1][nextCell]) {
|
|
19055
|
+
nextRow.insertBefore(cell, box[rowIndex + 1][nextCell]);
|
|
19056
|
+
}
|
|
19057
|
+
else {
|
|
19058
|
+
nextRow.appendChild(cell);
|
|
19059
|
+
}
|
|
18955
19060
|
}
|
|
18956
19061
|
}
|
|
18957
19062
|
}
|
|
@@ -18961,7 +19066,7 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
18961
19066
|
if (dec &&
|
|
18962
19067
|
(cell.parentNode === row || cell !== box[rowIndex][j - 1])) {
|
|
18963
19068
|
const rowSpan = cell.rowSpan;
|
|
18964
|
-
(0,helpers.attr)(cell, 'rowspan', rowSpan - 1 > 1 ?
|
|
19069
|
+
(0,helpers.attr)(cell, 'rowspan', rowSpan - 1 > 1 ? rowSpan - 1 : null);
|
|
18965
19070
|
}
|
|
18966
19071
|
});
|
|
18967
19072
|
dom/* Dom.safeRemove */.i.safeRemove(row);
|
|
@@ -18980,8 +19085,7 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
18980
19085
|
if ((box[i] && td && j + 1 >= box[i].length) ||
|
|
18981
19086
|
td !== box[i][j + 1]) {
|
|
18982
19087
|
if (td.nextSibling) {
|
|
18983
|
-
td.
|
|
18984
|
-
td.parentNode.insertBefore(cell, td.nextSibling);
|
|
19088
|
+
dom/* Dom.before */.i.before(td.nextSibling, cell);
|
|
18985
19089
|
}
|
|
18986
19090
|
else {
|
|
18987
19091
|
td.parentNode && td.parentNode.appendChild(cell);
|
|
@@ -18992,13 +19096,12 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
18992
19096
|
else {
|
|
18993
19097
|
if (j - 1 < 0 ||
|
|
18994
19098
|
(box[i][j] !== box[i][j - 1] && box[i][j].parentNode)) {
|
|
18995
|
-
|
|
18996
|
-
td.parentNode.insertBefore(cell, box[i][j]);
|
|
19099
|
+
dom/* Dom.before */.i.before(box[i][j], cell);
|
|
18997
19100
|
added = true;
|
|
18998
19101
|
}
|
|
18999
19102
|
}
|
|
19000
19103
|
if (!added) {
|
|
19001
|
-
box[i][j]
|
|
19104
|
+
(0,helpers.attr)(box[i][j], 'colspan', parseInt((0,helpers.attr)(box[i][j], 'colspan') || '1', 10) + 1);
|
|
19002
19105
|
}
|
|
19003
19106
|
}
|
|
19004
19107
|
}
|
|
@@ -19123,15 +19226,15 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
19123
19226
|
}
|
|
19124
19227
|
if (box[i][j].hasAttribute('rowspan') &&
|
|
19125
19228
|
box[i][j].rowSpan === 1) {
|
|
19126
|
-
box[i][j]
|
|
19229
|
+
(0,helpers.attr)(box[i][j], 'rowspan', null);
|
|
19127
19230
|
}
|
|
19128
19231
|
if (box[i][j].hasAttribute('colspan') &&
|
|
19129
19232
|
box[i][j].colSpan === 1) {
|
|
19130
|
-
box[i][j]
|
|
19233
|
+
(0,helpers.attr)(box[i][j], 'colspan', null);
|
|
19131
19234
|
}
|
|
19132
19235
|
if (box[i][j].hasAttribute('class') &&
|
|
19133
19236
|
!(0,helpers.attr)(box[i][j], 'class')) {
|
|
19134
|
-
box[i][j]
|
|
19237
|
+
(0,helpers.attr)(box[i][j], 'class', null);
|
|
19135
19238
|
}
|
|
19136
19239
|
}
|
|
19137
19240
|
}
|
|
@@ -19252,13 +19355,11 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
19252
19355
|
static splitVertical(table, jodit) {
|
|
19253
19356
|
let coord, td, percentage;
|
|
19254
19357
|
const __marked = [];
|
|
19255
|
-
Table.getSelectedCellsByTable(table).forEach(
|
|
19358
|
+
Table.getSelectedCellsByTable(table).forEach(cell => {
|
|
19256
19359
|
coord = Table.formalCoordinate(table, cell);
|
|
19257
19360
|
if (cell.colSpan < 2) {
|
|
19258
19361
|
Table.formalMatrix(table, (tdElm, i, j) => {
|
|
19259
|
-
if (coord[1] === j &&
|
|
19260
|
-
coord[0] !== i &&
|
|
19261
|
-
tdElm !== cell) {
|
|
19362
|
+
if (coord[1] === j && coord[0] !== i && tdElm !== cell) {
|
|
19262
19363
|
Table.__mark(tdElm, 'colspan', tdElm.colSpan + 1, __marked);
|
|
19263
19364
|
}
|
|
19264
19365
|
});
|
|
@@ -19285,12 +19386,13 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
19285
19386
|
const box = Table.formalMatrix(table);
|
|
19286
19387
|
for (let i = 0; i < box.length; i += 1) {
|
|
19287
19388
|
const cell = box[i][column];
|
|
19288
|
-
if (cell.colSpan > 1) {
|
|
19389
|
+
if (cell.colSpan > 1 && box.length > 1) {
|
|
19289
19390
|
continue;
|
|
19290
19391
|
}
|
|
19291
19392
|
const w = cell.offsetWidth;
|
|
19292
19393
|
const percent = ((w + delta) / table.offsetWidth) * 100;
|
|
19293
19394
|
Table.__mark(cell, 'width', percent.toFixed(constants.ACCURACY) + '%', marked);
|
|
19395
|
+
break;
|
|
19294
19396
|
}
|
|
19295
19397
|
if (!noUnmark) {
|
|
19296
19398
|
Table.__unmark(marked);
|
|
@@ -19312,20 +19414,10 @@ class Table extends component/* ViewComponent */.Hr {
|
|
|
19312
19414
|
dom/* Dom.safeRemove */.i.safeRemove(cell);
|
|
19313
19415
|
break;
|
|
19314
19416
|
case 'rowspan':
|
|
19315
|
-
|
|
19316
|
-
cell.setAttribute('rowspan', value.toString());
|
|
19317
|
-
}
|
|
19318
|
-
else {
|
|
19319
|
-
cell.removeAttribute('rowspan');
|
|
19320
|
-
}
|
|
19417
|
+
(0,helpers.attr)(cell, 'rowspan', value > 1 ? value : null);
|
|
19321
19418
|
break;
|
|
19322
19419
|
case 'colspan':
|
|
19323
|
-
|
|
19324
|
-
cell.setAttribute('colspan', value.toString());
|
|
19325
|
-
}
|
|
19326
|
-
else {
|
|
19327
|
-
cell.removeAttribute('colspan');
|
|
19328
|
-
}
|
|
19420
|
+
(0,helpers.attr)(cell, 'colspan', value > 1 ? value : null);
|
|
19329
19421
|
break;
|
|
19330
19422
|
case 'width':
|
|
19331
19423
|
cell.style.width = value.toString();
|
|
@@ -19523,6 +19615,7 @@ class Uploader extends component/* ViewComponent */.Hr {
|
|
|
19523
19615
|
};
|
|
19524
19616
|
return ajax
|
|
19525
19617
|
.send()
|
|
19618
|
+
.then(resp => resp.json())
|
|
19526
19619
|
.then(resp => {
|
|
19527
19620
|
removeAjaxInstanceFromList();
|
|
19528
19621
|
success.call(this, resp);
|
|
@@ -21684,6 +21777,7 @@ class cleanHtml extends Plugin {
|
|
|
21684
21777
|
if (!nodeElm) {
|
|
21685
21778
|
return work;
|
|
21686
21779
|
}
|
|
21780
|
+
nodeElm = this.replaceIfMatched(nodeElm);
|
|
21687
21781
|
if (this.isRemovableNode(nodeElm, current)) {
|
|
21688
21782
|
remove.push(nodeElm);
|
|
21689
21783
|
return this.visitNode(nodeElm.nextSibling, current, remove);
|
|
@@ -21759,6 +21853,18 @@ class cleanHtml extends Plugin {
|
|
|
21759
21853
|
.on('keyup.cleanHtml', this.onKeyUpCleanUp)
|
|
21760
21854
|
.on('beforeCommand.cleanHtml', this.beforeCommand);
|
|
21761
21855
|
}
|
|
21856
|
+
replaceIfMatched(oldParent) {
|
|
21857
|
+
const replaceOldTags = this.j.o.cleanHTML.replaceOldTags;
|
|
21858
|
+
if (!replaceOldTags || !dom/* Dom.isHTMLElement */.i.isHTMLElement(oldParent)) {
|
|
21859
|
+
return oldParent;
|
|
21860
|
+
}
|
|
21861
|
+
const tagName = replaceOldTags[oldParent.nodeName.toLowerCase()] ||
|
|
21862
|
+
replaceOldTags[oldParent.nodeName];
|
|
21863
|
+
if (tagName) {
|
|
21864
|
+
return dom/* Dom.replace */.i.replace(oldParent, tagName, this.j.createInside, true, false);
|
|
21865
|
+
}
|
|
21866
|
+
return oldParent;
|
|
21867
|
+
}
|
|
21762
21868
|
onChangeCleanHTML() {
|
|
21763
21869
|
if (!this.allowEdit()) {
|
|
21764
21870
|
return;
|
|
@@ -21773,9 +21879,7 @@ class cleanHtml extends Plugin {
|
|
|
21773
21879
|
const oldParent = dom/* Dom.closest */.i.closest(current, tags, editor.editor);
|
|
21774
21880
|
if (oldParent) {
|
|
21775
21881
|
editor.s.save();
|
|
21776
|
-
|
|
21777
|
-
replaceOldTags[oldParent.nodeName];
|
|
21778
|
-
dom/* Dom.replace */.i.replace(oldParent, tagName, editor.createInside, true, false);
|
|
21882
|
+
this.replaceIfMatched(oldParent);
|
|
21779
21883
|
editor.s.restore();
|
|
21780
21884
|
}
|
|
21781
21885
|
}
|
|
@@ -21890,13 +21994,16 @@ class cleanHtml extends Plugin {
|
|
|
21890
21994
|
if (this.isInlineBlock(node)) {
|
|
21891
21995
|
shouldUnwrap.push(node);
|
|
21892
21996
|
}
|
|
21997
|
+
if (dom/* Dom.isElement */.i.isElement(node) && (0,helpers.attr)(node, 'style')) {
|
|
21998
|
+
(0,helpers.attr)(node, 'style', null);
|
|
21999
|
+
}
|
|
21893
22000
|
});
|
|
21894
22001
|
shouldUnwrap.forEach(node => dom/* Dom.unwrap */.i.unwrap(node));
|
|
21895
22002
|
const clearParent = (node, left) => {
|
|
21896
22003
|
if (!findNotEmptySibling(node, left)) {
|
|
21897
22004
|
const pn = node.parentNode;
|
|
21898
|
-
if (pn && pn !== s.area &&
|
|
21899
|
-
|
|
22005
|
+
if (pn && pn !== s.area && (0,helpers.attr)(pn, 'style')) {
|
|
22006
|
+
(0,helpers.attr)(pn, 'style', null);
|
|
21900
22007
|
clearParent(pn, left);
|
|
21901
22008
|
return true;
|
|
21902
22009
|
}
|
|
@@ -24866,15 +24973,16 @@ function image_image(editor) {
|
|
|
24866
24973
|
config/* Config.prototype.controls.indent */.D.prototype.controls.indent = {
|
|
24867
24974
|
tooltip: 'Increase Indent'
|
|
24868
24975
|
};
|
|
24869
|
-
const getKey = (direction) => direction === 'rtl' ? '
|
|
24976
|
+
const getKey = (direction, box) => `${dom/* Dom.isCell */.i.isCell(box) ? 'padding' : 'margin'}${direction === 'rtl' ? 'Right' : 'Left'}`;
|
|
24870
24977
|
config/* Config.prototype.controls.outdent */.D.prototype.controls.outdent = {
|
|
24871
24978
|
isDisabled: (editor) => {
|
|
24872
24979
|
const current = editor.s.current();
|
|
24873
24980
|
if (current) {
|
|
24874
24981
|
const currentBox = dom/* Dom.closest */.i.closest(current, dom/* Dom.isBlock */.i.isBlock, editor.editor);
|
|
24875
|
-
|
|
24876
|
-
|
|
24877
|
-
return
|
|
24982
|
+
if (currentBox) {
|
|
24983
|
+
const arrow = getKey(editor.o.direction, currentBox);
|
|
24984
|
+
return (!currentBox.style[arrow] ||
|
|
24985
|
+
parseInt(currentBox.style[arrow], 10) <= 0);
|
|
24878
24986
|
}
|
|
24879
24987
|
}
|
|
24880
24988
|
return true;
|
|
@@ -24883,7 +24991,6 @@ config/* Config.prototype.controls.outdent */.D.prototype.controls.outdent = {
|
|
|
24883
24991
|
};
|
|
24884
24992
|
config/* Config.prototype.indentMargin */.D.prototype.indentMargin = 10;
|
|
24885
24993
|
function indent(editor) {
|
|
24886
|
-
const key = getKey(editor.o.direction);
|
|
24887
24994
|
editor
|
|
24888
24995
|
.registerButton({
|
|
24889
24996
|
name: 'indent',
|
|
@@ -24894,13 +25001,13 @@ function indent(editor) {
|
|
|
24894
25001
|
group: 'indent'
|
|
24895
25002
|
});
|
|
24896
25003
|
const callback = (command) => {
|
|
24897
|
-
const
|
|
25004
|
+
const processedElements = [];
|
|
24898
25005
|
editor.s.eachSelection((current) => {
|
|
24899
25006
|
editor.s.save();
|
|
24900
25007
|
let currentBox = current
|
|
24901
25008
|
? dom/* Dom.up */.i.up(current, dom/* Dom.isBlock */.i.isBlock, editor.editor)
|
|
24902
25009
|
: false;
|
|
24903
|
-
const enter = editor.o
|
|
25010
|
+
const { enter } = editor.o;
|
|
24904
25011
|
if (!currentBox && current) {
|
|
24905
25012
|
currentBox = dom/* Dom.wrapInline */.i.wrapInline(current, enter !== constants.BR ? enter : constants.PARAGRAPH, editor);
|
|
24906
25013
|
}
|
|
@@ -24908,9 +25015,10 @@ function indent(editor) {
|
|
|
24908
25015
|
editor.s.restore();
|
|
24909
25016
|
return false;
|
|
24910
25017
|
}
|
|
24911
|
-
const alreadyIndented =
|
|
24912
|
-
if (currentBox &&
|
|
24913
|
-
|
|
25018
|
+
const alreadyIndented = processedElements.includes(currentBox);
|
|
25019
|
+
if (currentBox && !alreadyIndented) {
|
|
25020
|
+
const key = getKey(editor.o.direction, currentBox);
|
|
25021
|
+
processedElements.push(currentBox);
|
|
24914
25022
|
let value = currentBox.style[key]
|
|
24915
25023
|
? parseInt(currentBox.style[key], 10)
|
|
24916
25024
|
: 0;
|
|
@@ -24918,7 +25026,7 @@ function indent(editor) {
|
|
|
24918
25026
|
editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
|
|
24919
25027
|
currentBox.style[key] = value > 0 ? value + 'px' : '';
|
|
24920
25028
|
if (!(0,helpers.attr)(currentBox, 'style')) {
|
|
24921
|
-
|
|
25029
|
+
(0,helpers.attr)(currentBox, 'style', null);
|
|
24922
25030
|
}
|
|
24923
25031
|
}
|
|
24924
25032
|
editor.s.restore();
|
|
@@ -27425,7 +27533,7 @@ let resizeHandler = class resizeHandler extends Plugin {
|
|
|
27425
27533
|
this.j.unlock();
|
|
27426
27534
|
}
|
|
27427
27535
|
}
|
|
27428
|
-
beforeDestruct(
|
|
27536
|
+
beforeDestruct() {
|
|
27429
27537
|
dom/* Dom.safeRemove */.i.safeRemove(this.handle);
|
|
27430
27538
|
this.j.e.off(this.j.ow, 'mouseup touchsend', this.onHandleResizeEnd);
|
|
27431
27539
|
}
|
|
@@ -27550,9 +27658,7 @@ let size = class size extends Plugin {
|
|
|
27550
27658
|
}
|
|
27551
27659
|
}
|
|
27552
27660
|
beforeDestruct(jodit) {
|
|
27553
|
-
this.
|
|
27554
|
-
.off(this.j.ow, 'load.size', this.resizeWorkspaces)
|
|
27555
|
-
.off('.size');
|
|
27661
|
+
jodit.e.off(jodit.ow, 'load.size', this.resizeWorkspaces).off('.size');
|
|
27556
27662
|
}
|
|
27557
27663
|
};
|
|
27558
27664
|
size = (0,tslib_es6/* __decorate */.gn)([
|
|
@@ -28207,7 +28313,7 @@ class source extends Plugin {
|
|
|
28207
28313
|
});
|
|
28208
28314
|
}
|
|
28209
28315
|
}
|
|
28210
|
-
beforeDestruct(
|
|
28316
|
+
beforeDestruct() {
|
|
28211
28317
|
if (this.sourceEditor) {
|
|
28212
28318
|
this.sourceEditor.destruct();
|
|
28213
28319
|
delete this.sourceEditor;
|
|
@@ -29397,10 +29503,23 @@ class selectCells extends Plugin {
|
|
|
29397
29503
|
dom/* Dom.safeRemove */.i.safeRemove(table);
|
|
29398
29504
|
break;
|
|
29399
29505
|
case 'binrow':
|
|
29400
|
-
|
|
29506
|
+
new Set(cells.map(td => td.parentNode)).forEach(row => {
|
|
29507
|
+
Table.removeRow(table, row.rowIndex);
|
|
29508
|
+
});
|
|
29401
29509
|
break;
|
|
29402
29510
|
case 'bincolumn':
|
|
29403
|
-
|
|
29511
|
+
{
|
|
29512
|
+
const columnsSet = new Set(), columns = cells.reduce((acc, td) => {
|
|
29513
|
+
if (!columnsSet.has(td.cellIndex)) {
|
|
29514
|
+
acc.push(td);
|
|
29515
|
+
columnsSet.add(td.cellIndex);
|
|
29516
|
+
}
|
|
29517
|
+
return acc;
|
|
29518
|
+
}, []);
|
|
29519
|
+
columns.forEach(td => {
|
|
29520
|
+
Table.removeColumn(table, td.cellIndex);
|
|
29521
|
+
});
|
|
29522
|
+
}
|
|
29404
29523
|
break;
|
|
29405
29524
|
case 'addcolumnafter':
|
|
29406
29525
|
case 'addcolumnbefore':
|