@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,826 +0,0 @@
|
|
|
1
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
2
|
-
import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
|
|
3
|
-
import { ChangeDetectionStrategy, Component, computed, DestroyRef, Directive, ElementRef, effect, inject, input, Injectable, PLATFORM_ID, signal, viewChild, ViewEncapsulation, } from '@angular/core';
|
|
4
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
-
import { LucideEllipsis } from '@lucide/angular';
|
|
6
|
-
import { MlvFade, MlvResizeObserverService } from '@malva-ui/cdk/utils';
|
|
7
|
-
import { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';
|
|
8
|
-
import { MlvListItem } from '@malva-ui/core/list';
|
|
9
|
-
import { MlvMenu, MlvMenuItem, MlvMenuTrigger } from '@malva-ui/core/menu';
|
|
10
|
-
import { MlvToolbar } from '@malva-ui/core/toolbar';
|
|
11
|
-
import { MlvDivider } from '@malva-ui/core/divider';
|
|
12
|
-
import { MlvTooltip } from '@malva-ui/core/tooltip';
|
|
13
|
-
import { MLV_EDITOR_I18N } from '@malva-ui/i18n';
|
|
14
|
-
import { MLV_EDITOR_OVERLAY_REGISTRY, MLV_EDITOR_TOOLBAR_CONTEXT, MLV_EDITOR_TOOLBAR_ROVING, MLV_EDITOR_TOOLBAR_REVISION, MlvEditorOverlayRegistry, MlvEditorToolbarRovingRegistry, MlvEditorToolbarRevision, } from '../editor-toolbar-context';
|
|
15
|
-
import { MlvEditorAlignment } from './editor-alignment';
|
|
16
|
-
import { MlvEditorBlockInsert } from './editor-block-insert';
|
|
17
|
-
import { MlvEditorHeading } from './editor-heading';
|
|
18
|
-
import { MlvEditorHighlight } from './editor-highlight';
|
|
19
|
-
import { MlvEditorInlineMarks } from './editor-inline-marks';
|
|
20
|
-
import { MlvEditorList } from './editor-list';
|
|
21
|
-
import { MlvEditorLink } from './editor-link';
|
|
22
|
-
import { MlvEditorImageUpload } from './editor-image-upload';
|
|
23
|
-
import { MlvEditorTable } from './editor-table';
|
|
24
|
-
import { MlvEditorUndoRedo } from './editor-undo-redo';
|
|
25
|
-
import { MlvEditorZoom } from './editor-zoom';
|
|
26
|
-
import { MlvEditorTextColor } from './editor-text-color';
|
|
27
|
-
import { MlvEditorToolbarWidget } from './editor-toolbar-widget';
|
|
28
|
-
import * as i0 from "@angular/core";
|
|
29
|
-
/** @internal Named roving-focus root used by editor and compatibility toolbar shells. */
|
|
30
|
-
export class MlvEditorToolbarRoot {
|
|
31
|
-
/** Whether the toolbar has entered its compact overflow layout. */
|
|
32
|
-
narrow = signal(false, /* @ts-ignore */
|
|
33
|
-
...(ngDevMode ? [{ debugName: "narrow" }] : /* istanbul ignore next */ []));
|
|
34
|
-
/** Accessible toolbar name. */
|
|
35
|
-
ariaLabel = input(undefined, /* @ts-ignore */
|
|
36
|
-
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
37
|
-
/** Whether the composite toolbar is unavailable. */
|
|
38
|
-
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
39
|
-
/** Keyboard-navigation axis. */
|
|
40
|
-
orientation = input('horizontal', /* @ts-ignore */
|
|
41
|
-
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
42
|
-
/** Whether arrow navigation wraps at the boundaries. */
|
|
43
|
-
wrap = input(true, { ...(ngDevMode ? { debugName: "wrap" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
44
|
-
/** @internal Editor-scoped focus registry. */
|
|
45
|
-
_registry = inject(MLV_EDITOR_TOOLBAR_ROVING);
|
|
46
|
-
/** @internal Transaction state that re-evaluates disabled toolbar widgets. */
|
|
47
|
-
_revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {
|
|
48
|
-
optional: true,
|
|
49
|
-
});
|
|
50
|
-
/** @internal Optional localized defaults. */
|
|
51
|
-
_i18n = inject(MLV_EDITOR_I18N, { optional: true });
|
|
52
|
-
/** @internal Actual composite-root element. */
|
|
53
|
-
_element = inject(ElementRef);
|
|
54
|
-
/** @internal Root teardown lifecycle. */
|
|
55
|
-
_destroyRef = inject(DestroyRef);
|
|
56
|
-
/** @internal Avoids DOM observers during server rendering. */
|
|
57
|
-
_isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
58
|
-
/** @internal Shared observer abstraction for responsive width changes. */
|
|
59
|
-
_resizeObserver = inject(MlvResizeObserverService);
|
|
60
|
-
constructor() {
|
|
61
|
-
effect(() => {
|
|
62
|
-
this._revision?.();
|
|
63
|
-
this._registry.setDisabled(this.disabled());
|
|
64
|
-
});
|
|
65
|
-
if (this._isBrowser) {
|
|
66
|
-
this._destroyRef.onDestroy(this._registry.connect(this._element.nativeElement));
|
|
67
|
-
this._resizeObserver
|
|
68
|
-
.observe(this._element)
|
|
69
|
-
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
70
|
-
.subscribe((entries) => {
|
|
71
|
-
const width = entries[entries.length - 1]?.contentRect.width;
|
|
72
|
-
if (width !== undefined && width > 0)
|
|
73
|
-
this.narrow.set(width < 640);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/** @internal Resolves the user or localized toolbar label. */
|
|
78
|
-
resolvedAriaLabel() {
|
|
79
|
-
return this.ariaLabel() ?? this._i18n?.().toolbarLabel ?? 'Editor toolbar';
|
|
80
|
-
}
|
|
81
|
-
/** @internal Handles roving navigation from the host metadata event binding. */
|
|
82
|
-
handleKeydown(event) {
|
|
83
|
-
if (this.disabled())
|
|
84
|
-
return;
|
|
85
|
-
const target = event.target instanceof HTMLElement ? event.target : null;
|
|
86
|
-
if (!target)
|
|
87
|
-
return;
|
|
88
|
-
if (event.key === 'Home' || event.key === 'End') {
|
|
89
|
-
event.preventDefault();
|
|
90
|
-
this._registry.focusBoundary(event.key === 'Home' ? 'start' : 'end');
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const direction = this.orientation() === 'vertical'
|
|
94
|
-
? event.key === 'ArrowUp'
|
|
95
|
-
? -1
|
|
96
|
-
: event.key === 'ArrowDown'
|
|
97
|
-
? 1
|
|
98
|
-
: undefined
|
|
99
|
-
: event.key === 'ArrowLeft'
|
|
100
|
-
? -1
|
|
101
|
-
: event.key === 'ArrowRight'
|
|
102
|
-
? 1
|
|
103
|
-
: undefined;
|
|
104
|
-
if (!direction)
|
|
105
|
-
return;
|
|
106
|
-
event.preventDefault();
|
|
107
|
-
this._registry.move(target, direction, this.wrap());
|
|
108
|
-
}
|
|
109
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorToolbarRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
110
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.7", type: MlvEditorToolbarRoot, isStandalone: true, selector: "[mlvEditorToolbarRoot]", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "toolbar" }, listeners: { "keydown": "handleKeydown($event)" }, properties: { "class.mlv-editor-toolbar--narrow": "narrow()", "attr.aria-label": "resolvedAriaLabel()", "attr.aria-orientation": "orientation()", "attr.aria-disabled": "disabled() || null" }, classAttribute: "mlv-editor-toolbar" }, exportAs: ["mlvEditorToolbarRoot"], ngImport: i0 });
|
|
111
|
-
}
|
|
112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorToolbarRoot, decorators: [{
|
|
113
|
-
type: Directive,
|
|
114
|
-
args: [{
|
|
115
|
-
selector: '[mlvEditorToolbarRoot]',
|
|
116
|
-
exportAs: 'mlvEditorToolbarRoot',
|
|
117
|
-
host: {
|
|
118
|
-
class: 'mlv-editor-toolbar',
|
|
119
|
-
'[class.mlv-editor-toolbar--narrow]': 'narrow()',
|
|
120
|
-
role: 'toolbar',
|
|
121
|
-
'[attr.aria-label]': 'resolvedAriaLabel()',
|
|
122
|
-
'[attr.aria-orientation]': 'orientation()',
|
|
123
|
-
'[attr.aria-disabled]': 'disabled() || null',
|
|
124
|
-
'(keydown)': 'handleKeydown($event)',
|
|
125
|
-
},
|
|
126
|
-
}]
|
|
127
|
-
}], ctorParameters: () => [], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], wrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrap", required: false }] }] } });
|
|
128
|
-
/** @internal Responsive menu containing commands removed from the primary row. */
|
|
129
|
-
export class MlvEditorToolbarOverflow {
|
|
130
|
-
/** @protected Responsive state owned by the enclosing toolbar root. */
|
|
131
|
-
_root = inject(MlvEditorToolbarRoot);
|
|
132
|
-
/** @protected Editor-scoped command state. */
|
|
133
|
-
_context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);
|
|
134
|
-
/** @private Command-state invalidation signal. */
|
|
135
|
-
_revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {
|
|
136
|
-
optional: true,
|
|
137
|
-
});
|
|
138
|
-
/** @private Roving coordinator used to recover focus after wide layout returns. */
|
|
139
|
-
_roving = inject(MLV_EDITOR_TOOLBAR_ROVING);
|
|
140
|
-
/** @private Detached overlay registry. */
|
|
141
|
-
_overlays = inject(MLV_EDITOR_OVERLAY_REGISTRY);
|
|
142
|
-
/** @private Document used after a browser menu opens. */
|
|
143
|
-
_document = inject(DOCUMENT);
|
|
144
|
-
/** @private Teardown scope for a currently open menu. */
|
|
145
|
-
_destroyRef = inject(DestroyRef);
|
|
146
|
-
/** @private Optional reactive localized editor copy. */
|
|
147
|
-
_i18n = inject(MLV_EDITOR_I18N, { optional: true });
|
|
148
|
-
/** @protected Rendered overflow menu. */
|
|
149
|
-
_menu = viewChild.required('_menu', /* @ts-ignore */
|
|
150
|
-
...(ngDevMode ? [{ debugName: "_menu" }] : /* istanbul ignore next */ []));
|
|
151
|
-
/** @protected Trigger that owns the overflow menu. */
|
|
152
|
-
_trigger = viewChild.required(MlvMenuTrigger, /* @ts-ignore */
|
|
153
|
-
...(ngDevMode ? [{ debugName: "_trigger" }] : /* istanbul ignore next */ []));
|
|
154
|
-
/** @private Current detached-overlay registration. */
|
|
155
|
-
_unregister;
|
|
156
|
-
/** @private Guards queued registration after close. */
|
|
157
|
-
_menuOpen = false;
|
|
158
|
-
/** @private Previous responsive state used to identify a narrow-to-wide edge. */
|
|
159
|
-
_wasNarrow = false;
|
|
160
|
-
/** @protected Formatting order retained when controls move into overflow. */
|
|
161
|
-
_alignments = computed(() => [
|
|
162
|
-
{ value: 'left', label: this._copy().alignLeft },
|
|
163
|
-
{ value: 'center', label: this._copy().alignCenter },
|
|
164
|
-
{ value: 'right', label: this._copy().alignRight },
|
|
165
|
-
{ value: 'justify', label: this._copy().alignJustify },
|
|
166
|
-
], /* @ts-ignore */
|
|
167
|
-
...(ngDevMode ? [{ debugName: "_alignments" }] : /* istanbul ignore next */ []));
|
|
168
|
-
/** @protected Reactive localized copy for every overflow command. */
|
|
169
|
-
_copy = computed(() => {
|
|
170
|
-
const copy = this._i18n?.();
|
|
171
|
-
return {
|
|
172
|
-
moreFormatting: copy?.moreFormatting ?? 'More formatting',
|
|
173
|
-
bold: copy?.bold ?? 'Bold',
|
|
174
|
-
italic: copy?.italic ?? 'Italic',
|
|
175
|
-
strike: copy?.strike ?? 'Strike-through',
|
|
176
|
-
underline: copy?.underline ?? 'Underline',
|
|
177
|
-
alignLeft: copy?.alignLeft ?? 'Align left',
|
|
178
|
-
alignCenter: copy?.alignCenter ?? 'Align center',
|
|
179
|
-
alignRight: copy?.alignRight ?? 'Align right',
|
|
180
|
-
alignJustify: copy?.alignJustify ?? 'Justify',
|
|
181
|
-
blockquote: copy?.blockquote ?? 'Blockquote',
|
|
182
|
-
codeBlock: copy?.codeBlock ?? 'Code block',
|
|
183
|
-
horizontalRule: copy?.horizontalRule ?? 'Horizontal rule',
|
|
184
|
-
};
|
|
185
|
-
}, /* @ts-ignore */
|
|
186
|
-
...(ngDevMode ? [{ debugName: "_copy" }] : /* istanbul ignore next */ []));
|
|
187
|
-
/** @protected Bold toggle command. */
|
|
188
|
-
_bold = (editor) => editor.chain().focus().toggleBold().run();
|
|
189
|
-
/** @protected Italic toggle command. */
|
|
190
|
-
_italic = (editor) => editor.chain().focus().toggleItalic().run();
|
|
191
|
-
/** @protected Strike toggle command. */
|
|
192
|
-
_strike = (editor) => editor.chain().focus().toggleStrike().run();
|
|
193
|
-
/** @protected Underline toggle command. */
|
|
194
|
-
_underline = (editor) => editor.chain().focus().toggleUnderline().run();
|
|
195
|
-
/** @protected Blockquote toggle command. */
|
|
196
|
-
_blockquote = (editor) => editor.chain().focus().toggleBlockquote().run();
|
|
197
|
-
/** @protected Code-block toggle command. */
|
|
198
|
-
_codeBlock = (editor) => editor.chain().focus().toggleCodeBlock().run();
|
|
199
|
-
/** @protected Horizontal-rule insertion command. */
|
|
200
|
-
_horizontalRule = (editor) => editor.chain().focus().setHorizontalRule().run();
|
|
201
|
-
/** @protected Non-mutating bold capability check. */
|
|
202
|
-
_canBold = (editor) => editor.can().chain().toggleBold().run();
|
|
203
|
-
/** @protected Non-mutating italic capability check. */
|
|
204
|
-
_canItalic = (editor) => editor.can().chain().toggleItalic().run();
|
|
205
|
-
/** @protected Non-mutating strike capability check. */
|
|
206
|
-
_canStrike = (editor) => editor.can().chain().toggleStrike().run();
|
|
207
|
-
/** @protected Non-mutating underline capability check. */
|
|
208
|
-
_canUnderline = (editor) => editor.can().chain().toggleUnderline().run();
|
|
209
|
-
/** @protected Non-mutating blockquote capability check. */
|
|
210
|
-
_canBlockquote = (editor) => editor.can().chain().toggleBlockquote().run();
|
|
211
|
-
/** @protected Non-mutating code-block capability check. */
|
|
212
|
-
_canCodeBlock = (editor) => editor.can().chain().toggleCodeBlock().run();
|
|
213
|
-
/** @protected Non-mutating horizontal-rule capability check. */
|
|
214
|
-
_canHorizontalRule = (editor) => editor.can().chain().setHorizontalRule().run();
|
|
215
|
-
constructor() {
|
|
216
|
-
effect(() => {
|
|
217
|
-
const narrow = this._root.narrow();
|
|
218
|
-
const wasNarrow = this._wasNarrow;
|
|
219
|
-
this._wasNarrow = narrow;
|
|
220
|
-
if (narrow || !wasNarrow || !this._menuOpen)
|
|
221
|
-
return;
|
|
222
|
-
this._menu().close();
|
|
223
|
-
queueMicrotask(() => this._roving.focusBoundary('start'));
|
|
224
|
-
});
|
|
225
|
-
this._destroyRef.onDestroy(() => this._unregisterOverlay());
|
|
226
|
-
}
|
|
227
|
-
/** @protected Whether the active extension set registered a command. */
|
|
228
|
-
_supported(command) {
|
|
229
|
-
this._revision?.();
|
|
230
|
-
const editor = this._context.editor();
|
|
231
|
-
if (!editor)
|
|
232
|
-
return false;
|
|
233
|
-
return (typeof editor.commands[command] === 'function');
|
|
234
|
-
}
|
|
235
|
-
/** @protected Alignment command factory. */
|
|
236
|
-
_align(value) {
|
|
237
|
-
return (editor) => editor.chain().focus().setTextAlign(value).run();
|
|
238
|
-
}
|
|
239
|
-
/** @protected Non-mutating alignment capability factory. */
|
|
240
|
-
_canAlign(value) {
|
|
241
|
-
return (editor) => editor.can().chain().setTextAlign(value).run();
|
|
242
|
-
}
|
|
243
|
-
/** @protected Whether the command is blocked or unsupported. */
|
|
244
|
-
_commandDisabled(command) {
|
|
245
|
-
this._revision?.();
|
|
246
|
-
if (this._context.disabled() || this._context.readonly())
|
|
247
|
-
return true;
|
|
248
|
-
try {
|
|
249
|
-
return !this._context.can(command);
|
|
250
|
-
}
|
|
251
|
-
catch {
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
/** @protected Executes one overflow command through the context guard. */
|
|
256
|
-
_run(command) {
|
|
257
|
-
this._context.run(command);
|
|
258
|
-
}
|
|
259
|
-
/** @protected Registers the detached overflow panel with composite focus. */
|
|
260
|
-
_registerOverlay() {
|
|
261
|
-
this._menuOpen = true;
|
|
262
|
-
queueMicrotask(() => {
|
|
263
|
-
if (!this._menuOpen)
|
|
264
|
-
return;
|
|
265
|
-
const panel = this._document.getElementById(this._menu().panelId);
|
|
266
|
-
if (!panel)
|
|
267
|
-
return;
|
|
268
|
-
this._unregister?.();
|
|
269
|
-
this._unregister = this._overlays.register(panel, () => this._trigger().close());
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
/** @protected Releases focus ownership after close. */
|
|
273
|
-
_unregisterOverlay() {
|
|
274
|
-
this._menuOpen = false;
|
|
275
|
-
this._unregister?.();
|
|
276
|
-
this._unregister = undefined;
|
|
277
|
-
}
|
|
278
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorToolbarOverflow, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
279
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: MlvEditorToolbarOverflow, isStandalone: true, selector: "mlv-editor-toolbar-overflow", host: { properties: { "hidden": "!_root.narrow()" }, classAttribute: "mlv-editor-toolbar__overflow" }, viewQueries: [{ propertyName: "_menu", first: true, predicate: ["_menu"], descendants: true, isSignal: true }, { propertyName: "_trigger", first: true, predicate: MlvMenuTrigger, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
280
|
-
<button
|
|
281
|
-
mlvButton
|
|
282
|
-
mlvEditorToolbarWidget
|
|
283
|
-
type="button"
|
|
284
|
-
shape="circle"
|
|
285
|
-
variant="transparent"
|
|
286
|
-
[attr.aria-label]="_copy().moreFormatting"
|
|
287
|
-
[disabled]="_context.disabled()"
|
|
288
|
-
[mlvMenuTrigger]="_menu"
|
|
289
|
-
[menuTriggerDisabled]="_context.disabled()"
|
|
290
|
-
[mlvTooltip]="_copy().moreFormatting"
|
|
291
|
-
(menuOpened)="_registerOverlay()"
|
|
292
|
-
(menuClosed)="_unregisterOverlay()"
|
|
293
|
-
>
|
|
294
|
-
<svg mlvButtonIcon lucideEllipsis aria-hidden="true" />
|
|
295
|
-
</button>
|
|
296
|
-
<mlv-menu #_menu [label]="_copy().moreFormatting">
|
|
297
|
-
@if (_supported('toggleBold')) {
|
|
298
|
-
<mlv-list-item
|
|
299
|
-
mlvMenuItem
|
|
300
|
-
[disabled]="_commandDisabled(_canBold)"
|
|
301
|
-
[attr.aria-current]="_context.isActive('bold') ? 'true' : null"
|
|
302
|
-
(itemClick)="_run(_bold)"
|
|
303
|
-
>{{ _copy().bold }}</mlv-list-item
|
|
304
|
-
>
|
|
305
|
-
}
|
|
306
|
-
@if (_supported('toggleItalic')) {
|
|
307
|
-
<mlv-list-item
|
|
308
|
-
mlvMenuItem
|
|
309
|
-
[disabled]="_commandDisabled(_canItalic)"
|
|
310
|
-
[attr.aria-current]="_context.isActive('italic') ? 'true' : null"
|
|
311
|
-
(itemClick)="_run(_italic)"
|
|
312
|
-
>{{ _copy().italic }}</mlv-list-item
|
|
313
|
-
>
|
|
314
|
-
}
|
|
315
|
-
@if (_supported('toggleStrike')) {
|
|
316
|
-
<mlv-list-item
|
|
317
|
-
mlvMenuItem
|
|
318
|
-
[disabled]="_commandDisabled(_canStrike)"
|
|
319
|
-
[attr.aria-current]="_context.isActive('strike') ? 'true' : null"
|
|
320
|
-
(itemClick)="_run(_strike)"
|
|
321
|
-
>{{ _copy().strike }}</mlv-list-item
|
|
322
|
-
>
|
|
323
|
-
}
|
|
324
|
-
@if (_supported('toggleUnderline')) {
|
|
325
|
-
<mlv-list-item
|
|
326
|
-
mlvMenuItem
|
|
327
|
-
[disabled]="_commandDisabled(_canUnderline)"
|
|
328
|
-
[attr.aria-current]="_context.isActive('underline') ? 'true' : null"
|
|
329
|
-
(itemClick)="_run(_underline)"
|
|
330
|
-
>{{ _copy().underline }}</mlv-list-item
|
|
331
|
-
>
|
|
332
|
-
}
|
|
333
|
-
@if (_supported('setTextAlign')) {
|
|
334
|
-
@for (alignment of _alignments(); track alignment.value) {
|
|
335
|
-
<mlv-list-item
|
|
336
|
-
mlvMenuItem
|
|
337
|
-
[disabled]="_commandDisabled(_canAlign(alignment.value))"
|
|
338
|
-
[attr.aria-current]="
|
|
339
|
-
_context.isActive('paragraph', { textAlign: alignment.value })
|
|
340
|
-
? 'true'
|
|
341
|
-
: null
|
|
342
|
-
"
|
|
343
|
-
(itemClick)="_run(_align(alignment.value))"
|
|
344
|
-
>{{ alignment.label }}</mlv-list-item
|
|
345
|
-
>
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
@if (_supported('toggleBlockquote')) {
|
|
349
|
-
<mlv-list-item
|
|
350
|
-
mlvMenuItem
|
|
351
|
-
[disabled]="_commandDisabled(_canBlockquote)"
|
|
352
|
-
[attr.aria-current]="_context.isActive('blockquote') ? 'true' : null"
|
|
353
|
-
(itemClick)="_run(_blockquote)"
|
|
354
|
-
>{{ _copy().blockquote }}</mlv-list-item
|
|
355
|
-
>
|
|
356
|
-
}
|
|
357
|
-
@if (_supported('toggleCodeBlock')) {
|
|
358
|
-
<mlv-list-item
|
|
359
|
-
mlvMenuItem
|
|
360
|
-
[disabled]="_commandDisabled(_canCodeBlock)"
|
|
361
|
-
[attr.aria-current]="_context.isActive('codeBlock') ? 'true' : null"
|
|
362
|
-
(itemClick)="_run(_codeBlock)"
|
|
363
|
-
>{{ _copy().codeBlock }}</mlv-list-item
|
|
364
|
-
>
|
|
365
|
-
}
|
|
366
|
-
@if (_supported('setHorizontalRule')) {
|
|
367
|
-
<mlv-list-item
|
|
368
|
-
mlvMenuItem
|
|
369
|
-
[disabled]="_commandDisabled(_canHorizontalRule)"
|
|
370
|
-
(itemClick)="_run(_horizontalRule)"
|
|
371
|
-
>{{ _copy().horizontalRule }}</mlv-list-item
|
|
372
|
-
>
|
|
373
|
-
}
|
|
374
|
-
</mlv-menu>
|
|
375
|
-
`, isInline: true, dependencies: [{ 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: "component", type: LucideEllipsis, selector: "svg[lucideEllipsis], svg[lucideMoreHorizontal]" }, { kind: "component", type: MlvListItem, selector: "mlv-list-item", inputs: ["itemRole", "unread", "accent"] }, { kind: "component", type: MlvMenu, selector: "mlv-menu", inputs: ["label", "mlvDensity"], outputs: ["closed"] }, { kind: "directive", type: MlvMenuItem, selector: "mlv-list-item[mlvMenuItem]", inputs: ["disabled"], outputs: ["itemClick"] }, { kind: "directive", type: MlvMenuTrigger, selector: "[mlvMenuTrigger]", inputs: ["mlvMenuTrigger", "isSubmenuTrigger", "menuTriggerDisabled"], outputs: ["menuOpened", "menuClosed"] }, { kind: "directive", type: MlvEditorToolbarWidget, selector: "[mlvEditorToolbarWidget]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
376
|
-
}
|
|
377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorToolbarOverflow, decorators: [{
|
|
378
|
-
type: Component,
|
|
379
|
-
args: [{
|
|
380
|
-
selector: 'mlv-editor-toolbar-overflow',
|
|
381
|
-
imports: [
|
|
382
|
-
MlvButton,
|
|
383
|
-
MlvButtonIcon,
|
|
384
|
-
MlvTooltip,
|
|
385
|
-
LucideEllipsis,
|
|
386
|
-
MlvListItem,
|
|
387
|
-
MlvMenu,
|
|
388
|
-
MlvMenuItem,
|
|
389
|
-
MlvMenuTrigger,
|
|
390
|
-
MlvEditorToolbarWidget,
|
|
391
|
-
],
|
|
392
|
-
template: `
|
|
393
|
-
<button
|
|
394
|
-
mlvButton
|
|
395
|
-
mlvEditorToolbarWidget
|
|
396
|
-
type="button"
|
|
397
|
-
shape="circle"
|
|
398
|
-
variant="transparent"
|
|
399
|
-
[attr.aria-label]="_copy().moreFormatting"
|
|
400
|
-
[disabled]="_context.disabled()"
|
|
401
|
-
[mlvMenuTrigger]="_menu"
|
|
402
|
-
[menuTriggerDisabled]="_context.disabled()"
|
|
403
|
-
[mlvTooltip]="_copy().moreFormatting"
|
|
404
|
-
(menuOpened)="_registerOverlay()"
|
|
405
|
-
(menuClosed)="_unregisterOverlay()"
|
|
406
|
-
>
|
|
407
|
-
<svg mlvButtonIcon lucideEllipsis aria-hidden="true" />
|
|
408
|
-
</button>
|
|
409
|
-
<mlv-menu #_menu [label]="_copy().moreFormatting">
|
|
410
|
-
@if (_supported('toggleBold')) {
|
|
411
|
-
<mlv-list-item
|
|
412
|
-
mlvMenuItem
|
|
413
|
-
[disabled]="_commandDisabled(_canBold)"
|
|
414
|
-
[attr.aria-current]="_context.isActive('bold') ? 'true' : null"
|
|
415
|
-
(itemClick)="_run(_bold)"
|
|
416
|
-
>{{ _copy().bold }}</mlv-list-item
|
|
417
|
-
>
|
|
418
|
-
}
|
|
419
|
-
@if (_supported('toggleItalic')) {
|
|
420
|
-
<mlv-list-item
|
|
421
|
-
mlvMenuItem
|
|
422
|
-
[disabled]="_commandDisabled(_canItalic)"
|
|
423
|
-
[attr.aria-current]="_context.isActive('italic') ? 'true' : null"
|
|
424
|
-
(itemClick)="_run(_italic)"
|
|
425
|
-
>{{ _copy().italic }}</mlv-list-item
|
|
426
|
-
>
|
|
427
|
-
}
|
|
428
|
-
@if (_supported('toggleStrike')) {
|
|
429
|
-
<mlv-list-item
|
|
430
|
-
mlvMenuItem
|
|
431
|
-
[disabled]="_commandDisabled(_canStrike)"
|
|
432
|
-
[attr.aria-current]="_context.isActive('strike') ? 'true' : null"
|
|
433
|
-
(itemClick)="_run(_strike)"
|
|
434
|
-
>{{ _copy().strike }}</mlv-list-item
|
|
435
|
-
>
|
|
436
|
-
}
|
|
437
|
-
@if (_supported('toggleUnderline')) {
|
|
438
|
-
<mlv-list-item
|
|
439
|
-
mlvMenuItem
|
|
440
|
-
[disabled]="_commandDisabled(_canUnderline)"
|
|
441
|
-
[attr.aria-current]="_context.isActive('underline') ? 'true' : null"
|
|
442
|
-
(itemClick)="_run(_underline)"
|
|
443
|
-
>{{ _copy().underline }}</mlv-list-item
|
|
444
|
-
>
|
|
445
|
-
}
|
|
446
|
-
@if (_supported('setTextAlign')) {
|
|
447
|
-
@for (alignment of _alignments(); track alignment.value) {
|
|
448
|
-
<mlv-list-item
|
|
449
|
-
mlvMenuItem
|
|
450
|
-
[disabled]="_commandDisabled(_canAlign(alignment.value))"
|
|
451
|
-
[attr.aria-current]="
|
|
452
|
-
_context.isActive('paragraph', { textAlign: alignment.value })
|
|
453
|
-
? 'true'
|
|
454
|
-
: null
|
|
455
|
-
"
|
|
456
|
-
(itemClick)="_run(_align(alignment.value))"
|
|
457
|
-
>{{ alignment.label }}</mlv-list-item
|
|
458
|
-
>
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
@if (_supported('toggleBlockquote')) {
|
|
462
|
-
<mlv-list-item
|
|
463
|
-
mlvMenuItem
|
|
464
|
-
[disabled]="_commandDisabled(_canBlockquote)"
|
|
465
|
-
[attr.aria-current]="_context.isActive('blockquote') ? 'true' : null"
|
|
466
|
-
(itemClick)="_run(_blockquote)"
|
|
467
|
-
>{{ _copy().blockquote }}</mlv-list-item
|
|
468
|
-
>
|
|
469
|
-
}
|
|
470
|
-
@if (_supported('toggleCodeBlock')) {
|
|
471
|
-
<mlv-list-item
|
|
472
|
-
mlvMenuItem
|
|
473
|
-
[disabled]="_commandDisabled(_canCodeBlock)"
|
|
474
|
-
[attr.aria-current]="_context.isActive('codeBlock') ? 'true' : null"
|
|
475
|
-
(itemClick)="_run(_codeBlock)"
|
|
476
|
-
>{{ _copy().codeBlock }}</mlv-list-item
|
|
477
|
-
>
|
|
478
|
-
}
|
|
479
|
-
@if (_supported('setHorizontalRule')) {
|
|
480
|
-
<mlv-list-item
|
|
481
|
-
mlvMenuItem
|
|
482
|
-
[disabled]="_commandDisabled(_canHorizontalRule)"
|
|
483
|
-
(itemClick)="_run(_horizontalRule)"
|
|
484
|
-
>{{ _copy().horizontalRule }}</mlv-list-item
|
|
485
|
-
>
|
|
486
|
-
}
|
|
487
|
-
</mlv-menu>
|
|
488
|
-
`,
|
|
489
|
-
encapsulation: ViewEncapsulation.None,
|
|
490
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
491
|
-
host: {
|
|
492
|
-
class: 'mlv-editor-toolbar__overflow',
|
|
493
|
-
'[hidden]': '!_root.narrow()',
|
|
494
|
-
},
|
|
495
|
-
}]
|
|
496
|
-
}], ctorParameters: () => [], propDecorators: { _menu: [{ type: i0.ViewChild, args: ['_menu', { isSignal: true }] }], _trigger: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MlvMenuTrigger), { isSignal: true }] }] } });
|
|
497
|
-
/** @internal Defers public-toolbar context reads until Angular has assigned inputs. */
|
|
498
|
-
class MlvEditorToolbarContextProxy {
|
|
499
|
-
/** @internal Owning public toolbar component. */
|
|
500
|
-
_toolbar = inject(MlvEditorToolbar);
|
|
501
|
-
/** Editor instance supplied through the public context input. */
|
|
502
|
-
get editor() {
|
|
503
|
-
return this._toolbar.context().editor;
|
|
504
|
-
}
|
|
505
|
-
/** Disabled state combines the shell input and public context. */
|
|
506
|
-
disabled = computed(() => this._toolbar.disabled() || this._toolbar.context().disabled(), /* @ts-ignore */
|
|
507
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
508
|
-
/** Readonly state supplied through the public context input. */
|
|
509
|
-
get readonly() {
|
|
510
|
-
return this._toolbar.context().readonly;
|
|
511
|
-
}
|
|
512
|
-
/** Focus state supplied by the public owner context. */
|
|
513
|
-
get focused() {
|
|
514
|
-
return this._toolbar.context().focused;
|
|
515
|
-
}
|
|
516
|
-
/** Editable state supplied by the public owner context without shadowing. */
|
|
517
|
-
get editable() {
|
|
518
|
-
return this._toolbar.context().editable;
|
|
519
|
-
}
|
|
520
|
-
/** Serialization format supplied through the public context input. */
|
|
521
|
-
get format() {
|
|
522
|
-
return this._toolbar.context().format;
|
|
523
|
-
}
|
|
524
|
-
/** View zoom supplied through the public context input. */
|
|
525
|
-
get zoom() {
|
|
526
|
-
return this._toolbar.context().zoom;
|
|
527
|
-
}
|
|
528
|
-
/** Exact editor-owned upload capability supplied through the public context. */
|
|
529
|
-
get imageUpload() {
|
|
530
|
-
return this._toolbar.context().imageUpload;
|
|
531
|
-
}
|
|
532
|
-
/** Runs a public-context command. */
|
|
533
|
-
run(command) {
|
|
534
|
-
return this._toolbar.context().run(command);
|
|
535
|
-
}
|
|
536
|
-
/** Checks a public-context command. */
|
|
537
|
-
can(command) {
|
|
538
|
-
return this._toolbar.context().can(command);
|
|
539
|
-
}
|
|
540
|
-
/** Checks active state through the public context. */
|
|
541
|
-
isActive(name, attributes) {
|
|
542
|
-
return this._toolbar.context().isActive(name, attributes);
|
|
543
|
-
}
|
|
544
|
-
/** Reports a typed error through the public owner context. */
|
|
545
|
-
reportError(error) {
|
|
546
|
-
this._toolbar.context().reportError(error);
|
|
547
|
-
}
|
|
548
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorToolbarContextProxy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
549
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorToolbarContextProxy });
|
|
550
|
-
}
|
|
551
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorToolbarContextProxy, decorators: [{
|
|
552
|
-
type: Injectable
|
|
553
|
-
}] });
|
|
554
|
-
/** Public compatibility toolbar shell for standalone consumer use. */
|
|
555
|
-
export class MlvEditorToolbar {
|
|
556
|
-
/** Accessible toolbar name. */
|
|
557
|
-
ariaLabel = input(undefined, /* @ts-ignore */
|
|
558
|
-
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
559
|
-
/** Whether all toolbar interactions are disabled. */
|
|
560
|
-
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
561
|
-
/** Optional content rendered before built-in groups. */
|
|
562
|
-
startTemplate = input(null, /* @ts-ignore */
|
|
563
|
-
...(ngDevMode ? [{ debugName: "startTemplate" }] : /* istanbul ignore next */ []));
|
|
564
|
-
/** Optional content rendered after built-in groups. */
|
|
565
|
-
endTemplate = input(null, /* @ts-ignore */
|
|
566
|
-
...(ngDevMode ? [{ debugName: "endTemplate" }] : /* istanbul ignore next */ []));
|
|
567
|
-
/** Context supplied to custom toolbar templates. */
|
|
568
|
-
context = input.required(/* @ts-ignore */
|
|
569
|
-
...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
570
|
-
/** @internal Invalidates built-in command state for the supplied standalone editor. */
|
|
571
|
-
_revision = inject(MlvEditorToolbarRevision);
|
|
572
|
-
constructor() {
|
|
573
|
-
effect((onCleanup) => {
|
|
574
|
-
const editor = this.context().editor();
|
|
575
|
-
this._revision.revision.update((revision) => revision + 1);
|
|
576
|
-
if (!editor)
|
|
577
|
-
return;
|
|
578
|
-
const invalidate = () => this._revision.revision.update((revision) => revision + 1);
|
|
579
|
-
editor.on('transaction', invalidate);
|
|
580
|
-
editor.on('selectionUpdate', invalidate);
|
|
581
|
-
onCleanup(() => {
|
|
582
|
-
editor.off('transaction', invalidate);
|
|
583
|
-
editor.off('selectionUpdate', invalidate);
|
|
584
|
-
});
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorToolbar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
588
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: MlvEditorToolbar, isStandalone: true, selector: "mlv-editor-toolbar", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, startTemplate: { classPropertyName: "startTemplate", publicName: "startTemplate", isSignal: true, isRequired: false, transformFunction: null }, endTemplate: { classPropertyName: "endTemplate", publicName: "endTemplate", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.mlv-editor-toolbar--disabled": "disabled() || context().disabled()" }, classAttribute: "mlv-editor-toolbar" }, providers: [
|
|
589
|
-
MlvEditorOverlayRegistry,
|
|
590
|
-
MlvEditorToolbarRevision,
|
|
591
|
-
MlvEditorToolbarRovingRegistry,
|
|
592
|
-
MlvEditorToolbarContextProxy,
|
|
593
|
-
{
|
|
594
|
-
provide: MLV_EDITOR_OVERLAY_REGISTRY,
|
|
595
|
-
useExisting: MlvEditorOverlayRegistry,
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
provide: MLV_EDITOR_TOOLBAR_CONTEXT,
|
|
599
|
-
useExisting: MlvEditorToolbarContextProxy,
|
|
600
|
-
},
|
|
601
|
-
{
|
|
602
|
-
provide: MLV_EDITOR_TOOLBAR_REVISION,
|
|
603
|
-
useFactory: (state) => state.revision,
|
|
604
|
-
deps: [MlvEditorToolbarRevision],
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
provide: MLV_EDITOR_TOOLBAR_ROVING,
|
|
608
|
-
useExisting: MlvEditorToolbarRovingRegistry,
|
|
609
|
-
},
|
|
610
|
-
], ngImport: i0, template: `<div
|
|
611
|
-
mlvEditorToolbarRoot
|
|
612
|
-
#toolbarRoot="mlvEditorToolbarRoot"
|
|
613
|
-
[ariaLabel]="ariaLabel()"
|
|
614
|
-
[disabled]="disabled() || context().disabled()"
|
|
615
|
-
>
|
|
616
|
-
<ng-content select="[mlvEditorToolbarStart]" />
|
|
617
|
-
@if (startTemplate(); as template) {
|
|
618
|
-
<ng-container
|
|
619
|
-
[ngTemplateOutlet]="template"
|
|
620
|
-
[ngTemplateOutletContext]="{ $implicit: context() }"
|
|
621
|
-
/>
|
|
622
|
-
}
|
|
623
|
-
<div mlvFade class="mlv-editor-toolbar__scroll">
|
|
624
|
-
<mlv-toolbar>
|
|
625
|
-
<mlv-editor-undo-redo />
|
|
626
|
-
<mlv-divider
|
|
627
|
-
class="mlv-editor-toolbar__separator"
|
|
628
|
-
orientation="vertical"
|
|
629
|
-
muted
|
|
630
|
-
/>
|
|
631
|
-
<mlv-editor-zoom />
|
|
632
|
-
<mlv-divider
|
|
633
|
-
class="mlv-editor-toolbar__separator"
|
|
634
|
-
orientation="vertical"
|
|
635
|
-
muted
|
|
636
|
-
/>
|
|
637
|
-
<mlv-editor-heading />
|
|
638
|
-
<mlv-editor-list />
|
|
639
|
-
<mlv-divider
|
|
640
|
-
class="mlv-editor-toolbar__separator"
|
|
641
|
-
orientation="vertical"
|
|
642
|
-
muted
|
|
643
|
-
[hidden]="toolbarRoot.narrow()"
|
|
644
|
-
/>
|
|
645
|
-
<mlv-editor-inline-marks [hidden]="toolbarRoot.narrow()" />
|
|
646
|
-
<mlv-divider
|
|
647
|
-
class="mlv-editor-toolbar__separator"
|
|
648
|
-
orientation="vertical"
|
|
649
|
-
muted
|
|
650
|
-
[hidden]="toolbarRoot.narrow()"
|
|
651
|
-
/>
|
|
652
|
-
<mlv-editor-text-color />
|
|
653
|
-
<mlv-editor-highlight />
|
|
654
|
-
<mlv-divider
|
|
655
|
-
class="mlv-editor-toolbar__separator"
|
|
656
|
-
orientation="vertical"
|
|
657
|
-
muted
|
|
658
|
-
[hidden]="toolbarRoot.narrow()"
|
|
659
|
-
/>
|
|
660
|
-
<mlv-editor-alignment [hidden]="toolbarRoot.narrow()" />
|
|
661
|
-
<mlv-divider
|
|
662
|
-
class="mlv-editor-toolbar__separator"
|
|
663
|
-
orientation="vertical"
|
|
664
|
-
muted
|
|
665
|
-
[hidden]="toolbarRoot.narrow()"
|
|
666
|
-
/>
|
|
667
|
-
<mlv-editor-link />
|
|
668
|
-
<mlv-editor-table />
|
|
669
|
-
<mlv-divider
|
|
670
|
-
class="mlv-editor-toolbar__separator"
|
|
671
|
-
orientation="vertical"
|
|
672
|
-
muted
|
|
673
|
-
[hidden]="toolbarRoot.narrow()"
|
|
674
|
-
/>
|
|
675
|
-
<mlv-editor-block-insert [hidden]="toolbarRoot.narrow()" />
|
|
676
|
-
<mlv-divider
|
|
677
|
-
class="mlv-editor-toolbar__separator"
|
|
678
|
-
orientation="vertical"
|
|
679
|
-
muted
|
|
680
|
-
[hidden]="toolbarRoot.narrow()"
|
|
681
|
-
/>
|
|
682
|
-
<mlv-editor-image-upload />
|
|
683
|
-
</mlv-toolbar>
|
|
684
|
-
</div>
|
|
685
|
-
<mlv-editor-toolbar-overflow />
|
|
686
|
-
@if (endTemplate(); as template) {
|
|
687
|
-
<ng-container
|
|
688
|
-
[ngTemplateOutlet]="template"
|
|
689
|
-
[ngTemplateOutletContext]="{ $implicit: context() }"
|
|
690
|
-
/>
|
|
691
|
-
}
|
|
692
|
-
<ng-content select="[mlvEditorToolbarEnd]" /><ng-content />
|
|
693
|
-
</div>`, isInline: true, styles: [".mlv-editor-toolbar{box-sizing:border-box;padding:0;margin:0;font-family:var(--mlv-typography-family-text);font-size:var(--mlv-typography-body-m-size)}.mlv-editor-toolbar *{box-sizing:border-box}.mlv-editor-toolbar{display:flex;align-items:center;min-width:0;overflow:hidden}.mlv-editor-toolbar [hidden]{display:none!important}.mlv-editor-toolbar__scroll{flex:1 1 auto;min-width:0}.mlv-editor-toolbar__scroll>.mlv-toolbar{width:max-content;min-width:100%;flex-wrap:nowrap}.mlv-editor-toolbar__separator{flex:0 0 auto;align-self:stretch;min-height:var(--mlv-height-s);margin-inline:var(--mlv-spacing-1)}.mlv-editor-toolbar__overflow,.mlv-editor-toolbar .mlv-editor-undo-redo,.mlv-editor-toolbar .mlv-editor-inline-marks,.mlv-editor-toolbar .mlv-editor-block-insert{display:inline-flex;flex:0 0 auto;flex-direction:row;align-items:center;gap:var(--mlv-spacing-1)}.mlv-editor-toolbar mlv-editor-zoom,.mlv-editor-toolbar mlv-editor-heading,.mlv-editor-toolbar mlv-editor-list,.mlv-editor-toolbar mlv-editor-text-color,.mlv-editor-toolbar mlv-editor-highlight,.mlv-editor-toolbar mlv-editor-alignment,.mlv-editor-toolbar mlv-editor-link,.mlv-editor-toolbar mlv-editor-table,.mlv-editor-toolbar mlv-editor-image-upload{flex:0 0 auto}.mlv-editor-toolbar--disabled{opacity:var(--mlv-disabled-opacity)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MlvFade, selector: "[mlvFade]", inputs: ["mlvFadeHeight", "mlvFadeSize", "mlvFadeOffset", "mlvFade"] }, { kind: "component", type: MlvToolbar, selector: "mlv-toolbar", inputs: ["gap", "equalSize"] }, { kind: "component", type: MlvDivider, selector: "mlv-divider", inputs: ["orientation", "dashed", "muted"] }, { kind: "directive", type: MlvEditorToolbarRoot, selector: "[mlvEditorToolbarRoot]", inputs: ["ariaLabel", "disabled", "orientation", "wrap"], exportAs: ["mlvEditorToolbarRoot"] }, { kind: "component", type: MlvEditorUndoRedo, selector: "mlv-editor-undo-redo" }, { kind: "component", type: MlvEditorZoom, selector: "mlv-editor-zoom", inputs: ["zoom", "zoomLevels", "min", "max", "fitToContainer"], outputs: ["zoomChange"] }, { kind: "component", type: MlvEditorHeading, selector: "mlv-editor-heading", inputs: ["levels"] }, { kind: "component", type: MlvEditorList, selector: "mlv-editor-list" }, { kind: "component", type: MlvEditorInlineMarks, selector: "mlv-editor-inline-marks" }, { kind: "component", type: MlvEditorTextColor, selector: "mlv-editor-text-color" }, { kind: "component", type: MlvEditorHighlight, selector: "mlv-editor-highlight" }, { kind: "component", type: MlvEditorLink, selector: "mlv-editor-link", inputs: ["allowedProtocols"] }, { kind: "component", type: MlvEditorImageUpload, selector: "mlv-editor-image-upload" }, { kind: "component", type: MlvEditorTable, selector: "mlv-editor-table" }, { kind: "component", type: MlvEditorAlignment, selector: "mlv-editor-alignment" }, { kind: "component", type: MlvEditorBlockInsert, selector: "mlv-editor-block-insert" }, { kind: "component", type: MlvEditorToolbarOverflow, selector: "mlv-editor-toolbar-overflow" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
694
|
-
}
|
|
695
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: MlvEditorToolbar, decorators: [{
|
|
696
|
-
type: Component,
|
|
697
|
-
args: [{ selector: 'mlv-editor-toolbar', host: {
|
|
698
|
-
class: 'mlv-editor-toolbar',
|
|
699
|
-
'[class.mlv-editor-toolbar--disabled]': 'disabled() || context().disabled()',
|
|
700
|
-
}, imports: [
|
|
701
|
-
NgTemplateOutlet,
|
|
702
|
-
MlvFade,
|
|
703
|
-
MlvToolbar,
|
|
704
|
-
MlvDivider,
|
|
705
|
-
MlvEditorToolbarRoot,
|
|
706
|
-
MlvEditorUndoRedo,
|
|
707
|
-
MlvEditorZoom,
|
|
708
|
-
MlvEditorHeading,
|
|
709
|
-
MlvEditorList,
|
|
710
|
-
MlvEditorInlineMarks,
|
|
711
|
-
MlvEditorTextColor,
|
|
712
|
-
MlvEditorHighlight,
|
|
713
|
-
MlvEditorLink,
|
|
714
|
-
MlvEditorImageUpload,
|
|
715
|
-
MlvEditorTable,
|
|
716
|
-
MlvEditorAlignment,
|
|
717
|
-
MlvEditorBlockInsert,
|
|
718
|
-
MlvEditorToolbarOverflow,
|
|
719
|
-
], template: `<div
|
|
720
|
-
mlvEditorToolbarRoot
|
|
721
|
-
#toolbarRoot="mlvEditorToolbarRoot"
|
|
722
|
-
[ariaLabel]="ariaLabel()"
|
|
723
|
-
[disabled]="disabled() || context().disabled()"
|
|
724
|
-
>
|
|
725
|
-
<ng-content select="[mlvEditorToolbarStart]" />
|
|
726
|
-
@if (startTemplate(); as template) {
|
|
727
|
-
<ng-container
|
|
728
|
-
[ngTemplateOutlet]="template"
|
|
729
|
-
[ngTemplateOutletContext]="{ $implicit: context() }"
|
|
730
|
-
/>
|
|
731
|
-
}
|
|
732
|
-
<div mlvFade class="mlv-editor-toolbar__scroll">
|
|
733
|
-
<mlv-toolbar>
|
|
734
|
-
<mlv-editor-undo-redo />
|
|
735
|
-
<mlv-divider
|
|
736
|
-
class="mlv-editor-toolbar__separator"
|
|
737
|
-
orientation="vertical"
|
|
738
|
-
muted
|
|
739
|
-
/>
|
|
740
|
-
<mlv-editor-zoom />
|
|
741
|
-
<mlv-divider
|
|
742
|
-
class="mlv-editor-toolbar__separator"
|
|
743
|
-
orientation="vertical"
|
|
744
|
-
muted
|
|
745
|
-
/>
|
|
746
|
-
<mlv-editor-heading />
|
|
747
|
-
<mlv-editor-list />
|
|
748
|
-
<mlv-divider
|
|
749
|
-
class="mlv-editor-toolbar__separator"
|
|
750
|
-
orientation="vertical"
|
|
751
|
-
muted
|
|
752
|
-
[hidden]="toolbarRoot.narrow()"
|
|
753
|
-
/>
|
|
754
|
-
<mlv-editor-inline-marks [hidden]="toolbarRoot.narrow()" />
|
|
755
|
-
<mlv-divider
|
|
756
|
-
class="mlv-editor-toolbar__separator"
|
|
757
|
-
orientation="vertical"
|
|
758
|
-
muted
|
|
759
|
-
[hidden]="toolbarRoot.narrow()"
|
|
760
|
-
/>
|
|
761
|
-
<mlv-editor-text-color />
|
|
762
|
-
<mlv-editor-highlight />
|
|
763
|
-
<mlv-divider
|
|
764
|
-
class="mlv-editor-toolbar__separator"
|
|
765
|
-
orientation="vertical"
|
|
766
|
-
muted
|
|
767
|
-
[hidden]="toolbarRoot.narrow()"
|
|
768
|
-
/>
|
|
769
|
-
<mlv-editor-alignment [hidden]="toolbarRoot.narrow()" />
|
|
770
|
-
<mlv-divider
|
|
771
|
-
class="mlv-editor-toolbar__separator"
|
|
772
|
-
orientation="vertical"
|
|
773
|
-
muted
|
|
774
|
-
[hidden]="toolbarRoot.narrow()"
|
|
775
|
-
/>
|
|
776
|
-
<mlv-editor-link />
|
|
777
|
-
<mlv-editor-table />
|
|
778
|
-
<mlv-divider
|
|
779
|
-
class="mlv-editor-toolbar__separator"
|
|
780
|
-
orientation="vertical"
|
|
781
|
-
muted
|
|
782
|
-
[hidden]="toolbarRoot.narrow()"
|
|
783
|
-
/>
|
|
784
|
-
<mlv-editor-block-insert [hidden]="toolbarRoot.narrow()" />
|
|
785
|
-
<mlv-divider
|
|
786
|
-
class="mlv-editor-toolbar__separator"
|
|
787
|
-
orientation="vertical"
|
|
788
|
-
muted
|
|
789
|
-
[hidden]="toolbarRoot.narrow()"
|
|
790
|
-
/>
|
|
791
|
-
<mlv-editor-image-upload />
|
|
792
|
-
</mlv-toolbar>
|
|
793
|
-
</div>
|
|
794
|
-
<mlv-editor-toolbar-overflow />
|
|
795
|
-
@if (endTemplate(); as template) {
|
|
796
|
-
<ng-container
|
|
797
|
-
[ngTemplateOutlet]="template"
|
|
798
|
-
[ngTemplateOutletContext]="{ $implicit: context() }"
|
|
799
|
-
/>
|
|
800
|
-
}
|
|
801
|
-
<ng-content select="[mlvEditorToolbarEnd]" /><ng-content />
|
|
802
|
-
</div>`, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
803
|
-
MlvEditorOverlayRegistry,
|
|
804
|
-
MlvEditorToolbarRevision,
|
|
805
|
-
MlvEditorToolbarRovingRegistry,
|
|
806
|
-
MlvEditorToolbarContextProxy,
|
|
807
|
-
{
|
|
808
|
-
provide: MLV_EDITOR_OVERLAY_REGISTRY,
|
|
809
|
-
useExisting: MlvEditorOverlayRegistry,
|
|
810
|
-
},
|
|
811
|
-
{
|
|
812
|
-
provide: MLV_EDITOR_TOOLBAR_CONTEXT,
|
|
813
|
-
useExisting: MlvEditorToolbarContextProxy,
|
|
814
|
-
},
|
|
815
|
-
{
|
|
816
|
-
provide: MLV_EDITOR_TOOLBAR_REVISION,
|
|
817
|
-
useFactory: (state) => state.revision,
|
|
818
|
-
deps: [MlvEditorToolbarRevision],
|
|
819
|
-
},
|
|
820
|
-
{
|
|
821
|
-
provide: MLV_EDITOR_TOOLBAR_ROVING,
|
|
822
|
-
useExisting: MlvEditorToolbarRovingRegistry,
|
|
823
|
-
},
|
|
824
|
-
], styles: [".mlv-editor-toolbar{box-sizing:border-box;padding:0;margin:0;font-family:var(--mlv-typography-family-text);font-size:var(--mlv-typography-body-m-size)}.mlv-editor-toolbar *{box-sizing:border-box}.mlv-editor-toolbar{display:flex;align-items:center;min-width:0;overflow:hidden}.mlv-editor-toolbar [hidden]{display:none!important}.mlv-editor-toolbar__scroll{flex:1 1 auto;min-width:0}.mlv-editor-toolbar__scroll>.mlv-toolbar{width:max-content;min-width:100%;flex-wrap:nowrap}.mlv-editor-toolbar__separator{flex:0 0 auto;align-self:stretch;min-height:var(--mlv-height-s);margin-inline:var(--mlv-spacing-1)}.mlv-editor-toolbar__overflow,.mlv-editor-toolbar .mlv-editor-undo-redo,.mlv-editor-toolbar .mlv-editor-inline-marks,.mlv-editor-toolbar .mlv-editor-block-insert{display:inline-flex;flex:0 0 auto;flex-direction:row;align-items:center;gap:var(--mlv-spacing-1)}.mlv-editor-toolbar mlv-editor-zoom,.mlv-editor-toolbar mlv-editor-heading,.mlv-editor-toolbar mlv-editor-list,.mlv-editor-toolbar mlv-editor-text-color,.mlv-editor-toolbar mlv-editor-highlight,.mlv-editor-toolbar mlv-editor-alignment,.mlv-editor-toolbar mlv-editor-link,.mlv-editor-toolbar mlv-editor-table,.mlv-editor-toolbar mlv-editor-image-upload{flex:0 0 auto}.mlv-editor-toolbar--disabled{opacity:var(--mlv-disabled-opacity)}\n"] }]
|
|
825
|
-
}], ctorParameters: () => [], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], startTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "startTemplate", required: false }] }], endTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "endTemplate", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: true }] }] } });
|
|
826
|
-
//# sourceMappingURL=editor-toolbar.js.map
|