jodit 4.0.0-beta.88 → 4.0.0-beta.90
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 +28 -5
- package/README.md +4 -4
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +29 -12
- 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 +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +33 -12
- 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 +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +33 -12
- 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 +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +33 -12
- 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 +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +29 -11
- package/es5/jodit.min.css +2 -2
- 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/traits/dlgs.js +3 -3
- package/esm/modules/dialog/alert.js +3 -1
- package/esm/modules/dialog/confirm.js +3 -1
- package/esm/modules/dialog/dialog.d.ts +1 -0
- package/esm/modules/dialog/dialog.js +17 -3
- package/esm/modules/dialog/prompt.d.ts +1 -0
- package/esm/modules/dialog/prompt.js +4 -1
- package/esm/plugins/about/about.js +1 -1
- package/esm/types/dialog.d.ts +2 -0
- package/package.json +1 -1
- package/types/modules/dialog/dialog.d.ts +1 -0
- package/types/modules/dialog/prompt.d.ts +1 -0
- package/types/types/dialog.d.ts +2 -0
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-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.0.0-beta.
|
|
6
|
+
export const APP_VERSION = "4.0.0-beta.90";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
package/esm/core/traits/dlgs.js
CHANGED
|
@@ -24,18 +24,18 @@ export class Dlgs {
|
|
|
24
24
|
confirm(msg, title, callback) {
|
|
25
25
|
msg = processTitle(msg, this);
|
|
26
26
|
title = processTitle(title, this);
|
|
27
|
-
return Confirm.call(this.dlg(), msg, title, callback);
|
|
27
|
+
return Confirm.call(this.dlg({ closeOnClickOverlay: true }), msg, title, callback);
|
|
28
28
|
}
|
|
29
29
|
prompt(msg, title, callback, placeholder, defaultValue) {
|
|
30
30
|
msg = processTitle(msg, this);
|
|
31
31
|
title = processTitle(title, this);
|
|
32
32
|
placeholder = processTitle(placeholder, this);
|
|
33
|
-
return Prompt.call(this.dlg(), msg, title, callback, placeholder, defaultValue);
|
|
33
|
+
return Prompt.call(this.dlg({ closeOnClickOverlay: true }), msg, title, callback, placeholder, defaultValue);
|
|
34
34
|
}
|
|
35
35
|
alert(msg, title, callback, className) {
|
|
36
36
|
msg = processTitle(msg, this);
|
|
37
37
|
title = processTitle(title, this);
|
|
38
|
-
return Alert.call(this.dlg(), msg, title, callback, className);
|
|
38
|
+
return Alert.call(this.dlg({ closeOnClickOverlay: true }), msg, title, callback, className);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
function processTitle(title, self) {
|
|
@@ -27,7 +27,9 @@ export function Alert(msg, title, callback, className = 'jodit-dialog_alert') {
|
|
|
27
27
|
callback = title;
|
|
28
28
|
title = undefined;
|
|
29
29
|
}
|
|
30
|
-
const dialog = this instanceof Dialog
|
|
30
|
+
const dialog = this instanceof Dialog
|
|
31
|
+
? this
|
|
32
|
+
: new Dialog({ closeOnClickOverlay: true }), container = dialog.c.div(className), okButton = Button(dialog, 'ok', 'Ok');
|
|
31
33
|
asArray(msg).forEach(oneMessage => {
|
|
32
34
|
container.appendChild(Dom.isNode(oneMessage) ? oneMessage : dialog.c.fromHTML(oneMessage));
|
|
33
35
|
});
|
|
@@ -21,7 +21,9 @@ import { Button } from "jodit/esm/core/ui/button/button/button.js";
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export function Confirm(msg, title, callback) {
|
|
24
|
-
const dialog = this instanceof Dialog
|
|
24
|
+
const dialog = this instanceof Dialog
|
|
25
|
+
? this
|
|
26
|
+
: new Dialog({ closeOnClickOverlay: true }), $div = dialog.c.fromHTML('<form class="jodit-dialog_prompt"></form>'), $label = dialog.c.element('label');
|
|
25
27
|
if (isFunction(title)) {
|
|
26
28
|
callback = title;
|
|
27
29
|
title = undefined;
|
|
@@ -13,6 +13,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
13
13
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
14
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
15
|
};
|
|
16
|
+
var Dialog_1;
|
|
16
17
|
/**
|
|
17
18
|
* @module modules/dialog
|
|
18
19
|
*/
|
|
@@ -56,7 +57,7 @@ Config.prototype.controls.dialog = {
|
|
|
56
57
|
/**
|
|
57
58
|
* Module to generate dialog windows
|
|
58
59
|
*/
|
|
59
|
-
let Dialog = class Dialog extends ViewWithToolbar {
|
|
60
|
+
let Dialog = Dialog_1 = class Dialog extends ViewWithToolbar {
|
|
60
61
|
/** @override */
|
|
61
62
|
className() {
|
|
62
63
|
return 'Dialog';
|
|
@@ -155,6 +156,9 @@ let Dialog = class Dialog extends ViewWithToolbar {
|
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
onEsc(e) {
|
|
159
|
+
if (!this.o.closeOnEsc) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
158
162
|
if (this.isOpened &&
|
|
159
163
|
e.key === KEY_ESC &&
|
|
160
164
|
this.getMod('static') !== true) {
|
|
@@ -489,7 +493,7 @@ let Dialog = class Dialog extends ViewWithToolbar {
|
|
|
489
493
|
*/
|
|
490
494
|
this.isOpened = false;
|
|
491
495
|
const self = this;
|
|
492
|
-
self.options = ConfigProto(options, ConfigProto(Config.prototype.dialog,
|
|
496
|
+
self.options = ConfigProto(options, ConfigProto(Config.prototype.dialog, Dialog_1.defaultOptions));
|
|
493
497
|
Dom.safeRemove(self.container);
|
|
494
498
|
const n = this.getFullElName.bind(this);
|
|
495
499
|
self.container = this.c.fromHTML(`<div class="jodit jodit-dialog ${this.componentName}">
|
|
@@ -545,6 +549,11 @@ let Dialog = class Dialog extends ViewWithToolbar {
|
|
|
545
549
|
.on(self.container, 'close_dialog', self.close)
|
|
546
550
|
.on(this.ow, 'keydown', this.onEsc)
|
|
547
551
|
.on(this.ow, 'resize', this.onResize);
|
|
552
|
+
if (this.o.closeOnClickOverlay) {
|
|
553
|
+
const overlay = self.getElm('overlay');
|
|
554
|
+
assert(overlay != null, 'Overlay element does not exist');
|
|
555
|
+
this.e.on(overlay, 'click', self.close);
|
|
556
|
+
}
|
|
548
557
|
}
|
|
549
558
|
/**
|
|
550
559
|
* Build toolbar after ready
|
|
@@ -598,7 +607,12 @@ __decorate([
|
|
|
598
607
|
__decorate([
|
|
599
608
|
hook('ready')
|
|
600
609
|
], Dialog.prototype, "buildToolbar", null);
|
|
601
|
-
Dialog = __decorate([
|
|
610
|
+
Dialog = Dialog_1 = __decorate([
|
|
602
611
|
component
|
|
603
612
|
], Dialog);
|
|
604
613
|
export { Dialog };
|
|
614
|
+
Dialog.defaultOptions = {
|
|
615
|
+
...View.defaultOptions,
|
|
616
|
+
closeOnClickOverlay: false,
|
|
617
|
+
closeOnEsc: true
|
|
618
|
+
};
|
|
@@ -10,6 +10,7 @@ import type { IDialog } from "jodit/esm/types";
|
|
|
10
10
|
/**
|
|
11
11
|
* Show `Prompt` dialog. Work without Jodit object
|
|
12
12
|
*
|
|
13
|
+
* @param msg - Dialog content
|
|
13
14
|
* @param title - Title or callback
|
|
14
15
|
* @param callback - callback. The first argument is the value entered
|
|
15
16
|
* @param placeholder - Placeholder for input
|
|
@@ -10,6 +10,7 @@ import { Dialog } from "./dialog";
|
|
|
10
10
|
/**
|
|
11
11
|
* Show `Prompt` dialog. Work without Jodit object
|
|
12
12
|
*
|
|
13
|
+
* @param msg - Dialog content
|
|
13
14
|
* @param title - Title or callback
|
|
14
15
|
* @param callback - callback. The first argument is the value entered
|
|
15
16
|
* @param placeholder - Placeholder for input
|
|
@@ -25,7 +26,9 @@ import { Dialog } from "./dialog";
|
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
28
|
export function Prompt(msg, title, callback, placeholder, defaultValue) {
|
|
28
|
-
const dialog = this instanceof Dialog
|
|
29
|
+
const dialog = this instanceof Dialog
|
|
30
|
+
? this
|
|
31
|
+
: new Dialog({ closeOnClickOverlay: true }), cancelButton = Button(dialog, 'cancel', 'Cancel'), okButton = Button(dialog, 'ok', 'Ok'), form = dialog.c.element('form', {
|
|
29
32
|
class: 'jodit-dialog_prompt'
|
|
30
33
|
}), inputElement = dialog.c.element('input', {
|
|
31
34
|
autofocus: true,
|
|
@@ -17,7 +17,7 @@ import { HOMEPAGE } from "jodit/esm/core/constants.js";
|
|
|
17
17
|
import aboutIcon from "./about.svg";
|
|
18
18
|
Config.prototype.controls.about = {
|
|
19
19
|
exec: (editor) => {
|
|
20
|
-
const dialog = editor.dlg(), i = editor.i18n.bind(editor);
|
|
20
|
+
const dialog = editor.dlg({ closeOnClickOverlay: true }), i = editor.i18n.bind(editor);
|
|
21
21
|
dialog
|
|
22
22
|
.setMod('theme', editor.o.theme)
|
|
23
23
|
.setHeader(i('About Jodit'))
|
package/esm/types/dialog.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface IDialogOptions extends IViewOptions {
|
|
|
15
15
|
maxWidth?: string | number;
|
|
16
16
|
minWidth?: string | number;
|
|
17
17
|
minHeight?: string | number;
|
|
18
|
+
closeOnClickOverlay?: boolean;
|
|
19
|
+
closeOnEsc?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export type ContentItem = string | HTMLElement | IContainer;
|
|
20
22
|
export type Content = ContentItem | ContentItem[] | Array<ContentItem | ContentItem[]>;
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import type { IDialog } from "jodit/esm/types";
|
|
|
10
10
|
/**
|
|
11
11
|
* Show `Prompt` dialog. Work without Jodit object
|
|
12
12
|
*
|
|
13
|
+
* @param msg - Dialog content
|
|
13
14
|
* @param title - Title or callback
|
|
14
15
|
* @param callback - callback. The first argument is the value entered
|
|
15
16
|
* @param placeholder - Placeholder for input
|
package/types/types/dialog.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface IDialogOptions extends IViewOptions {
|
|
|
15
15
|
maxWidth?: string | number;
|
|
16
16
|
minWidth?: string | number;
|
|
17
17
|
minHeight?: string | number;
|
|
18
|
+
closeOnClickOverlay?: boolean;
|
|
19
|
+
closeOnEsc?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export type ContentItem = string | HTMLElement | IContainer;
|
|
20
22
|
export type Content = ContentItem | ContentItem[] | Array<ContentItem | ContentItem[]>;
|