jodit 4.2.50 → 4.3.1
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 +27 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +238 -108
- package/es2015/jodit.min.js +2 -2
- 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.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +239 -108
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.css +1 -1
- 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 +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +237 -107
- package/es2021/jodit.min.js +2 -2
- 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 +2 -2
- package/es2021.en/jodit.js +237 -107
- package/es2021.en/jodit.min.js +2 -2
- 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/164.fat.min.js +1 -1
- package/es5/164.min.js +1 -1
- package/es5/5.fat.min.js +1 -1
- package/es5/5.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +241 -109
- 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/esm/config.d.ts +4 -0
- package/esm/config.js +4 -0
- package/esm/core/constants.js +1 -1
- package/esm/core/decorators/cache/cache.d.ts +100 -0
- package/esm/core/decorators/cache/cache.js +106 -0
- package/esm/core/global.d.ts +6 -1
- package/esm/core/global.js +15 -13
- package/esm/core/helpers/utils/selector.d.ts +5 -1
- package/esm/core/helpers/utils/selector.js +3 -0
- package/esm/core/traits/dlgs.js +3 -0
- package/esm/core/view/view.js +4 -6
- package/esm/jodit.js +5 -5
- package/esm/modules/dialog/dialog.d.ts +8 -8
- package/esm/modules/dialog/dialog.js +37 -30
- package/esm/modules/file-browser/file-browser.js +2 -2
- package/esm/plugins/clipboard/clipboard.js +2 -1
- package/esm/plugins/image-processor/image-processor.js +5 -4
- package/esm/plugins/search/search.js +2 -2
- package/esm/types/view.d.ts +1 -0
- package/package.json +1 -1
- package/types/config.d.ts +4 -0
- package/types/core/decorators/cache/cache.d.ts +100 -0
- package/types/core/global.d.ts +6 -1
- package/types/core/helpers/utils/selector.d.ts +5 -1
- package/types/modules/dialog/dialog.d.ts +8 -8
- package/types/types/view.d.ts +1 -0
package/esm/config.d.ts
CHANGED
|
@@ -686,6 +686,10 @@ declare class Config implements IViewOptions {
|
|
|
686
686
|
* Buttons in toolbat without SVG - only texts
|
|
687
687
|
*/
|
|
688
688
|
textIcons: boolean;
|
|
689
|
+
/**
|
|
690
|
+
* Element for dialog container
|
|
691
|
+
*/
|
|
692
|
+
popupRoot: Nullable<HTMLElement>;
|
|
689
693
|
/**
|
|
690
694
|
* shows a INPUT[type=color] to open the browser color picker, on the right bottom of widget color picker
|
|
691
695
|
*/
|
package/esm/config.js
CHANGED
|
@@ -880,6 +880,10 @@ class Config {
|
|
|
880
880
|
* Buttons in toolbat without SVG - only texts
|
|
881
881
|
*/
|
|
882
882
|
this.textIcons = false;
|
|
883
|
+
/**
|
|
884
|
+
* Element for dialog container
|
|
885
|
+
*/
|
|
886
|
+
this.popupRoot = null;
|
|
883
887
|
/**
|
|
884
888
|
* shows a INPUT[type=color] to open the browser color picker, on the right bottom of widget color picker
|
|
885
889
|
*/
|
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-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.
|
|
6
|
+
export const APP_VERSION = "4.3.1";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -12,6 +12,106 @@ import type { IDictionary, Nullable } from "../../../types";
|
|
|
12
12
|
export interface CachePropertyDescriptor<T, R> extends PropertyDescriptor {
|
|
13
13
|
get?: (this: T) => R;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves a cached property value from an object if it exists; otherwise, returns `null`.
|
|
17
|
+
*
|
|
18
|
+
* This utility is particularly useful when working with properties that are lazily initialized
|
|
19
|
+
* or dynamically created, such as getters or cached computations. It ensures you can safely
|
|
20
|
+
* access the value without triggering initialization or creating a new instance.
|
|
21
|
+
*
|
|
22
|
+
* ### Usage Example:
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { IUIElement } from "jodit";
|
|
25
|
+
*
|
|
26
|
+
* const { component, cache, cached } = Jodit.decorators;
|
|
27
|
+
* const { UIElement } = Jodit.modules;
|
|
28
|
+
*
|
|
29
|
+
* @component
|
|
30
|
+
* class SomeComponent extends UIElement {
|
|
31
|
+
* @cache
|
|
32
|
+
* get someElement(): IUIElement {
|
|
33
|
+
* return new UIElement(this.jodit);
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* destruct() {
|
|
37
|
+
* // Use the cached utility to clean up only if the property is initialized
|
|
38
|
+
* cached(this, 'someElement')?.destruct();
|
|
39
|
+
* super.destruct();
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param object - The object containing the property to check.
|
|
45
|
+
* @param property - The name of the property to retrieve from the cache.
|
|
46
|
+
* @returns The cached value of the property if it exists; otherwise, `null`.
|
|
47
|
+
*
|
|
48
|
+
* ### Notes:
|
|
49
|
+
* - If the property is defined as a getter, the function will return `null`
|
|
50
|
+
* instead of invoking the getter.
|
|
51
|
+
* - This function is non-destructive and does not alter the object's state.
|
|
52
|
+
*/
|
|
15
53
|
export declare function cached<T>(object: object, property: string): Nullable<T>;
|
|
54
|
+
/**
|
|
55
|
+
* A decorator that caches the result of a getter method. Once the getter is accessed for the first time,
|
|
56
|
+
* its computed value is stored as a property of the object. Subsequent accesses return the cached value
|
|
57
|
+
* without recalculating it, improving performance and avoiding redundant computations.
|
|
58
|
+
*
|
|
59
|
+
* ### Key Features:
|
|
60
|
+
* - **Lazy Initialization**: The original getter is invoked only once, the first time the property is accessed.
|
|
61
|
+
* - **Immutability**: After caching, the value is stored as a non-writable, non-configurable property, preventing accidental modifications.
|
|
62
|
+
* - **Conditional Caching**: If the returned value has a property `noCache` set to `true`, the caching mechanism is bypassed, and the getter is invoked each time.
|
|
63
|
+
*
|
|
64
|
+
* ### Usage Example 1: Basic Caching
|
|
65
|
+
* ```typescript
|
|
66
|
+
* import { cache } from './decorators';
|
|
67
|
+
*
|
|
68
|
+
* class Example {
|
|
69
|
+
* private counter = 0;
|
|
70
|
+
*
|
|
71
|
+
* @cache
|
|
72
|
+
* get expensiveComputation(): number {
|
|
73
|
+
* console.log('Calculating...');
|
|
74
|
+
* return ++this.counter;
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
77
|
+
*
|
|
78
|
+
* const instance = new Example();
|
|
79
|
+
* console.log(instance.expensiveComputation); // Logs "Calculating..." and returns 1
|
|
80
|
+
* console.log(instance.expensiveComputation); // Returns 1 (cached value, no calculation)
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* ### Usage Example 2: Integration with Cached Utilities
|
|
84
|
+
* ```typescript
|
|
85
|
+
* import { cache, cached } from './decorators';
|
|
86
|
+
* import type { IUIElement } from "jodit";
|
|
87
|
+
*
|
|
88
|
+
* const { component } = Jodit.decorators;
|
|
89
|
+
* const { UIElement } = Jodit.modules;
|
|
90
|
+
*
|
|
91
|
+
* @component
|
|
92
|
+
* class SomeComponent extends UIElement {
|
|
93
|
+
* @cache
|
|
94
|
+
* get someElement(): IUIElement {
|
|
95
|
+
* return new UIElement(this.jodit);
|
|
96
|
+
* }
|
|
97
|
+
*
|
|
98
|
+
* destruct() {
|
|
99
|
+
* // Use the cached utility to clean up only if the property is initialized
|
|
100
|
+
* cached(this, 'someElement')?.destruct();
|
|
101
|
+
* super.destruct();
|
|
102
|
+
* }
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @param _ - The target object (not used directly).
|
|
107
|
+
* @param name - The name of the property to decorate.
|
|
108
|
+
* @param descriptor - The property descriptor, which must include a getter method.
|
|
109
|
+
* @throws Will throw an error if the descriptor does not include a getter.
|
|
110
|
+
*
|
|
111
|
+
* ### Notes:
|
|
112
|
+
* - **Performance**: Ideal for properties that are computationally expensive and do not change after the initial computation.
|
|
113
|
+
* - **Flexibility**: Supports conditional caching via the `noCache` property in the returned value.
|
|
114
|
+
* - **Compatibility**: Designed to work seamlessly with objects and classes in TypeScript or JavaScript.
|
|
115
|
+
*/
|
|
16
116
|
export declare function cache<T, R>(_: object, name: PropertyKey, descriptor: CachePropertyDescriptor<T, R>): void;
|
|
17
117
|
export declare function cacheHTML<T extends Function, R>(target: IDictionary, _: string, descriptor: CachePropertyDescriptor<T, R>): void;
|
|
@@ -4,9 +4,48 @@
|
|
|
4
4
|
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
import { STATUSES } from "../../component/statuses.js";
|
|
7
|
+
import { IS_PROD } from "../../constants.js";
|
|
7
8
|
import { Dom } from "../../dom/dom.js";
|
|
8
9
|
import { isFunction, isViewObject } from "../../helpers/checker/index.js";
|
|
9
10
|
import { error } from "../../helpers/utils/error/error.js";
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves a cached property value from an object if it exists; otherwise, returns `null`.
|
|
13
|
+
*
|
|
14
|
+
* This utility is particularly useful when working with properties that are lazily initialized
|
|
15
|
+
* or dynamically created, such as getters or cached computations. It ensures you can safely
|
|
16
|
+
* access the value without triggering initialization or creating a new instance.
|
|
17
|
+
*
|
|
18
|
+
* ### Usage Example:
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import type { IUIElement } from "jodit";
|
|
21
|
+
*
|
|
22
|
+
* const { component, cache, cached } = Jodit.decorators;
|
|
23
|
+
* const { UIElement } = Jodit.modules;
|
|
24
|
+
*
|
|
25
|
+
* @component
|
|
26
|
+
* class SomeComponent extends UIElement {
|
|
27
|
+
* @cache
|
|
28
|
+
* get someElement(): IUIElement {
|
|
29
|
+
* return new UIElement(this.jodit);
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* destruct() {
|
|
33
|
+
* // Use the cached utility to clean up only if the property is initialized
|
|
34
|
+
* cached(this, 'someElement')?.destruct();
|
|
35
|
+
* super.destruct();
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param object - The object containing the property to check.
|
|
41
|
+
* @param property - The name of the property to retrieve from the cache.
|
|
42
|
+
* @returns The cached value of the property if it exists; otherwise, `null`.
|
|
43
|
+
*
|
|
44
|
+
* ### Notes:
|
|
45
|
+
* - If the property is defined as a getter, the function will return `null`
|
|
46
|
+
* instead of invoking the getter.
|
|
47
|
+
* - This function is non-destructive and does not alter the object's state.
|
|
48
|
+
*/
|
|
10
49
|
export function cached(object, property) {
|
|
11
50
|
const descriptor = Object.getOwnPropertyDescriptor(object, property);
|
|
12
51
|
if (!descriptor || isFunction(descriptor.get)) {
|
|
@@ -14,12 +53,79 @@ export function cached(object, property) {
|
|
|
14
53
|
}
|
|
15
54
|
return descriptor.value;
|
|
16
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* A decorator that caches the result of a getter method. Once the getter is accessed for the first time,
|
|
58
|
+
* its computed value is stored as a property of the object. Subsequent accesses return the cached value
|
|
59
|
+
* without recalculating it, improving performance and avoiding redundant computations.
|
|
60
|
+
*
|
|
61
|
+
* ### Key Features:
|
|
62
|
+
* - **Lazy Initialization**: The original getter is invoked only once, the first time the property is accessed.
|
|
63
|
+
* - **Immutability**: After caching, the value is stored as a non-writable, non-configurable property, preventing accidental modifications.
|
|
64
|
+
* - **Conditional Caching**: If the returned value has a property `noCache` set to `true`, the caching mechanism is bypassed, and the getter is invoked each time.
|
|
65
|
+
*
|
|
66
|
+
* ### Usage Example 1: Basic Caching
|
|
67
|
+
* ```typescript
|
|
68
|
+
* import { cache } from './decorators';
|
|
69
|
+
*
|
|
70
|
+
* class Example {
|
|
71
|
+
* private counter = 0;
|
|
72
|
+
*
|
|
73
|
+
* @cache
|
|
74
|
+
* get expensiveComputation(): number {
|
|
75
|
+
* console.log('Calculating...');
|
|
76
|
+
* return ++this.counter;
|
|
77
|
+
* }
|
|
78
|
+
* }
|
|
79
|
+
*
|
|
80
|
+
* const instance = new Example();
|
|
81
|
+
* console.log(instance.expensiveComputation); // Logs "Calculating..." and returns 1
|
|
82
|
+
* console.log(instance.expensiveComputation); // Returns 1 (cached value, no calculation)
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* ### Usage Example 2: Integration with Cached Utilities
|
|
86
|
+
* ```typescript
|
|
87
|
+
* import { cache, cached } from './decorators';
|
|
88
|
+
* import type { IUIElement } from "jodit";
|
|
89
|
+
*
|
|
90
|
+
* const { component } = Jodit.decorators;
|
|
91
|
+
* const { UIElement } = Jodit.modules;
|
|
92
|
+
*
|
|
93
|
+
* @component
|
|
94
|
+
* class SomeComponent extends UIElement {
|
|
95
|
+
* @cache
|
|
96
|
+
* get someElement(): IUIElement {
|
|
97
|
+
* return new UIElement(this.jodit);
|
|
98
|
+
* }
|
|
99
|
+
*
|
|
100
|
+
* destruct() {
|
|
101
|
+
* // Use the cached utility to clean up only if the property is initialized
|
|
102
|
+
* cached(this, 'someElement')?.destruct();
|
|
103
|
+
* super.destruct();
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @param _ - The target object (not used directly).
|
|
109
|
+
* @param name - The name of the property to decorate.
|
|
110
|
+
* @param descriptor - The property descriptor, which must include a getter method.
|
|
111
|
+
* @throws Will throw an error if the descriptor does not include a getter.
|
|
112
|
+
*
|
|
113
|
+
* ### Notes:
|
|
114
|
+
* - **Performance**: Ideal for properties that are computationally expensive and do not change after the initial computation.
|
|
115
|
+
* - **Flexibility**: Supports conditional caching via the `noCache` property in the returned value.
|
|
116
|
+
* - **Compatibility**: Designed to work seamlessly with objects and classes in TypeScript or JavaScript.
|
|
117
|
+
*/
|
|
17
118
|
export function cache(_, name, descriptor) {
|
|
18
119
|
const getter = descriptor.get;
|
|
19
120
|
if (!getter) {
|
|
20
121
|
throw error('Getter property descriptor expected');
|
|
21
122
|
}
|
|
22
123
|
descriptor.get = function () {
|
|
124
|
+
if (!IS_PROD) {
|
|
125
|
+
if (this.isInDestruct) {
|
|
126
|
+
console.error('Trying to access property in destructed component');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
23
129
|
const value = getter.call(this);
|
|
24
130
|
if (value && value.noCache === true) {
|
|
25
131
|
return value;
|
package/esm/core/global.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module global
|
|
8
8
|
*/
|
|
9
|
-
import type { HTMLTagNames, IDictionary, IJodit, IViewBased, IViewComponent } from "../types";
|
|
9
|
+
import type { HTMLTagNames, IDictionary, IJodit, IViewBased, IViewComponent, IViewOptions } from "../types";
|
|
10
10
|
import { PluginSystem } from "./plugin/plugin-system";
|
|
11
11
|
import { EventEmitter } from "./event-emitter";
|
|
12
12
|
export declare const instances: IDictionary<IJodit>;
|
|
@@ -21,6 +21,11 @@ export declare const extendLang: (langs: IDictionary) => void;
|
|
|
21
21
|
* Create unique box(HTMLCotainer) and remove it after destroy
|
|
22
22
|
*/
|
|
23
23
|
export declare function getContainer<T extends HTMLTagNames = HTMLTagNames>(jodit: IViewBased | IViewComponent, classFunc?: Function | string, tag?: T, createInsideEditor?: boolean): HTMLElementTagNameMap[T];
|
|
24
|
+
/**
|
|
25
|
+
* Get root element for view
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function getPopupViewRoot(o: IViewOptions, container: HTMLElement, defaultRoot: HTMLElement): HTMLElement;
|
|
24
29
|
/**
|
|
25
30
|
* Global event emitter
|
|
26
31
|
*/
|
package/esm/core/global.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
+
import { css } from "./helpers/index.js";
|
|
6
7
|
import { isJoditObject } from "./helpers/checker/is-jodit-object.js";
|
|
7
8
|
import { isString } from "./helpers/checker/is-string.js";
|
|
8
9
|
import { isViewObject } from "./helpers/checker/is-view-object.js";
|
|
@@ -54,21 +55,10 @@ export function getContainer(jodit, classFunc, tag = 'div', createInsideEditor =
|
|
|
54
55
|
: 'jodit-utils';
|
|
55
56
|
const data = boxes.get(jodit) || {}, key = name + tag;
|
|
56
57
|
const view = isViewObject(jodit) ? jodit : jodit.j;
|
|
58
|
+
let body = null;
|
|
57
59
|
if (!data[key]) {
|
|
58
60
|
let c = view.c;
|
|
59
|
-
|
|
60
|
-
if (isJoditObject(jodit) && jodit.o.shadowRoot) {
|
|
61
|
-
body = jodit.o.shadowRoot;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
body = jodit.od.body;
|
|
65
|
-
if (isJoditObject(jodit)) {
|
|
66
|
-
const dialog = Dom.closest(jodit.container, 'dialog', jodit.od.body);
|
|
67
|
-
if (dialog) {
|
|
68
|
-
body = dialog;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
61
|
+
body = getPopupViewRoot(view.o, view.container, jodit.od.body);
|
|
72
62
|
if (createInsideEditor &&
|
|
73
63
|
isJoditObject(jodit) &&
|
|
74
64
|
jodit.od !== jodit.ed) {
|
|
@@ -100,6 +90,18 @@ export function getContainer(jodit, classFunc, tag = 'div', createInsideEditor =
|
|
|
100
90
|
data[key].classList.add(`jodit_theme_${view.o.theme || 'default'}`);
|
|
101
91
|
return data[key];
|
|
102
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Get root element for view
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
export function getPopupViewRoot(o, container, defaultRoot) {
|
|
98
|
+
return (o.popupRoot ??
|
|
99
|
+
o.shadowRoot ??
|
|
100
|
+
Dom.closest(container, parentElement => Dom.isHTMLElement(parentElement) &&
|
|
101
|
+
(Dom.isTag(parentElement, 'dialog') ||
|
|
102
|
+
['fixed', 'absolute'].includes(css(parentElement, 'position'))), defaultRoot) ??
|
|
103
|
+
defaultRoot);
|
|
104
|
+
}
|
|
103
105
|
/**
|
|
104
106
|
* Global event emitter
|
|
105
107
|
*/
|
|
@@ -15,14 +15,18 @@ import type { HTMLTagNames, IDictionary, Nullable } from "../../../types";
|
|
|
15
15
|
* ```javascript
|
|
16
16
|
* Jodit.modules.Helpers.$$('.someselector').forEach(function (elm) {
|
|
17
17
|
* elm.addEventListener('click', function () {
|
|
18
|
-
* alert('
|
|
18
|
+
* alert('Clicked');
|
|
19
19
|
* });
|
|
20
20
|
* })
|
|
21
21
|
* ```
|
|
22
22
|
* @param selector - CSS like selector
|
|
23
23
|
* @param root - where to search
|
|
24
|
+
* @deprecated Do not use it in new code
|
|
24
25
|
*/
|
|
25
26
|
export declare function $$<K extends HTMLTagNames>(selector: K, root: HTMLElement | DocumentFragment): Array<HTMLElementTagNameMap[K]>;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Do not use it in new code
|
|
29
|
+
*/
|
|
26
30
|
export declare function $$<T extends HTMLElement>(selector: string, root: HTMLElement | DocumentFragment): T[];
|
|
27
31
|
/**
|
|
28
32
|
* Calculate XPath selector
|
package/esm/core/traits/dlgs.js
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
+
import { getPopupViewRoot } from "../global.js";
|
|
6
7
|
import { isHTML, isString } from "../helpers/checker/index.js";
|
|
7
8
|
import { markOwner } from "../helpers/utils/utils.js";
|
|
8
9
|
import { Alert, Confirm, Dialog, Prompt } from "../../modules/dialog/index.js";
|
|
9
10
|
export class Dlgs {
|
|
10
11
|
dlg(options) {
|
|
12
|
+
const popupRoot = getPopupViewRoot(this.o, this.container, this.od.body);
|
|
11
13
|
const dialog = new Dialog({
|
|
12
14
|
language: this.o.language,
|
|
13
15
|
shadowRoot: this.o.shadowRoot,
|
|
16
|
+
popupRoot,
|
|
14
17
|
ownerWindow: this.o.ownerWindow,
|
|
15
18
|
defaultTimeout: this.o.defaultTimeout,
|
|
16
19
|
direction: this.o.direction,
|
package/esm/core/view/view.js
CHANGED
|
@@ -19,7 +19,7 @@ import { Component } from "../component/component.js";
|
|
|
19
19
|
import { STATUSES } from "../component/statuses.js";
|
|
20
20
|
import { APP_VERSION, BASE_PATH, ES, IS_ES_MODERN, IS_ES_NEXT } from "../constants.js";
|
|
21
21
|
import { Create } from "../create/create.js";
|
|
22
|
-
import { cache } from "../decorators/cache/cache.js";
|
|
22
|
+
import { cache, cached } from "../decorators/cache/cache.js";
|
|
23
23
|
import { derive } from "../decorators/derive/derive.js";
|
|
24
24
|
import { hook } from "../decorators/hook/hook.js";
|
|
25
25
|
import { Dom } from "../dom/index.js";
|
|
@@ -246,16 +246,14 @@ let View = View_1 = class View extends Component {
|
|
|
246
246
|
if (this.isDestructed) {
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
|
-
this
|
|
250
|
-
this
|
|
249
|
+
cached(this, 'progressbar')?.destruct();
|
|
250
|
+
cached(this, 'message')?.destruct();
|
|
251
251
|
if (this.events) {
|
|
252
252
|
this.events.destruct();
|
|
253
253
|
// @ts-ignore
|
|
254
254
|
this.events = undefined;
|
|
255
255
|
}
|
|
256
|
-
|
|
257
|
-
this.buffer.clear();
|
|
258
|
-
}
|
|
256
|
+
cached(this, 'buffer')?.clear();
|
|
259
257
|
Dom.safeRemove(this.container);
|
|
260
258
|
super.destruct();
|
|
261
259
|
}
|
package/esm/jodit.js
CHANGED
|
@@ -16,7 +16,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
16
16
|
var Jodit_1;
|
|
17
17
|
import * as constants from "./core/constants.js";
|
|
18
18
|
import { FAT_MODE, IS_PROD, lang } from "./core/constants.js";
|
|
19
|
-
import { autobind, cache, derive, throttle, watch } from "./core/decorators/index.js";
|
|
19
|
+
import { autobind, cache, cached, derive, throttle, watch } from "./core/decorators/index.js";
|
|
20
20
|
import { eventEmitter, instances, modules, pluginSystem } from "./core/global.js";
|
|
21
21
|
import { asArray, attr, callPromise, ConfigProto, css, error, isFunction, isJoditObject, isNumber, isPromise, isString, isVoid, kebabCase, markAsAtomic, normalizeKeyAliases, resolveElement, toArray, ucfirst } from "./core/helpers/index.js";
|
|
22
22
|
import { Ajax } from "./core/request/index.js";
|
|
@@ -1163,15 +1163,15 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
this.setStatus(STATUSES.beforeDestruct);
|
|
1165
1165
|
this.__elementToPlace.clear();
|
|
1166
|
-
this
|
|
1167
|
-
this
|
|
1166
|
+
cached(this, 'storage')?.clear();
|
|
1167
|
+
cached(this, 'buffer')?.clear();
|
|
1168
1168
|
this.commands.clear();
|
|
1169
1169
|
this.__selectionLocked = null;
|
|
1170
1170
|
this.e.off(this.ow, 'resize');
|
|
1171
1171
|
this.e.off(this.ow);
|
|
1172
1172
|
this.e.off(this.od);
|
|
1173
1173
|
this.e.off(this.od.body);
|
|
1174
|
-
const
|
|
1174
|
+
const tmpValue = this.editor ? this.getEditorValue() : '';
|
|
1175
1175
|
this.places.forEach(({ container, workplace, statusbar, element, iframe, editor, history }) => {
|
|
1176
1176
|
if (!element) {
|
|
1177
1177
|
return;
|
|
@@ -1215,7 +1215,7 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
|
|
|
1215
1215
|
Dom.safeRemove(iframe);
|
|
1216
1216
|
// inline mode
|
|
1217
1217
|
if (container === element) {
|
|
1218
|
-
element.innerHTML =
|
|
1218
|
+
element.innerHTML = tmpValue;
|
|
1219
1219
|
}
|
|
1220
1220
|
history.destruct();
|
|
1221
1221
|
});
|
|
@@ -35,17 +35,17 @@ export declare class Dialog extends ViewWithToolbar implements IDialog {
|
|
|
35
35
|
private lockSelect;
|
|
36
36
|
private unlockSelect;
|
|
37
37
|
private setElements;
|
|
38
|
-
private
|
|
38
|
+
private __onMouseUp;
|
|
39
39
|
/**
|
|
40
40
|
*
|
|
41
41
|
*/
|
|
42
|
-
private
|
|
43
|
-
private
|
|
44
|
-
private
|
|
45
|
-
private
|
|
46
|
-
private
|
|
47
|
-
private
|
|
48
|
-
private
|
|
42
|
+
private __onHeaderMouseDown;
|
|
43
|
+
private __onMouseMove;
|
|
44
|
+
private __onEsc;
|
|
45
|
+
private __onResize;
|
|
46
|
+
private __onResizerMouseDown;
|
|
47
|
+
private __addGlobalResizeListeners;
|
|
48
|
+
private __removeGlobalResizeListeners;
|
|
49
49
|
OPTIONS: IDialogOptions;
|
|
50
50
|
readonly dialog: HTMLElement;
|
|
51
51
|
workplace: HTMLDivElement;
|