jodit 4.12.44 → 4.13.3
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 +6 -1
- package/es2015/jodit.css +6 -1
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +14 -14
- package/es2015/jodit.js +156 -17
- 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 +3 -3
- 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 +6 -1
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +4 -4
- package/es2021/jodit.js +147 -17
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +6 -6
- 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 +6 -1
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +5 -5
- package/es2021.en/jodit.js +147 -17
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +5 -5
- 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 +7 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +192 -17
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/selection/selection.d.ts +31 -0
- package/esm/core/selection/selection.js +143 -14
- package/esm/core/view/view-with-toolbar.d.ts +6 -0
- package/esm/core/view/view-with-toolbar.js +18 -2
- package/esm/jodit.js +7 -0
- package/esm/types/jodit.d.ts +2 -0
- package/package.json +1 -1
- package/types/core/selection/selection.d.ts +31 -0
- package/types/core/view/view-with-toolbar.d.ts +6 -0
- package/types/types/jodit.d.ts +2 -0
package/es5/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.13.3
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -2107,7 +2107,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2107
2107
|
* @packageDocumentation
|
|
2108
2108
|
* @module constants
|
|
2109
2109
|
*/
|
|
2110
|
-
var APP_VERSION = "4.
|
|
2110
|
+
var APP_VERSION = "4.13.3";
|
|
2111
2111
|
// prettier-ignore
|
|
2112
2112
|
var ES = "es5";
|
|
2113
2113
|
var IS_ES_MODERN = false;
|
|
@@ -12949,6 +12949,170 @@ var Selection = /*#__PURE__*/ function() {
|
|
|
12949
12949
|
return '';
|
|
12950
12950
|
}
|
|
12951
12951
|
},
|
|
12952
|
+
{
|
|
12953
|
+
key: "__wrapSelectionFragments",
|
|
12954
|
+
value: /**
|
|
12955
|
+
* Splits the boundaries of the current selection and wraps every
|
|
12956
|
+
* contiguous run of selected inline content (grouped by block) into a
|
|
12957
|
+
* `<font>` element, returning those wrappers in document order.
|
|
12958
|
+
*
|
|
12959
|
+
* This is a pure-DOM replacement for the old
|
|
12960
|
+
* `nativeExecCommand('fontsize', false, '7')` trick which relied on the
|
|
12961
|
+
* browser to split the selection into `<font size="7">` fragments.
|
|
12962
|
+
*/ function __wrapSelectionFragments() {
|
|
12963
|
+
var range = this.range;
|
|
12964
|
+
this.__splitSelectionBoundaries(range);
|
|
12965
|
+
var root = range.commonAncestorContainer;
|
|
12966
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isText(root)) {
|
|
12967
|
+
root = root.parentNode;
|
|
12968
|
+
}
|
|
12969
|
+
if (!root) {
|
|
12970
|
+
return [];
|
|
12971
|
+
}
|
|
12972
|
+
return this.__wrapSelectionRuns(this.__collectContainedNodes(root, range));
|
|
12973
|
+
}
|
|
12974
|
+
},
|
|
12975
|
+
{
|
|
12976
|
+
key: "__splitSelectionBoundaries",
|
|
12977
|
+
value: /**
|
|
12978
|
+
* Splits the text nodes at both ends of the range so that its boundaries
|
|
12979
|
+
* always fall between nodes. Afterwards every node inside the range is
|
|
12980
|
+
* fully (not partially) selected.
|
|
12981
|
+
*/ function __splitSelectionBoundaries(range) {
|
|
12982
|
+
var _ref, _ref1;
|
|
12983
|
+
var _endContainer_nodeValue, _startContainer_nodeValue;
|
|
12984
|
+
var startContainer = range.startContainer, endContainer = range.endContainer;
|
|
12985
|
+
var startOffset = range.startOffset, endOffset = range.endOffset;
|
|
12986
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isText(endContainer) && endOffset > 0 && endOffset < ((_ref = (_endContainer_nodeValue = endContainer.nodeValue) === null || _endContainer_nodeValue === void 0 ? void 0 : _endContainer_nodeValue.length) !== null && _ref !== void 0 ? _ref : 0)) {
|
|
12987
|
+
var _ref2;
|
|
12988
|
+
var _endContainer_nodeValue1;
|
|
12989
|
+
endContainer.splitText(endOffset);
|
|
12990
|
+
endOffset = (_ref2 = (_endContainer_nodeValue1 = endContainer.nodeValue) === null || _endContainer_nodeValue1 === void 0 ? void 0 : _endContainer_nodeValue1.length) !== null && _ref2 !== void 0 ? _ref2 : endOffset;
|
|
12991
|
+
}
|
|
12992
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isText(startContainer) && startOffset > 0 && startOffset < ((_ref1 = (_startContainer_nodeValue = startContainer.nodeValue) === null || _startContainer_nodeValue === void 0 ? void 0 : _startContainer_nodeValue.length) !== null && _ref1 !== void 0 ? _ref1 : 0)) {
|
|
12993
|
+
var middle = startContainer.splitText(startOffset);
|
|
12994
|
+
// Selection located inside a single text node - the tail we just
|
|
12995
|
+
// cut off is the actual selected fragment.
|
|
12996
|
+
if (startContainer === endContainer) {
|
|
12997
|
+
var _ref3;
|
|
12998
|
+
var _middle_nodeValue;
|
|
12999
|
+
endContainer = middle;
|
|
13000
|
+
endOffset = (_ref3 = (_middle_nodeValue = middle.nodeValue) === null || _middle_nodeValue === void 0 ? void 0 : _middle_nodeValue.length) !== null && _ref3 !== void 0 ? _ref3 : 0;
|
|
13001
|
+
}
|
|
13002
|
+
startContainer = middle;
|
|
13003
|
+
startOffset = 0;
|
|
13004
|
+
}
|
|
13005
|
+
range.setStart(startContainer, startOffset);
|
|
13006
|
+
range.setEnd(endContainer, endOffset);
|
|
13007
|
+
// Normalize text-edge boundaries (e.g. `(text, 0)` or `(text, length)`)
|
|
13008
|
+
// to the element level so that containment checks based on
|
|
13009
|
+
// `selectNode()` treat a fully selected text node as contained.
|
|
13010
|
+
this.__normalizeRangeBoundary(range, true);
|
|
13011
|
+
this.__normalizeRangeBoundary(range, false);
|
|
13012
|
+
}
|
|
13013
|
+
},
|
|
13014
|
+
{
|
|
13015
|
+
key: "__normalizeRangeBoundary",
|
|
13016
|
+
value: function __normalizeRangeBoundary(range, atStart) {
|
|
13017
|
+
var _ref;
|
|
13018
|
+
var _container_nodeValue;
|
|
13019
|
+
var container = atStart ? range.startContainer : range.endContainer;
|
|
13020
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isText(container)) {
|
|
13021
|
+
return;
|
|
13022
|
+
}
|
|
13023
|
+
var offset = atStart ? range.startOffset : range.endOffset;
|
|
13024
|
+
var length = (_ref = (_container_nodeValue = container.nodeValue) === null || _container_nodeValue === void 0 ? void 0 : _container_nodeValue.length) !== null && _ref !== void 0 ? _ref : 0;
|
|
13025
|
+
if (offset === 0) {
|
|
13026
|
+
atStart ? range.setStartBefore(container) : range.setEndBefore(container);
|
|
13027
|
+
} else if (offset >= length) {
|
|
13028
|
+
atStart ? range.setStartAfter(container) : range.setEndAfter(container);
|
|
13029
|
+
}
|
|
13030
|
+
}
|
|
13031
|
+
},
|
|
13032
|
+
{
|
|
13033
|
+
key: "__collectContainedNodes",
|
|
13034
|
+
value: /**
|
|
13035
|
+
* Collects the highest-level nodes that are completely inside the range,
|
|
13036
|
+
* descending into nodes that are only partially selected.
|
|
13037
|
+
*/ function __collectContainedNodes(root, range) {
|
|
13038
|
+
var _this = this;
|
|
13039
|
+
var result = [];
|
|
13040
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.toArray)(root.childNodes).forEach(function(child) {
|
|
13041
|
+
if (_this.__isFullyContained(range, child)) {
|
|
13042
|
+
result.push(child);
|
|
13043
|
+
} else if (child.childNodes.length && range.intersectsNode(child)) {
|
|
13044
|
+
var _result;
|
|
13045
|
+
(_result = result).push.apply(_result, (0,_swc_helpers_to_consumable_array__WEBPACK_IMPORTED_MODULE_4__._)(_this.__collectContainedNodes(child, range)));
|
|
13046
|
+
}
|
|
13047
|
+
});
|
|
13048
|
+
return result;
|
|
13049
|
+
}
|
|
13050
|
+
},
|
|
13051
|
+
{
|
|
13052
|
+
key: "__isFullyContained",
|
|
13053
|
+
value: function __isFullyContained(range, node) {
|
|
13054
|
+
var nodeRange = this.createRange();
|
|
13055
|
+
nodeRange.selectNode(node);
|
|
13056
|
+
return range.compareBoundaryPoints(Range.START_TO_START, nodeRange) <= 0 && range.compareBoundaryPoints(Range.END_TO_END, nodeRange) >= 0;
|
|
13057
|
+
}
|
|
13058
|
+
},
|
|
13059
|
+
{
|
|
13060
|
+
key: "__wrapSelectionRuns",
|
|
13061
|
+
value: /**
|
|
13062
|
+
* Wraps every contiguous run of selected inline siblings into a `<font>`
|
|
13063
|
+
* element. Block-level nodes are never wrapped themselves - their inline
|
|
13064
|
+
* content is wrapped instead, keeping every `<font>` inside a single block.
|
|
13065
|
+
*/ function __wrapSelectionRuns(nodes) {
|
|
13066
|
+
var _this = this;
|
|
13067
|
+
var fonts = [];
|
|
13068
|
+
var run = [];
|
|
13069
|
+
var flush = function flush() {
|
|
13070
|
+
if (run.length) {
|
|
13071
|
+
fonts.push(_this.__wrapRunInFont(run));
|
|
13072
|
+
run = [];
|
|
13073
|
+
}
|
|
13074
|
+
};
|
|
13075
|
+
nodes.forEach(function(node) {
|
|
13076
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isElement(node) && _this.__isOrContainsBlock(node)) {
|
|
13077
|
+
var _fonts;
|
|
13078
|
+
flush();
|
|
13079
|
+
(_fonts = fonts).push.apply(_fonts, (0,_swc_helpers_to_consumable_array__WEBPACK_IMPORTED_MODULE_4__._)(_this.__wrapSelectionRuns((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.toArray)(node.childNodes))));
|
|
13080
|
+
} else {
|
|
13081
|
+
if (run.length && run[run.length - 1].parentNode !== node.parentNode) {
|
|
13082
|
+
flush();
|
|
13083
|
+
}
|
|
13084
|
+
run.push(node);
|
|
13085
|
+
}
|
|
13086
|
+
});
|
|
13087
|
+
flush();
|
|
13088
|
+
return fonts;
|
|
13089
|
+
}
|
|
13090
|
+
},
|
|
13091
|
+
{
|
|
13092
|
+
key: "__isOrContainsBlock",
|
|
13093
|
+
value: function __isOrContainsBlock(node) {
|
|
13094
|
+
var _this = this;
|
|
13095
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isBlock(node)) {
|
|
13096
|
+
return true;
|
|
13097
|
+
}
|
|
13098
|
+
return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.toArray)(node.childNodes).some(function(child) {
|
|
13099
|
+
return _this.__isOrContainsBlock(child);
|
|
13100
|
+
});
|
|
13101
|
+
}
|
|
13102
|
+
},
|
|
13103
|
+
{
|
|
13104
|
+
key: "__wrapRunInFont",
|
|
13105
|
+
value: function __wrapRunInFont(run) {
|
|
13106
|
+
var _first_parentNode;
|
|
13107
|
+
var font = this.j.createInside.element('font');
|
|
13108
|
+
var _run = (0,_swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_3__._)(run, 1), first = _run[0];
|
|
13109
|
+
(_first_parentNode = first.parentNode) === null || _first_parentNode === void 0 ? void 0 : _first_parentNode.insertBefore(font, first);
|
|
13110
|
+
run.forEach(function(node) {
|
|
13111
|
+
return font.appendChild(node);
|
|
13112
|
+
});
|
|
13113
|
+
return font;
|
|
13114
|
+
}
|
|
13115
|
+
},
|
|
12952
13116
|
{
|
|
12953
13117
|
key: "wrapInTagGen",
|
|
12954
13118
|
value: /**
|
|
@@ -12978,20 +13142,7 @@ var Selection = /*#__PURE__*/ function() {
|
|
|
12978
13142
|
2
|
|
12979
13143
|
];
|
|
12980
13144
|
case 2:
|
|
12981
|
-
|
|
12982
|
-
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.$$)('*[style*=font-size]', this.area).forEach(function(elm) {
|
|
12983
|
-
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.attr)(elm, 'data-font-size', elm.style.fontSize.toString());
|
|
12984
|
-
elm.style.removeProperty('font-size');
|
|
12985
|
-
});
|
|
12986
|
-
this.j.nativeExecCommand('fontsize', false, '7');
|
|
12987
|
-
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.$$)('*[data-font-size]', this.area).forEach(function(elm) {
|
|
12988
|
-
var fontSize = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.attr)(elm, 'data-font-size');
|
|
12989
|
-
if (fontSize) {
|
|
12990
|
-
elm.style.fontSize = fontSize;
|
|
12991
|
-
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.attr)(elm, 'data-font-size', null);
|
|
12992
|
-
}
|
|
12993
|
-
});
|
|
12994
|
-
elms = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.$$)('font[size="7"]', this.area);
|
|
13145
|
+
elms = this.__wrapSelectionFragments();
|
|
12995
13146
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
12996
13147
|
_state.label = 3;
|
|
12997
13148
|
case 3:
|
|
@@ -20031,10 +20182,27 @@ var ViewWithToolbar = /*#__PURE__*/ function(View) {
|
|
|
20031
20182
|
if (!this.o.fullsize && ((0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_14__.isString)(this.o.toolbar) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_12__.Dom.isHTMLElement(this.o.toolbar))) {
|
|
20032
20183
|
return (0,jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_15__.resolveElement)(this.o.toolbar, this.o.shadowRoot || this.od);
|
|
20033
20184
|
}
|
|
20034
|
-
this.o.toolbar &&
|
|
20185
|
+
this.o.toolbar && this.__appendToolbarBox();
|
|
20035
20186
|
return this.__defaultToolbarContainer;
|
|
20036
20187
|
}
|
|
20037
20188
|
},
|
|
20189
|
+
{
|
|
20190
|
+
key: "__appendToolbarBox",
|
|
20191
|
+
value: /**
|
|
20192
|
+
* Keep the toolbar box as the first child of the container, except that
|
|
20193
|
+
* children flagged with `data-jodit-above-toolbar` (e.g. the `above`
|
|
20194
|
+
* workplace slot used for presence bars and banners) stay above it.
|
|
20195
|
+
*/ function __appendToolbarBox() {
|
|
20196
|
+
var box = this.__defaultToolbarContainer;
|
|
20197
|
+
var anchor = this.container.firstElementChild;
|
|
20198
|
+
while(anchor && anchor !== box && anchor.hasAttribute('data-jodit-above-toolbar')){
|
|
20199
|
+
anchor = anchor.nextElementSibling;
|
|
20200
|
+
}
|
|
20201
|
+
if (anchor !== box) {
|
|
20202
|
+
this.container.insertBefore(box, anchor);
|
|
20203
|
+
}
|
|
20204
|
+
}
|
|
20205
|
+
},
|
|
20038
20206
|
{
|
|
20039
20207
|
/**
|
|
20040
20208
|
* Change panel container
|
|
@@ -21671,6 +21839,12 @@ var Jodit = /*#__PURE__*/ function(ViewWithToolbar) {
|
|
|
21671
21839
|
element.style.display = 'none';
|
|
21672
21840
|
}
|
|
21673
21841
|
var SLOT = 'workplace-slot';
|
|
21842
|
+
// A slot that always stays ABOVE the toolbar (presence bars, banners…).
|
|
21843
|
+
// The `data-jodit-above-toolbar` attribute tells ViewWithToolbar to keep
|
|
21844
|
+
// the toolbar box below it when (re)attaching the toolbar container.
|
|
21845
|
+
var aboveSlot = this.c.div(this.getFullElName(SLOT, 'above'), NOEDIT);
|
|
21846
|
+
aboveSlot.setAttribute('data-jodit-above-toolbar', '');
|
|
21847
|
+
jodit_modules__WEBPACK_IMPORTED_MODULE_19__.Dom.appendChildFirst(container, aboveSlot);
|
|
21674
21848
|
var topSlot = this.c.div(this.getFullElName(SLOT, 'top'), NOEDIT);
|
|
21675
21849
|
container.appendChild(topSlot);
|
|
21676
21850
|
var centerSlot = this.c.div(this.getFullElName(SLOT, 'center'), NOEDIT);
|
|
@@ -21703,6 +21877,7 @@ var Jodit = /*#__PURE__*/ function(ViewWithToolbar) {
|
|
|
21703
21877
|
container: container,
|
|
21704
21878
|
workplace: workplace,
|
|
21705
21879
|
slots: {
|
|
21880
|
+
above: aboveSlot,
|
|
21706
21881
|
top: topSlot,
|
|
21707
21882
|
bottom: bottomPanel,
|
|
21708
21883
|
center: centerSlot,
|