@kubex/zinc 1.0.8 → 1.0.10
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/dist/custom-elements.json +229 -10
- package/dist/vscode.html-custom-data.json +15 -2
- package/dist/web-types.json +64 -5
- package/dist/zn.d.ts +40 -2
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +385 -372
- package/docs/pages/components/button.md +14 -0
- package/docs/pages/components/dropdown.md +6 -1
- package/docs/pages/components/table.md +1 -1
- package/package.json +1 -1
- package/scss/themes/_light.scss +1 -1
- package/src/components/button/button.component.ts +12 -20
- package/src/components/button/button.scss +3 -33
- package/src/components/button-menu/button-menu.component.ts +1 -0
- package/src/components/content-block/content-block.scss +54 -0
- package/src/components/data-table/data-table.component.ts +22 -3
- package/src/components/editor/editor.component.ts +110 -55
- package/src/components/editor/editor.scss +0 -1
- package/src/components/editor/modules/context-menu/context-menu-component.ts +1 -0
- package/src/components/editor/modules/context-menu/context-menu.scss +1 -1
- package/src/components/editor/modules/context-menu/context-menu.ts +58 -26
- package/src/components/editor/modules/context-menu/quick-action/quick-action.component.ts +1 -0
- package/src/components/editor/modules/toolbar/toolbar.component.ts +61 -33
- package/src/components/editor/modules/toolbar/toolbar.ts +19 -4
- package/src/components/header/header.scss +1 -0
- package/src/components/menu/menu.component.ts +2 -1
- package/src/components/menu-item/menu-item.component.ts +4 -0
- package/src/components/note/note.component.ts +2 -25
- package/src/components/note/note.scss +0 -7
- package/src/components/order-table/order-table.scss +16 -10
- package/src/components/panel/panel.component.ts +9 -3
- package/src/components/panel/panel.scss +8 -0
- package/src/components/popup/popup.component.ts +11 -21
- package/src/components/settings-container/settings-container.component.ts +22 -16
- package/src/components/settings-container/settings-container.scss +5 -4
- package/src/components/tabs/tabs.component.ts +24 -6
- package/src/components/tooltip/tooltip.component.ts +7 -7
- package/src/internal/form.ts +41 -3
|
@@ -34,6 +34,20 @@ The `auto-click` attribute can be added to a button to make it automatically cli
|
|
|
34
34
|
color="transparent"
|
|
35
35
|
></zn-button>
|
|
36
36
|
</zn-button auto-click>
|
|
37
|
+
|
|
38
|
+
<br>
|
|
39
|
+
<br>
|
|
40
|
+
|
|
41
|
+
<zn-button color="success" auto-click auto-click-delay="10000" loading-text="Accepting">
|
|
42
|
+
Test Auto Button
|
|
43
|
+
<zn-style slot="cancel" margin="l">
|
|
44
|
+
<zn-button
|
|
45
|
+
icon="call_end"
|
|
46
|
+
icon-size="18"
|
|
47
|
+
type="button"
|
|
48
|
+
color="error"
|
|
49
|
+
></zn-button></zn-style>
|
|
50
|
+
</zn-button>
|
|
37
51
|
```
|
|
38
52
|
|
|
39
53
|
### Variants
|
|
@@ -6,7 +6,12 @@ layout: component
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
```html:preview
|
|
9
|
-
<zn-dropdown
|
|
9
|
+
<zn-dropdown t="[object Object]" placement="bottom-start">
|
|
10
|
+
<zn-menu actions="[{"confirm":{"type":"success","trigger":"reactivate10","caption":"Reactivate Access","content":"Are you sure you want to reactivate access for John Doe?","action":"#"},"title":"Reactivate Access","style":"success"}]" t="[object Object]" role="menu"></zn-menu>
|
|
11
|
+
<button slot="trigger">
|
|
12
|
+
<zn-icon src="more_vert" t="[object Object]" size="24" library="material-symbols-outlined"></zn-icon>
|
|
13
|
+
</button>
|
|
14
|
+
</zn-dropdown>
|
|
10
15
|
```
|
|
11
16
|
|
|
12
17
|
## Examples
|
|
@@ -6,7 +6,7 @@ layout: component
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
```html:preview
|
|
9
|
-
<zn-table></zn-table>
|
|
9
|
+
<zn-table fixed-first="" t="light" has-actions="" data="{"header":["Full Name","User ID","Email","Type","Partner","State","Date Joined"],"items": [{"actions": [{"confirm": {"type": "success","trigger": "reactivate10","caption": "Reactivate Access","content": "Are you sure you want to reactivate access for John Doe?","action": "#"},"title": "Reactivate Access","style": "success"}],"caption": "John Doe","data": ["1","john.doe@example.com","Member","","<span class='zn-success'>Active</span>","2025-01-01 12:10:20"]}]}"></zn-table>
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
## Examples
|
package/package.json
CHANGED
package/scss/themes/_light.scss
CHANGED
|
@@ -361,26 +361,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
361
361
|
${this.content}
|
|
362
362
|
</slot>
|
|
363
363
|
${this.iconPosition === 'right' ? icon : ''}
|
|
364
|
-
${this.
|
|
365
|
-
<div class="button--loading-container">
|
|
366
|
-
<span
|
|
367
|
-
class=${classMap({
|
|
368
|
-
'button--loading-text-bottom': true,
|
|
369
|
-
'button--loading-text-bottom-transparent': this.color === 'transparent',
|
|
370
|
-
[`button--loading-text-bottom-${this.loadingTextPosition}`]: !!this.loadingTextPosition,
|
|
371
|
-
})}>
|
|
372
|
-
${this.loadingText}<span class="loading-countdown"></span>
|
|
373
|
-
</span>
|
|
374
|
-
<span
|
|
375
|
-
class=${classMap({
|
|
376
|
-
'button--loading-text-top': true,
|
|
377
|
-
'button--loading-text-top-transparent': this.color === 'transparent',
|
|
378
|
-
[`button--loading-text-top-${this.loadingTextPosition}`]: !!this.loadingTextPosition,
|
|
379
|
-
})}>
|
|
380
|
-
${this.loadingText}<span class="loading-countdown"></span>
|
|
381
|
-
</span>
|
|
382
|
-
</div>
|
|
383
|
-
` : null}
|
|
364
|
+
${this._getLoadingContainer()}
|
|
384
365
|
</${tag}>`;
|
|
385
366
|
|
|
386
367
|
let content = this.autoClick ? html`
|
|
@@ -401,4 +382,15 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
|
|
|
401
382
|
|
|
402
383
|
return content;
|
|
403
384
|
}
|
|
385
|
+
|
|
386
|
+
private _getLoadingContainer() {
|
|
387
|
+
return html`
|
|
388
|
+
${this.loading ? html`
|
|
389
|
+
<div class="button--loading-container">
|
|
390
|
+
<span class="button--loading-text">
|
|
391
|
+
${this.loadingText}<span class="loading-countdown"></span>
|
|
392
|
+
</span>
|
|
393
|
+
</div>
|
|
394
|
+
` : null}`;
|
|
395
|
+
}
|
|
404
396
|
}
|
|
@@ -312,8 +312,6 @@
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
.button--loading-bg {
|
|
315
|
-
background-color: #e0e0e0;
|
|
316
|
-
|
|
317
315
|
&-transparent {
|
|
318
316
|
background-color: transparent;
|
|
319
317
|
}
|
|
@@ -347,7 +345,8 @@
|
|
|
347
345
|
pointer-events: none;
|
|
348
346
|
}
|
|
349
347
|
|
|
350
|
-
&-text
|
|
348
|
+
&-text {
|
|
349
|
+
z-index: 5;
|
|
351
350
|
width: 100%;
|
|
352
351
|
height: 100%;
|
|
353
352
|
display: flex;
|
|
@@ -357,9 +356,8 @@
|
|
|
357
356
|
font-weight: inherit;
|
|
358
357
|
user-select: none;
|
|
359
358
|
position: absolute;
|
|
360
|
-
top: 0;
|
|
361
|
-
left: 0;
|
|
362
359
|
pointer-events: none;
|
|
360
|
+
color: inherit;
|
|
363
361
|
|
|
364
362
|
.loading-countdown {
|
|
365
363
|
margin-left: 3px;
|
|
@@ -375,25 +373,6 @@
|
|
|
375
373
|
padding-inline-end: 7px;
|
|
376
374
|
}
|
|
377
375
|
}
|
|
378
|
-
|
|
379
|
-
&-text-bottom {
|
|
380
|
-
z-index: 2;
|
|
381
|
-
color: rgba(var(--btn-color), .85);
|
|
382
|
-
|
|
383
|
-
&-transparent {
|
|
384
|
-
color: inherit;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
&-text-top {
|
|
389
|
-
z-index: 3;
|
|
390
|
-
color: inherit;
|
|
391
|
-
/* Animate the reveal from left to right using a mask */
|
|
392
|
-
mask-image: linear-gradient(90deg, #000 0%, #000 100%);
|
|
393
|
-
mask-size: 0 100%;
|
|
394
|
-
mask-repeat: no-repeat;
|
|
395
|
-
animation: loading-text-reveal var(--loading-duration, 2s) linear forwards;
|
|
396
|
-
}
|
|
397
376
|
}
|
|
398
377
|
|
|
399
378
|
.button--relative-wrapper {
|
|
@@ -412,15 +391,6 @@
|
|
|
412
391
|
}
|
|
413
392
|
}
|
|
414
393
|
|
|
415
|
-
@keyframes loading-text-reveal {
|
|
416
|
-
from {
|
|
417
|
-
mask-size: 0 100%;
|
|
418
|
-
}
|
|
419
|
-
to {
|
|
420
|
-
mask-size: 100% 100%;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
394
|
:host([vertical-align="center"]) {
|
|
425
395
|
align-self: center;
|
|
426
396
|
}
|
|
@@ -307,6 +307,7 @@ export default class ZnButtonMenu extends ZincElement {
|
|
|
307
307
|
public setDynamicButtons(btns: NodeListOf<ZnButton>) {
|
|
308
308
|
// remove all buttons that have the zn-button-menu__added class
|
|
309
309
|
this.removeAllButtons();
|
|
310
|
+
if (!btns || btns.length === 0) return;
|
|
310
311
|
|
|
311
312
|
// add the new buttons
|
|
312
313
|
btns.forEach((button: ZnButton) => {
|
|
@@ -72,3 +72,57 @@ zn-panel:not(.content-block--short) zn-header::part(header-description) {
|
|
|
72
72
|
.hidden {
|
|
73
73
|
display: none;
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
li[data-list="ordered"] {
|
|
77
|
+
counter-increment: list-0 1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@supports (counter-set:none) {
|
|
81
|
+
li[data-list] {
|
|
82
|
+
counter-set: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
li[data-list=bullet] > .ql-ui:before {
|
|
87
|
+
content: "•";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
li[data-list=checked] > .ql-ui:before {
|
|
91
|
+
content: "☑";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
li[data-list=unchecked] > .ql-ui:before {
|
|
95
|
+
content: "☐";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
li[data-list="ordered"] > .ql-ui::before {
|
|
99
|
+
content: counter(list-0) ". ";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
ol {
|
|
103
|
+
padding: 0;
|
|
104
|
+
margin: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
li[data-list=checked] > .ql-ui, li[data-list=unchecked] > .ql-ui {
|
|
108
|
+
color: #777;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ql-ui {
|
|
112
|
+
position: absolute;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
li {
|
|
116
|
+
list-style-type: none;
|
|
117
|
+
padding-left: 1em;
|
|
118
|
+
position: relative;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
li > .ql-ui::before {
|
|
122
|
+
display: inline-block;
|
|
123
|
+
margin-left: -1.5em;
|
|
124
|
+
margin-right: 0.3em;
|
|
125
|
+
text-align: right;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
width: 1.2em;
|
|
128
|
+
}
|
|
@@ -90,6 +90,8 @@ interface HeaderConfig {
|
|
|
90
90
|
default?: boolean;
|
|
91
91
|
sortable?: boolean;
|
|
92
92
|
filterable?: boolean;
|
|
93
|
+
hideHeader?: boolean;
|
|
94
|
+
hideColumn?: boolean;
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
interface DataRequest {
|
|
@@ -427,6 +429,13 @@ export default class ZnDataTable extends ZincElement {
|
|
|
427
429
|
}
|
|
428
430
|
});
|
|
429
431
|
|
|
432
|
+
// remove empty groups
|
|
433
|
+
Object.keys(groupedRows).forEach((groupKey) => {
|
|
434
|
+
if (groupedRows[groupKey].length === 0) {
|
|
435
|
+
delete groupedRows[groupKey];
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
|
|
430
439
|
// render a table for each group
|
|
431
440
|
return html`
|
|
432
441
|
<zn-sp flush>
|
|
@@ -449,7 +458,10 @@ export default class ZnDataTable extends ZincElement {
|
|
|
449
458
|
}
|
|
450
459
|
|
|
451
460
|
public renderTableData(data: any) {
|
|
452
|
-
const filteredHeaders = Object.values(this.headers).filter((header) => {
|
|
461
|
+
const filteredHeaders = Object.values(this.headers).filter((header: HeaderConfig) => {
|
|
462
|
+
if (header.hideHeader || header.hideColumn) {
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
453
465
|
return !Object.values(this.hiddenColumns).includes(header.key);
|
|
454
466
|
});
|
|
455
467
|
|
|
@@ -608,7 +620,7 @@ export default class ZnDataTable extends ZincElement {
|
|
|
608
620
|
|| this.hasSlotController.test(ActionSlots.modify.valueOf())
|
|
609
621
|
|| this.hasSlotController.test(ActionSlots.create.valueOf());
|
|
610
622
|
|
|
611
|
-
if(!hasSlots) {
|
|
623
|
+
if (!hasSlots) {
|
|
612
624
|
return [];
|
|
613
625
|
}
|
|
614
626
|
|
|
@@ -909,6 +921,13 @@ export default class ZnDataTable extends ZincElement {
|
|
|
909
921
|
}
|
|
910
922
|
|
|
911
923
|
private renderCellBody(index: number, value: Cell) {
|
|
924
|
+
const filteredHeaders = Object.values(this.headers).filter((header: HeaderConfig) => {
|
|
925
|
+
if (header.hideHeader || header.hideColumn) {
|
|
926
|
+
return false;
|
|
927
|
+
}
|
|
928
|
+
return !Object.values(this.hiddenColumns).includes(header.key);
|
|
929
|
+
});
|
|
930
|
+
|
|
912
931
|
const headerKeys: string[] = Object.keys(this.headers).filter(
|
|
913
932
|
(key) => !Object.values(this.hiddenColumns).includes(key)
|
|
914
933
|
);
|
|
@@ -920,7 +939,7 @@ export default class ZnDataTable extends ZincElement {
|
|
|
920
939
|
class="${classMap({
|
|
921
940
|
'table__cell': true,
|
|
922
941
|
'table__cell--wide': headerKey === this.wideColumn,
|
|
923
|
-
'table__cell--last':
|
|
942
|
+
'table__cell--last': index === filteredHeaders.length - 1,
|
|
924
943
|
})}">
|
|
925
944
|
<div>${this.renderCell(value)}</div>
|
|
926
945
|
</td>`;
|
|
@@ -25,6 +25,18 @@ import type ToolbarComponent from "./modules/toolbar/toolbar.component";
|
|
|
25
25
|
|
|
26
26
|
import styles from './editor.scss';
|
|
27
27
|
|
|
28
|
+
export interface EditorFeatureConfig {
|
|
29
|
+
codeBlocksEnabled?: boolean;
|
|
30
|
+
dividersEnabled?: boolean;
|
|
31
|
+
linksEnabled?: boolean;
|
|
32
|
+
attachmentsEnabled?: boolean;
|
|
33
|
+
imagesEnabled?: boolean;
|
|
34
|
+
videosEnabled?: boolean;
|
|
35
|
+
datesEnabled?: boolean;
|
|
36
|
+
emojisEnabled?: boolean;
|
|
37
|
+
codeEnabled?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
/**
|
|
29
41
|
* @summary Short summary of the component's intended use.
|
|
30
42
|
* @documentation https://zinc.style/components/editor
|
|
@@ -66,6 +78,17 @@ export default class ZnEditor extends ZincElement implements ZincFormControl {
|
|
|
66
78
|
@property({attribute: 'attachment-url', type: String})
|
|
67
79
|
uploadAttachmentUrl: string;
|
|
68
80
|
|
|
81
|
+
/* Feature Permission Attributes */
|
|
82
|
+
@property({attribute: 'code-blocks', type: Boolean}) codeBlocksEnabled: boolean = false;
|
|
83
|
+
@property({attribute: 'dividers', type: Boolean}) dividersEnabled: boolean = false;
|
|
84
|
+
@property({attribute: 'links', type: Boolean}) linksEnabled: boolean = false;
|
|
85
|
+
@property({attribute: 'attachments', type: Boolean}) attachmentsEnabled: boolean = false;
|
|
86
|
+
@property({attribute: 'images', type: Boolean}) imagesEnabled: boolean = false;
|
|
87
|
+
@property({attribute: 'videos', type: Boolean}) videosEnabled: boolean = false;
|
|
88
|
+
@property({attribute: 'dates', type: Boolean}) datesEnabled: boolean = false;
|
|
89
|
+
@property({attribute: 'emojis', type: Boolean}) emojisEnabled: boolean = false;
|
|
90
|
+
@property({attribute: 'code', type: Boolean}) codeEnabled: boolean = false;
|
|
91
|
+
@property({attribute: 'ai', type: Boolean}) aiEnabled: boolean = false;
|
|
69
92
|
@property({attribute: 'ai-path'}) aiPath: string = '';
|
|
70
93
|
|
|
71
94
|
private quillElement: Quill;
|
|
@@ -111,10 +134,16 @@ export default class ZnEditor extends ZincElement implements ZincFormControl {
|
|
|
111
134
|
});
|
|
112
135
|
|
|
113
136
|
Quill.register({'modules/toolbar': Toolbar}, true);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
137
|
+
if (this.datesEnabled) {
|
|
138
|
+
Quill.register({'modules/datePicker': DatePicker}, true);
|
|
139
|
+
}
|
|
140
|
+
if (this.emojisEnabled) {
|
|
141
|
+
Quill.register({'modules/emoji': Emoji}, true);
|
|
142
|
+
Quill.register({'modules/headlessEmoji': HeadlessEmoji}, true);
|
|
143
|
+
}
|
|
144
|
+
if (this.attachmentsEnabled) {
|
|
145
|
+
Quill.register({'modules/attachment': Attachment}, true);
|
|
146
|
+
}
|
|
118
147
|
Quill.register({'modules/timeTracking': TimeTracking}, true);
|
|
119
148
|
Quill.register({'modules/dragAndDrop': DragAndDrop}, true);
|
|
120
149
|
Quill.register({'modules/imageResize': ImageResize}, true);
|
|
@@ -122,80 +151,106 @@ export default class ZnEditor extends ZincElement implements ZincFormControl {
|
|
|
122
151
|
Quill.register({'modules/dialog': Dialog}, true);
|
|
123
152
|
|
|
124
153
|
/* AI Modules */
|
|
125
|
-
|
|
154
|
+
if (this.aiEnabled) {
|
|
155
|
+
Quill.register('modules/ai', QuillAI as any, true);
|
|
156
|
+
}
|
|
126
157
|
|
|
127
158
|
// Register a custom HR blot so we can insert an inline horizontal rule block
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
159
|
+
if (this.dividersEnabled) {
|
|
160
|
+
const BlockEmbed = Quill.import('blots/block/embed') as { new(...args: any[]): any };
|
|
161
|
+
|
|
162
|
+
class HrBlot extends BlockEmbed {
|
|
163
|
+
static blotName = 'hr';
|
|
164
|
+
static tagName = 'HR';
|
|
165
|
+
static className = 'ql-hr';
|
|
166
|
+
|
|
167
|
+
static create(): HTMLElement {
|
|
168
|
+
const node = document.createElement('hr');
|
|
169
|
+
node.classList.add('ql-hr');
|
|
170
|
+
return node;
|
|
171
|
+
}
|
|
139
172
|
}
|
|
140
|
-
}
|
|
141
173
|
|
|
142
|
-
|
|
174
|
+
Quill.register({'formats/hr': HrBlot}, true);
|
|
175
|
+
}
|
|
143
176
|
|
|
144
|
-
const attachmentInput = this.getForm()?.querySelector('input[name="attachments"]');
|
|
145
177
|
const startTimeInput = this.getForm()?.querySelector('input[name="startTime"]');
|
|
146
178
|
const openTimeInput = this.getForm()?.querySelector('input[name="openTime"]');
|
|
147
179
|
|
|
180
|
+
const featureConfig: EditorFeatureConfig = {
|
|
181
|
+
codeBlocksEnabled: this.codeBlocksEnabled,
|
|
182
|
+
dividersEnabled: this.dividersEnabled,
|
|
183
|
+
linksEnabled: this.linksEnabled,
|
|
184
|
+
attachmentsEnabled: this.attachmentsEnabled,
|
|
185
|
+
imagesEnabled: this.imagesEnabled,
|
|
186
|
+
videosEnabled: this.videosEnabled,
|
|
187
|
+
datesEnabled: this.datesEnabled,
|
|
188
|
+
emojisEnabled: this.emojisEnabled,
|
|
189
|
+
codeEnabled: this.codeEnabled,
|
|
190
|
+
};
|
|
191
|
+
|
|
148
192
|
const quill = new Quill(this.editor, {
|
|
149
193
|
modules: {
|
|
150
194
|
toolbar: {
|
|
151
195
|
container: this.toolbar,
|
|
196
|
+
config: featureConfig
|
|
197
|
+
},
|
|
198
|
+
contextMenu: {
|
|
199
|
+
config: featureConfig
|
|
152
200
|
},
|
|
153
|
-
contextMenu: {},
|
|
154
201
|
keyboard: {
|
|
155
202
|
bindings: bindings
|
|
156
203
|
},
|
|
157
204
|
dialog: {
|
|
158
205
|
editorId: this.id
|
|
159
206
|
},
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
207
|
+
...(this.datesEnabled && {
|
|
208
|
+
datePicker: {}
|
|
209
|
+
}),
|
|
210
|
+
...(this.emojisEnabled && {
|
|
211
|
+
emoji: {},
|
|
212
|
+
headlessEmoji: {},
|
|
213
|
+
}),
|
|
214
|
+
...(this.aiEnabled && {
|
|
215
|
+
ai: {
|
|
216
|
+
path: this.aiPath
|
|
217
|
+
}
|
|
218
|
+
}),
|
|
166
219
|
timeTracking: {
|
|
167
220
|
startTimeInput: startTimeInput as HTMLInputElement,
|
|
168
221
|
openTimeInput: openTimeInput as HTMLInputElement
|
|
169
222
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
223
|
+
...(this.attachmentsEnabled && {
|
|
224
|
+
attachment: {
|
|
225
|
+
attachmentInput: this.getForm()?.querySelector('input[name="attachments"]'),
|
|
226
|
+
onFileUploaded: () => {
|
|
227
|
+
window.onbeforeunload = () => null;
|
|
228
|
+
},
|
|
229
|
+
upload: (file: File) => {
|
|
230
|
+
window.onbeforeunload = () => 'You have unsaved changes. Are you sure you want to leave?';
|
|
231
|
+
return new Promise((resolve) => {
|
|
232
|
+
const fd = new FormData();
|
|
233
|
+
fd.append('filename', file.name);
|
|
234
|
+
fd.append('size', file.size.toString());
|
|
235
|
+
fd.append('mimeType', file.type);
|
|
236
|
+
|
|
237
|
+
const xhr = new XMLHttpRequest();
|
|
238
|
+
xhr.open('POST', this.uploadAttachmentUrl, true);
|
|
239
|
+
xhr.onload = () => {
|
|
240
|
+
if (xhr.status === 200) {
|
|
241
|
+
const response = JSON.parse(xhr.responseText) as {
|
|
242
|
+
uploadPath: string;
|
|
243
|
+
uploadUrl: string;
|
|
244
|
+
originalFilename: string;
|
|
245
|
+
};
|
|
246
|
+
resolve({path: response.uploadPath, url: response.uploadUrl, filename: response.originalFilename});
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
xhr.send(fd);
|
|
250
|
+
});
|
|
251
|
+
},
|
|
174
252
|
},
|
|
175
|
-
|
|
176
|
-
window.onbeforeunload = () => 'You have unsaved changes. Are you sure you want to leave?';
|
|
177
|
-
return new Promise((resolve) => {
|
|
178
|
-
const fd = new FormData();
|
|
179
|
-
fd.append('filename', file.name);
|
|
180
|
-
fd.append('size', file.size.toString());
|
|
181
|
-
fd.append('mimeType', file.type);
|
|
182
|
-
|
|
183
|
-
const xhr = new XMLHttpRequest();
|
|
184
|
-
xhr.open('POST', this.uploadAttachmentUrl, true);
|
|
185
|
-
xhr.onload = () => {
|
|
186
|
-
if (xhr.status === 200) {
|
|
187
|
-
const response = JSON.parse(xhr.responseText) as {
|
|
188
|
-
uploadPath: string;
|
|
189
|
-
uploadUrl: string;
|
|
190
|
-
originalFilename: string;
|
|
191
|
-
};
|
|
192
|
-
resolve({path: response.uploadPath, url: response.uploadUrl, filename: response.originalFilename});
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
xhr.send(fd);
|
|
196
|
-
});
|
|
197
|
-
},
|
|
198
|
-
},
|
|
253
|
+
}),
|
|
199
254
|
imageResize: {},
|
|
200
255
|
history: {}
|
|
201
256
|
},
|
|
@@ -339,7 +394,7 @@ export default class ZnEditor extends ZincElement implements ZincFormControl {
|
|
|
339
394
|
const emoji = this.quillElement.getModule('headlessEmoji') as HeadlessEmoji;
|
|
340
395
|
const menu = this.quillElement.getModule('contextMenu') as ContextMenu;
|
|
341
396
|
const dialog = this.quillElement.getModule('dialog') as Dialog;
|
|
342
|
-
if (emoji
|
|
397
|
+
if (emoji?.isOpen() || menu?.isOpen() || dialog?.isOpen()) {
|
|
343
398
|
return false;
|
|
344
399
|
}
|
|
345
400
|
|