jodit 4.0.0-beta.84 → 4.0.0-beta.85
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 +41 -0
- package/README.md +4 -4
- package/es2015/jodit.css +320 -41
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +2470 -2258
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +2 -2
- package/es2015/plugins/debug/debug.js +4 -4
- 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 +37 -36
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.css +320 -41
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +2469 -2255
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.js +4 -4
- 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 +37 -36
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +320 -41
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +2459 -2253
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +2 -2
- package/es2021/plugins/debug/debug.js +4 -4
- 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 +37 -36
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +320 -41
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +2459 -2253
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +2 -2
- package/es2021.en/plugins/debug/debug.js +4 -4
- 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 +37 -36
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +400 -103
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +2530 -2312
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.js +4 -4
- 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 +38 -36
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/esm/core/component/component.d.ts +2 -2
- package/esm/core/constants.js +2 -2
- package/esm/core/dom/dom.js +2 -2
- package/esm/core/helpers/checker/is-marker.d.ts +3 -0
- package/esm/core/helpers/normalize/normalize-size.d.ts +1 -1
- package/esm/core/helpers/normalize/normalize-size.js +2 -2
- package/esm/core/helpers/string/trim.d.ts +1 -0
- package/esm/core/helpers/string/trim.js +5 -0
- package/esm/core/helpers/utils/attr.d.ts +3 -0
- package/esm/core/helpers/utils/css.js +1 -0
- package/esm/core/plugin/interface.d.ts +3 -0
- package/esm/core/selection/style/api/has-same-style.d.ts +1 -1
- package/esm/core/selection/style/api/has-same-style.js +7 -4
- package/esm/core/selection/style/api/is-suit-element.d.ts +7 -2
- package/esm/core/selection/style/api/is-suit-element.js +21 -10
- package/esm/core/selection/style/transactions.d.ts +3 -0
- package/esm/core/selection/style/transactions.js +3 -3
- package/esm/core/storage/engines/local-storage-provider.d.ts +1 -1
- package/esm/core/storage/engines/memory-storage-provider.d.ts +1 -1
- package/esm/core/ui/button/tooltip/tooltip.d.ts +2 -2
- package/esm/core/ui/button/tooltip/tooltip.js +2 -2
- package/esm/core/ui/element.d.ts +1 -1
- package/esm/core/ui/form/block/block.d.ts +1 -1
- package/esm/core/ui/form/block/block.js +1 -1
- package/esm/core/ui/group/group.d.ts +0 -1
- package/esm/core/ui/group/group.js +0 -2
- package/esm/core/ui/group/list.d.ts +1 -0
- package/esm/core/ui/group/list.js +14 -2
- package/esm/core/ui/helpers/get-control-type.js +9 -2
- package/esm/core/ui/popup/popup.d.ts +12 -12
- package/esm/core/ui/popup/popup.js +46 -40
- package/esm/modules/file-browser/config.js +1 -1
- package/esm/modules/image-editor/config.d.ts +3 -0
- package/esm/modules/toolbar/button/button.d.ts +5 -5
- package/esm/modules/toolbar/button/button.js +25 -24
- package/esm/modules/toolbar/button/content.js +1 -1
- package/esm/modules/toolbar/button/index.d.ts +1 -0
- package/esm/modules/toolbar/button/index.js +1 -0
- package/esm/modules/toolbar/button/select/select.d.ts +15 -0
- package/esm/modules/toolbar/button/select/select.js +47 -0
- package/esm/modules/toolbar/collection/collection.d.ts +1 -0
- package/esm/modules/toolbar/collection/collection.js +4 -1
- package/esm/modules/toolbar/factory.d.ts +1 -0
- package/esm/modules/toolbar/factory.js +4 -0
- package/esm/plugins/bold/bold.js +1 -6
- package/esm/plugins/bold/interface.d.ts +3 -0
- package/esm/plugins/class-span/class-span.js +7 -7
- package/esm/plugins/color/config.js +2 -2
- package/esm/plugins/delete/interface.d.ts +3 -0
- package/esm/plugins/enter/interface.d.ts +3 -0
- package/esm/plugins/file/file.js +1 -1
- package/esm/plugins/font/config.js +63 -51
- package/esm/plugins/font/font.js +1 -1
- package/esm/plugins/format-block/config.d.ts +6 -0
- package/esm/plugins/format-block/config.js +52 -0
- package/esm/plugins/format-block/format-block.d.ts +1 -0
- package/esm/plugins/format-block/format-block.js +1 -68
- package/esm/plugins/fullsize/config.js +1 -1
- package/esm/plugins/iframe/iframe.js +11 -9
- package/esm/plugins/image/image.js +1 -1
- package/esm/plugins/image-processor/config.js +3 -0
- package/esm/plugins/inline-popup/config/items/cells.js +1 -1
- package/esm/plugins/justify/justify.js +8 -7
- package/esm/plugins/link/config.js +1 -1
- package/esm/plugins/mobile/config.js +3 -3
- package/esm/plugins/search/interface.d.ts +3 -0
- package/esm/plugins/select-cells/select-cells.d.ts +2 -0
- package/esm/plugins/symbols/config.js +1 -1
- package/esm/plugins/table/config.js +2 -1
- package/esm/plugins/video/config.js +1 -1
- package/esm/types/messages.d.ts +8 -0
- package/esm/types/popup.d.ts +3 -3
- package/esm/types/toolbar.d.ts +12 -8
- package/esm/typings.d.ts +0 -1
- package/package.json +1 -1
- package/types/core/component/component.d.ts +2 -2
- package/types/core/helpers/checker/is-marker.d.ts +3 -0
- package/types/core/helpers/normalize/normalize-size.d.ts +1 -1
- package/types/core/helpers/string/trim.d.ts +1 -0
- package/types/core/helpers/utils/attr.d.ts +3 -0
- package/types/core/plugin/interface.d.ts +3 -0
- package/types/core/selection/style/api/has-same-style.d.ts +1 -1
- package/types/core/selection/style/api/is-suit-element.d.ts +7 -2
- package/types/core/selection/style/transactions.d.ts +3 -0
- package/types/core/storage/engines/local-storage-provider.d.ts +1 -1
- package/types/core/storage/engines/memory-storage-provider.d.ts +1 -1
- package/types/core/ui/button/tooltip/tooltip.d.ts +2 -2
- package/types/core/ui/element.d.ts +1 -1
- package/types/core/ui/form/block/block.d.ts +1 -1
- package/types/core/ui/group/group.d.ts +0 -1
- package/types/core/ui/group/list.d.ts +1 -0
- package/types/core/ui/popup/popup.d.ts +12 -12
- package/types/modules/image-editor/config.d.ts +3 -0
- package/types/modules/toolbar/button/button.d.ts +5 -5
- package/types/modules/toolbar/button/index.d.ts +1 -0
- package/types/modules/toolbar/button/select/select.d.ts +15 -0
- package/types/modules/toolbar/collection/collection.d.ts +1 -0
- package/types/modules/toolbar/factory.d.ts +1 -0
- package/types/plugins/bold/interface.d.ts +3 -0
- package/types/plugins/delete/interface.d.ts +3 -0
- package/types/plugins/enter/interface.d.ts +3 -0
- package/types/plugins/format-block/config.d.ts +6 -0
- package/types/plugins/format-block/format-block.d.ts +1 -0
- package/types/plugins/search/interface.d.ts +3 -0
- package/types/plugins/select-cells/select-cells.d.ts +2 -0
- package/types/types/messages.d.ts +8 -0
- package/types/types/popup.d.ts +3 -3
- package/types/types/toolbar.d.ts +12 -8
- package/types/typings.d.ts +0 -1
|
@@ -99,7 +99,14 @@ export let UIList = class UIList extends UIGroup {
|
|
|
99
99
|
}
|
|
100
100
|
default:
|
|
101
101
|
lastBtnSeparator = false;
|
|
102
|
-
|
|
102
|
+
switch (control.component) {
|
|
103
|
+
case 'select':
|
|
104
|
+
elm = this.makeSelect(control, target);
|
|
105
|
+
break;
|
|
106
|
+
case 'button':
|
|
107
|
+
default:
|
|
108
|
+
elm = this.makeButton(control, target);
|
|
109
|
+
}
|
|
103
110
|
}
|
|
104
111
|
if (elm) {
|
|
105
112
|
if (!group) {
|
|
@@ -134,11 +141,16 @@ export let UIList = class UIList extends UIGroup {
|
|
|
134
141
|
this.update();
|
|
135
142
|
return this;
|
|
136
143
|
}
|
|
144
|
+
makeSelect(control, target) {
|
|
145
|
+
throw new Error('Not implemented behaviour');
|
|
146
|
+
}
|
|
137
147
|
/**
|
|
138
148
|
* Create button instance
|
|
139
149
|
*/
|
|
140
150
|
makeButton(control, target) {
|
|
141
|
-
return new UIButton(this.j
|
|
151
|
+
return new UIButton(this.j, {
|
|
152
|
+
name: control.name
|
|
153
|
+
});
|
|
142
154
|
}
|
|
143
155
|
};
|
|
144
156
|
__decorate([
|
|
@@ -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
|
-
import { ConfigFlatten, isString } from "jodit/esm/core/helpers/index.js";
|
|
6
|
+
import { ConfigFlatten, isArray, isString } from "jodit/esm/core/helpers/index.js";
|
|
7
7
|
import { Config } from "jodit/esm/config.js";
|
|
8
8
|
/**
|
|
9
9
|
* Get control for button name
|
|
@@ -47,10 +47,17 @@ export function findControlType(path, controls) {
|
|
|
47
47
|
else {
|
|
48
48
|
key = namespaceOrKey;
|
|
49
49
|
}
|
|
50
|
+
const list = store[key]?.list;
|
|
50
51
|
return store[key]
|
|
51
52
|
? {
|
|
52
53
|
name: key,
|
|
53
|
-
...ConfigFlatten(store[key])
|
|
54
|
+
...ConfigFlatten(store[key]),
|
|
55
|
+
list: isArray(list)
|
|
56
|
+
? list.reduce((acc, k) => {
|
|
57
|
+
acc[k] = k;
|
|
58
|
+
return acc;
|
|
59
|
+
}, {})
|
|
60
|
+
: list
|
|
54
61
|
}
|
|
55
62
|
: undefined;
|
|
56
63
|
}
|
|
@@ -10,18 +10,17 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { IBound, IPopup, IUIElement, IViewBased, PopupStrategy } from "jodit/esm/types";
|
|
13
|
-
import {
|
|
13
|
+
import { UIGroup } from "jodit/esm/core/ui/group/group";
|
|
14
14
|
type getBoundFunc = () => IBound;
|
|
15
|
-
export declare class Popup extends
|
|
15
|
+
export declare class Popup extends UIGroup implements IPopup {
|
|
16
16
|
readonly smart: boolean;
|
|
17
|
-
/** @override */
|
|
18
17
|
className(): string;
|
|
19
18
|
isOpened: boolean;
|
|
20
19
|
strategy: PopupStrategy;
|
|
20
|
+
protected appendChildToContainer(childContainer: HTMLElement): void;
|
|
21
21
|
viewBound: () => IBound;
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
/** @override */
|
|
22
|
+
private __targetBound;
|
|
23
|
+
private __childrenPopups;
|
|
25
24
|
updateParentElement(target: IUIElement): this;
|
|
26
25
|
/**
|
|
27
26
|
* Set popup content
|
|
@@ -31,7 +30,7 @@ export declare class Popup extends UIElement implements IPopup {
|
|
|
31
30
|
* Open popup near with some bound
|
|
32
31
|
*/
|
|
33
32
|
open(getBound: getBoundFunc, keepPosition?: boolean, parentContainer?: HTMLElement): this;
|
|
34
|
-
private
|
|
33
|
+
private __calculateZIndex;
|
|
35
34
|
/**
|
|
36
35
|
* Calculate static bound for point
|
|
37
36
|
*/
|
|
@@ -40,11 +39,11 @@ export declare class Popup extends UIElement implements IPopup {
|
|
|
40
39
|
* Update container position
|
|
41
40
|
*/
|
|
42
41
|
updatePosition(): this;
|
|
43
|
-
|
|
42
|
+
private __throttleUpdatePosition;
|
|
44
43
|
/**
|
|
45
44
|
* Calculate start point
|
|
46
45
|
*/
|
|
47
|
-
private
|
|
46
|
+
private __calculatePosition;
|
|
48
47
|
/**
|
|
49
48
|
* Check if one box is inside second
|
|
50
49
|
*/
|
|
@@ -56,15 +55,16 @@ export declare class Popup extends UIElement implements IPopup {
|
|
|
56
55
|
/**
|
|
57
56
|
* Close popup if click was in outside
|
|
58
57
|
*/
|
|
59
|
-
private
|
|
58
|
+
private __closeOnOutsideClick;
|
|
60
59
|
isOwnClick(e: MouseEvent): boolean;
|
|
61
|
-
private
|
|
62
|
-
private
|
|
60
|
+
private __addGlobalListeners;
|
|
61
|
+
private __removeGlobalListeners;
|
|
63
62
|
/**
|
|
64
63
|
* Set ZIndex
|
|
65
64
|
*/
|
|
66
65
|
setZIndex(index: number | string): void;
|
|
67
66
|
constructor(jodit: IViewBased, smart?: boolean);
|
|
67
|
+
render(): string;
|
|
68
68
|
/** @override **/
|
|
69
69
|
destruct(): any;
|
|
70
70
|
}
|
|
@@ -21,6 +21,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
21
21
|
import { Dom } from "jodit/esm/core/dom/dom.js";
|
|
22
22
|
import { attr, css, isString, kebabCase, markOwner, position, ucfirst } from "jodit/esm/core/helpers/index.js";
|
|
23
23
|
import { assert } from "jodit/esm/core/helpers/utils/assert.js";
|
|
24
|
+
import { UIGroup } from "jodit/esm/core/ui/group/group.js";
|
|
24
25
|
import { UIElement } from "jodit/esm/core/ui/element.js";
|
|
25
26
|
import { autobind, throttle } from "jodit/esm/core/decorators/index.js";
|
|
26
27
|
import { Component } from "jodit/esm/core/component/component.js";
|
|
@@ -32,25 +33,28 @@ const EVENTS_FOR_AUTOCLOSE = [
|
|
|
32
33
|
'backSpaceAfterDelete',
|
|
33
34
|
'beforeCommandDelete'
|
|
34
35
|
];
|
|
35
|
-
export class Popup extends
|
|
36
|
-
/** @override */
|
|
36
|
+
export class Popup extends UIGroup {
|
|
37
37
|
className() {
|
|
38
38
|
return 'Popup';
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
appendChildToContainer(childContainer) {
|
|
41
|
+
const content = this.getElm('content');
|
|
42
|
+
assert(content, 'Content element should exist');
|
|
43
|
+
content.appendChild(childContainer);
|
|
44
|
+
}
|
|
41
45
|
updateParentElement(target) {
|
|
42
46
|
if (target !== this && Component.isInstanceOf(target, Popup)) {
|
|
43
|
-
this.
|
|
47
|
+
this.__childrenPopups.forEach(popup => {
|
|
44
48
|
if (!target.closest(popup) && popup.isOpened) {
|
|
45
49
|
popup.close();
|
|
46
50
|
}
|
|
47
51
|
});
|
|
48
|
-
if (!this.
|
|
52
|
+
if (!this.__childrenPopups.has(target)) {
|
|
49
53
|
this.j.e.on(target, 'beforeClose', () => {
|
|
50
|
-
this.
|
|
54
|
+
this.__childrenPopups.delete(target);
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
|
-
this.
|
|
57
|
+
this.__childrenPopups.add(target);
|
|
54
58
|
}
|
|
55
59
|
return super.updateParentElement(target);
|
|
56
60
|
}
|
|
@@ -58,21 +62,18 @@ export class Popup extends UIElement {
|
|
|
58
62
|
* Set popup content
|
|
59
63
|
*/
|
|
60
64
|
setContent(content) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
let elm;
|
|
64
|
-
if (Component.isInstanceOf(content, UIElement)) {
|
|
65
|
-
elm = content.container;
|
|
66
|
-
content.parentElement = this;
|
|
65
|
+
if (this.allChildren.length) {
|
|
66
|
+
throw new Error('Remove children');
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
if (Component.isInstanceOf(content, UIElement)) {
|
|
69
|
+
this.append(content);
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
72
|
-
elm = content
|
|
72
|
+
const elm = isString(content)
|
|
73
|
+
? this.j.c.fromHTML(content)
|
|
74
|
+
: content;
|
|
75
|
+
this.appendChildToContainer(elm);
|
|
73
76
|
}
|
|
74
|
-
box.appendChild(elm);
|
|
75
|
-
this.container.appendChild(box);
|
|
76
77
|
this.updatePosition();
|
|
77
78
|
return this;
|
|
78
79
|
}
|
|
@@ -81,10 +82,10 @@ export class Popup extends UIElement {
|
|
|
81
82
|
*/
|
|
82
83
|
open(getBound, keepPosition = false, parentContainer) {
|
|
83
84
|
markOwner(this.jodit, this.container);
|
|
84
|
-
this.
|
|
85
|
+
this.__calculateZIndex();
|
|
85
86
|
this.isOpened = true;
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
87
|
+
this.__addGlobalListeners();
|
|
88
|
+
this.__targetBound = !keepPosition
|
|
88
89
|
? getBound
|
|
89
90
|
: this.getKeepBound(getBound);
|
|
90
91
|
if (parentContainer) {
|
|
@@ -101,7 +102,7 @@ export class Popup extends UIElement {
|
|
|
101
102
|
this.j.e.fire('afterOpenPopup', this);
|
|
102
103
|
return this;
|
|
103
104
|
}
|
|
104
|
-
|
|
105
|
+
__calculateZIndex() {
|
|
105
106
|
if (this.container.style.zIndex) {
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
@@ -166,22 +167,22 @@ export class Popup extends UIElement {
|
|
|
166
167
|
if (!this.isOpened) {
|
|
167
168
|
return this;
|
|
168
169
|
}
|
|
169
|
-
const [pos, strategy] = this.
|
|
170
|
+
const [pos, strategy] = this.__calculatePosition(this.__targetBound(), this.viewBound(), position(this.container, this.j));
|
|
170
171
|
this.setMod('strategy', strategy);
|
|
171
172
|
css(this.container, {
|
|
172
173
|
left: pos.left,
|
|
173
174
|
top: pos.top
|
|
174
175
|
});
|
|
175
|
-
this.
|
|
176
|
+
this.__childrenPopups.forEach(popup => popup.updatePosition());
|
|
176
177
|
return this;
|
|
177
178
|
}
|
|
178
|
-
|
|
179
|
+
__throttleUpdatePosition() {
|
|
179
180
|
this.updatePosition();
|
|
180
181
|
}
|
|
181
182
|
/**
|
|
182
183
|
* Calculate start point
|
|
183
184
|
*/
|
|
184
|
-
|
|
185
|
+
__calculatePosition(target, view, container, defaultStrategy = this.strategy) {
|
|
185
186
|
const x = {
|
|
186
187
|
left: target.left,
|
|
187
188
|
right: target.left - (container.width - target.width)
|
|
@@ -242,17 +243,17 @@ export class Popup extends UIElement {
|
|
|
242
243
|
return this;
|
|
243
244
|
}
|
|
244
245
|
this.isOpened = false;
|
|
245
|
-
this.
|
|
246
|
+
this.__childrenPopups.forEach(popup => popup.close());
|
|
246
247
|
this.j.e.fire(this, 'beforeClose');
|
|
247
248
|
this.j.e.fire('beforePopupClose', this);
|
|
248
|
-
this.
|
|
249
|
+
this.__removeGlobalListeners();
|
|
249
250
|
Dom.safeRemove(this.container);
|
|
250
251
|
return this;
|
|
251
252
|
}
|
|
252
253
|
/**
|
|
253
254
|
* Close popup if click was in outside
|
|
254
255
|
*/
|
|
255
|
-
|
|
256
|
+
__closeOnOutsideClick(e) {
|
|
256
257
|
if (!this.isOpened || this.isOwnClick(e)) {
|
|
257
258
|
return;
|
|
258
259
|
}
|
|
@@ -265,14 +266,14 @@ export class Popup extends UIElement {
|
|
|
265
266
|
const box = UIElement.closestElement(e.target, Popup);
|
|
266
267
|
return Boolean(box && (this === box || box.closest(this)));
|
|
267
268
|
}
|
|
268
|
-
|
|
269
|
-
const up = this.
|
|
269
|
+
__addGlobalListeners() {
|
|
270
|
+
const up = this.__throttleUpdatePosition, ow = this.ow;
|
|
270
271
|
eventEmitter.on('closeAllPopups', this.close);
|
|
271
272
|
if (this.smart) {
|
|
272
273
|
this.j.e
|
|
273
274
|
.on(EVENTS_FOR_AUTOCLOSE, this.close)
|
|
274
|
-
.on('mousedown touchstart', this.
|
|
275
|
-
.on(ow, 'mousedown touchstart', this.
|
|
275
|
+
.on('mousedown touchstart', this.__closeOnOutsideClick)
|
|
276
|
+
.on(ow, 'mousedown touchstart', this.__closeOnOutsideClick);
|
|
276
277
|
}
|
|
277
278
|
this.j.e
|
|
278
279
|
.on('closeAllPopups', this.close)
|
|
@@ -284,14 +285,14 @@ export class Popup extends UIElement {
|
|
|
284
285
|
box && this.j.e.on(box, 'scroll mousewheel', up);
|
|
285
286
|
});
|
|
286
287
|
}
|
|
287
|
-
|
|
288
|
-
const up = this.
|
|
288
|
+
__removeGlobalListeners() {
|
|
289
|
+
const up = this.__throttleUpdatePosition, ow = this.ow;
|
|
289
290
|
eventEmitter.off('closeAllPopups', this.close);
|
|
290
291
|
if (this.smart) {
|
|
291
292
|
this.j.e
|
|
292
293
|
.off(EVENTS_FOR_AUTOCLOSE, this.close)
|
|
293
|
-
.off('mousedown touchstart', this.
|
|
294
|
-
.off(ow, 'mousedown touchstart', this.
|
|
294
|
+
.off('mousedown touchstart', this.__closeOnOutsideClick)
|
|
295
|
+
.off(ow, 'mousedown touchstart', this.__closeOnOutsideClick);
|
|
295
296
|
}
|
|
296
297
|
this.j.e
|
|
297
298
|
.off('closeAllPopups', this.close)
|
|
@@ -321,9 +322,14 @@ export class Popup extends UIElement {
|
|
|
321
322
|
width: this.ow.innerWidth,
|
|
322
323
|
height: this.ow.innerHeight
|
|
323
324
|
});
|
|
324
|
-
this.
|
|
325
|
+
this.__childrenPopups = new Set();
|
|
325
326
|
attr(this.container, 'role', 'popup');
|
|
326
327
|
}
|
|
328
|
+
render() {
|
|
329
|
+
return `<div>
|
|
330
|
+
<div class="&__content"></div>
|
|
331
|
+
</div>`;
|
|
332
|
+
}
|
|
327
333
|
/** @override **/
|
|
328
334
|
destruct() {
|
|
329
335
|
this.close();
|
|
@@ -336,10 +342,10 @@ __decorate([
|
|
|
336
342
|
__decorate([
|
|
337
343
|
throttle(10),
|
|
338
344
|
autobind
|
|
339
|
-
], Popup.prototype, "
|
|
345
|
+
], Popup.prototype, "__throttleUpdatePosition", null);
|
|
340
346
|
__decorate([
|
|
341
347
|
autobind
|
|
342
348
|
], Popup.prototype, "close", null);
|
|
343
349
|
__decorate([
|
|
344
350
|
autobind
|
|
345
|
-
], Popup.prototype, "
|
|
351
|
+
], Popup.prototype, "__closeOnOutsideClick", null);
|
|
@@ -283,7 +283,7 @@ Config.prototype.controls.filebrowser = {
|
|
|
283
283
|
},
|
|
284
284
|
filter: {
|
|
285
285
|
isInput: true,
|
|
286
|
-
getContent: (filebrowser,
|
|
286
|
+
getContent: (filebrowser, b) => {
|
|
287
287
|
const oldInput = b.container.querySelector('.jodit-input');
|
|
288
288
|
if (oldInput) {
|
|
289
289
|
return oldInput;
|
|
@@ -3,6 +3,9 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* @module modules/image-editor
|
|
8
|
+
*/
|
|
6
9
|
import type { ImageEditorOptions } from "jodit/esm/types";
|
|
7
10
|
declare module 'jodit/config' {
|
|
8
11
|
interface Config {
|
|
@@ -42,11 +42,11 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
|
|
|
42
42
|
/**
|
|
43
43
|
* Calculates whether the button is active
|
|
44
44
|
*/
|
|
45
|
-
private
|
|
45
|
+
private __calculateActivatedStatus;
|
|
46
46
|
/**
|
|
47
47
|
* Calculates whether an element is blocked for the user
|
|
48
48
|
*/
|
|
49
|
-
private
|
|
49
|
+
private __calculateDisabledStatus;
|
|
50
50
|
/** @override */
|
|
51
51
|
protected onChangeActivated(): void;
|
|
52
52
|
/** @override */
|
|
@@ -63,7 +63,7 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
|
|
|
63
63
|
/**
|
|
64
64
|
* Init constant data from control
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
protected __initFromControl(): void;
|
|
67
67
|
/**
|
|
68
68
|
* Click on trigger button
|
|
69
69
|
*/
|
|
@@ -72,10 +72,10 @@ export declare class ToolbarButton<T extends IViewBased = IViewBased> extends UI
|
|
|
72
72
|
/**
|
|
73
73
|
* Create and open popup list
|
|
74
74
|
*/
|
|
75
|
-
private
|
|
75
|
+
private __openControlList;
|
|
76
76
|
protected onOutsideClick(e: MouseEvent): void;
|
|
77
77
|
private openPopup;
|
|
78
|
-
private
|
|
78
|
+
private __closePopup;
|
|
79
79
|
/**
|
|
80
80
|
* Click handler
|
|
81
81
|
*/
|
|
@@ -41,25 +41,26 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
41
41
|
}
|
|
42
42
|
/** @override **/
|
|
43
43
|
update() {
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
window.__onupdate = (window.__onupdate ?? 0) + 1;
|
|
46
44
|
const { control, state } = this, tc = this.closest(ToolbarCollection);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
if (!tc) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const value = control.value?.(tc.jodit, this);
|
|
49
|
+
if (value !== undefined) {
|
|
50
|
+
state.value = value;
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
state.disabled = this.__calculateDisabledStatus(tc);
|
|
53
|
+
state.activated = this.__calculateActivatedStatus(tc);
|
|
54
|
+
control.update?.(tc.jodit, this);
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Calculates whether the button is active
|
|
56
58
|
*/
|
|
57
|
-
|
|
59
|
+
__calculateActivatedStatus(tc) {
|
|
58
60
|
if (isJoditObject(this.j) && !this.j.editorIsActive) {
|
|
59
61
|
return false;
|
|
60
62
|
}
|
|
61
|
-
if (
|
|
62
|
-
this.control.isActive(this.j, this.control, this)) {
|
|
63
|
+
if (this.control.isActive?.(this.j, this)) {
|
|
63
64
|
return true;
|
|
64
65
|
}
|
|
65
66
|
return Boolean(tc && tc.shouldBeActive(this));
|
|
@@ -67,7 +68,7 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
67
68
|
/**
|
|
68
69
|
* Calculates whether an element is blocked for the user
|
|
69
70
|
*/
|
|
70
|
-
|
|
71
|
+
__calculateDisabledStatus(tc) {
|
|
71
72
|
if (this.j.o.disabled) {
|
|
72
73
|
return true;
|
|
73
74
|
}
|
|
@@ -76,8 +77,7 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
76
77
|
!this.j.o.activeButtonsInReadOnly.includes(this.control.name))) {
|
|
77
78
|
return true;
|
|
78
79
|
}
|
|
79
|
-
if (
|
|
80
|
-
this.control.isDisabled(this.j, this.control, this)) {
|
|
80
|
+
if (this.control.isDisabled?.(this.j, this)) {
|
|
81
81
|
return true;
|
|
82
82
|
}
|
|
83
83
|
return Boolean(tc && tc.shouldBeDisabled(this));
|
|
@@ -212,7 +212,7 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
212
212
|
*/
|
|
213
213
|
onTriggerClick(e) {
|
|
214
214
|
if (this.openedPopup) {
|
|
215
|
-
this.
|
|
215
|
+
this.__closePopup();
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
218
|
const { control: ctr } = this;
|
|
@@ -220,14 +220,14 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
220
220
|
actionTrigger: this
|
|
221
221
|
};
|
|
222
222
|
if (ctr.list) {
|
|
223
|
-
return this.
|
|
223
|
+
return this.__openControlList(ctr);
|
|
224
224
|
}
|
|
225
225
|
if (isFunction(ctr.popup)) {
|
|
226
226
|
const popup = this.openPopup();
|
|
227
227
|
popup.parentElement = this;
|
|
228
228
|
if (this.j.e.fire(camelCase(`before-${ctr.name}-open-popup`), this.target, ctr, popup) !== false) {
|
|
229
229
|
const target = this.toolbar?.getTarget(this) ?? this.target ?? null;
|
|
230
|
-
const elm = ctr.popup(this.j, target,
|
|
230
|
+
const elm = ctr.popup(this.j, target, this.__closePopup, this);
|
|
231
231
|
if (elm) {
|
|
232
232
|
popup
|
|
233
233
|
.setContent(isString(elm) ? this.j.c.fromHTML(elm) : elm)
|
|
@@ -248,7 +248,7 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
248
248
|
/**
|
|
249
249
|
* Create and open popup list
|
|
250
250
|
*/
|
|
251
|
-
|
|
251
|
+
__openControlList(control) {
|
|
252
252
|
const controls = this.jodit.options.controls ?? {}, getControl = (key) => findControlType(key, controls);
|
|
253
253
|
const list = control.list, menu = this.openPopup(), toolbar = makeCollection(this.j);
|
|
254
254
|
menu.parentElement = this;
|
|
@@ -287,6 +287,7 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
287
287
|
data: control.data,
|
|
288
288
|
command: control.command,
|
|
289
289
|
isActive: control.isChildActive,
|
|
290
|
+
value: control.value,
|
|
290
291
|
isDisabled: control.isChildDisabled,
|
|
291
292
|
mode: control.mode,
|
|
292
293
|
args: [...(control.args ? control.args : []), key, value]
|
|
@@ -299,7 +300,7 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
299
300
|
toolbar.build(isArray(list)
|
|
300
301
|
? list.map(getButton)
|
|
301
302
|
: keys(list, false).map(key => getButton(key, list[key])), this.target);
|
|
302
|
-
menu.setContent(toolbar
|
|
303
|
+
menu.setContent(toolbar).open(() => position(this.container), false, this.j.o.allowTabNavigation ? this.container : undefined);
|
|
303
304
|
this.state.activated = true;
|
|
304
305
|
}
|
|
305
306
|
onOutsideClick(e) {
|
|
@@ -310,18 +311,18 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
310
311
|
!Dom.isNode(e.target) ||
|
|
311
312
|
(!Dom.isOrContains(this.container, e.target) &&
|
|
312
313
|
!this.openedPopup.isOwnClick(e))) {
|
|
313
|
-
this.
|
|
314
|
+
this.__closePopup();
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
317
|
openPopup() {
|
|
317
|
-
this.
|
|
318
|
+
this.__closePopup();
|
|
318
319
|
this.openedPopup = new Popup(this.j, false);
|
|
319
320
|
this.j.e
|
|
320
321
|
.on(this.ow, 'mousedown touchstart', this.onOutsideClick)
|
|
321
322
|
.on('escape closeAllPopups', this.onOutsideClick);
|
|
322
323
|
return this.openedPopup;
|
|
323
324
|
}
|
|
324
|
-
|
|
325
|
+
__closePopup() {
|
|
325
326
|
if (this.openedPopup) {
|
|
326
327
|
this.j.e
|
|
327
328
|
.off(this.ow, 'mousedown touchstart', this.onOutsideClick)
|
|
@@ -360,7 +361,7 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
360
361
|
}
|
|
361
362
|
}
|
|
362
363
|
if (ctr.list) {
|
|
363
|
-
return this.
|
|
364
|
+
return this.__openControlList(ctr);
|
|
364
365
|
}
|
|
365
366
|
if (isFunction(ctr.popup)) {
|
|
366
367
|
return this.onTriggerClick(originalEvent);
|
|
@@ -373,7 +374,7 @@ export let ToolbarButton = class ToolbarButton extends UIButton {
|
|
|
373
374
|
}
|
|
374
375
|
}
|
|
375
376
|
destruct() {
|
|
376
|
-
this.
|
|
377
|
+
this.__closePopup();
|
|
377
378
|
return super.destruct();
|
|
378
379
|
}
|
|
379
380
|
};
|
|
@@ -391,7 +392,7 @@ __decorate([
|
|
|
391
392
|
], ToolbarButton.prototype, "onOutsideClick", null);
|
|
392
393
|
__decorate([
|
|
393
394
|
autobind
|
|
394
|
-
], ToolbarButton.prototype, "
|
|
395
|
+
], ToolbarButton.prototype, "__closePopup", null);
|
|
395
396
|
ToolbarButton = __decorate([
|
|
396
397
|
component
|
|
397
398
|
], ToolbarButton);
|
|
@@ -27,7 +27,7 @@ export let ToolbarContent = class ToolbarContent extends UIButton {
|
|
|
27
27
|
}
|
|
28
28
|
/** @override */
|
|
29
29
|
update() {
|
|
30
|
-
const content = this.control.getContent(this.j, this
|
|
30
|
+
const content = this.control.getContent(this.j, this);
|
|
31
31
|
if (isString(content) || content.parentNode !== this.container) {
|
|
32
32
|
Dom.detach(this.container);
|
|
33
33
|
this.container.appendChild(isString(content) ? this.j.create.fromHTML(content) : content);
|
|
@@ -0,0 +1,15 @@
|
|
|
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-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @module modules/toolbar/button
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { IViewBased } from "jodit/esm/types";
|
|
11
|
+
import { ToolbarButton } from "../button";
|
|
12
|
+
export declare class ToolbarSelect<T extends IViewBased = IViewBased> extends ToolbarButton<T> {
|
|
13
|
+
className(): string;
|
|
14
|
+
update(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
10
|
+
else
|
|
11
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
12
|
+
if (d = decorators[i])
|
|
13
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @module modules/toolbar/button
|
|
18
|
+
*/
|
|
19
|
+
import { component } from "jodit/esm/core/decorators/index.js";
|
|
20
|
+
import { isString } from "jodit/esm/core/helpers/checker/is-string.js";
|
|
21
|
+
import { ToolbarButton } from "../button";
|
|
22
|
+
export let ToolbarSelect = class ToolbarSelect extends ToolbarButton {
|
|
23
|
+
className() {
|
|
24
|
+
return 'ToolbarSelect';
|
|
25
|
+
}
|
|
26
|
+
update() {
|
|
27
|
+
super.update();
|
|
28
|
+
this.state.icon.name = '';
|
|
29
|
+
const { list, data } = this.control;
|
|
30
|
+
if (list) {
|
|
31
|
+
let key = this.state.value ||
|
|
32
|
+
(data && isString(data.currentValue)
|
|
33
|
+
? data.currentValue
|
|
34
|
+
: undefined);
|
|
35
|
+
if (!key) {
|
|
36
|
+
const keys = Object.keys(list);
|
|
37
|
+
key = keys[0];
|
|
38
|
+
}
|
|
39
|
+
const text = (list[key.toString()] || key).toString();
|
|
40
|
+
this.state.text =
|
|
41
|
+
this.control.textTemplate?.(this.jodit, text) ?? text;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
ToolbarSelect = __decorate([
|
|
46
|
+
component
|
|
47
|
+
], ToolbarSelect);
|
|
@@ -20,6 +20,7 @@ export declare class ToolbarCollection<T extends IViewWithToolbar = IViewWithToo
|
|
|
20
20
|
*/
|
|
21
21
|
get firstButton(): Nullable<IToolbarButton>;
|
|
22
22
|
protected makeButton(control: IControlTypeStrong, target?: Nullable<HTMLElement>): IUIButton;
|
|
23
|
+
protected makeSelect(control: IControlTypeStrong, target?: Nullable<HTMLElement>): IUIButton;
|
|
23
24
|
/**
|
|
24
25
|
* Button should be active
|
|
25
26
|
*/
|
|
@@ -21,7 +21,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
21
21
|
import { error } from "jodit/esm/core/helpers/utils/error/error.js";
|
|
22
22
|
import { UIList, UITooltip } from "jodit/esm/core/ui/index.js";
|
|
23
23
|
import { component, autobind } from "jodit/esm/core/decorators/index.js";
|
|
24
|
-
import { makeButton } from "jodit/esm/modules/toolbar/factory.js";
|
|
24
|
+
import { makeButton, makeSelect } from "jodit/esm/modules/toolbar/factory.js";
|
|
25
25
|
export let ToolbarCollection = class ToolbarCollection extends UIList {
|
|
26
26
|
/** @override */
|
|
27
27
|
className() {
|
|
@@ -37,6 +37,9 @@ export let ToolbarCollection = class ToolbarCollection extends UIList {
|
|
|
37
37
|
makeButton(control, target = null) {
|
|
38
38
|
return makeButton(this.j, control, target);
|
|
39
39
|
}
|
|
40
|
+
makeSelect(control, target = null) {
|
|
41
|
+
return makeSelect(this.j, control, target);
|
|
42
|
+
}
|
|
40
43
|
/**
|
|
41
44
|
* Button should be active
|
|
42
45
|
*/
|
|
@@ -17,3 +17,4 @@ export declare function makeCollection(jodit: IViewBased, parentElement?: IUIEle
|
|
|
17
17
|
* Button factory
|
|
18
18
|
*/
|
|
19
19
|
export declare function makeButton(jodit: IViewBased, control: IControlTypeStrong, target?: Nullable<HTMLElement>): IToolbarButton;
|
|
20
|
+
export declare function makeSelect(view: IViewBased, control: IControlTypeStrong, target?: Nullable<HTMLElement>): IToolbarButton;
|