jodit 4.12.17 → 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 +16 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +4 -4
- package/es2015/jodit.js +145 -37
- 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 +143 -37
- 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 +143 -37
- 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 +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +155 -37
- 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 +8 -0
- package/esm/plugins/select/select.js +37 -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 +8 -0
package/es2021.en/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
|
*/
|
|
@@ -1802,7 +1802,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1802
1802
|
* ```
|
|
1803
1803
|
* @packageDocumentation
|
|
1804
1804
|
* @module constants
|
|
1805
|
-
*/ const APP_VERSION = "4.12.
|
|
1805
|
+
*/ const APP_VERSION = "4.12.18";
|
|
1806
1806
|
// prettier-ignore
|
|
1807
1807
|
const ES = "es2021";
|
|
1808
1808
|
const IS_ES_MODERN = true;
|
|
@@ -7635,6 +7635,18 @@ const completeUrl = (url)=>{
|
|
|
7635
7635
|
|
|
7636
7636
|
|
|
7637
7637
|
|
|
7638
|
+
/**
|
|
7639
|
+
* Keys that must never be copied from a (potentially untrusted) config object —
|
|
7640
|
+
* assigning them during a recursive merge can reach and mutate
|
|
7641
|
+
* `Object.prototype` (prototype pollution, CWE-1321).
|
|
7642
|
+
*/ const UNSAFE_PROTO_KEYS = [
|
|
7643
|
+
'__proto__',
|
|
7644
|
+
'constructor',
|
|
7645
|
+
'prototype'
|
|
7646
|
+
];
|
|
7647
|
+
function isUnsafeProtoKey(key) {
|
|
7648
|
+
return UNSAFE_PROTO_KEYS.indexOf(key) !== -1;
|
|
7649
|
+
}
|
|
7638
7650
|
/**
|
|
7639
7651
|
* @example
|
|
7640
7652
|
* ```js
|
|
@@ -7683,6 +7695,9 @@ const completeUrl = (url)=>{
|
|
|
7683
7695
|
}
|
|
7684
7696
|
const newOpt = {};
|
|
7685
7697
|
Object.keys(options).forEach((key)=>{
|
|
7698
|
+
if (isUnsafeProtoKey(key)) {
|
|
7699
|
+
return;
|
|
7700
|
+
}
|
|
7686
7701
|
const opt = options[key], protoKey = proto ? proto[key] : null;
|
|
7687
7702
|
if ((0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(opt) && (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(protoKey) && !(0,_extend__WEBPACK_IMPORTED_MODULE_5__.isAtom)(opt)) {
|
|
7688
7703
|
newOpt[key] = ConfigProto(opt, protoKey, deep + 1);
|
|
@@ -7744,6 +7759,9 @@ function ConfigFlatten(obj) {
|
|
|
7744
7759
|
* @see {@link ConfigProto} for the prototype-chain variant used at editor creation time
|
|
7745
7760
|
*/ function ConfigMerge(target, source) {
|
|
7746
7761
|
Object.keys(source).forEach((key)=>{
|
|
7762
|
+
if (isUnsafeProtoKey(key)) {
|
|
7763
|
+
return;
|
|
7764
|
+
}
|
|
7747
7765
|
const srcVal = source[key];
|
|
7748
7766
|
const tgtVal = target[key];
|
|
7749
7767
|
if ((0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(srcVal) && (0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(tgtVal) && !(0,_extend__WEBPACK_IMPORTED_MODULE_5__.isAtom)(srcVal)) {
|
|
@@ -27931,7 +27949,11 @@ function filterStyleProperties(style, allowed) {
|
|
|
27931
27949
|
if (!jodit.o.cleanHTML.removeEmptyElements) {
|
|
27932
27950
|
return false;
|
|
27933
27951
|
}
|
|
27934
|
-
|
|
27952
|
+
// Never drop an empty inline element that currently holds the caret — it is
|
|
27953
|
+
// a pending-format marker the user is about to type into (#1291). `current`
|
|
27954
|
+
// is captured before a click moves the caret, so also check the live caret.
|
|
27955
|
+
const liveCaret = jodit.s.isCollapsed() ? jodit.s.range.startContainer : null;
|
|
27956
|
+
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));
|
|
27935
27957
|
}
|
|
27936
27958
|
|
|
27937
27959
|
|
|
@@ -28723,11 +28745,33 @@ var DragState = /*#__PURE__*/ function(DragState) {
|
|
|
28723
28745
|
*/ class dragAndDropElement extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
|
|
28724
28746
|
/** @override */ afterInit() {
|
|
28725
28747
|
this.dragList = this.j.o.draggableTags ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.splitArray)(this.j.o.draggableTags).filter(Boolean).map((item)=>item.toLowerCase()) : [];
|
|
28748
|
+
// Allow another plugin (e.g. a drag handle/anchor) to start dragging
|
|
28749
|
+
// an element programmatically, regardless of the `draggableTags` list.
|
|
28750
|
+
this.j.e.on('startDragElement', this.onStartDragElement);
|
|
28726
28751
|
if (!this.dragList.length) {
|
|
28727
28752
|
return;
|
|
28728
28753
|
}
|
|
28729
28754
|
this.j.e.on('mousedown dragstart', this.onDragStart);
|
|
28730
28755
|
}
|
|
28756
|
+
/**
|
|
28757
|
+
* Start dragging a specific element programmatically.
|
|
28758
|
+
*
|
|
28759
|
+
* Allows a separate UI element (for example a drag handle/anchor shown next
|
|
28760
|
+
* to a block) to initiate the drag without the user pressing directly on the
|
|
28761
|
+
* draggable element itself.
|
|
28762
|
+
*
|
|
28763
|
+
* @example
|
|
28764
|
+
* ```js
|
|
28765
|
+
* handle.addEventListener('mousedown', e => {
|
|
28766
|
+
* editor.e.fire('startDragElement', preBlock, e);
|
|
28767
|
+
* });
|
|
28768
|
+
* ```
|
|
28769
|
+
*/ onStartDragElement(element, event) {
|
|
28770
|
+
if (this.isInDestruct || this.state > 0 || !element) {
|
|
28771
|
+
return;
|
|
28772
|
+
}
|
|
28773
|
+
this.startDragging(element, event);
|
|
28774
|
+
}
|
|
28731
28775
|
/**
|
|
28732
28776
|
* Drag start handler
|
|
28733
28777
|
*/ onDragStart(event) {
|
|
@@ -28749,11 +28793,18 @@ var DragState = /*#__PURE__*/ function(DragState) {
|
|
|
28749
28793
|
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(lastTarget.parentElement, 'a') && lastTarget.parentElement.firstChild === lastTarget && lastTarget.parentElement.lastChild === lastTarget) {
|
|
28750
28794
|
lastTarget = lastTarget.parentElement;
|
|
28751
28795
|
}
|
|
28796
|
+
this.startDragging(lastTarget, event);
|
|
28797
|
+
}
|
|
28798
|
+
/**
|
|
28799
|
+
* Prepare the ghost element and switch to the waiting state.
|
|
28800
|
+
* Shared by the native mousedown handler and the programmatic
|
|
28801
|
+
* `startDragElement` event handler.
|
|
28802
|
+
*/ startDragging(target, event) {
|
|
28752
28803
|
this.startX = event.clientX;
|
|
28753
28804
|
this.startY = event.clientY;
|
|
28754
28805
|
this.isCopyMode = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.ctrlKey)(event); // we can move only element from editor
|
|
28755
|
-
this.draggable =
|
|
28756
|
-
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(this.draggable, 'target',
|
|
28806
|
+
this.draggable = target.cloneNode(true);
|
|
28807
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(this.draggable, 'target', target);
|
|
28757
28808
|
this.state = 1;
|
|
28758
28809
|
this.addDragListeners();
|
|
28759
28810
|
}
|
|
@@ -28822,6 +28873,18 @@ var DragState = /*#__PURE__*/ function(DragState) {
|
|
|
28822
28873
|
}
|
|
28823
28874
|
const { parentElement } = fragment;
|
|
28824
28875
|
this.j.s.insertNode(fragment, true, false);
|
|
28876
|
+
// Dropping a non-editable block (e.g. a `<pre>` code sample) can leave an
|
|
28877
|
+
// invisible filler text node beside it. Remove it so the drop does not
|
|
28878
|
+
// introduce a stray empty line (which clean-html would otherwise strip
|
|
28879
|
+
// later, causing a flash).
|
|
28880
|
+
[
|
|
28881
|
+
fragment.previousSibling,
|
|
28882
|
+
fragment.nextSibling
|
|
28883
|
+
].forEach((node)=>{
|
|
28884
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isEmptyTextNode(node)) {
|
|
28885
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(node);
|
|
28886
|
+
}
|
|
28887
|
+
});
|
|
28825
28888
|
if (parentElement && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isEmpty(parentElement) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isCell(parentElement)) {
|
|
28826
28889
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(parentElement);
|
|
28827
28890
|
}
|
|
@@ -28848,7 +28911,7 @@ var DragState = /*#__PURE__*/ function(DragState) {
|
|
|
28848
28911
|
}
|
|
28849
28912
|
/** @override */ beforeDestruct() {
|
|
28850
28913
|
this.onDragEnd();
|
|
28851
|
-
this.j.e.off('mousedown dragstart', this.onDragStart);
|
|
28914
|
+
this.j.e.off('mousedown dragstart', this.onDragStart).off('startDragElement', this.onStartDragElement);
|
|
28852
28915
|
this.removeDragListeners();
|
|
28853
28916
|
}
|
|
28854
28917
|
constructor(...args){
|
|
@@ -28857,6 +28920,9 @@ var DragState = /*#__PURE__*/ function(DragState) {
|
|
|
28857
28920
|
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "diffStep", 10), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startY", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "state", 0);
|
|
28858
28921
|
}
|
|
28859
28922
|
}
|
|
28923
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
28924
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
|
|
28925
|
+
], dragAndDropElement.prototype, "onStartDragElement", null);
|
|
28860
28926
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
28861
28927
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
|
|
28862
28928
|
], dragAndDropElement.prototype, "onDragStart", null);
|
|
@@ -29356,12 +29422,17 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('dtd', dtd);
|
|
|
29356
29422
|
if (beforeEnter !== undefined) {
|
|
29357
29423
|
return beforeEnter;
|
|
29358
29424
|
}
|
|
29359
|
-
|
|
29360
|
-
|
|
29361
|
-
|
|
29362
|
-
editor.
|
|
29363
|
-
|
|
29364
|
-
|
|
29425
|
+
// Delete-of-selection + new block must be a single history step,
|
|
29426
|
+
// otherwise pressing Enter over a selection needs two Ctrl+Z to undo
|
|
29427
|
+
// (the first only reverts to the intermediate empty state). #1292
|
|
29428
|
+
editor.history.snapshot.transaction(()=>{
|
|
29429
|
+
if (!editor.s.isCollapsed()) {
|
|
29430
|
+
editor.execCommand('Delete');
|
|
29431
|
+
}
|
|
29432
|
+
editor.s.focus();
|
|
29433
|
+
this.onEnter(event);
|
|
29434
|
+
editor.e.fire('afterEnter', event);
|
|
29435
|
+
});
|
|
29365
29436
|
editor.synchronizeValues(); // fire change
|
|
29366
29437
|
return false;
|
|
29367
29438
|
}
|
|
@@ -38482,13 +38553,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38482
38553
|
/* unused harmony export select */
|
|
38483
38554
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
38484
38555
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
38485
|
-
/* harmony import */ var
|
|
38486
|
-
/* harmony import */ var
|
|
38487
|
-
/* harmony import */ var
|
|
38488
|
-
/* harmony import */ var
|
|
38489
|
-
/* harmony import */ var
|
|
38490
|
-
/* harmony import */ var
|
|
38491
|
-
/* harmony import */ var
|
|
38556
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
38557
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
38558
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
|
|
38559
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
38560
|
+
/* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
|
|
38561
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
38562
|
+
/* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
|
|
38563
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47670);
|
|
38492
38564
|
/*!
|
|
38493
38565
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
38494
38566
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -38506,6 +38578,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38506
38578
|
|
|
38507
38579
|
|
|
38508
38580
|
|
|
38581
|
+
|
|
38509
38582
|
/**
|
|
38510
38583
|
* A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
|
|
38511
38584
|
*
|
|
@@ -38516,7 +38589,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38516
38589
|
* console.log(img.src);
|
|
38517
38590
|
* })
|
|
38518
38591
|
* ```
|
|
38519
|
-
*/ class select extends
|
|
38592
|
+
*/ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
38520
38593
|
afterInit(jodit) {
|
|
38521
38594
|
this.proxyEventsList.forEach((eventName)=>{
|
|
38522
38595
|
jodit.e.on(eventName + '.select', this.onStartSelection);
|
|
@@ -38531,7 +38604,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38531
38604
|
const { j } = this;
|
|
38532
38605
|
let result, target = e.target;
|
|
38533
38606
|
while(result === undefined && target && target !== j.editor){
|
|
38534
|
-
result = j.e.fire((0,
|
|
38607
|
+
result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
|
|
38535
38608
|
target = target.parentElement;
|
|
38536
38609
|
}
|
|
38537
38610
|
if (e.type === 'click' && result === undefined && target === j.editor) {
|
|
@@ -38542,10 +38615,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38542
38615
|
* @event outsideClick(e) - when user clicked on the outside of editor
|
|
38543
38616
|
*/ onOutsideClick(e) {
|
|
38544
38617
|
const node = e.target;
|
|
38545
|
-
if (
|
|
38618
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(node, (elm)=>elm === this.j.editor)) {
|
|
38546
38619
|
return;
|
|
38547
38620
|
}
|
|
38548
|
-
const box =
|
|
38621
|
+
const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
|
|
38549
38622
|
if (!box) {
|
|
38550
38623
|
this.j.e.fire('outsideClick', e);
|
|
38551
38624
|
}
|
|
@@ -38554,7 +38627,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38554
38627
|
const { s } = this.j;
|
|
38555
38628
|
if (!s.isCollapsed()) {
|
|
38556
38629
|
const current = s.current();
|
|
38557
|
-
if (current &&
|
|
38630
|
+
if (current && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, current)) {
|
|
38558
38631
|
this.onCopyNormalizeSelectionBound();
|
|
38559
38632
|
}
|
|
38560
38633
|
}
|
|
@@ -38573,14 +38646,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38573
38646
|
*/ onClickRightOfNestedListItem(e) {
|
|
38574
38647
|
const { s } = this.j;
|
|
38575
38648
|
const range = s.range;
|
|
38576
|
-
if (!range.collapsed || range.startOffset !== 0 || !
|
|
38649
|
+
if (!range.collapsed || range.startOffset !== 0 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(range.startContainer)) {
|
|
38577
38650
|
return;
|
|
38578
38651
|
}
|
|
38579
38652
|
const text = range.startContainer;
|
|
38580
38653
|
const li = text.parentNode;
|
|
38581
38654
|
// The text must be the direct content of a list item that has a nested
|
|
38582
38655
|
// list (the last level has no nested list and behaves correctly).
|
|
38583
|
-
if (!
|
|
38656
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(li, 'li') || !(li.querySelector('ul') || li.querySelector('ol'))) {
|
|
38584
38657
|
return;
|
|
38585
38658
|
}
|
|
38586
38659
|
const measure = this.j.ed.createRange();
|
|
@@ -38591,6 +38664,34 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38591
38664
|
s.setCursorAfter(text);
|
|
38592
38665
|
}
|
|
38593
38666
|
}
|
|
38667
|
+
/**
|
|
38668
|
+
* Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
|
|
38669
|
+
* a collapsed cursor leaves empty marker elements with the caret inside; a
|
|
38670
|
+
* click puts the caret right before them (outside), so they get cleaned up
|
|
38671
|
+
* and the formatting is lost. Move the caret back into the innermost marker
|
|
38672
|
+
* so the next typed character keeps every pending format (#1291).
|
|
38673
|
+
*/ onClickKeepPendingFormat() {
|
|
38674
|
+
const { s } = this.j;
|
|
38675
|
+
const range = s.range;
|
|
38676
|
+
if (!range.collapsed || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(range.startContainer)) {
|
|
38677
|
+
return;
|
|
38678
|
+
}
|
|
38679
|
+
const text = range.startContainer;
|
|
38680
|
+
// Caret must sit at the very end of the text, right before the markers.
|
|
38681
|
+
if (range.startOffset !== (text.nodeValue?.length ?? 0)) {
|
|
38682
|
+
return;
|
|
38683
|
+
}
|
|
38684
|
+
const marker = text.nextSibling;
|
|
38685
|
+
if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(marker) || !marker.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_INLINE) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmpty(marker)) {
|
|
38686
|
+
return;
|
|
38687
|
+
}
|
|
38688
|
+
let inner = marker;
|
|
38689
|
+
// Descend into the innermost empty formatting marker.
|
|
38690
|
+
while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(inner.firstElementChild) && inner.firstElementChild.nodeName.match(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_INLINE)){
|
|
38691
|
+
inner = inner.firstElementChild;
|
|
38692
|
+
}
|
|
38693
|
+
s.setCursorIn(inner);
|
|
38694
|
+
}
|
|
38594
38695
|
/**
|
|
38595
38696
|
* Normalize selection after triple click
|
|
38596
38697
|
*/ onTripleClickNormalizeSelection(e) {
|
|
@@ -38599,8 +38700,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38599
38700
|
}
|
|
38600
38701
|
const { s } = this.j;
|
|
38601
38702
|
const { startContainer, startOffset } = s.range;
|
|
38602
|
-
if (startOffset === 0 &&
|
|
38603
|
-
s.select(
|
|
38703
|
+
if (startOffset === 0 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(startContainer)) {
|
|
38704
|
+
s.select(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(startContainer, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock, this.j.editor) || startContainer, true);
|
|
38604
38705
|
}
|
|
38605
38706
|
}
|
|
38606
38707
|
onCopyNormalizeSelectionBound(e) {
|
|
@@ -38608,7 +38709,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38608
38709
|
if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
|
|
38609
38710
|
return;
|
|
38610
38711
|
}
|
|
38611
|
-
if (e && (!e.isTrusted || !
|
|
38712
|
+
if (e && (!e.isTrusted || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isNode(e.target) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(editor, e.target))) {
|
|
38612
38713
|
return;
|
|
38613
38714
|
}
|
|
38614
38715
|
this.jodit.s.expandSelection();
|
|
@@ -38624,38 +38725,43 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
|
|
|
38624
38725
|
}
|
|
38625
38726
|
}
|
|
38626
38727
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
38627
|
-
|
|
38728
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
38628
38729
|
], select.prototype, "onStartSelection", null);
|
|
38629
38730
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
38630
|
-
(0,
|
|
38731
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)('ow:click')
|
|
38631
38732
|
], select.prototype, "onOutsideClick", null);
|
|
38632
38733
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
38633
|
-
(0,
|
|
38734
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
38634
38735
|
':beforeCommandCut'
|
|
38635
38736
|
])
|
|
38636
38737
|
], select.prototype, "beforeCommandCut", null);
|
|
38637
38738
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
38638
|
-
(0,
|
|
38739
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
38639
38740
|
':beforeCommandSelectall'
|
|
38640
38741
|
])
|
|
38641
38742
|
], select.prototype, "beforeCommandSelectAll", null);
|
|
38642
38743
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
38643
|
-
(0,
|
|
38744
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
38644
38745
|
':click'
|
|
38645
38746
|
])
|
|
38646
38747
|
], select.prototype, "onClickRightOfNestedListItem", null);
|
|
38647
38748
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
38648
|
-
(0,
|
|
38749
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
38750
|
+
':click'
|
|
38751
|
+
])
|
|
38752
|
+
], select.prototype, "onClickKeepPendingFormat", null);
|
|
38753
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
38754
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
38649
38755
|
':click'
|
|
38650
38756
|
])
|
|
38651
38757
|
], select.prototype, "onTripleClickNormalizeSelection", null);
|
|
38652
38758
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
38653
|
-
(0,
|
|
38759
|
+
(0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
|
|
38654
38760
|
':copy',
|
|
38655
38761
|
':cut'
|
|
38656
38762
|
])
|
|
38657
38763
|
], select.prototype, "onCopyNormalizeSelectionBound", null);
|
|
38658
|
-
|
|
38764
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('select', select);
|
|
38659
38765
|
|
|
38660
38766
|
|
|
38661
38767
|
/***/ }),
|