@sdcorejs/angular 20.3.1 → 20.3.2
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/assets/STYLE-GUIDE.md +25 -5
- package/assets/THEME.md +237 -5
- package/assets/licenses/tiptap-oss-NOTICES.txt +332 -0
- package/assets/scss/ckeditor5.scss +2 -88
- package/assets/scss/core/_control.scss +39 -0
- package/assets/scss/core/form.scss +156 -45
- package/assets/scss/core/view.scss +24 -0
- package/assets/scss/editor-content.scss +173 -0
- package/assets/scss/sd-core.scss +1 -0
- package/assets/scss/themes/_component-tokens.scss +93 -31
- package/assets/scss/themes/_material-tokens.scss +112 -0
- package/assets/scss/themes/_presets.scss +25 -0
- package/assets/scss/themes/_scales.scss +10 -0
- package/assets/scss/themes/_semantic.scss +13 -0
- package/assets/scss/themes/default.scss +8 -2
- package/components/avatar/index.d.ts +67 -2
- package/components/badge/index.d.ts +188 -6
- package/components/button/index.d.ts +20 -1
- package/components/ckeditor-styles/index.d.ts +3 -18
- package/components/editor/index.d.ts +20 -17
- package/components/editor-engine/index.d.ts +246 -0
- package/components/file-explorer/index.d.ts +4 -2
- package/components/form-generic/index.d.ts +246 -35
- package/components/index.d.ts +1 -0
- package/components/mini-editor/index.d.ts +33 -70
- package/components/modal-resizable/index.d.ts +1 -124
- package/components/operator/index.d.ts +137 -8
- package/components/tab-router/index.d.ts +31 -18
- package/components/table/index.d.ts +84 -6
- package/components/window/index.d.ts +81 -0
- package/configurations/index.d.ts +8 -1
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +5 -5
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +142 -11
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +548 -24
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +33 -3
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +5 -20
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1872 -0
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-editor.mjs +457 -756
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +68 -37
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +2115 -1156
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +5 -2
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +21 -6
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +12 -2
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +177 -283
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +1 -308
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +262 -43
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +12 -12
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +192 -42
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +564 -110
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-view.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-window.mjs +486 -0
- package/fesm2022/sdcorejs-angular-components-window.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-configurations.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +18 -1
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +15 -2
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +460 -125
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +75 -13
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +71 -18
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +75 -16
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +82 -2
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +40 -5
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +50 -7
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-models.mjs +88 -5
- package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs +5 -4
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +63 -15
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +1535 -22
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-DnbDCdcz.mjs +478 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-DnbDCdcz.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-EBHM4kx2.mjs +214 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-EBHM4kx2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-BtHe8YIW.mjs +277 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-BtHe8YIW.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-eFshU7ew.mjs +1556 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-eFshU7ew.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +96 -3
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +1825 -62
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules.mjs +1 -0
- package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-pipes.mjs +27 -7
- package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-date-time.mjs +143 -0
- package/fesm2022/sdcorejs-angular-services-date-time.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-services-storage.mjs +44 -8
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services.mjs +1 -0
- package/fesm2022/sdcorejs-angular-services.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs +4 -0
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs +10 -0
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -1
- package/forms/autocomplete/index.d.ts +5 -0
- package/forms/chip-calendar/index.d.ts +163 -18
- package/forms/date/index.d.ts +23 -2
- package/forms/date-range/index.d.ts +24 -2
- package/forms/directives/index.d.ts +47 -2
- package/forms/input/index.d.ts +23 -2
- package/forms/input-number/index.d.ts +23 -2
- package/forms/models/index.d.ts +38 -3
- package/forms/select/index.d.ts +32 -2
- package/i18n/index.d.ts +302 -2
- package/modules/generic/index.d.ts +316 -0
- package/modules/icon/index.d.ts +37 -6
- package/modules/index.d.ts +1 -0
- package/modules/layout/index.d.ts +536 -86
- package/package.json +41 -8
- package/pipes/index.d.ts +2 -0
- package/services/date-time/index.d.ts +57 -0
- package/services/index.d.ts +1 -0
- package/services/storage/index.d.ts +8 -1
- package/utilities/read-state/index.d.ts +2 -0
- package/utilities/theme/index.d.ts +1 -1
|
@@ -1,337 +1,231 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { output,
|
|
4
|
-
import * as i1 from '@ckeditor/ckeditor5-angular';
|
|
5
|
-
import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
|
|
6
|
-
import { SdCKEditorStyles } from '@sdcorejs/angular/components/ckeditor-styles';
|
|
7
|
-
import { ClassicEditor, Essentials, FontColor, Paragraph, Bold, Italic, Underline, Link, List, Undo, Widget, Markdown, Mention, HtmlDataProcessor } from 'ckeditor5';
|
|
8
|
-
import { Subscription, Subject } from 'rxjs';
|
|
9
|
-
import { throttleTime } from 'rxjs/operators';
|
|
2
|
+
import { input, output, signal, computed, inject, ChangeDetectorRef, effect, forwardRef, HostBinding, Input, Component } from '@angular/core';
|
|
10
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
11
|
-
import {
|
|
4
|
+
import { SdEditorSurface } from '@sdcorejs/angular/components/editor-engine';
|
|
5
|
+
export { SdEditorImportError } from '@sdcorejs/angular/components/editor-engine';
|
|
12
6
|
|
|
13
|
-
/**
|
|
14
|
-
* Component sd-mini-editor - Editor đơn giản cho comment input
|
|
15
|
-
* Sử dụng CKEditor với chế độ đơn giản (bold, italic, link)
|
|
16
|
-
* Hỗ trợ mention và output format (html/markdown)
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```html
|
|
20
|
-
* <sd-mini-editor
|
|
21
|
-
* [option]="editorOption"
|
|
22
|
-
* [(ngModel)]="content"
|
|
23
|
-
* (contentChange)="onContentChange($event)"
|
|
24
|
-
* >
|
|
25
|
-
* </sd-mini-editor>
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
7
|
+
/** Compact Core toolbar with the same document schema as SdEditor. */
|
|
28
8
|
class SdMiniEditor {
|
|
29
|
-
/** Cấu hình option cho editor */
|
|
30
9
|
option;
|
|
31
|
-
get maxEditorHeight() {
|
|
32
|
-
return this.option?.maxHeight;
|
|
33
|
-
}
|
|
34
|
-
/** NgModel binding - nội dung HTML/Markdown */
|
|
35
10
|
value = '';
|
|
11
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
36
12
|
valueChange = output();
|
|
37
|
-
/** Event emitter khi content thay đổi */
|
|
38
13
|
contentChange = output();
|
|
39
|
-
/** Event emitter khi blur */
|
|
40
14
|
blur = output();
|
|
41
|
-
/** Event emitter khi focus */
|
|
42
15
|
focus = output();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
// Build base config
|
|
63
|
-
const config = {
|
|
64
|
-
licenseKey: 'GPL',
|
|
65
|
-
getOption: () => this.option,
|
|
66
|
-
plugins,
|
|
67
|
-
toolbar: {
|
|
68
|
-
items: ['bold', 'italic', 'underline', '|', 'fontColor', '|', 'bulletedList', 'numberedList', '|', 'link'],
|
|
69
|
-
shouldNotGroupWhenFull: true,
|
|
70
|
-
},
|
|
71
|
-
placeholder: this.option?.placeholder,
|
|
72
|
-
link: {
|
|
73
|
-
addTargetToExternalLinks: true,
|
|
74
|
-
defaultProtocol: 'https://',
|
|
75
|
-
// why: mặc định CKEditor cho cả ftp/ftps; link trong bình luận chỉ cần web, mail và điện thoại.
|
|
76
|
-
allowedProtocols: ['https', 'http', 'mailto', 'tel'],
|
|
77
|
-
},
|
|
78
|
-
fontColor: {
|
|
79
|
-
columns: 5,
|
|
80
|
-
documentColors: 10,
|
|
81
|
-
colorPicker: { format: 'hex' },
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
// Add mention configuration if enabled
|
|
85
|
-
if (enableMention && this.option?.mentionConfig?.feeds) {
|
|
86
|
-
config.mention = {
|
|
87
|
-
feeds: this.option.mentionConfig.feeds,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
return config;
|
|
16
|
+
importWarning = output();
|
|
17
|
+
#diagnostics = signal([], ...(ngDevMode ? [{ debugName: "#diagnostics" }] : []));
|
|
18
|
+
importDiagnostics = this.#diagnostics.asReadonly();
|
|
19
|
+
surfaceContent = signal('', ...(ngDevMode ? [{ debugName: "surfaceContent" }] : []));
|
|
20
|
+
#formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "#formDisabled" }] : []));
|
|
21
|
+
effectiveDisabled = computed(() => this.disabled() || this.#formDisabled(), ...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : []));
|
|
22
|
+
#cdRef = inject(ChangeDetectorRef);
|
|
23
|
+
#engine;
|
|
24
|
+
#timer;
|
|
25
|
+
#trailing;
|
|
26
|
+
#deadline;
|
|
27
|
+
#composing = false;
|
|
28
|
+
#formatPending = false;
|
|
29
|
+
#destroyed = false;
|
|
30
|
+
#onChange = () => { };
|
|
31
|
+
#onTouched = () => { };
|
|
32
|
+
get maxEditorHeight() {
|
|
33
|
+
return this.option?.maxHeight;
|
|
91
34
|
}
|
|
92
35
|
constructor() {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.#onChange(output);
|
|
98
|
-
this.valueChange.emit(output);
|
|
99
|
-
this.contentChange.emit(output);
|
|
100
|
-
this.option?.onChange?.(output);
|
|
101
|
-
}));
|
|
36
|
+
effect(() => {
|
|
37
|
+
if (this.effectiveDisabled())
|
|
38
|
+
this.onSourceChange();
|
|
39
|
+
});
|
|
102
40
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
41
|
+
ngOnChanges(changes) {
|
|
42
|
+
if (changes['value'])
|
|
43
|
+
this.setContent(this.value);
|
|
106
44
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return this.option?.enableMention ?? false;
|
|
45
|
+
onEngineReady(engine) {
|
|
46
|
+
this.onSourceChange();
|
|
47
|
+
this.#composing = false;
|
|
48
|
+
this.#engine = engine;
|
|
112
49
|
}
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (this.value) {
|
|
120
|
-
this.setContent(this.value);
|
|
50
|
+
/** Cancel a stale throttle window before replacing an authoritative source. */
|
|
51
|
+
onSourceChange(reason = 'source') {
|
|
52
|
+
this.#clearTimer();
|
|
53
|
+
if (reason === 'format') {
|
|
54
|
+
this.#formatPending = true;
|
|
55
|
+
return;
|
|
121
56
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const marker = rawId[0];
|
|
152
|
-
const cleanId = rawId.slice(1);
|
|
153
|
-
return writer.createAttributeElement('span', {
|
|
154
|
-
class: 'ck-custom-mention',
|
|
155
|
-
'data-id': cleanId,
|
|
156
|
-
'data-marker': marker,
|
|
157
|
-
contenteditable: 'false',
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
converterPriority: 'highest',
|
|
161
|
-
});
|
|
162
|
-
// Xử lý keyboard để xóa mention 1 lần
|
|
163
|
-
editor.editing.view.document.on('keydown', (evt, data) => {
|
|
164
|
-
const keyEvent = data;
|
|
165
|
-
// Delete (46) hoặc Backspace (8)
|
|
166
|
-
if (keyEvent.keyCode === 46 || keyEvent.keyCode === 8) {
|
|
167
|
-
const model = editor.model;
|
|
168
|
-
const selection = model.document.selection;
|
|
169
|
-
const position = selection.getFirstPosition();
|
|
170
|
-
if (!position)
|
|
171
|
-
return;
|
|
172
|
-
// Tìm text node có mention attribute
|
|
173
|
-
const node = position.textNode || position.nodeBefore || position.nodeAfter;
|
|
174
|
-
if (node && node.is('$text')) {
|
|
175
|
-
const mentionAttr = node.getAttribute('mention');
|
|
176
|
-
if (mentionAttr) {
|
|
177
|
-
// Xóa toàn bộ text node chứa mention
|
|
178
|
-
model.change(writer => {
|
|
179
|
-
writer.remove(node);
|
|
180
|
-
});
|
|
181
|
-
evt.stop();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
});
|
|
57
|
+
this.#formatPending = false;
|
|
58
|
+
this.#deadline = undefined;
|
|
59
|
+
this.#trailing = undefined;
|
|
60
|
+
}
|
|
61
|
+
onFormatChange(value) {
|
|
62
|
+
if (this.#destroyed || this.effectiveDisabled())
|
|
63
|
+
return;
|
|
64
|
+
// A refused conversion stays paused until a supported representation is
|
|
65
|
+
// restored. Retain the live pending edit without exporting stale HTML.
|
|
66
|
+
if (value === undefined)
|
|
67
|
+
return;
|
|
68
|
+
this.#formatPending = false;
|
|
69
|
+
this.#trailing = undefined;
|
|
70
|
+
if (value !== this.value)
|
|
71
|
+
this.onSurfaceChange(value);
|
|
72
|
+
if (this.#deadline !== undefined)
|
|
73
|
+
this.#scheduleWindow();
|
|
74
|
+
}
|
|
75
|
+
onSurfaceChange(value) {
|
|
76
|
+
if (this.#destroyed || this.effectiveDisabled())
|
|
77
|
+
return;
|
|
78
|
+
if (this.#composing || this.#formatPending) {
|
|
79
|
+
this.#trailing = value;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (this.#deadline === undefined) {
|
|
83
|
+
// App callbacks can replace content synchronously; establish the window first.
|
|
84
|
+
this.#startWindow();
|
|
85
|
+
this.#emit(value);
|
|
186
86
|
}
|
|
87
|
+
else
|
|
88
|
+
this.#trailing = value;
|
|
187
89
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
*/
|
|
192
|
-
#convertOutput() {
|
|
193
|
-
const editor = this.#editor;
|
|
194
|
-
if (!editor)
|
|
195
|
-
return '';
|
|
196
|
-
const html = this.#readSanitizedHtml(editor);
|
|
197
|
-
if (!this.#isMarkdown())
|
|
198
|
-
return html;
|
|
199
|
-
// why: dựng Markdown từ HTML ĐÃ lọc, để `[text](javascript:...)` không thể lọt vào chuỗi Markdown.
|
|
200
|
-
const htmlProcessor = new HtmlDataProcessor(editor.data.viewDocument);
|
|
201
|
-
return editor.data.processor.toData(htmlProcessor.toView(html));
|
|
90
|
+
#startWindow() {
|
|
91
|
+
this.#deadline = Date.now() + 500;
|
|
92
|
+
this.#scheduleWindow();
|
|
202
93
|
}
|
|
203
|
-
#
|
|
204
|
-
|
|
94
|
+
#scheduleWindow() {
|
|
95
|
+
if (this.#deadline === undefined || this.#composing || this.#formatPending || this.#destroyed)
|
|
96
|
+
return;
|
|
97
|
+
this.#clearTimer();
|
|
98
|
+
this.#timer = setTimeout(() => {
|
|
99
|
+
this.#timer = undefined;
|
|
100
|
+
this.#deadline = undefined;
|
|
101
|
+
const trailing = this.#trailing;
|
|
102
|
+
this.#trailing = undefined;
|
|
103
|
+
if (trailing !== undefined && !this.#destroyed && !this.#composing && !this.effectiveDisabled()) {
|
|
104
|
+
this.#startWindow();
|
|
105
|
+
this.#emit(trailing);
|
|
106
|
+
}
|
|
107
|
+
}, Math.max(0, this.#deadline - Date.now()));
|
|
108
|
+
}
|
|
109
|
+
onCompositionChange(composing) {
|
|
110
|
+
this.#composing = composing;
|
|
111
|
+
this.#clearTimer();
|
|
112
|
+
if (composing || this.#formatPending || this.#destroyed || this.effectiveDisabled())
|
|
113
|
+
return;
|
|
114
|
+
if (this.#deadline !== undefined)
|
|
115
|
+
this.#scheduleWindow();
|
|
116
|
+
else if (this.#trailing !== undefined) {
|
|
117
|
+
const value = this.#trailing;
|
|
118
|
+
this.#trailing = undefined;
|
|
119
|
+
this.#startWindow();
|
|
120
|
+
this.#emit(value);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
#clearTimer() {
|
|
124
|
+
if (this.#timer !== undefined)
|
|
125
|
+
clearTimeout(this.#timer);
|
|
126
|
+
this.#timer = undefined;
|
|
127
|
+
}
|
|
128
|
+
#emit(value) {
|
|
129
|
+
this.value = value;
|
|
130
|
+
this.#onChange(value);
|
|
131
|
+
this.valueChange.emit(value);
|
|
132
|
+
this.contentChange.emit(value);
|
|
133
|
+
this.option?.onChange?.(value);
|
|
134
|
+
this.#cdRef.markForCheck();
|
|
205
135
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
136
|
+
onSurfaceFocus(event) {
|
|
137
|
+
this.focus.emit(event);
|
|
138
|
+
this.option?.onFocus?.(event);
|
|
139
|
+
}
|
|
140
|
+
onSurfaceBlur(event) {
|
|
141
|
+
this.#onTouched();
|
|
142
|
+
this.blur.emit(event);
|
|
143
|
+
this.option?.onBlur?.(event);
|
|
144
|
+
this.#cdRef.markForCheck();
|
|
145
|
+
}
|
|
146
|
+
onDiagnostics(diagnostics) {
|
|
147
|
+
this.#diagnostics.set(diagnostics);
|
|
148
|
+
this.importWarning.emit(diagnostics);
|
|
149
|
+
}
|
|
150
|
+
onMentionSelected(item) {
|
|
151
|
+
this.option?.onMentionSelect?.(item);
|
|
217
152
|
}
|
|
218
|
-
/**
|
|
219
|
-
* Set nội dung cho editor
|
|
220
|
-
*/
|
|
221
153
|
setContent(content) {
|
|
222
|
-
|
|
154
|
+
const value = content ?? '';
|
|
155
|
+
this.value = value;
|
|
156
|
+
// Consumer echoes must not replay content or reset the current selection/history.
|
|
157
|
+
if (this.#isCurrentContent(value))
|
|
158
|
+
return;
|
|
159
|
+
this.onSourceChange();
|
|
160
|
+
this.surfaceContent.set(value);
|
|
161
|
+
this.#engine?.setContent(value, this.option?.outputFormat ?? 'html');
|
|
162
|
+
this.#cdRef.markForCheck();
|
|
163
|
+
}
|
|
164
|
+
#isCurrentContent(value) {
|
|
165
|
+
if (!this.#engine)
|
|
166
|
+
return value === this.surfaceContent();
|
|
167
|
+
try {
|
|
168
|
+
return this.#engine.format === (this.option?.outputFormat ?? 'html') && value === this.#engine.getContent();
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
223
173
|
}
|
|
224
|
-
/**
|
|
225
|
-
* Get nội dung từ editor
|
|
226
|
-
*/
|
|
227
174
|
getContent() {
|
|
228
|
-
return this.#
|
|
175
|
+
return this.#engine?.getContent() ?? '';
|
|
229
176
|
}
|
|
230
|
-
/**
|
|
231
|
-
* Nội dung dạng HTML (đã lọc), bất kể `outputFormat`.
|
|
232
|
-
*/
|
|
233
177
|
getHtmlContent() {
|
|
234
|
-
return this.#
|
|
178
|
+
return this.#engine?.getHtml() ?? '';
|
|
235
179
|
}
|
|
236
|
-
/**
|
|
237
|
-
* Focus vào editor
|
|
238
|
-
*/
|
|
239
180
|
focusEditor() {
|
|
240
|
-
this
|
|
181
|
+
if (!this.effectiveDisabled())
|
|
182
|
+
this.#engine?.focus();
|
|
241
183
|
}
|
|
242
|
-
/**
|
|
243
|
-
* Insert mention vào vị trí con trỏ hiện tại
|
|
244
|
-
*/
|
|
245
184
|
insertMention(item) {
|
|
246
|
-
if (!this.#
|
|
185
|
+
if (!this.#engine || !this.option?.enableMention || this.effectiveDisabled() || this.importDiagnostics().length)
|
|
247
186
|
return;
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this.#editor.execute('mention', {
|
|
252
|
-
marker,
|
|
253
|
-
mention: {
|
|
254
|
-
id: item.id,
|
|
255
|
-
text: `${marker}${item.name}`,
|
|
256
|
-
},
|
|
257
|
-
});
|
|
187
|
+
const marker = item.marker ?? this.option.mentionConfig?.feeds?.[0]?.marker ?? '@';
|
|
188
|
+
this.#engine.insertMention({ ...item, marker });
|
|
189
|
+
this.option.onMentionSelect?.({ id: item.id, name: item.name, text: `${marker}${item.name}` });
|
|
258
190
|
}
|
|
259
|
-
/**
|
|
260
|
-
* Get danh sách mentions trong nội dung
|
|
261
|
-
*/
|
|
262
191
|
getMentions() {
|
|
263
|
-
|
|
264
|
-
return [];
|
|
265
|
-
const mentions = [];
|
|
266
|
-
const root = this.#editor.model.document.getRoot();
|
|
267
|
-
if (!root)
|
|
268
|
-
return mentions;
|
|
269
|
-
const range = this.#editor.model.createRangeIn(root);
|
|
270
|
-
for (const item of range.getItems()) {
|
|
271
|
-
if (item.is('$text')) {
|
|
272
|
-
const mentionAttr = item.getAttribute('mention');
|
|
273
|
-
if (mentionAttr) {
|
|
274
|
-
const text = item.data;
|
|
275
|
-
const marker = text.charAt(0);
|
|
276
|
-
const name = text.substring(1);
|
|
277
|
-
const id = item.getAttribute('data-user-id');
|
|
278
|
-
mentions.push({ id, name, marker });
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return mentions;
|
|
192
|
+
return this.#engine?.getMentions() ?? [];
|
|
283
193
|
}
|
|
284
|
-
/**
|
|
285
|
-
* ControlValueAccessor: Write value
|
|
286
|
-
*/
|
|
287
194
|
writeValue(value) {
|
|
288
|
-
this.value
|
|
289
|
-
if (this.#editor) {
|
|
290
|
-
this.setContent(this.value);
|
|
291
|
-
}
|
|
195
|
+
this.setContent(value || '');
|
|
292
196
|
}
|
|
293
|
-
/**
|
|
294
|
-
* ControlValueAccessor: Register change callback
|
|
295
|
-
*/
|
|
296
197
|
registerOnChange(fn) {
|
|
297
198
|
this.#onChange = fn;
|
|
298
199
|
}
|
|
299
|
-
/**
|
|
300
|
-
* ControlValueAccessor: Register touched callback
|
|
301
|
-
*/
|
|
302
200
|
registerOnTouched(fn) {
|
|
303
201
|
this.#onTouched = fn;
|
|
304
202
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
203
|
+
setDisabledState(disabled) {
|
|
204
|
+
this.#formDisabled.set(disabled);
|
|
205
|
+
if (disabled)
|
|
206
|
+
this.onSourceChange();
|
|
207
|
+
this.#cdRef.markForCheck();
|
|
208
|
+
}
|
|
209
|
+
ngOnDestroy() {
|
|
210
|
+
this.#destroyed = true;
|
|
211
|
+
this.onSourceChange();
|
|
212
|
+
this.#engine = undefined; // Surface owns engine destruction.
|
|
213
|
+
}
|
|
308
214
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdMiniEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
309
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.25", type: SdMiniEditor, isStandalone: true, selector: "sd-mini-editor", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: false, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", contentChange: "contentChange", blur: "blur", focus: "focus" }, host: { properties: { "style.--sd-mini-editor-max-height": "this.maxEditorHeight" } }, providers: [
|
|
310
|
-
{
|
|
311
|
-
provide: NG_VALUE_ACCESSOR,
|
|
312
|
-
useExisting: forwardRef(() => SdMiniEditor),
|
|
313
|
-
multi: true,
|
|
314
|
-
},
|
|
315
|
-
], ngImport: i0, template: "<sd-ckeditor-styles />\n<ckeditor class=\"sd-mini-editor\" [editor]=\"Editor\" [config]=\"editorConfig\" [disabled]=\"disabled()\" (ready)=\"onReady($event)\"> </ckeditor>\n", styles: [".sd-mini-editor{display:block}::ng-deep .ck-powered-by-balloon{display:none!important}::ng-deep .ck-mentions .ck-button.ck-on{background:var(--sd-primary)!important;color:var(--sd-text-on-solid, #ffffff)!important}::ng-deep .ck-mentions .ck-button.ck-on *{color:var(--sd-text-on-solid, #ffffff)!important}:host ::ng-deep .ck-editor{--ck-content-font-size: 14px;--ck-content-line-height: 1.5}:host ::ng-deep .ck-editor__editable_inline{border:var(--ck-focus-ring);border-top-left-radius:0!important;border-top-right-radius:0!important;max-height:var(--sd-mini-editor-max-height);overflow:auto}:host ::ng-deep .ck-toolbar{border-radius:0;border:0!important}:host ::ng-deep .ck-content img{max-width:100%!important;height:auto!important;object-fit:contain}:host ::ng-deep .ck-content p{margin-bottom:var(--ck-spacing-large);text-indent:0}:host ::ng-deep .ck-content ul,:host ::ng-deep .ck-content ol{padding-left:20px!important;margin-left:0!important}:host ::ng-deep .ck-custom-mention{font-weight:var(--sd-font-weight-semibold, 600);padding:0 2px;display:inline-block;pointer-events:none;-webkit-user-select:none;user-select:none;color:var(--sd-primary, #005cbb)}:host ::ng-deep .ck-custom-mention:before{content:attr(data-marker)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: CKEditorModule }, { kind: "component", type: i1.CKEditorComponent, selector: "ckeditor", inputs: ["editor", "config", "data", "tagName", "watchdog", "editorWatchdogConfig", "disableWatchdog", "disableTwoWayDataBinding", "disabled"], outputs: ["ready", "change", "blur", "focus", "error"] }, { kind: "component", type: SdCKEditorStyles, selector: "sd-ckeditor-styles" }] });
|
|
215
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.25", type: SdMiniEditor, isStandalone: true, selector: "sd-mini-editor", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: false, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", contentChange: "contentChange", blur: "blur", focus: "focus", importWarning: "importWarning" }, host: { properties: { "style.--sd-mini-editor-max-height": "this.maxEditorHeight" } }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SdMiniEditor), multi: true }], usesOnChanges: true, ngImport: i0, template: "<sd-editor-surface\n class=\"sd-mini-editor\"\n variant=\"compact\"\n [content]=\"surfaceContent()\"\n [format]=\"option?.outputFormat ?? 'html'\"\n [editable]=\"!effectiveDisabled()\"\n [placeholder]=\"option?.placeholder\"\n [disabled]=\"effectiveDisabled()\"\n [height]=\"option?.height\"\n [maxHeight]=\"option?.maxHeight\"\n [mentionFeeds]=\"option?.enableMention ? option?.mentionConfig?.feeds : undefined\"\n (engineReady)=\"onEngineReady($event)\"\n (sourceChange)=\"onSourceChange($event)\"\n (formatChange)=\"onFormatChange($event)\"\n (compositionChange)=\"onCompositionChange($event)\"\n (change)=\"onSurfaceChange($event)\"\n (focus)=\"onSurfaceFocus($event)\"\n (blur)=\"onSurfaceBlur($event)\"\n (diagnostics)=\"onDiagnostics($event)\"\n (mentionSelected)=\"onMentionSelected($event)\" />\n", styles: [":host,.sd-mini-editor{display:block}\n"], dependencies: [{ kind: "component", type: SdEditorSurface, selector: "sd-editor-surface", inputs: ["content", "format", "variant", "editable", "disabled", "readonly", "placeholder", "mentionFeeds", "uploadEnabled", "height", "maxHeight", "label", "describedBy", "invalid", "id"], outputs: ["engineReady", "change", "focus", "blur", "diagnostics", "sourceChange", "formatChange", "compositionChange", "mentionSelected", "filesSelected"] }] });
|
|
316
216
|
}
|
|
317
217
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdMiniEditor, decorators: [{
|
|
318
218
|
type: Component,
|
|
319
|
-
args: [{ selector: 'sd-mini-editor', standalone: true, imports: [
|
|
320
|
-
{
|
|
321
|
-
provide: NG_VALUE_ACCESSOR,
|
|
322
|
-
useExisting: forwardRef(() => SdMiniEditor),
|
|
323
|
-
multi: true,
|
|
324
|
-
},
|
|
325
|
-
], template: "<sd-ckeditor-styles />\n<ckeditor class=\"sd-mini-editor\" [editor]=\"Editor\" [config]=\"editorConfig\" [disabled]=\"disabled()\" (ready)=\"onReady($event)\"> </ckeditor>\n", styles: [".sd-mini-editor{display:block}::ng-deep .ck-powered-by-balloon{display:none!important}::ng-deep .ck-mentions .ck-button.ck-on{background:var(--sd-primary)!important;color:var(--sd-text-on-solid, #ffffff)!important}::ng-deep .ck-mentions .ck-button.ck-on *{color:var(--sd-text-on-solid, #ffffff)!important}:host ::ng-deep .ck-editor{--ck-content-font-size: 14px;--ck-content-line-height: 1.5}:host ::ng-deep .ck-editor__editable_inline{border:var(--ck-focus-ring);border-top-left-radius:0!important;border-top-right-radius:0!important;max-height:var(--sd-mini-editor-max-height);overflow:auto}:host ::ng-deep .ck-toolbar{border-radius:0;border:0!important}:host ::ng-deep .ck-content img{max-width:100%!important;height:auto!important;object-fit:contain}:host ::ng-deep .ck-content p{margin-bottom:var(--ck-spacing-large);text-indent:0}:host ::ng-deep .ck-content ul,:host ::ng-deep .ck-content ol{padding-left:20px!important;margin-left:0!important}:host ::ng-deep .ck-custom-mention{font-weight:var(--sd-font-weight-semibold, 600);padding:0 2px;display:inline-block;pointer-events:none;-webkit-user-select:none;user-select:none;color:var(--sd-primary, #005cbb)}:host ::ng-deep .ck-custom-mention:before{content:attr(data-marker)}\n"] }]
|
|
219
|
+
args: [{ selector: 'sd-mini-editor', standalone: true, imports: [SdEditorSurface], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SdMiniEditor), multi: true }], template: "<sd-editor-surface\n class=\"sd-mini-editor\"\n variant=\"compact\"\n [content]=\"surfaceContent()\"\n [format]=\"option?.outputFormat ?? 'html'\"\n [editable]=\"!effectiveDisabled()\"\n [placeholder]=\"option?.placeholder\"\n [disabled]=\"effectiveDisabled()\"\n [height]=\"option?.height\"\n [maxHeight]=\"option?.maxHeight\"\n [mentionFeeds]=\"option?.enableMention ? option?.mentionConfig?.feeds : undefined\"\n (engineReady)=\"onEngineReady($event)\"\n (sourceChange)=\"onSourceChange($event)\"\n (formatChange)=\"onFormatChange($event)\"\n (compositionChange)=\"onCompositionChange($event)\"\n (change)=\"onSurfaceChange($event)\"\n (focus)=\"onSurfaceFocus($event)\"\n (blur)=\"onSurfaceBlur($event)\"\n (diagnostics)=\"onDiagnostics($event)\"\n (mentionSelected)=\"onMentionSelected($event)\" />\n", styles: [":host,.sd-mini-editor{display:block}\n"] }]
|
|
326
220
|
}], ctorParameters: () => [], propDecorators: { option: [{
|
|
327
221
|
type: Input,
|
|
328
222
|
args: [{ required: true }]
|
|
329
|
-
}], maxEditorHeight: [{
|
|
330
|
-
type: HostBinding,
|
|
331
|
-
args: ['style.--sd-mini-editor-max-height']
|
|
332
223
|
}], value: [{
|
|
333
224
|
type: Input
|
|
334
|
-
}], valueChange: [{ type: i0.Output, args: ["valueChange"] }], contentChange: [{ type: i0.Output, args: ["contentChange"] }], blur: [{ type: i0.Output, args: ["blur"] }], focus: [{ type: i0.Output, args: ["focus"] }],
|
|
225
|
+
}], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], contentChange: [{ type: i0.Output, args: ["contentChange"] }], blur: [{ type: i0.Output, args: ["blur"] }], focus: [{ type: i0.Output, args: ["focus"] }], importWarning: [{ type: i0.Output, args: ["importWarning"] }], maxEditorHeight: [{
|
|
226
|
+
type: HostBinding,
|
|
227
|
+
args: ['style.--sd-mini-editor-max-height']
|
|
228
|
+
}] } });
|
|
335
229
|
|
|
336
230
|
/**
|
|
337
231
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdcorejs-angular-components-mini-editor.mjs","sources":["../../../projects/sdcorejs-angular/components/mini-editor/src/mini-editor.component.ts","../../../projects/sdcorejs-angular/components/mini-editor/src/mini-editor.component.html","../../../projects/sdcorejs-angular/components/mini-editor/sdcorejs-angular-components-mini-editor.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, HostBinding, Input, forwardRef, OnDestroy, input, output } from '@angular/core';\nimport { CKEditorModule } from '@ckeditor/ckeditor5-angular';\nimport { SdCKEditorStyles } from '@sdcorejs/angular/components/ckeditor-styles';\nimport {\n Bold,\n ClassicEditor,\n Essentials,\n Italic,\n Link,\n List,\n FontColor,\n HtmlDataProcessor,\n Markdown,\n Mention,\n Paragraph,\n Underline,\n Undo,\n Widget,\n} from 'ckeditor5';\nimport { Subject, Subscription } from 'rxjs';\nimport { throttleTime } from 'rxjs/operators';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { sdSanitizeEditorHtml } from '@sdcorejs/angular/utilities/extensions';\n\nimport { SdMiniEditorOption, SdMiniEditorConfig, SdMiniEditorMentionItem } from './mini-editor.model';\n\n/**\n * Component sd-mini-editor - Editor đơn giản cho comment input\n * Sử dụng CKEditor với chế độ đơn giản (bold, italic, link)\n * Hỗ trợ mention và output format (html/markdown)\n *\n * @example\n * ```html\n * <sd-mini-editor\n * [option]=\"editorOption\"\n * [(ngModel)]=\"content\"\n * (contentChange)=\"onContentChange($event)\"\n * >\n * </sd-mini-editor>\n * ```\n */\n@Component({\n selector: 'sd-mini-editor',\n standalone: true,\n imports: [CommonModule, CKEditorModule, SdCKEditorStyles],\n templateUrl: './mini-editor.component.html',\n styleUrl: './mini-editor.component.scss',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SdMiniEditor),\n multi: true,\n },\n ],\n})\nexport class SdMiniEditor implements ControlValueAccessor, OnDestroy {\n /** Cấu hình option cho editor */\n @Input({ required: true }) option!: SdMiniEditorOption;\n\n @HostBinding('style.--sd-mini-editor-max-height')\n get maxEditorHeight(): string | undefined {\n return this.option?.maxHeight;\n }\n\n /** NgModel binding - nội dung HTML/Markdown */\n @Input() value = '';\n readonly valueChange = output<string>();\n\n /** Event emitter khi content thay đổi */\n readonly contentChange = output<string>();\n\n /** Event emitter khi blur */\n readonly blur = output<FocusEvent>();\n\n /** Event emitter khi focus */\n readonly focus = output<FocusEvent>();\n\n /** Disabled state */\n readonly disabled = input(false);\n\n Editor = ClassicEditor;\n #editor!: ClassicEditor;\n #subscription = new Subscription();\n #contentChangeSubject = new Subject<void>();\n\n // Build editor config dynamically\n get editorConfig(): SdMiniEditorConfig {\n const enableMention = this.option?.enableMention ?? false;\n const useMarkdown = this.option?.outputFormat === 'markdown';\n const plugins: any[] = [Essentials, FontColor, Paragraph, Bold, Italic, Underline, Link, List, Undo, Widget];\n\n // Add Markdown plugin if outputFormat is markdown\n if (useMarkdown) {\n plugins.push(Markdown);\n }\n\n // Add Mention plugin if enabled\n if (enableMention) {\n plugins.push(Mention);\n }\n\n // Build base config\n const config: SdMiniEditorConfig = {\n licenseKey: 'GPL',\n getOption: () => this.option,\n plugins,\n toolbar: {\n items: ['bold', 'italic', 'underline', '|', 'fontColor', '|', 'bulletedList', 'numberedList', '|', 'link'],\n shouldNotGroupWhenFull: true,\n },\n placeholder: this.option?.placeholder,\n link: {\n addTargetToExternalLinks: true,\n defaultProtocol: 'https://',\n // why: mặc định CKEditor cho cả ftp/ftps; link trong bình luận chỉ cần web, mail và điện thoại.\n allowedProtocols: ['https', 'http', 'mailto', 'tel'],\n },\n fontColor: {\n columns: 5,\n documentColors: 10,\n colorPicker: { format: 'hex' },\n },\n };\n\n // Add mention configuration if enabled\n if (enableMention && this.option?.mentionConfig?.feeds) {\n config.mention = {\n feeds: this.option.mentionConfig.feeds,\n };\n }\n\n return config;\n }\n\n constructor() {\n // Setup debounce cho content change\n this.#subscription.add(\n this.#contentChangeSubject.pipe(throttleTime(500, undefined, { leading: true, trailing: true })).subscribe(() => {\n const output = this.#convertOutput();\n this.value = output;\n this.#onChange(output);\n this.valueChange.emit(output);\n this.contentChange.emit(output);\n this.option?.onChange?.(output);\n })\n );\n }\n\n ngOnDestroy() {\n this.#subscription.unsubscribe();\n this.#editor?.destroy?.();\n }\n\n /**\n * Kiểm tra có nên enable mention plugin không\n */\n #shouldEnableMention(): boolean {\n return this.option?.enableMention ?? false;\n }\n\n /**\n * Xử lý khi editor ready\n */\n onReady(editor: ClassicEditor) {\n this.#editor = editor;\n\n // Set initial content\n if (this.value) {\n this.setContent(this.value);\n }\n\n // Lắng nghe sự kiện thay đổi nội dung\n editor.model.document.on('change:data', () => {\n this.#contentChangeSubject.next();\n });\n\n // Lắng nghe focus/blur events\n editor.editing.view.document.on('focus', evt => {\n const domEvent = (evt as any).domEvent as FocusEvent;\n this.focus.emit(domEvent);\n this.option?.onFocus?.(domEvent);\n });\n\n editor.editing.view.document.on('blur', evt => {\n const domEvent = (evt as any).domEvent as FocusEvent;\n this.blur.emit(domEvent);\n this.option?.onBlur?.(domEvent);\n });\n\n // Lắng nghe sự kiện mention được chọn\n if (this.#shouldEnableMention()) {\n editor.commands.get('mention')?.on('execute', (_evt, data: any) => {\n const mentionData = data[0];\n this.option?.onMentionSelect?.(mentionData.mention);\n // Trigger content change sau khi insert mention\n this.#contentChangeSubject.next();\n });\n\n // Custom downcast converter để thay đổi cấu trúc mention HTML\n editor.conversion.for('downcast').attributeToElement({\n model: 'mention',\n view: (mentionData, { writer }) => {\n const data = mentionData as SdMiniEditorMentionItem;\n const rawId = data?.id || '';\n const marker = rawId[0];\n const cleanId = rawId.slice(1);\n\n return writer.createAttributeElement('span', {\n class: 'ck-custom-mention',\n 'data-id': cleanId,\n 'data-marker': marker,\n contenteditable: 'false',\n });\n },\n converterPriority: 'highest',\n });\n\n // Xử lý keyboard để xóa mention 1 lần\n editor.editing.view.document.on('keydown', (evt, data) => {\n const keyEvent = data as { keyCode: number; domEvent: KeyboardEvent };\n // Delete (46) hoặc Backspace (8)\n if (keyEvent.keyCode === 46 || keyEvent.keyCode === 8) {\n const model = editor.model;\n const selection = model.document.selection;\n const position = selection.getFirstPosition();\n if (!position) return;\n\n // Tìm text node có mention attribute\n const node = position.textNode || position.nodeBefore || position.nodeAfter;\n if (node && node.is('$text')) {\n const mentionAttr = node.getAttribute('mention');\n if (mentionAttr) {\n // Xóa toàn bộ text node chứa mention\n model.change(writer => {\n writer.remove(node);\n });\n evt.stop();\n }\n }\n }\n });\n }\n }\n\n /**\n * Nội dung phát ra ngoài theo `outputFormat`: HTML đã lọc, hoặc Markdown dựng từ HTML đã lọc.\n * Là điểm ra duy nhất cho cả luồng throttle (valueChange/contentChange/form) lẫn `getContent()` (D-032).\n */\n #convertOutput(): string {\n const editor = this.#editor;\n if (!editor) return '';\n const html = this.#readSanitizedHtml(editor);\n if (!this.#isMarkdown()) return html;\n // why: dựng Markdown từ HTML ĐÃ lọc, để `[text](javascript:...)` không thể lọt vào chuỗi Markdown.\n const htmlProcessor = new HtmlDataProcessor(editor.data.viewDocument);\n return editor.data.processor.toData(htmlProcessor.toView(html));\n }\n\n #isMarkdown(): boolean {\n return this.option?.outputFormat === 'markdown';\n }\n\n /** HTML hiện tại của editor (kể cả ở chế độ Markdown), đã qua `sdSanitizeEditorHtml`. */\n #readSanitizedHtml(editor: ClassicEditor): string {\n if (!this.#isMarkdown()) return sdSanitizeEditorHtml(editor.getData());\n // why: với plugin Markdown, `getData()` trả Markdown. Lấy HTML từ data view (đúng thứ getData() dùng)\n // để lọc trước khi chuyển.\n const root = editor.model.document.getRoot();\n if (!root) return '';\n const htmlProcessor = new HtmlDataProcessor(editor.data.viewDocument);\n return sdSanitizeEditorHtml(htmlProcessor.toData(editor.data.toView(root)));\n }\n\n /**\n * Set nội dung cho editor\n */\n setContent(content: string) {\n this.#editor?.setData?.(content);\n }\n\n /**\n * Get nội dung từ editor\n */\n getContent(): string {\n return this.#convertOutput();\n }\n\n /**\n * Nội dung dạng HTML (đã lọc), bất kể `outputFormat`.\n */\n getHtmlContent(): string {\n return this.#editor ? this.#readSanitizedHtml(this.#editor) : '';\n }\n\n /**\n * Focus vào editor\n */\n focusEditor() {\n this.#editor?.editing?.view?.focus?.();\n }\n\n /**\n * Insert mention vào vị trí con trỏ hiện tại\n */\n insertMention(item: { id: string; name: string; marker?: string }) {\n if (!this.#editor) return;\n\n const firstFeed = this.option?.mentionConfig?.feeds?.[0];\n const marker = item.marker || (firstFeed as any)?.marker || '@';\n\n // Sử dụng CKEditor mention command\n this.#editor.execute('mention', {\n marker,\n mention: {\n id: item.id,\n text: `${marker}${item.name}`,\n },\n });\n }\n\n /**\n * Get danh sách mentions trong nội dung\n */\n getMentions(): { id: string; name: string; marker: string }[] {\n if (!this.#editor) return [];\n\n const mentions: { id: string; name: string; marker: string }[] = [];\n const root = this.#editor.model.document.getRoot();\n if (!root) return mentions;\n\n const range = this.#editor.model.createRangeIn(root);\n\n for (const item of range.getItems()) {\n if (item.is('$text')) {\n const mentionAttr = item.getAttribute('mention');\n if (mentionAttr) {\n const text = (item as any).data as string;\n const marker = text.charAt(0);\n const name = text.substring(1);\n const id = item.getAttribute('data-user-id') as string;\n\n mentions.push({ id, name, marker });\n }\n }\n }\n\n return mentions;\n }\n\n /**\n * ControlValueAccessor: Write value\n */\n writeValue(value: string): void {\n this.value = value || '';\n if (this.#editor) {\n this.setContent(this.value);\n }\n }\n\n /**\n * ControlValueAccessor: Register change callback\n */\n registerOnChange(fn: (value: string) => void): void {\n this.#onChange = fn;\n }\n\n /**\n * ControlValueAccessor: Register touched callback\n */\n registerOnTouched(fn: () => void): void {\n this.#onTouched = fn;\n }\n\n /** ControlValueAccessor callbacks */\n #onChange: (value: string) => void = () => {};\n #onTouched: () => void = () => {};\n}\n","<sd-ckeditor-styles />\n<ckeditor class=\"sd-mini-editor\" [editor]=\"Editor\" [config]=\"editorConfig\" [disabled]=\"disabled()\" (ready)=\"onReady($event)\"> </ckeditor>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AA4BA;;;;;;;;;;;;;;AAcG;MAeU,YAAY,CAAA;;AAEI,IAAA,MAAM;AAEjC,IAAA,IACI,eAAe,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,MAAM,EAAE,SAAS;IAC/B;;IAGS,KAAK,GAAG,EAAE;IACV,WAAW,GAAG,MAAM,EAAU;;IAG9B,aAAa,GAAG,MAAM,EAAU;;IAGh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,EAAE,IAAI;AACZ,aAAA;AACF,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECvDH,+KAEA,EAAA,MAAA,EAAA,CAAA,ktCAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,ED4CY,YAAY,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAE,cAAc,gTAAE,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,CAAA,EAAA,CAAA;;4FAW7C,YAAY,EAAA,UAAA,EAAA,CAAA;kBAdxB,SAAS;+BACE,gBAAgB,EAAA,UAAA,EACd,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,EAAE,cAAc,EAAE,gBAAgB,CAAC,EAAA,SAAA,EAG9C;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,kBAAkB,CAAC;AAC3C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,+KAAA,EAAA,MAAA,EAAA,CAAA,ktCAAA,CAAA,EAAA;;sBAIA,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAExB,WAAW;uBAAC,mCAAmC;;sBAM/C;;;AEnEH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sdcorejs-angular-components-mini-editor.mjs","sources":["../../../projects/sdcorejs-angular/components/mini-editor/src/mini-editor.component.ts","../../../projects/sdcorejs-angular/components/mini-editor/src/mini-editor.component.html","../../../projects/sdcorejs-angular/components/mini-editor/sdcorejs-angular-components-mini-editor.ts"],"sourcesContent":["import {\n ChangeDetectorRef,\n Component,\n HostBinding,\n Input,\n OnChanges,\n OnDestroy,\n SimpleChanges,\n computed,\n effect,\n forwardRef,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n SdEditorEngine,\n SdEditorImportDiagnostic,\n SdEditorMentionItem,\n SdEditorSourceChangeReason,\n SdEditorSurface,\n} from '@sdcorejs/angular/components/editor-engine';\nimport { SdMiniEditorOption } from './mini-editor.model';\n\n/** Compact Core toolbar with the same document schema as SdEditor. */\n@Component({\n selector: 'sd-mini-editor',\n standalone: true,\n imports: [SdEditorSurface],\n templateUrl: './mini-editor.component.html',\n styleUrl: './mini-editor.component.scss',\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SdMiniEditor), multi: true }],\n})\nexport class SdMiniEditor implements ControlValueAccessor, OnChanges, OnDestroy {\n @Input({ required: true }) option!: SdMiniEditorOption;\n @Input() value = '';\n readonly disabled = input(false);\n readonly valueChange = output<string>();\n readonly contentChange = output<string>();\n readonly blur = output<FocusEvent>();\n readonly focus = output<FocusEvent>();\n readonly importWarning = output<readonly SdEditorImportDiagnostic[]>();\n readonly #diagnostics = signal<readonly SdEditorImportDiagnostic[]>([]);\n readonly importDiagnostics = this.#diagnostics.asReadonly();\n readonly surfaceContent = signal('');\n readonly #formDisabled = signal(false);\n readonly effectiveDisabled = computed(() => this.disabled() || this.#formDisabled());\n readonly #cdRef = inject(ChangeDetectorRef);\n #engine?: SdEditorEngine;\n #timer?: ReturnType<typeof setTimeout>;\n #trailing?: string;\n #deadline?: number;\n #composing = false;\n #formatPending = false;\n #destroyed = false;\n #onChange: (value: string) => void = () => {};\n #onTouched: () => void = () => {};\n\n @HostBinding('style.--sd-mini-editor-max-height')\n get maxEditorHeight(): string | undefined {\n return this.option?.maxHeight;\n }\n\n constructor() {\n effect(() => {\n if (this.effectiveDisabled()) this.onSourceChange();\n });\n }\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['value']) this.setContent(this.value);\n }\n onEngineReady(engine: SdEditorEngine): void {\n this.onSourceChange();\n this.#composing = false;\n this.#engine = engine;\n }\n /** Cancel a stale throttle window before replacing an authoritative source. */\n onSourceChange(reason: SdEditorSourceChangeReason = 'source'): void {\n this.#clearTimer();\n if (reason === 'format') {\n this.#formatPending = true;\n return;\n }\n this.#formatPending = false;\n this.#deadline = undefined;\n this.#trailing = undefined;\n }\n onFormatChange(value: string | undefined): void {\n if (this.#destroyed || this.effectiveDisabled()) return;\n // A refused conversion stays paused until a supported representation is\n // restored. Retain the live pending edit without exporting stale HTML.\n if (value === undefined) return;\n this.#formatPending = false;\n this.#trailing = undefined;\n if (value !== this.value) this.onSurfaceChange(value);\n if (this.#deadline !== undefined) this.#scheduleWindow();\n }\n onSurfaceChange(value: string): void {\n if (this.#destroyed || this.effectiveDisabled()) return;\n if (this.#composing || this.#formatPending) {\n this.#trailing = value;\n return;\n }\n if (this.#deadline === undefined) {\n // App callbacks can replace content synchronously; establish the window first.\n this.#startWindow();\n this.#emit(value);\n } else this.#trailing = value;\n }\n #startWindow(): void {\n this.#deadline = Date.now() + 500;\n this.#scheduleWindow();\n }\n #scheduleWindow(): void {\n if (this.#deadline === undefined || this.#composing || this.#formatPending || this.#destroyed) return;\n this.#clearTimer();\n this.#timer = setTimeout(\n () => {\n this.#timer = undefined;\n this.#deadline = undefined;\n const trailing = this.#trailing;\n this.#trailing = undefined;\n if (trailing !== undefined && !this.#destroyed && !this.#composing && !this.effectiveDisabled()) {\n this.#startWindow();\n this.#emit(trailing);\n }\n },\n Math.max(0, this.#deadline - Date.now())\n );\n }\n onCompositionChange(composing: boolean): void {\n this.#composing = composing;\n this.#clearTimer();\n if (composing || this.#formatPending || this.#destroyed || this.effectiveDisabled()) return;\n if (this.#deadline !== undefined) this.#scheduleWindow();\n else if (this.#trailing !== undefined) {\n const value = this.#trailing;\n this.#trailing = undefined;\n this.#startWindow();\n this.#emit(value);\n }\n }\n #clearTimer(): void {\n if (this.#timer !== undefined) clearTimeout(this.#timer);\n this.#timer = undefined;\n }\n #emit(value: string): void {\n this.value = value;\n this.#onChange(value);\n this.valueChange.emit(value);\n this.contentChange.emit(value);\n this.option?.onChange?.(value);\n this.#cdRef.markForCheck();\n }\n onSurfaceFocus(event: FocusEvent): void {\n this.focus.emit(event);\n this.option?.onFocus?.(event);\n }\n onSurfaceBlur(event: FocusEvent): void {\n this.#onTouched();\n this.blur.emit(event);\n this.option?.onBlur?.(event);\n this.#cdRef.markForCheck();\n }\n onDiagnostics(diagnostics: readonly SdEditorImportDiagnostic[]): void {\n this.#diagnostics.set(diagnostics);\n this.importWarning.emit(diagnostics);\n }\n onMentionSelected(item: SdEditorMentionItem): void {\n this.option?.onMentionSelect?.(item);\n }\n setContent(content: string): void {\n const value = content ?? '';\n this.value = value;\n // Consumer echoes must not replay content or reset the current selection/history.\n if (this.#isCurrentContent(value)) return;\n this.onSourceChange();\n this.surfaceContent.set(value);\n this.#engine?.setContent(value, this.option?.outputFormat ?? 'html');\n this.#cdRef.markForCheck();\n }\n #isCurrentContent(value: string): boolean {\n if (!this.#engine) return value === this.surfaceContent();\n try {\n return this.#engine.format === (this.option?.outputFormat ?? 'html') && value === this.#engine.getContent();\n } catch {\n return false;\n }\n }\n getContent(): string {\n return this.#engine?.getContent() ?? '';\n }\n getHtmlContent(): string {\n return this.#engine?.getHtml() ?? '';\n }\n focusEditor(): void {\n if (!this.effectiveDisabled()) this.#engine?.focus();\n }\n insertMention(item: { id: string; name: string; marker?: string }): void {\n if (!this.#engine || !this.option?.enableMention || this.effectiveDisabled() || this.importDiagnostics().length) return;\n const marker = item.marker ?? this.option.mentionConfig?.feeds?.[0]?.marker ?? '@';\n this.#engine.insertMention({ ...item, marker });\n this.option.onMentionSelect?.({ id: item.id, name: item.name, text: `${marker}${item.name}` });\n }\n getMentions(): { id: string; name: string; marker: string }[] {\n return this.#engine?.getMentions() ?? [];\n }\n writeValue(value: string): void {\n this.setContent(value || '');\n }\n registerOnChange(fn: (value: string) => void): void {\n this.#onChange = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.#onTouched = fn;\n }\n setDisabledState(disabled: boolean): void {\n this.#formDisabled.set(disabled);\n if (disabled) this.onSourceChange();\n this.#cdRef.markForCheck();\n }\n ngOnDestroy(): void {\n this.#destroyed = true;\n this.onSourceChange();\n this.#engine = undefined; // Surface owns engine destruction.\n }\n}\n","<sd-editor-surface\n class=\"sd-mini-editor\"\n variant=\"compact\"\n [content]=\"surfaceContent()\"\n [format]=\"option?.outputFormat ?? 'html'\"\n [editable]=\"!effectiveDisabled()\"\n [placeholder]=\"option?.placeholder\"\n [disabled]=\"effectiveDisabled()\"\n [height]=\"option?.height\"\n [maxHeight]=\"option?.maxHeight\"\n [mentionFeeds]=\"option?.enableMention ? option?.mentionConfig?.feeds : undefined\"\n (engineReady)=\"onEngineReady($event)\"\n (sourceChange)=\"onSourceChange($event)\"\n (formatChange)=\"onFormatChange($event)\"\n (compositionChange)=\"onCompositionChange($event)\"\n (change)=\"onSurfaceChange($event)\"\n (focus)=\"onSurfaceFocus($event)\"\n (blur)=\"onSurfaceBlur($event)\"\n (diagnostics)=\"onDiagnostics($event)\"\n (mentionSelected)=\"onMentionSelected($event)\" />\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AA0BA;MASa,YAAY,CAAA;AACI,IAAA,MAAM;IACxB,KAAK,GAAG,EAAE;AACV,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,oDAAC;IACvB,WAAW,GAAG,MAAM,EAAU;IAC9B,aAAa,GAAG,MAAM,EAAU;IAChC,IAAI,GAAG,MAAM,EAAc;IAC3B,KAAK,GAAG,MAAM,EAAc;IAC5B,aAAa,GAAG,MAAM,EAAuC;AAC7D,IAAA,YAAY,GAAG,MAAM,CAAsC,EAAE,wDAAC;AAC9D,IAAA,iBAAiB,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE;AAClD,IAAA,cAAc,GAAG,MAAM,CAAC,EAAE,0DAAC;AAC3B,IAAA,aAAa,GAAG,MAAM,CAAC,KAAK,yDAAC;AAC7B,IAAA,iBAAiB,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,IAAI,I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