@malva-ui/editor 0.1.13 → 0.1.14
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/README.md +5 -5
- package/fesm2022/malva-ui-editor-ai.mjs +17 -0
- package/fesm2022/malva-ui-editor-ai.mjs.map +1 -0
- package/fesm2022/malva-ui-editor.mjs +10227 -0
- package/fesm2022/malva-ui-editor.mjs.map +1 -0
- package/package.json +35 -26
- package/types/malva-ui-editor-ai.d.ts +1 -0
- package/types/malva-ui-editor.d.ts +2995 -0
- package/ai/index.d.ts +0 -12
- package/ai/malva-ui-editor-ai.d.ts +0 -5
- package/esm2022/ai/index.js +0 -12
- package/esm2022/ai/index.js.map +0 -1
- package/esm2022/ai/malva-ui-editor-ai.js +0 -5
- package/esm2022/ai/malva-ui-editor-ai.js.map +0 -1
- package/esm2022/index.js +0 -37
- package/esm2022/index.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-actions.js +0 -69
- package/esm2022/lib/ai/editor-ai-actions.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-context.js +0 -612
- package/esm2022/lib/ai/editor-ai-context.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-menu.js +0 -288
- package/esm2022/lib/ai/editor-ai-menu.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-review-bar.js +0 -223
- package/esm2022/lib/ai/editor-ai-review-bar.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-stream.js +0 -677
- package/esm2022/lib/ai/editor-ai-stream.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-suggestions.js +0 -751
- package/esm2022/lib/ai/editor-ai-suggestions.js.map +0 -1
- package/esm2022/lib/ai/editor-ai.tokens.js +0 -10
- package/esm2022/lib/ai/editor-ai.tokens.js.map +0 -1
- package/esm2022/lib/ai/editor-ai.types.js +0 -1
- package/esm2022/lib/ai/editor-ai.types.js.map +0 -1
- package/esm2022/lib/editor/editor.js +0 -985
- package/esm2022/lib/editor/editor.js.map +0 -1
- package/esm2022/lib/editor-extension-preflight.js +0 -83
- package/esm2022/lib/editor-extension-preflight.js.map +0 -1
- package/esm2022/lib/editor-serialization.js +0 -152
- package/esm2022/lib/editor-serialization.js.map +0 -1
- package/esm2022/lib/editor-toolbar-context.js +0 -259
- package/esm2022/lib/editor-toolbar-context.js.map +0 -1
- package/esm2022/lib/editor.tokens.js +0 -10
- package/esm2022/lib/editor.tokens.js.map +0 -1
- package/esm2022/lib/editor.types.js +0 -48
- package/esm2022/lib/editor.types.js.map +0 -1
- package/esm2022/lib/extensions/editor-block-handle.js +0 -760
- package/esm2022/lib/extensions/editor-block-handle.js.map +0 -1
- package/esm2022/lib/extensions/editor-extensions.js +0 -321
- package/esm2022/lib/extensions/editor-extensions.js.map +0 -1
- package/esm2022/lib/extensions/editor-markdown-compatibility.js +0 -162
- package/esm2022/lib/extensions/editor-markdown-compatibility.js.map +0 -1
- package/esm2022/lib/extensions/editor-upload-placeholder.js +0 -156
- package/esm2022/lib/extensions/editor-upload-placeholder.js.map +0 -1
- package/esm2022/lib/status/editor-status.js +0 -64
- package/esm2022/lib/status/editor-status.js.map +0 -1
- package/esm2022/lib/toolbar/editor-alignment.js +0 -203
- package/esm2022/lib/toolbar/editor-alignment.js.map +0 -1
- package/esm2022/lib/toolbar/editor-block-insert.js +0 -101
- package/esm2022/lib/toolbar/editor-block-insert.js.map +0 -1
- package/esm2022/lib/toolbar/editor-color-control.js +0 -71
- package/esm2022/lib/toolbar/editor-color-control.js.map +0 -1
- package/esm2022/lib/toolbar/editor-command-button.js +0 -115
- package/esm2022/lib/toolbar/editor-command-button.js.map +0 -1
- package/esm2022/lib/toolbar/editor-heading.js +0 -266
- package/esm2022/lib/toolbar/editor-heading.js.map +0 -1
- package/esm2022/lib/toolbar/editor-highlight.js +0 -84
- package/esm2022/lib/toolbar/editor-highlight.js.map +0 -1
- package/esm2022/lib/toolbar/editor-image-upload-dialog.js +0 -289
- package/esm2022/lib/toolbar/editor-image-upload-dialog.js.map +0 -1
- package/esm2022/lib/toolbar/editor-image-upload.js +0 -315
- package/esm2022/lib/toolbar/editor-image-upload.js.map +0 -1
- package/esm2022/lib/toolbar/editor-inline-marks.js +0 -124
- package/esm2022/lib/toolbar/editor-inline-marks.js.map +0 -1
- package/esm2022/lib/toolbar/editor-link.js +0 -265
- package/esm2022/lib/toolbar/editor-link.js.map +0 -1
- package/esm2022/lib/toolbar/editor-list.js +0 -249
- package/esm2022/lib/toolbar/editor-list.js.map +0 -1
- package/esm2022/lib/toolbar/editor-table.js +0 -292
- package/esm2022/lib/toolbar/editor-table.js.map +0 -1
- package/esm2022/lib/toolbar/editor-text-color.js +0 -82
- package/esm2022/lib/toolbar/editor-text-color.js.map +0 -1
- package/esm2022/lib/toolbar/editor-toolbar-widget.js +0 -41
- package/esm2022/lib/toolbar/editor-toolbar-widget.js.map +0 -1
- package/esm2022/lib/toolbar/editor-toolbar.defs.js +0 -60
- package/esm2022/lib/toolbar/editor-toolbar.defs.js.map +0 -1
- package/esm2022/lib/toolbar/editor-toolbar.js +0 -826
- package/esm2022/lib/toolbar/editor-toolbar.js.map +0 -1
- package/esm2022/lib/toolbar/editor-undo-redo.js +0 -72
- package/esm2022/lib/toolbar/editor-undo-redo.js.map +0 -1
- package/esm2022/lib/toolbar/editor-zoom.js +0 -330
- package/esm2022/lib/toolbar/editor-zoom.js.map +0 -1
- package/esm2022/lib/upload/editor-image-upload-coordinator.js +0 -480
- package/esm2022/lib/upload/editor-image-upload-coordinator.js.map +0 -1
- package/esm2022/malva-ui-editor.js +0 -5
- package/esm2022/malva-ui-editor.js.map +0 -1
- package/index.d.ts +0 -35
- package/lib/ai/editor-ai-actions.d.ts +0 -27
- package/lib/ai/editor-ai-context.d.ts +0 -307
- package/lib/ai/editor-ai-menu.d.ts +0 -142
- package/lib/ai/editor-ai-review-bar.d.ts +0 -116
- package/lib/ai/editor-ai-stream.d.ts +0 -207
- package/lib/ai/editor-ai-suggestions.d.ts +0 -219
- package/lib/ai/editor-ai.tokens.d.ts +0 -10
- package/lib/ai/editor-ai.types.d.ts +0 -176
- package/lib/editor/editor.d.ts +0 -243
- package/lib/editor-extension-preflight.d.ts +0 -23
- package/lib/editor-serialization.d.ts +0 -74
- package/lib/editor-toolbar-context.d.ts +0 -116
- package/lib/editor.tokens.d.ts +0 -6
- package/lib/editor.types.d.ts +0 -194
- package/lib/extensions/editor-block-handle.d.ts +0 -59
- package/lib/extensions/editor-extensions.d.ts +0 -165
- package/lib/extensions/editor-markdown-compatibility.d.ts +0 -11
- package/lib/extensions/editor-upload-placeholder.d.ts +0 -75
- package/lib/status/editor-status.d.ts +0 -24
- package/lib/toolbar/editor-alignment.d.ts +0 -61
- package/lib/toolbar/editor-block-insert.d.ts +0 -26
- package/lib/toolbar/editor-color-control.d.ts +0 -32
- package/lib/toolbar/editor-command-button.d.ts +0 -29
- package/lib/toolbar/editor-heading.d.ts +0 -68
- package/lib/toolbar/editor-highlight.d.ts +0 -21
- package/lib/toolbar/editor-image-upload-dialog.d.ts +0 -96
- package/lib/toolbar/editor-image-upload.d.ts +0 -71
- package/lib/toolbar/editor-inline-marks.d.ts +0 -30
- package/lib/toolbar/editor-link.d.ts +0 -78
- package/lib/toolbar/editor-list.d.ts +0 -67
- package/lib/toolbar/editor-table.d.ts +0 -133
- package/lib/toolbar/editor-text-color.d.ts +0 -21
- package/lib/toolbar/editor-toolbar-widget.d.ts +0 -19
- package/lib/toolbar/editor-toolbar.d.ts +0 -157
- package/lib/toolbar/editor-toolbar.defs.d.ts +0 -35
- package/lib/toolbar/editor-undo-redo.d.ts +0 -26
- package/lib/toolbar/editor-zoom.d.ts +0 -108
- package/lib/upload/editor-image-upload-coordinator.d.ts +0 -55
- package/malva-ui-editor.d.ts +0 -5
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, computed, DestroyRef, effect, ElementRef, inject, Injector, signal, viewChild, ViewEncapsulation, } from '@angular/core';
|
|
2
|
-
import { LucideImage } from '@lucide/angular';
|
|
3
|
-
import { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';
|
|
4
|
-
import { MlvDialogService } from '@malva-ui/core/dialog';
|
|
5
|
-
import { MlvProgress } from '@malva-ui/core/progress';
|
|
6
|
-
import { MlvTooltip } from '@malva-ui/core/tooltip';
|
|
7
|
-
import { MLV_EDITOR_I18N, MLV_FILE_UPLOAD_I18N } from '@malva-ui/i18n';
|
|
8
|
-
import { MLV_EDITOR_TOOLBAR_CONTEXT, MLV_EDITOR_TOOLBAR_REVISION, } from '../editor-toolbar-context';
|
|
9
|
-
import { MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR, resolveMlvEditorImageUploadCoordinator, } from '../upload/editor-image-upload-coordinator';
|
|
10
|
-
import { MlvEditorImageUploadDialog } from './editor-image-upload-dialog';
|
|
11
|
-
import { MlvEditorToolbarWidget } from './editor-toolbar-widget';
|
|
12
|
-
import * as i0 from "@angular/core";
|
|
13
|
-
/** Public toolbar entry point for the editor image-upload dialog. */
|
|
14
|
-
export class MlvEditorImageUpload {
|
|
15
|
-
/** @protected Editor-scoped command/form state. */
|
|
16
|
-
_context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);
|
|
17
|
-
/** @protected Shared upload coordinator for this editor instance. */
|
|
18
|
-
_coordinator = computed(() => resolveMlvEditorImageUploadCoordinator(this._context.imageUpload), /* @ts-ignore */
|
|
19
|
-
...(ngDevMode ? [{ debugName: "_coordinator" }] : /* istanbul ignore next */ []));
|
|
20
|
-
/** @private Transaction invalidation for runtime command support. */
|
|
21
|
-
_revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {
|
|
22
|
-
optional: true,
|
|
23
|
-
});
|
|
24
|
-
/** @private Malva dialog service used for the one modal surface. */
|
|
25
|
-
_dialogs = inject(MlvDialogService);
|
|
26
|
-
/** @private Exact child injector passed through to the dialog portal. */
|
|
27
|
-
_injector = inject(Injector);
|
|
28
|
-
/** @private Trigger restored by the shared dialog lifecycle. */
|
|
29
|
-
_trigger = viewChild.required('_trigger', {
|
|
30
|
-
read: ElementRef,
|
|
31
|
-
});
|
|
32
|
-
/** @private Current dialog, preventing duplicate opens. */
|
|
33
|
-
_dialogRef;
|
|
34
|
-
/** @private Component teardown closes any owned dialog. */
|
|
35
|
-
_destroyRef = inject(DestroyRef);
|
|
36
|
-
/** @private Optional localized editor copy. */
|
|
37
|
-
_i18n = inject(MLV_EDITOR_I18N, { optional: true });
|
|
38
|
-
/** @protected Reactive localized trigger copy. */
|
|
39
|
-
_copy = computed(() => this._i18n?.().uploadImage ?? 'Upload image', /* @ts-ignore */
|
|
40
|
-
...(ngDevMode ? [{ debugName: "_copy" }] : /* istanbul ignore next */ []));
|
|
41
|
-
/** @protected Whether the editor has both required upload commands. */
|
|
42
|
-
_supported = computed(() => {
|
|
43
|
-
this._revision?.();
|
|
44
|
-
const commands = this._context.editor()?.commands;
|
|
45
|
-
return (typeof commands?.['setImage'] === 'function' &&
|
|
46
|
-
typeof commands?.['insertUploadPlaceholder'] === 'function' &&
|
|
47
|
-
typeof commands?.['replaceUploadPlaceholder'] === 'function');
|
|
48
|
-
}, /* @ts-ignore */
|
|
49
|
-
...(ngDevMode ? [{ debugName: "_supported" }] : /* istanbul ignore next */ []));
|
|
50
|
-
/** @protected Whether the mutation entry point belongs in this toolbar. */
|
|
51
|
-
_visible = computed(() => !!this._coordinator() &&
|
|
52
|
-
!!this._coordinator()?.adapterAvailable() &&
|
|
53
|
-
this._supported() &&
|
|
54
|
-
!this._context.readonly(), /* @ts-ignore */
|
|
55
|
-
...(ngDevMode ? [{ debugName: "_visible" }] : /* istanbul ignore next */ []));
|
|
56
|
-
/** @protected Whether the visible trigger is currently inert. */
|
|
57
|
-
_disabled = computed(() => this._context.disabled() ||
|
|
58
|
-
this._context.readonly() ||
|
|
59
|
-
!this._coordinator()?.available(), /* @ts-ignore */
|
|
60
|
-
...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
61
|
-
constructor() {
|
|
62
|
-
effect(() => {
|
|
63
|
-
if (this._dialogRef &&
|
|
64
|
-
(this._context.disabled() || this._context.readonly())) {
|
|
65
|
-
this._dialogRef.close();
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
this._destroyRef.onDestroy(() => this._dialogRef?.close());
|
|
69
|
-
}
|
|
70
|
-
/** @protected Opens one editor-scoped Malva upload dialog. */
|
|
71
|
-
_open() {
|
|
72
|
-
const coordinator = this._coordinator();
|
|
73
|
-
if (!coordinator ||
|
|
74
|
-
this._disabled() ||
|
|
75
|
-
!this._visible() ||
|
|
76
|
-
this._dialogRef) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const trigger = this._trigger().nativeElement;
|
|
80
|
-
const ref = this._dialogs.open(MlvEditorImageUploadDialog, {
|
|
81
|
-
title: this._copy(),
|
|
82
|
-
injector: Injector.create({
|
|
83
|
-
parent: this._injector,
|
|
84
|
-
providers: [
|
|
85
|
-
{
|
|
86
|
-
provide: MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR,
|
|
87
|
-
useValue: coordinator,
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
}),
|
|
91
|
-
size: 's',
|
|
92
|
-
});
|
|
93
|
-
this._dialogRef = ref;
|
|
94
|
-
ref.afterClosed().subscribe(() => {
|
|
95
|
-
if (this._dialogRef === ref)
|
|
96
|
-
this._dialogRef = undefined;
|
|
97
|
-
if (!this._context.disabled() &&
|
|
98
|
-
trigger.isConnected &&
|
|
99
|
-
document.activeElement !== trigger) {
|
|
100
|
-
trigger.focus();
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorImageUpload, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
105
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.7", type: MlvEditorImageUpload, isStandalone: true, selector: "mlv-editor-image-upload", host: { properties: { "hidden": "!_visible()" }, classAttribute: "mlv-editor-image-upload" }, viewQueries: [{ propertyName: "_trigger", first: true, predicate: ["_trigger"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<button\n #_trigger\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_disabled()\"\n [attr.aria-label]=\"_copy()\"\n [attr.aria-pressed]=\"false\"\n [mlvTooltip]=\"_copy()\"\n (click)=\"_open()\"\n>\n <svg mlvButtonIcon lucideImage aria-hidden=\"true\" />\n</button>\n", dependencies: [{ kind: "component", type: LucideImage, selector: "svg[lucideImage]" }, { kind: "component", type: MlvButton, selector: "button[mlvButton], a[mlvButton]", inputs: ["variant", "shape", "disabled", "loading"] }, { kind: "directive", type: MlvButtonIcon, selector: "[mlvButtonIcon]" }, { kind: "directive", type: MlvTooltip, selector: "[mlvTooltip]", inputs: ["mlvTooltip", "tooltipPlacement", "tooltipTone", "tooltipDelay", "tooltipDisabled", "tooltipArrow"] }, { kind: "directive", type: MlvEditorToolbarWidget, selector: "[mlvEditorToolbarWidget]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
106
|
-
}
|
|
107
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorImageUpload, decorators: [{
|
|
108
|
-
type: Component,
|
|
109
|
-
args: [{ selector: 'mlv-editor-image-upload', imports: [
|
|
110
|
-
LucideImage,
|
|
111
|
-
MlvButton,
|
|
112
|
-
MlvButtonIcon,
|
|
113
|
-
MlvTooltip,
|
|
114
|
-
MlvEditorToolbarWidget,
|
|
115
|
-
], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
116
|
-
class: 'mlv-editor-image-upload',
|
|
117
|
-
'[hidden]': '!_visible()',
|
|
118
|
-
}, template: "<button\n #_trigger\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_disabled()\"\n [attr.aria-label]=\"_copy()\"\n [attr.aria-pressed]=\"false\"\n [mlvTooltip]=\"_copy()\"\n (click)=\"_open()\"\n>\n <svg mlvButtonIcon lucideImage aria-hidden=\"true\" />\n</button>\n" }]
|
|
119
|
-
}], ctorParameters: () => [], propDecorators: { _trigger: [{ type: i0.ViewChild, args: ['_trigger', { ...{
|
|
120
|
-
read: ElementRef,
|
|
121
|
-
}, isSignal: true }] }] } });
|
|
122
|
-
/** @internal Non-serializable pending-upload surface owned by the editor shell. */
|
|
123
|
-
export class MlvEditorImageUploadStatus {
|
|
124
|
-
/** @protected Shared editor coordinator. */
|
|
125
|
-
_coordinator = inject(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR);
|
|
126
|
-
/** @private Editor state guarding mutation actions. */
|
|
127
|
-
_context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);
|
|
128
|
-
/** @private Optional localized editor copy. */
|
|
129
|
-
_i18n = inject(MLV_EDITOR_I18N, { optional: true });
|
|
130
|
-
/** @private Localized file removal copy. */
|
|
131
|
-
_fileI18n = inject(MLV_FILE_UPLOAD_I18N);
|
|
132
|
-
/** @protected Current active and retryable uploads. */
|
|
133
|
-
_pending = this._coordinator.pending;
|
|
134
|
-
/** @protected Polite coarse-grained live-region text. */
|
|
135
|
-
_announcement = signal('', /* @ts-ignore */
|
|
136
|
-
...(ngDevMode ? [{ debugName: "_announcement" }] : /* istanbul ignore next */ []));
|
|
137
|
-
/** @private Last announced progress bucket for each active item. */
|
|
138
|
-
_buckets = new Map();
|
|
139
|
-
/** @protected Whether status actions are inert. */
|
|
140
|
-
_disabled = computed(() => this._context.disabled() || this._context.readonly(), /* @ts-ignore */
|
|
141
|
-
...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
142
|
-
/** @protected Reactive localized status/action copy. */
|
|
143
|
-
_copy = computed(() => {
|
|
144
|
-
const copy = this._i18n?.();
|
|
145
|
-
return {
|
|
146
|
-
cancel: copy?.cancelUpload ?? 'Cancel upload',
|
|
147
|
-
retry: copy?.retryUpload ?? 'Retry upload',
|
|
148
|
-
failed: copy?.imageUploadFailed ?? 'Image upload failed.',
|
|
149
|
-
progress: copy?.uploadProgress ?? 'Uploading image: {progress}%',
|
|
150
|
-
};
|
|
151
|
-
}, /* @ts-ignore */
|
|
152
|
-
...(ngDevMode ? [{ debugName: "_copy" }] : /* istanbul ignore next */ []));
|
|
153
|
-
constructor() {
|
|
154
|
-
effect(() => {
|
|
155
|
-
const pending = this._pending();
|
|
156
|
-
for (const item of pending) {
|
|
157
|
-
if (item.status === 'failed') {
|
|
158
|
-
this._announcement.set(this._copy().failed);
|
|
159
|
-
this._buckets.delete(item.id);
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
const bucket = Math.floor(item.progress / 10) * 10;
|
|
163
|
-
if (this._buckets.get(item.id) === bucket)
|
|
164
|
-
continue;
|
|
165
|
-
this._buckets.set(item.id, bucket);
|
|
166
|
-
this._announcement.set(this._progressLabel(bucket));
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
const stopTerminalEvents = this._coordinator.onTerminal(({ id, reason }) => {
|
|
170
|
-
this._buckets.delete(id);
|
|
171
|
-
if (reason === 'success' && !this._coordinator.hasDialogOwner(id)) {
|
|
172
|
-
this._announcement.set(this._fileI18n().uploadComplete);
|
|
173
|
-
}
|
|
174
|
-
else if (reason === 'cancelled') {
|
|
175
|
-
this._announcement.set(this._copy().cancel);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
inject(DestroyRef).onDestroy(stopTerminalEvents);
|
|
179
|
-
}
|
|
180
|
-
/** @protected Formats localized coarse progress. */
|
|
181
|
-
_progressLabel(progress) {
|
|
182
|
-
return this._copy().progress.replace('{progress}', String(Math.floor(progress / 10) * 10));
|
|
183
|
-
}
|
|
184
|
-
/** @protected Labels a remove action without exposing a bare icon. */
|
|
185
|
-
_removeLabel(name) {
|
|
186
|
-
return this._fileI18n().removeFile.replace('{name}', name);
|
|
187
|
-
}
|
|
188
|
-
/** @protected Cancels an active upload and announces the semantic state. */
|
|
189
|
-
_cancel(id) {
|
|
190
|
-
this._coordinator.cancel(id);
|
|
191
|
-
}
|
|
192
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorImageUploadStatus, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
193
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: MlvEditorImageUploadStatus, isStandalone: true, selector: "mlv-editor-image-upload-status", host: { classAttribute: "mlv-editor-image-upload-status" }, ngImport: i0, template: `
|
|
194
|
-
@if (_pending().length) {
|
|
195
|
-
<ul class="mlv-editor-image-upload-status__list">
|
|
196
|
-
@for (item of _pending(); track item.id) {
|
|
197
|
-
<li class="mlv-editor-image-upload-status__item">
|
|
198
|
-
<span class="mlv-editor-image-upload-status__name">{{
|
|
199
|
-
item.file.name
|
|
200
|
-
}}</span>
|
|
201
|
-
@if (item.status === 'uploading') {
|
|
202
|
-
<mlv-progress
|
|
203
|
-
size="s"
|
|
204
|
-
[value]="item.progress"
|
|
205
|
-
[showPercentage]="true"
|
|
206
|
-
[ariaLabel]="_progressLabel(item.progress)"
|
|
207
|
-
/>
|
|
208
|
-
<button
|
|
209
|
-
mlvButton
|
|
210
|
-
type="button"
|
|
211
|
-
variant="secondary"
|
|
212
|
-
[attr.aria-label]="_copy().cancel"
|
|
213
|
-
[disabled]="_disabled()"
|
|
214
|
-
(click)="_cancel(item.id)"
|
|
215
|
-
>
|
|
216
|
-
{{ _copy().cancel }}
|
|
217
|
-
</button>
|
|
218
|
-
} @else {
|
|
219
|
-
<span role="alert">{{ _copy().failed }}</span>
|
|
220
|
-
<button
|
|
221
|
-
mlvButton
|
|
222
|
-
type="button"
|
|
223
|
-
variant="secondary"
|
|
224
|
-
[attr.aria-label]="_copy().retry"
|
|
225
|
-
[disabled]="_disabled()"
|
|
226
|
-
(click)="_coordinator.retry(item.id)"
|
|
227
|
-
>
|
|
228
|
-
{{ _copy().retry }}
|
|
229
|
-
</button>
|
|
230
|
-
<button
|
|
231
|
-
mlvButton
|
|
232
|
-
type="button"
|
|
233
|
-
variant="secondary"
|
|
234
|
-
[attr.aria-label]="_removeLabel(item.file.name)"
|
|
235
|
-
[disabled]="_disabled()"
|
|
236
|
-
(click)="_coordinator.remove(item.id)"
|
|
237
|
-
>
|
|
238
|
-
{{ _removeLabel(item.file.name) }}
|
|
239
|
-
</button>
|
|
240
|
-
}
|
|
241
|
-
</li>
|
|
242
|
-
}
|
|
243
|
-
</ul>
|
|
244
|
-
}
|
|
245
|
-
<span
|
|
246
|
-
class="mlv-editor-image-upload-status__live"
|
|
247
|
-
aria-live="polite"
|
|
248
|
-
aria-atomic="true"
|
|
249
|
-
>{{ _announcement() }}</span
|
|
250
|
-
>
|
|
251
|
-
`, isInline: true, styles: [".mlv-editor-image-upload-dialog{box-sizing:border-box;padding:0;margin:0;font-family:var(--mlv-typography-family-text);font-size:var(--mlv-font-size-m)}.mlv-editor-image-upload-dialog *{box-sizing:border-box}.mlv-editor-image-upload-dialog__body{display:grid;gap:var(--mlv-spacing-2)}.mlv-editor-image-upload-dialog__preview{display:block;max-block-size:12rem;max-inline-size:100%;margin-inline:auto;border-radius:var(--mlv-radius-card);object-fit:contain}.mlv-editor-image-upload-dialog__error{margin:0;color:var(--mlv-text-negative)}.mlv-editor-image-upload-dialog__live{position:absolute;width:.0625rem;height:.0625rem;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.mlv-editor-image-upload-status{box-sizing:border-box;padding:0;margin:0;font-family:var(--mlv-typography-family-text);font-size:var(--mlv-font-size-m)}.mlv-editor-image-upload-status *{box-sizing:border-box}.mlv-editor-image-upload-status{display:block;padding:0 var(--mlv-spacing-4) var(--mlv-spacing-2)}.mlv-editor-image-upload-status__list{display:grid;gap:var(--mlv-spacing-1-5);padding:0;margin:0;list-style:none}.mlv-editor-image-upload-status__item{display:grid;grid-template-columns:minmax(0,1fr) minmax(8rem,2fr) auto auto;align-items:center;gap:var(--mlv-spacing-3)}.mlv-editor-image-upload-status__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mlv-editor-image-upload-status__live{position:absolute;width:.0625rem;height:.0625rem;overflow:hidden;clip-path:inset(50%);white-space:nowrap}\n"], dependencies: [{ kind: "component", type: MlvButton, selector: "button[mlvButton], a[mlvButton]", inputs: ["variant", "shape", "disabled", "loading"] }, { kind: "component", type: MlvProgress, selector: "mlv-progress", inputs: ["shape", "value", "size", "tone", "showPercentage", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
252
|
-
}
|
|
253
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorImageUploadStatus, decorators: [{
|
|
254
|
-
type: Component,
|
|
255
|
-
args: [{ selector: 'mlv-editor-image-upload-status', imports: [MlvButton, MlvProgress], template: `
|
|
256
|
-
@if (_pending().length) {
|
|
257
|
-
<ul class="mlv-editor-image-upload-status__list">
|
|
258
|
-
@for (item of _pending(); track item.id) {
|
|
259
|
-
<li class="mlv-editor-image-upload-status__item">
|
|
260
|
-
<span class="mlv-editor-image-upload-status__name">{{
|
|
261
|
-
item.file.name
|
|
262
|
-
}}</span>
|
|
263
|
-
@if (item.status === 'uploading') {
|
|
264
|
-
<mlv-progress
|
|
265
|
-
size="s"
|
|
266
|
-
[value]="item.progress"
|
|
267
|
-
[showPercentage]="true"
|
|
268
|
-
[ariaLabel]="_progressLabel(item.progress)"
|
|
269
|
-
/>
|
|
270
|
-
<button
|
|
271
|
-
mlvButton
|
|
272
|
-
type="button"
|
|
273
|
-
variant="secondary"
|
|
274
|
-
[attr.aria-label]="_copy().cancel"
|
|
275
|
-
[disabled]="_disabled()"
|
|
276
|
-
(click)="_cancel(item.id)"
|
|
277
|
-
>
|
|
278
|
-
{{ _copy().cancel }}
|
|
279
|
-
</button>
|
|
280
|
-
} @else {
|
|
281
|
-
<span role="alert">{{ _copy().failed }}</span>
|
|
282
|
-
<button
|
|
283
|
-
mlvButton
|
|
284
|
-
type="button"
|
|
285
|
-
variant="secondary"
|
|
286
|
-
[attr.aria-label]="_copy().retry"
|
|
287
|
-
[disabled]="_disabled()"
|
|
288
|
-
(click)="_coordinator.retry(item.id)"
|
|
289
|
-
>
|
|
290
|
-
{{ _copy().retry }}
|
|
291
|
-
</button>
|
|
292
|
-
<button
|
|
293
|
-
mlvButton
|
|
294
|
-
type="button"
|
|
295
|
-
variant="secondary"
|
|
296
|
-
[attr.aria-label]="_removeLabel(item.file.name)"
|
|
297
|
-
[disabled]="_disabled()"
|
|
298
|
-
(click)="_coordinator.remove(item.id)"
|
|
299
|
-
>
|
|
300
|
-
{{ _removeLabel(item.file.name) }}
|
|
301
|
-
</button>
|
|
302
|
-
}
|
|
303
|
-
</li>
|
|
304
|
-
}
|
|
305
|
-
</ul>
|
|
306
|
-
}
|
|
307
|
-
<span
|
|
308
|
-
class="mlv-editor-image-upload-status__live"
|
|
309
|
-
aria-live="polite"
|
|
310
|
-
aria-atomic="true"
|
|
311
|
-
>{{ _announcement() }}</span
|
|
312
|
-
>
|
|
313
|
-
`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'mlv-editor-image-upload-status' }, styles: [".mlv-editor-image-upload-dialog{box-sizing:border-box;padding:0;margin:0;font-family:var(--mlv-typography-family-text);font-size:var(--mlv-font-size-m)}.mlv-editor-image-upload-dialog *{box-sizing:border-box}.mlv-editor-image-upload-dialog__body{display:grid;gap:var(--mlv-spacing-2)}.mlv-editor-image-upload-dialog__preview{display:block;max-block-size:12rem;max-inline-size:100%;margin-inline:auto;border-radius:var(--mlv-radius-card);object-fit:contain}.mlv-editor-image-upload-dialog__error{margin:0;color:var(--mlv-text-negative)}.mlv-editor-image-upload-dialog__live{position:absolute;width:.0625rem;height:.0625rem;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.mlv-editor-image-upload-status{box-sizing:border-box;padding:0;margin:0;font-family:var(--mlv-typography-family-text);font-size:var(--mlv-font-size-m)}.mlv-editor-image-upload-status *{box-sizing:border-box}.mlv-editor-image-upload-status{display:block;padding:0 var(--mlv-spacing-4) var(--mlv-spacing-2)}.mlv-editor-image-upload-status__list{display:grid;gap:var(--mlv-spacing-1-5);padding:0;margin:0;list-style:none}.mlv-editor-image-upload-status__item{display:grid;grid-template-columns:minmax(0,1fr) minmax(8rem,2fr) auto auto;align-items:center;gap:var(--mlv-spacing-3)}.mlv-editor-image-upload-status__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mlv-editor-image-upload-status__live{position:absolute;width:.0625rem;height:.0625rem;overflow:hidden;clip-path:inset(50%);white-space:nowrap}\n"] }]
|
|
314
|
-
}], ctorParameters: () => [] });
|
|
315
|
-
//# sourceMappingURL=editor-image-upload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor-image-upload.js","sourceRoot":"","sources":["../../../../../../libs/editor/src/lib/toolbar/editor-image-upload.ts","../../../../../../libs/editor/src/lib/toolbar/editor-image-upload.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,MAAM,EACN,UAAU,EACV,MAAM,EACN,QAAQ,EACR,MAAM,EACN,SAAS,EACT,iBAAiB,GAElB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAqB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAA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AK,EAAE,gCAAgC,EAAE","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n Injector,\n signal,\n viewChild,\n ViewEncapsulation,\n type Signal,\n} from '@angular/core';\nimport { LucideImage } from '@lucide/angular';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvDialogService, type MlvDialogRef } from '@malva-ui/core/dialog';\nimport { MlvProgress } from '@malva-ui/core/progress';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport { MLV_EDITOR_I18N, MLV_FILE_UPLOAD_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport {\n MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR,\n resolveMlvEditorImageUploadCoordinator,\n} from '../upload/editor-image-upload-coordinator';\nimport { MlvEditorImageUploadDialog } from './editor-image-upload-dialog';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\n\n/** Public toolbar entry point for the editor image-upload dialog. */\n@Component({\n selector: 'mlv-editor-image-upload',\n imports: [\n LucideImage,\n MlvButton,\n MlvButtonIcon,\n MlvTooltip,\n MlvEditorToolbarWidget,\n ],\n templateUrl: './editor-image-upload.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-image-upload',\n '[hidden]': '!_visible()',\n },\n})\nexport class MlvEditorImageUpload {\n /** @protected Editor-scoped command/form state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @protected Shared upload coordinator for this editor instance. */\n protected readonly _coordinator = computed(() =>\n resolveMlvEditorImageUploadCoordinator(this._context.imageUpload),\n );\n\n /** @private Transaction invalidation for runtime command support. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {\n optional: true,\n });\n\n /** @private Malva dialog service used for the one modal surface. */\n private readonly _dialogs = inject(MlvDialogService);\n\n /** @private Exact child injector passed through to the dialog portal. */\n private readonly _injector = inject(Injector);\n\n /** @private Trigger restored by the shared dialog lifecycle. */\n private readonly _trigger = viewChild.required('_trigger', {\n read: ElementRef,\n }) as Signal<ElementRef<HTMLButtonElement>>;\n\n /** @private Current dialog, preventing duplicate opens. */\n private _dialogRef: MlvDialogRef<void> | undefined;\n\n /** @private Component teardown closes any owned dialog. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Reactive localized trigger copy. */\n protected readonly _copy = computed(\n () => this._i18n?.().uploadImage ?? 'Upload image',\n );\n\n /** @protected Whether the editor has both required upload commands. */\n protected readonly _supported = computed(() => {\n this._revision?.();\n const commands = this._context.editor()?.commands as\n | Record<string, unknown>\n | undefined;\n return (\n typeof commands?.['setImage'] === 'function' &&\n typeof commands?.['insertUploadPlaceholder'] === 'function' &&\n typeof commands?.['replaceUploadPlaceholder'] === 'function'\n );\n });\n\n /** @protected Whether the mutation entry point belongs in this toolbar. */\n protected readonly _visible = computed(\n () =>\n !!this._coordinator() &&\n !!this._coordinator()?.adapterAvailable() &&\n this._supported() &&\n !this._context.readonly(),\n );\n\n /** @protected Whether the visible trigger is currently inert. */\n protected readonly _disabled = computed(\n () =>\n this._context.disabled() ||\n this._context.readonly() ||\n !this._coordinator()?.available(),\n );\n\n constructor() {\n effect(() => {\n if (\n this._dialogRef &&\n (this._context.disabled() || this._context.readonly())\n ) {\n this._dialogRef.close();\n }\n });\n this._destroyRef.onDestroy(() => this._dialogRef?.close());\n }\n\n /** @protected Opens one editor-scoped Malva upload dialog. */\n protected _open(): void {\n const coordinator = this._coordinator();\n if (\n !coordinator ||\n this._disabled() ||\n !this._visible() ||\n this._dialogRef\n ) {\n return;\n }\n const trigger = this._trigger().nativeElement;\n const ref = this._dialogs.open<void>(MlvEditorImageUploadDialog, {\n title: this._copy(),\n injector: Injector.create({\n parent: this._injector,\n providers: [\n {\n provide: MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR,\n useValue: coordinator,\n },\n ],\n }),\n size: 's',\n });\n this._dialogRef = ref;\n ref.afterClosed().subscribe(() => {\n if (this._dialogRef === ref) this._dialogRef = undefined;\n if (\n !this._context.disabled() &&\n trigger.isConnected &&\n document.activeElement !== trigger\n ) {\n trigger.focus();\n }\n });\n }\n}\n\n/** @internal Non-serializable pending-upload surface owned by the editor shell. */\n@Component({\n selector: 'mlv-editor-image-upload-status',\n imports: [MlvButton, MlvProgress],\n template: `\n @if (_pending().length) {\n <ul class=\"mlv-editor-image-upload-status__list\">\n @for (item of _pending(); track item.id) {\n <li class=\"mlv-editor-image-upload-status__item\">\n <span class=\"mlv-editor-image-upload-status__name\">{{\n item.file.name\n }}</span>\n @if (item.status === 'uploading') {\n <mlv-progress\n size=\"s\"\n [value]=\"item.progress\"\n [showPercentage]=\"true\"\n [ariaLabel]=\"_progressLabel(item.progress)\"\n />\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n [attr.aria-label]=\"_copy().cancel\"\n [disabled]=\"_disabled()\"\n (click)=\"_cancel(item.id)\"\n >\n {{ _copy().cancel }}\n </button>\n } @else {\n <span role=\"alert\">{{ _copy().failed }}</span>\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n [attr.aria-label]=\"_copy().retry\"\n [disabled]=\"_disabled()\"\n (click)=\"_coordinator.retry(item.id)\"\n >\n {{ _copy().retry }}\n </button>\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n [attr.aria-label]=\"_removeLabel(item.file.name)\"\n [disabled]=\"_disabled()\"\n (click)=\"_coordinator.remove(item.id)\"\n >\n {{ _removeLabel(item.file.name) }}\n </button>\n }\n </li>\n }\n </ul>\n }\n <span\n class=\"mlv-editor-image-upload-status__live\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >{{ _announcement() }}</span\n >\n `,\n styleUrl: './editor-image-upload-dialog.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'mlv-editor-image-upload-status' },\n})\nexport class MlvEditorImageUploadStatus {\n /** @protected Shared editor coordinator. */\n protected readonly _coordinator = inject(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR);\n\n /** @private Editor state guarding mutation actions. */\n private readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @private Localized file removal copy. */\n private readonly _fileI18n = inject(MLV_FILE_UPLOAD_I18N);\n\n /** @protected Current active and retryable uploads. */\n protected readonly _pending = this._coordinator.pending;\n\n /** @protected Polite coarse-grained live-region text. */\n protected readonly _announcement = signal('');\n\n /** @private Last announced progress bucket for each active item. */\n private readonly _buckets = new Map<string, number>();\n\n /** @protected Whether status actions are inert. */\n protected readonly _disabled = computed(\n () => this._context.disabled() || this._context.readonly(),\n );\n\n /** @protected Reactive localized status/action copy. */\n protected readonly _copy = computed(() => {\n const copy = this._i18n?.();\n return {\n cancel: copy?.cancelUpload ?? 'Cancel upload',\n retry: copy?.retryUpload ?? 'Retry upload',\n failed: copy?.imageUploadFailed ?? 'Image upload failed.',\n progress: copy?.uploadProgress ?? 'Uploading image: {progress}%',\n };\n });\n\n constructor() {\n effect(() => {\n const pending = this._pending();\n\n for (const item of pending) {\n if (item.status === 'failed') {\n this._announcement.set(this._copy().failed);\n this._buckets.delete(item.id);\n continue;\n }\n const bucket = Math.floor(item.progress / 10) * 10;\n if (this._buckets.get(item.id) === bucket) continue;\n this._buckets.set(item.id, bucket);\n this._announcement.set(this._progressLabel(bucket));\n }\n });\n const stopTerminalEvents = this._coordinator.onTerminal(\n ({ id, reason }) => {\n this._buckets.delete(id);\n if (reason === 'success' && !this._coordinator.hasDialogOwner(id)) {\n this._announcement.set(this._fileI18n().uploadComplete);\n } else if (reason === 'cancelled') {\n this._announcement.set(this._copy().cancel);\n }\n },\n );\n inject(DestroyRef).onDestroy(stopTerminalEvents);\n }\n\n /** @protected Formats localized coarse progress. */\n protected _progressLabel(progress: number): string {\n return this._copy().progress.replace(\n '{progress}',\n String(Math.floor(progress / 10) * 10),\n );\n }\n\n /** @protected Labels a remove action without exposing a bare icon. */\n protected _removeLabel(name: string): string {\n return this._fileI18n().removeFile.replace('{name}', name);\n }\n\n /** @protected Cancels an active upload and announces the semantic state. */\n protected _cancel(id: string): void {\n this._coordinator.cancel(id);\n }\n}\n","<button\n #_trigger\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_disabled()\"\n [attr.aria-label]=\"_copy()\"\n [attr.aria-pressed]=\"false\"\n [mlvTooltip]=\"_copy()\"\n (click)=\"_open()\"\n>\n <svg mlvButtonIcon lucideImage aria-hidden=\"true\" />\n</button>\n"]}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, computed, inject, ViewEncapsulation, } from '@angular/core';
|
|
2
|
-
import { LucideBold, LucideItalic, LucideStrikethrough, LucideUnderline, } from '@lucide/angular';
|
|
3
|
-
import { MLV_EDITOR_TOOLBAR_CONTEXT, MLV_EDITOR_TOOLBAR_REVISION, } from '../editor-toolbar-context';
|
|
4
|
-
import { MLV_EDITOR_I18N } from '@malva-ui/i18n';
|
|
5
|
-
import { MlvEditorCommandButton } from './editor-command-button';
|
|
6
|
-
import { MlvButtonIcon } from '@malva-ui/core/button';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
/** Inline bold, italic, strike-through, and underline toggles. */
|
|
9
|
-
export class MlvEditorInlineMarks {
|
|
10
|
-
/** @protected Editor command state. */ _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);
|
|
11
|
-
/** @private Per-editor state invalidation signal. */ _revision = inject(MLV_EDITOR_TOOLBAR_REVISION);
|
|
12
|
-
/** @private Optional localized copy. */ _i18n = inject(MLV_EDITOR_I18N, { optional: true });
|
|
13
|
-
/** @protected Resolved labels. */ _copy = computed(() => ({
|
|
14
|
-
bold: this._i18n?.().bold ?? 'Bold',
|
|
15
|
-
italic: this._i18n?.().italic ?? 'Italic',
|
|
16
|
-
strike: this._i18n?.().strike ?? 'Strike',
|
|
17
|
-
underline: this._i18n?.().underline ?? 'Underline',
|
|
18
|
-
}), /* @ts-ignore */
|
|
19
|
-
...(ngDevMode ? [{ debugName: "_copy" }] : /* istanbul ignore next */ []));
|
|
20
|
-
/** @protected Bold availability. */ _canBold = (editor) => editor.commands.toggleBold !== undefined;
|
|
21
|
-
/** @protected Reads active state after the latest transaction or selection update. */
|
|
22
|
-
_isActive(name) {
|
|
23
|
-
this._revision();
|
|
24
|
-
return this._context.isActive(name);
|
|
25
|
-
}
|
|
26
|
-
/** @protected Current bold command availability. */ _canBoldNow = (editor) => editor.can().chain().toggleBold().run();
|
|
27
|
-
/** @protected Italic availability. */ _canItalic = (editor) => editor.commands.toggleItalic !== undefined;
|
|
28
|
-
/** @protected Current italic command availability. */ _canItalicNow = (editor) => editor.can().chain().toggleItalic().run();
|
|
29
|
-
/** @protected Strike availability. */ _canStrike = (editor) => editor.commands.toggleStrike !== undefined;
|
|
30
|
-
/** @protected Current strike command availability. */ _canStrikeNow = (editor) => editor.can().chain().toggleStrike().run();
|
|
31
|
-
/** @protected Underline availability. */ _canUnderline = (editor) => editor.commands.toggleUnderline !== undefined;
|
|
32
|
-
/** @protected Current underline command availability. */ _canUnderlineNow = (editor) => editor.can().chain().toggleUnderline().run();
|
|
33
|
-
/** @protected Bold command. */ _bold = (editor) => editor.chain().focus().toggleBold().run();
|
|
34
|
-
/** @protected Italic command. */ _italic = (editor) => editor.chain().focus().toggleItalic().run();
|
|
35
|
-
/** @protected Strike command. */ _strike = (editor) => editor.chain().focus().toggleStrike().run();
|
|
36
|
-
/** @protected Underline command. */ _underline = (editor) => editor.chain().focus().toggleUnderline().run();
|
|
37
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorInlineMarks, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
38
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.7", type: MlvEditorInlineMarks, isStandalone: true, selector: "mlv-editor-inline-marks", host: { attributes: { "role": "group" }, classAttribute: "mlv-editor-inline-marks" }, ngImport: i0, template: `
|
|
39
|
-
<mlv-editor-command-button
|
|
40
|
-
[label]="_copy().bold"
|
|
41
|
-
[pressed]="_isActive('bold')"
|
|
42
|
-
[supports]="_canBold"
|
|
43
|
-
[canCommand]="_canBoldNow"
|
|
44
|
-
[command]="_bold"
|
|
45
|
-
><svg mlvButtonIcon lucideBold
|
|
46
|
-
/></mlv-editor-command-button>
|
|
47
|
-
<mlv-editor-command-button
|
|
48
|
-
[label]="_copy().italic"
|
|
49
|
-
[pressed]="_isActive('italic')"
|
|
50
|
-
[supports]="_canItalic"
|
|
51
|
-
[canCommand]="_canItalicNow"
|
|
52
|
-
[command]="_italic"
|
|
53
|
-
><svg mlvButtonIcon lucideItalic
|
|
54
|
-
/></mlv-editor-command-button>
|
|
55
|
-
<mlv-editor-command-button
|
|
56
|
-
[label]="_copy().strike"
|
|
57
|
-
[pressed]="_isActive('strike')"
|
|
58
|
-
[supports]="_canStrike"
|
|
59
|
-
[canCommand]="_canStrikeNow"
|
|
60
|
-
[command]="_strike"
|
|
61
|
-
><svg mlvButtonIcon lucideStrikethrough
|
|
62
|
-
/></mlv-editor-command-button>
|
|
63
|
-
<mlv-editor-command-button
|
|
64
|
-
[label]="_copy().underline"
|
|
65
|
-
[pressed]="_isActive('underline')"
|
|
66
|
-
[supports]="_canUnderline"
|
|
67
|
-
[canCommand]="_canUnderlineNow"
|
|
68
|
-
[command]="_underline"
|
|
69
|
-
><svg mlvButtonIcon lucideUnderline
|
|
70
|
-
/></mlv-editor-command-button>
|
|
71
|
-
`, isInline: true, dependencies: [{ kind: "component", type: MlvEditorCommandButton, selector: "mlv-editor-command-button", inputs: ["label", "supports", "command", "canCommand", "pressed"] }, { kind: "component", type: LucideBold, selector: "svg[lucideBold]" }, { kind: "component", type: LucideItalic, selector: "svg[lucideItalic]" }, { kind: "component", type: LucideStrikethrough, selector: "svg[lucideStrikethrough]" }, { kind: "component", type: LucideUnderline, selector: "svg[lucideUnderline]" }, { kind: "directive", type: MlvButtonIcon, selector: "[mlvButtonIcon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
72
|
-
}
|
|
73
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorInlineMarks, decorators: [{
|
|
74
|
-
type: Component,
|
|
75
|
-
args: [{
|
|
76
|
-
selector: 'mlv-editor-inline-marks',
|
|
77
|
-
imports: [
|
|
78
|
-
MlvEditorCommandButton,
|
|
79
|
-
LucideBold,
|
|
80
|
-
LucideItalic,
|
|
81
|
-
LucideStrikethrough,
|
|
82
|
-
LucideUnderline,
|
|
83
|
-
MlvButtonIcon,
|
|
84
|
-
],
|
|
85
|
-
template: `
|
|
86
|
-
<mlv-editor-command-button
|
|
87
|
-
[label]="_copy().bold"
|
|
88
|
-
[pressed]="_isActive('bold')"
|
|
89
|
-
[supports]="_canBold"
|
|
90
|
-
[canCommand]="_canBoldNow"
|
|
91
|
-
[command]="_bold"
|
|
92
|
-
><svg mlvButtonIcon lucideBold
|
|
93
|
-
/></mlv-editor-command-button>
|
|
94
|
-
<mlv-editor-command-button
|
|
95
|
-
[label]="_copy().italic"
|
|
96
|
-
[pressed]="_isActive('italic')"
|
|
97
|
-
[supports]="_canItalic"
|
|
98
|
-
[canCommand]="_canItalicNow"
|
|
99
|
-
[command]="_italic"
|
|
100
|
-
><svg mlvButtonIcon lucideItalic
|
|
101
|
-
/></mlv-editor-command-button>
|
|
102
|
-
<mlv-editor-command-button
|
|
103
|
-
[label]="_copy().strike"
|
|
104
|
-
[pressed]="_isActive('strike')"
|
|
105
|
-
[supports]="_canStrike"
|
|
106
|
-
[canCommand]="_canStrikeNow"
|
|
107
|
-
[command]="_strike"
|
|
108
|
-
><svg mlvButtonIcon lucideStrikethrough
|
|
109
|
-
/></mlv-editor-command-button>
|
|
110
|
-
<mlv-editor-command-button
|
|
111
|
-
[label]="_copy().underline"
|
|
112
|
-
[pressed]="_isActive('underline')"
|
|
113
|
-
[supports]="_canUnderline"
|
|
114
|
-
[canCommand]="_canUnderlineNow"
|
|
115
|
-
[command]="_underline"
|
|
116
|
-
><svg mlvButtonIcon lucideUnderline
|
|
117
|
-
/></mlv-editor-command-button>
|
|
118
|
-
`,
|
|
119
|
-
encapsulation: ViewEncapsulation.None,
|
|
120
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
121
|
-
host: { class: 'mlv-editor-inline-marks', role: 'group' },
|
|
122
|
-
}]
|
|
123
|
-
}] });
|
|
124
|
-
//# sourceMappingURL=editor-inline-marks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor-inline-marks.js","sourceRoot":"","sources":["../../../../../../libs/editor/src/lib/toolbar/editor-inline-marks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,MAAM,EACN,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;;AAEtD,kEAAkE;AAiDlE,MAAM,OAAO,oBAAoB;IAC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;;;;;;;;;;;;;;;;;;;;;;;;;GAiCT,4DAxCC,sBAAsB,yIACtB,UAAU,4DACV,YAAY,8DACZ,mBAAmB,qEACnB,eAAe,iEACf,aAAa;;2FAwCJ,oBAAoB;kBAhDhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,yBAAyB;oBACnC,OAAO,EAAE;wBACP,sBAAsB;wBACtB,UAAU;wBACV,YAAY;wBACZ,mBAAmB;wBACnB,eAAe;wBACf,aAAa;qBACd;oBACD,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCT;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,IAAI,EAAE,EAAE,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE,OAAO,EAAE;iBAC1D","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport {\n LucideBold,\n LucideItalic,\n LucideStrikethrough,\n LucideUnderline,\n} from '@lucide/angular';\nimport {\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport { MlvEditorCommandButton } from './editor-command-button';\nimport { MlvButtonIcon } from '@malva-ui/core/button';\n\n/** Inline bold, italic, strike-through, and underline toggles. */\n@Component({\n selector: 'mlv-editor-inline-marks',\n imports: [\n MlvEditorCommandButton,\n LucideBold,\n LucideItalic,\n LucideStrikethrough,\n LucideUnderline,\n MlvButtonIcon,\n ],\n template: `\n <mlv-editor-command-button\n [label]=\"_copy().bold\"\n [pressed]=\"_isActive('bold')\"\n [supports]=\"_canBold\"\n [canCommand]=\"_canBoldNow\"\n [command]=\"_bold\"\n ><svg mlvButtonIcon lucideBold\n /></mlv-editor-command-button>\n <mlv-editor-command-button\n [label]=\"_copy().italic\"\n [pressed]=\"_isActive('italic')\"\n [supports]=\"_canItalic\"\n [canCommand]=\"_canItalicNow\"\n [command]=\"_italic\"\n ><svg mlvButtonIcon lucideItalic\n /></mlv-editor-command-button>\n <mlv-editor-command-button\n [label]=\"_copy().strike\"\n [pressed]=\"_isActive('strike')\"\n [supports]=\"_canStrike\"\n [canCommand]=\"_canStrikeNow\"\n [command]=\"_strike\"\n ><svg mlvButtonIcon lucideStrikethrough\n /></mlv-editor-command-button>\n <mlv-editor-command-button\n [label]=\"_copy().underline\"\n [pressed]=\"_isActive('underline')\"\n [supports]=\"_canUnderline\"\n [canCommand]=\"_canUnderlineNow\"\n [command]=\"_underline\"\n ><svg mlvButtonIcon lucideUnderline\n /></mlv-editor-command-button>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'mlv-editor-inline-marks', role: 'group' },\n})\nexport class MlvEditorInlineMarks {\n /** @protected Editor command state. */ protected readonly _context = inject(\n MLV_EDITOR_TOOLBAR_CONTEXT,\n );\n /** @private Per-editor state invalidation signal. */ private readonly _revision =\n inject(MLV_EDITOR_TOOLBAR_REVISION);\n /** @private Optional localized copy. */ private readonly _i18n = inject(\n MLV_EDITOR_I18N,\n { optional: true },\n );\n /** @protected Resolved labels. */ protected readonly _copy = computed(\n () => ({\n bold: this._i18n?.().bold ?? 'Bold',\n italic: this._i18n?.().italic ?? 'Italic',\n strike: this._i18n?.().strike ?? 'Strike',\n underline: this._i18n?.().underline ?? 'Underline',\n }),\n );\n /** @protected Bold availability. */ protected readonly _canBold = (\n editor: Editor,\n ): boolean => editor.commands.toggleBold !== undefined;\n /** @protected Reads active state after the latest transaction or selection update. */\n protected _isActive(name: string): boolean {\n this._revision();\n return this._context.isActive(name);\n }\n /** @protected Current bold command availability. */ protected readonly _canBoldNow =\n (editor: Editor): boolean => editor.can().chain().toggleBold().run();\n /** @protected Italic availability. */ protected readonly _canItalic = (\n editor: Editor,\n ): boolean => editor.commands.toggleItalic !== undefined;\n /** @protected Current italic command availability. */ protected readonly _canItalicNow =\n (editor: Editor): boolean => editor.can().chain().toggleItalic().run();\n /** @protected Strike availability. */ protected readonly _canStrike = (\n editor: Editor,\n ): boolean => editor.commands.toggleStrike !== undefined;\n /** @protected Current strike command availability. */ protected readonly _canStrikeNow =\n (editor: Editor): boolean => editor.can().chain().toggleStrike().run();\n /** @protected Underline availability. */ protected readonly _canUnderline = (\n editor: Editor,\n ): boolean => editor.commands.toggleUnderline !== undefined;\n /** @protected Current underline command availability. */ protected readonly _canUnderlineNow =\n (editor: Editor): boolean => editor.can().chain().toggleUnderline().run();\n /** @protected Bold command. */ protected readonly _bold = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleBold().run();\n /** @protected Italic command. */ protected readonly _italic = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleItalic().run();\n /** @protected Strike command. */ protected readonly _strike = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleStrike().run();\n /** @protected Underline command. */ protected readonly _underline = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleUnderline().run();\n}\n"]}
|