@3kles/kles-richtext-editor 1.2.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.
- package/fesm2022/3kles-kles-richtext-editor-material.mjs +250 -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-DVVzGrUm.mjs +106 -0
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-fields.component-DVVzGrUm.mjs.map +1 -0
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-DzUmL7Je.mjs +197 -0
- package/fesm2022/3kles-kles-richtext-editor-richtext-toolbar-menu.component-DzUmL7Je.mjs.map +1 -0
- package/fesm2022/3kles-kles-richtext-editor-toolbar-configuration-DsbPfSEO.mjs +337 -0
- package/fesm2022/3kles-kles-richtext-editor-toolbar-configuration-DsbPfSEO.mjs.map +1 -0
- package/fesm2022/3kles-kles-richtext-editor.mjs +239 -404
- 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 +120 -11
- package/types/3kles-kles-richtext-editor.d.ts.map +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
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 { 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";
|
|
2
4
|
import * as i0 from "@angular/core";
|
|
3
|
-
import {
|
|
5
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, PLATFORM_ID, ViewChild, booleanAttribute, computed, effect, forwardRef, inject, input, output, signal, untracked, viewChild } from "@angular/core";
|
|
4
6
|
import { NG_VALIDATORS, NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
5
|
-
import { compareTextPoints, createEmptyDocument, getNodeAtPath, getTextBlockText, isSupportedLinkDestination, resolveTextBlock, validateDocument } from "@3kles/richtext-core";
|
|
6
|
-
import { createEditor } from "@3kles/richtext-dom";
|
|
7
|
+
import { compareTextPoints, createEmptyDocument, getNodeAtPath, getTextBlockText, isSupportedLinkDestination, isTextStyleMarkType, normalizeTextStyleValue, resolveTextBlock, validateDocument } from "@3kles/richtext-core";
|
|
8
|
+
import { createEditor, selectedTextStyle } from "@3kles/richtext-dom";
|
|
7
9
|
import { importHtml } from "@3kles/richtext-formats";
|
|
8
10
|
const RICHTEXT_I18N = new InjectionToken("RICHTEXT_I18N", {
|
|
9
11
|
providedIn: "root",
|
|
@@ -18,103 +20,6 @@ function provideRichTextI18n(options) {
|
|
|
18
20
|
})
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
|
-
const RICHTEXT_MESSAGES_FR = Object.freeze({
|
|
22
|
-
editorLabel: "Contenu du document",
|
|
23
|
-
invalidDocument: "La valeur doit être un document 3KLES valide.",
|
|
24
|
-
requiredDocument: "Le document doit contenir du texte.",
|
|
25
|
-
validationError: "Le document comporte une erreur de validation.",
|
|
26
|
-
previewLabel: "Représentation JSON du document",
|
|
27
|
-
toolbarLabel: "Mise en forme du document",
|
|
28
|
-
toolbarFields: "Options de titre et de lien",
|
|
29
|
-
headingLevel: "Niveau",
|
|
30
|
-
headingLevelLabel: "Niveau du titre",
|
|
31
|
-
linkAddress: "Adresse du lien",
|
|
32
|
-
applyLink: "Appliquer le lien",
|
|
33
|
-
removeLink: "Retirer le lien",
|
|
34
|
-
invalidLink: "Saisissez une adresse HTTP, HTTPS, mailto ou une destination dynamique valide.",
|
|
35
|
-
actionUnavailable: "Cette action ne peut pas être appliquée à la sélection.",
|
|
36
|
-
undoDone: "Annulation effectuée.",
|
|
37
|
-
redoDone: "Rétablissement effectué.",
|
|
38
|
-
formatDone: "Mise en forme mise à jour.",
|
|
39
|
-
linkApplied: "Lien appliqué.",
|
|
40
|
-
linkNotApplied: "Le lien ne peut pas être appliqué à la sélection.",
|
|
41
|
-
linkRemoved: "Lien retiré.",
|
|
42
|
-
linkNotRemoved: "Le lien ne peut pas être retiré de la sélection.",
|
|
43
|
-
bold: "Gras",
|
|
44
|
-
italic: "Italique",
|
|
45
|
-
underline: "Souligné",
|
|
46
|
-
paragraph: "Paragraphe",
|
|
47
|
-
heading: "Titre",
|
|
48
|
-
strike: "Barré",
|
|
49
|
-
code: "Code en ligne",
|
|
50
|
-
bulletList: "Liste à puces",
|
|
51
|
-
orderedList: "Liste numérotée",
|
|
52
|
-
indent: "Indenter",
|
|
53
|
-
outdent: "Réduire le retrait",
|
|
54
|
-
blockquote: "Citation",
|
|
55
|
-
codeBlock: "Bloc de code",
|
|
56
|
-
clear: "Effacer la mise en forme",
|
|
57
|
-
undo: "Annuler",
|
|
58
|
-
redo: "Rétablir"
|
|
59
|
-
});
|
|
60
|
-
const RICHTEXT_MESSAGES_EN = Object.freeze({
|
|
61
|
-
editorLabel: "Document content",
|
|
62
|
-
invalidDocument: "The value must be a valid 3KLES document.",
|
|
63
|
-
requiredDocument: "The document must contain text.",
|
|
64
|
-
validationError: "The document has a validation error.",
|
|
65
|
-
previewLabel: "Document JSON representation",
|
|
66
|
-
toolbarLabel: "Document formatting",
|
|
67
|
-
toolbarFields: "Heading and link options",
|
|
68
|
-
headingLevel: "Level",
|
|
69
|
-
headingLevelLabel: "Heading level",
|
|
70
|
-
linkAddress: "Link address",
|
|
71
|
-
applyLink: "Apply link",
|
|
72
|
-
removeLink: "Remove link",
|
|
73
|
-
invalidLink: "Enter a valid HTTP, HTTPS, mailto, or dynamic link destination.",
|
|
74
|
-
actionUnavailable: "This action cannot be applied to the selection.",
|
|
75
|
-
undoDone: "Undo completed.",
|
|
76
|
-
redoDone: "Redo completed.",
|
|
77
|
-
formatDone: "Formatting updated.",
|
|
78
|
-
linkApplied: "Link applied.",
|
|
79
|
-
linkNotApplied: "The link cannot be applied to the selection.",
|
|
80
|
-
linkRemoved: "Link removed.",
|
|
81
|
-
linkNotRemoved: "The link cannot be removed from the selection.",
|
|
82
|
-
bold: "Bold",
|
|
83
|
-
italic: "Italic",
|
|
84
|
-
underline: "Underline",
|
|
85
|
-
paragraph: "Paragraph",
|
|
86
|
-
heading: "Heading",
|
|
87
|
-
strike: "Strikethrough",
|
|
88
|
-
code: "Inline code",
|
|
89
|
-
bulletList: "Bullet list",
|
|
90
|
-
orderedList: "Numbered list",
|
|
91
|
-
indent: "Indent",
|
|
92
|
-
outdent: "Outdent",
|
|
93
|
-
blockquote: "Blockquote",
|
|
94
|
-
codeBlock: "Code block",
|
|
95
|
-
clear: "Clear formatting",
|
|
96
|
-
undo: "Undo",
|
|
97
|
-
redo: "Redo"
|
|
98
|
-
});
|
|
99
|
-
function richTextLocale(locale) {
|
|
100
|
-
return locale?.trim().toLowerCase().split(/[-_]/u)[0] === "en" ? "en" : "fr";
|
|
101
|
-
}
|
|
102
|
-
function resolveRichTextMessages(locale, ...overrides) {
|
|
103
|
-
const messages = { ...richTextLocale(locale) === "en" ? RICHTEXT_MESSAGES_EN : RICHTEXT_MESSAGES_FR };
|
|
104
|
-
for (const override of overrides) {
|
|
105
|
-
if (!override) continue;
|
|
106
|
-
for (const [key, value] of Object.entries(override)) if (typeof value === "string" && value.trim().length > 0) Object.defineProperty(messages, key, {
|
|
107
|
-
value,
|
|
108
|
-
enumerable: true,
|
|
109
|
-
configurable: true,
|
|
110
|
-
writable: true
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return Object.freeze(messages);
|
|
114
|
-
}
|
|
115
|
-
function richTextLabel(value, fallback) {
|
|
116
|
-
return value?.trim() ? value : fallback;
|
|
117
|
-
}
|
|
118
23
|
var RichTextDocumentPreviewComponent = class RichTextDocumentPreviewComponent {
|
|
119
24
|
document = input.required(...ngDevMode ? [{ debugName: "document" }] : /* istanbul ignore next */ []);
|
|
120
25
|
labelOverride = input(void 0, {
|
|
@@ -232,38 +137,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
232
137
|
}
|
|
233
138
|
});
|
|
234
139
|
const RICHTEXT_EDITOR_EXTENSIONS = new InjectionToken("RICHTEXT_EDITOR_EXTENSIONS");
|
|
235
|
-
var RichTextAccessibilityIds = class RichTextAccessibilityIds {
|
|
236
|
-
appId = inject(APP_ID);
|
|
237
|
-
sequence = 0;
|
|
238
|
-
next(purpose) {
|
|
239
|
-
return `${this.appId}-kles-richtext-${purpose}-${++this.sequence}`;
|
|
240
|
-
}
|
|
241
|
-
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
242
|
-
minVersion: "12.0.0",
|
|
243
|
-
version: "22.2.6",
|
|
244
|
-
ngImport: i0,
|
|
245
|
-
type: RichTextAccessibilityIds,
|
|
246
|
-
deps: [],
|
|
247
|
-
target: i0.ɵɵFactoryTarget.Injectable
|
|
248
|
-
});
|
|
249
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
250
|
-
minVersion: "12.0.0",
|
|
251
|
-
version: "22.2.6",
|
|
252
|
-
ngImport: i0,
|
|
253
|
-
type: RichTextAccessibilityIds,
|
|
254
|
-
providedIn: "root"
|
|
255
|
-
});
|
|
256
|
-
};
|
|
257
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
258
|
-
minVersion: "12.0.0",
|
|
259
|
-
version: "22.2.6",
|
|
260
|
-
ngImport: i0,
|
|
261
|
-
type: RichTextAccessibilityIds,
|
|
262
|
-
decorators: [{
|
|
263
|
-
type: Injectable,
|
|
264
|
-
args: [{ providedIn: "root" }]
|
|
265
|
-
}]
|
|
266
|
-
});
|
|
267
140
|
const RICHTEXT_REQUIRED_ERROR = Object.freeze({ required: true });
|
|
268
141
|
function validateRichTextValue(value) {
|
|
269
142
|
return value === null ? {
|
|
@@ -1075,176 +948,6 @@ function provideRichTextToolbar(config) {
|
|
|
1075
948
|
useValue: config
|
|
1076
949
|
};
|
|
1077
950
|
}
|
|
1078
|
-
const TOOLBAR_ACTIONS = Object.freeze([
|
|
1079
|
-
{
|
|
1080
|
-
id: "bold",
|
|
1081
|
-
key: "bold",
|
|
1082
|
-
command: "bold",
|
|
1083
|
-
toggle: true
|
|
1084
|
-
},
|
|
1085
|
-
{
|
|
1086
|
-
id: "italic",
|
|
1087
|
-
key: "italic",
|
|
1088
|
-
command: "italic",
|
|
1089
|
-
toggle: true
|
|
1090
|
-
},
|
|
1091
|
-
{
|
|
1092
|
-
id: "underline",
|
|
1093
|
-
key: "underline",
|
|
1094
|
-
command: "underline",
|
|
1095
|
-
toggle: true
|
|
1096
|
-
},
|
|
1097
|
-
{
|
|
1098
|
-
id: "paragraph",
|
|
1099
|
-
key: "paragraph",
|
|
1100
|
-
command: "paragraph",
|
|
1101
|
-
toggle: true
|
|
1102
|
-
},
|
|
1103
|
-
{
|
|
1104
|
-
id: "heading",
|
|
1105
|
-
key: "heading",
|
|
1106
|
-
command: "heading",
|
|
1107
|
-
toggle: true
|
|
1108
|
-
},
|
|
1109
|
-
{
|
|
1110
|
-
id: "strike",
|
|
1111
|
-
key: "strike",
|
|
1112
|
-
command: "strike",
|
|
1113
|
-
toggle: true
|
|
1114
|
-
},
|
|
1115
|
-
{
|
|
1116
|
-
id: "code",
|
|
1117
|
-
key: "code",
|
|
1118
|
-
command: "code",
|
|
1119
|
-
toggle: true
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
id: "bulletList",
|
|
1123
|
-
key: "bulletList",
|
|
1124
|
-
command: "bulletList",
|
|
1125
|
-
toggle: true
|
|
1126
|
-
},
|
|
1127
|
-
{
|
|
1128
|
-
id: "orderedList",
|
|
1129
|
-
key: "orderedList",
|
|
1130
|
-
command: "orderedList",
|
|
1131
|
-
toggle: true
|
|
1132
|
-
},
|
|
1133
|
-
{
|
|
1134
|
-
id: "indent",
|
|
1135
|
-
key: "indent",
|
|
1136
|
-
command: Object.freeze({ type: "indentListItem" })
|
|
1137
|
-
},
|
|
1138
|
-
{
|
|
1139
|
-
id: "outdent",
|
|
1140
|
-
key: "outdent",
|
|
1141
|
-
command: Object.freeze({ type: "outdentListItem" })
|
|
1142
|
-
},
|
|
1143
|
-
{
|
|
1144
|
-
id: "blockquote",
|
|
1145
|
-
key: "blockquote",
|
|
1146
|
-
command: "blockquote",
|
|
1147
|
-
toggle: true
|
|
1148
|
-
},
|
|
1149
|
-
{
|
|
1150
|
-
id: "codeBlock",
|
|
1151
|
-
key: "codeBlock",
|
|
1152
|
-
command: "codeBlock",
|
|
1153
|
-
toggle: true
|
|
1154
|
-
},
|
|
1155
|
-
{
|
|
1156
|
-
id: "clear",
|
|
1157
|
-
key: "clear",
|
|
1158
|
-
command: Object.freeze({ type: "clearFormatting" })
|
|
1159
|
-
},
|
|
1160
|
-
{
|
|
1161
|
-
id: "undo",
|
|
1162
|
-
key: "undo",
|
|
1163
|
-
command: "undo"
|
|
1164
|
-
},
|
|
1165
|
-
{
|
|
1166
|
-
id: "redo",
|
|
1167
|
-
key: "redo",
|
|
1168
|
-
command: "redo"
|
|
1169
|
-
}
|
|
1170
|
-
]);
|
|
1171
|
-
const DEFAULT_RICHTEXT_TOOLBAR_ITEMS = Object.freeze([
|
|
1172
|
-
...TOOLBAR_ACTIONS.map(({ id }) => id),
|
|
1173
|
-
"headingLevel",
|
|
1174
|
-
"link"
|
|
1175
|
-
]);
|
|
1176
|
-
function resolveToolbarItems(items) {
|
|
1177
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1178
|
-
const resolved = [];
|
|
1179
|
-
for (const input of items) {
|
|
1180
|
-
const item = typeof input === "string" ? { id: input } : input;
|
|
1181
|
-
if (!item.id.trim()) throw new TypeError("Toolbar item IDs must be nonempty.");
|
|
1182
|
-
if (seen.has(item.id)) throw new TypeError(`Duplicate toolbar item ID: ${item.id}`);
|
|
1183
|
-
seen.add(item.id);
|
|
1184
|
-
if (item.visible === false) continue;
|
|
1185
|
-
if ("kind" in item && item.kind === "command") {
|
|
1186
|
-
if (TOOLBAR_ACTIONS.some((action) => action.id === item.id) || item.id === "headingLevel" || item.id === "link") throw new TypeError(`Custom toolbar item uses a reserved ID: ${item.id}`);
|
|
1187
|
-
if (!item.label.trim()) throw new TypeError("Custom toolbar commands need a nonempty label.");
|
|
1188
|
-
resolved.push(Object.freeze({
|
|
1189
|
-
...item,
|
|
1190
|
-
kind: "action",
|
|
1191
|
-
builtin: false,
|
|
1192
|
-
toggle: item.toggle ?? false
|
|
1193
|
-
}));
|
|
1194
|
-
} else if (item.id === "headingLevel" || item.id === "link") resolved.push(Object.freeze({
|
|
1195
|
-
...item,
|
|
1196
|
-
kind: "field",
|
|
1197
|
-
id: item.id
|
|
1198
|
-
}));
|
|
1199
|
-
else {
|
|
1200
|
-
const definition = TOOLBAR_ACTIONS.find((action) => action.id === item.id);
|
|
1201
|
-
if (!definition) throw new TypeError(`Unknown toolbar item ID: ${item.id}`);
|
|
1202
|
-
resolved.push(Object.freeze({
|
|
1203
|
-
...item,
|
|
1204
|
-
...definition,
|
|
1205
|
-
kind: "action",
|
|
1206
|
-
builtin: true,
|
|
1207
|
-
toggle: definition.toggle ?? false
|
|
1208
|
-
}));
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
return Object.freeze(resolved);
|
|
1212
|
-
}
|
|
1213
|
-
function toolbarActionQueries(items) {
|
|
1214
|
-
return items.filter((item) => item.kind === "action").map((item) => ({
|
|
1215
|
-
id: item.id,
|
|
1216
|
-
builtin: item.builtin,
|
|
1217
|
-
command: item.command,
|
|
1218
|
-
disabled: item.disabled ?? false,
|
|
1219
|
-
toggle: item.toggle
|
|
1220
|
-
}));
|
|
1221
|
-
}
|
|
1222
|
-
function sameToolbarActionQueries(left, right) {
|
|
1223
|
-
return left.length === right.length && left.every((item, index) => {
|
|
1224
|
-
const next = right[index];
|
|
1225
|
-
return next !== void 0 && item.id === next.id && item.builtin === next.builtin && item.command === next.command && item.disabled === next.disabled && item.toggle === next.toggle;
|
|
1226
|
-
});
|
|
1227
|
-
}
|
|
1228
|
-
function toolbarItemLabel(item, messages) {
|
|
1229
|
-
const override = item.labelKey !== void 0 && Object.hasOwn(messages, item.labelKey) ? messages[item.labelKey] : void 0;
|
|
1230
|
-
return (typeof override === "string" && override.trim() ? override : void 0) ?? (item.label?.trim() ? item.label : void 0) ?? (item.kind === "action" && item.key ? messages[item.key] : item.kind === "field" && item.id === "headingLevel" ? messages.headingLevel : messages.linkAddress);
|
|
1231
|
-
}
|
|
1232
|
-
function toolbarButtonContent(action, messages, preferIconOnly = false) {
|
|
1233
|
-
const label = toolbarItemLabel(action, messages);
|
|
1234
|
-
const ariaLabel = richTextLabel(action.ariaLabel, label);
|
|
1235
|
-
const icon = action.icon?.trim();
|
|
1236
|
-
if (!icon) return {
|
|
1237
|
-
label,
|
|
1238
|
-
ariaLabel
|
|
1239
|
-
};
|
|
1240
|
-
const iconType = action.iconType ?? (icon === "undo" || icon === "redo" ? "material" : "text");
|
|
1241
|
-
return {
|
|
1242
|
-
icon,
|
|
1243
|
-
iconType,
|
|
1244
|
-
label: preferIconOnly || action.label?.trim() === "" || iconType === "material" && action.label === void 0 && action.labelKey === void 0 ? "" : label,
|
|
1245
|
-
ariaLabel
|
|
1246
|
-
};
|
|
1247
|
-
}
|
|
1248
951
|
function nextToolbarItem(items, current, key) {
|
|
1249
952
|
const available = items.filter((item) => !item.disabled);
|
|
1250
953
|
if (key === "Home") return available[0]?.id;
|
|
@@ -1285,6 +988,46 @@ function toolbarLinkHref(snapshot) {
|
|
|
1285
988
|
function isToolbarHeadingLevel(level) {
|
|
1286
989
|
return level === 1 || level === 2 || level === 3 || level === 4 || level === 5 || level === 6;
|
|
1287
990
|
}
|
|
991
|
+
const STYLE_OPTIONS = {
|
|
992
|
+
fontFamily: [
|
|
993
|
+
"Arial",
|
|
994
|
+
"Calibri",
|
|
995
|
+
"Courier New",
|
|
996
|
+
"Georgia",
|
|
997
|
+
"Tahoma",
|
|
998
|
+
"Times New Roman",
|
|
999
|
+
"Verdana"
|
|
1000
|
+
],
|
|
1001
|
+
fontSize: [
|
|
1002
|
+
"8px",
|
|
1003
|
+
"10px",
|
|
1004
|
+
"12px",
|
|
1005
|
+
"14px",
|
|
1006
|
+
"16px",
|
|
1007
|
+
"18px",
|
|
1008
|
+
"20px",
|
|
1009
|
+
"24px",
|
|
1010
|
+
"28px",
|
|
1011
|
+
"32px",
|
|
1012
|
+
"36px",
|
|
1013
|
+
"48px",
|
|
1014
|
+
"72px"
|
|
1015
|
+
],
|
|
1016
|
+
lineHeight: [
|
|
1017
|
+
"1",
|
|
1018
|
+
"1.15",
|
|
1019
|
+
"1.25",
|
|
1020
|
+
"1.5",
|
|
1021
|
+
"1.75",
|
|
1022
|
+
"2",
|
|
1023
|
+
"2.5",
|
|
1024
|
+
"3"
|
|
1025
|
+
]
|
|
1026
|
+
};
|
|
1027
|
+
const COLOR_DEFAULTS = {
|
|
1028
|
+
color: "#000000",
|
|
1029
|
+
backgroundColor: "#ffff00"
|
|
1030
|
+
};
|
|
1288
1031
|
var RichTextToolbarComponent = class RichTextToolbarComponent {
|
|
1289
1032
|
editor = input.required(...ngDevMode ? [{ debugName: "editor" }] : /* istanbul ignore next */ []);
|
|
1290
1033
|
labelOverride = input(void 0, {
|
|
@@ -1324,11 +1067,52 @@ var RichTextToolbarComponent = class RichTextToolbarComponent {
|
|
|
1324
1067
|
iconOnly = computed(() => this.config()?.iconOnly ?? this.defaults.iconOnly ?? false, ...ngDevMode ? [{ debugName: "iconOnly" }] : /* istanbul ignore next */ []);
|
|
1325
1068
|
resolvedItems = computed(() => resolveToolbarItems(this.items() ?? this.config()?.items ?? this.defaults.items ?? DEFAULT_RICHTEXT_TOOLBAR_ITEMS), ...ngDevMode ? [{ debugName: "resolvedItems" }] : /* istanbul ignore next */ []);
|
|
1326
1069
|
hasItems = computed(() => this.resolvedItems().length > 0, ...ngDevMode ? [{ debugName: "hasItems" }] : /* istanbul ignore next */ []);
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
label
|
|
1331
|
-
|
|
1070
|
+
fieldsLabel = computed(() => this.resolvedItems().some((item) => item.kind === "field" && isTextStyleMarkType(item.id)) ? this.text().toolbarStyleFields : this.text().toolbarFields, ...ngDevMode ? [{ debugName: "fieldsLabel" }] : /* istanbul ignore next */ []);
|
|
1071
|
+
actions = computed(() => this.resolvedItems().filter((item) => item.kind !== "field"), ...ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []);
|
|
1072
|
+
fields = computed(() => this.resolvedItems().filter((item) => item.kind === "field").map((item) => {
|
|
1073
|
+
const label = toolbarItemLabel(item, this.text());
|
|
1074
|
+
if (!isTextStyleMarkType(item.id)) return {
|
|
1075
|
+
...item,
|
|
1076
|
+
id: item.id,
|
|
1077
|
+
label,
|
|
1078
|
+
control: "existing"
|
|
1079
|
+
};
|
|
1080
|
+
const state = this.editor().state();
|
|
1081
|
+
const value = state ? selectedTextStyle(state, item.id) : void 0;
|
|
1082
|
+
const disabled = item.disabled === true || this.stylesDisabled();
|
|
1083
|
+
if (item.id === "color" || item.id === "backgroundColor") return {
|
|
1084
|
+
...item,
|
|
1085
|
+
id: item.id,
|
|
1086
|
+
label,
|
|
1087
|
+
disabled,
|
|
1088
|
+
control: "color",
|
|
1089
|
+
value,
|
|
1090
|
+
fallback: COLOR_DEFAULTS[item.id]
|
|
1091
|
+
};
|
|
1092
|
+
const options = STYLE_OPTIONS[item.id];
|
|
1093
|
+
return {
|
|
1094
|
+
...item,
|
|
1095
|
+
id: item.id,
|
|
1096
|
+
label,
|
|
1097
|
+
disabled,
|
|
1098
|
+
value,
|
|
1099
|
+
control: "select",
|
|
1100
|
+
options: value && !options.includes(value) ? [value, ...options] : options
|
|
1101
|
+
};
|
|
1102
|
+
}), ...ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []);
|
|
1103
|
+
stylesDisabled = computed(() => {
|
|
1104
|
+
this.refreshKey();
|
|
1105
|
+
this.refreshVersion();
|
|
1106
|
+
const editor = this.editor();
|
|
1107
|
+
editor.state();
|
|
1108
|
+
return this.blocked() || !editor.can({
|
|
1109
|
+
type: "setMark",
|
|
1110
|
+
mark: {
|
|
1111
|
+
type: "fontSize",
|
|
1112
|
+
value: "16px"
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
}, ...ngDevMode ? [{ debugName: "stylesDisabled" }] : /* istanbul ignore next */ []);
|
|
1332
1116
|
queries = computed(() => toolbarActionQueries(this.resolvedItems()), {
|
|
1333
1117
|
...ngDevMode ? { debugName: "queries" } : /* istanbul ignore next */ {},
|
|
1334
1118
|
equal: sameToolbarActionQueries
|
|
@@ -1370,11 +1154,23 @@ var RichTextToolbarComponent = class RichTextToolbarComponent {
|
|
|
1370
1154
|
const messages = this.text();
|
|
1371
1155
|
const iconOnly = this.iconOnly();
|
|
1372
1156
|
return this.actions().flatMap((action) => {
|
|
1157
|
+
const content = toolbarButtonContent(action, messages, iconOnly);
|
|
1158
|
+
if (action.kind === "menu") {
|
|
1159
|
+
const disabled = action.disabled === true || this.blocked() || !action.groups.some(({ items }) => items.some((command) => !command.disabled));
|
|
1160
|
+
return [{
|
|
1161
|
+
...content,
|
|
1162
|
+
kind: "menu",
|
|
1163
|
+
id: action.id,
|
|
1164
|
+
disabled,
|
|
1165
|
+
menu: action
|
|
1166
|
+
}];
|
|
1167
|
+
}
|
|
1373
1168
|
const capability = capabilities.get(action.id);
|
|
1374
1169
|
if (!capability) return [];
|
|
1375
1170
|
return [{
|
|
1376
1171
|
...capability,
|
|
1377
|
-
...
|
|
1172
|
+
...content,
|
|
1173
|
+
kind: "command"
|
|
1378
1174
|
}];
|
|
1379
1175
|
});
|
|
1380
1176
|
}, ...ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []);
|
|
@@ -1500,8 +1296,21 @@ var RichTextToolbarComponent = class RichTextToolbarComponent {
|
|
|
1500
1296
|
this.statusKey.set(key);
|
|
1501
1297
|
this.status.set(this.text()[key]);
|
|
1502
1298
|
}
|
|
1503
|
-
|
|
1504
|
-
|
|
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
|
+
};
|
|
1505
1314
|
}
|
|
1506
1315
|
execute(button) {
|
|
1507
1316
|
if (button.disabled) return;
|
|
@@ -1509,11 +1318,33 @@ var RichTextToolbarComponent = class RichTextToolbarComponent {
|
|
|
1509
1318
|
const result = this.editor().execute(button.command);
|
|
1510
1319
|
this.announce(result && !result.ok ? "actionUnavailable" : button.id === "undo" ? "undoDone" : button.id === "redo" ? "redoDone" : "formatDone");
|
|
1511
1320
|
}
|
|
1321
|
+
executeMenuCommand(command) {
|
|
1322
|
+
if (this.blocked()) return;
|
|
1323
|
+
const result = this.editor().execute(command);
|
|
1324
|
+
this.announce(result?.ok ? "formatDone" : "actionUnavailable");
|
|
1325
|
+
}
|
|
1512
1326
|
changeHeadingLevel(event) {
|
|
1513
1327
|
if (!(event.target instanceof HTMLSelectElement)) return;
|
|
1514
1328
|
const level = Number(event.target.value);
|
|
1515
1329
|
if (isToolbarHeadingLevel(level)) this.headingLevel.set(level);
|
|
1516
1330
|
}
|
|
1331
|
+
changeStyle(markType, rawValue) {
|
|
1332
|
+
const configured = this.resolvedItems().find((item) => item.kind === "field" && item.id === markType);
|
|
1333
|
+
if (!configured || configured.disabled || this.stylesDisabled()) return;
|
|
1334
|
+
const value = normalizeTextStyleValue(markType, rawValue);
|
|
1335
|
+
if (rawValue && value === void 0) return;
|
|
1336
|
+
const result = this.editor().execute(value === void 0 ? {
|
|
1337
|
+
type: "unsetMark",
|
|
1338
|
+
markType
|
|
1339
|
+
} : {
|
|
1340
|
+
type: "setMark",
|
|
1341
|
+
mark: {
|
|
1342
|
+
type: markType,
|
|
1343
|
+
value
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
this.announce(result?.ok ? "formatDone" : "actionUnavailable");
|
|
1347
|
+
}
|
|
1517
1348
|
changeLink(value) {
|
|
1518
1349
|
this.linkDirty.set(true);
|
|
1519
1350
|
this.linkHref.set(value);
|
|
@@ -1546,7 +1377,7 @@ var RichTextToolbarComponent = class RichTextToolbarComponent {
|
|
|
1546
1377
|
if (id) this.currentAction.set(id);
|
|
1547
1378
|
}
|
|
1548
1379
|
navigate(event) {
|
|
1549
|
-
if (event.isComposing || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || !(event.target instanceof HTMLButtonElement)) return;
|
|
1380
|
+
if (event.isComposing || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || !(event.target instanceof HTMLButtonElement) || !event.target.hasAttribute("data-richtext-action")) return;
|
|
1550
1381
|
const key = event.key;
|
|
1551
1382
|
if (key !== "ArrowLeft" && key !== "ArrowRight" && key !== "Home" && key !== "End") return;
|
|
1552
1383
|
const id = nextToolbarItem(this.buttons(), event.target.getAttribute("data-richtext-action") ?? void 0, key);
|
|
@@ -1639,109 +1470,113 @@ var RichTextToolbarComponent = class RichTextToolbarComponent {
|
|
|
1639
1470
|
isSignal: true
|
|
1640
1471
|
}],
|
|
1641
1472
|
ngImport: i0,
|
|
1642
|
-
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
|
|
1643
|
-
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-
|
|
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"],
|
|
1644
1475
|
dependencies: [{
|
|
1645
|
-
kind: "
|
|
1646
|
-
type:
|
|
1647
|
-
selector: "
|
|
1648
|
-
inputs: [
|
|
1649
|
-
"ngTemplateOutletContext",
|
|
1650
|
-
"ngTemplateOutlet",
|
|
1651
|
-
"ngTemplateOutletInjector"
|
|
1652
|
-
]
|
|
1476
|
+
kind: "component",
|
|
1477
|
+
type: RichTextToolbarButtonComponent,
|
|
1478
|
+
selector: "kles-richtext-toolbar-button",
|
|
1479
|
+
inputs: ["control"]
|
|
1653
1480
|
}],
|
|
1654
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1481
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
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)]]
|
|
1655
1483
|
});
|
|
1656
1484
|
};
|
|
1657
|
-
i0.ɵɵ
|
|
1658
|
-
minVersion: "
|
|
1485
|
+
i0.ɵɵngDeclareClassMetadataAsync({
|
|
1486
|
+
minVersion: "18.0.0",
|
|
1659
1487
|
version: "22.2.6",
|
|
1660
1488
|
ngImport: i0,
|
|
1661
1489
|
type: RichTextToolbarComponent,
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
standalone: true,
|
|
1667
|
-
imports: [NgTemplateOutlet],
|
|
1668
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1669
|
-
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 <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 </div>\n }\n @if (fields().length) {\n <div class=\"kles-richtext-toolbar__fields\" role=\"group\" [attr.aria-label]=\"text().toolbarFields\">\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 {\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 }\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",
|
|
1670
|
-
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 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 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"]
|
|
1671
|
-
}]
|
|
1672
|
-
}],
|
|
1673
|
-
ctorParameters: () => [],
|
|
1674
|
-
propDecorators: {
|
|
1675
|
-
editor: [{
|
|
1676
|
-
type: i0.Input,
|
|
1677
|
-
args: [{
|
|
1678
|
-
isSignal: true,
|
|
1679
|
-
alias: "editor",
|
|
1680
|
-
required: true
|
|
1681
|
-
}]
|
|
1682
|
-
}],
|
|
1683
|
-
labelOverride: [{
|
|
1684
|
-
type: i0.Input,
|
|
1685
|
-
args: [{
|
|
1686
|
-
isSignal: true,
|
|
1687
|
-
alias: "label",
|
|
1688
|
-
required: false
|
|
1689
|
-
}]
|
|
1690
|
-
}],
|
|
1691
|
-
locale: [{
|
|
1692
|
-
type: i0.Input,
|
|
1693
|
-
args: [{
|
|
1694
|
-
isSignal: true,
|
|
1695
|
-
alias: "locale",
|
|
1696
|
-
required: false
|
|
1697
|
-
}]
|
|
1698
|
-
}],
|
|
1699
|
-
messages: [{
|
|
1700
|
-
type: i0.Input,
|
|
1701
|
-
args: [{
|
|
1702
|
-
isSignal: true,
|
|
1703
|
-
alias: "messages",
|
|
1704
|
-
required: false
|
|
1705
|
-
}]
|
|
1706
|
-
}],
|
|
1707
|
-
config: [{
|
|
1708
|
-
type: i0.Input,
|
|
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) => ({
|
|
1492
|
+
decorators: [{
|
|
1493
|
+
type: Component,
|
|
1709
1494
|
args: [{
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
required: false
|
|
1721
|
-
}]
|
|
1722
|
-
}],
|
|
1723
|
-
buttonTemplate: [{
|
|
1724
|
-
type: i0.Input,
|
|
1725
|
-
args: [{
|
|
1726
|
-
isSignal: true,
|
|
1727
|
-
alias: "buttonTemplate",
|
|
1728
|
-
required: false
|
|
1495
|
+
selector: "kles-richtext-toolbar",
|
|
1496
|
+
standalone: true,
|
|
1497
|
+
imports: [
|
|
1498
|
+
RichTextToolbarButtonComponent,
|
|
1499
|
+
RichTextToolbarFieldsComponent,
|
|
1500
|
+
RichTextToolbarMenuComponent
|
|
1501
|
+
],
|
|
1502
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
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"]
|
|
1729
1505
|
}]
|
|
1730
1506
|
}],
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1507
|
+
ctorParameters: () => [],
|
|
1508
|
+
propDecorators: {
|
|
1509
|
+
editor: [{
|
|
1510
|
+
type: i0.Input,
|
|
1511
|
+
args: [{
|
|
1512
|
+
isSignal: true,
|
|
1513
|
+
alias: "editor",
|
|
1514
|
+
required: true
|
|
1515
|
+
}]
|
|
1516
|
+
}],
|
|
1517
|
+
labelOverride: [{
|
|
1518
|
+
type: i0.Input,
|
|
1519
|
+
args: [{
|
|
1520
|
+
isSignal: true,
|
|
1521
|
+
alias: "label",
|
|
1522
|
+
required: false
|
|
1523
|
+
}]
|
|
1524
|
+
}],
|
|
1525
|
+
locale: [{
|
|
1526
|
+
type: i0.Input,
|
|
1527
|
+
args: [{
|
|
1528
|
+
isSignal: true,
|
|
1529
|
+
alias: "locale",
|
|
1530
|
+
required: false
|
|
1531
|
+
}]
|
|
1532
|
+
}],
|
|
1533
|
+
messages: [{
|
|
1534
|
+
type: i0.Input,
|
|
1535
|
+
args: [{
|
|
1536
|
+
isSignal: true,
|
|
1537
|
+
alias: "messages",
|
|
1538
|
+
required: false
|
|
1539
|
+
}]
|
|
1540
|
+
}],
|
|
1541
|
+
config: [{
|
|
1542
|
+
type: i0.Input,
|
|
1543
|
+
args: [{
|
|
1544
|
+
isSignal: true,
|
|
1545
|
+
alias: "config",
|
|
1546
|
+
required: false
|
|
1547
|
+
}]
|
|
1548
|
+
}],
|
|
1549
|
+
items: [{
|
|
1550
|
+
type: i0.Input,
|
|
1551
|
+
args: [{
|
|
1552
|
+
isSignal: true,
|
|
1553
|
+
alias: "items",
|
|
1554
|
+
required: false
|
|
1555
|
+
}]
|
|
1556
|
+
}],
|
|
1557
|
+
buttonTemplate: [{
|
|
1558
|
+
type: i0.Input,
|
|
1559
|
+
args: [{
|
|
1560
|
+
isSignal: true,
|
|
1561
|
+
alias: "buttonTemplate",
|
|
1562
|
+
required: false
|
|
1563
|
+
}]
|
|
1564
|
+
}],
|
|
1565
|
+
refreshKey: [{
|
|
1566
|
+
type: i0.Input,
|
|
1567
|
+
args: [{
|
|
1568
|
+
isSignal: true,
|
|
1569
|
+
alias: "refreshKey",
|
|
1570
|
+
required: false
|
|
1571
|
+
}]
|
|
1572
|
+
}],
|
|
1573
|
+
commands: [{
|
|
1574
|
+
type: i0.ViewChild,
|
|
1575
|
+
args: ["commands", { isSignal: true }]
|
|
1737
1576
|
}]
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
type: i0.ViewChild,
|
|
1741
|
-
args: ["commands", { isSignal: true }]
|
|
1742
|
-
}]
|
|
1743
|
-
}
|
|
1577
|
+
}
|
|
1578
|
+
})
|
|
1744
1579
|
});
|
|
1745
|
-
export { DEFAULT_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 };
|
|
1746
1581
|
|
|
1747
1582
|
//# sourceMappingURL=3kles-kles-richtext-editor.mjs.map
|