@3kles/kles-richtext-editor 1.4.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 +273 -0
- package/fesm2022/3kles-kles-richtext-editor-material.mjs.map +1 -1
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-button.component-B0aePmqW.mjs.map +1 -1
- 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-DzUmL7Je.mjs → 3kles-kles-richtext-editor-richtext-toolbar-menu.component-DkaxVVT8.mjs} +35 -8
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-DkaxVVT8.mjs.map +1 -0
- package/fesm2022/3kles-kles-richtext-editor.mjs +6 -3
- package/fesm2022/3kles-kles-richtext-editor.mjs.map +1 -1
- package/package.json +4 -4
- package/types/3kles-kles-richtext-editor-material.d.ts.map +1 -1
- package/types/3kles-kles-richtext-editor.d.ts +38 -1
- package/types/3kles-kles-richtext-editor.d.ts.map +1 -1
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-fields.component-DVVzGrUm.mjs +0 -106
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-fields.component-DVVzGrUm.mjs.map +0 -1
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-DzUmL7Je.mjs.map +0 -1
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { n as RICHTEXT_TOOLBAR_APPEARANCE, t as RichTextToolbarButtonComponent } from "./3kles-kles-richtext-editor-richtext-toolbar-button.component-B0aePmqW.mjs";
|
|
2
|
-
import { NgComponentOutlet } from "@angular/common";
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import { ChangeDetectionStrategy, Component, inject, input } from "@angular/core";
|
|
5
|
-
var RichTextToolbarFieldsComponent = class RichTextToolbarFieldsComponent {
|
|
6
|
-
toolbar = input.required(...ngDevMode ? [{ debugName: "toolbar" }] : /* istanbul ignore next */ []);
|
|
7
|
-
colorRenderer = inject(RICHTEXT_TOOLBAR_APPEARANCE).color;
|
|
8
|
-
resetColor = {
|
|
9
|
-
color: () => this.toolbar().changeStyle("color", ""),
|
|
10
|
-
backgroundColor: () => this.toolbar().changeStyle("backgroundColor", "")
|
|
11
|
-
};
|
|
12
|
-
linkControl(remove) {
|
|
13
|
-
const ariaLabel = this.toolbar().text()[remove ? "removeLink" : "applyLink"];
|
|
14
|
-
const iconOnly = this.toolbar().iconOnly();
|
|
15
|
-
return {
|
|
16
|
-
label: iconOnly ? "" : ariaLabel,
|
|
17
|
-
ariaLabel,
|
|
18
|
-
disabled: remove ? this.toolbar().removeLinkDisabled() : this.toolbar().applyLinkDisabled(),
|
|
19
|
-
icon: iconOnly ? remove ? "link_off" : "link" : void 0,
|
|
20
|
-
iconType: "material",
|
|
21
|
-
fieldId: "link",
|
|
22
|
-
activate: () => remove ? this.toolbar().removeLink() : this.toolbar().applyLink()
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
colorControl(field) {
|
|
26
|
-
return {
|
|
27
|
-
...field,
|
|
28
|
-
popoverId: `${this.toolbar().linkErrorId}-${field.id}`,
|
|
29
|
-
ariaLabel: field.ariaLabel?.trim() || field.label,
|
|
30
|
-
resetLabel: this.toolbar().text()[field.id === "color" ? "resetColor" : "resetBackgroundColor"],
|
|
31
|
-
change: (value) => this.toolbar().changeStyle(field.id, value)
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
35
|
-
minVersion: "12.0.0",
|
|
36
|
-
version: "22.2.6",
|
|
37
|
-
ngImport: i0,
|
|
38
|
-
type: RichTextToolbarFieldsComponent,
|
|
39
|
-
deps: [],
|
|
40
|
-
target: i0.ɵɵFactoryTarget.Component
|
|
41
|
-
});
|
|
42
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
43
|
-
minVersion: "17.0.0",
|
|
44
|
-
version: "22.2.6",
|
|
45
|
-
type: RichTextToolbarFieldsComponent,
|
|
46
|
-
isStandalone: true,
|
|
47
|
-
selector: "kles-richtext-toolbar-fields",
|
|
48
|
-
inputs: { toolbar: {
|
|
49
|
-
classPropertyName: "toolbar",
|
|
50
|
-
publicName: "toolbar",
|
|
51
|
-
isSignal: true,
|
|
52
|
-
isRequired: true,
|
|
53
|
-
transformFunction: null
|
|
54
|
-
} },
|
|
55
|
-
ngImport: i0,
|
|
56
|
-
template: "<div class=\"kles-richtext-toolbar__fields\" role=\"group\" [attr.aria-label]=\"toolbar().fieldsLabel()\">\n @for (field of toolbar().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() || toolbar().text().headingLevelLabel\"\n [disabled]=\"toolbar().headingDisabled()\"\n (change)=\"toolbar().changeHeadingLevel($event)\"\n >\n @for (level of toolbar().headingLevels; track level) {\n <option [value]=\"level\" [selected]=\"level === toolbar().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]=\"toolbar().linksDisabled()\"\n [value]=\"toolbar().linkHref()\"\n [attr.aria-label]=\"field.ariaLabel?.trim() || field.label\"\n [attr.aria-invalid]=\"toolbar().linkInvalid() ? 'true' : null\"\n [attr.aria-describedby]=\"toolbar().linkInvalid() ? toolbar().linkErrorId : null\"\n (input)=\"toolbar().changeLink(linkInput.value)\"\n (keydown.enter)=\"toolbar().applyLink($event)\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </label>\n <kles-richtext-toolbar-button [control]=\"linkControl(false)\" />\n <kles-richtext-toolbar-button [control]=\"linkControl(true)\" />\n } @else if (field.control === 'color') {\n @let color = colorControl(field);\n @if (colorRenderer; as renderer) {\n <ng-container *ngComponentOutlet=\"renderer; inputs: { control: color }\" />\n } @else {\n <div class=\"kles-richtext-toolbar__color\">\n <label class=\"kles-richtext-toolbar__level\" [attr.data-richtext-field]=\"color.id\">\n {{ color.label }}\n <input\n #colorInput\n type=\"color\"\n [value]=\"color.value ?? color.fallback\"\n [disabled]=\"color.disabled\"\n [attr.aria-label]=\"color.ariaLabel\"\n (change)=\"color.change(colorInput.value)\"\n />\n </label>\n <kles-richtext-toolbar-button\n [control]=\"{\n label: '',\n icon: '×',\n ariaLabel: color.resetLabel,\n disabled: color.disabled,\n activate: resetColor[color.id],\n }\"\n />\n </div>\n }\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)=\"toolbar().changeStyle(field.id, styleSelect.value)\"\n >\n @if (field.value === null) {\n <option disabled selected>{{ toolbar().text().mixedStyles }}</option>\n }\n <option value=\"\" [selected]=\"field.value === undefined\">\n {{ toolbar().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",
|
|
57
|
-
styles: [":host{display:contents}.kles-richtext-toolbar__fields{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem}.kles-richtext-toolbar__fields{display:flex;align-items:flex-end;flex-wrap:wrap;gap:.5rem;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 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 :is(input,select):disabled{opacity:.5;cursor:not-allowed}.kles-richtext-toolbar :is(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))}\n"],
|
|
58
|
-
dependencies: [{
|
|
59
|
-
kind: "directive",
|
|
60
|
-
type: NgComponentOutlet,
|
|
61
|
-
selector: "[ngComponentOutlet]",
|
|
62
|
-
inputs: [
|
|
63
|
-
"ngComponentOutlet",
|
|
64
|
-
"ngComponentOutletInputs",
|
|
65
|
-
"ngComponentOutletInjector",
|
|
66
|
-
"ngComponentOutletEnvironmentInjector",
|
|
67
|
-
"ngComponentOutletContent",
|
|
68
|
-
"ngComponentOutletNgModule"
|
|
69
|
-
],
|
|
70
|
-
exportAs: ["ngComponentOutlet"]
|
|
71
|
-
}, {
|
|
72
|
-
kind: "component",
|
|
73
|
-
type: RichTextToolbarButtonComponent,
|
|
74
|
-
selector: "kles-richtext-toolbar-button",
|
|
75
|
-
inputs: ["control"]
|
|
76
|
-
}],
|
|
77
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
81
|
-
minVersion: "12.0.0",
|
|
82
|
-
version: "22.2.6",
|
|
83
|
-
ngImport: i0,
|
|
84
|
-
type: RichTextToolbarFieldsComponent,
|
|
85
|
-
decorators: [{
|
|
86
|
-
type: Component,
|
|
87
|
-
args: [{
|
|
88
|
-
selector: "kles-richtext-toolbar-fields",
|
|
89
|
-
imports: [NgComponentOutlet, RichTextToolbarButtonComponent],
|
|
90
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
91
|
-
template: "<div class=\"kles-richtext-toolbar__fields\" role=\"group\" [attr.aria-label]=\"toolbar().fieldsLabel()\">\n @for (field of toolbar().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() || toolbar().text().headingLevelLabel\"\n [disabled]=\"toolbar().headingDisabled()\"\n (change)=\"toolbar().changeHeadingLevel($event)\"\n >\n @for (level of toolbar().headingLevels; track level) {\n <option [value]=\"level\" [selected]=\"level === toolbar().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]=\"toolbar().linksDisabled()\"\n [value]=\"toolbar().linkHref()\"\n [attr.aria-label]=\"field.ariaLabel?.trim() || field.label\"\n [attr.aria-invalid]=\"toolbar().linkInvalid() ? 'true' : null\"\n [attr.aria-describedby]=\"toolbar().linkInvalid() ? toolbar().linkErrorId : null\"\n (input)=\"toolbar().changeLink(linkInput.value)\"\n (keydown.enter)=\"toolbar().applyLink($event)\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </label>\n <kles-richtext-toolbar-button [control]=\"linkControl(false)\" />\n <kles-richtext-toolbar-button [control]=\"linkControl(true)\" />\n } @else if (field.control === 'color') {\n @let color = colorControl(field);\n @if (colorRenderer; as renderer) {\n <ng-container *ngComponentOutlet=\"renderer; inputs: { control: color }\" />\n } @else {\n <div class=\"kles-richtext-toolbar__color\">\n <label class=\"kles-richtext-toolbar__level\" [attr.data-richtext-field]=\"color.id\">\n {{ color.label }}\n <input\n #colorInput\n type=\"color\"\n [value]=\"color.value ?? color.fallback\"\n [disabled]=\"color.disabled\"\n [attr.aria-label]=\"color.ariaLabel\"\n (change)=\"color.change(colorInput.value)\"\n />\n </label>\n <kles-richtext-toolbar-button\n [control]=\"{\n label: '',\n icon: '×',\n ariaLabel: color.resetLabel,\n disabled: color.disabled,\n activate: resetColor[color.id],\n }\"\n />\n </div>\n }\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)=\"toolbar().changeStyle(field.id, styleSelect.value)\"\n >\n @if (field.value === null) {\n <option disabled selected>{{ toolbar().text().mixedStyles }}</option>\n }\n <option value=\"\" [selected]=\"field.value === undefined\">\n {{ toolbar().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",
|
|
92
|
-
styles: [":host{display:contents}.kles-richtext-toolbar__fields{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem}.kles-richtext-toolbar__fields{display:flex;align-items:flex-end;flex-wrap:wrap;gap:.5rem;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 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 :is(input,select):disabled{opacity:.5;cursor:not-allowed}.kles-richtext-toolbar :is(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))}\n"]
|
|
93
|
-
}]
|
|
94
|
-
}],
|
|
95
|
-
propDecorators: { toolbar: [{
|
|
96
|
-
type: i0.Input,
|
|
97
|
-
args: [{
|
|
98
|
-
isSignal: true,
|
|
99
|
-
alias: "toolbar",
|
|
100
|
-
required: true
|
|
101
|
-
}]
|
|
102
|
-
}] }
|
|
103
|
-
});
|
|
104
|
-
export { RichTextToolbarFieldsComponent };
|
|
105
|
-
|
|
106
|
-
//# sourceMappingURL=3kles-kles-richtext-editor-richtext-toolbar-fields.component-DVVzGrUm.mjs.map
|
package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-fields.component-DVVzGrUm.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3kles-kles-richtext-editor-richtext-toolbar-fields.component-DVVzGrUm.mjs","names":[],"sources":["../../../projects/kles-richtext-editor/src/lib/toolbar/richtext-toolbar-fields.component.ts","../../../projects/kles-richtext-editor/src/lib/toolbar/richtext-toolbar-fields.component.html"],"sourcesContent":["import { NgComponentOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';\nimport { RichTextToolbarButtonComponent } from './richtext-toolbar-button.component.js';\nimport type { RichTextToolbarComponent } from './richtext-toolbar.component.js';\nimport { RICHTEXT_TOOLBAR_APPEARANCE } from './toolbar-appearance.js';\nimport type { RichTextToolbarButtonControl, RichTextToolbarColorControl } from './toolbar-appearance.js';\n\n@Component({\n selector: 'kles-richtext-toolbar-fields',\n imports: [NgComponentOutlet, RichTextToolbarButtonComponent],\n templateUrl: './richtext-toolbar-fields.component.html',\n styleUrl: './richtext-toolbar-fields.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class RichTextToolbarFieldsComponent {\n readonly toolbar = input.required<RichTextToolbarComponent>();\n protected readonly colorRenderer = inject(RICHTEXT_TOOLBAR_APPEARANCE).color;\n protected readonly resetColor = {\n color: () => this.toolbar().changeStyle('color', ''),\n backgroundColor: () => this.toolbar().changeStyle('backgroundColor', ''),\n };\n\n protected linkControl(remove: boolean): RichTextToolbarButtonControl {\n const ariaLabel = this.toolbar().text()[remove ? 'removeLink' : 'applyLink'];\n const iconOnly = this.toolbar().iconOnly();\n return {\n label: iconOnly ? '' : ariaLabel,\n ariaLabel,\n disabled: remove ? this.toolbar().removeLinkDisabled() : this.toolbar().applyLinkDisabled(),\n icon: iconOnly ? (remove ? 'link_off' : 'link') : undefined,\n iconType: 'material',\n fieldId: 'link',\n activate: () => (remove ? this.toolbar().removeLink() : this.toolbar().applyLink()),\n };\n }\n\n protected colorControl(field: {\n readonly id: RichTextToolbarColorControl['id'];\n readonly label: string;\n readonly ariaLabel?: string;\n readonly disabled: boolean;\n readonly value: string | null | undefined;\n readonly fallback: string;\n }): RichTextToolbarColorControl {\n return {\n ...field,\n popoverId: `${this.toolbar().linkErrorId}-${field.id}`,\n ariaLabel: field.ariaLabel?.trim() || field.label,\n resetLabel: this.toolbar().text()[field.id === 'color' ? 'resetColor' : 'resetBackgroundColor'],\n change: (value) => this.toolbar().changeStyle(field.id, value),\n };\n }\n}\n","<div class=\"kles-richtext-toolbar__fields\" role=\"group\" [attr.aria-label]=\"toolbar().fieldsLabel()\">\n @for (field of toolbar().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() || toolbar().text().headingLevelLabel\"\n [disabled]=\"toolbar().headingDisabled()\"\n (change)=\"toolbar().changeHeadingLevel($event)\"\n >\n @for (level of toolbar().headingLevels; track level) {\n <option [value]=\"level\" [selected]=\"level === toolbar().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]=\"toolbar().linksDisabled()\"\n [value]=\"toolbar().linkHref()\"\n [attr.aria-label]=\"field.ariaLabel?.trim() || field.label\"\n [attr.aria-invalid]=\"toolbar().linkInvalid() ? 'true' : null\"\n [attr.aria-describedby]=\"toolbar().linkInvalid() ? toolbar().linkErrorId : null\"\n (input)=\"toolbar().changeLink(linkInput.value)\"\n (keydown.enter)=\"toolbar().applyLink($event)\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n />\n </label>\n <kles-richtext-toolbar-button [control]=\"linkControl(false)\" />\n <kles-richtext-toolbar-button [control]=\"linkControl(true)\" />\n } @else if (field.control === 'color') {\n @let color = colorControl(field);\n @if (colorRenderer; as renderer) {\n <ng-container *ngComponentOutlet=\"renderer; inputs: { control: color }\" />\n } @else {\n <div class=\"kles-richtext-toolbar__color\">\n <label class=\"kles-richtext-toolbar__level\" [attr.data-richtext-field]=\"color.id\">\n {{ color.label }}\n <input\n #colorInput\n type=\"color\"\n [value]=\"color.value ?? color.fallback\"\n [disabled]=\"color.disabled\"\n [attr.aria-label]=\"color.ariaLabel\"\n (change)=\"color.change(colorInput.value)\"\n />\n </label>\n <kles-richtext-toolbar-button\n [control]=\"{\n label: '',\n icon: '×',\n ariaLabel: color.resetLabel,\n disabled: color.disabled,\n activate: resetColor[color.id],\n }\"\n />\n </div>\n }\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)=\"toolbar().changeStyle(field.id, styleSelect.value)\"\n >\n @if (field.value === null) {\n <option disabled selected>{{ toolbar().text().mixedStyles }}</option>\n }\n <option value=\"\" [selected]=\"field.value === undefined\">\n {{ toolbar().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"],"mappings":";;;;AAcA,IAAa,iCAAb,MAAa,+BAA8B;CAC9B,UAAU,MAAM,SAAoC,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAC1C,gBAAgB,OAAO,2BAA2B,CAAC,CAAC;CACpD,aAAa;EAC5B,aAAa,KAAK,QAAO,CAAE,CAAC,YAAY,SAAS,EAAE;EACnD,uBAAuB,KAAK,QAAO,CAAE,CAAC,YAAY,mBAAmB,EAAE;CAC1E;CAES,YAAY,QAAe;EACjC,MAAM,YAAY,KAAK,QAAO,CAAE,CAAC,KAAI,CAAE,CAAC,SAAS,eAAe;EAChE,MAAM,WAAW,KAAK,QAAO,CAAE,CAAC,SAAQ;EACxC,OAAO;GACH,OAAO,WAAW,KAAK;GACvB;GACA,UAAU,SAAS,KAAK,QAAO,CAAE,CAAC,mBAAkB,IAAK,KAAK,QAAO,CAAE,CAAC,kBAAiB;GACzF,MAAM,WAAY,SAAS,aAAa,SAAU;GAClD,UAAU;GACV,SAAS;GACT,gBAAiB,SAAS,KAAK,QAAO,CAAE,CAAC,WAAU,IAAK,KAAK,QAAO,CAAE,CAAC,UAAS;EACnF;CACL;CAEU,aAAa,OAOtB;EACG,OAAO;GACH,GAAG;GACH,WAAW,GAAG,KAAK,QAAO,CAAE,CAAC,YAAW,GAAI,MAAM;GAClD,WAAW,MAAM,WAAW,KAAI,KAAM,MAAM;GAC5C,YAAY,KAAK,QAAO,CAAE,CAAC,KAAI,CAAE,CAAC,MAAM,OAAO,UAAU,eAAe;GACxE,SAAS,UAAU,KAAK,QAAO,CAAE,CAAC,YAAY,MAAM,IAAI,KAAK;EAChE;CACL;CArCS,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAA8B,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAA9B,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAA8B,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,SAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,UAAA;EAAA,UCd3C;EAsFA,QAAA,CAAA,g6CAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MD7Ec;GAAiB,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;GAAA;GAAA,UAAA,CAAA,mBAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAA8B,UAAA;GAAA,QAAA,CAAA,SAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAKlD,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA8B,YAAA,CAAA;EAP1C,MAAA;EACa,MAAA,CAAA;GAAA,UAAA;GAA8B,SAC/B,CAAC,mBAAmB,8BAA8B;GAAC,iBAG3C,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,g6CAAA;EAAA,CAAA"}
|
package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-DzUmL7Je.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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":";;;;AA+BA,IAAa,+BAAb,MAAa,6BAA4B;CAC5B,SACL,MAAM,SAAwG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACzG,SAAS,MAAM,SAA+C,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAC9D,WAAW,MAAM,SAAoC,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CACrD,UAAU,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,UAAU,OAAM;CACN,UAAU,OAAO,wBAAwB,CAAC,CAAC,KAAK,MAAM;CACtD,SAAS,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACnB,OAAO,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CACpB,UAAU,gBAAgB;EACzC,GAAG,KAAK,OAAM;EACd,UAAU,KAAK,OAAM,CAAE,CAAC;EACxB,SAAS,KAAK,QAAO;EACrB,eAAe,KAAK;CACvB,IAAE,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACc,QAAQ,UAAmC,SAAQ,GAAA,YAAA,CAAA,EAA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