jodit 3.9.2 → 3.10.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/.idea/workspace.xml +317 -283
- package/CHANGELOG.MD +320 -118
- package/README.md +0 -1
- package/build/jodit.css +703 -617
- package/build/jodit.es2018.css +493 -437
- package/build/jodit.es2018.en.css +493 -437
- package/build/jodit.es2018.en.js +1549 -773
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +1 -1
- package/build/jodit.es2018.js +1549 -773
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +1 -1
- package/build/jodit.js +2616 -1713
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +1 -1
- package/index.d.ts +10 -0
- package/package.json +10 -10
- package/src/config.ts +19 -20
- package/src/core/component/component.ts +16 -15
- package/src/core/component/statuses.ts +6 -6
- package/src/core/dom.ts +16 -4
- package/src/core/events/event-emitter.ts +4 -2
- package/src/core/global.ts +13 -2
- package/src/core/helpers/append-script.ts +14 -0
- package/src/core/helpers/selector.ts +8 -3
- package/src/core/helpers/size/index.ts +1 -0
- package/src/core/helpers/size/object-size.ts +22 -0
- package/src/core/selection/select.ts +1 -0
- package/src/core/selection/style/api/{get-closest-wrapper.ts → extract.ts} +26 -43
- package/src/core/selection/style/api/finite-state-machine.ts +66 -0
- package/src/core/selection/style/api/index.ts +12 -5
- package/src/core/selection/style/api/{check-special-elements.ts → is-inside-invisible-element.ts} +1 -1
- package/src/core/selection/style/api/is-suit-element.ts +12 -1
- package/src/core/selection/style/api/toggle/toggle-css.ts +134 -0
- package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +49 -0
- package/src/core/selection/style/api/toggle-commit-styles.ts +27 -0
- package/src/core/selection/style/api/wrap-and-commit-style.ts +68 -0
- package/src/core/selection/style/api/wrap-ordered-list.ts +37 -0
- package/src/core/selection/style/api/wrap-unwrapped-text.ts +1 -4
- package/src/core/selection/style/apply-style.ts +161 -97
- package/src/core/selection/style/commit-style.ts +13 -0
- package/src/core/storage/engines/local-storage-provider.ts +9 -3
- package/src/core/storage/engines/memory-storage-provider.ts +6 -3
- package/src/core/storage/storage.ts +7 -4
- package/src/core/ui/button/button/button.less +10 -8
- package/src/core/ui/button/button/button.ts +9 -9
- package/src/core/ui/button/group/group.ts +2 -2
- package/src/core/ui/element.ts +4 -3
- package/src/core/ui/form/block/block.ts +1 -1
- package/src/core/ui/form/form.ts +8 -0
- package/src/core/ui/form/inputs/area/area.less +5 -0
- package/src/core/ui/form/inputs/area/area.ts +22 -1
- package/src/core/ui/form/inputs/checkbox/checkbox.ts +28 -4
- package/src/core/ui/form/inputs/input/input.less +1 -1
- package/src/core/ui/form/inputs/input/input.ts +14 -4
- package/src/core/ui/helpers/buttons.ts +14 -6
- package/src/core/ui/icon.ts +3 -1
- package/src/core/ui/index.ts +1 -3
- package/src/core/ui/list/group.less +8 -2
- package/src/core/ui/list/group.ts +2 -2
- package/src/{modules/file-browser/consts.ts → core/ui/list/index.ts} +4 -4
- package/src/core/ui/list/list.less +10 -1
- package/src/core/ui/list/list.ts +20 -3
- package/src/core/ui/{separator.ts → list/separator.ts} +2 -2
- package/src/core/ui/list/spacer.ts +15 -0
- package/src/core/ui/popup/popup.less +5 -3
- package/src/core/ui/popup/popup.ts +53 -1
- package/src/core/view/view-with-toolbar.ts +6 -1
- package/src/jodit.ts +17 -14
- package/src/modules/dialog/dialog.less +1 -16
- package/src/modules/dialog/dialog.ts +10 -3
- package/src/modules/file-browser/builders/context-menu.ts +29 -22
- package/src/modules/file-browser/config.ts +10 -2
- package/src/modules/file-browser/file-browser.ts +50 -29
- package/src/modules/file-browser/listeners/native-listeners.ts +37 -19
- package/src/modules/file-browser/listeners/state-listeners.ts +48 -22
- package/src/modules/file-browser/styles/file-browser.less +4 -291
- package/src/modules/file-browser/styles/preview.less +11 -8
- package/src/modules/file-browser/ui/files/files.less +174 -0
- package/src/modules/file-browser/ui/files/files.ts +14 -0
- package/src/modules/file-browser/ui/index.ts +8 -0
- package/src/modules/file-browser/ui/tree/tree.less +118 -0
- package/src/modules/file-browser/ui/tree/tree.ts +14 -0
- package/src/modules/status-bar/status-bar.less +27 -1
- package/src/modules/status-bar/status-bar.ts +15 -1
- package/src/modules/table.ts +122 -98
- package/src/modules/toolbar/collection/collection.ts +17 -8
- package/src/modules/toolbar/collection/editor-collection.ts +27 -2
- package/src/modules/widget/file-selector/file-selector.ts +1 -1
- package/src/modules/widget/tabs/tabs.less +2 -1
- package/src/modules/widget/tabs/tabs.ts +5 -3
- package/src/plugins/add-new-line/add-new-line.ts +1 -0
- package/src/plugins/bold.ts +2 -2
- package/src/plugins/clipboard/drag-and-drop.ts +4 -1
- package/src/plugins/clipboard/paste/paste.ts +1 -1
- package/src/plugins/font.ts +11 -1
- package/src/plugins/image/image-properties/image-properties.ts +7 -0
- package/src/plugins/index.ts +1 -0
- package/src/plugins/inline-popup/config/config.ts +1 -0
- package/src/plugins/inline-popup/config/items/toolbar.ts +33 -0
- package/src/plugins/inline-popup/inline-popup.ts +17 -0
- package/src/plugins/link/template.ts +2 -2
- package/src/plugins/mobile.ts +10 -14
- package/src/plugins/ordered-list.ts +40 -1
- package/src/plugins/powered-by-jodit.ts +39 -0
- package/src/plugins/print/preview.ts +103 -48
- package/src/plugins/resizer/resizer.less +10 -7
- package/src/plugins/resizer/resizer.ts +12 -14
- package/src/plugins/size/resize-handler.ts +4 -1
- package/src/plugins/size/size.less +2 -19
- package/src/plugins/size/size.ts +6 -1
- package/src/plugins/source/const.ts +7 -0
- package/src/plugins/source/editor/engines/ace.ts +5 -0
- package/src/plugins/source/source.ts +33 -7
- package/src/plugins/sticky/sticky.ts +2 -0
- package/src/plugins/table/config.ts +3 -1
- package/src/plugins/table/table.less +0 -1
- package/src/styles/icons/index.ts +2 -0
- package/src/styles/icons/resize-handler.svg +4 -0
- package/src/styles/jodit.less +6 -0
- package/src/styles/mixins.less +20 -0
- package/src/styles/themes/dark.less +11 -1
- package/src/types/ajax.d.ts +0 -1
- package/src/types/file-browser.d.ts +13 -1
- package/src/types/jodit.d.ts +4 -1
- package/src/types/popup.d.ts +1 -0
- package/src/types/select.d.ts +2 -0
- package/src/types/storage.ts +3 -3
- package/src/types/style.d.ts +8 -0
- package/src/types/toolbar.d.ts +9 -2
- package/src/types/types.d.ts +1 -1
- package/src/types/ui.d.ts +22 -4
- package/src/types/view.d.ts +1 -0
- package/types/core/component/component.d.ts +10 -5
- package/types/core/component/statuses.d.ts +6 -6
- package/types/core/dom.d.ts +3 -2
- package/types/core/helpers/append-script.d.ts +1 -0
- package/types/core/helpers/selector.d.ts +2 -3
- package/types/core/helpers/size/index.d.ts +1 -0
- package/types/core/helpers/size/object-size.d.ts +7 -0
- package/types/core/selection/style/api/{get-closest-wrapper.d.ts → extract.d.ts} +6 -5
- package/types/core/selection/style/api/finite-state-machine.d.ts +21 -0
- package/types/core/selection/style/api/index.d.ts +12 -5
- package/types/core/selection/style/api/{check-special-elements.d.ts → is-inside-invisible-element.d.ts} +1 -1
- package/types/core/selection/style/api/is-suit-element.d.ts +9 -0
- package/types/core/selection/style/api/toggle/toggle-css.d.ts +11 -0
- package/types/core/selection/style/api/toggle/toggle-ordered-list.d.ts +11 -0
- package/types/core/selection/style/api/{toggle-styles.d.ts → toggle-commit-styles.d.ts} +1 -3
- package/types/core/selection/style/api/{post-process-list-element.d.ts → wrap-and-commit-style.d.ts} +3 -3
- package/types/core/selection/style/api/wrap-ordered-list.d.ts +12 -0
- package/types/core/selection/style/apply-style.d.ts +1 -4
- package/types/core/selection/style/commit-style.d.ts +7 -0
- package/types/core/storage/engines/local-storage-provider.d.ts +3 -3
- package/types/core/storage/engines/memory-storage-provider.d.ts +3 -3
- package/types/core/storage/storage.d.ts +3 -3
- package/types/core/ui/button/button/button.d.ts +3 -3
- package/types/core/ui/form/form.d.ts +1 -0
- package/types/core/ui/form/inputs/area/area.d.ts +7 -1
- package/types/core/ui/form/inputs/checkbox/checkbox.d.ts +9 -3
- package/types/core/ui/helpers/buttons.d.ts +2 -2
- package/types/core/ui/icon.d.ts +1 -1
- package/types/core/ui/index.d.ts +1 -3
- package/types/core/ui/list/group.d.ts +2 -1
- package/types/core/ui/list/index.d.ts +9 -0
- package/types/core/ui/{separator.d.ts → list/separator.d.ts} +1 -1
- package/types/core/ui/list/spacer.d.ts +9 -0
- package/types/core/ui/popup/popup.d.ts +2 -1
- package/types/core/view/view-with-toolbar.d.ts +4 -2
- package/types/jodit.d.ts +6 -6
- package/types/modules/file-browser/file-browser.d.ts +3 -2
- package/types/modules/file-browser/listeners/native-listeners.d.ts +5 -1
- package/types/modules/file-browser/ui/files/files.d.ts +10 -0
- package/types/modules/file-browser/ui/index.d.ts +7 -0
- package/types/modules/file-browser/ui/tree/tree.d.ts +10 -0
- package/types/modules/status-bar/status-bar.d.ts +6 -1
- package/types/modules/table.d.ts +2 -2
- package/types/modules/toolbar/button/button.d.ts +1 -1
- package/types/modules/toolbar/collection/collection.d.ts +5 -2
- package/types/modules/toolbar/collection/editor-collection.d.ts +9 -1
- package/types/modules/widget/tabs/tabs.d.ts +2 -1
- package/types/plugins/index.d.ts +1 -0
- package/types/plugins/inline-popup/inline-popup.d.ts +4 -0
- package/types/plugins/ordered-list.d.ts +8 -1
- package/types/plugins/powered-by-jodit.d.ts +12 -0
- package/types/plugins/source/const.d.ts +6 -0
- package/types/plugins/source/editor/engines/ace.d.ts +1 -0
- package/types/plugins/source/source.d.ts +1 -0
- package/types/styles/icons/index.d.ts +2 -1
- package/types/types/storage.d.ts +3 -3
- package/types/types/{ajax.d.ts → types/ajax.d.ts} +0 -1
- package/types/types/{async.d.ts → types/async.d.ts} +0 -0
- package/types/types/{context.d.ts → types/context.d.ts} +0 -0
- package/types/types/{core.ts → types/core.ts} +0 -0
- package/types/types/{create.d.ts → types/create.d.ts} +0 -0
- package/types/types/{dialog.d.ts → types/dialog.d.ts} +0 -0
- package/types/types/{events.d.ts → types/events.d.ts} +0 -0
- package/types/types/{file-browser.d.ts → types/file-browser.d.ts} +13 -1
- package/types/types/{form.d.ts → types/form.d.ts} +0 -0
- package/types/types/{index.d.ts → types/index.d.ts} +0 -0
- package/types/types/{jodit.d.ts → types/jodit.d.ts} +4 -1
- package/types/types/{observe.d.ts → types/observe.d.ts} +0 -0
- package/types/types/{plugin.d.ts → types/plugin.d.ts} +0 -0
- package/types/types/{popup.d.ts → types/popup.d.ts} +1 -0
- package/types/types/{select.d.ts → types/select.d.ts} +2 -0
- package/types/types/{source.d.ts → types/source.d.ts} +0 -0
- package/types/types/{storage.ts → types/storage.ts} +3 -3
- package/types/types/{style.d.ts → types/style.d.ts} +8 -0
- package/types/types/{toolbar.d.ts → types/toolbar.d.ts} +9 -2
- package/types/types/{traits.d.ts → types/traits.d.ts} +0 -0
- package/types/types/{types.d.ts → types/types.d.ts} +1 -1
- package/types/types/{ui.d.ts → types/ui.d.ts} +22 -4
- package/types/types/{uploader.d.ts → types/uploader.d.ts} +0 -0
- package/types/types/{view.d.ts → types/view.d.ts} +1 -0
- package/src/core/selection/style/api/post-process-list-element.ts +0 -33
- package/src/core/selection/style/api/toggle-styles.ts +0 -74
- package/types/modules/file-browser/consts.d.ts +0 -8
|
@@ -11,12 +11,14 @@ export class MemoryStorageProvider<T = StorageValueType>
|
|
|
11
11
|
{
|
|
12
12
|
private data: Map<string, T> = new Map();
|
|
13
13
|
|
|
14
|
-
set(key: string, value: T):
|
|
14
|
+
set(key: string, value: T): IStorage<T> {
|
|
15
15
|
this.data.set(key, value);
|
|
16
|
+
return this;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
delete(key: string):
|
|
19
|
+
delete(key: string): IStorage<T> {
|
|
19
20
|
this.data.delete(key);
|
|
21
|
+
return this;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
get<R = T>(key: string): R | void {
|
|
@@ -27,7 +29,8 @@ export class MemoryStorageProvider<T = StorageValueType>
|
|
|
27
29
|
return this.data.has(key);
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
clear():
|
|
32
|
+
clear(): IStorage<T> {
|
|
31
33
|
this.data.clear();
|
|
34
|
+
return this;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
@@ -17,12 +17,14 @@ export const StorageKey: string = 'Jodit_';
|
|
|
17
17
|
export class Storage<T = StorageValueType> implements IStorage<T> {
|
|
18
18
|
readonly prefix = StorageKey;
|
|
19
19
|
|
|
20
|
-
set(key: string, value: T):
|
|
20
|
+
set(key: string, value: T): IStorage<T> {
|
|
21
21
|
this.provider.set(camelCase(this.prefix + key), value);
|
|
22
|
+
return this;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
delete(key: string):
|
|
25
|
+
delete(key: string): IStorage<T> {
|
|
25
26
|
this.provider.delete(camelCase(this.prefix + key));
|
|
27
|
+
return this;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
get<R = T>(key: string): R | void {
|
|
@@ -33,8 +35,9 @@ export class Storage<T = StorageValueType> implements IStorage<T> {
|
|
|
33
35
|
return this.provider.exists(camelCase(this.prefix + key));
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
clear():
|
|
37
|
-
|
|
38
|
+
clear(): IStorage<T> {
|
|
39
|
+
this.provider.clear();
|
|
40
|
+
return this;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
protected constructor(readonly provider: IStorage<T>, suffix?: string) {
|
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.jodit-ui-button-interaction() {
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
|
|
34
36
|
&:hover:not([disabled]) {
|
|
35
37
|
background-color: var(--color-button-background-hover);
|
|
36
38
|
opacity: 1;
|
|
@@ -140,28 +142,28 @@
|
|
|
140
142
|
}
|
|
141
143
|
}
|
|
142
144
|
|
|
143
|
-
.jodit-ui-button-
|
|
144
|
-
&
|
|
145
|
+
.jodit-ui-button-variants {
|
|
146
|
+
&_variant_initial {
|
|
145
147
|
}
|
|
146
148
|
|
|
147
|
-
&
|
|
149
|
+
&_variant_default {
|
|
148
150
|
.jodit_status(#e3e3e3, #212529, #c9cdd1, #212529, #dae0e5, #212529);
|
|
149
151
|
}
|
|
150
152
|
|
|
151
|
-
&
|
|
153
|
+
&_variant_primary {
|
|
152
154
|
.jodit_status(#007bff, #fff, #0069d9, #fff, #0062cc, #fff);
|
|
153
155
|
}
|
|
154
156
|
|
|
155
|
-
&
|
|
157
|
+
&_variant_secondary {
|
|
156
158
|
.jodit_status(#d8d8d8, #212529, #c9cdd1, #212529, #dae0e5, #212529);
|
|
157
159
|
border-radius: 0;
|
|
158
160
|
}
|
|
159
161
|
|
|
160
|
-
&
|
|
162
|
+
&_variant_success {
|
|
161
163
|
.jodit_status(#28a745, #fff, #218838, #fff, #1e7e34, #fff);
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
&
|
|
166
|
+
&_variant_danger {
|
|
165
167
|
.jodit_status(#dc3545, #fff, #c82333, #fff, #bd2130, #fff);
|
|
166
168
|
}
|
|
167
169
|
}
|
|
@@ -190,5 +192,5 @@
|
|
|
190
192
|
outline: 1px dashed var(--color-background-selection);
|
|
191
193
|
}
|
|
192
194
|
|
|
193
|
-
.jodit-ui-button-
|
|
195
|
+
.jodit-ui-button-variants();
|
|
194
196
|
}
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
IUIButtonState,
|
|
12
12
|
IUIButtonStatePartial,
|
|
13
13
|
IViewBased,
|
|
14
|
-
|
|
14
|
+
ButtonVariant
|
|
15
15
|
} from '../../../../types';
|
|
16
16
|
import { UIElement } from '../../element';
|
|
17
17
|
import { Dom } from '../../../dom';
|
|
@@ -27,7 +27,7 @@ export const UIButtonState = (): IUIButtonState => ({
|
|
|
27
27
|
name: '',
|
|
28
28
|
value: '',
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
variant: 'initial',
|
|
31
31
|
disabled: false,
|
|
32
32
|
activated: false,
|
|
33
33
|
|
|
@@ -97,9 +97,9 @@ export class UIButton extends UIElement implements IUIButton {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
@watch('state.
|
|
100
|
+
@watch('state.variant')
|
|
101
101
|
protected onChangeStatus(): void {
|
|
102
|
-
this.setMod('
|
|
102
|
+
this.setMod('variant', this.state.variant);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
@watch('state.text')
|
|
@@ -257,19 +257,19 @@ export function Button(
|
|
|
257
257
|
jodit: IViewBased,
|
|
258
258
|
icon: string,
|
|
259
259
|
text: string,
|
|
260
|
-
|
|
260
|
+
variant?: ButtonVariant
|
|
261
261
|
): IUIButton;
|
|
262
262
|
export function Button(
|
|
263
263
|
jodit: IViewBased,
|
|
264
264
|
state: IUIButtonStatePartial,
|
|
265
|
-
|
|
265
|
+
variant?: ButtonVariant
|
|
266
266
|
): IUIButton;
|
|
267
267
|
|
|
268
268
|
export function Button(
|
|
269
269
|
jodit: IViewBased,
|
|
270
270
|
stateOrText: string | IUIButtonStatePartial,
|
|
271
271
|
text?: string,
|
|
272
|
-
|
|
272
|
+
variant?: ButtonVariant
|
|
273
273
|
): IUIButton {
|
|
274
274
|
const button = new UIButton(jodit);
|
|
275
275
|
|
|
@@ -279,8 +279,8 @@ export function Button(
|
|
|
279
279
|
button.state.icon.name = stateOrText;
|
|
280
280
|
button.state.name = stateOrText;
|
|
281
281
|
|
|
282
|
-
if (
|
|
283
|
-
button.state.
|
|
282
|
+
if (variant) {
|
|
283
|
+
button.state.variant = variant;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
if (text) {
|
|
@@ -42,7 +42,7 @@ export class UIButtonGroup extends UIGroup {
|
|
|
42
42
|
|
|
43
43
|
constructor(
|
|
44
44
|
jodit: IViewBased,
|
|
45
|
-
readonly options: {
|
|
45
|
+
override readonly options: {
|
|
46
46
|
name?: string;
|
|
47
47
|
value?: string | boolean | number;
|
|
48
48
|
label?: string;
|
|
@@ -59,7 +59,7 @@ export class UIButtonGroup extends UIGroup {
|
|
|
59
59
|
const btn = new UIButton(jodit, {
|
|
60
60
|
text: opt.text,
|
|
61
61
|
value: opt.value,
|
|
62
|
-
|
|
62
|
+
variant: 'primary'
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
btn.onAction(() => {
|
package/src/core/ui/element.ts
CHANGED
|
@@ -46,6 +46,7 @@ export abstract class UIElement<T extends IViewBased = IViewBased>
|
|
|
46
46
|
callback(parent);
|
|
47
47
|
parent = parent.parentElement;
|
|
48
48
|
}
|
|
49
|
+
|
|
49
50
|
return this;
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -93,9 +94,9 @@ export abstract class UIElement<T extends IViewBased = IViewBased>
|
|
|
93
94
|
* Find closest UIElement in DOM
|
|
94
95
|
*/
|
|
95
96
|
static closestElement(node: Node, type: Function): Nullable<IUIElement> {
|
|
96
|
-
const elm = Dom.up(node,
|
|
97
|
-
if (
|
|
98
|
-
const { component } =
|
|
97
|
+
const elm = Dom.up(node, elm => {
|
|
98
|
+
if (elm) {
|
|
99
|
+
const { component } = elm as HTMLElement;
|
|
99
100
|
return component && component instanceof type;
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -21,7 +21,7 @@ export class UIBlock extends UIGroup {
|
|
|
21
21
|
constructor(
|
|
22
22
|
jodit: IViewBased,
|
|
23
23
|
elements?: Array<IUIElement | void | null | false>,
|
|
24
|
-
readonly options: {
|
|
24
|
+
override readonly options: {
|
|
25
25
|
align?: 'center' | 'left' | 'right' | 'full';
|
|
26
26
|
width?: 'full';
|
|
27
27
|
ref?: string;
|
package/src/core/ui/form/form.ts
CHANGED
|
@@ -75,4 +75,12 @@ export class UIForm extends UIGroup implements IUIForm {
|
|
|
75
75
|
attr(form, 'dir', this.j.o.direction || 'auto');
|
|
76
76
|
return form;
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
constructor(...args: ConstructorParameters<typeof UIGroup>) {
|
|
80
|
+
super(...args);
|
|
81
|
+
|
|
82
|
+
if (this.options?.className) {
|
|
83
|
+
this.container.classList.add(this.options?.className);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
78
86
|
}
|
|
@@ -6,21 +6,42 @@
|
|
|
6
6
|
|
|
7
7
|
import './area.less';
|
|
8
8
|
|
|
9
|
+
import type { IUITextArea, IViewBased } from '../../../../../types';
|
|
9
10
|
import { UIInput } from '../input/input';
|
|
10
11
|
import { component } from '../../../../decorators';
|
|
11
12
|
|
|
12
13
|
@component
|
|
13
|
-
export class UITextArea extends UIInput {
|
|
14
|
+
export class UITextArea extends UIInput implements IUITextArea {
|
|
14
15
|
/** @override */
|
|
15
16
|
override className(): string {
|
|
16
17
|
return 'UITextArea';
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
/** @override */
|
|
21
|
+
static override defaultState: IUITextArea['state'] = {
|
|
22
|
+
...UIInput.defaultState,
|
|
23
|
+
size: 5,
|
|
24
|
+
resizable: true
|
|
25
|
+
};
|
|
26
|
+
|
|
19
27
|
override nativeInput!: HTMLTextAreaElement;
|
|
20
28
|
|
|
29
|
+
/** @override */
|
|
30
|
+
override state: IUITextArea['state'] = { ...UITextArea.defaultState };
|
|
31
|
+
|
|
21
32
|
/** @override */
|
|
22
33
|
protected override createContainer(options: this['state']): HTMLElement {
|
|
23
34
|
this.nativeInput = this.j.create.element('textarea');
|
|
35
|
+
|
|
24
36
|
return super.createContainer(options);
|
|
25
37
|
}
|
|
38
|
+
|
|
39
|
+
constructor(jodit: IViewBased, state: Partial<IUITextArea['state']>) {
|
|
40
|
+
super(jodit, state);
|
|
41
|
+
Object.assign(this.state, state);
|
|
42
|
+
|
|
43
|
+
if (this.state.resizable === false) {
|
|
44
|
+
this.nativeInput.style.resize = 'none';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
26
47
|
}
|
|
@@ -6,17 +6,26 @@
|
|
|
6
6
|
|
|
7
7
|
import './checkbox.less';
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { IViewBased, IUICheckBox } from '../../../../../types';
|
|
10
10
|
import { UIInput } from '../input/input';
|
|
11
|
-
import { component } from '../../../../decorators';
|
|
11
|
+
import { component, watch, hook } from '../../../../decorators';
|
|
12
12
|
|
|
13
13
|
@component
|
|
14
|
-
export class UICheckbox extends UIInput {
|
|
14
|
+
export class UICheckbox extends UIInput implements IUICheckBox {
|
|
15
15
|
/** @override */
|
|
16
16
|
override className(): string {
|
|
17
17
|
return 'UICheckbox';
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/** @override */
|
|
21
|
+
static override defaultState: IUICheckBox['state'] = {
|
|
22
|
+
...UIInput.defaultState,
|
|
23
|
+
checked: false
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** @override */
|
|
27
|
+
override state: IUICheckBox['state'] = { ...UICheckbox.defaultState };
|
|
28
|
+
|
|
20
29
|
/** @override */
|
|
21
30
|
protected override render(): HTMLElement {
|
|
22
31
|
return this.j.c.element('label', {
|
|
@@ -25,7 +34,22 @@ export class UICheckbox extends UIInput {
|
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
/** @override **/
|
|
28
|
-
constructor(jodit: IViewBased, options: Partial<
|
|
37
|
+
constructor(jodit: IViewBased, options: Partial<IUICheckBox['state']>) {
|
|
29
38
|
super(jodit, { ...options, type: 'checkbox' });
|
|
39
|
+
Object.assign(this.state, options);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@watch('state.checked')
|
|
43
|
+
@hook('ready')
|
|
44
|
+
protected onChangeChecked(): void {
|
|
45
|
+
this.value = this.state.checked.toString();
|
|
46
|
+
(<HTMLInputElement>this.nativeInput).checked = this.state.checked;
|
|
47
|
+
|
|
48
|
+
this.setMod('checked', this.state.checked);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@watch('nativeInput:change')
|
|
52
|
+
protected onChangeNativeCheckBox(): void {
|
|
53
|
+
this.state.checked = (<HTMLInputElement>this.nativeInput).checked;
|
|
30
54
|
}
|
|
31
55
|
}
|
|
@@ -166,7 +166,11 @@ export class UIInput extends UIElement implements IUIInput {
|
|
|
166
166
|
*/
|
|
167
167
|
@watch('state.value')
|
|
168
168
|
protected onChangeStateValue(): void {
|
|
169
|
-
|
|
169
|
+
const value = this.state.value.toString();
|
|
170
|
+
|
|
171
|
+
if (value !== this.value) {
|
|
172
|
+
this.value = value;
|
|
173
|
+
}
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
/**
|
|
@@ -176,9 +180,11 @@ export class UIInput extends UIElement implements IUIInput {
|
|
|
176
180
|
protected onChangeValue(): void {
|
|
177
181
|
const { value } = this;
|
|
178
182
|
|
|
179
|
-
this.state.value
|
|
180
|
-
|
|
181
|
-
|
|
183
|
+
if (this.state.value !== value) {
|
|
184
|
+
this.state.value = value;
|
|
185
|
+
this.j.e.fire(this, 'change', value);
|
|
186
|
+
this.state.onChange?.(value);
|
|
187
|
+
}
|
|
182
188
|
}
|
|
183
189
|
|
|
184
190
|
protected validators: Set<IUIInputValidator> = new Set([]);
|
|
@@ -226,6 +232,10 @@ export class UIInput extends UIElement implements IUIInput {
|
|
|
226
232
|
constructor(jodit: IViewBased, options?: Partial<IUIInput['state']>) {
|
|
227
233
|
super(jodit, options);
|
|
228
234
|
|
|
235
|
+
if (options?.value !== undefined) {
|
|
236
|
+
options.value = options.value.toString();
|
|
237
|
+
}
|
|
238
|
+
|
|
229
239
|
Object.assign(this.state, options);
|
|
230
240
|
|
|
231
241
|
if (this.state.clearButton !== undefined) {
|
|
@@ -8,7 +8,8 @@ import type {
|
|
|
8
8
|
Buttons,
|
|
9
9
|
ButtonsGroup,
|
|
10
10
|
ButtonsGroups,
|
|
11
|
-
IControlType
|
|
11
|
+
IControlType,
|
|
12
|
+
IJodit
|
|
12
13
|
} from '../../../types';
|
|
13
14
|
import { isArray } from '../../helpers/checker';
|
|
14
15
|
|
|
@@ -18,14 +19,20 @@ export const isButtonGroup = (
|
|
|
18
19
|
return isArray((<ButtonsGroup>item).buttons);
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
export
|
|
22
|
-
buttons: ButtonsGroups
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
export function flatButtonsSet(
|
|
23
|
+
buttons: ButtonsGroups,
|
|
24
|
+
jodit: IJodit
|
|
25
|
+
): Set<string | IControlType> {
|
|
26
|
+
const groups = jodit.getRegisteredButtonGroups();
|
|
27
|
+
|
|
28
|
+
return new Set(
|
|
25
29
|
buttons.reduce(
|
|
26
30
|
(acc: Buttons, item: ButtonsGroup | string | IControlType) => {
|
|
27
31
|
if (isButtonGroup(item)) {
|
|
28
|
-
acc.
|
|
32
|
+
acc = acc.concat([
|
|
33
|
+
...(<ButtonsGroup>item).buttons,
|
|
34
|
+
...(groups[item.group] ?? [])
|
|
35
|
+
]);
|
|
29
36
|
} else {
|
|
30
37
|
acc.push(item);
|
|
31
38
|
}
|
|
@@ -35,3 +42,4 @@ export const flatButtonsSet = (
|
|
|
35
42
|
[] as Buttons
|
|
36
43
|
)
|
|
37
44
|
);
|
|
45
|
+
}
|
package/src/core/ui/icon.ts
CHANGED
|
@@ -23,6 +23,7 @@ export class Icon {
|
|
|
23
23
|
return (
|
|
24
24
|
Icon.icons[name] ||
|
|
25
25
|
Icon.icons[name.replace(/-/g, '_')] ||
|
|
26
|
+
Icon.icons[name.replace(/_/g, '-')] ||
|
|
26
27
|
Icon.icons[name.toLowerCase()]
|
|
27
28
|
);
|
|
28
29
|
}
|
|
@@ -44,8 +45,9 @@ export class Icon {
|
|
|
44
45
|
/**
|
|
45
46
|
* Set SVG in store
|
|
46
47
|
*/
|
|
47
|
-
static set(name: string, value: string):
|
|
48
|
+
static set(name: string, value: string): typeof Icon {
|
|
48
49
|
this.icons[name.replace('_', '-')] = value;
|
|
50
|
+
return this;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
/**
|
package/src/core/ui/index.ts
CHANGED
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
export * from './element';
|
|
8
8
|
export * from './button';
|
|
9
9
|
export * from './popup';
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './list/group';
|
|
12
|
-
export * from './list/list';
|
|
10
|
+
export * from './list';
|
|
13
11
|
export * from './form';
|
|
14
12
|
export * from './icon';
|
|
15
13
|
export * from './progress-bar/progress-bar';
|
|
@@ -10,14 +10,20 @@
|
|
|
10
10
|
.jodit-ui-group {
|
|
11
11
|
display: inline-flex;
|
|
12
12
|
max-width: 100%;
|
|
13
|
+
|
|
13
14
|
flex: 0 0 auto;
|
|
14
15
|
flex-shrink: 0;
|
|
15
16
|
flex-wrap: wrap;
|
|
16
17
|
|
|
17
|
-
&
|
|
18
|
+
&_line_true {
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: stretch;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&_separated_true:not(:last-child):not(&_before-spacer_true) {
|
|
18
24
|
&:after {
|
|
19
25
|
content: '';
|
|
20
|
-
.jodit-ui-separator();
|
|
26
|
+
.jodit-ui-separator-func();
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
29
|
|
|
@@ -76,7 +76,7 @@ export class UIGroup<T extends IViewBased = IViewBased>
|
|
|
76
76
|
*/
|
|
77
77
|
append(elm: IUIElement | IUIElement[], distElement?: string): this {
|
|
78
78
|
if (isArray(elm)) {
|
|
79
|
-
elm.forEach(item => this.append(item));
|
|
79
|
+
elm.forEach(item => this.append(item, distElement));
|
|
80
80
|
return this;
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -145,7 +145,7 @@ export class UIGroup<T extends IViewBased = IViewBased>
|
|
|
145
145
|
constructor(
|
|
146
146
|
jodit: T,
|
|
147
147
|
elements?: Array<IUIElement | void | null | false>,
|
|
148
|
-
options?: IDictionary
|
|
148
|
+
readonly options?: IDictionary
|
|
149
149
|
) {
|
|
150
150
|
super(jodit, options);
|
|
151
151
|
elements?.forEach(elm => elm && this.append(elm));
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export
|
|
7
|
+
export * from './group';
|
|
8
|
+
export * from './list';
|
|
9
|
+
export * from './separator';
|
|
10
|
+
export * from './spacer';
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
width: 100%;
|
|
26
26
|
height: auto;
|
|
27
27
|
min-height: var(--button-size);
|
|
28
|
+
cursor: pointer;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
&__text:not(:empty) {
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
.jodit-ui-separator {
|
|
38
|
+
.jodit-ui-separator-func() {
|
|
38
39
|
padding: 0;
|
|
39
40
|
border-right: 1px solid var(--color-border);
|
|
40
41
|
border-left: 0;
|
|
@@ -42,9 +43,17 @@
|
|
|
42
43
|
cursor: default;
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
.jodit-ui-separator {
|
|
47
|
+
.jodit-ui-separator-func();
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
.jodit-ui-break {
|
|
46
51
|
width: 0;
|
|
47
52
|
height: 0 !important;
|
|
48
53
|
flex-basis: 100%;
|
|
49
54
|
border-top: 1px solid var(--color-border);
|
|
50
55
|
}
|
|
56
|
+
|
|
57
|
+
.jodit-ui-spacer {
|
|
58
|
+
flex: 1;
|
|
59
|
+
}
|
package/src/core/ui/list/list.ts
CHANGED
|
@@ -21,7 +21,8 @@ import { UIButton } from '../button';
|
|
|
21
21
|
import { getStrongControlTypes } from '../helpers/get-strong-control-types';
|
|
22
22
|
import { component, watch } from '../../decorators';
|
|
23
23
|
import { UIGroup } from './group';
|
|
24
|
-
import {
|
|
24
|
+
import { UISpacer } from './spacer';
|
|
25
|
+
import { UISeparator } from './separator';
|
|
25
26
|
import { isButtonGroup } from '../helpers/buttons';
|
|
26
27
|
import { getControlType } from '../helpers/get-control-type';
|
|
27
28
|
import { splitArray } from '../../helpers';
|
|
@@ -89,8 +90,9 @@ export class UIList<T extends IViewBased = IViewBased>
|
|
|
89
90
|
|
|
90
91
|
let lastBtnSeparator: boolean = false;
|
|
91
92
|
|
|
92
|
-
let line
|
|
93
|
+
let line = this.makeGroup();
|
|
93
94
|
this.append(line);
|
|
95
|
+
line.setMod('line', true);
|
|
94
96
|
|
|
95
97
|
let group: IUIGroup;
|
|
96
98
|
|
|
@@ -100,6 +102,7 @@ export class UIList<T extends IViewBased = IViewBased>
|
|
|
100
102
|
switch (control.name) {
|
|
101
103
|
case '\n':
|
|
102
104
|
line = this.makeGroup();
|
|
105
|
+
line.setMod('line', true);
|
|
103
106
|
group = this.makeGroup();
|
|
104
107
|
line.append(group);
|
|
105
108
|
this.append(line);
|
|
@@ -112,6 +115,19 @@ export class UIList<T extends IViewBased = IViewBased>
|
|
|
112
115
|
}
|
|
113
116
|
break;
|
|
114
117
|
|
|
118
|
+
case '---': {
|
|
119
|
+
group.setMod('before-spacer', true);
|
|
120
|
+
|
|
121
|
+
const space = new UISpacer(this.j);
|
|
122
|
+
line.append(space);
|
|
123
|
+
|
|
124
|
+
group = this.makeGroup();
|
|
125
|
+
line.append(group);
|
|
126
|
+
lastBtnSeparator = false;
|
|
127
|
+
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
|
|
115
131
|
default:
|
|
116
132
|
lastBtnSeparator = false;
|
|
117
133
|
elm = this.makeButton(control, target);
|
|
@@ -136,9 +152,10 @@ export class UIList<T extends IViewBased = IViewBased>
|
|
|
136
152
|
|
|
137
153
|
if (buttons.length) {
|
|
138
154
|
group = this.makeGroup();
|
|
139
|
-
line.append(group);
|
|
140
155
|
group.setMod('separated', true).setMod('group', item.group);
|
|
141
156
|
|
|
157
|
+
line.append(group);
|
|
158
|
+
|
|
142
159
|
getStrongControlTypes(buttons, this.j.o.controls)
|
|
143
160
|
.filter(isNotRemoved)
|
|
144
161
|
.forEach(addButton);
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { UIElement } from '
|
|
8
|
-
import { component } from '
|
|
7
|
+
import { UIElement } from '../element';
|
|
8
|
+
import { component } from '../../decorators';
|
|
9
9
|
|
|
10
10
|
@component
|
|
11
11
|
export class UISeparator extends UIElement {
|
|
@@ -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-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { UIElement } from '../element';
|
|
8
|
+
import { component } from '../../decorators';
|
|
9
|
+
|
|
10
|
+
@component
|
|
11
|
+
export class UISpacer extends UIElement {
|
|
12
|
+
className(): string {
|
|
13
|
+
return 'UISpacer';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -7,16 +7,18 @@
|
|
|
7
7
|
@import (reference) '../../../styles/variables';
|
|
8
8
|
@import (reference) '../../../styles/mixins';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
--box-shadow: 0 4px 1px -2px rgba(76, 76, 76, 0.2),
|
|
10
|
+
:root {
|
|
11
|
+
--popup-box-shadow: 0 4px 1px -2px rgba(76, 76, 76, 0.2),
|
|
12
12
|
0 3px 3px 0 rgba(76, 76, 76, 0.15), 0 1px 4px 0 rgba(76, 76, 76, 0.13);
|
|
13
|
+
}
|
|
13
14
|
|
|
15
|
+
.jodit-popup {
|
|
14
16
|
.jodit-box();
|
|
15
17
|
|
|
16
18
|
position: fixed;
|
|
17
19
|
z-index: var(--z-index-popup);
|
|
18
20
|
display: inline-block;
|
|
19
|
-
box-shadow: var(--box-shadow);
|
|
21
|
+
box-shadow: var(--popup-box-shadow);
|
|
20
22
|
transform: translate3d(0, 0, 0);
|
|
21
23
|
|
|
22
24
|
&__content {
|