jodit 4.1.16 → 4.2.6
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 +22 -5
- package/es2015/jodit.css +82 -31
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +1378 -546
- 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 +82 -31
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +1364 -546
- 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 +82 -31
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +1361 -546
- 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 +82 -31
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +1361 -546
- 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 +131 -35
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +1402 -482
- 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/config.d.ts +22 -0
- package/esm/config.js +22 -0
- package/esm/core/async/async.js +7 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/size/position.js +2 -2
- package/esm/core/helpers/utils/selector.d.ts +3 -1
- package/esm/core/helpers/utils/selector.js +3 -3
- package/esm/core/ui/button/tooltip/tooltip.js +2 -1
- package/esm/core/ui/popup/popup.js +1 -1
- package/esm/modules/dialog/dialog.js +1 -0
- package/esm/modules/file-browser/data-provider.js +4 -1
- package/esm/modules/file-browser/file-browser.js +9 -2
- package/esm/modules/image-editor/templates/form.js +6 -5
- package/esm/modules/toolbar/button/button.d.ts +1 -1
- package/esm/modules/widget/tabs/tabs.d.ts +4 -4
- package/esm/modules/widget/tabs/tabs.js +9 -7
- package/esm/plugins/ai-assistant/ai-assistant.d.ts +1 -1
- package/esm/plugins/ai-assistant/ai-assistant.js +3 -3
- package/esm/plugins/image-properties/config.d.ts +5 -83
- package/esm/plugins/image-properties/config.js +0 -3
- package/esm/plugins/image-properties/image-properties.d.ts +22 -32
- package/esm/plugins/image-properties/image-properties.js +133 -402
- package/{types/plugins/image-properties/templates/form.d.ts → esm/plugins/image-properties/readers/align.d.ts} +3 -5
- package/esm/plugins/image-properties/readers/align.js +24 -0
- package/esm/plugins/image-properties/readers/index.d.ts +12 -0
- package/esm/plugins/image-properties/readers/index.js +38 -0
- package/esm/plugins/image-properties/readers/link.d.ts +9 -0
- package/esm/plugins/image-properties/readers/link.js +19 -0
- package/esm/plugins/image-properties/readers/margin.d.ts +8 -0
- package/esm/plugins/image-properties/readers/margin.js +28 -0
- package/esm/plugins/image-properties/readers/size.d.ts +8 -0
- package/esm/plugins/image-properties/readers/size.js +36 -0
- package/esm/plugins/image-properties/ui/ui-image-form.d.ts +29 -0
- package/esm/plugins/image-properties/ui/ui-image-form.js +171 -0
- package/esm/plugins/image-properties/ui/ui-image-main-tab.d.ts +36 -0
- package/esm/plugins/image-properties/ui/ui-image-main-tab.js +179 -0
- package/esm/plugins/image-properties/ui/ui-image-position-tab.d.ts +36 -0
- package/esm/plugins/image-properties/ui/ui-image-position-tab.js +261 -0
- package/esm/plugins/image-properties/{templates/main-tab.d.ts → utils/open-image-editor.d.ts} +5 -3
- package/esm/plugins/image-properties/utils/open-image-editor.js +52 -0
- package/esm/plugins/image-properties/utils/open-image-popup.d.ts +9 -0
- package/esm/plugins/image-properties/utils/open-image-popup.js +34 -0
- package/esm/plugins/image-properties/utils/utils.d.ts +9 -0
- package/esm/plugins/image-properties/utils/utils.js +21 -0
- package/esm/plugins/image-properties/writers/index.d.ts +12 -0
- package/esm/plugins/image-properties/writers/index.js +53 -0
- package/esm/plugins/image-properties/{templates/form.d.ts → writers/link.d.ts} +2 -4
- package/esm/plugins/image-properties/writers/link.js +24 -0
- package/esm/plugins/image-properties/writers/margin.d.ts +8 -0
- package/esm/plugins/image-properties/writers/margin.js +33 -0
- package/esm/plugins/image-properties/writers/size.d.ts +7 -0
- package/esm/plugins/image-properties/writers/size.js +28 -0
- package/esm/plugins/select/config.d.ts +7 -0
- package/esm/plugins/select/config.js +2 -1
- package/esm/plugins/select/select.d.ts +7 -3
- package/esm/plugins/select/select.js +21 -4
- package/esm/types/ui.d.ts +1 -1
- package/package.json +1 -1
- package/types/config.d.ts +22 -0
- package/types/core/helpers/utils/selector.d.ts +3 -1
- package/types/modules/toolbar/button/button.d.ts +1 -1
- package/types/modules/widget/tabs/tabs.d.ts +4 -4
- package/types/plugins/ai-assistant/ai-assistant.d.ts +1 -1
- package/types/plugins/image-properties/config.d.ts +5 -83
- package/types/plugins/image-properties/image-properties.d.ts +22 -32
- package/types/plugins/image-properties/{templates/main-tab.d.ts → readers/align.d.ts} +3 -5
- package/types/plugins/image-properties/readers/index.d.ts +12 -0
- package/types/plugins/image-properties/readers/link.d.ts +9 -0
- package/types/plugins/image-properties/readers/margin.d.ts +8 -0
- package/types/plugins/image-properties/readers/size.d.ts +8 -0
- package/types/plugins/image-properties/ui/ui-image-form.d.ts +29 -0
- package/types/plugins/image-properties/ui/ui-image-main-tab.d.ts +36 -0
- package/types/plugins/image-properties/ui/ui-image-position-tab.d.ts +36 -0
- package/types/plugins/image-properties/utils/open-image-editor.d.ts +12 -0
- package/types/plugins/image-properties/utils/open-image-popup.d.ts +9 -0
- package/types/plugins/image-properties/utils/utils.d.ts +9 -0
- package/types/plugins/image-properties/writers/index.d.ts +12 -0
- package/{esm/plugins/image-properties/templates/position-tab.d.ts → types/plugins/image-properties/writers/link.d.ts} +2 -4
- package/types/plugins/image-properties/writers/margin.d.ts +8 -0
- package/types/plugins/image-properties/writers/size.d.ts +7 -0
- package/types/plugins/select/config.d.ts +7 -0
- package/types/plugins/select/select.d.ts +7 -3
- package/types/types/ui.d.ts +1 -1
- package/esm/plugins/image-properties/templates/form.js +0 -26
- package/esm/plugins/image-properties/templates/main-tab.js +0 -47
- package/esm/plugins/image-properties/templates/position-tab.js +0 -66
- package/types/plugins/image-properties/templates/position-tab.d.ts +0 -10
package/esm/config.d.ts
CHANGED
|
@@ -104,6 +104,28 @@ declare class Config implements IViewOptions {
|
|
|
104
104
|
ownerWindow: Window;
|
|
105
105
|
/**
|
|
106
106
|
* Shadow root if Jodit was created in it
|
|
107
|
+
*
|
|
108
|
+
* ```html
|
|
109
|
+
* <div id="editor"></div>
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* ```js
|
|
113
|
+
* const app = document.getElementById('editor');
|
|
114
|
+
* app.attachShadow({ mode: 'open' });
|
|
115
|
+
* const root = app.shadowRoot;
|
|
116
|
+
*
|
|
117
|
+
* root.innerHTML = `
|
|
118
|
+
* <link rel="stylesheet" href="./build/jodit.css"/>
|
|
119
|
+
* <h1>Jodit example in Shadow DOM</h1>
|
|
120
|
+
* <div id="edit"></div>
|
|
121
|
+
* `;
|
|
122
|
+
*
|
|
123
|
+
* const editor = Jodit.make(root.getElementById('edit'), {
|
|
124
|
+
* globalFullSize: false,
|
|
125
|
+
* shadowRoot: root
|
|
126
|
+
* });
|
|
127
|
+
* editor.value = '<p>start</p>';
|
|
128
|
+
* ```
|
|
107
129
|
*/
|
|
108
130
|
shadowRoot: Nullable<ShadowRoot>;
|
|
109
131
|
/**
|
package/esm/config.js
CHANGED
|
@@ -139,6 +139,28 @@ class Config {
|
|
|
139
139
|
: null);
|
|
140
140
|
/**
|
|
141
141
|
* Shadow root if Jodit was created in it
|
|
142
|
+
*
|
|
143
|
+
* ```html
|
|
144
|
+
* <div id="editor"></div>
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* ```js
|
|
148
|
+
* const app = document.getElementById('editor');
|
|
149
|
+
* app.attachShadow({ mode: 'open' });
|
|
150
|
+
* const root = app.shadowRoot;
|
|
151
|
+
*
|
|
152
|
+
* root.innerHTML = `
|
|
153
|
+
* <link rel="stylesheet" href="./build/jodit.css"/>
|
|
154
|
+
* <h1>Jodit example in Shadow DOM</h1>
|
|
155
|
+
* <div id="edit"></div>
|
|
156
|
+
* `;
|
|
157
|
+
*
|
|
158
|
+
* const editor = Jodit.make(root.getElementById('edit'), {
|
|
159
|
+
* globalFullSize: false,
|
|
160
|
+
* shadowRoot: root
|
|
161
|
+
* });
|
|
162
|
+
* editor.value = '<p>start</p>';
|
|
163
|
+
* ```
|
|
142
164
|
*/
|
|
143
165
|
this.shadowRoot = null;
|
|
144
166
|
/**
|
package/esm/core/async/async.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { IS_ES_NEXT } from "jodit/esm/core/constants.js";
|
|
7
7
|
import { clearTimeout, setTimeout } from "jodit/esm/core/helpers/async/index.js";
|
|
8
|
+
import { isAbortError } from "jodit/esm/core/helpers/checker/is-abort-error.js";
|
|
8
9
|
import { isFunction } from "jodit/esm/core/helpers/checker/is-function.js";
|
|
9
10
|
import { isNumber } from "jodit/esm/core/helpers/checker/is-number.js";
|
|
10
11
|
import { isPlainObject } from "jodit/esm/core/helpers/checker/is-plain-object.js";
|
|
@@ -132,6 +133,11 @@ export class Async {
|
|
|
132
133
|
? (...args) => {
|
|
133
134
|
const promise = this.promise(res => {
|
|
134
135
|
promises.push(res);
|
|
136
|
+
}).catch((e) => {
|
|
137
|
+
if (isAbortError(e)) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
throw e;
|
|
135
141
|
});
|
|
136
142
|
onFire(...args);
|
|
137
143
|
return promise;
|
|
@@ -203,7 +209,7 @@ export class Async {
|
|
|
203
209
|
promise(executor) {
|
|
204
210
|
let rejectCallback = () => { };
|
|
205
211
|
const promise = new Promise((resolve, reject) => {
|
|
206
|
-
rejectCallback = () => reject(abort());
|
|
212
|
+
rejectCallback = () => reject(abort('Abort async'));
|
|
207
213
|
this.promisesRejections.add(rejectCallback);
|
|
208
214
|
executor(resolve, reject);
|
|
209
215
|
});
|
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.
|
|
6
|
+
export const APP_VERSION = "4.2.6";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -21,7 +21,7 @@ export function position(elm, jodit, recurse = false) {
|
|
|
21
21
|
return {
|
|
22
22
|
left: Math.round(xPos),
|
|
23
23
|
top: Math.round(yPos),
|
|
24
|
-
width: Math.round(elm.offsetWidth),
|
|
25
|
-
height: Math.round(elm.offsetHeight)
|
|
24
|
+
width: Math.round(elm.offsetWidth ?? rect.width),
|
|
25
|
+
height: Math.round(elm.offsetHeight ?? rect.height)
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -31,7 +31,9 @@ export declare const getXPathByElement: (element: HTMLElement, root: HTMLElement
|
|
|
31
31
|
/**
|
|
32
32
|
* Find all `ref` or `data-ref` elements inside HTMLElement
|
|
33
33
|
*/
|
|
34
|
-
export declare const refs: <T extends HTMLElement>(root: HTMLElement
|
|
34
|
+
export declare const refs: <T extends HTMLElement>(root: HTMLElement | {
|
|
35
|
+
container: HTMLElement;
|
|
36
|
+
}) => IDictionary<T>;
|
|
35
37
|
/**
|
|
36
38
|
* Calculate full CSS selector
|
|
37
39
|
*/
|
|
@@ -59,9 +59,9 @@ export const getXPathByElement = (element, root) => {
|
|
|
59
59
|
* Find all `ref` or `data-ref` elements inside HTMLElement
|
|
60
60
|
*/
|
|
61
61
|
export const refs = (root) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
if ('container' in root) {
|
|
63
|
+
root = root.container;
|
|
64
|
+
}
|
|
65
65
|
return $$('[ref],[data-ref]', root).reduce((def, child) => {
|
|
66
66
|
const key = attr(child, '-ref');
|
|
67
67
|
if (key && isString(key)) {
|
|
@@ -39,7 +39,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
|
|
|
39
39
|
view.o.showTooltip &&
|
|
40
40
|
!view.o.useNativeTooltip) {
|
|
41
41
|
view.hookStatus(STATUSES.ready, () => {
|
|
42
|
-
// TODO Move it inside __open method. Now it is here
|
|
42
|
+
// TODO Move it inside __open method. Now it is here because testcase failed with capturing
|
|
43
43
|
getContainer(this.j, UITooltip_1).appendChild(this.container);
|
|
44
44
|
view.e.on(view.container, 'mouseenter.tooltip', this.__onMouseEnter, {
|
|
45
45
|
capture: true
|
|
@@ -55,6 +55,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
|
|
|
55
55
|
const view = this.j;
|
|
56
56
|
view.e
|
|
57
57
|
.on(view.ow, 'scroll.tooltip', this.__hide)
|
|
58
|
+
.on(view.ow, 'joditCloseDialog', this.__hide)
|
|
58
59
|
.on(view.container, 'mouseleave.tooltip', this.__hide)
|
|
59
60
|
.on([
|
|
60
61
|
'escape.tooltip',
|
|
@@ -15,7 +15,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
15
15
|
};
|
|
16
16
|
import { IS_PROD } from "jodit/esm/core/constants.js";
|
|
17
17
|
import { autobind } from "jodit/esm/core/decorators/index.js";
|
|
18
|
-
import { ConfigProto, error, isFunction, normalizeRelativePath, set } from "jodit/esm/core/helpers/index.js";
|
|
18
|
+
import { abort, ConfigProto, error, isFunction, normalizeRelativePath, set } from "jodit/esm/core/helpers/index.js";
|
|
19
19
|
import { Ajax } from "jodit/esm/core/request/index.js";
|
|
20
20
|
import { FileBrowserItem } from "jodit/esm/modules/file-browser/builders/item.js";
|
|
21
21
|
export const DEFAULT_SOURCE_NAME = 'default';
|
|
@@ -96,6 +96,9 @@ let DataProvider = class DataProvider {
|
|
|
96
96
|
this.o.permissions.data.source = source;
|
|
97
97
|
if (this.o.permissions.url) {
|
|
98
98
|
return this.get('permissions').then(resp => {
|
|
99
|
+
if (this.parent.isInDestruct) {
|
|
100
|
+
throw abort();
|
|
101
|
+
}
|
|
99
102
|
let process = this.o.permissions.process;
|
|
100
103
|
if (!process) {
|
|
101
104
|
process = this.o.ajax.process;
|
|
@@ -153,10 +153,17 @@ let FileBrowser = class FileBrowser extends ViewWithToolbar {
|
|
|
153
153
|
this.__updateToolbarButtons();
|
|
154
154
|
this._dialog.open(this.browser, header);
|
|
155
155
|
this.e.fire('sort.filebrowser', this.state.sortBy);
|
|
156
|
-
loadTree(this)
|
|
156
|
+
loadTree(this)
|
|
157
|
+
.then(resolve, reject)
|
|
158
|
+
.finally(() => {
|
|
159
|
+
if (this.isInDestruct) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this?.e?.fire('fileBrowserReady.filebrowser');
|
|
163
|
+
});
|
|
157
164
|
})
|
|
158
165
|
.catch((e) => {
|
|
159
|
-
if (!IS_PROD) {
|
|
166
|
+
if (!isAbortError(e) && !IS_PROD) {
|
|
160
167
|
throw e;
|
|
161
168
|
}
|
|
162
169
|
});
|
|
@@ -10,11 +10,12 @@ const act = (el, className = 'jodti-image-editor_active') => el ? className : ''
|
|
|
10
10
|
export const form = (editor, o) => {
|
|
11
11
|
const i = editor.i18n.bind(editor);
|
|
12
12
|
const switcher = (label, ref, active = true) => `<div class="jodit-form__group">
|
|
13
|
-
<label
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
<label class="jodit-switcher-wrapper">
|
|
14
|
+
<span class='jodit-switcher'>
|
|
15
|
+
<input ${act(active, 'checked')} data-ref="${ref}" type="checkbox"/>
|
|
16
|
+
<span class="jodit-switcher__slider"></span>
|
|
17
|
+
</span>
|
|
18
|
+
<span>${i(label)}</span>
|
|
18
19
|
</label>
|
|
19
20
|
</div>`;
|
|
20
21
|
return editor.create.fromHTML(`<form class="${jie} jodit-properties">
|
|
@@ -22,7 +22,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
|
|
|
22
22
|
hasTrigger: boolean;
|
|
23
23
|
size: "small" | "tiny" | "xsmall" | "middle" | "large";
|
|
24
24
|
name: string;
|
|
25
|
-
value: string | number | boolean;
|
|
25
|
+
value: string | number | boolean;
|
|
26
26
|
variant: import("jodit/esm/types").ButtonVariant;
|
|
27
27
|
type: "button" | "submit";
|
|
28
28
|
disabled: boolean;
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
* @module modules/widget/tabs
|
|
10
10
|
*/
|
|
11
|
-
import type {
|
|
11
|
+
import type { IViewBased } from "jodit/esm/types";
|
|
12
12
|
import { UIElement } from "jodit/esm/core/ui";
|
|
13
13
|
|
|
14
14
|
export interface TabOption {
|
|
15
15
|
icon?: string;
|
|
16
16
|
name: string;
|
|
17
|
-
content: HTMLElement | ((this:
|
|
17
|
+
content: HTMLElement | ((this: IViewBased) => void) | UIElement;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Build tabs system
|
|
@@ -44,6 +44,6 @@ export interface TabOption {
|
|
|
44
44
|
* ]);
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
|
-
export declare const TabsWidget: (jodit:
|
|
48
|
-
|
|
47
|
+
export declare const TabsWidget: (jodit: IViewBased, tabs: TabOption[], state?: {
|
|
48
|
+
activeTab: string;
|
|
49
49
|
}) => HTMLDivElement;
|
|
@@ -46,11 +46,13 @@ export const TabsWidget = (jodit, tabs, state) => {
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
buttonList.forEach(b => {
|
|
49
|
+
b.state.variant = 'initial';
|
|
49
50
|
b.state.activated = false;
|
|
50
51
|
});
|
|
51
52
|
$$('.jodit-tab', tabBox).forEach(a => {
|
|
52
53
|
a.classList.remove('jodit-tab_active');
|
|
53
54
|
});
|
|
55
|
+
nameToTab[tab].button.state.variant = 'outline';
|
|
54
56
|
nameToTab[tab].button.state.activated = true;
|
|
55
57
|
nameToTab[tab].tab.classList.add('jodit-tab_active');
|
|
56
58
|
};
|
|
@@ -79,7 +81,7 @@ export const TabsWidget = (jodit, tabs, state) => {
|
|
|
79
81
|
content.call(jodit);
|
|
80
82
|
}
|
|
81
83
|
if (state) {
|
|
82
|
-
state.
|
|
84
|
+
state.activeTab = name;
|
|
83
85
|
}
|
|
84
86
|
return false;
|
|
85
87
|
});
|
|
@@ -95,20 +97,20 @@ export const TabsWidget = (jodit, tabs, state) => {
|
|
|
95
97
|
$$('a', buttons).forEach(a => {
|
|
96
98
|
a.style.width = (100 / tabCount).toFixed(10) + '%';
|
|
97
99
|
});
|
|
98
|
-
const tab = !state || !state.
|
|
100
|
+
const tab = !state || !state.activeTab || !nameToTab[state.activeTab]
|
|
99
101
|
? firstTab
|
|
100
|
-
: state.
|
|
102
|
+
: state.activeTab;
|
|
101
103
|
setActive(tab);
|
|
102
104
|
if (state) {
|
|
103
|
-
let
|
|
104
|
-
Object.defineProperty(state, '
|
|
105
|
+
let activeTab = state.activeTab;
|
|
106
|
+
Object.defineProperty(state, 'activeTab', {
|
|
105
107
|
configurable: true,
|
|
106
108
|
enumerable: false,
|
|
107
109
|
get() {
|
|
108
|
-
return
|
|
110
|
+
return activeTab;
|
|
109
111
|
},
|
|
110
112
|
set(value) {
|
|
111
|
-
|
|
113
|
+
activeTab = value;
|
|
112
114
|
setActive(value);
|
|
113
115
|
}
|
|
114
116
|
});
|
|
@@ -21,7 +21,7 @@ export declare class aiAssistant extends Plugin {
|
|
|
21
21
|
private get __container();
|
|
22
22
|
constructor(jodit: IJodit);
|
|
23
23
|
/** @override */
|
|
24
|
-
afterInit(
|
|
24
|
+
afterInit(): void;
|
|
25
25
|
protected onGenerateAiAssistantForm(prompt: string): void;
|
|
26
26
|
protected onInvokeAiAssistant(prompt: string): void;
|
|
27
27
|
/** @override */
|
|
@@ -20,7 +20,7 @@ import { isAbortError } from "jodit/esm/core/helpers/checker/is-abort-error.js";
|
|
|
20
20
|
import { Plugin } from "jodit/esm/core/plugin/plugin.js";
|
|
21
21
|
import "./config";
|
|
22
22
|
import { UiAiAssistant } from "./ui/ui-ai-assistant";
|
|
23
|
-
import * as
|
|
23
|
+
import * as lang from "./langs";
|
|
24
24
|
/**
|
|
25
25
|
* The plugin inserts content generated by AI into the editor.
|
|
26
26
|
*/
|
|
@@ -64,10 +64,10 @@ export class aiAssistant extends Plugin {
|
|
|
64
64
|
group: 'insert'
|
|
65
65
|
}
|
|
66
66
|
];
|
|
67
|
-
extendLang(
|
|
67
|
+
extendLang(lang);
|
|
68
68
|
}
|
|
69
69
|
/** @override */
|
|
70
|
-
afterInit(
|
|
70
|
+
afterInit() { }
|
|
71
71
|
onGenerateAiAssistantForm(prompt) {
|
|
72
72
|
this.__dialog.open(this.__container, 'AI Assistant');
|
|
73
73
|
this.__container.setPrompt(prompt);
|
|
@@ -3,90 +3,12 @@
|
|
|
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
|
+
import type { ImagePropertiesOptions } from "./interface";
|
|
6
10
|
declare module 'jodit/config' {
|
|
7
11
|
interface Config {
|
|
8
|
-
image:
|
|
9
|
-
dialogWidth: number;
|
|
10
|
-
/**
|
|
11
|
-
* Open editing dialog after double click on image
|
|
12
|
-
*/
|
|
13
|
-
openOnDblClick: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Show edit 'src' input
|
|
16
|
-
*/
|
|
17
|
-
editSrc: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Show crop/resize btn
|
|
20
|
-
*/
|
|
21
|
-
useImageEditor: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Show edit 'title' input
|
|
24
|
-
*/
|
|
25
|
-
editTitle: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Show edit 'alt' input
|
|
28
|
-
*/
|
|
29
|
-
editAlt: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Show edit image link's options
|
|
32
|
-
*/
|
|
33
|
-
editLink: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Show edit image size's inputs
|
|
36
|
-
*/
|
|
37
|
-
editSize: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Show edit margin inputs
|
|
40
|
-
*/
|
|
41
|
-
editMargins: boolean;
|
|
42
|
-
editBorderRadius: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Show edit classNames input
|
|
45
|
-
*/
|
|
46
|
-
editClass: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Pre-define available classes to select from
|
|
49
|
-
*
|
|
50
|
-
* Classes can be provided as list of strings or as list of tuples
|
|
51
|
-
* `["classname", "human label"]`.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```javascript
|
|
55
|
-
* new Jodit('#editor', {
|
|
56
|
-
* image: {
|
|
57
|
-
* availableClasses: [
|
|
58
|
-
* "rte-image-width-50",
|
|
59
|
-
* ["rte-image-width-75", "75 % width"]
|
|
60
|
-
* ]
|
|
61
|
-
* }
|
|
62
|
-
* })
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
availableClasses: [
|
|
66
|
-
string,
|
|
67
|
-
string
|
|
68
|
-
][] | string[];
|
|
69
|
-
/**
|
|
70
|
-
* Show style edit input
|
|
71
|
-
*/
|
|
72
|
-
editStyle: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Show edit ID input
|
|
75
|
-
*/
|
|
76
|
-
editId: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Show Alignment selector
|
|
79
|
-
*/
|
|
80
|
-
editAlign: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Show preview image
|
|
83
|
-
*/
|
|
84
|
-
showPreview: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Select image after close dialog
|
|
87
|
-
*/
|
|
88
|
-
selectImageAfterClose: boolean;
|
|
89
|
-
};
|
|
12
|
+
image: ImagePropertiesOptions;
|
|
90
13
|
}
|
|
91
14
|
}
|
|
92
|
-
export {};
|
|
@@ -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 { Config } from "jodit/esm/config.js";
|
|
10
7
|
Config.prototype.image = {
|
|
11
8
|
dialogWidth: 600,
|
|
@@ -9,27 +9,34 @@
|
|
|
9
9
|
* @module plugins/image-properties
|
|
10
10
|
*/
|
|
11
11
|
import type { IJodit } from "jodit/esm/types";
|
|
12
|
-
import { Plugin } from "jodit/esm/
|
|
12
|
+
import { Plugin } from "jodit/esm/core/plugin/plugin";
|
|
13
13
|
import "./config";
|
|
14
|
-
|
|
14
|
+
import type { ImagePropertiesState } from "./interface";
|
|
15
|
+
/**
|
|
16
|
+
* Plug-in for image editing window
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```javascript
|
|
20
|
+
* const editor = Jodit.make('#editor', {
|
|
21
|
+
* image: {
|
|
22
|
+
* editSrc: false,
|
|
23
|
+
* editLink: false
|
|
24
|
+
* }
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
15
28
|
/**
|
|
16
29
|
* Show dialog with image's options
|
|
17
30
|
*/
|
|
18
31
|
export declare class imageProperties extends Plugin {
|
|
19
|
-
protected state:
|
|
20
|
-
image: HTMLImageElement;
|
|
21
|
-
ratio: number;
|
|
22
|
-
sizeIsLocked: boolean;
|
|
23
|
-
marginIsLocked: boolean;
|
|
24
|
-
};
|
|
32
|
+
protected state: ImagePropertiesState;
|
|
25
33
|
private activeTabState;
|
|
26
|
-
|
|
27
|
-
protected onChangeSizeIsLocked(): void;
|
|
28
|
-
private form;
|
|
34
|
+
private get form();
|
|
29
35
|
/**
|
|
30
36
|
* Dialog for form
|
|
31
37
|
*/
|
|
32
|
-
private dialog;
|
|
38
|
+
private get dialog();
|
|
39
|
+
private get __buttons();
|
|
33
40
|
/**
|
|
34
41
|
* Open dialog editing image properties
|
|
35
42
|
*
|
|
@@ -45,28 +52,11 @@ export declare class imageProperties extends Plugin {
|
|
|
45
52
|
* ```
|
|
46
53
|
*/
|
|
47
54
|
protected open(): void | false;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*/
|
|
51
|
-
private makeForm;
|
|
52
|
-
/**
|
|
53
|
-
* Set input values from image
|
|
54
|
-
*/
|
|
55
|
-
private updateValues;
|
|
56
|
-
/**
|
|
57
|
-
* Apply form's values to image
|
|
58
|
-
*/
|
|
59
|
-
private onApply;
|
|
60
|
-
/**
|
|
61
|
-
* Open image editor dialog
|
|
62
|
-
*/
|
|
63
|
-
private openImageEditor;
|
|
64
|
-
/**
|
|
65
|
-
* Open popup with filebrowser/uploader buttons for image
|
|
66
|
-
*/
|
|
67
|
-
private openImagePopup;
|
|
55
|
+
private __lock;
|
|
56
|
+
private __unlock;
|
|
68
57
|
/** @override **/
|
|
69
58
|
protected afterInit(editor: IJodit): void;
|
|
59
|
+
protected onStateValuesImageSrcChange(): Promise<void>;
|
|
70
60
|
/** @override */
|
|
71
61
|
protected beforeDestruct(editor: IJodit): void;
|
|
72
62
|
}
|