@3kles/kles-richtext-editor 1.3.0 → 1.4.0

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.
@@ -0,0 +1,197 @@
1
+ import { c as toolbarPresentationLabel, l as RichTextAccessibilityIds } from "./3kles-kles-richtext-editor-toolbar-configuration-DsbPfSEO.mjs";
2
+ import { t as RichTextToolbarButtonComponent } from "./3kles-kles-richtext-editor-richtext-toolbar-button.component-B0aePmqW.mjs";
3
+ import * as i0 from "@angular/core";
4
+ import { ChangeDetectionStrategy, Component, computed, effect, inject, input, output, signal, viewChild } from "@angular/core";
5
+ var RichTextToolbarMenuComponent = class RichTextToolbarMenuComponent {
6
+ button = input.required(...ngDevMode ? [{ debugName: "button" }] : /* istanbul ignore next */ []);
7
+ groups = input.required(...ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []);
8
+ messages = input.required(...ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []);
9
+ tabStop = input.required(...ngDevMode ? [{ debugName: "tabStop" }] : /* istanbul ignore next */ []);
10
+ command = output();
11
+ panelId = inject(RichTextAccessibilityIds).next("menu");
12
+ search = signal("", ...ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []);
13
+ open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
14
+ trigger = computed(() => ({
15
+ ...this.button(),
16
+ actionId: this.button().id,
17
+ tabStop: this.tabStop(),
18
+ popoverTarget: this.panelId
19
+ }), ...ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []);
20
+ panel = viewChild("panel", ...ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []);
21
+ results = computed(() => {
22
+ const messages = this.messages();
23
+ const search = this.search().trim().toLocaleLowerCase();
24
+ return this.groups().flatMap((group) => {
25
+ const label = toolbarPresentationLabel(group, messages, "");
26
+ const items = group.items.map((item) => ({
27
+ ...item,
28
+ label: toolbarPresentationLabel(item, messages, item.label)
29
+ })).filter((item) => [
30
+ label,
31
+ item.label,
32
+ ...item.searchTerms ?? []
33
+ ].some((term) => term.toLocaleLowerCase().includes(search)));
34
+ return items.length ? [{
35
+ id: group.id,
36
+ label,
37
+ items
38
+ }] : [];
39
+ });
40
+ }, ...ngDevMode ? [{ debugName: "results" }] : /* istanbul ignore next */ []);
41
+ constructor() {
42
+ effect(() => {
43
+ if (this.button().disabled && this.open()) this.panel()?.nativeElement.hidePopover();
44
+ });
45
+ }
46
+ syncPopover(panel) {
47
+ const open = panel.matches(":popover-open");
48
+ this.open.set(open);
49
+ if (!open) this.search.set("");
50
+ }
51
+ choose(item, panel) {
52
+ if (item.disabled || this.button().disabled || !panel.matches(":popover-open")) return;
53
+ this.command.emit(item.command);
54
+ panel.hidePopover();
55
+ }
56
+ navigate(event, panel) {
57
+ if (event.isComposing || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
58
+ const target = event.target;
59
+ const buttons = Array.from(panel.querySelectorAll("button[data-richtext-menu-command]:not(:disabled)"));
60
+ if (target instanceof HTMLInputElement && event.key === "Enter") {
61
+ event.preventDefault();
62
+ buttons[0]?.click();
63
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
64
+ const index = buttons.findIndex((button) => button === target);
65
+ const next = event.key === "ArrowDown" ? buttons[index + 1] : buttons[index - 1];
66
+ event.preventDefault();
67
+ if (next) next.focus();
68
+ else if (index === 0 && event.key === "ArrowUp") panel.querySelector("input")?.focus();
69
+ }
70
+ }
71
+ static ɵfac = i0.ɵɵngDeclareFactory({
72
+ minVersion: "12.0.0",
73
+ version: "22.2.6",
74
+ ngImport: i0,
75
+ type: RichTextToolbarMenuComponent,
76
+ deps: [],
77
+ target: i0.ɵɵFactoryTarget.Component
78
+ });
79
+ static ɵcmp = i0.ɵɵngDeclareComponent({
80
+ minVersion: "17.0.0",
81
+ version: "22.2.6",
82
+ type: RichTextToolbarMenuComponent,
83
+ isStandalone: true,
84
+ selector: "kles-richtext-toolbar-menu",
85
+ inputs: {
86
+ button: {
87
+ classPropertyName: "button",
88
+ publicName: "button",
89
+ isSignal: true,
90
+ isRequired: true,
91
+ transformFunction: null
92
+ },
93
+ groups: {
94
+ classPropertyName: "groups",
95
+ publicName: "groups",
96
+ isSignal: true,
97
+ isRequired: true,
98
+ transformFunction: null
99
+ },
100
+ messages: {
101
+ classPropertyName: "messages",
102
+ publicName: "messages",
103
+ isSignal: true,
104
+ isRequired: true,
105
+ transformFunction: null
106
+ },
107
+ tabStop: {
108
+ classPropertyName: "tabStop",
109
+ publicName: "tabStop",
110
+ isSignal: true,
111
+ isRequired: true,
112
+ transformFunction: null
113
+ }
114
+ },
115
+ outputs: { command: "command" },
116
+ viewQueries: [{
117
+ propertyName: "panel",
118
+ first: true,
119
+ predicate: ["panel"],
120
+ descendants: true,
121
+ isSignal: true
122
+ }],
123
+ ngImport: i0,
124
+ template: "<kles-richtext-toolbar-button [control]=\"trigger()\" />\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",
125
+ 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-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"],
126
+ dependencies: [{
127
+ kind: "component",
128
+ type: RichTextToolbarButtonComponent,
129
+ selector: "kles-richtext-toolbar-button",
130
+ inputs: ["control"]
131
+ }],
132
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
133
+ });
134
+ };
135
+ i0.ɵɵngDeclareClassMetadata({
136
+ minVersion: "12.0.0",
137
+ version: "22.2.6",
138
+ ngImport: i0,
139
+ type: RichTextToolbarMenuComponent,
140
+ decorators: [{
141
+ type: Component,
142
+ args: [{
143
+ selector: "kles-richtext-toolbar-menu",
144
+ standalone: true,
145
+ imports: [RichTextToolbarButtonComponent],
146
+ changeDetection: ChangeDetectionStrategy.OnPush,
147
+ template: "<kles-richtext-toolbar-button [control]=\"trigger()\" />\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",
148
+ 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-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"]
149
+ }]
150
+ }],
151
+ ctorParameters: () => [],
152
+ propDecorators: {
153
+ button: [{
154
+ type: i0.Input,
155
+ args: [{
156
+ isSignal: true,
157
+ alias: "button",
158
+ required: true
159
+ }]
160
+ }],
161
+ groups: [{
162
+ type: i0.Input,
163
+ args: [{
164
+ isSignal: true,
165
+ alias: "groups",
166
+ required: true
167
+ }]
168
+ }],
169
+ messages: [{
170
+ type: i0.Input,
171
+ args: [{
172
+ isSignal: true,
173
+ alias: "messages",
174
+ required: true
175
+ }]
176
+ }],
177
+ tabStop: [{
178
+ type: i0.Input,
179
+ args: [{
180
+ isSignal: true,
181
+ alias: "tabStop",
182
+ required: true
183
+ }]
184
+ }],
185
+ command: [{
186
+ type: i0.Output,
187
+ args: ["command"]
188
+ }],
189
+ panel: [{
190
+ type: i0.ViewChild,
191
+ args: ["panel", { isSignal: true }]
192
+ }]
193
+ }
194
+ });
195
+ export { RichTextToolbarMenuComponent };
196
+
197
+ //# sourceMappingURL=3kles-kles-richtext-editor-richtext-toolbar-menu.component-DzUmL7Je.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3kles-kles-richtext-editor-richtext-toolbar-menu.component-DzUmL7Je.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 { RichTextToolbarButtonComponent } from './richtext-toolbar-button.component.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 imports: [RichTextToolbarButtonComponent],\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 protected readonly trigger = computed(() => ({\n ...this.button(),\n actionId: this.button().id,\n tabStop: this.tabStop(),\n popoverTarget: this.panelId,\n }));\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","<kles-richtext-toolbar-button [control]=\"trigger()\" />\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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"}
@@ -1,5 +1,6 @@
1
1
  import { a as toolbarActionQueries, d as RICHTEXT_MESSAGES_FR, f as resolveRichTextMessages, i as sameToolbarActionQueries, l as RichTextAccessibilityIds, n as FULL_RICHTEXT_TOOLBAR_ITEMS, o as toolbarButtonContent, p as richTextLabel, r as resolveToolbarItems, s as toolbarItemLabel, t as DEFAULT_RICHTEXT_TOOLBAR_ITEMS, u as RICHTEXT_MESSAGES_EN } from "./3kles-kles-richtext-editor-toolbar-configuration-DsbPfSEO.mjs";
2
- import { JsonPipe, NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
2
+ import { n as RICHTEXT_TOOLBAR_APPEARANCE, r as provideRichTextToolbarAppearance, t as RichTextToolbarButtonComponent } from "./3kles-kles-richtext-editor-richtext-toolbar-button.component-B0aePmqW.mjs";
3
+ import { JsonPipe, isPlatformBrowser } from "@angular/common";
3
4
  import * as i0 from "@angular/core";
4
5
  import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, PLATFORM_ID, ViewChild, booleanAttribute, computed, effect, forwardRef, inject, input, output, signal, untracked, viewChild } from "@angular/core";
5
6
  import { NG_VALIDATORS, NG_VALUE_ACCESSOR } from "@angular/forms";
@@ -1085,7 +1086,8 @@ var RichTextToolbarComponent = class RichTextToolbarComponent {
1085
1086
  label,
1086
1087
  disabled,
1087
1088
  control: "color",
1088
- colorValue: value ?? COLOR_DEFAULTS[item.id]
1089
+ value,
1090
+ fallback: COLOR_DEFAULTS[item.id]
1089
1091
  };
1090
1092
  const options = STYLE_OPTIONS[item.id];
1091
1093
  return {
@@ -1294,8 +1296,21 @@ var RichTextToolbarComponent = class RichTextToolbarComponent {
1294
1296
  this.statusKey.set(key);
1295
1297
  this.status.set(this.text()[key]);
1296
1298
  }
1297
- preserveSelection(event) {
1298
- if (event.button === 0) event.preventDefault();
1299
+ actionControl(button) {
1300
+ const template = this.buttonTemplate();
1301
+ return {
1302
+ ...button,
1303
+ actionId: button.id,
1304
+ tabStop: this.tabStop() === button.id ? 0 : -1,
1305
+ content: template ? {
1306
+ template,
1307
+ context: {
1308
+ $implicit: button,
1309
+ item: button
1310
+ }
1311
+ } : void 0,
1312
+ activate: () => this.execute(button)
1313
+ };
1299
1314
  }
1300
1315
  execute(button) {
1301
1316
  if (button.disabled) return;
@@ -1455,20 +1470,16 @@ var RichTextToolbarComponent = class RichTextToolbarComponent {
1455
1470
  isSignal: true
1456
1471
  }],
1457
1472
  ngImport: i0,
1458
- template: "<div class=\"kles-richtext-toolbar\" (focusin)=\"rememberFocus($event)\">\n @if (hasItems()) {\n @if (buttons().length) {\n <div\n #commands\n class=\"kles-richtext-toolbar__commands\"\n role=\"toolbar\"\n [attr.aria-label]=\"label()\"\n [attr.aria-disabled]=\"blocked()\"\n [attr.aria-busy]=\"editor().composing()\"\n (keydown)=\"navigate($event)\"\n >\n @for (button of buttons(); track button.id) {\n @if (button.kind === 'menu') {\n @defer (on immediate) {\n <kles-richtext-toolbar-menu\n [button]=\"button\"\n [groups]=\"button.menu.groups\"\n [tabStop]=\"tabStop() === button.id ? 0 : -1\"\n [messages]=\"text()\"\n (command)=\"executeMenuCommand($event)\"\n />\n }\n } @else {\n <button\n type=\"button\"\n [attr.data-richtext-action]=\"button.id\"\n [class.kles-richtext-toolbar__button-with-icon]=\"!buttonTemplate() && !!button.icon\"\n [disabled]=\"button.disabled\"\n [attr.aria-label]=\"button.ariaLabel\"\n [attr.title]=\"button.label ? null : button.ariaLabel\"\n [attr.aria-pressed]=\"button.pressed ?? null\"\n [tabIndex]=\"tabStop() === button.id ? 0 : -1\"\n (mousedown)=\"preserveSelection($event)\"\n (click)=\"execute(button)\"\n >\n @if (buttonTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: button, item: button }\"\n />\n } @else {\n @if (button.iconType === 'material') {\n <span\n class=\"kles-richtext-toolbar__material-icon\"\n [attr.data-material-icon]=\"button.icon\"\n aria-hidden=\"true\"\n ></span>\n } @else if (button.icon) {\n <span aria-hidden=\"true\">{{ button.icon }}</span>\n }\n {{ button.label }}\n }\n </button>\n }\n }\n </div>\n }\n @if (fields().length) {\n <div class=\"kles-richtext-toolbar__fields\" role=\"group\" [attr.aria-label]=\"fieldsLabel()\">\n @for (field of fields(); track field.id) {\n @if (field.id === 'headingLevel') {\n <label class=\"kles-richtext-toolbar__level\" data-richtext-field=\"headingLevel\">\n {{ field.label }}\n <select\n [attr.aria-label]=\"field.ariaLabel?.trim() || text().headingLevelLabel\"\n [disabled]=\"headingDisabled()\"\n (change)=\"changeHeadingLevel($event)\"\n >\n @for (level of headingLevels; track level) {\n <option [value]=\"level\" [selected]=\"level === headingLevel()\">{{ level }}</option>\n }\n </select>\n </label>\n } @else if (field.id === 'link') {\n <label class=\"kles-richtext-toolbar__link\" data-richtext-field=\"link\">\n {{ field.label }}\n <input\n #linkInput\n type=\"text\"\n inputmode=\"url\"\n [disabled]=\"linksDisabled()\"\n [value]=\"linkHref()\"\n [attr.aria-label]=\"field.ariaLabel?.trim() || field.label\"\n [attr.aria-invalid]=\"linkInvalid() ? 'true' : null\"\n [attr.aria-describedby]=\"linkInvalid() ? linkErrorId : null\"\n (input)=\"changeLink(linkInput.value)\"\n (keydown.enter)=\"applyLink($event)\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </label>\n <button\n type=\"button\"\n data-richtext-field=\"link\"\n [class.kles-richtext-toolbar__button-with-icon]=\"iconOnly()\"\n [disabled]=\"applyLinkDisabled()\"\n [attr.aria-label]=\"iconOnly() ? text().applyLink : null\"\n [attr.title]=\"iconOnly() ? text().applyLink : null\"\n (mousedown)=\"preserveSelection($event)\"\n (click)=\"applyLink()\"\n >\n @if (iconOnly()) {\n <span\n class=\"kles-richtext-toolbar__material-icon\"\n data-material-icon=\"link\"\n aria-hidden=\"true\"\n ></span>\n } @else {\n {{ text().applyLink }}\n }\n </button>\n <button\n type=\"button\"\n data-richtext-field=\"link\"\n [class.kles-richtext-toolbar__button-with-icon]=\"iconOnly()\"\n [disabled]=\"removeLinkDisabled()\"\n [attr.aria-label]=\"iconOnly() ? text().removeLink : null\"\n [attr.title]=\"iconOnly() ? text().removeLink : null\"\n (mousedown)=\"preserveSelection($event)\"\n (click)=\"removeLink()\"\n >\n @if (iconOnly()) {\n <span\n class=\"kles-richtext-toolbar__material-icon\"\n data-material-icon=\"link_off\"\n aria-hidden=\"true\"\n ></span>\n } @else {\n {{ text().removeLink }}\n }\n </button>\n } @else if (field.control === 'color') {\n <div class=\"kles-richtext-toolbar__color\">\n <label class=\"kles-richtext-toolbar__level\" [attr.data-richtext-field]=\"field.id\">\n {{ field.label }}\n <input\n #colorInput\n type=\"color\"\n [value]=\"field.colorValue\"\n [disabled]=\"field.disabled\"\n [attr.aria-label]=\"field.ariaLabel?.trim() || field.label\"\n (change)=\"changeStyle(field.id, colorInput.value)\"\n />\n </label>\n <button\n type=\"button\"\n [disabled]=\"field.disabled\"\n [attr.aria-label]=\"\n field.id === 'color' ? text().resetColor : text().resetBackgroundColor\n \"\n [attr.title]=\"field.id === 'color' ? text().resetColor : text().resetBackgroundColor\"\n (mousedown)=\"preserveSelection($event)\"\n (click)=\"changeStyle(field.id, '')\"\n >\n <span aria-hidden=\"true\">×</span>\n </button>\n </div>\n } @else if (field.control === 'select') {\n <label class=\"kles-richtext-toolbar__level\" [attr.data-richtext-field]=\"field.id\">\n {{ field.label }}\n <select\n #styleSelect\n [disabled]=\"field.disabled\"\n [attr.aria-label]=\"field.ariaLabel?.trim() || field.label\"\n (change)=\"changeStyle(field.id, styleSelect.value)\"\n >\n @if (field.value === null) {\n <option disabled selected>{{ text().mixedStyles }}</option>\n }\n <option value=\"\" [selected]=\"field.value === undefined\">\n {{ text().defaultStyle }}\n </option>\n @for (value of field.options; track value) {\n <option [value]=\"value\" [selected]=\"field.value === value\">{{ value }}</option>\n }\n </select>\n </label>\n }\n }\n </div>\n }\n @if (linkInvalid()) {\n <p [id]=\"linkErrorId\" class=\"kles-richtext-toolbar__error\">{{ text().invalidLink }}</p>\n }\n <p class=\"kles-richtext-toolbar__status\" role=\"status\" aria-live=\"polite\">{{ status() }}</p>\n }\n</div>\n",
1459
- styles: [":host{display:block;min-width:0;max-width:100%}.kles-richtext-toolbar{margin-block-end:1rem;color:inherit}.kles-richtext-toolbar__commands,.kles-richtext-toolbar__fields{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem}.kles-richtext-toolbar__fields{align-items:flex-end;margin-block-start:.75rem}.kles-richtext-toolbar__level,.kles-richtext-toolbar__link{display:flex;flex-direction:column;gap:.35rem;margin:0;font-weight:600;min-width:0}.kles-richtext-toolbar__link{flex:1 1 14rem;max-width:28rem}.kles-richtext-toolbar__color{display:flex;align-items:flex-end;gap:.25rem}.kles-richtext-toolbar button,.kles-richtext-toolbar input,.kles-richtext-toolbar select{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))}.kles-richtext-toolbar input{min-width:0;width:100%;color:inherit}.kles-richtext-toolbar input[type=color]{cursor:pointer;padding:.25rem;min-inline-size:2.75rem}.kles-richtext-toolbar button{cursor:pointer;overflow-wrap:anywhere}.kles-richtext-toolbar button.kles-richtext-toolbar__button-with-icon{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;min-inline-size:2.75rem}.kles-richtext-toolbar__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}.kles-richtext-toolbar__material-icon:before{content:attr(data-material-icon)}.kles-richtext-toolbar button:hover:enabled{text-decoration:underline}.kles-richtext-toolbar button[aria-pressed=true]{background:var(--kles-richtext-toolbar-accent, var(--accent, #174f89));color:var(--kles-richtext-toolbar-background, var(--surface, #fff))}.kles-richtext-toolbar :is(button,input,select):disabled{opacity:.5;cursor:not-allowed}.kles-richtext-toolbar :is(button,input,select):focus-visible{outline:3px solid var(--kles-richtext-toolbar-focus, var(--accent, #174f89));outline-offset:3px}.kles-richtext-toolbar input[aria-invalid=true]{border-color:var(--kles-richtext-toolbar-error, var(--error, #9e2020))}.kles-richtext-toolbar__status{margin:.5rem 0 0;font-size:.9rem;line-height:1.5}.kles-richtext-toolbar__status:empty{margin:0}.kles-richtext-toolbar__error{color:var(--kles-richtext-toolbar-error, var(--error, #9e2020));margin:.5rem 0 0;line-height:1.5}\n"],
1473
+ template: "<div class=\"kles-richtext-toolbar\" (focusin)=\"rememberFocus($event)\">\n @if (hasItems()) {\n @if (buttons().length) {\n <div\n #commands\n class=\"kles-richtext-toolbar__commands\"\n role=\"toolbar\"\n [attr.aria-label]=\"label()\"\n [attr.aria-disabled]=\"blocked()\"\n [attr.aria-busy]=\"editor().composing()\"\n (keydown)=\"navigate($event)\"\n >\n @for (button of buttons(); track button.id) {\n @if (button.kind === 'menu') {\n @defer (on immediate) {\n <kles-richtext-toolbar-menu\n [button]=\"button\"\n [groups]=\"button.menu.groups\"\n [tabStop]=\"tabStop() === button.id ? 0 : -1\"\n [messages]=\"text()\"\n (command)=\"executeMenuCommand($event)\"\n />\n }\n } @else {\n <kles-richtext-toolbar-button [control]=\"actionControl(button)\" />\n }\n }\n </div>\n }\n @if (fields().length) {\n @defer (on immediate) {\n <kles-richtext-toolbar-fields [toolbar]=\"this\" />\n }\n }\n @if (linkInvalid()) {\n <p [id]=\"linkErrorId\" class=\"kles-richtext-toolbar__error\">{{ text().invalidLink }}</p>\n }\n <p class=\"kles-richtext-toolbar__status\" role=\"status\" aria-live=\"polite\">{{ status() }}</p>\n }\n</div>\n",
1474
+ styles: [":host{display:block;min-width:0;max-width:100%}.kles-richtext-toolbar{margin-block-end:1rem;color:inherit}.kles-richtext-toolbar__commands,.kles-richtext-toolbar__status{margin:.5rem 0 0;font-size:.9rem;line-height:1.5}.kles-richtext-toolbar__status:empty{margin:0}.kles-richtext-toolbar__error{color:var(--kles-richtext-toolbar-error, var(--error, #9e2020));margin:.5rem 0 0;line-height:1.5}\n"],
1460
1475
  dependencies: [{
1461
- kind: "directive",
1462
- type: NgTemplateOutlet,
1463
- selector: "[ngTemplateOutlet]",
1464
- inputs: [
1465
- "ngTemplateOutletContext",
1466
- "ngTemplateOutlet",
1467
- "ngTemplateOutletInjector"
1468
- ]
1476
+ kind: "component",
1477
+ type: RichTextToolbarButtonComponent,
1478
+ selector: "kles-richtext-toolbar-button",
1479
+ inputs: ["control"]
1469
1480
  }],
1470
1481
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1471
- deferBlockDependencies: [() => [import("./3kles-kles-richtext-editor-richtext-toolbar-menu.component-Dq2K0CY3.mjs").then((m) => m.RichTextToolbarMenuComponent)]]
1482
+ deferBlockDependencies: [() => [import("./3kles-kles-richtext-editor-richtext-toolbar-menu.component-DzUmL7Je.mjs").then((m) => m.RichTextToolbarMenuComponent)], () => [import("./3kles-kles-richtext-editor-richtext-toolbar-fields.component-DVVzGrUm.mjs").then((m) => m.RichTextToolbarFieldsComponent)]]
1472
1483
  });
1473
1484
  };
1474
1485
  i0.ɵɵngDeclareClassMetadataAsync({
@@ -1476,17 +1487,21 @@ i0.ɵɵngDeclareClassMetadataAsync({
1476
1487
  version: "22.2.6",
1477
1488
  ngImport: i0,
1478
1489
  type: RichTextToolbarComponent,
1479
- resolveDeferredDeps: () => [import("./3kles-kles-richtext-editor-richtext-toolbar-menu.component-Dq2K0CY3.mjs").then((m) => m.RichTextToolbarMenuComponent)],
1480
- resolveMetadata: (RichTextToolbarMenuComponent) => ({
1490
+ resolveDeferredDeps: () => [import("./3kles-kles-richtext-editor-richtext-toolbar-menu.component-DzUmL7Je.mjs").then((m) => m.RichTextToolbarMenuComponent), import("./3kles-kles-richtext-editor-richtext-toolbar-fields.component-DVVzGrUm.mjs").then((m) => m.RichTextToolbarFieldsComponent)],
1491
+ resolveMetadata: (RichTextToolbarMenuComponent, RichTextToolbarFieldsComponent) => ({
1481
1492
  decorators: [{
1482
1493
  type: Component,
1483
1494
  args: [{
1484
1495
  selector: "kles-richtext-toolbar",
1485
1496
  standalone: true,
1486
- imports: [NgTemplateOutlet, RichTextToolbarMenuComponent],
1497
+ imports: [
1498
+ RichTextToolbarButtonComponent,
1499
+ RichTextToolbarFieldsComponent,
1500
+ RichTextToolbarMenuComponent
1501
+ ],
1487
1502
  changeDetection: ChangeDetectionStrategy.OnPush,
1488
- template: "<div class=\"kles-richtext-toolbar\" (focusin)=\"rememberFocus($event)\">\n @if (hasItems()) {\n @if (buttons().length) {\n <div\n #commands\n class=\"kles-richtext-toolbar__commands\"\n role=\"toolbar\"\n [attr.aria-label]=\"label()\"\n [attr.aria-disabled]=\"blocked()\"\n [attr.aria-busy]=\"editor().composing()\"\n (keydown)=\"navigate($event)\"\n >\n @for (button of buttons(); track button.id) {\n @if (button.kind === 'menu') {\n @defer (on immediate) {\n <kles-richtext-toolbar-menu\n [button]=\"button\"\n [groups]=\"button.menu.groups\"\n [tabStop]=\"tabStop() === button.id ? 0 : -1\"\n [messages]=\"text()\"\n (command)=\"executeMenuCommand($event)\"\n />\n }\n } @else {\n <button\n type=\"button\"\n [attr.data-richtext-action]=\"button.id\"\n [class.kles-richtext-toolbar__button-with-icon]=\"!buttonTemplate() && !!button.icon\"\n [disabled]=\"button.disabled\"\n [attr.aria-label]=\"button.ariaLabel\"\n [attr.title]=\"button.label ? null : button.ariaLabel\"\n [attr.aria-pressed]=\"button.pressed ?? null\"\n [tabIndex]=\"tabStop() === button.id ? 0 : -1\"\n (mousedown)=\"preserveSelection($event)\"\n (click)=\"execute(button)\"\n >\n @if (buttonTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: button, item: button }\"\n />\n } @else {\n @if (button.iconType === 'material') {\n <span\n class=\"kles-richtext-toolbar__material-icon\"\n [attr.data-material-icon]=\"button.icon\"\n aria-hidden=\"true\"\n ></span>\n } @else if (button.icon) {\n <span aria-hidden=\"true\">{{ button.icon }}</span>\n }\n {{ button.label }}\n }\n </button>\n }\n }\n </div>\n }\n @if (fields().length) {\n <div class=\"kles-richtext-toolbar__fields\" role=\"group\" [attr.aria-label]=\"fieldsLabel()\">\n @for (field of fields(); track field.id) {\n @if (field.id === 'headingLevel') {\n <label class=\"kles-richtext-toolbar__level\" data-richtext-field=\"headingLevel\">\n {{ field.label }}\n <select\n [attr.aria-label]=\"field.ariaLabel?.trim() || text().headingLevelLabel\"\n [disabled]=\"headingDisabled()\"\n (change)=\"changeHeadingLevel($event)\"\n >\n @for (level of headingLevels; track level) {\n <option [value]=\"level\" [selected]=\"level === headingLevel()\">{{ level }}</option>\n }\n </select>\n </label>\n } @else if (field.id === 'link') {\n <label class=\"kles-richtext-toolbar__link\" data-richtext-field=\"link\">\n {{ field.label }}\n <input\n #linkInput\n type=\"text\"\n inputmode=\"url\"\n [disabled]=\"linksDisabled()\"\n [value]=\"linkHref()\"\n [attr.aria-label]=\"field.ariaLabel?.trim() || field.label\"\n [attr.aria-invalid]=\"linkInvalid() ? 'true' : null\"\n [attr.aria-describedby]=\"linkInvalid() ? linkErrorId : null\"\n (input)=\"changeLink(linkInput.value)\"\n (keydown.enter)=\"applyLink($event)\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </label>\n <button\n type=\"button\"\n data-richtext-field=\"link\"\n [class.kles-richtext-toolbar__button-with-icon]=\"iconOnly()\"\n [disabled]=\"applyLinkDisabled()\"\n [attr.aria-label]=\"iconOnly() ? text().applyLink : null\"\n [attr.title]=\"iconOnly() ? text().applyLink : null\"\n (mousedown)=\"preserveSelection($event)\"\n (click)=\"applyLink()\"\n >\n @if (iconOnly()) {\n <span\n class=\"kles-richtext-toolbar__material-icon\"\n data-material-icon=\"link\"\n aria-hidden=\"true\"\n ></span>\n } @else {\n {{ text().applyLink }}\n }\n </button>\n <button\n type=\"button\"\n data-richtext-field=\"link\"\n [class.kles-richtext-toolbar__button-with-icon]=\"iconOnly()\"\n [disabled]=\"removeLinkDisabled()\"\n [attr.aria-label]=\"iconOnly() ? text().removeLink : null\"\n [attr.title]=\"iconOnly() ? text().removeLink : null\"\n (mousedown)=\"preserveSelection($event)\"\n (click)=\"removeLink()\"\n >\n @if (iconOnly()) {\n <span\n class=\"kles-richtext-toolbar__material-icon\"\n data-material-icon=\"link_off\"\n aria-hidden=\"true\"\n ></span>\n } @else {\n {{ text().removeLink }}\n }\n </button>\n } @else if (field.control === 'color') {\n <div class=\"kles-richtext-toolbar__color\">\n <label class=\"kles-richtext-toolbar__level\" [attr.data-richtext-field]=\"field.id\">\n {{ field.label }}\n <input\n #colorInput\n type=\"color\"\n [value]=\"field.colorValue\"\n [disabled]=\"field.disabled\"\n [attr.aria-label]=\"field.ariaLabel?.trim() || field.label\"\n (change)=\"changeStyle(field.id, colorInput.value)\"\n />\n </label>\n <button\n type=\"button\"\n [disabled]=\"field.disabled\"\n [attr.aria-label]=\"\n field.id === 'color' ? text().resetColor : text().resetBackgroundColor\n \"\n [attr.title]=\"field.id === 'color' ? text().resetColor : text().resetBackgroundColor\"\n (mousedown)=\"preserveSelection($event)\"\n (click)=\"changeStyle(field.id, '')\"\n >\n <span aria-hidden=\"true\">×</span>\n </button>\n </div>\n } @else if (field.control === 'select') {\n <label class=\"kles-richtext-toolbar__level\" [attr.data-richtext-field]=\"field.id\">\n {{ field.label }}\n <select\n #styleSelect\n [disabled]=\"field.disabled\"\n [attr.aria-label]=\"field.ariaLabel?.trim() || field.label\"\n (change)=\"changeStyle(field.id, styleSelect.value)\"\n >\n @if (field.value === null) {\n <option disabled selected>{{ text().mixedStyles }}</option>\n }\n <option value=\"\" [selected]=\"field.value === undefined\">\n {{ text().defaultStyle }}\n </option>\n @for (value of field.options; track value) {\n <option [value]=\"value\" [selected]=\"field.value === value\">{{ value }}</option>\n }\n </select>\n </label>\n }\n }\n </div>\n }\n @if (linkInvalid()) {\n <p [id]=\"linkErrorId\" class=\"kles-richtext-toolbar__error\">{{ text().invalidLink }}</p>\n }\n <p class=\"kles-richtext-toolbar__status\" role=\"status\" aria-live=\"polite\">{{ status() }}</p>\n }\n</div>\n",
1489
- styles: [":host{display:block;min-width:0;max-width:100%}.kles-richtext-toolbar{margin-block-end:1rem;color:inherit}.kles-richtext-toolbar__commands,.kles-richtext-toolbar__fields{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem}.kles-richtext-toolbar__fields{align-items:flex-end;margin-block-start:.75rem}.kles-richtext-toolbar__level,.kles-richtext-toolbar__link{display:flex;flex-direction:column;gap:.35rem;margin:0;font-weight:600;min-width:0}.kles-richtext-toolbar__link{flex:1 1 14rem;max-width:28rem}.kles-richtext-toolbar__color{display:flex;align-items:flex-end;gap:.25rem}.kles-richtext-toolbar button,.kles-richtext-toolbar input,.kles-richtext-toolbar select{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))}.kles-richtext-toolbar input{min-width:0;width:100%;color:inherit}.kles-richtext-toolbar input[type=color]{cursor:pointer;padding:.25rem;min-inline-size:2.75rem}.kles-richtext-toolbar button{cursor:pointer;overflow-wrap:anywhere}.kles-richtext-toolbar button.kles-richtext-toolbar__button-with-icon{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;min-inline-size:2.75rem}.kles-richtext-toolbar__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}.kles-richtext-toolbar__material-icon:before{content:attr(data-material-icon)}.kles-richtext-toolbar button:hover:enabled{text-decoration:underline}.kles-richtext-toolbar button[aria-pressed=true]{background:var(--kles-richtext-toolbar-accent, var(--accent, #174f89));color:var(--kles-richtext-toolbar-background, var(--surface, #fff))}.kles-richtext-toolbar :is(button,input,select):disabled{opacity:.5;cursor:not-allowed}.kles-richtext-toolbar :is(button,input,select):focus-visible{outline:3px solid var(--kles-richtext-toolbar-focus, var(--accent, #174f89));outline-offset:3px}.kles-richtext-toolbar input[aria-invalid=true]{border-color:var(--kles-richtext-toolbar-error, var(--error, #9e2020))}.kles-richtext-toolbar__status{margin:.5rem 0 0;font-size:.9rem;line-height:1.5}.kles-richtext-toolbar__status:empty{margin:0}.kles-richtext-toolbar__error{color:var(--kles-richtext-toolbar-error, var(--error, #9e2020));margin:.5rem 0 0;line-height:1.5}\n"]
1503
+ template: "<div class=\"kles-richtext-toolbar\" (focusin)=\"rememberFocus($event)\">\n @if (hasItems()) {\n @if (buttons().length) {\n <div\n #commands\n class=\"kles-richtext-toolbar__commands\"\n role=\"toolbar\"\n [attr.aria-label]=\"label()\"\n [attr.aria-disabled]=\"blocked()\"\n [attr.aria-busy]=\"editor().composing()\"\n (keydown)=\"navigate($event)\"\n >\n @for (button of buttons(); track button.id) {\n @if (button.kind === 'menu') {\n @defer (on immediate) {\n <kles-richtext-toolbar-menu\n [button]=\"button\"\n [groups]=\"button.menu.groups\"\n [tabStop]=\"tabStop() === button.id ? 0 : -1\"\n [messages]=\"text()\"\n (command)=\"executeMenuCommand($event)\"\n />\n }\n } @else {\n <kles-richtext-toolbar-button [control]=\"actionControl(button)\" />\n }\n }\n </div>\n }\n @if (fields().length) {\n @defer (on immediate) {\n <kles-richtext-toolbar-fields [toolbar]=\"this\" />\n }\n }\n @if (linkInvalid()) {\n <p [id]=\"linkErrorId\" class=\"kles-richtext-toolbar__error\">{{ text().invalidLink }}</p>\n }\n <p class=\"kles-richtext-toolbar__status\" role=\"status\" aria-live=\"polite\">{{ status() }}</p>\n }\n</div>\n",
1504
+ styles: [":host{display:block;min-width:0;max-width:100%}.kles-richtext-toolbar{margin-block-end:1rem;color:inherit}.kles-richtext-toolbar__commands,.kles-richtext-toolbar__status{margin:.5rem 0 0;font-size:.9rem;line-height:1.5}.kles-richtext-toolbar__status:empty{margin:0}.kles-richtext-toolbar__error{color:var(--kles-richtext-toolbar-error, var(--error, #9e2020));margin:.5rem 0 0;line-height:1.5}\n"]
1490
1505
  }]
1491
1506
  }],
1492
1507
  ctorParameters: () => [],
@@ -1562,6 +1577,6 @@ i0.ɵɵngDeclareClassMetadataAsync({
1562
1577
  }
1563
1578
  })
1564
1579
  });
1565
- export { DEFAULT_RICHTEXT_TOOLBAR_ITEMS, FULL_RICHTEXT_TOOLBAR_ITEMS, RICHTEXT_EDITOR_EXTENSIONS, RICHTEXT_I18N, RICHTEXT_MESSAGES_EN, RICHTEXT_MESSAGES_FR, RICHTEXT_TOOLBAR_CONFIG, RichTextDocumentPreviewComponent, RichTextEditorComponent, RichTextToolbarComponent, provideRichTextI18n, provideRichTextToolbar, richTextDocumentValidator, richTextHtmlRequiredValidator, richTextRequiredValidator, validateRichTextValue };
1580
+ export { DEFAULT_RICHTEXT_TOOLBAR_ITEMS, FULL_RICHTEXT_TOOLBAR_ITEMS, RICHTEXT_EDITOR_EXTENSIONS, RICHTEXT_I18N, RICHTEXT_MESSAGES_EN, RICHTEXT_MESSAGES_FR, RICHTEXT_TOOLBAR_APPEARANCE, RICHTEXT_TOOLBAR_CONFIG, RichTextDocumentPreviewComponent, RichTextEditorComponent, RichTextToolbarComponent, provideRichTextI18n, provideRichTextToolbar, provideRichTextToolbarAppearance, richTextDocumentValidator, richTextHtmlRequiredValidator, richTextRequiredValidator, validateRichTextValue };
1566
1581
 
1567
1582
  //# sourceMappingURL=3kles-kles-richtext-editor.mjs.map