jodit 4.0.1 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -6
- package/es2015/jodit.css +5 -7
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +50 -39
- 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 +5 -7
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +50 -39
- 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 +5 -7
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +50 -39
- 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 +5 -7
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +50 -39
- 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 +7 -9
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +51 -38
- 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/selection/selection.js +5 -1
- package/esm/core/ui/popup/popup.js +5 -4
- package/esm/jodit.js +6 -12
- package/esm/modules/context-menu/context-menu.js +5 -3
- package/esm/modules/dialog/dialog.js +5 -3
- package/esm/modules/file-browser/builders/context-menu.js +3 -1
- package/esm/modules/file-browser/data-provider.js +6 -6
- package/esm/modules/file-browser/file-browser.js +1 -5
- package/esm/modules/toolbar/button/button.d.ts +1 -1
- package/esm/plugins/inline-popup/config/items/a.d.ts +1 -1
- package/esm/plugins/inline-popup/config/items/cells.d.ts +1 -1
- package/esm/plugins/inline-popup/config/items/img.d.ts +1 -1
- package/esm/plugins/select/select.d.ts +2 -1
- package/esm/plugins/select/select.js +12 -2
- package/package.json +1 -1
- package/types/modules/toolbar/button/button.d.ts +1 -1
- package/types/plugins/inline-popup/config/items/a.d.ts +1 -1
- package/types/plugins/inline-popup/config/items/cells.d.ts +1 -1
- package/types/plugins/inline-popup/config/items/img.d.ts +1 -1
- package/types/plugins/select/select.d.ts +2 -1
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.0.
|
|
6
|
+
export const APP_VERSION = "4.0.3";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -1086,7 +1086,8 @@ export class Selection {
|
|
|
1086
1086
|
if (this.isCollapsed()) {
|
|
1087
1087
|
return this;
|
|
1088
1088
|
}
|
|
1089
|
-
const { range } = this
|
|
1089
|
+
const { range } = this;
|
|
1090
|
+
const c = range.cloneRange();
|
|
1090
1091
|
if (!Dom.isOrContains(this.j.editor, range.commonAncestorContainer, true)) {
|
|
1091
1092
|
return this;
|
|
1092
1093
|
}
|
|
@@ -1134,6 +1135,9 @@ export class Selection {
|
|
|
1134
1135
|
}
|
|
1135
1136
|
this.selectRange(c);
|
|
1136
1137
|
Dom.safeRemove(leftFake, rightFake);
|
|
1138
|
+
if (this.isCollapsed()) {
|
|
1139
|
+
throw error('Selection is collapsed');
|
|
1140
|
+
}
|
|
1137
1141
|
return this;
|
|
1138
1142
|
}
|
|
1139
1143
|
}
|
|
@@ -300,10 +300,11 @@ export class Popup extends UIGroup {
|
|
|
300
300
|
.off(this.container, 'scroll mousewheel', up)
|
|
301
301
|
.off(ow, 'scroll', up)
|
|
302
302
|
.off(ow, 'resize', up);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
303
|
+
if (this.j.container.isConnected) {
|
|
304
|
+
Dom.up(this.j.container, box => {
|
|
305
|
+
box && this.j.e.off(box, 'scroll mousewheel', up);
|
|
306
|
+
});
|
|
307
|
+
}
|
|
307
308
|
}
|
|
308
309
|
/**
|
|
309
310
|
* Set ZIndex
|
package/esm/jodit.js
CHANGED
|
@@ -543,18 +543,12 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
|
|
|
543
543
|
}
|
|
544
544
|
if (result !== false) {
|
|
545
545
|
this.s.focus();
|
|
546
|
-
|
|
547
|
-
this.
|
|
548
|
-
this.s.expandSelection();
|
|
546
|
+
try {
|
|
547
|
+
result = this.nativeExecCommand(command, showUI, value);
|
|
549
548
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}
|
|
554
|
-
catch (e) {
|
|
555
|
-
if (!IS_PROD) {
|
|
556
|
-
throw e;
|
|
557
|
-
}
|
|
549
|
+
catch (e) {
|
|
550
|
+
if (!IS_PROD) {
|
|
551
|
+
throw e;
|
|
558
552
|
}
|
|
559
553
|
}
|
|
560
554
|
}
|
|
@@ -565,7 +559,7 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
|
|
|
565
559
|
* @param third - The third option is for the team
|
|
566
560
|
*/
|
|
567
561
|
this.e.fire('afterCommand', command, showUI, value);
|
|
568
|
-
this.
|
|
562
|
+
this.__imdSynchronizeValues(); // synchrony
|
|
569
563
|
return result;
|
|
570
564
|
}
|
|
571
565
|
/**
|
|
@@ -42,7 +42,8 @@ let ContextMenu = class ContextMenu extends Popup {
|
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
44
|
show(x, y, actions) {
|
|
45
|
-
const self = this
|
|
45
|
+
const self = this;
|
|
46
|
+
self.clear();
|
|
46
47
|
if (!isArray(actions)) {
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
@@ -55,12 +56,13 @@ let ContextMenu = class ContextMenu extends Popup {
|
|
|
55
56
|
action.setMod('context', 'menu');
|
|
56
57
|
action.onAction((e) => {
|
|
57
58
|
item.exec?.call(self, e);
|
|
59
|
+
self.clear();
|
|
58
60
|
self.close();
|
|
59
61
|
return false;
|
|
60
62
|
});
|
|
61
|
-
|
|
63
|
+
this.append(action);
|
|
62
64
|
});
|
|
63
|
-
this.
|
|
65
|
+
this.open(() => ({ left: x, top: y, width: 0, height: 0 }), true);
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
68
|
ContextMenu = __decorate([
|
|
@@ -439,10 +439,12 @@ let Dialog = Dialog_1 = class Dialog extends ViewWithToolbar {
|
|
|
439
439
|
this.getMod('static') === true) {
|
|
440
440
|
return this;
|
|
441
441
|
}
|
|
442
|
+
const { e } = this;
|
|
442
443
|
/**
|
|
443
444
|
* Called up to close the window
|
|
444
445
|
*/
|
|
445
|
-
if (
|
|
446
|
+
if (e.fire(this, 'beforeClose') === false ||
|
|
447
|
+
e.fire('beforeClose', this) === false) {
|
|
446
448
|
return this;
|
|
447
449
|
}
|
|
448
450
|
this.setMod('active', false);
|
|
@@ -455,8 +457,8 @@ let Dialog = Dialog_1 = class Dialog extends ViewWithToolbar {
|
|
|
455
457
|
/**
|
|
456
458
|
* It called after the window is closed
|
|
457
459
|
*/
|
|
458
|
-
|
|
459
|
-
|
|
460
|
+
e.fire(this, 'afterClose');
|
|
461
|
+
e.fire(this.ow, 'joditCloseDialog');
|
|
460
462
|
if (this.destroyAfterClose) {
|
|
461
463
|
this.destruct();
|
|
462
464
|
}
|
|
@@ -149,7 +149,9 @@ export default (self) => {
|
|
|
149
149
|
]);
|
|
150
150
|
}, self.defaultTimeout);
|
|
151
151
|
self.e
|
|
152
|
-
.on('beforeClose', () =>
|
|
152
|
+
.on('beforeClose', () => {
|
|
153
|
+
contextmenu.close();
|
|
154
|
+
})
|
|
153
155
|
.on('beforeDestruct', () => contextmenu.destruct());
|
|
154
156
|
e.stopPropagation();
|
|
155
157
|
e.preventDefault();
|
|
@@ -19,7 +19,7 @@ import { autobind } from "jodit/esm/core/decorators/index.js";
|
|
|
19
19
|
import { FileBrowserItem } from "jodit/esm/modules/file-browser/builders/item.js";
|
|
20
20
|
import { IS_PROD } from "jodit/esm/core/constants.js";
|
|
21
21
|
export const DEFAULT_SOURCE_NAME = 'default';
|
|
22
|
-
const possibleRules = [
|
|
22
|
+
const possibleRules = new Set([
|
|
23
23
|
'allowFiles',
|
|
24
24
|
'allowFileMove',
|
|
25
25
|
'allowFileUpload',
|
|
@@ -33,7 +33,7 @@ const possibleRules = [
|
|
|
33
33
|
'allowFolderRename',
|
|
34
34
|
'allowImageResize',
|
|
35
35
|
'allowImageCrop'
|
|
36
|
-
];
|
|
36
|
+
]);
|
|
37
37
|
let DataProvider = class DataProvider {
|
|
38
38
|
constructor(parent, options) {
|
|
39
39
|
this.parent = parent;
|
|
@@ -114,13 +114,13 @@ let DataProvider = class DataProvider {
|
|
|
114
114
|
canI(action) {
|
|
115
115
|
const rule = 'allow' + action;
|
|
116
116
|
if (!IS_PROD) {
|
|
117
|
-
if (!possibleRules.
|
|
117
|
+
if (!possibleRules.has(rule)) {
|
|
118
118
|
throw error('Wrong action ' + action);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
123
|
-
return
|
|
121
|
+
const presetValue = this.o.permissionsPresets[rule];
|
|
122
|
+
if (presetValue !== undefined) {
|
|
123
|
+
return presetValue;
|
|
124
124
|
}
|
|
125
125
|
return (this.__currentPermissions == null ||
|
|
126
126
|
this.__currentPermissions[rule] === undefined ||
|
|
@@ -76,11 +76,7 @@ let FileBrowser = class FileBrowser extends ViewWithToolbar {
|
|
|
76
76
|
minHeight: 300,
|
|
77
77
|
buttons: this.o.headerButtons ?? ['fullsize', 'dialog.close']
|
|
78
78
|
});
|
|
79
|
-
['afterClose', 'beforeOpen'].forEach(proxyEvent =>
|
|
80
|
-
dialog.events.on(dialog, proxyEvent, () => {
|
|
81
|
-
this.e.fire(proxyEvent);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
79
|
+
['beforeClose', 'afterClose', 'beforeOpen'].forEach(proxyEvent => dialog.events.on(dialog, proxyEvent, () => this.e.fire(proxyEvent)));
|
|
84
80
|
dialog.setSize(this.o.width, this.o.height);
|
|
85
81
|
return dialog;
|
|
86
82
|
}
|
|
@@ -20,7 +20,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
|
|
|
20
20
|
theme: string;
|
|
21
21
|
currentValue: string;
|
|
22
22
|
hasTrigger: boolean;
|
|
23
|
-
size: "
|
|
23
|
+
size: "small" | "tiny" | "xsmall" | "middle" | "large";
|
|
24
24
|
name: string;
|
|
25
25
|
value: string | number | boolean; /** @override */
|
|
26
26
|
variant: import("jodit/esm/types").ButtonVariant;
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
* @module plugins/inline-popup
|
|
8
8
|
*/
|
|
9
9
|
import type { IControlType, IJodit } from "jodit/esm/types";
|
|
10
|
-
declare const _default: (string | IControlType<import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> |
|
|
10
|
+
declare const _default: (string | IControlType<IJodit | import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> | import("jodit/esm/types").IFileBrowser<import("jodit/esm/types").IFileBrowserOptions>, import("jodit/esm/types").IToolbarButton>)[];
|
|
11
11
|
export default _default;
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
* @module plugins/inline-popup
|
|
8
8
|
*/
|
|
9
9
|
import type { IControlType } from "jodit/esm/types";
|
|
10
|
-
declare const _default: (string | IControlType<import("jodit/esm/types").
|
|
10
|
+
declare const _default: (string | IControlType<import("jodit/esm/types").IJodit | import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> | import("jodit/esm/types").IFileBrowser<import("jodit/esm/types").IFileBrowserOptions>, import("jodit/esm/types").IToolbarButton>)[];
|
|
11
11
|
export default _default;
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { IControlType, IJodit } from "jodit/esm/types";
|
|
10
10
|
export declare const align: IControlType<IJodit>;
|
|
11
|
-
declare const _default: (string | IControlType<import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> |
|
|
11
|
+
declare const _default: (string | IControlType<IJodit | import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> | import("jodit/esm/types").IFileBrowser<import("jodit/esm/types").IFileBrowserOptions>, import("jodit/esm/types").IToolbarButton>)[];
|
|
12
12
|
export default _default;
|
|
@@ -31,6 +31,7 @@ export declare class select extends Plugin {
|
|
|
31
31
|
* @event outsideClick(e) - when user clicked in the outside of editor
|
|
32
32
|
*/
|
|
33
33
|
protected onOutsideClick(e: MouseEvent): void;
|
|
34
|
-
protected beforeCommandCut(command: string): void;
|
|
34
|
+
protected beforeCommandCut(command: string): void | false;
|
|
35
|
+
protected beforeCommandSelectall(command: string): false;
|
|
35
36
|
protected onCopyNormalizeSelectionBound(e?: ClipboardEvent): void;
|
|
36
37
|
}
|
|
@@ -78,13 +78,20 @@ export class select extends Plugin {
|
|
|
78
78
|
}
|
|
79
79
|
beforeCommandCut(command) {
|
|
80
80
|
const { s } = this.j;
|
|
81
|
-
if (
|
|
81
|
+
if (!s.isCollapsed()) {
|
|
82
82
|
const current = s.current();
|
|
83
83
|
if (current && Dom.isOrContains(this.j.editor, current)) {
|
|
84
84
|
this.onCopyNormalizeSelectionBound();
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
beforeCommandSelectall(command) {
|
|
89
|
+
const { s } = this.j;
|
|
90
|
+
s.focus();
|
|
91
|
+
s.select(this.j.editor, true);
|
|
92
|
+
s.expandSelection();
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
88
95
|
onCopyNormalizeSelectionBound(e) {
|
|
89
96
|
const { s, editor, o } = this.j;
|
|
90
97
|
if (!o.select.normalizeSelectionBeforeCutAndCopy || s.isCollapsed()) {
|
|
@@ -106,8 +113,11 @@ __decorate([
|
|
|
106
113
|
watch('ow:click')
|
|
107
114
|
], select.prototype, "onOutsideClick", null);
|
|
108
115
|
__decorate([
|
|
109
|
-
watch([':
|
|
116
|
+
watch([':beforeCommandCut'])
|
|
110
117
|
], select.prototype, "beforeCommandCut", null);
|
|
118
|
+
__decorate([
|
|
119
|
+
watch([':beforeCommandSelectall'])
|
|
120
|
+
], select.prototype, "beforeCommandSelectall", null);
|
|
111
121
|
__decorate([
|
|
112
122
|
watch([':copy', ':cut'])
|
|
113
123
|
], select.prototype, "onCopyNormalizeSelectionBound", null);
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
|
|
|
20
20
|
theme: string;
|
|
21
21
|
currentValue: string;
|
|
22
22
|
hasTrigger: boolean;
|
|
23
|
-
size: "
|
|
23
|
+
size: "small" | "tiny" | "xsmall" | "middle" | "large";
|
|
24
24
|
name: string;
|
|
25
25
|
value: string | number | boolean; /** @override */
|
|
26
26
|
variant: import("jodit/esm/types").ButtonVariant;
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
* @module plugins/inline-popup
|
|
8
8
|
*/
|
|
9
9
|
import type { IControlType, IJodit } from "jodit/esm/types";
|
|
10
|
-
declare const _default: (string | IControlType<import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> |
|
|
10
|
+
declare const _default: (string | IControlType<IJodit | import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> | import("jodit/esm/types").IFileBrowser<import("jodit/esm/types").IFileBrowserOptions>, import("jodit/esm/types").IToolbarButton>)[];
|
|
11
11
|
export default _default;
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
* @module plugins/inline-popup
|
|
8
8
|
*/
|
|
9
9
|
import type { IControlType } from "jodit/esm/types";
|
|
10
|
-
declare const _default: (string | IControlType<import("jodit/esm/types").
|
|
10
|
+
declare const _default: (string | IControlType<import("jodit/esm/types").IJodit | import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> | import("jodit/esm/types").IFileBrowser<import("jodit/esm/types").IFileBrowserOptions>, import("jodit/esm/types").IToolbarButton>)[];
|
|
11
11
|
export default _default;
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { IControlType, IJodit } from "jodit/esm/types";
|
|
10
10
|
export declare const align: IControlType<IJodit>;
|
|
11
|
-
declare const _default: (string | IControlType<import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> |
|
|
11
|
+
declare const _default: (string | IControlType<IJodit | import("jodit/esm/types").IViewBased<import("jodit/esm/types").IViewOptions> | import("jodit/esm/types").IFileBrowser<import("jodit/esm/types").IFileBrowserOptions>, import("jodit/esm/types").IToolbarButton>)[];
|
|
12
12
|
export default _default;
|
|
@@ -31,6 +31,7 @@ export declare class select extends Plugin {
|
|
|
31
31
|
* @event outsideClick(e) - when user clicked in the outside of editor
|
|
32
32
|
*/
|
|
33
33
|
protected onOutsideClick(e: MouseEvent): void;
|
|
34
|
-
protected beforeCommandCut(command: string): void;
|
|
34
|
+
protected beforeCommandCut(command: string): void | false;
|
|
35
|
+
protected beforeCommandSelectall(command: string): false;
|
|
35
36
|
protected onCopyNormalizeSelectionBound(e?: ClipboardEvent): void;
|
|
36
37
|
}
|