jodit 4.12.16 → 4.12.18
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 +22 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +4 -4
- package/es2015/jodit.js +172 -34
- package/es2015/jodit.min.js +4 -4
- 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.js +4 -4
- package/es2018/jodit.min.js +4 -4
- package/es2018/plugins/debug/debug.min.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 +5 -5
- package/es2021/jodit.js +170 -34
- 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 +1 -1
- package/es2021.en/jodit.fat.min.js +6 -6
- package/es2021.en/jodit.js +170 -34
- package/es2021.en/jodit.min.js +6 -6
- 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 +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +185 -34
- 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/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/helpers/utils/config-proto.js +15 -0
- package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +8 -1
- package/esm/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +21 -0
- package/esm/plugins/drag-and-drop-element/drag-and-drop-element.js +48 -3
- package/esm/plugins/enter/enter.js +11 -6
- package/esm/plugins/select/select.d.ts +14 -0
- package/esm/plugins/select/select.js +69 -0
- package/package.json +1 -1
- package/types/plugins/drag-and-drop-element/drag-and-drop-element.d.ts +21 -0
- package/types/plugins/select/select.d.ts +14 -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.12.
|
|
4
|
+
* Version: v4.12.18
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -2066,7 +2066,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2066
2066
|
* @packageDocumentation
|
|
2067
2067
|
* @module constants
|
|
2068
2068
|
*/
|
|
2069
|
-
var APP_VERSION = "4.12.
|
|
2069
|
+
var APP_VERSION = "4.12.18";
|
|
2070
2070
|
// prettier-ignore
|
|
2071
2071
|
var ES = "es5";
|
|
2072
2072
|
var IS_ES_MODERN = false;
|
|
@@ -8658,6 +8658,18 @@ var completeUrl = function completeUrl(url) {
|
|
|
8658
8658
|
|
|
8659
8659
|
|
|
8660
8660
|
|
|
8661
|
+
/**
|
|
8662
|
+
* Keys that must never be copied from a (potentially untrusted) config object —
|
|
8663
|
+
* assigning them during a recursive merge can reach and mutate
|
|
8664
|
+
* `Object.prototype` (prototype pollution, CWE-1321).
|
|
8665
|
+
*/ var UNSAFE_PROTO_KEYS = [
|
|
8666
|
+
'__proto__',
|
|
8667
|
+
'constructor',
|
|
8668
|
+
'prototype'
|
|
8669
|
+
];
|
|
8670
|
+
function isUnsafeProtoKey(key) {
|
|
8671
|
+
return UNSAFE_PROTO_KEYS.indexOf(key) !== -1;
|
|
8672
|
+
}
|
|
8661
8673
|
/**
|
|
8662
8674
|
* @example
|
|
8663
8675
|
* ```js
|
|
@@ -8707,6 +8719,9 @@ var completeUrl = function completeUrl(url) {
|
|
|
8707
8719
|
}
|
|
8708
8720
|
var newOpt = {};
|
|
8709
8721
|
Object.keys(options).forEach(function(key) {
|
|
8722
|
+
if (isUnsafeProtoKey(key)) {
|
|
8723
|
+
return;
|
|
8724
|
+
}
|
|
8710
8725
|
var opt = options[key], protoKey = proto ? proto[key] : null;
|
|
8711
8726
|
if ((0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(opt) && (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(protoKey) && !(0,_extend__WEBPACK_IMPORTED_MODULE_6__.isAtom)(opt)) {
|
|
8712
8727
|
newOpt[key] = ConfigProto(opt, protoKey, deep + 1);
|
|
@@ -8765,6 +8780,9 @@ function ConfigFlatten(obj) {
|
|
|
8765
8780
|
* @see {@link ConfigProto} for the prototype-chain variant used at editor creation time
|
|
8766
8781
|
*/ function ConfigMerge(target, source) {
|
|
8767
8782
|
Object.keys(source).forEach(function(key) {
|
|
8783
|
+
if (isUnsafeProtoKey(key)) {
|
|
8784
|
+
return;
|
|
8785
|
+
}
|
|
8768
8786
|
var srcVal = source[key];
|
|
8769
8787
|
var tgtVal = target[key];
|
|
8770
8788
|
if ((0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(srcVal) && (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(tgtVal) && !(0,_extend__WEBPACK_IMPORTED_MODULE_6__.isAtom)(srcVal)) {
|
|
@@ -33621,7 +33639,11 @@ function filterStyleProperties(style, allowed) {
|
|
|
33621
33639
|
if (!jodit.o.cleanHTML.removeEmptyElements) {
|
|
33622
33640
|
return false;
|
|
33623
33641
|
}
|
|
33624
|
-
|
|
33642
|
+
// Never drop an empty inline element that currently holds the caret — it is
|
|
33643
|
+
// a pending-format marker the user is about to type into (#1291). `current`
|
|
33644
|
+
// is captured before a click moves the caret, so also check the live caret.
|
|
33645
|
+
var liveCaret = jodit.s.isCollapsed() ? jodit.s.range.startContainer : null;
|
|
33646
|
+
return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(node) && node.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.IS_INLINE) != null && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTemporary(node) && (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__.trimInv)(node.innerHTML).length === 0 && (current == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, current)) && (liveCaret == null || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(node, liveCaret));
|
|
33625
33647
|
}
|
|
33626
33648
|
|
|
33627
33649
|
|
|
@@ -34866,12 +34888,37 @@ var DragState = /*#__PURE__*/ function(DragState) {
|
|
|
34866
34888
|
this.dragList = this.j.o.draggableTags ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.splitArray)(this.j.o.draggableTags).filter(Boolean).map(function(item) {
|
|
34867
34889
|
return item.toLowerCase();
|
|
34868
34890
|
}) : [];
|
|
34891
|
+
// Allow another plugin (e.g. a drag handle/anchor) to start dragging
|
|
34892
|
+
// an element programmatically, regardless of the `draggableTags` list.
|
|
34893
|
+
this.j.e.on('startDragElement', this.onStartDragElement);
|
|
34869
34894
|
if (!this.dragList.length) {
|
|
34870
34895
|
return;
|
|
34871
34896
|
}
|
|
34872
34897
|
this.j.e.on('mousedown dragstart', this.onDragStart);
|
|
34873
34898
|
}
|
|
34874
34899
|
},
|
|
34900
|
+
{
|
|
34901
|
+
key: "onStartDragElement",
|
|
34902
|
+
value: /**
|
|
34903
|
+
* Start dragging a specific element programmatically.
|
|
34904
|
+
*
|
|
34905
|
+
* Allows a separate UI element (for example a drag handle/anchor shown next
|
|
34906
|
+
* to a block) to initiate the drag without the user pressing directly on the
|
|
34907
|
+
* draggable element itself.
|
|
34908
|
+
*
|
|
34909
|
+
* @example
|
|
34910
|
+
* ```js
|
|
34911
|
+
* handle.addEventListener('mousedown', e => {
|
|
34912
|
+
* editor.e.fire('startDragElement', preBlock, e);
|
|
34913
|
+
* });
|
|
34914
|
+
* ```
|
|
34915
|
+
*/ function onStartDragElement(element, event) {
|
|
34916
|
+
if (this.isInDestruct || this.state > 0 || !element) {
|
|
34917
|
+
return;
|
|
34918
|
+
}
|
|
34919
|
+
this.startDragging(element, event);
|
|
34920
|
+
}
|
|
34921
|
+
},
|
|
34875
34922
|
{
|
|
34876
34923
|
key: "onDragStart",
|
|
34877
34924
|
value: /**
|
|
@@ -34898,11 +34945,21 @@ var DragState = /*#__PURE__*/ function(DragState) {
|
|
|
34898
34945
|
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isTag(lastTarget.parentElement, 'a') && lastTarget.parentElement.firstChild === lastTarget && lastTarget.parentElement.lastChild === lastTarget) {
|
|
34899
34946
|
lastTarget = lastTarget.parentElement;
|
|
34900
34947
|
}
|
|
34948
|
+
this.startDragging(lastTarget, event);
|
|
34949
|
+
}
|
|
34950
|
+
},
|
|
34951
|
+
{
|
|
34952
|
+
key: "startDragging",
|
|
34953
|
+
value: /**
|
|
34954
|
+
* Prepare the ghost element and switch to the waiting state.
|
|
34955
|
+
* Shared by the native mousedown handler and the programmatic
|
|
34956
|
+
* `startDragElement` event handler.
|
|
34957
|
+
*/ function startDragging(target, event) {
|
|
34901
34958
|
this.startX = event.clientX;
|
|
34902
34959
|
this.startY = event.clientY;
|
|
34903
34960
|
this.isCopyMode = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.ctrlKey)(event); // we can move only element from editor
|
|
34904
|
-
this.draggable =
|
|
34905
|
-
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.dataBind)(this.draggable, 'target',
|
|
34961
|
+
this.draggable = target.cloneNode(true);
|
|
34962
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.dataBind)(this.draggable, 'target', target);
|
|
34906
34963
|
this.state = 1;
|
|
34907
34964
|
this.addDragListeners();
|
|
34908
34965
|
}
|
|
@@ -34981,6 +35038,18 @@ var DragState = /*#__PURE__*/ function(DragState) {
|
|
|
34981
35038
|
}
|
|
34982
35039
|
var parentElement = fragment.parentElement;
|
|
34983
35040
|
this.j.s.insertNode(fragment, true, false);
|
|
35041
|
+
// Dropping a non-editable block (e.g. a `<pre>` code sample) can leave an
|
|
35042
|
+
// invisible filler text node beside it. Remove it so the drop does not
|
|
35043
|
+
// introduce a stray empty line (which clean-html would otherwise strip
|
|
35044
|
+
// later, causing a flash).
|
|
35045
|
+
[
|
|
35046
|
+
fragment.previousSibling,
|
|
35047
|
+
fragment.nextSibling
|
|
35048
|
+
].forEach(function(node) {
|
|
35049
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isEmptyTextNode(node)) {
|
|
35050
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(node);
|
|
35051
|
+
}
|
|
35052
|
+
});
|
|
34984
35053
|
if (parentElement && jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isEmpty(parentElement) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isCell(parentElement)) {
|
|
34985
35054
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(parentElement);
|
|
34986
35055
|
}
|
|
@@ -35016,13 +35085,16 @@ var DragState = /*#__PURE__*/ function(DragState) {
|
|
|
35016
35085
|
key: "beforeDestruct",
|
|
35017
35086
|
value: /** @override */ function beforeDestruct() {
|
|
35018
35087
|
this.onDragEnd();
|
|
35019
|
-
this.j.e.off('mousedown dragstart', this.onDragStart);
|
|
35088
|
+
this.j.e.off('mousedown dragstart', this.onDragStart).off('startDragElement', this.onStartDragElement);
|
|
35020
35089
|
this.removeDragListeners();
|
|
35021
35090
|
}
|
|
35022
35091
|
}
|
|
35023
35092
|
]);
|
|
35024
35093
|
return dragAndDropElement;
|
|
35025
35094
|
}((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_11__.Plugin));
|
|
35095
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
35096
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.autobind
|
|
35097
|
+
], dragAndDropElement.prototype, "onStartDragElement", null);
|
|
35026
35098
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
35027
35099
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_7__.autobind
|
|
35028
35100
|
], dragAndDropElement.prototype, "onDragStart", null);
|
|
@@ -35631,18 +35703,24 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_7__.pluginSystem.add('dtd', dtd);
|
|
|
35631
35703
|
{
|
|
35632
35704
|
key: "onEnterKeyDown",
|
|
35633
35705
|
value: function onEnterKeyDown(event) {
|
|
35706
|
+
var _this = this;
|
|
35634
35707
|
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_6__.KEY_ENTER) {
|
|
35635
35708
|
var editor = this.j;
|
|
35636
35709
|
var beforeEnter = editor.e.fire('beforeEnter', event);
|
|
35637
35710
|
if (beforeEnter !== undefined) {
|
|
35638
35711
|
return beforeEnter;
|
|
35639
35712
|
}
|
|
35640
|
-
|
|
35641
|
-
|
|
35642
|
-
|
|
35643
|
-
editor.
|
|
35644
|
-
|
|
35645
|
-
|
|
35713
|
+
// Delete-of-selection + new block must be a single history step,
|
|
35714
|
+
// otherwise pressing Enter over a selection needs two Ctrl+Z to undo
|
|
35715
|
+
// (the first only reverts to the intermediate empty state). #1292
|
|
35716
|
+
editor.history.snapshot.transaction(function() {
|
|
35717
|
+
if (!editor.s.isCollapsed()) {
|
|
35718
|
+
editor.execCommand('Delete');
|
|
35719
|
+
}
|
|
35720
|
+
editor.s.focus();
|
|
35721
|
+
_this.onEnter(event);
|
|
35722
|
+
editor.e.fire('afterEnter', event);
|
|
35723
|
+
});
|
|
35646
35724
|
editor.synchronizeValues(); // fire change
|
|
35647
35725
|
return false;
|
|
35648
35726
|
}
|
|
@@ -46850,13 +46928,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46850
46928
|
/* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34918);
|
|
46851
46929
|
/* harmony import */ var _swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(38574);
|
|
46852
46930
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(31635);
|
|
46853
|
-
/* harmony import */ var
|
|
46854
|
-
/* harmony import */ var
|
|
46855
|
-
/* harmony import */ var
|
|
46856
|
-
/* harmony import */ var
|
|
46857
|
-
/* harmony import */ var
|
|
46858
|
-
/* harmony import */ var
|
|
46859
|
-
/* harmony import */ var
|
|
46931
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(81937);
|
|
46932
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(84839);
|
|
46933
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(23211);
|
|
46934
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28077);
|
|
46935
|
+
/* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(57821);
|
|
46936
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(91206);
|
|
46937
|
+
/* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4099);
|
|
46938
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47670);
|
|
46860
46939
|
/*!
|
|
46861
46940
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
46862
46941
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -46879,6 +46958,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46879
46958
|
|
|
46880
46959
|
|
|
46881
46960
|
|
|
46961
|
+
|
|
46882
46962
|
/**
|
|
46883
46963
|
* A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
|
|
46884
46964
|
*
|
|
@@ -46929,7 +47009,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46929
47009
|
var j = this.j;
|
|
46930
47010
|
var result, target = e.target;
|
|
46931
47011
|
while(result === undefined && target && target !== j.editor){
|
|
46932
|
-
result = j.e.fire((0,
|
|
47012
|
+
result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_11__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
|
|
46933
47013
|
target = target.parentElement;
|
|
46934
47014
|
}
|
|
46935
47015
|
if (e.type === 'click' && result === undefined && target === j.editor) {
|
|
@@ -46944,12 +47024,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46944
47024
|
*/ function onOutsideClick(e) {
|
|
46945
47025
|
var _this = this;
|
|
46946
47026
|
var node = e.target;
|
|
46947
|
-
if (
|
|
47027
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.up(node, function(elm) {
|
|
46948
47028
|
return elm === _this.j.editor;
|
|
46949
47029
|
})) {
|
|
46950
47030
|
return;
|
|
46951
47031
|
}
|
|
46952
|
-
var box =
|
|
47032
|
+
var box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.Popup);
|
|
46953
47033
|
if (!box) {
|
|
46954
47034
|
this.j.e.fire('outsideClick', e);
|
|
46955
47035
|
}
|
|
@@ -46961,7 +47041,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46961
47041
|
var s = this.j.s;
|
|
46962
47042
|
if (!s.isCollapsed()) {
|
|
46963
47043
|
var current = s.current();
|
|
46964
|
-
if (current &&
|
|
47044
|
+
if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isOrContains(this.j.editor, current)) {
|
|
46965
47045
|
this.onCopyNormalizeSelectionBound();
|
|
46966
47046
|
}
|
|
46967
47047
|
}
|
|
@@ -46977,6 +47057,67 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46977
47057
|
return false;
|
|
46978
47058
|
}
|
|
46979
47059
|
},
|
|
47060
|
+
{
|
|
47061
|
+
key: "onClickRightOfNestedListItem",
|
|
47062
|
+
value: /**
|
|
47063
|
+
* Fix caret position when clicking to the right of a list item that has a
|
|
47064
|
+
* nested list. Blink/WebKit place the caret at the start of the line instead
|
|
47065
|
+
* of the end (#1296); move it to the end of the item's own text.
|
|
47066
|
+
*/ function onClickRightOfNestedListItem(e) {
|
|
47067
|
+
var s = this.j.s;
|
|
47068
|
+
var range = s.range;
|
|
47069
|
+
if (!range.collapsed || range.startOffset !== 0 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isText(range.startContainer)) {
|
|
47070
|
+
return;
|
|
47071
|
+
}
|
|
47072
|
+
var text = range.startContainer;
|
|
47073
|
+
var li = text.parentNode;
|
|
47074
|
+
// The text must be the direct content of a list item that has a nested
|
|
47075
|
+
// list (the last level has no nested list and behaves correctly).
|
|
47076
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isTag(li, 'li') || !(li.querySelector('ul') || li.querySelector('ol'))) {
|
|
47077
|
+
return;
|
|
47078
|
+
}
|
|
47079
|
+
var measure = this.j.ed.createRange();
|
|
47080
|
+
measure.selectNodeContents(text);
|
|
47081
|
+
var rect = measure.getBoundingClientRect();
|
|
47082
|
+
// Only when the click happened to the right of the text.
|
|
47083
|
+
if (e.clientX > rect.right) {
|
|
47084
|
+
s.setCursorAfter(text);
|
|
47085
|
+
}
|
|
47086
|
+
}
|
|
47087
|
+
},
|
|
47088
|
+
{
|
|
47089
|
+
key: "onClickKeepPendingFormat",
|
|
47090
|
+
value: /**
|
|
47091
|
+
* Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
|
|
47092
|
+
* a collapsed cursor leaves empty marker elements with the caret inside; a
|
|
47093
|
+
* click puts the caret right before them (outside), so they get cleaned up
|
|
47094
|
+
* and the formatting is lost. Move the caret back into the innermost marker
|
|
47095
|
+
* so the next typed character keeps every pending format (#1291).
|
|
47096
|
+
*/ function onClickKeepPendingFormat() {
|
|
47097
|
+
var _ref;
|
|
47098
|
+
var _text_nodeValue;
|
|
47099
|
+
var s = this.j.s;
|
|
47100
|
+
var range = s.range;
|
|
47101
|
+
if (!range.collapsed || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isText(range.startContainer)) {
|
|
47102
|
+
return;
|
|
47103
|
+
}
|
|
47104
|
+
var text = range.startContainer;
|
|
47105
|
+
// Caret must sit at the very end of the text, right before the markers.
|
|
47106
|
+
if (range.startOffset !== ((_ref = (_text_nodeValue = text.nodeValue) === null || _text_nodeValue === void 0 ? void 0 : _text_nodeValue.length) !== null && _ref !== void 0 ? _ref : 0)) {
|
|
47107
|
+
return;
|
|
47108
|
+
}
|
|
47109
|
+
var marker = text.nextSibling;
|
|
47110
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isElement(marker) || !marker.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.IS_INLINE) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isEmpty(marker)) {
|
|
47111
|
+
return;
|
|
47112
|
+
}
|
|
47113
|
+
var inner = marker;
|
|
47114
|
+
// Descend into the innermost empty formatting marker.
|
|
47115
|
+
while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isElement(inner.firstElementChild) && inner.firstElementChild.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.IS_INLINE)){
|
|
47116
|
+
inner = inner.firstElementChild;
|
|
47117
|
+
}
|
|
47118
|
+
s.setCursorIn(inner);
|
|
47119
|
+
}
|
|
47120
|
+
},
|
|
46980
47121
|
{
|
|
46981
47122
|
key: "onTripleClickNormalizeSelection",
|
|
46982
47123
|
value: /**
|
|
@@ -46987,8 +47128,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46987
47128
|
}
|
|
46988
47129
|
var s = this.j.s;
|
|
46989
47130
|
var _s_range = s.range, startContainer = _s_range.startContainer, startOffset = _s_range.startOffset;
|
|
46990
|
-
if (startOffset === 0 &&
|
|
46991
|
-
s.select(
|
|
47131
|
+
if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isText(startContainer)) {
|
|
47132
|
+
s.select(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.closest(startContainer, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isBlock, this.j.editor) || startContainer, true);
|
|
46992
47133
|
}
|
|
46993
47134
|
}
|
|
46994
47135
|
},
|
|
@@ -46999,7 +47140,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
46999
47140
|
if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
|
|
47000
47141
|
return;
|
|
47001
47142
|
}
|
|
47002
|
-
if (e && (!e.isTrusted || !
|
|
47143
|
+
if (e && (!e.isTrusted || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isNode(e.target) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isOrContains(editor, e.target))) {
|
|
47003
47144
|
return;
|
|
47004
47145
|
}
|
|
47005
47146
|
this.jodit.s.expandSelection();
|
|
@@ -47007,35 +47148,45 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
47007
47148
|
}
|
|
47008
47149
|
]);
|
|
47009
47150
|
return select;
|
|
47010
|
-
}((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__._)(
|
|
47151
|
+
}((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_5__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_12__.Plugin));
|
|
47011
47152
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
47012
|
-
|
|
47153
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.autobind
|
|
47013
47154
|
], select.prototype, "onStartSelection", null);
|
|
47014
47155
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
47015
|
-
(0,
|
|
47156
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)('ow:click')
|
|
47016
47157
|
], select.prototype, "onOutsideClick", null);
|
|
47017
47158
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
47018
|
-
(0,
|
|
47159
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
|
|
47019
47160
|
':beforeCommandCut'
|
|
47020
47161
|
])
|
|
47021
47162
|
], select.prototype, "beforeCommandCut", null);
|
|
47022
47163
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
47023
|
-
(0,
|
|
47164
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
|
|
47024
47165
|
':beforeCommandSelectall'
|
|
47025
47166
|
])
|
|
47026
47167
|
], select.prototype, "beforeCommandSelectAll", null);
|
|
47027
47168
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
47028
|
-
(0,
|
|
47169
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
|
|
47170
|
+
':click'
|
|
47171
|
+
])
|
|
47172
|
+
], select.prototype, "onClickRightOfNestedListItem", null);
|
|
47173
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
47174
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
|
|
47175
|
+
':click'
|
|
47176
|
+
])
|
|
47177
|
+
], select.prototype, "onClickKeepPendingFormat", null);
|
|
47178
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
47179
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
|
|
47029
47180
|
':click'
|
|
47030
47181
|
])
|
|
47031
47182
|
], select.prototype, "onTripleClickNormalizeSelection", null);
|
|
47032
47183
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
|
|
47033
|
-
(0,
|
|
47184
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
|
|
47034
47185
|
':copy',
|
|
47035
47186
|
':cut'
|
|
47036
47187
|
])
|
|
47037
47188
|
], select.prototype, "onCopyNormalizeSelectionBound", null);
|
|
47038
|
-
|
|
47189
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_10__.pluginSystem.add('select', select);
|
|
47039
47190
|
|
|
47040
47191
|
|
|
47041
47192
|
/***/ }),
|
package/es5/jodit.min.css
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.12.
|
|
4
|
+
* Version: v4.12.18
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
8
8
|
/*!
|
|
9
9
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
10
10
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
11
|
-
* Version: v4.12.
|
|
11
|
+
* Version: v4.12.18
|
|
12
12
|
* Url: https://xdsoft.net/jodit/
|
|
13
13
|
* License(s): MIT
|
|
14
14
|
*/
|