jodit 4.2.12 → 4.2.15
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 +11 -5
- package/es2015/jodit.css +115 -115
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +539 -444
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +2 -2
- 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 +115 -115
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +539 -444
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +2 -2
- 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 +115 -115
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +533 -440
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +2 -2
- 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 +115 -115
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +533 -440
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +2 -2
- 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 +129 -129
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +556 -460
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- 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/decorators/autobind/autobind.d.ts +5 -0
- package/esm/core/decorators/autobind/autobind.js +5 -0
- package/esm/core/selection/helpers/index.d.ts +9 -3
- package/esm/core/selection/helpers/index.js +48 -0
- package/esm/core/selection/selection.d.ts +6 -1
- package/esm/core/selection/selection.js +95 -117
- package/esm/index.d.ts +6 -1
- package/esm/index.js +3 -2
- package/esm/modules/table/table.d.ts +3 -1
- package/esm/modules/table/table.js +38 -33
- package/esm/modules/uploader/helpers/send-files.js +33 -29
- package/esm/plugins/backspace/cases/check-remove-char.js +65 -55
- package/esm/plugins/drag-and-drop/drag-and-drop.d.ts +2 -0
- package/esm/plugins/drag-and-drop/drag-and-drop.js +43 -36
- package/esm/plugins/inline-popup/config/items/cells.js +9 -0
- package/esm/plugins/link/link.js +71 -64
- package/esm/plugins/search/helpers/highlight-text-ranges.d.ts +0 -4
- package/esm/plugins/search/helpers/highlight-text-ranges.js +58 -49
- package/esm/plugins/table-keyboard-navigation/table-keyboard-navigation.js +35 -29
- package/package.json +1 -1
- package/types/core/decorators/autobind/autobind.d.ts +5 -0
- package/types/core/selection/helpers/index.d.ts +9 -3
- package/types/core/selection/selection.d.ts +6 -1
- package/types/index.d.ts +6 -1
- package/types/modules/table/table.d.ts +3 -1
- package/types/plugins/drag-and-drop/drag-and-drop.d.ts +2 -0
- package/types/plugins/search/helpers/highlight-text-ranges.d.ts +0 -4
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.2.
|
|
6
|
+
export const APP_VERSION = "4.2.15";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -3,4 +3,9 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* [[include:core/decorators/autobind/README.md]]
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @module decorators/autobind
|
|
10
|
+
*/
|
|
6
11
|
export { default as autobind } from "autobind-decorator";
|
|
@@ -3,4 +3,9 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* [[include:core/decorators/autobind/README.md]]
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @module decorators/autobind
|
|
10
|
+
*/
|
|
6
11
|
export { default as autobind } from "autobind-decorator";
|
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* @module selection
|
|
8
|
-
*/
|
|
9
6
|
export * from "./move-node-inside-start";
|
|
10
7
|
export * from "./move-the-node-along-the-edge-outward";
|
|
8
|
+
/**
|
|
9
|
+
* Check if the cursor is at the edge of the string
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare function cursorInTheEdgeOfString(container: Node, offset: number, start: boolean, end: boolean): boolean;
|
|
13
|
+
export declare function findCorrectCurrentNode(node: Node, range: Range, rightMode: boolean, isCollapsed: boolean, checkChild: boolean, child: (nd: Node) => Node | null): {
|
|
14
|
+
node: Node;
|
|
15
|
+
rightMode: boolean;
|
|
16
|
+
};
|
|
@@ -6,5 +6,53 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module selection
|
|
8
8
|
*/
|
|
9
|
+
import { INVISIBLE_SPACE_REG_EXP_END as INV_END, INVISIBLE_SPACE_REG_EXP_START as INV_START } from "../../constants.js";
|
|
10
|
+
import { Dom } from "../../dom/dom.js";
|
|
9
11
|
export * from "./move-node-inside-start.js";
|
|
10
12
|
export * from "./move-the-node-along-the-edge-outward.js";
|
|
13
|
+
/**
|
|
14
|
+
* Check if the cursor is at the edge of the string
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
export function cursorInTheEdgeOfString(container, offset, start, end) {
|
|
18
|
+
const text = container.nodeValue?.length ? container.nodeValue : '';
|
|
19
|
+
if (end && text.replace(INV_END(), '').length > offset) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
const inv = INV_START().exec(text);
|
|
23
|
+
return start && ((inv && inv[0].length < offset) || (!inv && offset > 0));
|
|
24
|
+
}
|
|
25
|
+
export function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild, child) {
|
|
26
|
+
node = range.startContainer.childNodes[range.startOffset];
|
|
27
|
+
if (!node) {
|
|
28
|
+
node = range.startContainer.childNodes[range.startOffset - 1];
|
|
29
|
+
rightMode = true;
|
|
30
|
+
}
|
|
31
|
+
if (node && isCollapsed && !Dom.isText(node)) {
|
|
32
|
+
// test Current method - Cursor in the left of some SPAN
|
|
33
|
+
if (!rightMode && Dom.isText(node.previousSibling)) {
|
|
34
|
+
node = node.previousSibling;
|
|
35
|
+
}
|
|
36
|
+
else if (checkChild) {
|
|
37
|
+
let current = child(node);
|
|
38
|
+
while (current) {
|
|
39
|
+
if (current && Dom.isText(current)) {
|
|
40
|
+
node = current;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
current = child(current);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (node && !isCollapsed && !Dom.isText(node)) {
|
|
48
|
+
let leftChild = node, rightChild = node;
|
|
49
|
+
do {
|
|
50
|
+
leftChild = leftChild.firstChild;
|
|
51
|
+
rightChild = rightChild.lastChild;
|
|
52
|
+
} while (leftChild && rightChild && !Dom.isText(leftChild));
|
|
53
|
+
if (leftChild === rightChild && leftChild && Dom.isText(leftChild)) {
|
|
54
|
+
node = leftChild;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { node, rightMode };
|
|
58
|
+
}
|
|
@@ -125,10 +125,11 @@ export declare class Selection implements ISelect {
|
|
|
125
125
|
/**
|
|
126
126
|
* Returns the current element under the cursor inside editor
|
|
127
127
|
*/
|
|
128
|
-
current(checkChild?: boolean):
|
|
128
|
+
current(checkChild?: boolean): Nullable<Node>;
|
|
129
129
|
/**
|
|
130
130
|
* Insert element in editor
|
|
131
131
|
*
|
|
132
|
+
* @param node - Node for insert
|
|
132
133
|
* @param insertCursorAfter - After insert, cursor will move after element
|
|
133
134
|
* @param fireChange - After insert, editor fire change event. You can prevent this behavior
|
|
134
135
|
*/
|
|
@@ -137,6 +138,7 @@ export declare class Selection implements ISelect {
|
|
|
137
138
|
* Inserts in the current cursor position some HTML snippet
|
|
138
139
|
*
|
|
139
140
|
* @param html - HTML The text to be inserted into the document
|
|
141
|
+
* @param insertCursorAfter - After insert, cursor will move after element
|
|
140
142
|
* @example
|
|
141
143
|
* ```javascript
|
|
142
144
|
* parent.s.insertHTML('<img src="image.png"/>');
|
|
@@ -148,6 +150,7 @@ export declare class Selection implements ISelect {
|
|
|
148
150
|
*
|
|
149
151
|
* @param url - URL for image, or HTMLImageElement
|
|
150
152
|
* @param styles - If specified, it will be applied <code>$(image).css(styles)</code>
|
|
153
|
+
* @param defaultWidth - If specified, it will be applied <code>css('width', defaultWidth)</code>
|
|
151
154
|
*/
|
|
152
155
|
insertImage(url: string | HTMLImageElement, styles?: Nullable<IDictionary<string>>, defaultWidth?: Nullable<number | string>): void;
|
|
153
156
|
/**
|
|
@@ -188,6 +191,7 @@ export declare class Selection implements ISelect {
|
|
|
188
191
|
private setCursorNearWith;
|
|
189
192
|
/**
|
|
190
193
|
* Set cursor in the node
|
|
194
|
+
* @param node - Node element
|
|
191
195
|
* @param inStart - set cursor in start of element
|
|
192
196
|
*/
|
|
193
197
|
setCursorIn(node: Node, inStart?: boolean): Node;
|
|
@@ -197,6 +201,7 @@ export declare class Selection implements ISelect {
|
|
|
197
201
|
selectRange(range: Range, focus?: boolean): this;
|
|
198
202
|
/**
|
|
199
203
|
* Select node
|
|
204
|
+
* @param node - Node element
|
|
200
205
|
* @param inward - select all inside
|
|
201
206
|
*/
|
|
202
207
|
select(node: Node | HTMLElement | HTMLTableElement | HTMLTableCellElement, inward?: boolean): this;
|
|
@@ -14,7 +14,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
14
14
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
15
|
};
|
|
16
16
|
import * as consts from "../constants.js";
|
|
17
|
-
import { INSEPARABLE_TAGS, INVISIBLE_SPACE,
|
|
17
|
+
import { INSEPARABLE_TAGS, INVISIBLE_SPACE, IS_PROD } from "../constants.js";
|
|
18
18
|
import { autobind } from "../decorators/index.js";
|
|
19
19
|
import { Dom } from "../dom/dom.js";
|
|
20
20
|
import { $$, attr, call, css, error, getScrollParent, scrollIntoViewIfNeeded, size, toArray } from "../helpers/index.js";
|
|
@@ -23,6 +23,7 @@ import { assert } from "../helpers/utils/assert.js";
|
|
|
23
23
|
import { moveTheNodeAlongTheEdgeOutward } from "./helpers/move-the-node-along-the-edge-outward.js";
|
|
24
24
|
import "./interface.js";
|
|
25
25
|
import { CommitStyle } from "./style/commit-style.js";
|
|
26
|
+
import { cursorInTheEdgeOfString, findCorrectCurrentNode } from "./helpers/index.js";
|
|
26
27
|
export class Selection {
|
|
27
28
|
constructor(jodit) {
|
|
28
29
|
this.jodit = jodit;
|
|
@@ -405,63 +406,35 @@ export class Selection {
|
|
|
405
406
|
* Returns the current element under the cursor inside editor
|
|
406
407
|
*/
|
|
407
408
|
current(checkChild = true) {
|
|
408
|
-
if (this.j.getRealMode()
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
else if (checkChild) {
|
|
432
|
-
let current = child(node);
|
|
433
|
-
while (current) {
|
|
434
|
-
if (current && Dom.isText(current)) {
|
|
435
|
-
node = current;
|
|
436
|
-
break;
|
|
437
|
-
}
|
|
438
|
-
current = child(current);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
if (node && !sel.isCollapsed && !Dom.isText(node)) {
|
|
443
|
-
let leftChild = node, rightChild = node;
|
|
444
|
-
do {
|
|
445
|
-
leftChild = leftChild.firstChild;
|
|
446
|
-
rightChild = rightChild.lastChild;
|
|
447
|
-
} while (leftChild && rightChild && !Dom.isText(leftChild));
|
|
448
|
-
if (leftChild === rightChild &&
|
|
449
|
-
leftChild &&
|
|
450
|
-
Dom.isText(leftChild)) {
|
|
451
|
-
node = leftChild;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
// check - cursor inside editor
|
|
456
|
-
if (node && Dom.isOrContains(this.area, node)) {
|
|
457
|
-
return node;
|
|
458
|
-
}
|
|
409
|
+
if (this.j.getRealMode() !== consts.MODE_WYSIWYG) {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
const sel = this.sel;
|
|
413
|
+
if (!sel || sel.rangeCount === 0) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
const range = sel.getRangeAt(0);
|
|
417
|
+
let node = range.startContainer;
|
|
418
|
+
let rightMode = false;
|
|
419
|
+
const child = (nd) => rightMode ? nd.lastChild : nd.firstChild;
|
|
420
|
+
if (Dom.isTag(node, 'br') && sel.isCollapsed) {
|
|
421
|
+
return node;
|
|
422
|
+
}
|
|
423
|
+
if (!Dom.isText(node)) {
|
|
424
|
+
const ret = findCorrectCurrentNode(node, range, rightMode, sel.isCollapsed, checkChild, child);
|
|
425
|
+
node = ret.node;
|
|
426
|
+
rightMode = ret.rightMode;
|
|
427
|
+
}
|
|
428
|
+
// check - cursor inside editor
|
|
429
|
+
if (node && Dom.isOrContains(this.area, node)) {
|
|
430
|
+
return node;
|
|
459
431
|
}
|
|
460
432
|
return null;
|
|
461
433
|
}
|
|
462
434
|
/**
|
|
463
435
|
* Insert element in editor
|
|
464
436
|
*
|
|
437
|
+
* @param node - Node for insert
|
|
465
438
|
* @param insertCursorAfter - After insert, cursor will move after element
|
|
466
439
|
* @param fireChange - After insert, editor fire change event. You can prevent this behavior
|
|
467
440
|
*/
|
|
@@ -523,6 +496,7 @@ export class Selection {
|
|
|
523
496
|
* Inserts in the current cursor position some HTML snippet
|
|
524
497
|
*
|
|
525
498
|
* @param html - HTML The text to be inserted into the document
|
|
499
|
+
* @param insertCursorAfter - After insert, cursor will move after element
|
|
526
500
|
* @example
|
|
527
501
|
* ```javascript
|
|
528
502
|
* parent.s.insertHTML('<img src="image.png"/>');
|
|
@@ -566,6 +540,7 @@ export class Selection {
|
|
|
566
540
|
*
|
|
567
541
|
* @param url - URL for image, or HTMLImageElement
|
|
568
542
|
* @param styles - If specified, it will be applied <code>$(image).css(styles)</code>
|
|
543
|
+
* @param defaultWidth - If specified, it will be applied <code>css('width', defaultWidth)</code>
|
|
569
544
|
*/
|
|
570
545
|
insertImage(url, styles = null, defaultWidth = null) {
|
|
571
546
|
const image = isString(url) ? this.j.createInside.element('img') : url;
|
|
@@ -620,74 +595,81 @@ export class Selection {
|
|
|
620
595
|
*/
|
|
621
596
|
eachSelection(callback) {
|
|
622
597
|
const sel = this.sel;
|
|
623
|
-
if (sel
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
598
|
+
if (!sel || !sel.rangeCount) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const range = sel.getRangeAt(0);
|
|
602
|
+
let root = range.commonAncestorContainer;
|
|
603
|
+
if (!Dom.isHTMLElement(root)) {
|
|
604
|
+
root = root.parentElement;
|
|
605
|
+
}
|
|
606
|
+
const nodes = [];
|
|
607
|
+
const startOffset = range.startOffset;
|
|
608
|
+
const length = root.childNodes.length;
|
|
609
|
+
const elementOffset = startOffset < length ? startOffset : length - 1;
|
|
610
|
+
let start = range.startContainer === this.area
|
|
611
|
+
? root.childNodes[elementOffset]
|
|
612
|
+
: range.startContainer;
|
|
613
|
+
let end = range.endContainer === this.area
|
|
614
|
+
? root.childNodes[range.endOffset - 1]
|
|
615
|
+
: range.endContainer;
|
|
616
|
+
if (Dom.isText(start) &&
|
|
617
|
+
start === range.startContainer &&
|
|
618
|
+
range.startOffset === start.nodeValue?.length &&
|
|
619
|
+
start.nextSibling) {
|
|
620
|
+
start = start.nextSibling;
|
|
621
|
+
}
|
|
622
|
+
if (Dom.isText(end) &&
|
|
623
|
+
end === range.endContainer &&
|
|
624
|
+
range.endOffset === 0 &&
|
|
625
|
+
end.previousSibling) {
|
|
626
|
+
end = end.previousSibling;
|
|
627
|
+
}
|
|
628
|
+
const checkElm = (node) => {
|
|
629
|
+
if (node &&
|
|
630
|
+
node !== root &&
|
|
631
|
+
!Dom.isEmptyTextNode(node) &&
|
|
632
|
+
!isMarker(node)) {
|
|
633
|
+
nodes.push(node);
|
|
640
634
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
635
|
+
};
|
|
636
|
+
checkElm(start);
|
|
637
|
+
if (start !== end && Dom.isOrContains(root, start, true)) {
|
|
638
|
+
Dom.find(start, node => {
|
|
639
|
+
checkElm(node);
|
|
640
|
+
// checks parentElement as well because partial selections are not equal to entire element
|
|
641
|
+
return (node === end ||
|
|
642
|
+
(node && node.contains && node.contains(end)));
|
|
643
|
+
}, root, true, false);
|
|
644
|
+
}
|
|
645
|
+
const forEvery = (current) => {
|
|
646
|
+
if (!Dom.isOrContains(this.j.editor, current, true)) {
|
|
647
|
+
return;
|
|
646
648
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
node !== root &&
|
|
650
|
-
!Dom.isEmptyTextNode(node) &&
|
|
651
|
-
!isMarker(node)) {
|
|
652
|
-
nodes.push(node);
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
checkElm(start);
|
|
656
|
-
if (start !== end && Dom.isOrContains(root, start, true)) {
|
|
657
|
-
Dom.find(start, node => {
|
|
658
|
-
checkElm(node);
|
|
659
|
-
// checks parentElement as well because partial selections are not equal to entire element
|
|
660
|
-
return (node === end ||
|
|
661
|
-
(node && node.contains && node.contains(end)));
|
|
662
|
-
}, root, true, false);
|
|
649
|
+
if (current.nodeName.match(/^(UL|OL)$/)) {
|
|
650
|
+
return toArray(current.childNodes).forEach(forEvery);
|
|
663
651
|
}
|
|
664
|
-
|
|
665
|
-
if (
|
|
666
|
-
|
|
667
|
-
}
|
|
668
|
-
if (current.nodeName.match(/^(UL|OL)$/)) {
|
|
669
|
-
return toArray(current.childNodes).forEach(forEvery);
|
|
652
|
+
if (Dom.isTag(current, 'li')) {
|
|
653
|
+
if (current.firstChild) {
|
|
654
|
+
current = current.firstChild;
|
|
670
655
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
else {
|
|
676
|
-
const currentB = this.j.createInside.text(INVISIBLE_SPACE);
|
|
677
|
-
current.appendChild(currentB);
|
|
678
|
-
current = currentB;
|
|
679
|
-
}
|
|
656
|
+
else {
|
|
657
|
+
const currentB = this.j.createInside.text(INVISIBLE_SPACE);
|
|
658
|
+
current.appendChild(currentB);
|
|
659
|
+
current = currentB;
|
|
680
660
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
661
|
+
}
|
|
662
|
+
callback(current);
|
|
663
|
+
};
|
|
664
|
+
if (nodes.length === 0) {
|
|
665
|
+
if (Dom.isEmptyTextNode(start)) {
|
|
684
666
|
nodes.push(start);
|
|
685
667
|
}
|
|
686
|
-
if (
|
|
668
|
+
if (start.firstChild) {
|
|
687
669
|
nodes.push(start.firstChild);
|
|
688
670
|
}
|
|
689
|
-
nodes.forEach(forEvery);
|
|
690
671
|
}
|
|
672
|
+
nodes.forEach(forEvery);
|
|
691
673
|
}
|
|
692
674
|
/**
|
|
693
675
|
* Checks if the cursor is at the end(start) block
|
|
@@ -714,13 +696,7 @@ export class Selection {
|
|
|
714
696
|
this.j.e.fire('isInvisibleForCursor', elm) === true));
|
|
715
697
|
// check right offset
|
|
716
698
|
if (Dom.isText(container)) {
|
|
717
|
-
|
|
718
|
-
if (end && text.replace(INV_END(), '').length > offset) {
|
|
719
|
-
return false;
|
|
720
|
-
}
|
|
721
|
-
const inv = INV_START().exec(text);
|
|
722
|
-
if (start &&
|
|
723
|
-
((inv && inv[0].length < offset) || (!inv && offset > 0))) {
|
|
699
|
+
if (cursorInTheEdgeOfString(container, offset, start, end)) {
|
|
724
700
|
return false;
|
|
725
701
|
}
|
|
726
702
|
}
|
|
@@ -808,6 +784,7 @@ export class Selection {
|
|
|
808
784
|
}
|
|
809
785
|
/**
|
|
810
786
|
* Set cursor in the node
|
|
787
|
+
* @param node - Node element
|
|
811
788
|
* @param inStart - set cursor in start of element
|
|
812
789
|
*/
|
|
813
790
|
setCursorIn(node, inStart = false) {
|
|
@@ -868,6 +845,7 @@ export class Selection {
|
|
|
868
845
|
}
|
|
869
846
|
/**
|
|
870
847
|
* Select node
|
|
848
|
+
* @param node - Node element
|
|
871
849
|
* @param inward - select all inside
|
|
872
850
|
*/
|
|
873
851
|
select(node, inward = false) {
|
package/esm/index.d.ts
CHANGED
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* [[include:README.md]]
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @module jodit
|
|
10
|
+
*/
|
|
7
11
|
import { Jodit as DefaultJodit } from "./jodit";
|
|
12
|
+
import "./plugins/index";
|
|
8
13
|
|
|
9
14
|
|
|
10
15
|
export { DefaultJodit as Jodit };
|
package/esm/index.js
CHANGED
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
* @module jodit
|
|
10
10
|
*/
|
|
11
|
+
// eslint-disable-next-line simple-import-sort/imports
|
|
12
|
+
import { Jodit as DefaultJodit } from "./jodit.js";
|
|
11
13
|
import { isFunction, isString } from "./core/helpers/checker/index.js";
|
|
12
|
-
import "./plugins/index.js";
|
|
13
14
|
import * as constants from "./core/constants.js";
|
|
14
15
|
import * as decorators from "./core/decorators/index.js";
|
|
15
16
|
import * as Modules from "./modules/index.js";
|
|
16
17
|
import * as Icons from "./styles/icons/index.js";
|
|
17
|
-
import { Jodit as DefaultJodit } from "./jodit.js";
|
|
18
18
|
import Languages from "./languages.js";
|
|
19
|
+
import "./plugins/index.js";
|
|
19
20
|
// copy constants in Jodit
|
|
20
21
|
Object.keys(constants).forEach((key) => {
|
|
21
22
|
DefaultJodit[key] = constants[key];
|
|
@@ -38,6 +38,7 @@ export declare class Table extends ViewComponent<IJodit> {
|
|
|
38
38
|
private static __formalMatrix;
|
|
39
39
|
/**
|
|
40
40
|
* Generate formal table martix columns*rows
|
|
41
|
+
* @param table - Working table
|
|
41
42
|
* @param callback - if return false cycle break
|
|
42
43
|
*/
|
|
43
44
|
formalMatrix(table: HTMLTableElement, callback?: (cell: HTMLTableCellElement, row: number, col: number, colSpan: number, rowSpan: number) => false | void): HTMLTableCellElement[][];
|
|
@@ -54,7 +55,6 @@ export declare class Table extends ViewComponent<IJodit> {
|
|
|
54
55
|
* @param line - Insert a new line after/before this
|
|
55
56
|
* line contains the selected cell
|
|
56
57
|
* @param after - Insert a new line after line contains the selected cell
|
|
57
|
-
* @param create - Instance of Create class
|
|
58
58
|
*/
|
|
59
59
|
appendRow(table: HTMLTableElement, line: false | HTMLTableRowElement, after: boolean): void;
|
|
60
60
|
private static __removeRow;
|
|
@@ -78,6 +78,8 @@ export declare class Table extends ViewComponent<IJodit> {
|
|
|
78
78
|
*/
|
|
79
79
|
getSelectedBound(table: HTMLTableElement, selectedCells: HTMLTableCellElement[]): number[][];
|
|
80
80
|
private static __normalizeTable;
|
|
81
|
+
private static __removeExtraColspans;
|
|
82
|
+
private static __removeExtraRowspans;
|
|
81
83
|
/**
|
|
82
84
|
* Try recalculate all coluns and rows after change
|
|
83
85
|
*/
|