@tectra-ng/editor 0.0.1 → 0.1.5

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,776 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, ViewEncapsulation, afterRenderEffect, booleanAttribute, computed, inject, input, output, signal, viewChild } from "@angular/core";
3
+ import { DomSanitizer } from "@angular/platform-browser";
4
+ import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
5
+ import { injectTranslations } from "@tectra-ng/core/i18n";
6
+ import { TxStyleLoader } from "@tectra-ng/core/styles";
7
+ import { optionalBoolean } from "@tectra-ng/core/utils";
8
+ import { toStyleObject } from "@tectra-ng/themes";
9
+ import { TxDialog } from "@tectra-ng/ui/dialog";
10
+ const QUILL_SIZES = {
11
+ small: "0.75em",
12
+ large: "1.5em",
13
+ huge: "2.5em"
14
+ };
15
+ const QUILL_FONTS = {
16
+ serif: "serif",
17
+ monospace: "monospace"
18
+ };
19
+ const INDENT_STEP_EM = 3;
20
+ const ALIGNMENTS = [
21
+ "left",
22
+ "center",
23
+ "right",
24
+ "justify"
25
+ ];
26
+ const QUILL_MARKERS = /data-list=|class="[^"]*\bql-|ql-code-block|ql-video/;
27
+ function parse(html) {
28
+ const Parser = globalThis.DOMParser;
29
+ return Parser ? new Parser().parseFromString(`<body>${html}</body>`, "text/html").body : null;
30
+ }
31
+ function classValue(element, prefix) {
32
+ const match = Array.from(element.classList).find((name) => name.startsWith(prefix));
33
+ if (!match) return null;
34
+ element.classList.remove(match);
35
+ return match.slice(prefix.length);
36
+ }
37
+ function cleanClassAttribute(element) {
38
+ if (element.getAttribute("class") === "") element.removeAttribute("class");
39
+ }
40
+ function styleOf(element) {
41
+ return element.style ?? null;
42
+ }
43
+ function indentLevel(element) {
44
+ const value = Number(element.getAttribute("data-indent") ?? NaN);
45
+ if (!Number.isNaN(value)) return value;
46
+ const margin = styleOf(element)?.marginLeft ?? "";
47
+ return margin.endsWith("em") ? Math.round(parseFloat(margin) / INDENT_STEP_EM) : 0;
48
+ }
49
+ function quillListKind(item, list) {
50
+ const data = item.getAttribute("data-list");
51
+ if (data === "bullet" || data === "ordered" || data === "checked" || data === "unchecked") return data;
52
+ return list.tagName === "UL" ? "bullet" : "ordered";
53
+ }
54
+ function createList(document, kind) {
55
+ const list = document.createElement(kind === "ordered" ? "ol" : "ul");
56
+ if (kind === "checked" || kind === "unchecked") list.setAttribute("data-type", "taskList");
57
+ return list;
58
+ }
59
+ function sameListKind(a, b) {
60
+ const task = (kind) => kind === "checked" || kind === "unchecked";
61
+ return a === b || task(a) && task(b);
62
+ }
63
+ function convertQuillList(list) {
64
+ const document = list.ownerDocument;
65
+ const items = Array.from(list.children).filter((child) => child.tagName === "LI");
66
+ const fragment = document.createDocumentFragment();
67
+ const stack = [];
68
+ for (const item of items) {
69
+ const kind = quillListKind(item, list);
70
+ const level = Number(classValue(item, "ql-indent-") ?? 0);
71
+ while (stack.length && stack[stack.length - 1].level > level) stack.pop();
72
+ const top = stack[stack.length - 1];
73
+ if (top && top.level === level && !sameListKind(top.kind, kind)) stack.pop();
74
+ if (!stack.length || stack[stack.length - 1].level < level) {
75
+ const element = createList(document, kind);
76
+ const parent = stack[stack.length - 1];
77
+ if (parent) (parent.element.lastElementChild ?? parent.element.appendChild(document.createElement("li"))).appendChild(element);
78
+ else fragment.appendChild(element);
79
+ stack.push({
80
+ level,
81
+ kind,
82
+ element
83
+ });
84
+ }
85
+ const current = stack[stack.length - 1];
86
+ const next = document.createElement("li");
87
+ const paragraph = document.createElement("p");
88
+ const align = classValue(item, "ql-align-");
89
+ if (align && ALIGNMENTS.includes(align)) paragraph.style.textAlign = align;
90
+ item.querySelectorAll(".ql-ui").forEach((node) => node.remove());
91
+ paragraph.append(...Array.from(item.childNodes));
92
+ if (kind === "checked" || kind === "unchecked") {
93
+ next.setAttribute("data-type", "taskItem");
94
+ next.setAttribute("data-checked", String(kind === "checked"));
95
+ }
96
+ next.appendChild(paragraph);
97
+ current.element.appendChild(next);
98
+ }
99
+ list.replaceWith(fragment);
100
+ }
101
+ function convertQuillCode(container) {
102
+ const document = container.ownerDocument;
103
+ const lines = Array.from(container.querySelectorAll(".ql-code-block"));
104
+ const pre = document.createElement("pre");
105
+ const code = document.createElement("code");
106
+ const language = lines[0]?.getAttribute("data-language");
107
+ if (language && language !== "plain") code.className = `language-${language}`;
108
+ code.textContent = lines.map((line) => line.textContent ?? "").join("\n");
109
+ pre.appendChild(code);
110
+ container.replaceWith(pre);
111
+ }
112
+ function isQuillHtml(html) {
113
+ return !!html && QUILL_MARKERS.test(html);
114
+ }
115
+ function fromQuillHtml(html) {
116
+ if (!html) return "";
117
+ if (!isQuillHtml(html)) return html;
118
+ const body = parse(html);
119
+ if (!body) return html;
120
+ body.querySelectorAll(".ql-cursor, .ql-ui").forEach((node) => node.remove());
121
+ body.querySelectorAll(".ql-code-block-container").forEach(convertQuillCode);
122
+ body.querySelectorAll("pre.ql-syntax").forEach((pre) => {
123
+ const code = body.ownerDocument.createElement("code");
124
+ code.textContent = pre.textContent ?? "";
125
+ pre.replaceChildren(code);
126
+ pre.classList.remove("ql-syntax");
127
+ cleanClassAttribute(pre);
128
+ });
129
+ Array.from(body.querySelectorAll("ol, ul")).filter((list) => Array.from(list.children).some((item) => item.hasAttribute("data-list") || /\bql-indent-/.test(item.className))).filter((list) => !list.parentElement?.closest("ol, ul")).forEach(convertQuillList);
130
+ body.querySelectorAll("[class*=\"ql-\"]").forEach((element) => {
131
+ const style = styleOf(element);
132
+ const align = classValue(element, "ql-align-");
133
+ if (align && ALIGNMENTS.includes(align) && style) style.textAlign = align;
134
+ const indent = Number(classValue(element, "ql-indent-") ?? 0);
135
+ if (indent > 0 && style) {
136
+ element.setAttribute("data-indent", String(indent));
137
+ style.marginLeft = `${indent * INDENT_STEP_EM}em`;
138
+ }
139
+ const size = classValue(element, "ql-size-");
140
+ if (size && QUILL_SIZES[size] && style) style.fontSize = QUILL_SIZES[size];
141
+ const font = classValue(element, "ql-font-");
142
+ if (font && QUILL_FONTS[font] && style) style.fontFamily = QUILL_FONTS[font];
143
+ if (classValue(element, "ql-direction-") === "rtl") element.setAttribute("dir", "rtl");
144
+ if (element.tagName === "IFRAME" && element.classList.contains("ql-video")) {
145
+ element.classList.remove("ql-video");
146
+ element.setAttribute("data-type", "video");
147
+ }
148
+ cleanClassAttribute(element);
149
+ });
150
+ return body.innerHTML;
151
+ }
152
+ function flattenList(list, level, out) {
153
+ const document = list.ownerDocument;
154
+ const task = list.getAttribute("data-type") === "taskList";
155
+ for (const item of Array.from(list.children).filter((child) => child.tagName === "LI")) {
156
+ const kind = task ? item.getAttribute("data-checked") === "true" ? "checked" : "unchecked" : list.tagName === "OL" ? "ordered" : "bullet";
157
+ const next = document.createElement("li");
158
+ next.setAttribute("data-list", kind);
159
+ if (level > 0) next.classList.add(`ql-indent-${level}`);
160
+ const nested = [];
161
+ const blocks = task ? Array.from(item.querySelector(":scope > div")?.children ?? item.children) : Array.from(item.children);
162
+ const inline = [];
163
+ for (const child of blocks) if (child.tagName === "UL" || child.tagName === "OL") nested.push(child);
164
+ else if (child.tagName === "LABEL") continue;
165
+ else {
166
+ const align = styleOf(child)?.textAlign;
167
+ if (align && ALIGNMENTS.includes(align) && align !== "left") next.classList.add(`ql-align-${align}`);
168
+ if (inline.length) inline.push(document.createElement("br"));
169
+ inline.push(...Array.from(child.childNodes));
170
+ }
171
+ next.append(...inline);
172
+ out.appendChild(next);
173
+ nested.forEach((child) => flattenList(child, level + 1, out));
174
+ }
175
+ }
176
+ function toQuillHtml(html) {
177
+ if (!html) return "";
178
+ const body = parse(html);
179
+ if (!body) return html;
180
+ const document = body.ownerDocument;
181
+ const topLists = Array.from(body.querySelectorAll("ol, ul")).filter((list) => !list.parentElement?.closest("ol, ul"));
182
+ let previous = null;
183
+ for (const list of topLists) {
184
+ const target = previous && previous.nextSibling === list ? previous : document.createElement("ol");
185
+ flattenList(list, 0, target);
186
+ if (target === previous) list.remove();
187
+ else list.replaceWith(target);
188
+ previous = target;
189
+ }
190
+ body.querySelectorAll("pre").forEach((pre) => {
191
+ const code = pre.querySelector("code");
192
+ const language = Array.from(code?.classList ?? []).find((name) => name.startsWith("language-"))?.slice(9) ?? "plain";
193
+ const container = document.createElement("div");
194
+ container.className = "ql-code-block-container";
195
+ container.setAttribute("spellcheck", "false");
196
+ for (const line of (code?.textContent ?? pre.textContent ?? "").split("\n")) {
197
+ const block = document.createElement("div");
198
+ block.className = "ql-code-block";
199
+ block.setAttribute("data-language", language);
200
+ block.textContent = line;
201
+ if (!line) block.appendChild(document.createElement("br"));
202
+ container.appendChild(block);
203
+ }
204
+ pre.replaceWith(container);
205
+ });
206
+ body.querySelectorAll("[style], [data-indent], [dir], iframe[data-type=\"video\"]").forEach((element) => {
207
+ const style = styleOf(element);
208
+ if (style?.textAlign && ALIGNMENTS.includes(style.textAlign)) {
209
+ if (style.textAlign !== "left") element.classList.add(`ql-align-${style.textAlign}`);
210
+ style.removeProperty("text-align");
211
+ }
212
+ const indent = indentLevel(element);
213
+ if (indent > 0) element.classList.add(`ql-indent-${indent}`);
214
+ element.removeAttribute("data-indent");
215
+ style?.removeProperty("margin-left");
216
+ const size = Object.entries(QUILL_SIZES).find(([, value]) => value === style?.fontSize)?.[0];
217
+ if (size) {
218
+ element.classList.add(`ql-size-${size}`);
219
+ style?.removeProperty("font-size");
220
+ }
221
+ const font = Object.entries(QUILL_FONTS).find(([, value]) => value === style?.fontFamily)?.[0];
222
+ if (font) {
223
+ element.classList.add(`ql-font-${font}`);
224
+ style?.removeProperty("font-family");
225
+ }
226
+ if (element.getAttribute("dir") === "rtl") {
227
+ element.classList.add("ql-direction-rtl");
228
+ element.removeAttribute("dir");
229
+ }
230
+ if (element.tagName === "IFRAME") {
231
+ element.removeAttribute("data-type");
232
+ element.classList.add("ql-video");
233
+ element.setAttribute("frameborder", "0");
234
+ element.setAttribute("allowfullscreen", "true");
235
+ }
236
+ if (element.getAttribute("style") === "") element.removeAttribute("style");
237
+ });
238
+ body.querySelectorAll("p:empty, h1:empty, h2:empty, h3:empty, h4:empty, h5:empty, h6:empty").forEach((block) => block.appendChild(document.createElement("br")));
239
+ return body.innerHTML;
240
+ }
241
+ function toEditorHtml(html) {
242
+ return fromQuillHtml(html);
243
+ }
244
+ function formatEditorHtml(html, format) {
245
+ return format === "quill" ? toQuillHtml(html) : html;
246
+ }
247
+ const ALLOWED_TAGS = /* @__PURE__ */ new Set([
248
+ "p",
249
+ "br",
250
+ "h1",
251
+ "h2",
252
+ "h3",
253
+ "h4",
254
+ "h5",
255
+ "h6",
256
+ "strong",
257
+ "b",
258
+ "em",
259
+ "i",
260
+ "u",
261
+ "s",
262
+ "strike",
263
+ "del",
264
+ "code",
265
+ "pre",
266
+ "blockquote",
267
+ "ul",
268
+ "ol",
269
+ "li",
270
+ "a",
271
+ "img",
272
+ "span",
273
+ "sub",
274
+ "sup",
275
+ "hr",
276
+ "mark",
277
+ "div",
278
+ "label",
279
+ "input",
280
+ "table",
281
+ "thead",
282
+ "tbody",
283
+ "tfoot",
284
+ "tr",
285
+ "th",
286
+ "td",
287
+ "colgroup",
288
+ "col",
289
+ "iframe"
290
+ ]);
291
+ const DROP_WITH_CONTENT = /* @__PURE__ */ new Set([
292
+ "script",
293
+ "style",
294
+ "template",
295
+ "noscript",
296
+ "object",
297
+ "embed",
298
+ "svg",
299
+ "math",
300
+ "textarea",
301
+ "select",
302
+ "button",
303
+ "form"
304
+ ]);
305
+ const ALLOWED_ATTRIBUTES = /* @__PURE__ */ new Set([
306
+ "class",
307
+ "style",
308
+ "href",
309
+ "target",
310
+ "rel",
311
+ "src",
312
+ "alt",
313
+ "title",
314
+ "width",
315
+ "height",
316
+ "colspan",
317
+ "rowspan",
318
+ "start",
319
+ "dir",
320
+ "data-list",
321
+ "data-type",
322
+ "data-checked",
323
+ "data-indent",
324
+ "data-language",
325
+ "data-id",
326
+ "data-label",
327
+ "data-mention-suggestion-char",
328
+ "colwidth",
329
+ "data-colwidth",
330
+ "data-tone",
331
+ "type",
332
+ "checked",
333
+ "disabled",
334
+ "frameborder",
335
+ "allowfullscreen",
336
+ "spellcheck"
337
+ ]);
338
+ const ALLOWED_STYLES = /* @__PURE__ */ new Set([
339
+ "color",
340
+ "background-color",
341
+ "text-align",
342
+ "font-size",
343
+ "font-family",
344
+ "margin-left",
345
+ "padding-left",
346
+ "width",
347
+ "min-width"
348
+ ]);
349
+ const SAFE_STYLE_VALUE = /^[#(),.%\w\s'"-]+$/;
350
+ const SAFE_CLASS = /^(ql-[\w-]+|tx-[\w-]+|language-[\w-]+)$/;
351
+ const SAFE_LINK = /^(https?:|mailto:|tel:|sms:|#|\/(?!\/))/i;
352
+ const SAFE_IMAGE = /^(https?:|data:image\/(png|jpe?g|gif|webp|avif|bmp|svg\+xml);base64,|blob:|\/(?!\/))/i;
353
+ const SAFE_FRAME = /^https:\/\//i;
354
+ function cleanStyle(value) {
355
+ return value.split(";").map((declaration) => declaration.split(":")).filter(([property, ...rest]) => property && rest.length).map(([property, ...rest]) => [property.trim().toLowerCase(), rest.join(":").trim()]).filter(([property, propertyValue]) => ALLOWED_STYLES.has(property) && SAFE_STYLE_VALUE.test(propertyValue) && !/url\s*\(|expression\s*\(/i.test(propertyValue)).map(([property, propertyValue]) => `${property}: ${propertyValue}`).join("; ");
356
+ }
357
+ function cleanAttribute(element, name, value) {
358
+ const tag = element.tagName.toLowerCase();
359
+ switch (name) {
360
+ case "style": return cleanStyle(value) || null;
361
+ case "class": {
362
+ const classes = value.split(/\s+/).filter((item) => SAFE_CLASS.test(item));
363
+ return classes.length ? classes.join(" ") : null;
364
+ }
365
+ case "href": return tag === "a" && SAFE_LINK.test(value.trim()) ? value.trim() : null;
366
+ case "src":
367
+ if (tag === "img") return SAFE_IMAGE.test(value.trim()) ? value.trim() : null;
368
+ return tag === "iframe" && SAFE_FRAME.test(value.trim()) ? value.trim() : null;
369
+ case "target": return value === "_blank" ? value : null;
370
+ case "type": return tag === "input" && value === "checkbox" ? value : null;
371
+ default: return value;
372
+ }
373
+ }
374
+ function cleanNode(node) {
375
+ for (const child of Array.from(node.childNodes)) {
376
+ if (child.nodeType === 3) continue;
377
+ if (child.nodeType !== 1) {
378
+ child.remove();
379
+ continue;
380
+ }
381
+ const element = child;
382
+ const tag = element.tagName.toLowerCase();
383
+ if (DROP_WITH_CONTENT.has(tag)) {
384
+ element.remove();
385
+ continue;
386
+ }
387
+ if (!ALLOWED_TAGS.has(tag)) {
388
+ cleanNode(element);
389
+ element.replaceWith(...Array.from(element.childNodes));
390
+ continue;
391
+ }
392
+ for (const attribute of Array.from(element.attributes)) {
393
+ const name = attribute.name.toLowerCase();
394
+ const cleaned = ALLOWED_ATTRIBUTES.has(name) ? cleanAttribute(element, name, attribute.value) : null;
395
+ if (cleaned === null) element.removeAttribute(attribute.name);
396
+ else if (cleaned !== attribute.value) element.setAttribute(attribute.name, cleaned);
397
+ }
398
+ if (tag === "a" && element.getAttribute("target") === "_blank") element.setAttribute("rel", "noopener noreferrer nofollow");
399
+ if (tag === "input") element.setAttribute("disabled", "");
400
+ if (tag === "iframe") {
401
+ if (!element.getAttribute("src")) {
402
+ element.remove();
403
+ continue;
404
+ }
405
+ element.setAttribute("sandbox", "allow-scripts allow-same-origin allow-presentation allow-popups");
406
+ element.setAttribute("loading", "lazy");
407
+ }
408
+ cleanNode(element);
409
+ }
410
+ }
411
+ function sanitizeEditorHtml(html) {
412
+ if (!html) return "";
413
+ const Parser = globalThis.DOMParser;
414
+ if (!Parser) return "";
415
+ const body = new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
416
+ cleanNode(body);
417
+ return body.innerHTML;
418
+ }
419
+ var TxEditorProseStyles = class TxEditorProseStyles {
420
+ static ɵfac = i0.ɵɵngDeclareFactory({
421
+ minVersion: "12.0.0",
422
+ version: "22.2.3",
423
+ ngImport: i0,
424
+ type: TxEditorProseStyles,
425
+ deps: [],
426
+ target: i0.ɵɵFactoryTarget.Component
427
+ });
428
+ static ɵcmp = i0.ɵɵngDeclareComponent({
429
+ minVersion: "14.0.0",
430
+ version: "22.2.3",
431
+ type: TxEditorProseStyles,
432
+ isStandalone: true,
433
+ selector: "tx-editor-prose-styles",
434
+ ngImport: i0,
435
+ template: "",
436
+ isInline: true,
437
+ styles: ["@charset \"UTF-8\";.tx-editor-prose{--_gap: var(--tx-editor-content-block-gap);--_paragraph-gap: var(--tx-editor-content-paragraph-gap);color:var(--tx-editor-content-color);font-family:var(--tx-font-family);font-size:var(--tx-editor-content-font-size);line-height:var(--tx-editor-content-line-height);overflow-wrap:break-word}.tx-editor-prose>:first-child{margin-top:0}.tx-editor-prose>:last-child{margin-bottom:0}.tx-editor-prose p,.tx-editor-prose ul,.tx-editor-prose ol,.tx-editor-prose blockquote{margin:0 0 var(--_paragraph-gap)}.tx-editor-prose pre,.tx-editor-prose table,.tx-editor-prose figure,.tx-editor-prose img,.tx-editor-prose iframe{margin-block:var(--_gap)}.tx-editor-prose h1,.tx-editor-prose h2,.tx-editor-prose h3,.tx-editor-prose h4,.tx-editor-prose h5,.tx-editor-prose h6{margin:var(--tx-editor-content-heading-space-before) 0 var(--tx-editor-content-heading-space-after);font-weight:var(--tx-editor-content-heading-font-weight);letter-spacing:-.01em;line-height:var(--tx-editor-content-heading-line-height)}.tx-editor-prose h1{font-size:var(--tx-editor-content-heading-h1-size);letter-spacing:-.02em}.tx-editor-prose h2{font-size:var(--tx-editor-content-heading-h2-size)}.tx-editor-prose h3{font-size:var(--tx-editor-content-heading-h3-size)}.tx-editor-prose h4{font-size:var(--tx-editor-content-heading-h4-size)}.tx-editor-prose h5{font-size:var(--tx-editor-content-heading-h5-size)}.tx-editor-prose h6{color:var(--tx-editor-content-heading-h6-color);font-size:var(--tx-editor-content-heading-h6-size);letter-spacing:.02em;text-transform:uppercase}.tx-editor-prose a{color:var(--tx-editor-content-link-color);text-decoration:underline;text-decoration-color:var(--tx-editor-content-link-underline-color);text-decoration-thickness:1px;text-underline-offset:.2em;cursor:pointer;transition:text-decoration-color var(--tx-motion-duration) var(--tx-motion-easing)}.tx-editor-prose a:hover{text-decoration-color:var(--tx-editor-content-link-hover-underline-color)}.tx-editor-prose ul,.tx-editor-prose ol{padding-left:var(--tx-editor-content-list-indent)}.tx-editor-prose ul ul,.tx-editor-prose ul ol,.tx-editor-prose ol ul,.tx-editor-prose ol ol{margin:var(--tx-editor-content-list-item-gap) 0 0}.tx-editor-prose ul{list-style:disc}.tx-editor-prose ul ul{list-style:circle}.tx-editor-prose ul ul ul{list-style:square}.tx-editor-prose ol{list-style:decimal}.tx-editor-prose ol ol{list-style:lower-alpha}.tx-editor-prose ol ol ol{list-style:lower-roman}.tx-editor-prose li{margin:0}.tx-editor-prose li+li{margin-top:var(--tx-editor-content-list-item-gap)}.tx-editor-prose li>p{margin:0}.tx-editor-prose li::marker{color:var(--tx-editor-content-list-marker-color)}.tx-editor-prose ul[data-type=taskList]{padding-left:0;list-style:none}.tx-editor-prose ul[data-type=taskList] li{display:flex;align-items:flex-start;gap:var(--tx-editor-content-task-gap)}.tx-editor-prose ul[data-type=taskList] li>label{display:inline-flex;flex-shrink:0;align-items:center;height:calc(1em * var(--tx-editor-content-line-height));margin:0;-webkit-user-select:none;user-select:none}.tx-editor-prose ul[data-type=taskList] li>div{flex:1 1 auto;min-width:0}.tx-editor-prose ul[data-type=taskList] li[data-checked=true]>div{color:var(--tx-editor-content-task-done-color);text-decoration:line-through;text-decoration-color:var(--tx-editor-content-task-done-color)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]{display:grid;place-content:center;width:var(--tx-editor-content-task-size);height:var(--tx-editor-content-task-size);margin:0;border:1.5px solid var(--tx-editor-content-task-border-color);border-radius:var(--tx-editor-content-task-border-radius);background:transparent;cursor:pointer;appearance:none;transition:background-color var(--tx-motion-duration) var(--tx-motion-easing),border-color var(--tx-motion-duration) var(--tx-motion-easing)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]:after{width:4px;height:8px;margin-top:-2px;border:solid var(--tx-editor-content-task-checked-color);border-width:0 2px 2px 0;content:\"\";opacity:0;transform:rotate(45deg) scale(.6);transition:opacity var(--tx-motion-duration) var(--tx-motion-easing),transform var(--tx-motion-duration) var(--tx-motion-easing)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]:checked{border-color:var(--tx-editor-content-task-checked-background);background:var(--tx-editor-content-task-checked-background)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]:checked:after{opacity:1;transform:rotate(45deg) scale(1)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]:disabled{cursor:default}.tx-editor-prose blockquote{padding:var(--tx-editor-content-quote-padding);border-left:var(--tx-editor-content-quote-border-width) solid var(--tx-editor-content-quote-border-color);color:var(--tx-editor-content-quote-color)}.tx-editor-prose blockquote>:last-child{margin-bottom:0}.tx-editor-prose code{padding:var(--tx-editor-content-code-padding);border-radius:var(--tx-editor-content-code-border-radius);background:var(--tx-editor-content-code-background);color:var(--tx-editor-content-code-color);font-family:var(--tx-editor-content-code-font-family);font-size:var(--tx-editor-content-code-font-size);-webkit-box-decoration-break:clone;box-decoration-break:clone}.tx-editor-prose pre{overflow-x:auto;padding:var(--tx-editor-content-code-block-padding);border:1px solid var(--tx-editor-content-code-block-border-color);border-radius:var(--tx-editor-content-code-block-border-radius);background:var(--tx-editor-content-code-block-background);font-family:var(--tx-editor-content-code-font-family);font-size:var(--tx-editor-content-code-block-font-size);line-height:var(--tx-editor-content-code-block-line-height);tab-size:2;white-space:pre}.tx-editor-prose pre code{padding:0;border-radius:0;background:none;font-size:inherit}.tx-editor-prose hr{height:0;margin:var(--tx-editor-content-rule-spacing) 0;border:0;border-top:1px solid var(--tx-editor-content-rule-color)}.tx-editor-prose img{display:block;max-width:100%;height:auto;border-radius:var(--tx-editor-content-image-border-radius)}.tx-editor-prose iframe{display:block;width:100%;max-width:640px;height:auto;border:0;border-radius:var(--tx-editor-content-video-border-radius);aspect-ratio:var(--tx-editor-content-video-aspect-ratio)}.tx-editor-prose [data-type=mention]{padding:var(--tx-editor-content-mention-padding);border-radius:var(--tx-editor-content-mention-border-radius);background:var(--tx-editor-content-mention-background);color:var(--tx-editor-content-mention-color);font-weight:var(--tx-editor-content-mention-font-weight);white-space:nowrap;-webkit-box-decoration-break:clone;box-decoration-break:clone}.tx-editor-prose [data-type=callout]{--_tone: var(--tx-editor-content-callout-info-color);position:relative;margin-block:var(--_gap);padding:var(--tx-editor-content-callout-padding-block) var(--tx-editor-content-callout-padding-inline-end) var(--tx-editor-content-callout-padding-block) var(--tx-editor-content-callout-padding-inline-start);border-radius:var(--tx-editor-content-callout-border-radius);background:color-mix(in srgb,var(--_tone) var(--tx-editor-content-callout-tint),transparent)}.tx-editor-prose [data-type=callout]:before{position:absolute;inset-block-start:calc(var(--tx-editor-content-callout-padding-block) + (var(--tx-editor-content-font-size) * var(--tx-editor-content-line-height) - var(--tx-editor-content-callout-marker-size)) / 2);inset-inline-start:var(--tx-editor-content-callout-marker-start);display:grid;place-items:center;width:var(--tx-editor-content-callout-marker-size);height:var(--tx-editor-content-callout-marker-size);border-radius:var(--tx-radius-full);background:var(--_tone);color:var(--tx-editor-content-callout-marker-color);content:\"i\";font-size:var(--tx-editor-content-callout-marker-font-size);font-weight:var(--tx-font-weight-bold);line-height:1}.tx-editor-prose [data-type=callout]>:last-child{margin-bottom:0}.tx-editor-prose [data-type=callout][data-tone=success]{--_tone: var(--tx-editor-content-callout-success-color)}.tx-editor-prose [data-type=callout][data-tone=success]:before{content:\"\\2713\"}.tx-editor-prose [data-type=callout][data-tone=warn]{--_tone: var(--tx-editor-content-callout-warn-color)}.tx-editor-prose [data-type=callout][data-tone=warn]:before{content:\"!\"}.tx-editor-prose [data-type=callout][data-tone=danger]{--_tone: var(--tx-editor-content-callout-danger-color)}.tx-editor-prose [data-type=callout][data-tone=danger]:before{content:\"!\"}.tx-editor-prose table{width:100%;border-collapse:collapse;table-layout:fixed}.tx-editor-prose th,.tx-editor-prose td{padding:var(--tx-editor-content-table-cell-padding);border:1px solid var(--tx-editor-content-table-border-color);text-align:start;vertical-align:top}.tx-editor-prose th>p,.tx-editor-prose td>p{margin:0}.tx-editor-prose th{background:var(--tx-editor-content-table-header-background);font-weight:var(--tx-font-weight-semibold)}.tx-editor-prose .ql-align-center{text-align:center}.tx-editor-prose .ql-align-right{text-align:right}.tx-editor-prose .ql-align-justify{text-align:justify}.tx-editor-prose .ql-size-small{font-size:.75em}.tx-editor-prose .ql-size-large{font-size:1.5em}.tx-editor-prose .ql-size-huge{font-size:2.5em}.tx-editor-prose .ql-font-serif{font-family:serif}.tx-editor-prose .ql-font-monospace{font-family:var(--tx-font-family-mono)}.tx-editor-prose .ql-direction-rtl{direction:rtl;text-align:inherit}.tx-editor-prose .ql-indent-1:not(li){padding-left:3em}.tx-editor-prose .ql-indent-2:not(li){padding-left:6em}.tx-editor-prose .ql-indent-3:not(li){padding-left:9em}.tx-editor-prose .ql-indent-4:not(li){padding-left:12em}.tx-editor-prose .ql-indent-5:not(li){padding-left:15em}.tx-editor-prose .ql-indent-6:not(li){padding-left:18em}.tx-editor-prose .ql-indent-7:not(li){padding-left:21em}.tx-editor-prose .ql-indent-8:not(li){padding-left:24em}.tx-editor-prose ol:has(>li[data-list]){padding-left:var(--tx-editor-content-list-indent);list-style:none;counter-reset:tx-ql-0}.tx-editor-prose ol:has(>li[data-list])>li[data-list]{position:relative;counter-increment:tx-ql-0}.tx-editor-prose ol:has(>li[data-list])>li[data-list]:before{position:absolute;right:calc(100% + .5em);color:var(--tx-editor-content-list-marker-color);white-space:nowrap}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=bullet]:before{content:\"\\2022\"}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=ordered]:before{content:counter(tx-ql-0) \".\"}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=checked]:before{content:\"\\2611\"}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=unchecked]:before{content:\"\\2610\"}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=checked]{color:var(--tx-editor-content-task-done-color);text-decoration:line-through}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-1{padding-left:1.5em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-2{padding-left:3em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-3{padding-left:4.5em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-4{padding-left:6em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-5{padding-left:7.5em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-6{padding-left:9em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-7{padding-left:10.5em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-8{padding-left:12em}.tx-editor-prose .ql-code-block-container{margin-block:var(--_gap);padding:var(--tx-editor-content-code-block-padding);border:1px solid var(--tx-editor-content-code-block-border-color);border-radius:var(--tx-editor-content-code-block-border-radius);background:var(--tx-editor-content-code-block-background);font-family:var(--tx-editor-content-code-font-family);font-size:var(--tx-editor-content-code-block-font-size);line-height:var(--tx-editor-content-code-block-line-height);white-space:pre}@media(prefers-reduced-motion:reduce){.tx-editor-prose a,.tx-editor-prose input[type=checkbox],.tx-editor-prose input[type=checkbox]:after{transition:none}}\n"],
438
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
439
+ encapsulation: i0.ViewEncapsulation.None
440
+ });
441
+ };
442
+ i0.ɵɵngDeclareClassMetadata({
443
+ minVersion: "12.0.0",
444
+ version: "22.2.3",
445
+ ngImport: i0,
446
+ type: TxEditorProseStyles,
447
+ decorators: [{
448
+ type: Component,
449
+ args: [{
450
+ selector: "tx-editor-prose-styles",
451
+ template: "",
452
+ encapsulation: ViewEncapsulation.None,
453
+ changeDetection: ChangeDetectionStrategy.OnPush,
454
+ styles: ["@charset \"UTF-8\";.tx-editor-prose{--_gap: var(--tx-editor-content-block-gap);--_paragraph-gap: var(--tx-editor-content-paragraph-gap);color:var(--tx-editor-content-color);font-family:var(--tx-font-family);font-size:var(--tx-editor-content-font-size);line-height:var(--tx-editor-content-line-height);overflow-wrap:break-word}.tx-editor-prose>:first-child{margin-top:0}.tx-editor-prose>:last-child{margin-bottom:0}.tx-editor-prose p,.tx-editor-prose ul,.tx-editor-prose ol,.tx-editor-prose blockquote{margin:0 0 var(--_paragraph-gap)}.tx-editor-prose pre,.tx-editor-prose table,.tx-editor-prose figure,.tx-editor-prose img,.tx-editor-prose iframe{margin-block:var(--_gap)}.tx-editor-prose h1,.tx-editor-prose h2,.tx-editor-prose h3,.tx-editor-prose h4,.tx-editor-prose h5,.tx-editor-prose h6{margin:var(--tx-editor-content-heading-space-before) 0 var(--tx-editor-content-heading-space-after);font-weight:var(--tx-editor-content-heading-font-weight);letter-spacing:-.01em;line-height:var(--tx-editor-content-heading-line-height)}.tx-editor-prose h1{font-size:var(--tx-editor-content-heading-h1-size);letter-spacing:-.02em}.tx-editor-prose h2{font-size:var(--tx-editor-content-heading-h2-size)}.tx-editor-prose h3{font-size:var(--tx-editor-content-heading-h3-size)}.tx-editor-prose h4{font-size:var(--tx-editor-content-heading-h4-size)}.tx-editor-prose h5{font-size:var(--tx-editor-content-heading-h5-size)}.tx-editor-prose h6{color:var(--tx-editor-content-heading-h6-color);font-size:var(--tx-editor-content-heading-h6-size);letter-spacing:.02em;text-transform:uppercase}.tx-editor-prose a{color:var(--tx-editor-content-link-color);text-decoration:underline;text-decoration-color:var(--tx-editor-content-link-underline-color);text-decoration-thickness:1px;text-underline-offset:.2em;cursor:pointer;transition:text-decoration-color var(--tx-motion-duration) var(--tx-motion-easing)}.tx-editor-prose a:hover{text-decoration-color:var(--tx-editor-content-link-hover-underline-color)}.tx-editor-prose ul,.tx-editor-prose ol{padding-left:var(--tx-editor-content-list-indent)}.tx-editor-prose ul ul,.tx-editor-prose ul ol,.tx-editor-prose ol ul,.tx-editor-prose ol ol{margin:var(--tx-editor-content-list-item-gap) 0 0}.tx-editor-prose ul{list-style:disc}.tx-editor-prose ul ul{list-style:circle}.tx-editor-prose ul ul ul{list-style:square}.tx-editor-prose ol{list-style:decimal}.tx-editor-prose ol ol{list-style:lower-alpha}.tx-editor-prose ol ol ol{list-style:lower-roman}.tx-editor-prose li{margin:0}.tx-editor-prose li+li{margin-top:var(--tx-editor-content-list-item-gap)}.tx-editor-prose li>p{margin:0}.tx-editor-prose li::marker{color:var(--tx-editor-content-list-marker-color)}.tx-editor-prose ul[data-type=taskList]{padding-left:0;list-style:none}.tx-editor-prose ul[data-type=taskList] li{display:flex;align-items:flex-start;gap:var(--tx-editor-content-task-gap)}.tx-editor-prose ul[data-type=taskList] li>label{display:inline-flex;flex-shrink:0;align-items:center;height:calc(1em * var(--tx-editor-content-line-height));margin:0;-webkit-user-select:none;user-select:none}.tx-editor-prose ul[data-type=taskList] li>div{flex:1 1 auto;min-width:0}.tx-editor-prose ul[data-type=taskList] li[data-checked=true]>div{color:var(--tx-editor-content-task-done-color);text-decoration:line-through;text-decoration-color:var(--tx-editor-content-task-done-color)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]{display:grid;place-content:center;width:var(--tx-editor-content-task-size);height:var(--tx-editor-content-task-size);margin:0;border:1.5px solid var(--tx-editor-content-task-border-color);border-radius:var(--tx-editor-content-task-border-radius);background:transparent;cursor:pointer;appearance:none;transition:background-color var(--tx-motion-duration) var(--tx-motion-easing),border-color var(--tx-motion-duration) var(--tx-motion-easing)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]:after{width:4px;height:8px;margin-top:-2px;border:solid var(--tx-editor-content-task-checked-color);border-width:0 2px 2px 0;content:\"\";opacity:0;transform:rotate(45deg) scale(.6);transition:opacity var(--tx-motion-duration) var(--tx-motion-easing),transform var(--tx-motion-duration) var(--tx-motion-easing)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]:checked{border-color:var(--tx-editor-content-task-checked-background);background:var(--tx-editor-content-task-checked-background)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]:checked:after{opacity:1;transform:rotate(45deg) scale(1)}.tx-editor-prose ul[data-type=taskList] input[type=checkbox]:disabled{cursor:default}.tx-editor-prose blockquote{padding:var(--tx-editor-content-quote-padding);border-left:var(--tx-editor-content-quote-border-width) solid var(--tx-editor-content-quote-border-color);color:var(--tx-editor-content-quote-color)}.tx-editor-prose blockquote>:last-child{margin-bottom:0}.tx-editor-prose code{padding:var(--tx-editor-content-code-padding);border-radius:var(--tx-editor-content-code-border-radius);background:var(--tx-editor-content-code-background);color:var(--tx-editor-content-code-color);font-family:var(--tx-editor-content-code-font-family);font-size:var(--tx-editor-content-code-font-size);-webkit-box-decoration-break:clone;box-decoration-break:clone}.tx-editor-prose pre{overflow-x:auto;padding:var(--tx-editor-content-code-block-padding);border:1px solid var(--tx-editor-content-code-block-border-color);border-radius:var(--tx-editor-content-code-block-border-radius);background:var(--tx-editor-content-code-block-background);font-family:var(--tx-editor-content-code-font-family);font-size:var(--tx-editor-content-code-block-font-size);line-height:var(--tx-editor-content-code-block-line-height);tab-size:2;white-space:pre}.tx-editor-prose pre code{padding:0;border-radius:0;background:none;font-size:inherit}.tx-editor-prose hr{height:0;margin:var(--tx-editor-content-rule-spacing) 0;border:0;border-top:1px solid var(--tx-editor-content-rule-color)}.tx-editor-prose img{display:block;max-width:100%;height:auto;border-radius:var(--tx-editor-content-image-border-radius)}.tx-editor-prose iframe{display:block;width:100%;max-width:640px;height:auto;border:0;border-radius:var(--tx-editor-content-video-border-radius);aspect-ratio:var(--tx-editor-content-video-aspect-ratio)}.tx-editor-prose [data-type=mention]{padding:var(--tx-editor-content-mention-padding);border-radius:var(--tx-editor-content-mention-border-radius);background:var(--tx-editor-content-mention-background);color:var(--tx-editor-content-mention-color);font-weight:var(--tx-editor-content-mention-font-weight);white-space:nowrap;-webkit-box-decoration-break:clone;box-decoration-break:clone}.tx-editor-prose [data-type=callout]{--_tone: var(--tx-editor-content-callout-info-color);position:relative;margin-block:var(--_gap);padding:var(--tx-editor-content-callout-padding-block) var(--tx-editor-content-callout-padding-inline-end) var(--tx-editor-content-callout-padding-block) var(--tx-editor-content-callout-padding-inline-start);border-radius:var(--tx-editor-content-callout-border-radius);background:color-mix(in srgb,var(--_tone) var(--tx-editor-content-callout-tint),transparent)}.tx-editor-prose [data-type=callout]:before{position:absolute;inset-block-start:calc(var(--tx-editor-content-callout-padding-block) + (var(--tx-editor-content-font-size) * var(--tx-editor-content-line-height) - var(--tx-editor-content-callout-marker-size)) / 2);inset-inline-start:var(--tx-editor-content-callout-marker-start);display:grid;place-items:center;width:var(--tx-editor-content-callout-marker-size);height:var(--tx-editor-content-callout-marker-size);border-radius:var(--tx-radius-full);background:var(--_tone);color:var(--tx-editor-content-callout-marker-color);content:\"i\";font-size:var(--tx-editor-content-callout-marker-font-size);font-weight:var(--tx-font-weight-bold);line-height:1}.tx-editor-prose [data-type=callout]>:last-child{margin-bottom:0}.tx-editor-prose [data-type=callout][data-tone=success]{--_tone: var(--tx-editor-content-callout-success-color)}.tx-editor-prose [data-type=callout][data-tone=success]:before{content:\"\\2713\"}.tx-editor-prose [data-type=callout][data-tone=warn]{--_tone: var(--tx-editor-content-callout-warn-color)}.tx-editor-prose [data-type=callout][data-tone=warn]:before{content:\"!\"}.tx-editor-prose [data-type=callout][data-tone=danger]{--_tone: var(--tx-editor-content-callout-danger-color)}.tx-editor-prose [data-type=callout][data-tone=danger]:before{content:\"!\"}.tx-editor-prose table{width:100%;border-collapse:collapse;table-layout:fixed}.tx-editor-prose th,.tx-editor-prose td{padding:var(--tx-editor-content-table-cell-padding);border:1px solid var(--tx-editor-content-table-border-color);text-align:start;vertical-align:top}.tx-editor-prose th>p,.tx-editor-prose td>p{margin:0}.tx-editor-prose th{background:var(--tx-editor-content-table-header-background);font-weight:var(--tx-font-weight-semibold)}.tx-editor-prose .ql-align-center{text-align:center}.tx-editor-prose .ql-align-right{text-align:right}.tx-editor-prose .ql-align-justify{text-align:justify}.tx-editor-prose .ql-size-small{font-size:.75em}.tx-editor-prose .ql-size-large{font-size:1.5em}.tx-editor-prose .ql-size-huge{font-size:2.5em}.tx-editor-prose .ql-font-serif{font-family:serif}.tx-editor-prose .ql-font-monospace{font-family:var(--tx-font-family-mono)}.tx-editor-prose .ql-direction-rtl{direction:rtl;text-align:inherit}.tx-editor-prose .ql-indent-1:not(li){padding-left:3em}.tx-editor-prose .ql-indent-2:not(li){padding-left:6em}.tx-editor-prose .ql-indent-3:not(li){padding-left:9em}.tx-editor-prose .ql-indent-4:not(li){padding-left:12em}.tx-editor-prose .ql-indent-5:not(li){padding-left:15em}.tx-editor-prose .ql-indent-6:not(li){padding-left:18em}.tx-editor-prose .ql-indent-7:not(li){padding-left:21em}.tx-editor-prose .ql-indent-8:not(li){padding-left:24em}.tx-editor-prose ol:has(>li[data-list]){padding-left:var(--tx-editor-content-list-indent);list-style:none;counter-reset:tx-ql-0}.tx-editor-prose ol:has(>li[data-list])>li[data-list]{position:relative;counter-increment:tx-ql-0}.tx-editor-prose ol:has(>li[data-list])>li[data-list]:before{position:absolute;right:calc(100% + .5em);color:var(--tx-editor-content-list-marker-color);white-space:nowrap}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=bullet]:before{content:\"\\2022\"}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=ordered]:before{content:counter(tx-ql-0) \".\"}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=checked]:before{content:\"\\2611\"}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=unchecked]:before{content:\"\\2610\"}.tx-editor-prose ol:has(>li[data-list])>li[data-list][data-list=checked]{color:var(--tx-editor-content-task-done-color);text-decoration:line-through}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-1{padding-left:1.5em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-2{padding-left:3em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-3{padding-left:4.5em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-4{padding-left:6em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-5{padding-left:7.5em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-6{padding-left:9em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-7{padding-left:10.5em}.tx-editor-prose ol:has(>li[data-list])>li.ql-indent-8{padding-left:12em}.tx-editor-prose .ql-code-block-container{margin-block:var(--_gap);padding:var(--tx-editor-content-code-block-padding);border:1px solid var(--tx-editor-content-code-block-border-color);border-radius:var(--tx-editor-content-code-block-border-radius);background:var(--tx-editor-content-code-block-background);font-family:var(--tx-editor-content-code-font-family);font-size:var(--tx-editor-content-code-block-font-size);line-height:var(--tx-editor-content-code-block-line-height);white-space:pre}@media(prefers-reduced-motion:reduce){.tx-editor-prose a,.tx-editor-prose input[type=checkbox],.tx-editor-prose input[type=checkbox]:after{transition:none}}\n"]
455
+ }]
456
+ }]
457
+ });
458
+ var TxEditorContent = class TxEditorContent {
459
+ sanitizer = inject(DomSanitizer);
460
+ html = input(null, ...ngDevMode ? [{ debugName: "html" }] : /* istanbul ignore next */ []);
461
+ previewImages = input(true, {
462
+ ...ngDevMode ? { debugName: "previewImages" } : /* istanbul ignore next */ {},
463
+ transform: booleanAttribute
464
+ });
465
+ dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
466
+ pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
467
+ ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
468
+ unstyled = input(void 0, {
469
+ ...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
470
+ transform: optionalBoolean
471
+ });
472
+ imageClick = output();
473
+ translations = injectTranslations();
474
+ isUnstyled = injectUnstyled(this.unstyled);
475
+ passThrough = injectPassThrough("editorContent", this, this.pt, this.ptOptions);
476
+ body = viewChild("body", ...ngDevMode ? [{ debugName: "body" }] : /* istanbul ignore next */ []);
477
+ preview = signal(null, ...ngDevMode ? [{ debugName: "preview" }] : /* istanbul ignore next */ []);
478
+ previewOpen = signal(false, ...ngDevMode ? [{ debugName: "previewOpen" }] : /* istanbul ignore next */ []);
479
+ safeHtml = computed(() => this.sanitizer.bypassSecurityTrustHtml(sanitizeEditorHtml(fromQuillHtml(this.html()))), ...ngDevMode ? [{ debugName: "safeHtml" }] : /* istanbul ignore next */ []);
480
+ hostStyle = computed(() => ({
481
+ ...toStyleObject(this.dt(), "--tx-editor-content"),
482
+ ...this.passThrough().root?.style
483
+ }), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
484
+ constructor() {
485
+ inject(TxStyleLoader).load(TxEditorProseStyles);
486
+ afterRenderEffect(() => {
487
+ this.safeHtml();
488
+ const preview = this.previewImages();
489
+ this.body()?.nativeElement.querySelectorAll("img").forEach((image) => {
490
+ if (preview) {
491
+ image.setAttribute("tabindex", "0");
492
+ image.setAttribute("role", "button");
493
+ } else {
494
+ image.removeAttribute("tabindex");
495
+ image.removeAttribute("role");
496
+ }
497
+ });
498
+ });
499
+ }
500
+ onClick(event) {
501
+ const target = event.target;
502
+ if (target instanceof HTMLImageElement) this.open(target, event);
503
+ }
504
+ onKeydown(event) {
505
+ const target = event.target;
506
+ if (target instanceof HTMLImageElement && (event.key === "Enter" || event.key === " ")) {
507
+ event.preventDefault();
508
+ this.open(target, event);
509
+ }
510
+ }
511
+ open(target, event) {
512
+ const image = {
513
+ src: target.currentSrc || target.src,
514
+ alt: target.alt
515
+ };
516
+ this.imageClick.emit({
517
+ originalEvent: event,
518
+ ...image
519
+ });
520
+ if (this.previewImages()) {
521
+ this.preview.set(image);
522
+ this.previewOpen.set(true);
523
+ }
524
+ }
525
+ static ɵfac = i0.ɵɵngDeclareFactory({
526
+ minVersion: "12.0.0",
527
+ version: "22.2.3",
528
+ ngImport: i0,
529
+ type: TxEditorContent,
530
+ deps: [],
531
+ target: i0.ɵɵFactoryTarget.Component
532
+ });
533
+ static ɵcmp = i0.ɵɵngDeclareComponent({
534
+ minVersion: "17.0.0",
535
+ version: "22.2.3",
536
+ type: TxEditorContent,
537
+ isStandalone: true,
538
+ selector: "tx-editor-content",
539
+ inputs: {
540
+ html: {
541
+ classPropertyName: "html",
542
+ publicName: "html",
543
+ isSignal: true,
544
+ isRequired: false,
545
+ transformFunction: null
546
+ },
547
+ previewImages: {
548
+ classPropertyName: "previewImages",
549
+ publicName: "previewImages",
550
+ isSignal: true,
551
+ isRequired: false,
552
+ transformFunction: null
553
+ },
554
+ dt: {
555
+ classPropertyName: "dt",
556
+ publicName: "dt",
557
+ isSignal: true,
558
+ isRequired: false,
559
+ transformFunction: null
560
+ },
561
+ pt: {
562
+ classPropertyName: "pt",
563
+ publicName: "pt",
564
+ isSignal: true,
565
+ isRequired: false,
566
+ transformFunction: null
567
+ },
568
+ ptOptions: {
569
+ classPropertyName: "ptOptions",
570
+ publicName: "ptOptions",
571
+ isSignal: true,
572
+ isRequired: false,
573
+ transformFunction: null
574
+ },
575
+ unstyled: {
576
+ classPropertyName: "unstyled",
577
+ publicName: "unstyled",
578
+ isSignal: true,
579
+ isRequired: false,
580
+ transformFunction: null
581
+ }
582
+ },
583
+ outputs: { imageClick: "imageClick" },
584
+ host: {
585
+ properties: {
586
+ "class": "passThrough().root?.class",
587
+ "style": "hostStyle()",
588
+ "attr.data-styled": "!isUnstyled() || null",
589
+ "class.tx-editor-content--zoom": "previewImages()"
590
+ },
591
+ classAttribute: "tx-editor-content"
592
+ },
593
+ viewQueries: [{
594
+ propertyName: "body",
595
+ first: true,
596
+ predicate: ["body"],
597
+ descendants: true,
598
+ isSignal: true
599
+ }],
600
+ ngImport: i0,
601
+ template: `
602
+ <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- clicks and keys come from the images inside, which get a tab stop -->
603
+ <div
604
+ #body
605
+ class="tx-editor-content__body"
606
+ [class.tx-editor-prose]="!isUnstyled()"
607
+ [class]="passThrough().body?.class"
608
+ [style]="passThrough().body?.style"
609
+ [innerHTML]="safeHtml()"
610
+ (click)="onClick($event)"
611
+ (keydown)="onKeydown($event)"
612
+ ></div>
613
+ @if (previewImages()) {
614
+ <tx-dialog
615
+ size="large"
616
+ [header]="preview()?.alt || translations().editorImagePreview"
617
+ [visible]="previewOpen()"
618
+ (visibleChange)="previewOpen.set($event)"
619
+ >
620
+ @if (preview(); as image) {
621
+ <img class="tx-editor-content__preview" [src]="image.src" [alt]="image.alt" />
622
+ }
623
+ </tx-dialog>
624
+ }
625
+ `,
626
+ isInline: true,
627
+ styles: [":host{display:block;min-width:0}:host(.tx-editor-content--zoom) .tx-editor-content__body ::ng-deep img{cursor:zoom-in}.tx-editor-content__preview{display:block;max-width:100%;max-height:75vh;margin:0 auto;border-radius:var(--tx-editor-content-image-border-radius);object-fit:contain}\n"],
628
+ dependencies: [{
629
+ kind: "component",
630
+ type: TxDialog,
631
+ selector: "tx-dialog",
632
+ inputs: [
633
+ "visible",
634
+ "header",
635
+ "subtitle",
636
+ "size",
637
+ "width",
638
+ "height",
639
+ "breakpoints",
640
+ "position",
641
+ "drawer",
642
+ "drawerSize",
643
+ "modal",
644
+ "closable",
645
+ "closeOnEscape",
646
+ "dismissableMask",
647
+ "blockScroll",
648
+ "draggable",
649
+ "maximizable",
650
+ "autoFocus",
651
+ "restoreFocus",
652
+ "role",
653
+ "ariaLabel",
654
+ "panelClass",
655
+ "canClose",
656
+ "dt",
657
+ "unstyled"
658
+ ],
659
+ outputs: [
660
+ "visibleChange",
661
+ "opened",
662
+ "closed"
663
+ ]
664
+ }],
665
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
666
+ });
667
+ };
668
+ i0.ɵɵngDeclareClassMetadata({
669
+ minVersion: "12.0.0",
670
+ version: "22.2.3",
671
+ ngImport: i0,
672
+ type: TxEditorContent,
673
+ decorators: [{
674
+ type: Component,
675
+ args: [{
676
+ selector: "tx-editor-content",
677
+ imports: [TxDialog],
678
+ template: `
679
+ <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- clicks and keys come from the images inside, which get a tab stop -->
680
+ <div
681
+ #body
682
+ class="tx-editor-content__body"
683
+ [class.tx-editor-prose]="!isUnstyled()"
684
+ [class]="passThrough().body?.class"
685
+ [style]="passThrough().body?.style"
686
+ [innerHTML]="safeHtml()"
687
+ (click)="onClick($event)"
688
+ (keydown)="onKeydown($event)"
689
+ ></div>
690
+ @if (previewImages()) {
691
+ <tx-dialog
692
+ size="large"
693
+ [header]="preview()?.alt || translations().editorImagePreview"
694
+ [visible]="previewOpen()"
695
+ (visibleChange)="previewOpen.set($event)"
696
+ >
697
+ @if (preview(); as image) {
698
+ <img class="tx-editor-content__preview" [src]="image.src" [alt]="image.alt" />
699
+ }
700
+ </tx-dialog>
701
+ }
702
+ `,
703
+ changeDetection: ChangeDetectionStrategy.OnPush,
704
+ host: {
705
+ class: "tx-editor-content",
706
+ "[class]": "passThrough().root?.class",
707
+ "[style]": "hostStyle()",
708
+ "[attr.data-styled]": "!isUnstyled() || null",
709
+ "[class.tx-editor-content--zoom]": "previewImages()"
710
+ },
711
+ styles: [":host{display:block;min-width:0}:host(.tx-editor-content--zoom) .tx-editor-content__body ::ng-deep img{cursor:zoom-in}.tx-editor-content__preview{display:block;max-width:100%;max-height:75vh;margin:0 auto;border-radius:var(--tx-editor-content-image-border-radius);object-fit:contain}\n"]
712
+ }]
713
+ }],
714
+ ctorParameters: () => [],
715
+ propDecorators: {
716
+ html: [{
717
+ type: i0.Input,
718
+ args: [{
719
+ isSignal: true,
720
+ alias: "html",
721
+ required: false
722
+ }]
723
+ }],
724
+ previewImages: [{
725
+ type: i0.Input,
726
+ args: [{
727
+ isSignal: true,
728
+ alias: "previewImages",
729
+ required: false
730
+ }]
731
+ }],
732
+ dt: [{
733
+ type: i0.Input,
734
+ args: [{
735
+ isSignal: true,
736
+ alias: "dt",
737
+ required: false
738
+ }]
739
+ }],
740
+ pt: [{
741
+ type: i0.Input,
742
+ args: [{
743
+ isSignal: true,
744
+ alias: "pt",
745
+ required: false
746
+ }]
747
+ }],
748
+ ptOptions: [{
749
+ type: i0.Input,
750
+ args: [{
751
+ isSignal: true,
752
+ alias: "ptOptions",
753
+ required: false
754
+ }]
755
+ }],
756
+ unstyled: [{
757
+ type: i0.Input,
758
+ args: [{
759
+ isSignal: true,
760
+ alias: "unstyled",
761
+ required: false
762
+ }]
763
+ }],
764
+ imageClick: [{
765
+ type: i0.Output,
766
+ args: ["imageClick"]
767
+ }],
768
+ body: [{
769
+ type: i0.ViewChild,
770
+ args: ["body", { isSignal: true }]
771
+ }]
772
+ }
773
+ });
774
+ export { TxEditorContent, TxEditorProseStyles, formatEditorHtml, fromQuillHtml, isQuillHtml, sanitizeEditorHtml, toEditorHtml, toQuillHtml };
775
+
776
+ //# sourceMappingURL=tectra-ng-editor-content.mjs.map