jodit 4.4.7 → 4.5.1
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 +25 -3
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +82 -40
- package/es2015/jodit.min.js +2 -2
- 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.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +82 -40
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.css +1 -1
- package/es2018/plugins/debug/debug.js +1 -1
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +82 -40
- package/es2021/jodit.min.js +2 -2
- 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 +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +82 -40
- package/es2021.en/jodit.min.js +2 -2
- 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/5.fat.min.js +1 -1
- package/es5/5.min.js +1 -1
- package/es5/975.fat.min.js +1 -1
- package/es5/975.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +82 -40
- package/es5/jodit.min.css +2 -2
- 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/esm/core/constants.js +1 -1
- package/esm/core/dom/dom.d.ts +5 -0
- package/esm/core/dom/dom.js +36 -12
- package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +11 -5
- package/esm/plugins/indent/indent.js +34 -22
- package/package.json +1 -1
- package/types/core/dom/dom.d.ts +5 -0
package/es2021/jodit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.
|
|
4
|
+
* Version: v4.5.1
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1743,7 +1743,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1743
1743
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
1744
1744
|
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
1745
1745
|
*/
|
|
1746
|
-
const APP_VERSION = "4.
|
|
1746
|
+
const APP_VERSION = "4.5.1";
|
|
1747
1747
|
// prettier-ignore
|
|
1748
1748
|
const ES = "es2021";
|
|
1749
1749
|
const IS_ES_MODERN = true;
|
|
@@ -2884,28 +2884,25 @@ class Dom {
|
|
|
2884
2884
|
}
|
|
2885
2885
|
}
|
|
2886
2886
|
/**
|
|
2887
|
-
* Wrap all inline siblings
|
|
2887
|
+
* Wrap all inline next siblings
|
|
2888
2888
|
*/
|
|
2889
|
-
static
|
|
2890
|
-
let tmp
|
|
2889
|
+
static wrapNextInline(current, tag, editor) {
|
|
2890
|
+
let tmp;
|
|
2891
|
+
const first = current;
|
|
2892
|
+
let last = current;
|
|
2891
2893
|
editor.s.save();
|
|
2892
2894
|
let needFindNext = false;
|
|
2893
|
-
do {
|
|
2894
|
-
needFindNext = false;
|
|
2895
|
-
tmp = first.previousSibling;
|
|
2896
|
-
if (tmp && !Dom.isBlock(tmp)) {
|
|
2897
|
-
needFindNext = true;
|
|
2898
|
-
first = tmp;
|
|
2899
|
-
}
|
|
2900
|
-
} while (needFindNext);
|
|
2901
2895
|
do {
|
|
2902
2896
|
needFindNext = false;
|
|
2903
2897
|
tmp = last.nextSibling;
|
|
2904
|
-
if (tmp && !Dom.isBlock(tmp)) {
|
|
2898
|
+
if (tmp && !Dom.isBlock(tmp) && !Dom.isTag(tmp, 'br')) {
|
|
2905
2899
|
needFindNext = true;
|
|
2906
2900
|
last = tmp;
|
|
2907
2901
|
}
|
|
2908
2902
|
} while (needFindNext);
|
|
2903
|
+
return Dom.__wrapElements(tag, editor, first, last);
|
|
2904
|
+
}
|
|
2905
|
+
static __wrapElements(tag, editor, first, last) {
|
|
2909
2906
|
const wrapper = (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_2__/* .isString */ .Kg)(tag) ? editor.createInside.element(tag) : tag;
|
|
2910
2907
|
if (first.parentNode) {
|
|
2911
2908
|
first.parentNode.insertBefore(wrapper, first);
|
|
@@ -2922,6 +2919,33 @@ class Dom {
|
|
|
2922
2919
|
editor.s.restore();
|
|
2923
2920
|
return wrapper;
|
|
2924
2921
|
}
|
|
2922
|
+
/**
|
|
2923
|
+
* Wrap all inline siblings
|
|
2924
|
+
*/
|
|
2925
|
+
static wrapInline(current, tag, editor) {
|
|
2926
|
+
let tmp;
|
|
2927
|
+
let first = current;
|
|
2928
|
+
let last = current;
|
|
2929
|
+
editor.s.save();
|
|
2930
|
+
let needFindNext = false;
|
|
2931
|
+
do {
|
|
2932
|
+
needFindNext = false;
|
|
2933
|
+
tmp = first.previousSibling;
|
|
2934
|
+
if (tmp && !Dom.isBlock(tmp)) {
|
|
2935
|
+
needFindNext = true;
|
|
2936
|
+
first = tmp;
|
|
2937
|
+
}
|
|
2938
|
+
} while (needFindNext);
|
|
2939
|
+
do {
|
|
2940
|
+
needFindNext = false;
|
|
2941
|
+
tmp = last.nextSibling;
|
|
2942
|
+
if (tmp && !Dom.isBlock(tmp)) {
|
|
2943
|
+
needFindNext = true;
|
|
2944
|
+
last = tmp;
|
|
2945
|
+
}
|
|
2946
|
+
} while (needFindNext);
|
|
2947
|
+
return Dom.__wrapElements(tag, editor, first, last);
|
|
2948
|
+
}
|
|
2925
2949
|
/**
|
|
2926
2950
|
* Wrap node inside another node
|
|
2927
2951
|
*/
|
|
@@ -27868,12 +27892,18 @@ function tryRemoveNode(jodit, nodeElm, hadEffect, allowTags, denyTags, currentSe
|
|
|
27868
27892
|
* @private
|
|
27869
27893
|
*/
|
|
27870
27894
|
function isRemovableNode(jodit, node, current, allow, deny) {
|
|
27871
|
-
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(node)
|
|
27872
|
-
(
|
|
27873
|
-
|
|
27895
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(node)) {
|
|
27896
|
+
if (allow && !allow[node.nodeName]) {
|
|
27897
|
+
return true;
|
|
27898
|
+
}
|
|
27899
|
+
if (!allow && deny && deny[node.nodeName]) {
|
|
27900
|
+
return true;
|
|
27901
|
+
}
|
|
27874
27902
|
}
|
|
27875
|
-
|
|
27876
|
-
|
|
27903
|
+
if (!jodit.o.cleanHTML.removeEmptyElements) {
|
|
27904
|
+
return false;
|
|
27905
|
+
}
|
|
27906
|
+
return (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isElement(node) &&
|
|
27877
27907
|
node.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_INLINE) != null &&
|
|
27878
27908
|
!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isTemporary(node) &&
|
|
27879
27909
|
(0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__/* .trim */ .Bq)(node.innerHTML).length === 0 &&
|
|
@@ -33151,7 +33181,7 @@ const getKey = (direction, box) => `${jodit_core_dom_dom__WEBPACK_IMPORTED_MODUL
|
|
|
33151
33181
|
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17352);
|
|
33152
33182
|
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71842);
|
|
33153
33183
|
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(56298);
|
|
33154
|
-
/* harmony import */ var
|
|
33184
|
+
/* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97369);
|
|
33155
33185
|
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(97767);
|
|
33156
33186
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3392);
|
|
33157
33187
|
/*!
|
|
@@ -33165,6 +33195,22 @@ const getKey = (direction, box) => `${jodit_core_dom_dom__WEBPACK_IMPORTED_MODUL
|
|
|
33165
33195
|
|
|
33166
33196
|
|
|
33167
33197
|
|
|
33198
|
+
const applyIndentToBox = (processedElements, currentBox, editor, command) => {
|
|
33199
|
+
if (!currentBox) {
|
|
33200
|
+
return;
|
|
33201
|
+
}
|
|
33202
|
+
if (processedElements.has(currentBox)) {
|
|
33203
|
+
return;
|
|
33204
|
+
}
|
|
33205
|
+
const key = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__/* .getKey */ .i)(editor.o.direction, currentBox);
|
|
33206
|
+
processedElements.add(currentBox);
|
|
33207
|
+
let value = currentBox.style[key] ? parseInt(currentBox.style[key], 10) : 0;
|
|
33208
|
+
value += editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
|
|
33209
|
+
currentBox.style[key] = value > 0 ? value + 'px' : '';
|
|
33210
|
+
if (!(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style')) {
|
|
33211
|
+
(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style', null);
|
|
33212
|
+
}
|
|
33213
|
+
};
|
|
33168
33214
|
/**
|
|
33169
33215
|
* Indents the line containing the selection or insertion point.
|
|
33170
33216
|
*/
|
|
@@ -33178,46 +33224,42 @@ function indent(editor) {
|
|
|
33178
33224
|
name: 'outdent',
|
|
33179
33225
|
group: 'indent'
|
|
33180
33226
|
});
|
|
33181
|
-
const
|
|
33182
|
-
const processedElements =
|
|
33227
|
+
const indentCommand = (command) => {
|
|
33228
|
+
const processedElements = new Set();
|
|
33229
|
+
const { enter, enterBlock } = editor.o;
|
|
33230
|
+
const isBrMode = enter.toLowerCase() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.BR;
|
|
33231
|
+
const current = editor.s.current();
|
|
33232
|
+
if (isBrMode && editor.s.isCollapsed()) {
|
|
33233
|
+
if (current) {
|
|
33234
|
+
const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapNextInline(current, enterBlock, editor);
|
|
33235
|
+
applyIndentToBox(processedElements, box, editor, command);
|
|
33236
|
+
return false;
|
|
33237
|
+
}
|
|
33238
|
+
}
|
|
33183
33239
|
editor.s.eachSelection((current) => {
|
|
33184
33240
|
editor.s.save();
|
|
33185
33241
|
let currentBox = current
|
|
33186
33242
|
? jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.up(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isBlock, editor.editor)
|
|
33187
33243
|
: false;
|
|
33188
|
-
const { enter } = editor.o;
|
|
33189
33244
|
if (!currentBox && current) {
|
|
33190
|
-
currentBox = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapInline
|
|
33245
|
+
currentBox = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.call)(!isBrMode ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapInline : jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.wrapNextInline, current, !isBrMode ? enter.toLowerCase() : enterBlock, editor);
|
|
33191
33246
|
}
|
|
33192
33247
|
if (!currentBox) {
|
|
33193
33248
|
editor.s.restore();
|
|
33194
33249
|
return false;
|
|
33195
33250
|
}
|
|
33196
|
-
|
|
33197
|
-
if (currentBox && !alreadyIndented) {
|
|
33198
|
-
const key = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__/* .getKey */ .i)(editor.o.direction, currentBox);
|
|
33199
|
-
processedElements.push(currentBox);
|
|
33200
|
-
let value = currentBox.style[key]
|
|
33201
|
-
? parseInt(currentBox.style[key], 10)
|
|
33202
|
-
: 0;
|
|
33203
|
-
value +=
|
|
33204
|
-
editor.o.indentMargin * (command === 'outdent' ? -1 : 1);
|
|
33205
|
-
currentBox.style[key] = value > 0 ? value + 'px' : '';
|
|
33206
|
-
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style')) {
|
|
33207
|
-
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.attr)(currentBox, 'style', null);
|
|
33208
|
-
}
|
|
33209
|
-
}
|
|
33251
|
+
applyIndentToBox(processedElements, currentBox, editor, command);
|
|
33210
33252
|
editor.s.restore();
|
|
33211
33253
|
});
|
|
33212
33254
|
editor.synchronizeValues();
|
|
33213
33255
|
return false;
|
|
33214
33256
|
};
|
|
33215
33257
|
editor.registerCommand('indent', {
|
|
33216
|
-
exec:
|
|
33258
|
+
exec: indentCommand,
|
|
33217
33259
|
hotkeys: ['ctrl+]', 'cmd+]']
|
|
33218
33260
|
});
|
|
33219
33261
|
editor.registerCommand('outdent', {
|
|
33220
|
-
exec:
|
|
33262
|
+
exec: indentCommand,
|
|
33221
33263
|
hotkeys: ['ctrl+[', 'cmd+[']
|
|
33222
33264
|
});
|
|
33223
33265
|
}
|