jodit 4.2.14 → 4.2.17
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 +64 -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 +928 -823
- 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 +11 -11
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +2 -2
- 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 +928 -825
- 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 +11 -11
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +2 -2
- 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 +922 -819
- 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 +11 -11
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +2 -2
- 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 +922 -819
- 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 +11 -11
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +2 -2
- 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 +950 -844
- 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 +11 -11
- package/es5/plugins/speech-recognize/speech-recognize.min.js +2 -2
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/utils/config-proto.js +1 -1
- package/esm/core/request/ajax.js +1 -1
- 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/core/ui/helpers/get-control-type.js +15 -9
- package/esm/core/ui/helpers/get-strong-control-types.js +1 -1
- package/esm/index.d.ts +6 -1
- package/esm/index.js +3 -2
- package/esm/jodit.d.ts +1 -1
- package/esm/jodit.js +1 -1
- package/esm/modules/file-browser/file-browser.js +1 -1
- package/esm/modules/history/history.js +1 -1
- package/esm/modules/image-editor/config.js +1 -1
- package/esm/modules/image-editor/image-editor.js +1 -1
- package/esm/modules/table/table.d.ts +3 -1
- package/esm/modules/table/table.js +38 -33
- package/esm/modules/toolbar/button/button.js +2 -1
- package/esm/modules/toolbar/button/select/select.js +2 -1
- package/esm/modules/uploader/helpers/send-files.js +33 -29
- package/esm/modules/uploader/uploader.js +1 -1
- package/esm/plugins/about/about.js +1 -1
- package/esm/plugins/add-new-line/config.js +1 -1
- package/esm/plugins/ai-assistant/config.js +1 -1
- package/esm/plugins/backspace/cases/check-remove-char.js +68 -54
- package/esm/plugins/bold/bold.js +1 -1
- package/esm/plugins/class-span/class-span.js +1 -1
- package/esm/plugins/clean-html/config.js +1 -1
- package/esm/plugins/clipboard/config.js +1 -1
- package/esm/plugins/color/config.js +1 -1
- package/esm/plugins/copy-format/copy-format.js +1 -1
- 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/file/file.js +1 -1
- package/esm/plugins/font/config.js +1 -1
- package/esm/plugins/format-block/config.js +6 -4
- package/esm/plugins/fullsize/config.js +1 -1
- package/esm/plugins/hr/hr.js +1 -1
- package/esm/plugins/image/image.js +1 -1
- package/esm/plugins/image-properties/config.d.ts +0 -3
- package/esm/plugins/image-properties/config.js +3 -0
- package/esm/plugins/image-properties/interface.d.ts +121 -0
- package/esm/plugins/indent/config.js +1 -1
- package/esm/plugins/inline-popup/config/config.js +1 -1
- package/esm/plugins/justify/justify.js +10 -6
- package/esm/plugins/line-height/config.js +1 -1
- package/esm/plugins/link/config.js +1 -1
- package/esm/plugins/link/link.js +71 -64
- package/esm/plugins/mobile/config.js +1 -1
- package/esm/plugins/ordered-list/config.js +1 -1
- package/esm/plugins/paste/config.js +1 -1
- package/esm/plugins/print/print.js +1 -1
- package/esm/plugins/redo-undo/redo-undo.js +1 -1
- package/esm/plugins/search/config.js +1 -1
- 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/source/config.js +1 -1
- package/esm/plugins/speech-recognize/config.js +1 -1
- package/esm/plugins/spellcheck/config.js +1 -1
- package/esm/plugins/symbols/config.js +1 -1
- package/esm/plugins/table/config.js +1 -1
- package/esm/plugins/table-keyboard-navigation/table-keyboard-navigation.js +35 -29
- package/esm/plugins/video/config.js +1 -1
- package/esm/types/toolbar.d.ts +1 -2
- package/package.json +1 -1
- 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/jodit.d.ts +1 -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/image-properties/config.d.ts +0 -3
- package/types/plugins/image-properties/interface.d.ts +121 -0
- package/types/plugins/search/helpers/highlight-text-ranges.d.ts +0 -4
- package/types/types/toolbar.d.ts +1 -2
|
@@ -9,9 +9,9 @@ import { getContainer, pluginSystem } from "../../core/global.js";
|
|
|
9
9
|
import { defaultLanguage } from "../../core/helpers/utils/default-language.js";
|
|
10
10
|
import { previewBox } from "../../core/helpers/utils/print.js";
|
|
11
11
|
import { Icon } from "../../core/ui/icon.js";
|
|
12
|
+
import { Config } from "../../config.js";
|
|
12
13
|
import { generateCriticalCSS } from "./lib/generate-critical-css.js";
|
|
13
14
|
import printIcon from "./print.svg.js";
|
|
14
|
-
import { Config } from "../../config.js";
|
|
15
15
|
Icon.set('print', printIcon);
|
|
16
16
|
Config.prototype.controls.print = {
|
|
17
17
|
exec: (editor) => {
|
|
@@ -7,9 +7,9 @@ import * as consts from "../../core/constants.js";
|
|
|
7
7
|
import { pluginSystem } from "../../core/global.js";
|
|
8
8
|
import { Plugin } from "../../core/plugin/plugin.js";
|
|
9
9
|
import { Icon } from "../../core/ui/icon.js";
|
|
10
|
+
import { Config } from "../../config.js";
|
|
10
11
|
import redoIcon from "./icons/redo.svg.js";
|
|
11
12
|
import undoIcon from "./icons/undo.svg.js";
|
|
12
|
-
import { Config } from "../../config.js";
|
|
13
13
|
Icon.set('redo', redoIcon).set('undo', undoIcon);
|
|
14
14
|
Config.prototype.controls.redo = {
|
|
15
15
|
mode: consts.MODE_SPLIT,
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
import { Icon } from "../../core/ui/icon.js";
|
|
7
|
+
import { Config } from "../../config.js";
|
|
7
8
|
import "./interface.js";
|
|
8
9
|
import searchIcon from "./search.svg.js";
|
|
9
|
-
import { Config } from "../../config.js";
|
|
10
10
|
Config.prototype.useSearch = true;
|
|
11
11
|
Config.prototype.search = {
|
|
12
12
|
lazyIdleTimeout: 0,
|
|
@@ -23,7 +23,3 @@ export declare function clearSelectionWrappers(root: HTMLElement): void;
|
|
|
23
23
|
* @private
|
|
24
24
|
*/
|
|
25
25
|
export declare function clearSelectionWrappersFromHTML(root: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
export declare function isSelectionWrapper(node: unknown): boolean;
|
|
@@ -17,60 +17,14 @@ export function highlightTextRanges(jodit, rng, restRanges, ci, root) {
|
|
|
17
17
|
rng.endContainer.nodeValue == null) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
if (jodit
|
|
21
|
-
// @ts-ignore Because Highlight is not defined in the types TS 5.3.3
|
|
22
|
-
typeof window.Highlight !== 'undefined') {
|
|
23
|
-
const ranges = [rng, ...restRanges].map(rng => {
|
|
24
|
-
const range = jodit.selection.createRange();
|
|
25
|
-
range.setStart(rng.startContainer, rng.startOffset);
|
|
26
|
-
range.setEnd(rng.endContainer, rng.endOffset);
|
|
27
|
-
return range;
|
|
28
|
-
});
|
|
29
|
-
// @ts-ignore Because Highlight is not defined in the types TS 5.3.3
|
|
30
|
-
const searchHighlight = new Highlight(...ranges);
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
CSS.highlights.clear();
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
CSS.highlights.set('jodit-search-result', searchHighlight);
|
|
35
|
-
restRanges.length = 0;
|
|
20
|
+
if (checkNativeSelectionMethod(jodit, rng, restRanges)) {
|
|
36
21
|
return;
|
|
37
22
|
}
|
|
38
23
|
const span = ci.element('span', {
|
|
39
24
|
[TMP_ATTR]: true
|
|
40
25
|
});
|
|
41
26
|
Dom.markTemporary(span);
|
|
42
|
-
|
|
43
|
-
let diff = 0;
|
|
44
|
-
if (rng.startOffset !== 0) {
|
|
45
|
-
const text = ci.text(startText.substring(0, rng.startOffset));
|
|
46
|
-
rng.startContainer.nodeValue = startText.substring(rng.startOffset);
|
|
47
|
-
Dom.before(rng.startContainer, text);
|
|
48
|
-
if (rng.startContainer === rng.endContainer) {
|
|
49
|
-
diff = rng.startOffset;
|
|
50
|
-
rng.endOffset -= diff;
|
|
51
|
-
}
|
|
52
|
-
rng.startOffset = 0;
|
|
53
|
-
}
|
|
54
|
-
const endText = rng.endContainer.nodeValue;
|
|
55
|
-
if (rng.endOffset !== endText.length) {
|
|
56
|
-
const text = ci.text(endText.substring(rng.endOffset));
|
|
57
|
-
rng.endContainer.nodeValue = endText.substring(0, rng.endOffset);
|
|
58
|
-
Dom.after(rng.endContainer, text);
|
|
59
|
-
for (const range of restRanges) {
|
|
60
|
-
if (range.startContainer === rng.endContainer) {
|
|
61
|
-
range.startContainer = text;
|
|
62
|
-
range.startOffset = range.startOffset - rng.endOffset - diff;
|
|
63
|
-
if (range.endContainer === rng.endContainer) {
|
|
64
|
-
range.endContainer = text;
|
|
65
|
-
range.endOffset = range.endOffset - rng.endOffset - diff;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
rng.endOffset = rng.endContainer.nodeValue.length;
|
|
73
|
-
}
|
|
27
|
+
normalizeRanges(rng, restRanges, ci);
|
|
74
28
|
let next = rng.startContainer;
|
|
75
29
|
do {
|
|
76
30
|
if (!next) {
|
|
@@ -113,6 +67,61 @@ export function clearSelectionWrappersFromHTML(root) {
|
|
|
113
67
|
/**
|
|
114
68
|
* @private
|
|
115
69
|
*/
|
|
116
|
-
|
|
70
|
+
function isSelectionWrapper(node) {
|
|
117
71
|
return Dom.isElement(node) && node.hasAttribute(TMP_ATTR);
|
|
118
72
|
}
|
|
73
|
+
function checkNativeSelectionMethod(jodit, rng, restRanges) {
|
|
74
|
+
if (jodit.o.search.useCustomHighlightAPI &&
|
|
75
|
+
// @ts-ignore Because Highlight is not defined in the types TS 5.3.3
|
|
76
|
+
typeof window.Highlight !== 'undefined') {
|
|
77
|
+
const ranges = [rng, ...restRanges].map(rng => {
|
|
78
|
+
const range = jodit.selection.createRange();
|
|
79
|
+
range.setStart(rng.startContainer, rng.startOffset);
|
|
80
|
+
range.setEnd(rng.endContainer, rng.endOffset);
|
|
81
|
+
return range;
|
|
82
|
+
});
|
|
83
|
+
// @ts-ignore Because Highlight is not defined in the types TS 5.3.3
|
|
84
|
+
const searchHighlight = new Highlight(...ranges);
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
CSS.highlights.clear();
|
|
87
|
+
// @ts-ignore
|
|
88
|
+
CSS.highlights.set('jodit-search-result', searchHighlight);
|
|
89
|
+
restRanges.length = 0;
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
function normalizeRanges(rng, restRanges, ci) {
|
|
95
|
+
const startText = rng.startContainer.nodeValue;
|
|
96
|
+
let diff = 0;
|
|
97
|
+
if (rng.startOffset !== 0) {
|
|
98
|
+
const text = ci.text(startText.substring(0, rng.startOffset));
|
|
99
|
+
rng.startContainer.nodeValue = startText.substring(rng.startOffset);
|
|
100
|
+
Dom.before(rng.startContainer, text);
|
|
101
|
+
if (rng.startContainer === rng.endContainer) {
|
|
102
|
+
diff = rng.startOffset;
|
|
103
|
+
rng.endOffset -= diff;
|
|
104
|
+
}
|
|
105
|
+
rng.startOffset = 0;
|
|
106
|
+
}
|
|
107
|
+
const endText = rng.endContainer.nodeValue;
|
|
108
|
+
if (rng.endOffset !== endText.length) {
|
|
109
|
+
const text = ci.text(endText.substring(rng.endOffset));
|
|
110
|
+
rng.endContainer.nodeValue = endText.substring(0, rng.endOffset);
|
|
111
|
+
Dom.after(rng.endContainer, text);
|
|
112
|
+
for (const range of restRanges) {
|
|
113
|
+
if (range.startContainer === rng.endContainer) {
|
|
114
|
+
range.startContainer = text;
|
|
115
|
+
range.startOffset = range.startOffset - rng.endOffset - diff;
|
|
116
|
+
if (range.endContainer === rng.endContainer) {
|
|
117
|
+
range.endContainer = text;
|
|
118
|
+
range.endOffset = range.endOffset - rng.endOffset - diff;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
rng.endOffset = rng.endContainer.nodeValue.length;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { IS_IE, MODE_SOURCE, MODE_SPLIT } from "../../core/constants.js";
|
|
7
7
|
import { Icon } from "../../core/ui/icon.js";
|
|
8
|
-
import sourceIcon from "./source.svg.js";
|
|
9
8
|
import { Config } from "../../config.js";
|
|
9
|
+
import sourceIcon from "./source.svg.js";
|
|
10
10
|
Config.prototype.beautifyHTML = !IS_IE;
|
|
11
11
|
Config.prototype.sourceEditor = 'ace';
|
|
12
12
|
Config.prototype.sourceEditorNativeOptions = {
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import { isBoolean } from "../../core/helpers/checker/is-boolean.js";
|
|
7
7
|
import { dataBind } from "../../core/helpers/utils/data-bind.js";
|
|
8
8
|
import { Icon } from "../../core/ui/icon.js";
|
|
9
|
+
import { Config } from "../../config.js";
|
|
9
10
|
import { SpeechRecognition } from "./helpers/api.js";
|
|
10
11
|
import { RecognizeManager } from "./helpers/recognize-manager.js";
|
|
11
12
|
import speechRecognizeIcon from "./speech-recognize.svg.js";
|
|
12
|
-
import { Config } from "../../config.js";
|
|
13
13
|
Config.prototype.speechRecognize = {
|
|
14
14
|
api: SpeechRecognition,
|
|
15
15
|
sound: true,
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
import { Icon } from "../../core/ui/icon.js";
|
|
7
|
-
import spellcheckIcon from "./spellcheck.svg.js";
|
|
8
7
|
import { Config } from "../../config.js";
|
|
8
|
+
import spellcheckIcon from "./spellcheck.svg.js";
|
|
9
9
|
Config.prototype.spellcheck = false;
|
|
10
10
|
Icon.set('spellcheck', spellcheckIcon);
|
|
11
11
|
Config.prototype.controls.spellcheck = {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
import { Icon } from "../../core/ui/icon.js";
|
|
7
|
-
import symbolsIcon from "./symbols.svg.js";
|
|
8
7
|
import { Config } from "../../config.js";
|
|
8
|
+
import symbolsIcon from "./symbols.svg.js";
|
|
9
9
|
Config.prototype.usePopupForSpecialCharacters = false;
|
|
10
10
|
Config.prototype.specialCharacters = [
|
|
11
11
|
'!',
|
|
@@ -7,8 +7,8 @@ import { Dom } from "../../core/dom/index.js";
|
|
|
7
7
|
import { $$, css, scrollIntoViewIfNeeded } from "../../core/helpers/index.js";
|
|
8
8
|
import { attr } from "../../core/helpers/utils/index.js";
|
|
9
9
|
import { Icon } from "../../core/ui/icon.js";
|
|
10
|
-
import tableIcon from "./table.svg.js";
|
|
11
10
|
import { Config } from "../../config.js";
|
|
11
|
+
import tableIcon from "./table.svg.js";
|
|
12
12
|
Config.prototype.table = {
|
|
13
13
|
selectionCellStyle: 'border: 1px double #1e88e5 !important;',
|
|
14
14
|
useExtraClassesOptions: false
|
|
@@ -23,38 +23,10 @@ export function tableKeyboardNavigation(editor) {
|
|
|
23
23
|
.off('.tableKeyboardNavigation')
|
|
24
24
|
.on('keydown.tableKeyboardNavigation', (event) => {
|
|
25
25
|
const { key } = event;
|
|
26
|
-
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const current = editor.s.current();
|
|
30
|
-
if (!current) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const cell = Dom.up(current, Dom.isCell, editor.editor);
|
|
26
|
+
const cell = findCell(editor, key);
|
|
34
27
|
if (!cell) {
|
|
35
28
|
return;
|
|
36
29
|
}
|
|
37
|
-
const { range } = editor.s;
|
|
38
|
-
if (key !== consts.KEY_TAB && current !== cell) {
|
|
39
|
-
const isNextDirection = key === consts.KEY_RIGHT || key === consts.KEY_DOWN;
|
|
40
|
-
const hasNext = call(!isNextDirection ? Dom.prev : Dom.next, current, elm => key === consts.KEY_UP || key === consts.KEY_DOWN
|
|
41
|
-
? Dom.isTag(elm, 'br')
|
|
42
|
-
: Boolean(elm), cell);
|
|
43
|
-
if ((!isNextDirection &&
|
|
44
|
-
(hasNext ||
|
|
45
|
-
(key !== consts.KEY_UP &&
|
|
46
|
-
Dom.isText(current) &&
|
|
47
|
-
range.startOffset !== 0))) ||
|
|
48
|
-
(isNextDirection &&
|
|
49
|
-
(hasNext ||
|
|
50
|
-
(key !== consts.KEY_DOWN &&
|
|
51
|
-
Dom.isText(current) &&
|
|
52
|
-
current.nodeValue &&
|
|
53
|
-
range.startOffset !==
|
|
54
|
-
current.nodeValue.length)))) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
30
|
const tableModule = editor.getInstance(Table, editor.o);
|
|
59
31
|
const table = Dom.closest(cell, 'table', editor.editor);
|
|
60
32
|
let next = null;
|
|
@@ -112,3 +84,37 @@ export function tableKeyboardNavigation(editor) {
|
|
|
112
84
|
});
|
|
113
85
|
}
|
|
114
86
|
pluginSystem.add('tableKeyboardNavigation', tableKeyboardNavigation);
|
|
87
|
+
function findCell(editor, key) {
|
|
88
|
+
if (!WORK_KEYS.has(key)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const current = editor.s.current();
|
|
92
|
+
if (!current) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const cell = Dom.up(current, Dom.isCell, editor.editor);
|
|
96
|
+
if (!cell) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const { range } = editor.s;
|
|
100
|
+
if (key !== consts.KEY_TAB && current !== cell) {
|
|
101
|
+
const isNextDirection = key === consts.KEY_RIGHT || key === consts.KEY_DOWN;
|
|
102
|
+
const hasNext = call(!isNextDirection ? Dom.prev : Dom.next, current, elm => key === consts.KEY_UP || key === consts.KEY_DOWN
|
|
103
|
+
? Dom.isTag(elm, 'br')
|
|
104
|
+
: Boolean(elm), cell);
|
|
105
|
+
if ((!isNextDirection &&
|
|
106
|
+
(hasNext ||
|
|
107
|
+
(key !== consts.KEY_UP &&
|
|
108
|
+
Dom.isText(current) &&
|
|
109
|
+
range.startOffset !== 0))) ||
|
|
110
|
+
(isNextDirection &&
|
|
111
|
+
(hasNext ||
|
|
112
|
+
(key !== consts.KEY_DOWN &&
|
|
113
|
+
Dom.isText(current) &&
|
|
114
|
+
current.nodeValue &&
|
|
115
|
+
range.startOffset !== current.nodeValue.length)))) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return cell;
|
|
120
|
+
}
|
|
@@ -7,9 +7,9 @@ import { convertMediaUrlToVideoEmbed } from "../../core/helpers/index.js";
|
|
|
7
7
|
import { Button } from "../../core/ui/button/index.js";
|
|
8
8
|
import { UIBlock, UIForm, UIInput, UITextArea } from "../../core/ui/form/index.js";
|
|
9
9
|
import { Icon } from "../../core/ui/icon.js";
|
|
10
|
+
import { Config } from "../../config.js";
|
|
10
11
|
import { TabsWidget } from "../../modules/widget/index.js";
|
|
11
12
|
import videoIcon from "./video.svg.js";
|
|
12
|
-
import { Config } from "../../config.js";
|
|
13
13
|
Icon.set('video', videoIcon);
|
|
14
14
|
Config.prototype.controls.video = {
|
|
15
15
|
popup: (editor, current, close) => {
|
package/esm/types/toolbar.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { IViewBased } from "./view";
|
|
|
12
12
|
import type { IJodit } from "./jodit";
|
|
13
13
|
import type { Modes, IDictionary, HTMLTagNames, Nullable, IContainer, IComponent, IBound } from "./types";
|
|
14
14
|
import type { IMods } from "./traits";
|
|
15
|
-
interface IControlType<T extends IViewBased = IJodit | IViewBased | IFileBrowser, B = IToolbarButton> {
|
|
15
|
+
interface IControlType<T extends IViewBased = IJodit | IViewBased | IFileBrowser, B extends IToolbarButton = IToolbarButton> {
|
|
16
16
|
name?: string;
|
|
17
17
|
text?: string;
|
|
18
18
|
textTemplate?: (jodit: T, value: string) => string;
|
|
@@ -228,7 +228,6 @@ interface IControlListItem {
|
|
|
228
228
|
}
|
|
229
229
|
interface IControlTypeStrong extends IControlType {
|
|
230
230
|
name: NonNullable<IControlType['name']>;
|
|
231
|
-
list?: IDictionary<string | number>;
|
|
232
231
|
}
|
|
233
232
|
interface IControlTypeContent extends IControlTypeStrong {
|
|
234
233
|
getContent: NonNullable<IControlTypeStrong['getContent']>;
|
package/package.json
CHANGED
|
@@ -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
|
+
};
|
|
@@ -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;
|
package/types/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/types/jodit.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import type { AjaxOptions, CanPromise, CustomCommand, ICreate, IDictionary, IFil
|
|
|
12
12
|
import type * as Modules from "./modules";
|
|
13
13
|
import * as constants from "./core/constants";
|
|
14
14
|
import { Dlgs } from "./core/traits/dlgs";
|
|
15
|
-
import { Selection, ViewWithToolbar } from "./modules";
|
|
16
15
|
import { Config } from "./config";
|
|
16
|
+
import { Selection, ViewWithToolbar } from "./modules";
|
|
17
17
|
/**
|
|
18
18
|
* Class Jodit. Main class
|
|
19
19
|
*/
|
|
@@ -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
|
*/
|
|
@@ -3,9 +3,6 @@
|
|
|
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 plugins/image-properties
|
|
8
|
-
*/
|
|
9
6
|
import type { ImagePropertiesOptions } from "./interface";
|
|
10
7
|
declare module 'jodit/config' {
|
|
11
8
|
interface Config {
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
+
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @module plugins/image-properties
|
|
8
|
+
*/
|
|
9
|
+
import type { ImageHAlign } from "../../types";
|
|
10
|
+
export type EditValues = {
|
|
11
|
+
style: string;
|
|
12
|
+
imageSrc: string;
|
|
13
|
+
borderRadius: number;
|
|
14
|
+
imageTitle: string;
|
|
15
|
+
imageAlt: string;
|
|
16
|
+
imageLink: string;
|
|
17
|
+
imageLinkOpenInNewTab: boolean;
|
|
18
|
+
imageWidth: number | string;
|
|
19
|
+
imageHeight: number | string;
|
|
20
|
+
marginTop: number | string;
|
|
21
|
+
marginRight: number | string;
|
|
22
|
+
marginBottom: number | string;
|
|
23
|
+
marginLeft: number | string;
|
|
24
|
+
classes: string;
|
|
25
|
+
id: string;
|
|
26
|
+
align: ImageHAlign;
|
|
27
|
+
};
|
|
28
|
+
export interface ImagePropertiesState {
|
|
29
|
+
image: HTMLImageElement;
|
|
30
|
+
sourceImage: HTMLImageElement;
|
|
31
|
+
ratio: number;
|
|
32
|
+
sizeIsLocked: boolean;
|
|
33
|
+
marginIsLocked: boolean;
|
|
34
|
+
values: EditValues;
|
|
35
|
+
}
|
|
36
|
+
export interface ImagePropertiesAPI {
|
|
37
|
+
openImageEditor: () => void;
|
|
38
|
+
openImagePopup: (target: HTMLElement) => void;
|
|
39
|
+
}
|
|
40
|
+
export interface ImagePropertiesOptions {
|
|
41
|
+
dialogWidth: number;
|
|
42
|
+
/**
|
|
43
|
+
* Open editing dialog after double click on image
|
|
44
|
+
*/
|
|
45
|
+
openOnDblClick: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Show edit 'src' input
|
|
48
|
+
*/
|
|
49
|
+
editSrc: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Show crop/resize btn
|
|
52
|
+
*/
|
|
53
|
+
useImageEditor: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Show edit 'title' input
|
|
56
|
+
*/
|
|
57
|
+
editTitle: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Show edit 'alt' input
|
|
60
|
+
*/
|
|
61
|
+
editAlt: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Show edit image link's options
|
|
64
|
+
*/
|
|
65
|
+
editLink: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Show edit image size's inputs
|
|
68
|
+
*/
|
|
69
|
+
editSize: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Show edit margin inputs
|
|
72
|
+
*/
|
|
73
|
+
editMargins: boolean;
|
|
74
|
+
editBorderRadius: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Show edit classNames input
|
|
77
|
+
*/
|
|
78
|
+
editClass: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Pre-define available classes to select from
|
|
81
|
+
*
|
|
82
|
+
* Classes can be provided as list of strings or as list of tuples
|
|
83
|
+
* `["classname", "human label"]`.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```javascript
|
|
87
|
+
* new Jodit('#editor', {
|
|
88
|
+
* image: {
|
|
89
|
+
* availableClasses: [
|
|
90
|
+
* "rte-image-width-50",
|
|
91
|
+
* ["rte-image-width-75", "75 % width"]
|
|
92
|
+
* ]
|
|
93
|
+
* }
|
|
94
|
+
* })
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
availableClasses: [
|
|
98
|
+
string,
|
|
99
|
+
string
|
|
100
|
+
][] | string[];
|
|
101
|
+
/**
|
|
102
|
+
* Show style edit input
|
|
103
|
+
*/
|
|
104
|
+
editStyle: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Show edit ID input
|
|
107
|
+
*/
|
|
108
|
+
editId: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Show Alignment selector
|
|
111
|
+
*/
|
|
112
|
+
editAlign: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Show preview image
|
|
115
|
+
*/
|
|
116
|
+
showPreview: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Select image after close dialog
|
|
119
|
+
*/
|
|
120
|
+
selectImageAfterClose: boolean;
|
|
121
|
+
}
|
|
@@ -23,7 +23,3 @@ export declare function clearSelectionWrappers(root: HTMLElement): void;
|
|
|
23
23
|
* @private
|
|
24
24
|
*/
|
|
25
25
|
export declare function clearSelectionWrappersFromHTML(root: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
export declare function isSelectionWrapper(node: unknown): boolean;
|
package/types/types/toolbar.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { IViewBased } from "./view";
|
|
|
12
12
|
import type { IJodit } from "./jodit";
|
|
13
13
|
import type { Modes, IDictionary, HTMLTagNames, Nullable, IContainer, IComponent, IBound } from "./types";
|
|
14
14
|
import type { IMods } from "./traits";
|
|
15
|
-
interface IControlType<T extends IViewBased = IJodit | IViewBased | IFileBrowser, B = IToolbarButton> {
|
|
15
|
+
interface IControlType<T extends IViewBased = IJodit | IViewBased | IFileBrowser, B extends IToolbarButton = IToolbarButton> {
|
|
16
16
|
name?: string;
|
|
17
17
|
text?: string;
|
|
18
18
|
textTemplate?: (jodit: T, value: string) => string;
|
|
@@ -228,7 +228,6 @@ interface IControlListItem {
|
|
|
228
228
|
}
|
|
229
229
|
interface IControlTypeStrong extends IControlType {
|
|
230
230
|
name: NonNullable<IControlType['name']>;
|
|
231
|
-
list?: IDictionary<string | number>;
|
|
232
231
|
}
|
|
233
232
|
interface IControlTypeContent extends IControlTypeStrong {
|
|
234
233
|
getContent: NonNullable<IControlTypeStrong['getContent']>;
|