@3kles/kles-richtext-editor 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/3kles-kles-richtext-editor-material.mjs +523 -0
- package/fesm2022/3kles-kles-richtext-editor-material.mjs.map +1 -0
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-button.component-B0aePmqW.mjs +96 -0
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-button.component-B0aePmqW.mjs.map +1 -0
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-fields.component-DZrj7frn.mjs +163 -0
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-fields.component-DZrj7frn.mjs.map +1 -0
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-DkaxVVT8.mjs +224 -0
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-DkaxVVT8.mjs.map +1 -0
- package/fesm2022/3kles-kles-richtext-editor.mjs +40 -22
- package/fesm2022/3kles-kles-richtext-editor.mjs.map +1 -1
- package/package.json +16 -4
- package/types/3kles-kles-richtext-editor-material.d.ts +5 -0
- package/types/3kles-kles-richtext-editor-material.d.ts.map +1 -0
- package/types/3kles-kles-richtext-editor.d.ts +82 -5
- package/types/3kles-kles-richtext-editor.d.ts.map +1 -1
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-Dq2K0CY3.mjs +0 -183
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-Dq2K0CY3.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Diagnostic, DocumentNode, HeadingNode, Mark, Result, TextStyleMarkType } from "@3kles/richtext-core";
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
import { AfterViewInit, InjectionToken, OnDestroy, Provider, TemplateRef } from "@angular/core";
|
|
3
|
+
import { AfterViewInit, InjectionToken, InputSignal, OnDestroy, Provider, TemplateRef, Type } from "@angular/core";
|
|
4
4
|
import { AbstractControl, ControlValueAccessor, ValidationErrors, Validator } from "@angular/forms";
|
|
5
5
|
import { EditorActionResult, EditorCommand, EditorEvent, NativeEditor } from "@3kles/richtext-dom";
|
|
6
6
|
import "@3kles/richtext-formats";
|
|
@@ -343,6 +343,81 @@ interface RichTextToolbarButtonContext {
|
|
|
343
343
|
export declare const DEFAULT_RICHTEXT_TOOLBAR_ITEMS: readonly RichTextToolbarItem[];
|
|
344
344
|
export declare const FULL_RICHTEXT_TOOLBAR_ITEMS: readonly RichTextToolbarItem[];
|
|
345
345
|
type ToolbarHeadingLevel = HeadingNode['level'];
|
|
346
|
+
interface RichTextToolbarButtonControl {
|
|
347
|
+
readonly label: string;
|
|
348
|
+
readonly ariaLabel: string;
|
|
349
|
+
readonly disabled: boolean;
|
|
350
|
+
readonly pressed?: boolean | undefined;
|
|
351
|
+
readonly icon?: string | undefined;
|
|
352
|
+
readonly iconType?: RichTextToolbarIconType | undefined;
|
|
353
|
+
readonly actionId?: string;
|
|
354
|
+
readonly fieldId?: string;
|
|
355
|
+
readonly tabStop?: number;
|
|
356
|
+
readonly popoverTarget?: string;
|
|
357
|
+
readonly content?: {
|
|
358
|
+
readonly template: TemplateRef<RichTextToolbarButtonContext>;
|
|
359
|
+
readonly context: RichTextToolbarButtonContext;
|
|
360
|
+
} | undefined;
|
|
361
|
+
readonly activate?: () => void;
|
|
362
|
+
}
|
|
363
|
+
interface RichTextToolbarColorControl {
|
|
364
|
+
readonly id: 'color' | 'backgroundColor';
|
|
365
|
+
readonly popoverId: string;
|
|
366
|
+
readonly label: string;
|
|
367
|
+
readonly ariaLabel: string;
|
|
368
|
+
readonly resetLabel: string;
|
|
369
|
+
readonly disabled: boolean;
|
|
370
|
+
/** Undefined means the default. Null means the selection contains multiple values. */
|
|
371
|
+
readonly value: string | null | undefined;
|
|
372
|
+
readonly fallback: string;
|
|
373
|
+
readonly change: (value: string) => void;
|
|
374
|
+
}
|
|
375
|
+
type RichTextToolbarFieldControl = {
|
|
376
|
+
readonly id: string;
|
|
377
|
+
readonly label: string;
|
|
378
|
+
readonly ariaLabel: string;
|
|
379
|
+
readonly disabled: boolean;
|
|
380
|
+
readonly value: string;
|
|
381
|
+
readonly change: (value: string) => void;
|
|
382
|
+
} & ({
|
|
383
|
+
readonly kind: 'link';
|
|
384
|
+
readonly invalid: boolean;
|
|
385
|
+
readonly errorId: string;
|
|
386
|
+
readonly submit: (event: Event) => void;
|
|
387
|
+
} | {
|
|
388
|
+
readonly kind: 'select';
|
|
389
|
+
readonly options: readonly {
|
|
390
|
+
readonly label: string;
|
|
391
|
+
readonly value: string;
|
|
392
|
+
readonly disabled?: boolean;
|
|
393
|
+
}[];
|
|
394
|
+
});
|
|
395
|
+
interface RichTextToolbarMenuControl {
|
|
396
|
+
readonly label: string;
|
|
397
|
+
readonly searchLabel: string;
|
|
398
|
+
readonly noResults: string;
|
|
399
|
+
readonly query: string;
|
|
400
|
+
readonly open: boolean;
|
|
401
|
+
readonly groups: readonly RichTextToolbarMenuGroup[];
|
|
402
|
+
readonly search: (query: string) => void;
|
|
403
|
+
readonly choose: (item: RichTextToolbarMenuCommand) => void;
|
|
404
|
+
}
|
|
405
|
+
interface RichTextToolbarAppearance {
|
|
406
|
+
readonly button?: Type<{
|
|
407
|
+
readonly control: InputSignal<RichTextToolbarButtonControl>;
|
|
408
|
+
}>;
|
|
409
|
+
readonly color?: Type<{
|
|
410
|
+
readonly control: InputSignal<RichTextToolbarColorControl>;
|
|
411
|
+
}>;
|
|
412
|
+
readonly field?: Type<{
|
|
413
|
+
readonly control: InputSignal<RichTextToolbarFieldControl>;
|
|
414
|
+
}>;
|
|
415
|
+
readonly menu?: Type<{
|
|
416
|
+
readonly control: InputSignal<RichTextToolbarMenuControl>;
|
|
417
|
+
}>;
|
|
418
|
+
}
|
|
419
|
+
export declare const RICHTEXT_TOOLBAR_APPEARANCE: InjectionToken<RichTextToolbarAppearance>;
|
|
420
|
+
export declare function provideRichTextToolbarAppearance(appearance: RichTextToolbarAppearance): Provider;
|
|
346
421
|
type ToolbarButton = (RichTextToolbarButton & {
|
|
347
422
|
readonly kind: 'command';
|
|
348
423
|
}) | (Pick<RichTextToolbarButton, 'id' | 'label' | 'ariaLabel' | 'icon' | 'iconType' | 'disabled' | 'pressed'> & {
|
|
@@ -376,7 +451,7 @@ export declare class RichTextToolbarComponent {
|
|
|
376
451
|
private lastFocusedElement;
|
|
377
452
|
readonly text: import("@angular/core").Signal<ResolvedRichTextMessages>;
|
|
378
453
|
readonly label: import("@angular/core").Signal<string>;
|
|
379
|
-
|
|
454
|
+
readonly iconOnly: import("@angular/core").Signal<boolean>;
|
|
380
455
|
private readonly resolvedItems;
|
|
381
456
|
readonly hasItems: import("@angular/core").Signal<boolean>;
|
|
382
457
|
readonly fieldsLabel: import("@angular/core").Signal<string>;
|
|
@@ -397,7 +472,8 @@ export declare class RichTextToolbarComponent {
|
|
|
397
472
|
label: string;
|
|
398
473
|
disabled: boolean;
|
|
399
474
|
control: "color";
|
|
400
|
-
|
|
475
|
+
value: string | null | undefined;
|
|
476
|
+
fallback: "#000000" | "#ffff00";
|
|
401
477
|
kind: "field";
|
|
402
478
|
visible?: boolean;
|
|
403
479
|
labelKey?: string;
|
|
@@ -439,10 +515,11 @@ export declare class RichTextToolbarComponent {
|
|
|
439
515
|
refresh(): void;
|
|
440
516
|
private queryButton;
|
|
441
517
|
private announce;
|
|
442
|
-
|
|
518
|
+
protected actionControl(button: RichTextToolbarButton): RichTextToolbarButtonControl;
|
|
443
519
|
execute(button: RichTextToolbarButton): void;
|
|
444
520
|
executeMenuCommand(command: EditorCommand): void;
|
|
445
521
|
changeHeadingLevel(event: Event): void;
|
|
522
|
+
setHeadingLevel(value: string): void;
|
|
446
523
|
changeStyle(markType: TextStyleMarkType, rawValue: string): void;
|
|
447
524
|
changeLink(value: string): void;
|
|
448
525
|
applyLink(event?: Event): void;
|
|
@@ -498,5 +575,5 @@ export declare function provideRichTextToolbar(config: RichTextToolbarConfig): P
|
|
|
498
575
|
export declare const RICHTEXT_I18N: InjectionToken<RichTextI18nOptions>;
|
|
499
576
|
/** Per-injector defaults; component locale/messages inputs remain reactive and take precedence. */
|
|
500
577
|
export declare function provideRichTextI18n(options: RichTextI18nOptions): Provider;
|
|
501
|
-
export type { RichTextDocumentValidationError, RichTextEditorSnapshot, RichTextFormValueFormat, RichTextI18nOptions, RichTextLocale, RichTextMessageKey, RichTextMessageOverrides, RichTextMessages, RichTextToolbarActionId, RichTextToolbarBuiltinId, RichTextToolbarBuiltinItem, RichTextToolbarButton, RichTextToolbarButtonContext, RichTextToolbarCommandItem, RichTextToolbarConfig, RichTextToolbarFieldId, RichTextToolbarIconType, RichTextToolbarItem, RichTextToolbarMenuCommand, RichTextToolbarMenuGroup, RichTextToolbarMenuItem, RichTextValidationErrors };
|
|
578
|
+
export type { RichTextDocumentValidationError, RichTextEditorSnapshot, RichTextFormValueFormat, RichTextI18nOptions, RichTextLocale, RichTextMessageKey, RichTextMessageOverrides, RichTextMessages, RichTextToolbarActionId, RichTextToolbarAppearance, RichTextToolbarBuiltinId, RichTextToolbarBuiltinItem, RichTextToolbarButton, RichTextToolbarButtonContext, RichTextToolbarButtonControl, RichTextToolbarColorControl, RichTextToolbarCommandItem, RichTextToolbarConfig, RichTextToolbarFieldControl, RichTextToolbarFieldId, RichTextToolbarIconType, RichTextToolbarItem, RichTextToolbarMenuCommand, RichTextToolbarMenuControl, RichTextToolbarMenuGroup, RichTextToolbarMenuItem, RichTextValidationErrors };
|
|
502
579
|
//# sourceMappingURL=3kles-kles-richtext-editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3kles-kles-richtext-editor.d.ts","names":["_$___i18n_messages_js0.ResolvedRichTextMessages","_$___i18n_messages_js0.ResolvedRichTextMessages","_$___i18n_messages_js0.ResolvedRichTextMessages"],"sources":["../../../projects/kles-richtext-editor/src/lib/i18n/messages.ts","../../../projects/kles-richtext-editor/src/lib/document-preview/document-preview.component.ts","../../../projects/kles-richtext-editor/src/lib/editor/validators.ts","../../../projects/kles-richtext-editor/src/lib/editor/richtext-editor.component.ts","../../../projects/kles-richtext-editor/src/lib/editor/configuration.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/toolbar-configuration.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/toolbar-state.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/richtext-toolbar.component.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/configuration.ts","../../../projects/kles-richtext-editor/src/lib/i18n/configuration.ts"],"mappings":";;;;;;;UACiB;WACJ;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;KAGD,2BAA2B;;KAE3B,2BAA2B,QAAQ,oBAAoB,SAAS;KAChE,2BAA2B,mBAAmB,SAAS;KACvD;UAEK;;WAEJ;WACA,WAAW;;qBAGX,sBAAsB;qBAoDtB,sBAAsB;qBCvGtB;WACA,kCAAQ,YAAA;WACR,uCAAa;WACb,gCAAM;WACN,kCAAQ,YAAA;mBACA;WACR,8BAAI,OAFIA;WAKR,+BAAK;SATL,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAgC;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;;UCR5B;WACJ,sBAAsB;;UAGlB;WACJ,mBAAmB;WACnB;;;wBAMG,sBAAsB,iBAAiB,OAAO;wBAqC9C,0BAA0B,SAAS,2BAA2B;wBAK9D,0BAA0B,SAAS,2BAA2B;wBAM9D,8BAA8B,SAAS,2BAA2B;KC1BtE,yBAAyB,WAAW;KACpC;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;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;IAAA;IAAA;IAAA;IAAA;;;;qBC1DvB,4BAA0B,6DAAA;KCE3B;KAiBA,mDAAmD;KACnD,2BAA2B,0BAA0B;KACrD;UAEF;WACG;WACA;;WAEA;WACA;WACA;WACA;;WAEA,WAAW;;UAGP,mCAAmC;WACvC,IAAI;;UAGA,mCAAmC;WACvC;WACA;WACA,SAAS;;WAET;WACA;;UAGI;WACJ;WACA;WACA;WACA,SAAS;WACT;WACA;;UAGI;WACJ;WACA;WACA;WACA,gBAAgB;;UAGZ,gCAAgC;WACpC;WACA;WACA;WACA,iBAAiB;;KAGlB,sBACR,2BAA2B,6BAA6B,6BAA6B;UAExE;;WAEJ,iBAAiB;;WAEjB;;UAGI;WACJ;;WAEA;WACA;WACA,SAAS;WACT;WACA;WACA;WACA,WAAW;;;UAIP;WACJ,WAAW;WACX,MAAM;;qBA6BN,yCAAyC;qBAMzC,sCAAsC;KCpIvC,sBAAsB;
|
|
1
|
+
{"version":3,"file":"3kles-kles-richtext-editor.d.ts","names":["_$___i18n_messages_js0.ResolvedRichTextMessages","_$___i18n_messages_js0.ResolvedRichTextMessages","_$___i18n_messages_js0.ResolvedRichTextMessages"],"sources":["../../../projects/kles-richtext-editor/src/lib/i18n/messages.ts","../../../projects/kles-richtext-editor/src/lib/document-preview/document-preview.component.ts","../../../projects/kles-richtext-editor/src/lib/editor/validators.ts","../../../projects/kles-richtext-editor/src/lib/editor/richtext-editor.component.ts","../../../projects/kles-richtext-editor/src/lib/editor/configuration.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/toolbar-configuration.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/toolbar-state.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/toolbar-appearance.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/richtext-toolbar.component.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/configuration.ts","../../../projects/kles-richtext-editor/src/lib/i18n/configuration.ts"],"mappings":";;;;;;;UACiB;WACJ;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;KAGD,2BAA2B;;KAE3B,2BAA2B,QAAQ,oBAAoB,SAAS;KAChE,2BAA2B,mBAAmB,SAAS;KACvD;UAEK;;WAEJ;WACA,WAAW;;qBAGX,sBAAsB;qBAoDtB,sBAAsB;qBCvGtB;WACA,kCAAQ,YAAA;WACR,uCAAa;WACb,gCAAM;WACN,kCAAQ,YAAA;mBACA;WACR,8BAAI,OAFIA;WAKR,+BAAK;SATL,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAgC;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;;UCR5B;WACJ,sBAAsB;;UAGlB;WACJ,mBAAmB;WACnB;;;wBAMG,sBAAsB,iBAAiB,OAAO;wBAqC9C,0BAA0B,SAAS,2BAA2B;wBAK9D,0BAA0B,SAAS,2BAA2B;wBAM9D,8BAA8B,SAAS,2BAA2B;KC1BtE,yBAAyB,WAAW;KACpC;qBAqBC,mCAAmC,eAAe,WAAW,sBAAsB;UAC5C;WAEvC,kCAAQ,YAAA;WACR,yCAAe,YAAA;WACf,kCAAQ;WACR,kCAAQ;WACR,kCAAQ;;WAER,iCAAO;WACP,uCAAa;WACb,gCAAM;WACN,kCAAQ,YAAA;mBACA;WACR,8BAAI,OAFIC;WAKR,+BAAK;;WAEL,qCAAW;WACX;WACA,wCAAc,iBAAA;WACd,qCAAW,wDA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,gCAAM;WACN;mBACQ;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;UACT;UACA;WAEC,8BAAI,OAhBoBC;WAmBxB,+BAAK;WACL,kCAAQ;mBACA;WAKR,kCAAQ;WACR,qCAAW;mBAKH;WAKR,gCAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA+BE;mBAOA;mBAGA;mBAIA;WAKR,iCAAO;mBAIC;mBAQA;WASR,iCAAO,gBAAA;WAoBP,iCAAO;mBAIC;mBAUA;WAUR,yCAAe;WAUf,uCAAa;WAWb,qCAAW;WAGX,2CAAiB;WAYjB,4CAAkB;;;EAyE3B;UAIQ;UAUA;YAKE,cAAc,QAAQ,wBAAwB;EAWxD,QAAQ,QAAQ;EAehB,mBAAmB,SAAS;EAM5B,mBAAmB,OAAO;EAK1B,gBAAgB;EAKhB,YAAY,UAAU,mBAAmB;EAazC,WAAW;EAOX,UAAU,QAAQ;EAWlB;EAMA,cAAc,OAAO;EAQrB,SAAS,OAAO;SAzXP,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAwB;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;;qBC3ExB,yBAAuB,eAAA;wBAKpB,uBAAuB,QAAQ,wBAAwB;qBCL1D,eAAa,eAAA;;wBAMV,oBAAoB,SAAS,sBAAsB"}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { c as toolbarPresentationLabel, l as RichTextAccessibilityIds } from "./3kles-kles-richtext-editor-toolbar-configuration-DsbPfSEO.mjs";
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
import { ChangeDetectionStrategy, Component, computed, effect, inject, input, output, signal, viewChild } from "@angular/core";
|
|
4
|
-
var RichTextToolbarMenuComponent = class RichTextToolbarMenuComponent {
|
|
5
|
-
button = input.required(...ngDevMode ? [{ debugName: "button" }] : /* istanbul ignore next */ []);
|
|
6
|
-
groups = input.required(...ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []);
|
|
7
|
-
messages = input.required(...ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []);
|
|
8
|
-
tabStop = input.required(...ngDevMode ? [{ debugName: "tabStop" }] : /* istanbul ignore next */ []);
|
|
9
|
-
command = output();
|
|
10
|
-
panelId = inject(RichTextAccessibilityIds).next("menu");
|
|
11
|
-
search = signal("", ...ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []);
|
|
12
|
-
open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
13
|
-
panel = viewChild("panel", ...ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []);
|
|
14
|
-
results = computed(() => {
|
|
15
|
-
const messages = this.messages();
|
|
16
|
-
const search = this.search().trim().toLocaleLowerCase();
|
|
17
|
-
return this.groups().flatMap((group) => {
|
|
18
|
-
const label = toolbarPresentationLabel(group, messages, "");
|
|
19
|
-
const items = group.items.map((item) => ({
|
|
20
|
-
...item,
|
|
21
|
-
label: toolbarPresentationLabel(item, messages, item.label)
|
|
22
|
-
})).filter((item) => [
|
|
23
|
-
label,
|
|
24
|
-
item.label,
|
|
25
|
-
...item.searchTerms ?? []
|
|
26
|
-
].some((term) => term.toLocaleLowerCase().includes(search)));
|
|
27
|
-
return items.length ? [{
|
|
28
|
-
id: group.id,
|
|
29
|
-
label,
|
|
30
|
-
items
|
|
31
|
-
}] : [];
|
|
32
|
-
});
|
|
33
|
-
}, ...ngDevMode ? [{ debugName: "results" }] : /* istanbul ignore next */ []);
|
|
34
|
-
constructor() {
|
|
35
|
-
effect(() => {
|
|
36
|
-
if (this.button().disabled && this.open()) this.panel()?.nativeElement.hidePopover();
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
syncPopover(panel) {
|
|
40
|
-
const open = panel.matches(":popover-open");
|
|
41
|
-
this.open.set(open);
|
|
42
|
-
if (!open) this.search.set("");
|
|
43
|
-
}
|
|
44
|
-
choose(item, panel) {
|
|
45
|
-
if (item.disabled || this.button().disabled || !panel.matches(":popover-open")) return;
|
|
46
|
-
this.command.emit(item.command);
|
|
47
|
-
panel.hidePopover();
|
|
48
|
-
}
|
|
49
|
-
navigate(event, panel) {
|
|
50
|
-
if (event.isComposing || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
|
|
51
|
-
const target = event.target;
|
|
52
|
-
const buttons = Array.from(panel.querySelectorAll("button[data-richtext-menu-command]:not(:disabled)"));
|
|
53
|
-
if (target instanceof HTMLInputElement && event.key === "Enter") {
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
buttons[0]?.click();
|
|
56
|
-
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
57
|
-
const index = buttons.findIndex((button) => button === target);
|
|
58
|
-
const next = event.key === "ArrowDown" ? buttons[index + 1] : buttons[index - 1];
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
if (next) next.focus();
|
|
61
|
-
else if (index === 0 && event.key === "ArrowUp") panel.querySelector("input")?.focus();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
65
|
-
minVersion: "12.0.0",
|
|
66
|
-
version: "22.2.6",
|
|
67
|
-
ngImport: i0,
|
|
68
|
-
type: RichTextToolbarMenuComponent,
|
|
69
|
-
deps: [],
|
|
70
|
-
target: i0.ɵɵFactoryTarget.Component
|
|
71
|
-
});
|
|
72
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
73
|
-
minVersion: "17.0.0",
|
|
74
|
-
version: "22.2.6",
|
|
75
|
-
type: RichTextToolbarMenuComponent,
|
|
76
|
-
isStandalone: true,
|
|
77
|
-
selector: "kles-richtext-toolbar-menu",
|
|
78
|
-
inputs: {
|
|
79
|
-
button: {
|
|
80
|
-
classPropertyName: "button",
|
|
81
|
-
publicName: "button",
|
|
82
|
-
isSignal: true,
|
|
83
|
-
isRequired: true,
|
|
84
|
-
transformFunction: null
|
|
85
|
-
},
|
|
86
|
-
groups: {
|
|
87
|
-
classPropertyName: "groups",
|
|
88
|
-
publicName: "groups",
|
|
89
|
-
isSignal: true,
|
|
90
|
-
isRequired: true,
|
|
91
|
-
transformFunction: null
|
|
92
|
-
},
|
|
93
|
-
messages: {
|
|
94
|
-
classPropertyName: "messages",
|
|
95
|
-
publicName: "messages",
|
|
96
|
-
isSignal: true,
|
|
97
|
-
isRequired: true,
|
|
98
|
-
transformFunction: null
|
|
99
|
-
},
|
|
100
|
-
tabStop: {
|
|
101
|
-
classPropertyName: "tabStop",
|
|
102
|
-
publicName: "tabStop",
|
|
103
|
-
isSignal: true,
|
|
104
|
-
isRequired: true,
|
|
105
|
-
transformFunction: null
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
outputs: { command: "command" },
|
|
109
|
-
viewQueries: [{
|
|
110
|
-
propertyName: "panel",
|
|
111
|
-
first: true,
|
|
112
|
-
predicate: ["panel"],
|
|
113
|
-
descendants: true,
|
|
114
|
-
isSignal: true
|
|
115
|
-
}],
|
|
116
|
-
ngImport: i0,
|
|
117
|
-
template: "<button\n type=\"button\"\n class=\"menu-trigger\"\n [class.with-icon]=\"!!button().icon\"\n [attr.data-richtext-action]=\"button().id\"\n [attr.aria-label]=\"button().ariaLabel\"\n [attr.title]=\"button().label ? null : button().ariaLabel\"\n [attr.popovertarget]=\"panelId\"\n aria-haspopup=\"dialog\"\n [disabled]=\"button().disabled\"\n [tabIndex]=\"tabStop()\"\n (mousedown)=\"$event.button === 0 && $event.preventDefault()\"\n>\n @if (button().iconType === 'material') {\n <span class=\"material-icon\" [attr.data-material-icon]=\"button().icon\" aria-hidden=\"true\"></span>\n } @else if (button().icon) {\n <span aria-hidden=\"true\">{{ button().icon }}</span>\n }\n {{ button().label }}\n</button>\n<div\n #panel\n class=\"menu-panel\"\n [id]=\"panelId\"\n role=\"dialog\"\n [attr.aria-label]=\"button().ariaLabel\"\n popover=\"auto\"\n (toggle)=\"syncPopover(panel)\"\n (keydown)=\"navigate($event, panel)\"\n (keydown.escape)=\"$event.preventDefault(); $event.stopPropagation(); panel.hidePopover()\"\n>\n <input\n #query\n type=\"search\"\n autofocus\n [value]=\"search()\"\n [attr.aria-label]=\"messages().menuSearch\"\n [placeholder]=\"messages().menuSearch\"\n (input)=\"search.set(query.value)\"\n />\n @if (open()) {\n <div class=\"menu-items\">\n @for (group of results(); track group.id) {\n <div [attr.role]=\"group.label ? 'group' : null\" [attr.aria-label]=\"group.label || null\">\n @if (group.label) {\n <p class=\"menu-heading\" aria-hidden=\"true\">{{ group.label }}</p>\n }\n @for (item of group.items; track item.id) {\n <button\n type=\"button\"\n [attr.data-richtext-menu-command]=\"item.id\"\n [disabled]=\"item.disabled\"\n (click)=\"choose(item, panel)\"\n >\n {{ item.label }}\n </button>\n }\n </div>\n } @empty {\n <p role=\"status\">{{ messages().menuNoResults }}</p>\n }\n </div>\n }\n</div>\n",
|
|
118
|
-
styles: [":host{display:contents}button,input{box-sizing:border-box;font:inherit;min-height:2.75rem;max-width:100%;padding:.5rem .7rem;border:1px solid var(--kles-richtext-toolbar-accent, var(--accent, #174f89));border-radius:var(--kles-richtext-toolbar-radius, .5rem);background:var(--kles-richtext-toolbar-background, var(--surface, #fff));color:var(--kles-richtext-toolbar-accent, var(--accent, #174f89))}button:enabled{cursor:pointer}button:disabled{opacity:.5;cursor:not-allowed}:is(button,input):focus-visible{outline:3px solid var(--kles-richtext-toolbar-focus, var(--accent, #174f89));outline-offset:3px}.menu-trigger.with-icon{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;min-inline-size:2.75rem}.material-icon{font-family:var(--kles-richtext-toolbar-material-icon-font, \"Material Icons\");font-feature-settings:\"liga\";font-style:normal;font-weight:400;font-size:1.5rem;line-height:1;letter-spacing:normal;text-transform:none;white-space:nowrap;direction:ltr}.material-icon:before{content:attr(data-material-icon)}.menu-panel{box-sizing:border-box;inline-size:min(20rem,100vw - 1.5rem);padding:.5rem;border:1px solid var(--kles-richtext-toolbar-accent, var(--accent, #174f89));border-radius:var(--kles-richtext-toolbar-radius, .5rem);background:var(--kles-richtext-toolbar-background, var(--surface, #fff));color:inherit}.menu-panel input{width:100%;color:inherit}@supports (position-area: block-end span-inline-end){.menu-panel{inset:auto;margin:.25rem 0;position-area:block-end span-inline-end;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.menu-items{margin-block-start:.25rem;max-block-size:min(22rem,48dvh);overflow-y:auto}.menu-items button{display:block;inline-size:100%;text-align:start;border:0}.menu-items button:hover:enabled{text-decoration:underline}.menu-items button:focus-visible{outline-offset:-3px}.menu-heading{margin:.5rem .7rem .25rem;font-weight:600}\n"],
|
|
119
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
123
|
-
minVersion: "12.0.0",
|
|
124
|
-
version: "22.2.6",
|
|
125
|
-
ngImport: i0,
|
|
126
|
-
type: RichTextToolbarMenuComponent,
|
|
127
|
-
decorators: [{
|
|
128
|
-
type: Component,
|
|
129
|
-
args: [{
|
|
130
|
-
selector: "kles-richtext-toolbar-menu",
|
|
131
|
-
standalone: true,
|
|
132
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
133
|
-
template: "<button\n type=\"button\"\n class=\"menu-trigger\"\n [class.with-icon]=\"!!button().icon\"\n [attr.data-richtext-action]=\"button().id\"\n [attr.aria-label]=\"button().ariaLabel\"\n [attr.title]=\"button().label ? null : button().ariaLabel\"\n [attr.popovertarget]=\"panelId\"\n aria-haspopup=\"dialog\"\n [disabled]=\"button().disabled\"\n [tabIndex]=\"tabStop()\"\n (mousedown)=\"$event.button === 0 && $event.preventDefault()\"\n>\n @if (button().iconType === 'material') {\n <span class=\"material-icon\" [attr.data-material-icon]=\"button().icon\" aria-hidden=\"true\"></span>\n } @else if (button().icon) {\n <span aria-hidden=\"true\">{{ button().icon }}</span>\n }\n {{ button().label }}\n</button>\n<div\n #panel\n class=\"menu-panel\"\n [id]=\"panelId\"\n role=\"dialog\"\n [attr.aria-label]=\"button().ariaLabel\"\n popover=\"auto\"\n (toggle)=\"syncPopover(panel)\"\n (keydown)=\"navigate($event, panel)\"\n (keydown.escape)=\"$event.preventDefault(); $event.stopPropagation(); panel.hidePopover()\"\n>\n <input\n #query\n type=\"search\"\n autofocus\n [value]=\"search()\"\n [attr.aria-label]=\"messages().menuSearch\"\n [placeholder]=\"messages().menuSearch\"\n (input)=\"search.set(query.value)\"\n />\n @if (open()) {\n <div class=\"menu-items\">\n @for (group of results(); track group.id) {\n <div [attr.role]=\"group.label ? 'group' : null\" [attr.aria-label]=\"group.label || null\">\n @if (group.label) {\n <p class=\"menu-heading\" aria-hidden=\"true\">{{ group.label }}</p>\n }\n @for (item of group.items; track item.id) {\n <button\n type=\"button\"\n [attr.data-richtext-menu-command]=\"item.id\"\n [disabled]=\"item.disabled\"\n (click)=\"choose(item, panel)\"\n >\n {{ item.label }}\n </button>\n }\n </div>\n } @empty {\n <p role=\"status\">{{ messages().menuNoResults }}</p>\n }\n </div>\n }\n</div>\n",
|
|
134
|
-
styles: [":host{display:contents}button,input{box-sizing:border-box;font:inherit;min-height:2.75rem;max-width:100%;padding:.5rem .7rem;border:1px solid var(--kles-richtext-toolbar-accent, var(--accent, #174f89));border-radius:var(--kles-richtext-toolbar-radius, .5rem);background:var(--kles-richtext-toolbar-background, var(--surface, #fff));color:var(--kles-richtext-toolbar-accent, var(--accent, #174f89))}button:enabled{cursor:pointer}button:disabled{opacity:.5;cursor:not-allowed}:is(button,input):focus-visible{outline:3px solid var(--kles-richtext-toolbar-focus, var(--accent, #174f89));outline-offset:3px}.menu-trigger.with-icon{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;min-inline-size:2.75rem}.material-icon{font-family:var(--kles-richtext-toolbar-material-icon-font, \"Material Icons\");font-feature-settings:\"liga\";font-style:normal;font-weight:400;font-size:1.5rem;line-height:1;letter-spacing:normal;text-transform:none;white-space:nowrap;direction:ltr}.material-icon:before{content:attr(data-material-icon)}.menu-panel{box-sizing:border-box;inline-size:min(20rem,100vw - 1.5rem);padding:.5rem;border:1px solid var(--kles-richtext-toolbar-accent, var(--accent, #174f89));border-radius:var(--kles-richtext-toolbar-radius, .5rem);background:var(--kles-richtext-toolbar-background, var(--surface, #fff));color:inherit}.menu-panel input{width:100%;color:inherit}@supports (position-area: block-end span-inline-end){.menu-panel{inset:auto;margin:.25rem 0;position-area:block-end span-inline-end;position-try-fallbacks:flip-inline,flip-block,flip-block flip-inline}}.menu-items{margin-block-start:.25rem;max-block-size:min(22rem,48dvh);overflow-y:auto}.menu-items button{display:block;inline-size:100%;text-align:start;border:0}.menu-items button:hover:enabled{text-decoration:underline}.menu-items button:focus-visible{outline-offset:-3px}.menu-heading{margin:.5rem .7rem .25rem;font-weight:600}\n"]
|
|
135
|
-
}]
|
|
136
|
-
}],
|
|
137
|
-
ctorParameters: () => [],
|
|
138
|
-
propDecorators: {
|
|
139
|
-
button: [{
|
|
140
|
-
type: i0.Input,
|
|
141
|
-
args: [{
|
|
142
|
-
isSignal: true,
|
|
143
|
-
alias: "button",
|
|
144
|
-
required: true
|
|
145
|
-
}]
|
|
146
|
-
}],
|
|
147
|
-
groups: [{
|
|
148
|
-
type: i0.Input,
|
|
149
|
-
args: [{
|
|
150
|
-
isSignal: true,
|
|
151
|
-
alias: "groups",
|
|
152
|
-
required: true
|
|
153
|
-
}]
|
|
154
|
-
}],
|
|
155
|
-
messages: [{
|
|
156
|
-
type: i0.Input,
|
|
157
|
-
args: [{
|
|
158
|
-
isSignal: true,
|
|
159
|
-
alias: "messages",
|
|
160
|
-
required: true
|
|
161
|
-
}]
|
|
162
|
-
}],
|
|
163
|
-
tabStop: [{
|
|
164
|
-
type: i0.Input,
|
|
165
|
-
args: [{
|
|
166
|
-
isSignal: true,
|
|
167
|
-
alias: "tabStop",
|
|
168
|
-
required: true
|
|
169
|
-
}]
|
|
170
|
-
}],
|
|
171
|
-
command: [{
|
|
172
|
-
type: i0.Output,
|
|
173
|
-
args: ["command"]
|
|
174
|
-
}],
|
|
175
|
-
panel: [{
|
|
176
|
-
type: i0.ViewChild,
|
|
177
|
-
args: ["panel", { isSignal: true }]
|
|
178
|
-
}]
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
export { RichTextToolbarMenuComponent };
|
|
182
|
-
|
|
183
|
-
//# sourceMappingURL=3kles-kles-richtext-editor-richtext-toolbar-menu.component-Dq2K0CY3.mjs.map
|
package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-Dq2K0CY3.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3kles-kles-richtext-editor-richtext-toolbar-menu.component-Dq2K0CY3.mjs","names":[],"sources":["../../../projects/kles-richtext-editor/src/lib/toolbar/richtext-toolbar-menu.component.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/richtext-toolbar-menu.component.html"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n input,\n output,\n signal,\n viewChild,\n inject,\n} from '@angular/core';\nimport type { ElementRef } from '@angular/core';\nimport type { EditorCommand } from '@3kles/richtext-dom';\nimport { RichTextAccessibilityIds } from '../editor/accessibility-ids.js';\nimport type { ResolvedRichTextMessages } from '../i18n/messages.js';\nimport { toolbarPresentationLabel } from './toolbar-configuration.js';\nimport type {\n RichTextToolbarButton,\n RichTextToolbarMenuCommand,\n RichTextToolbarMenuGroup,\n} from './toolbar-configuration.js';\n\n@Component({\n selector: 'kles-richtext-toolbar-menu',\n standalone: true,\n templateUrl: './richtext-toolbar-menu.component.html',\n styleUrl: './richtext-toolbar-menu.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class RichTextToolbarMenuComponent {\n readonly button =\n input.required<Pick<RichTextToolbarButton, 'id' | 'label' | 'ariaLabel' | 'icon' | 'iconType' | 'disabled'>>();\n readonly groups = input.required<readonly RichTextToolbarMenuGroup[]>();\n readonly messages = input.required<ResolvedRichTextMessages>();\n readonly tabStop = input.required<number>();\n readonly command = output<EditorCommand>();\n protected readonly panelId = inject(RichTextAccessibilityIds).next('menu');\n protected readonly search = signal('');\n protected readonly open = signal(false);\n private readonly panel = viewChild<ElementRef<HTMLElement>>('panel');\n\n protected readonly results = computed(() => {\n const messages = this.messages();\n const search = this.search().trim().toLocaleLowerCase();\n return this.groups().flatMap((group) => {\n const label = toolbarPresentationLabel(group, messages, '');\n const items = group.items\n .map((item) => ({ ...item, label: toolbarPresentationLabel(item, messages, item.label) }))\n .filter((item) =>\n [label, item.label, ...(item.searchTerms ?? [])].some((term) =>\n term.toLocaleLowerCase().includes(search),\n ),\n );\n return items.length ? [{ id: group.id, label, items }] : [];\n });\n });\n\n constructor() {\n effect(() => {\n if (this.button().disabled && this.open()) this.panel()?.nativeElement.hidePopover();\n });\n }\n\n protected syncPopover(panel: HTMLElement): void {\n const open = panel.matches(':popover-open');\n this.open.set(open);\n if (!open) this.search.set('');\n }\n\n protected choose(item: RichTextToolbarMenuCommand, panel: HTMLElement): void {\n if (item.disabled || this.button().disabled || !panel.matches(':popover-open')) return;\n // Run the command while focus is in the toolbar so the editor uses its saved selection.\n this.command.emit(item.command);\n panel.hidePopover();\n }\n\n protected navigate(event: KeyboardEvent, panel: HTMLElement): void {\n if (event.isComposing || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const target = event.target;\n const buttons = Array.from(\n panel.querySelectorAll<HTMLButtonElement>('button[data-richtext-menu-command]:not(:disabled)'),\n );\n if (target instanceof HTMLInputElement && event.key === 'Enter') {\n event.preventDefault();\n buttons[0]?.click();\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n const index = buttons.findIndex((button) => button === target);\n const next = event.key === 'ArrowDown' ? buttons[index + 1] : buttons[index - 1];\n event.preventDefault();\n if (next) next.focus();\n else if (index === 0 && event.key === 'ArrowUp') panel.querySelector('input')?.focus();\n }\n }\n}\n","<button\n type=\"button\"\n class=\"menu-trigger\"\n [class.with-icon]=\"!!button().icon\"\n [attr.data-richtext-action]=\"button().id\"\n [attr.aria-label]=\"button().ariaLabel\"\n [attr.title]=\"button().label ? null : button().ariaLabel\"\n [attr.popovertarget]=\"panelId\"\n aria-haspopup=\"dialog\"\n [disabled]=\"button().disabled\"\n [tabIndex]=\"tabStop()\"\n (mousedown)=\"$event.button === 0 && $event.preventDefault()\"\n>\n @if (button().iconType === 'material') {\n <span class=\"material-icon\" [attr.data-material-icon]=\"button().icon\" aria-hidden=\"true\"></span>\n } @else if (button().icon) {\n <span aria-hidden=\"true\">{{ button().icon }}</span>\n }\n {{ button().label }}\n</button>\n<div\n #panel\n class=\"menu-panel\"\n [id]=\"panelId\"\n role=\"dialog\"\n [attr.aria-label]=\"button().ariaLabel\"\n popover=\"auto\"\n (toggle)=\"syncPopover(panel)\"\n (keydown)=\"navigate($event, panel)\"\n (keydown.escape)=\"$event.preventDefault(); $event.stopPropagation(); panel.hidePopover()\"\n>\n <input\n #query\n type=\"search\"\n autofocus\n [value]=\"search()\"\n [attr.aria-label]=\"messages().menuSearch\"\n [placeholder]=\"messages().menuSearch\"\n (input)=\"search.set(query.value)\"\n />\n @if (open()) {\n <div class=\"menu-items\">\n @for (group of results(); track group.id) {\n <div [attr.role]=\"group.label ? 'group' : null\" [attr.aria-label]=\"group.label || null\">\n @if (group.label) {\n <p class=\"menu-heading\" aria-hidden=\"true\">{{ group.label }}</p>\n }\n @for (item of group.items; track item.id) {\n <button\n type=\"button\"\n [attr.data-richtext-menu-command]=\"item.id\"\n [disabled]=\"item.disabled\"\n (click)=\"choose(item, panel)\"\n >\n {{ item.label }}\n </button>\n }\n </div>\n } @empty {\n <p role=\"status\">{{ messages().menuNoResults }}</p>\n }\n </div>\n }\n</div>\n"],"mappings":";;;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