@tectra-ng/editor 0.1.4 → 0.1.6
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/tectra-ng-editor-content.mjs +49 -32
- package/fesm2022/tectra-ng-editor-content.mjs.map +1 -1
- package/fesm2022/tectra-ng-editor.mjs +3 -3
- package/fesm2022/tectra-ng-editor.mjs.map +1 -1
- package/package.json +16 -6
- package/types/tectra-ng-editor-content.d.ts +6 -5
- package/types/tectra-ng-editor-content.d.ts.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, ViewEncapsulation, afterRenderEffect, booleanAttribute, computed, inject, input, output, signal, viewChild } from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DOCUMENT, ViewEncapsulation, afterRenderEffect, booleanAttribute, computed, inject, input, output, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { DomSanitizer } from "@angular/platform-browser";
|
|
4
4
|
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
5
5
|
import { injectTranslations } from "@tectra-ng/core/i18n";
|
|
@@ -7,6 +7,26 @@ import { TxStyleLoader } from "@tectra-ng/core/styles";
|
|
|
7
7
|
import { optionalBoolean } from "@tectra-ng/core/utils";
|
|
8
8
|
import { toStyleObject } from "@tectra-ng/themes";
|
|
9
9
|
import { TxDialog } from "@tectra-ng/ui/dialog";
|
|
10
|
+
function parseHtmlBody(html, document) {
|
|
11
|
+
const Parser = globalThis.DOMParser;
|
|
12
|
+
if (Parser) return new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
|
|
13
|
+
const inert = document?.implementation.createHTMLDocument("");
|
|
14
|
+
if (!inert) return null;
|
|
15
|
+
inert.body.innerHTML = html;
|
|
16
|
+
return inert.body;
|
|
17
|
+
}
|
|
18
|
+
function appendNodes(parent, nodes) {
|
|
19
|
+
for (const node of Array.from(nodes)) parent.appendChild(node);
|
|
20
|
+
}
|
|
21
|
+
function replaceNode(node, replacement) {
|
|
22
|
+
node.parentNode?.replaceChild(replacement, node);
|
|
23
|
+
}
|
|
24
|
+
function unwrapNode(node) {
|
|
25
|
+
const parent = node.parentNode;
|
|
26
|
+
if (!parent) return;
|
|
27
|
+
for (const child of Array.from(node.childNodes)) parent.insertBefore(child, node);
|
|
28
|
+
parent.removeChild(node);
|
|
29
|
+
}
|
|
10
30
|
const QUILL_SIZES = {
|
|
11
31
|
small: "0.75em",
|
|
12
32
|
large: "1.5em",
|
|
@@ -24,10 +44,6 @@ const ALIGNMENTS = [
|
|
|
24
44
|
"justify"
|
|
25
45
|
];
|
|
26
46
|
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
47
|
function classValue(element, prefix) {
|
|
32
48
|
const match = Array.from(element.classList).find((name) => name.startsWith(prefix));
|
|
33
49
|
if (!match) return null;
|
|
@@ -88,7 +104,7 @@ function convertQuillList(list) {
|
|
|
88
104
|
const align = classValue(item, "ql-align-");
|
|
89
105
|
if (align && ALIGNMENTS.includes(align)) paragraph.style.textAlign = align;
|
|
90
106
|
item.querySelectorAll(".ql-ui").forEach((node) => node.remove());
|
|
91
|
-
paragraph
|
|
107
|
+
appendNodes(paragraph, item.childNodes);
|
|
92
108
|
if (kind === "checked" || kind === "unchecked") {
|
|
93
109
|
next.setAttribute("data-type", "taskItem");
|
|
94
110
|
next.setAttribute("data-checked", String(kind === "checked"));
|
|
@@ -96,7 +112,7 @@ function convertQuillList(list) {
|
|
|
96
112
|
next.appendChild(paragraph);
|
|
97
113
|
current.element.appendChild(next);
|
|
98
114
|
}
|
|
99
|
-
list
|
|
115
|
+
replaceNode(list, fragment);
|
|
100
116
|
}
|
|
101
117
|
function convertQuillCode(container) {
|
|
102
118
|
const document = container.ownerDocument;
|
|
@@ -107,22 +123,23 @@ function convertQuillCode(container) {
|
|
|
107
123
|
if (language && language !== "plain") code.className = `language-${language}`;
|
|
108
124
|
code.textContent = lines.map((line) => line.textContent ?? "").join("\n");
|
|
109
125
|
pre.appendChild(code);
|
|
110
|
-
container
|
|
126
|
+
replaceNode(container, pre);
|
|
111
127
|
}
|
|
112
128
|
function isQuillHtml(html) {
|
|
113
129
|
return !!html && QUILL_MARKERS.test(html);
|
|
114
130
|
}
|
|
115
|
-
function fromQuillHtml(html) {
|
|
131
|
+
function fromQuillHtml(html, document) {
|
|
116
132
|
if (!html) return "";
|
|
117
133
|
if (!isQuillHtml(html)) return html;
|
|
118
|
-
const body =
|
|
134
|
+
const body = parseHtmlBody(html, document);
|
|
119
135
|
if (!body) return html;
|
|
120
136
|
body.querySelectorAll(".ql-cursor, .ql-ui").forEach((node) => node.remove());
|
|
121
137
|
body.querySelectorAll(".ql-code-block-container").forEach(convertQuillCode);
|
|
122
138
|
body.querySelectorAll("pre.ql-syntax").forEach((pre) => {
|
|
123
139
|
const code = body.ownerDocument.createElement("code");
|
|
124
140
|
code.textContent = pre.textContent ?? "";
|
|
125
|
-
pre.
|
|
141
|
+
pre.textContent = "";
|
|
142
|
+
pre.appendChild(code);
|
|
126
143
|
pre.classList.remove("ql-syntax");
|
|
127
144
|
cleanClassAttribute(pre);
|
|
128
145
|
});
|
|
@@ -168,40 +185,40 @@ function flattenList(list, level, out) {
|
|
|
168
185
|
if (inline.length) inline.push(document.createElement("br"));
|
|
169
186
|
inline.push(...Array.from(child.childNodes));
|
|
170
187
|
}
|
|
171
|
-
next
|
|
188
|
+
appendNodes(next, inline);
|
|
172
189
|
out.appendChild(next);
|
|
173
190
|
nested.forEach((child) => flattenList(child, level + 1, out));
|
|
174
191
|
}
|
|
175
192
|
}
|
|
176
|
-
function toQuillHtml(html) {
|
|
193
|
+
function toQuillHtml(html, document) {
|
|
177
194
|
if (!html) return "";
|
|
178
|
-
const body =
|
|
195
|
+
const body = parseHtmlBody(html, document);
|
|
179
196
|
if (!body) return html;
|
|
180
|
-
const
|
|
197
|
+
const owner = body.ownerDocument;
|
|
181
198
|
const topLists = Array.from(body.querySelectorAll("ol, ul")).filter((list) => !list.parentElement?.closest("ol, ul"));
|
|
182
199
|
let previous = null;
|
|
183
200
|
for (const list of topLists) {
|
|
184
|
-
const target = previous && previous.nextSibling === list ? previous :
|
|
201
|
+
const target = previous && previous.nextSibling === list ? previous : owner.createElement("ol");
|
|
185
202
|
flattenList(list, 0, target);
|
|
186
203
|
if (target === previous) list.remove();
|
|
187
|
-
else list
|
|
204
|
+
else replaceNode(list, target);
|
|
188
205
|
previous = target;
|
|
189
206
|
}
|
|
190
207
|
body.querySelectorAll("pre").forEach((pre) => {
|
|
191
208
|
const code = pre.querySelector("code");
|
|
192
209
|
const language = Array.from(code?.classList ?? []).find((name) => name.startsWith("language-"))?.slice(9) ?? "plain";
|
|
193
|
-
const container =
|
|
210
|
+
const container = owner.createElement("div");
|
|
194
211
|
container.className = "ql-code-block-container";
|
|
195
212
|
container.setAttribute("spellcheck", "false");
|
|
196
213
|
for (const line of (code?.textContent ?? pre.textContent ?? "").split("\n")) {
|
|
197
|
-
const block =
|
|
214
|
+
const block = owner.createElement("div");
|
|
198
215
|
block.className = "ql-code-block";
|
|
199
216
|
block.setAttribute("data-language", language);
|
|
200
217
|
block.textContent = line;
|
|
201
|
-
if (!line) block.appendChild(
|
|
218
|
+
if (!line) block.appendChild(owner.createElement("br"));
|
|
202
219
|
container.appendChild(block);
|
|
203
220
|
}
|
|
204
|
-
pre
|
|
221
|
+
replaceNode(pre, container);
|
|
205
222
|
});
|
|
206
223
|
body.querySelectorAll("[style], [data-indent], [dir], iframe[data-type=\"video\"]").forEach((element) => {
|
|
207
224
|
const style = styleOf(element);
|
|
@@ -235,14 +252,14 @@ function toQuillHtml(html) {
|
|
|
235
252
|
}
|
|
236
253
|
if (element.getAttribute("style") === "") element.removeAttribute("style");
|
|
237
254
|
});
|
|
238
|
-
body.querySelectorAll("p:empty, h1:empty, h2:empty, h3:empty, h4:empty, h5:empty, h6:empty").forEach((block) => block.appendChild(
|
|
255
|
+
body.querySelectorAll("p:empty, h1:empty, h2:empty, h3:empty, h4:empty, h5:empty, h6:empty").forEach((block) => block.appendChild(owner.createElement("br")));
|
|
239
256
|
return body.innerHTML;
|
|
240
257
|
}
|
|
241
|
-
function toEditorHtml(html) {
|
|
242
|
-
return fromQuillHtml(html);
|
|
258
|
+
function toEditorHtml(html, document) {
|
|
259
|
+
return fromQuillHtml(html, document);
|
|
243
260
|
}
|
|
244
|
-
function formatEditorHtml(html, format) {
|
|
245
|
-
return format === "quill" ? toQuillHtml(html) : html;
|
|
261
|
+
function formatEditorHtml(html, format, document) {
|
|
262
|
+
return format === "quill" ? toQuillHtml(html, document) : html;
|
|
246
263
|
}
|
|
247
264
|
const ALLOWED_TAGS = /* @__PURE__ */ new Set([
|
|
248
265
|
"p",
|
|
@@ -386,7 +403,7 @@ function cleanNode(node) {
|
|
|
386
403
|
}
|
|
387
404
|
if (!ALLOWED_TAGS.has(tag)) {
|
|
388
405
|
cleanNode(element);
|
|
389
|
-
|
|
406
|
+
unwrapNode(element);
|
|
390
407
|
continue;
|
|
391
408
|
}
|
|
392
409
|
for (const attribute of Array.from(element.attributes)) {
|
|
@@ -408,11 +425,10 @@ function cleanNode(node) {
|
|
|
408
425
|
cleanNode(element);
|
|
409
426
|
}
|
|
410
427
|
}
|
|
411
|
-
function sanitizeEditorHtml(html) {
|
|
428
|
+
function sanitizeEditorHtml(html, document) {
|
|
412
429
|
if (!html) return "";
|
|
413
|
-
const
|
|
414
|
-
if (!
|
|
415
|
-
const body = new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
|
|
430
|
+
const body = parseHtmlBody(html, document);
|
|
431
|
+
if (!body) return "";
|
|
416
432
|
cleanNode(body);
|
|
417
433
|
return body.innerHTML;
|
|
418
434
|
}
|
|
@@ -457,6 +473,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
457
473
|
});
|
|
458
474
|
var TxEditorContent = class TxEditorContent {
|
|
459
475
|
sanitizer = inject(DomSanitizer);
|
|
476
|
+
document = inject(DOCUMENT);
|
|
460
477
|
html = input(null, ...ngDevMode ? [{ debugName: "html" }] : /* istanbul ignore next */ []);
|
|
461
478
|
previewImages = input(true, {
|
|
462
479
|
...ngDevMode ? { debugName: "previewImages" } : /* istanbul ignore next */ {},
|
|
@@ -476,7 +493,7 @@ var TxEditorContent = class TxEditorContent {
|
|
|
476
493
|
body = viewChild("body", ...ngDevMode ? [{ debugName: "body" }] : /* istanbul ignore next */ []);
|
|
477
494
|
preview = signal(null, ...ngDevMode ? [{ debugName: "preview" }] : /* istanbul ignore next */ []);
|
|
478
495
|
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 */ []);
|
|
496
|
+
safeHtml = computed(() => this.sanitizer.bypassSecurityTrustHtml(sanitizeEditorHtml(fromQuillHtml(this.html(), this.document), this.document)), ...ngDevMode ? [{ debugName: "safeHtml" }] : /* istanbul ignore next */ []);
|
|
480
497
|
hostStyle = computed(() => ({
|
|
481
498
|
...toStyleObject(this.dt(), "--tx-editor-content"),
|
|
482
499
|
...this.passThrough().root?.style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tectra-ng-editor-content.mjs","names":[],"sources":["../../../../packages/editor/content/src/editor-html.ts","../../../../packages/editor/content/src/editor-sanitizer.ts","../../../../packages/editor/content/src/editor-prose-styles.component.ts","../../../../packages/editor/content/src/editor-content.component.ts"],"sourcesContent":["import { TxEditorFormat } from './editor-content.types';\n\nconst QUILL_SIZES: Record<string, string> = { small: '0.75em', large: '1.5em', huge: '2.5em' };\nconst QUILL_FONTS: Record<string, string> = { serif: 'serif', monospace: 'monospace' };\nconst INDENT_STEP_EM = 3;\nconst ALIGNMENTS = ['left', 'center', 'right', 'justify'];\nconst QUILL_MARKERS = /data-list=|class=\"[^\"]*\\bql-|ql-code-block|ql-video/;\n\ntype TxListKind = 'bullet' | 'ordered' | 'checked' | 'unchecked';\n\nfunction parse(html: string): HTMLElement | null {\n const Parser = globalThis.DOMParser;\n return Parser ? new Parser().parseFromString(`<body>${html}</body>`, 'text/html').body : null;\n}\n\nfunction classValue(element: Element, prefix: string): string | null {\n const match = Array.from(element.classList).find((name) => name.startsWith(prefix));\n if (!match) {\n return null;\n }\n element.classList.remove(match);\n return match.slice(prefix.length);\n}\n\nfunction cleanClassAttribute(element: Element): void {\n if (element.getAttribute('class') === '') {\n element.removeAttribute('class');\n }\n}\n\nfunction styleOf(element: Element): CSSStyleDeclaration | null {\n return (element as HTMLElement).style ?? null;\n}\n\nfunction indentLevel(element: Element): number {\n const value = Number(element.getAttribute('data-indent') ?? NaN);\n if (!Number.isNaN(value)) {\n return value;\n }\n const margin = styleOf(element)?.marginLeft ?? '';\n return margin.endsWith('em') ? Math.round(parseFloat(margin) / INDENT_STEP_EM) : 0;\n}\n\nfunction quillListKind(item: Element, list: Element): TxListKind {\n const data = item.getAttribute('data-list');\n if (data === 'bullet' || data === 'ordered' || data === 'checked' || data === 'unchecked') {\n return data;\n }\n return list.tagName === 'UL' ? 'bullet' : 'ordered';\n}\n\nfunction createList(document: Document, kind: TxListKind): HTMLElement {\n const list = document.createElement(kind === 'ordered' ? 'ol' : 'ul');\n if (kind === 'checked' || kind === 'unchecked') {\n list.setAttribute('data-type', 'taskList');\n }\n return list;\n}\n\nfunction sameListKind(a: TxListKind, b: TxListKind): boolean {\n const task = (kind: TxListKind) => kind === 'checked' || kind === 'unchecked';\n return a === b || (task(a) && task(b));\n}\n\nfunction convertQuillList(list: Element): void {\n const document = list.ownerDocument;\n const items = Array.from(list.children).filter((child) => child.tagName === 'LI');\n const fragment = document.createDocumentFragment();\n const stack: { level: number; kind: TxListKind; element: HTMLElement }[] = [];\n for (const item of items) {\n const kind = quillListKind(item, list);\n const level = Number(classValue(item, 'ql-indent-') ?? 0);\n while (stack.length && stack[stack.length - 1].level > level) {\n stack.pop();\n }\n const top = stack[stack.length - 1];\n if (top && top.level === level && !sameListKind(top.kind, kind)) {\n stack.pop();\n }\n if (!stack.length || stack[stack.length - 1].level < level) {\n const element = createList(document, kind);\n const parent = stack[stack.length - 1];\n if (parent) {\n const lastItem = parent.element.lastElementChild ?? parent.element.appendChild(document.createElement('li'));\n lastItem.appendChild(element);\n } else {\n fragment.appendChild(element);\n }\n stack.push({ level, kind, element });\n }\n const current = stack[stack.length - 1];\n const next = document.createElement('li');\n const paragraph = document.createElement('p');\n const align = classValue(item, 'ql-align-');\n if (align && ALIGNMENTS.includes(align)) {\n paragraph.style.textAlign = align;\n }\n item.querySelectorAll('.ql-ui').forEach((node) => node.remove());\n paragraph.append(...Array.from(item.childNodes));\n if (kind === 'checked' || kind === 'unchecked') {\n next.setAttribute('data-type', 'taskItem');\n next.setAttribute('data-checked', String(kind === 'checked'));\n }\n next.appendChild(paragraph);\n current.element.appendChild(next);\n }\n list.replaceWith(fragment);\n}\n\nfunction convertQuillCode(container: Element): void {\n const document = container.ownerDocument;\n const lines = Array.from(container.querySelectorAll('.ql-code-block'));\n const pre = document.createElement('pre');\n const code = document.createElement('code');\n const language = lines[0]?.getAttribute('data-language');\n if (language && language !== 'plain') {\n code.className = `language-${language}`;\n }\n code.textContent = lines.map((line) => line.textContent ?? '').join('\\n');\n pre.appendChild(code);\n container.replaceWith(pre);\n}\n\nexport function isQuillHtml(html: string | null | undefined): boolean {\n return !!html && QUILL_MARKERS.test(html);\n}\n\nexport function fromQuillHtml(html: string | null | undefined): string {\n if (!html) {\n return '';\n }\n if (!isQuillHtml(html)) {\n return html;\n }\n const body = parse(html);\n if (!body) {\n return html;\n }\n body.querySelectorAll('.ql-cursor, .ql-ui').forEach((node) => node.remove());\n body.querySelectorAll('.ql-code-block-container').forEach(convertQuillCode);\n body.querySelectorAll('pre.ql-syntax').forEach((pre) => {\n const code = body.ownerDocument.createElement('code');\n code.textContent = pre.textContent ?? '';\n pre.replaceChildren(code);\n pre.classList.remove('ql-syntax');\n cleanClassAttribute(pre);\n });\n Array.from(body.querySelectorAll('ol, ul'))\n .filter((list) => Array.from(list.children).some((item) => item.hasAttribute('data-list') || /\\bql-indent-/.test(item.className)))\n .filter((list) => !list.parentElement?.closest('ol, ul'))\n .forEach(convertQuillList);\n body.querySelectorAll('[class*=\"ql-\"]').forEach((element) => {\n const style = styleOf(element);\n const align = classValue(element, 'ql-align-');\n if (align && ALIGNMENTS.includes(align) && style) {\n style.textAlign = align;\n }\n const indent = Number(classValue(element, 'ql-indent-') ?? 0);\n if (indent > 0 && style) {\n element.setAttribute('data-indent', String(indent));\n style.marginLeft = `${indent * INDENT_STEP_EM}em`;\n }\n const size = classValue(element, 'ql-size-');\n if (size && QUILL_SIZES[size] && style) {\n style.fontSize = QUILL_SIZES[size];\n }\n const font = classValue(element, 'ql-font-');\n if (font && QUILL_FONTS[font] && style) {\n style.fontFamily = QUILL_FONTS[font];\n }\n if (classValue(element, 'ql-direction-') === 'rtl') {\n element.setAttribute('dir', 'rtl');\n }\n if (element.tagName === 'IFRAME' && element.classList.contains('ql-video')) {\n element.classList.remove('ql-video');\n element.setAttribute('data-type', 'video');\n }\n cleanClassAttribute(element);\n });\n return body.innerHTML;\n}\n\nfunction flattenList(list: Element, level: number, out: HTMLElement): void {\n const document = list.ownerDocument;\n const task = list.getAttribute('data-type') === 'taskList';\n for (const item of Array.from(list.children).filter((child) => child.tagName === 'LI')) {\n const kind: TxListKind = task ? (item.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked') : list.tagName === 'OL' ? 'ordered' : 'bullet';\n const next = document.createElement('li');\n next.setAttribute('data-list', kind);\n if (level > 0) {\n next.classList.add(`ql-indent-${level}`);\n }\n const nested: Element[] = [];\n const blocks = task ? Array.from(item.querySelector(':scope > div')?.children ?? item.children) : Array.from(item.children);\n const inline: Node[] = [];\n for (const child of blocks) {\n if (child.tagName === 'UL' || child.tagName === 'OL') {\n nested.push(child);\n } else if (child.tagName === 'LABEL') {\n continue;\n } else {\n const align = styleOf(child)?.textAlign;\n if (align && ALIGNMENTS.includes(align) && align !== 'left') {\n next.classList.add(`ql-align-${align}`);\n }\n if (inline.length) {\n inline.push(document.createElement('br'));\n }\n inline.push(...Array.from(child.childNodes));\n }\n }\n next.append(...inline);\n out.appendChild(next);\n nested.forEach((child) => flattenList(child, level + 1, out));\n }\n}\n\nexport function toQuillHtml(html: string | null | undefined): string {\n if (!html) {\n return '';\n }\n const body = parse(html);\n if (!body) {\n return html;\n }\n const document = body.ownerDocument;\n const topLists = Array.from(body.querySelectorAll('ol, ul')).filter((list) => !list.parentElement?.closest('ol, ul'));\n let previous: HTMLElement | null = null;\n for (const list of topLists) {\n const target: HTMLElement = previous && previous.nextSibling === list ? previous : document.createElement('ol');\n flattenList(list, 0, target);\n if (target === previous) {\n list.remove();\n } else {\n list.replaceWith(target);\n }\n previous = target;\n }\n body.querySelectorAll('pre').forEach((pre) => {\n const code = pre.querySelector('code');\n const language = Array.from(code?.classList ?? []).find((name) => name.startsWith('language-'))?.slice(9) ?? 'plain';\n const container = document.createElement('div');\n container.className = 'ql-code-block-container';\n container.setAttribute('spellcheck', 'false');\n for (const line of (code?.textContent ?? pre.textContent ?? '').split('\\n')) {\n const block = document.createElement('div');\n block.className = 'ql-code-block';\n block.setAttribute('data-language', language);\n block.textContent = line;\n if (!line) {\n block.appendChild(document.createElement('br'));\n }\n container.appendChild(block);\n }\n pre.replaceWith(container);\n });\n body.querySelectorAll('[style], [data-indent], [dir], iframe[data-type=\"video\"]').forEach((element) => {\n const style = styleOf(element);\n if (style?.textAlign && ALIGNMENTS.includes(style.textAlign)) {\n if (style.textAlign !== 'left') {\n element.classList.add(`ql-align-${style.textAlign}`);\n }\n style.removeProperty('text-align');\n }\n const indent = indentLevel(element);\n if (indent > 0) {\n element.classList.add(`ql-indent-${indent}`);\n }\n element.removeAttribute('data-indent');\n style?.removeProperty('margin-left');\n const size = Object.entries(QUILL_SIZES).find(([, value]) => value === style?.fontSize)?.[0];\n if (size) {\n element.classList.add(`ql-size-${size}`);\n style?.removeProperty('font-size');\n }\n const font = Object.entries(QUILL_FONTS).find(([, value]) => value === style?.fontFamily)?.[0];\n if (font) {\n element.classList.add(`ql-font-${font}`);\n style?.removeProperty('font-family');\n }\n if (element.getAttribute('dir') === 'rtl') {\n element.classList.add('ql-direction-rtl');\n element.removeAttribute('dir');\n }\n if (element.tagName === 'IFRAME') {\n element.removeAttribute('data-type');\n element.classList.add('ql-video');\n element.setAttribute('frameborder', '0');\n element.setAttribute('allowfullscreen', 'true');\n }\n if (element.getAttribute('style') === '') {\n element.removeAttribute('style');\n }\n });\n body.querySelectorAll('p:empty, h1:empty, h2:empty, h3:empty, h4:empty, h5:empty, h6:empty').forEach((block) => block.appendChild(document.createElement('br')));\n return body.innerHTML;\n}\n\nexport function toEditorHtml(html: string | null | undefined): string {\n return fromQuillHtml(html);\n}\n\nexport function formatEditorHtml(html: string, format: TxEditorFormat): string {\n return format === 'quill' ? toQuillHtml(html) : html;\n}\n","const ALLOWED_TAGS = new Set([\n 'p', 'br', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'strong', 'b', 'em', 'i', 'u', 's', 'strike', 'del', 'code', 'pre',\n 'blockquote', 'ul', 'ol', 'li', 'a', 'img', 'span', 'sub', 'sup', 'hr', 'mark', 'div', 'label', 'input',\n 'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td', 'colgroup', 'col', 'iframe',\n]);\n\nconst DROP_WITH_CONTENT = new Set(['script', 'style', 'template', 'noscript', 'object', 'embed', 'svg', 'math', 'textarea', 'select', 'button', 'form']);\n\nconst ALLOWED_ATTRIBUTES = new Set([\n 'class', 'style', 'href', 'target', 'rel', 'src', 'alt', 'title', 'width', 'height', 'colspan', 'rowspan', 'start', 'dir',\n 'data-list', 'data-type', 'data-checked', 'data-indent', 'data-language', 'data-id', 'data-label', 'data-mention-suggestion-char',\n 'colwidth', 'data-colwidth', 'data-tone', 'type', 'checked', 'disabled', 'frameborder', 'allowfullscreen', 'spellcheck',\n]);\n\nconst ALLOWED_STYLES = new Set(['color', 'background-color', 'text-align', 'font-size', 'font-family', 'margin-left', 'padding-left', 'width', 'min-width']);\n\nconst SAFE_STYLE_VALUE = /^[#(),.%\\w\\s'\"-]+$/;\nconst SAFE_CLASS = /^(ql-[\\w-]+|tx-[\\w-]+|language-[\\w-]+)$/;\nconst SAFE_LINK = /^(https?:|mailto:|tel:|sms:|#|\\/(?!\\/))/i;\nconst SAFE_IMAGE = /^(https?:|data:image\\/(png|jpe?g|gif|webp|avif|bmp|svg\\+xml);base64,|blob:|\\/(?!\\/))/i;\nconst SAFE_FRAME = /^https:\\/\\//i;\n\nfunction cleanStyle(value: string): string {\n return value\n .split(';')\n .map((declaration) => declaration.split(':'))\n .filter(([property, ...rest]) => property && rest.length)\n .map(([property, ...rest]) => [property.trim().toLowerCase(), rest.join(':').trim()])\n .filter(([property, propertyValue]) => ALLOWED_STYLES.has(property) && SAFE_STYLE_VALUE.test(propertyValue) && !/url\\s*\\(|expression\\s*\\(/i.test(propertyValue))\n .map(([property, propertyValue]) => `${property}: ${propertyValue}`)\n .join('; ');\n}\n\nfunction cleanAttribute(element: Element, name: string, value: string): string | null {\n const tag = element.tagName.toLowerCase();\n switch (name) {\n case 'style': {\n const style = cleanStyle(value);\n return style || null;\n }\n case 'class': {\n const classes = value.split(/\\s+/).filter((item) => SAFE_CLASS.test(item));\n return classes.length ? classes.join(' ') : null;\n }\n case 'href':\n return tag === 'a' && SAFE_LINK.test(value.trim()) ? value.trim() : null;\n case 'src':\n if (tag === 'img') {\n return SAFE_IMAGE.test(value.trim()) ? value.trim() : null;\n }\n return tag === 'iframe' && SAFE_FRAME.test(value.trim()) ? value.trim() : null;\n case 'target':\n return value === '_blank' ? value : null;\n case 'type':\n return tag === 'input' && value === 'checkbox' ? value : null;\n default:\n return value;\n }\n}\n\nfunction cleanNode(node: Node): void {\n for (const child of Array.from(node.childNodes)) {\n if (child.nodeType === 3) {\n continue;\n }\n if (child.nodeType !== 1) {\n child.remove();\n continue;\n }\n const element = child as Element;\n const tag = element.tagName.toLowerCase();\n if (DROP_WITH_CONTENT.has(tag)) {\n element.remove();\n continue;\n }\n if (!ALLOWED_TAGS.has(tag)) {\n cleanNode(element);\n element.replaceWith(...Array.from(element.childNodes));\n continue;\n }\n for (const attribute of Array.from(element.attributes)) {\n const name = attribute.name.toLowerCase();\n const cleaned = ALLOWED_ATTRIBUTES.has(name) ? cleanAttribute(element, name, attribute.value) : null;\n if (cleaned === null) {\n element.removeAttribute(attribute.name);\n } else if (cleaned !== attribute.value) {\n element.setAttribute(attribute.name, cleaned);\n }\n }\n if (tag === 'a' && element.getAttribute('target') === '_blank') {\n element.setAttribute('rel', 'noopener noreferrer nofollow');\n }\n if (tag === 'input') {\n element.setAttribute('disabled', '');\n }\n if (tag === 'iframe') {\n if (!element.getAttribute('src')) {\n element.remove();\n continue;\n }\n element.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-presentation allow-popups');\n element.setAttribute('loading', 'lazy');\n }\n cleanNode(element);\n }\n}\n\nexport function sanitizeEditorHtml(html: string | null | undefined): string {\n if (!html) {\n return '';\n }\n const Parser = globalThis.DOMParser;\n if (!Parser) {\n return '';\n }\n const body = new Parser().parseFromString(`<body>${html}</body>`, 'text/html').body;\n cleanNode(body);\n return body.innerHTML;\n}\n","import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'tx-editor-prose-styles',\n template: '',\n styleUrl: './editor-prose.styles.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TxEditorProseStyles {}\n","import { ChangeDetectionStrategy, Component, ElementRef, afterRenderEffect, booleanAttribute, computed, inject, input, output, signal, viewChild } from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { TxPassThrough, TxPassThroughOptions, injectPassThrough, injectUnstyled } from '@tectra-ng/core/config';\nimport { injectTranslations } from '@tectra-ng/core/i18n';\nimport { TxStyleLoader } from '@tectra-ng/core/styles';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraDeepPartial, TectraEditorContentTokens, toStyleObject } from '@tectra-ng/themes';\nimport { TxDialog } from '@tectra-ng/ui/dialog';\nimport { TxEditorContentPart, TxEditorImageClickEvent } from './editor-content.types';\nimport { fromQuillHtml } from './editor-html';\nimport { TxEditorProseStyles } from './editor-prose-styles.component';\nimport { sanitizeEditorHtml } from './editor-sanitizer';\n\n@Component({\n selector: 'tx-editor-content',\n imports: [TxDialog],\n template: `\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- clicks and keys come from the images inside, which get a tab stop -->\n <div\n #body\n class=\"tx-editor-content__body\"\n [class.tx-editor-prose]=\"!isUnstyled()\"\n [class]=\"passThrough().body?.class\"\n [style]=\"passThrough().body?.style\"\n [innerHTML]=\"safeHtml()\"\n (click)=\"onClick($event)\"\n (keydown)=\"onKeydown($event)\"\n ></div>\n @if (previewImages()) {\n <tx-dialog\n size=\"large\"\n [header]=\"preview()?.alt || translations().editorImagePreview\"\n [visible]=\"previewOpen()\"\n (visibleChange)=\"previewOpen.set($event)\"\n >\n @if (preview(); as image) {\n <img class=\"tx-editor-content__preview\" [src]=\"image.src\" [alt]=\"image.alt\" />\n }\n </tx-dialog>\n }\n `,\n styleUrl: './editor-content.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-editor-content',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[class.tx-editor-content--zoom]': 'previewImages()',\n },\n})\nexport class TxEditorContent {\n private sanitizer = inject(DomSanitizer);\n\n readonly html = input<string | null | undefined>(null);\n readonly previewImages = input(true, { transform: booleanAttribute });\n readonly dt = input<TectraDeepPartial<TectraEditorContentTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxEditorContentPart, TxEditorContent> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly imageClick = output<TxEditorImageClickEvent>();\n\n readonly translations = injectTranslations();\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('editorContent', this, this.pt, this.ptOptions);\n private readonly body = viewChild<ElementRef<HTMLElement>>('body');\n protected readonly preview = signal<{ src: string; alt: string } | null>(null);\n protected readonly previewOpen = signal(false);\n protected readonly safeHtml = computed(() => this.sanitizer.bypassSecurityTrustHtml(sanitizeEditorHtml(fromQuillHtml(this.html()))));\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-editor-content'), ...this.passThrough().root?.style }));\n\n constructor() {\n inject(TxStyleLoader).load(TxEditorProseStyles);\n afterRenderEffect(() => {\n this.safeHtml();\n const preview = this.previewImages();\n this.body()\n ?.nativeElement.querySelectorAll('img')\n .forEach((image) => {\n if (preview) {\n image.setAttribute('tabindex', '0');\n image.setAttribute('role', 'button');\n } else {\n image.removeAttribute('tabindex');\n image.removeAttribute('role');\n }\n });\n });\n }\n\n protected onClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n if (target instanceof HTMLImageElement) {\n this.open(target, event);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const target = event.target as HTMLElement | null;\n if (target instanceof HTMLImageElement && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n this.open(target, event);\n }\n }\n\n private open(target: HTMLImageElement, event: Event): void {\n const image = { src: target.currentSrc || target.src, alt: target.alt };\n this.imageClick.emit({ originalEvent: event as MouseEvent | KeyboardEvent, ...image });\n if (this.previewImages()) {\n this.preview.set(image);\n this.previewOpen.set(true);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A,CAAA,YAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"tectra-ng-editor-content.mjs","names":[],"sources":["../../../../packages/editor/content/src/parse-html.ts","../../../../packages/editor/content/src/editor-html.ts","../../../../packages/editor/content/src/editor-sanitizer.ts","../../../../packages/editor/content/src/editor-prose-styles.component.ts","../../../../packages/editor/content/src/editor-content.component.ts"],"sourcesContent":["export function parseHtmlBody(html: string, document?: Document | null): HTMLElement | null {\n const Parser = globalThis.DOMParser;\n if (Parser) {\n return new Parser().parseFromString(`<body>${html}</body>`, 'text/html').body;\n }\n const inert = document?.implementation.createHTMLDocument('');\n if (!inert) {\n return null;\n }\n inert.body.innerHTML = html;\n return inert.body;\n}\n\nexport function appendNodes(parent: Node, nodes: Iterable<Node>): void {\n for (const node of Array.from(nodes)) {\n parent.appendChild(node);\n }\n}\n\nexport function replaceNode(node: Node, replacement: Node): void {\n node.parentNode?.replaceChild(replacement, node);\n}\n\nexport function unwrapNode(node: Node): void {\n const parent = node.parentNode;\n if (!parent) {\n return;\n }\n for (const child of Array.from(node.childNodes)) {\n parent.insertBefore(child, node);\n }\n parent.removeChild(node);\n}\n","import { TxEditorFormat } from './editor-content.types';\nimport { appendNodes, parseHtmlBody, replaceNode } from './parse-html';\n\nconst QUILL_SIZES: Record<string, string> = { small: '0.75em', large: '1.5em', huge: '2.5em' };\nconst QUILL_FONTS: Record<string, string> = { serif: 'serif', monospace: 'monospace' };\nconst INDENT_STEP_EM = 3;\nconst ALIGNMENTS = ['left', 'center', 'right', 'justify'];\nconst QUILL_MARKERS = /data-list=|class=\"[^\"]*\\bql-|ql-code-block|ql-video/;\n\ntype TxListKind = 'bullet' | 'ordered' | 'checked' | 'unchecked';\n\nfunction classValue(element: Element, prefix: string): string | null {\n const match = Array.from(element.classList).find((name) => name.startsWith(prefix));\n if (!match) {\n return null;\n }\n element.classList.remove(match);\n return match.slice(prefix.length);\n}\n\nfunction cleanClassAttribute(element: Element): void {\n if (element.getAttribute('class') === '') {\n element.removeAttribute('class');\n }\n}\n\nfunction styleOf(element: Element): CSSStyleDeclaration | null {\n return (element as HTMLElement).style ?? null;\n}\n\nfunction indentLevel(element: Element): number {\n const value = Number(element.getAttribute('data-indent') ?? NaN);\n if (!Number.isNaN(value)) {\n return value;\n }\n const margin = styleOf(element)?.marginLeft ?? '';\n return margin.endsWith('em') ? Math.round(parseFloat(margin) / INDENT_STEP_EM) : 0;\n}\n\nfunction quillListKind(item: Element, list: Element): TxListKind {\n const data = item.getAttribute('data-list');\n if (data === 'bullet' || data === 'ordered' || data === 'checked' || data === 'unchecked') {\n return data;\n }\n return list.tagName === 'UL' ? 'bullet' : 'ordered';\n}\n\nfunction createList(document: Document, kind: TxListKind): HTMLElement {\n const list = document.createElement(kind === 'ordered' ? 'ol' : 'ul');\n if (kind === 'checked' || kind === 'unchecked') {\n list.setAttribute('data-type', 'taskList');\n }\n return list;\n}\n\nfunction sameListKind(a: TxListKind, b: TxListKind): boolean {\n const task = (kind: TxListKind) => kind === 'checked' || kind === 'unchecked';\n return a === b || (task(a) && task(b));\n}\n\nfunction convertQuillList(list: Element): void {\n const document = list.ownerDocument;\n const items = Array.from(list.children).filter((child) => child.tagName === 'LI');\n const fragment = document.createDocumentFragment();\n const stack: { level: number; kind: TxListKind; element: HTMLElement }[] = [];\n for (const item of items) {\n const kind = quillListKind(item, list);\n const level = Number(classValue(item, 'ql-indent-') ?? 0);\n while (stack.length && stack[stack.length - 1].level > level) {\n stack.pop();\n }\n const top = stack[stack.length - 1];\n if (top && top.level === level && !sameListKind(top.kind, kind)) {\n stack.pop();\n }\n if (!stack.length || stack[stack.length - 1].level < level) {\n const element = createList(document, kind);\n const parent = stack[stack.length - 1];\n if (parent) {\n const lastItem = parent.element.lastElementChild ?? parent.element.appendChild(document.createElement('li'));\n lastItem.appendChild(element);\n } else {\n fragment.appendChild(element);\n }\n stack.push({ level, kind, element });\n }\n const current = stack[stack.length - 1];\n const next = document.createElement('li');\n const paragraph = document.createElement('p');\n const align = classValue(item, 'ql-align-');\n if (align && ALIGNMENTS.includes(align)) {\n paragraph.style.textAlign = align;\n }\n item.querySelectorAll('.ql-ui').forEach((node) => node.remove());\n appendNodes(paragraph, item.childNodes);\n if (kind === 'checked' || kind === 'unchecked') {\n next.setAttribute('data-type', 'taskItem');\n next.setAttribute('data-checked', String(kind === 'checked'));\n }\n next.appendChild(paragraph);\n current.element.appendChild(next);\n }\n replaceNode(list, fragment);\n}\n\nfunction convertQuillCode(container: Element): void {\n const document = container.ownerDocument;\n const lines = Array.from(container.querySelectorAll('.ql-code-block'));\n const pre = document.createElement('pre');\n const code = document.createElement('code');\n const language = lines[0]?.getAttribute('data-language');\n if (language && language !== 'plain') {\n code.className = `language-${language}`;\n }\n code.textContent = lines.map((line) => line.textContent ?? '').join('\\n');\n pre.appendChild(code);\n replaceNode(container, pre);\n}\n\nexport function isQuillHtml(html: string | null | undefined): boolean {\n return !!html && QUILL_MARKERS.test(html);\n}\n\nexport function fromQuillHtml(html: string | null | undefined, document?: Document | null): string {\n if (!html) {\n return '';\n }\n if (!isQuillHtml(html)) {\n return html;\n }\n const body = parseHtmlBody(html, document);\n if (!body) {\n return html;\n }\n body.querySelectorAll('.ql-cursor, .ql-ui').forEach((node) => node.remove());\n body.querySelectorAll('.ql-code-block-container').forEach(convertQuillCode);\n body.querySelectorAll('pre.ql-syntax').forEach((pre) => {\n const code = body.ownerDocument.createElement('code');\n code.textContent = pre.textContent ?? '';\n pre.textContent = '';\n pre.appendChild(code);\n pre.classList.remove('ql-syntax');\n cleanClassAttribute(pre);\n });\n Array.from(body.querySelectorAll('ol, ul'))\n .filter((list) => Array.from(list.children).some((item) => item.hasAttribute('data-list') || /\\bql-indent-/.test(item.className)))\n .filter((list) => !list.parentElement?.closest('ol, ul'))\n .forEach(convertQuillList);\n body.querySelectorAll('[class*=\"ql-\"]').forEach((element) => {\n const style = styleOf(element);\n const align = classValue(element, 'ql-align-');\n if (align && ALIGNMENTS.includes(align) && style) {\n style.textAlign = align;\n }\n const indent = Number(classValue(element, 'ql-indent-') ?? 0);\n if (indent > 0 && style) {\n element.setAttribute('data-indent', String(indent));\n style.marginLeft = `${indent * INDENT_STEP_EM}em`;\n }\n const size = classValue(element, 'ql-size-');\n if (size && QUILL_SIZES[size] && style) {\n style.fontSize = QUILL_SIZES[size];\n }\n const font = classValue(element, 'ql-font-');\n if (font && QUILL_FONTS[font] && style) {\n style.fontFamily = QUILL_FONTS[font];\n }\n if (classValue(element, 'ql-direction-') === 'rtl') {\n element.setAttribute('dir', 'rtl');\n }\n if (element.tagName === 'IFRAME' && element.classList.contains('ql-video')) {\n element.classList.remove('ql-video');\n element.setAttribute('data-type', 'video');\n }\n cleanClassAttribute(element);\n });\n return body.innerHTML;\n}\n\nfunction flattenList(list: Element, level: number, out: HTMLElement): void {\n const document = list.ownerDocument;\n const task = list.getAttribute('data-type') === 'taskList';\n for (const item of Array.from(list.children).filter((child) => child.tagName === 'LI')) {\n const kind: TxListKind = task ? (item.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked') : list.tagName === 'OL' ? 'ordered' : 'bullet';\n const next = document.createElement('li');\n next.setAttribute('data-list', kind);\n if (level > 0) {\n next.classList.add(`ql-indent-${level}`);\n }\n const nested: Element[] = [];\n const blocks = task ? Array.from(item.querySelector(':scope > div')?.children ?? item.children) : Array.from(item.children);\n const inline: Node[] = [];\n for (const child of blocks) {\n if (child.tagName === 'UL' || child.tagName === 'OL') {\n nested.push(child);\n } else if (child.tagName === 'LABEL') {\n continue;\n } else {\n const align = styleOf(child)?.textAlign;\n if (align && ALIGNMENTS.includes(align) && align !== 'left') {\n next.classList.add(`ql-align-${align}`);\n }\n if (inline.length) {\n inline.push(document.createElement('br'));\n }\n inline.push(...Array.from(child.childNodes));\n }\n }\n appendNodes(next, inline);\n out.appendChild(next);\n nested.forEach((child) => flattenList(child, level + 1, out));\n }\n}\n\nexport function toQuillHtml(html: string | null | undefined, document?: Document | null): string {\n if (!html) {\n return '';\n }\n const body = parseHtmlBody(html, document);\n if (!body) {\n return html;\n }\n const owner = body.ownerDocument;\n const topLists = Array.from(body.querySelectorAll('ol, ul')).filter((list) => !list.parentElement?.closest('ol, ul'));\n let previous: HTMLElement | null = null;\n for (const list of topLists) {\n const target: HTMLElement = previous && previous.nextSibling === list ? previous : owner.createElement('ol');\n flattenList(list, 0, target);\n if (target === previous) {\n list.remove();\n } else {\n replaceNode(list, target);\n }\n previous = target;\n }\n body.querySelectorAll('pre').forEach((pre) => {\n const code = pre.querySelector('code');\n const language = Array.from(code?.classList ?? []).find((name) => name.startsWith('language-'))?.slice(9) ?? 'plain';\n const container = owner.createElement('div');\n container.className = 'ql-code-block-container';\n container.setAttribute('spellcheck', 'false');\n for (const line of (code?.textContent ?? pre.textContent ?? '').split('\\n')) {\n const block = owner.createElement('div');\n block.className = 'ql-code-block';\n block.setAttribute('data-language', language);\n block.textContent = line;\n if (!line) {\n block.appendChild(owner.createElement('br'));\n }\n container.appendChild(block);\n }\n replaceNode(pre, container);\n });\n body.querySelectorAll('[style], [data-indent], [dir], iframe[data-type=\"video\"]').forEach((element) => {\n const style = styleOf(element);\n if (style?.textAlign && ALIGNMENTS.includes(style.textAlign)) {\n if (style.textAlign !== 'left') {\n element.classList.add(`ql-align-${style.textAlign}`);\n }\n style.removeProperty('text-align');\n }\n const indent = indentLevel(element);\n if (indent > 0) {\n element.classList.add(`ql-indent-${indent}`);\n }\n element.removeAttribute('data-indent');\n style?.removeProperty('margin-left');\n const size = Object.entries(QUILL_SIZES).find(([, value]) => value === style?.fontSize)?.[0];\n if (size) {\n element.classList.add(`ql-size-${size}`);\n style?.removeProperty('font-size');\n }\n const font = Object.entries(QUILL_FONTS).find(([, value]) => value === style?.fontFamily)?.[0];\n if (font) {\n element.classList.add(`ql-font-${font}`);\n style?.removeProperty('font-family');\n }\n if (element.getAttribute('dir') === 'rtl') {\n element.classList.add('ql-direction-rtl');\n element.removeAttribute('dir');\n }\n if (element.tagName === 'IFRAME') {\n element.removeAttribute('data-type');\n element.classList.add('ql-video');\n element.setAttribute('frameborder', '0');\n element.setAttribute('allowfullscreen', 'true');\n }\n if (element.getAttribute('style') === '') {\n element.removeAttribute('style');\n }\n });\n body.querySelectorAll('p:empty, h1:empty, h2:empty, h3:empty, h4:empty, h5:empty, h6:empty').forEach((block) => block.appendChild(owner.createElement('br')));\n return body.innerHTML;\n}\n\nexport function toEditorHtml(html: string | null | undefined, document?: Document | null): string {\n return fromQuillHtml(html, document);\n}\n\nexport function formatEditorHtml(html: string, format: TxEditorFormat, document?: Document | null): string {\n return format === 'quill' ? toQuillHtml(html, document) : html;\n}\n","import { parseHtmlBody, unwrapNode } from './parse-html';\n\nconst ALLOWED_TAGS = new Set([\n 'p', 'br', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'strong', 'b', 'em', 'i', 'u', 's', 'strike', 'del', 'code', 'pre',\n 'blockquote', 'ul', 'ol', 'li', 'a', 'img', 'span', 'sub', 'sup', 'hr', 'mark', 'div', 'label', 'input',\n 'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td', 'colgroup', 'col', 'iframe',\n]);\n\nconst DROP_WITH_CONTENT = new Set(['script', 'style', 'template', 'noscript', 'object', 'embed', 'svg', 'math', 'textarea', 'select', 'button', 'form']);\n\nconst ALLOWED_ATTRIBUTES = new Set([\n 'class', 'style', 'href', 'target', 'rel', 'src', 'alt', 'title', 'width', 'height', 'colspan', 'rowspan', 'start', 'dir',\n 'data-list', 'data-type', 'data-checked', 'data-indent', 'data-language', 'data-id', 'data-label', 'data-mention-suggestion-char',\n 'colwidth', 'data-colwidth', 'data-tone', 'type', 'checked', 'disabled', 'frameborder', 'allowfullscreen', 'spellcheck',\n]);\n\nconst ALLOWED_STYLES = new Set(['color', 'background-color', 'text-align', 'font-size', 'font-family', 'margin-left', 'padding-left', 'width', 'min-width']);\n\nconst SAFE_STYLE_VALUE = /^[#(),.%\\w\\s'\"-]+$/;\nconst SAFE_CLASS = /^(ql-[\\w-]+|tx-[\\w-]+|language-[\\w-]+)$/;\nconst SAFE_LINK = /^(https?:|mailto:|tel:|sms:|#|\\/(?!\\/))/i;\nconst SAFE_IMAGE = /^(https?:|data:image\\/(png|jpe?g|gif|webp|avif|bmp|svg\\+xml);base64,|blob:|\\/(?!\\/))/i;\nconst SAFE_FRAME = /^https:\\/\\//i;\n\nfunction cleanStyle(value: string): string {\n return value\n .split(';')\n .map((declaration) => declaration.split(':'))\n .filter(([property, ...rest]) => property && rest.length)\n .map(([property, ...rest]) => [property.trim().toLowerCase(), rest.join(':').trim()])\n .filter(([property, propertyValue]) => ALLOWED_STYLES.has(property) && SAFE_STYLE_VALUE.test(propertyValue) && !/url\\s*\\(|expression\\s*\\(/i.test(propertyValue))\n .map(([property, propertyValue]) => `${property}: ${propertyValue}`)\n .join('; ');\n}\n\nfunction cleanAttribute(element: Element, name: string, value: string): string | null {\n const tag = element.tagName.toLowerCase();\n switch (name) {\n case 'style': {\n const style = cleanStyle(value);\n return style || null;\n }\n case 'class': {\n const classes = value.split(/\\s+/).filter((item) => SAFE_CLASS.test(item));\n return classes.length ? classes.join(' ') : null;\n }\n case 'href':\n return tag === 'a' && SAFE_LINK.test(value.trim()) ? value.trim() : null;\n case 'src':\n if (tag === 'img') {\n return SAFE_IMAGE.test(value.trim()) ? value.trim() : null;\n }\n return tag === 'iframe' && SAFE_FRAME.test(value.trim()) ? value.trim() : null;\n case 'target':\n return value === '_blank' ? value : null;\n case 'type':\n return tag === 'input' && value === 'checkbox' ? value : null;\n default:\n return value;\n }\n}\n\nfunction cleanNode(node: Node): void {\n for (const child of Array.from(node.childNodes)) {\n if (child.nodeType === 3) {\n continue;\n }\n if (child.nodeType !== 1) {\n child.remove();\n continue;\n }\n const element = child as Element;\n const tag = element.tagName.toLowerCase();\n if (DROP_WITH_CONTENT.has(tag)) {\n element.remove();\n continue;\n }\n if (!ALLOWED_TAGS.has(tag)) {\n cleanNode(element);\n unwrapNode(element);\n continue;\n }\n for (const attribute of Array.from(element.attributes)) {\n const name = attribute.name.toLowerCase();\n const cleaned = ALLOWED_ATTRIBUTES.has(name) ? cleanAttribute(element, name, attribute.value) : null;\n if (cleaned === null) {\n element.removeAttribute(attribute.name);\n } else if (cleaned !== attribute.value) {\n element.setAttribute(attribute.name, cleaned);\n }\n }\n if (tag === 'a' && element.getAttribute('target') === '_blank') {\n element.setAttribute('rel', 'noopener noreferrer nofollow');\n }\n if (tag === 'input') {\n element.setAttribute('disabled', '');\n }\n if (tag === 'iframe') {\n if (!element.getAttribute('src')) {\n element.remove();\n continue;\n }\n element.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-presentation allow-popups');\n element.setAttribute('loading', 'lazy');\n }\n cleanNode(element);\n }\n}\n\nexport function sanitizeEditorHtml(html: string | null | undefined, document?: Document | null): string {\n if (!html) {\n return '';\n }\n const body = parseHtmlBody(html, document);\n if (!body) {\n return '';\n }\n cleanNode(body);\n return body.innerHTML;\n}\n","import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'tx-editor-prose-styles',\n template: '',\n styleUrl: './editor-prose.styles.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TxEditorProseStyles {}\n","import { ChangeDetectionStrategy, Component, DOCUMENT, ElementRef, afterRenderEffect, booleanAttribute, computed, inject, input, output, signal, viewChild } from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { TxPassThrough, TxPassThroughOptions, injectPassThrough, injectUnstyled } from '@tectra-ng/core/config';\nimport { injectTranslations } from '@tectra-ng/core/i18n';\nimport { TxStyleLoader } from '@tectra-ng/core/styles';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraDeepPartial, TectraEditorContentTokens, toStyleObject } from '@tectra-ng/themes';\nimport { TxDialog } from '@tectra-ng/ui/dialog';\nimport { TxEditorContentPart, TxEditorImageClickEvent } from './editor-content.types';\nimport { fromQuillHtml } from './editor-html';\nimport { TxEditorProseStyles } from './editor-prose-styles.component';\nimport { sanitizeEditorHtml } from './editor-sanitizer';\n\n@Component({\n selector: 'tx-editor-content',\n imports: [TxDialog],\n template: `\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- clicks and keys come from the images inside, which get a tab stop -->\n <div\n #body\n class=\"tx-editor-content__body\"\n [class.tx-editor-prose]=\"!isUnstyled()\"\n [class]=\"passThrough().body?.class\"\n [style]=\"passThrough().body?.style\"\n [innerHTML]=\"safeHtml()\"\n (click)=\"onClick($event)\"\n (keydown)=\"onKeydown($event)\"\n ></div>\n @if (previewImages()) {\n <tx-dialog\n size=\"large\"\n [header]=\"preview()?.alt || translations().editorImagePreview\"\n [visible]=\"previewOpen()\"\n (visibleChange)=\"previewOpen.set($event)\"\n >\n @if (preview(); as image) {\n <img class=\"tx-editor-content__preview\" [src]=\"image.src\" [alt]=\"image.alt\" />\n }\n </tx-dialog>\n }\n `,\n styleUrl: './editor-content.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-editor-content',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[class.tx-editor-content--zoom]': 'previewImages()',\n },\n})\nexport class TxEditorContent {\n private sanitizer = inject(DomSanitizer);\n private document = inject(DOCUMENT);\n\n readonly html = input<string | null | undefined>(null);\n readonly previewImages = input(true, { transform: booleanAttribute });\n readonly dt = input<TectraDeepPartial<TectraEditorContentTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxEditorContentPart, TxEditorContent> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly imageClick = output<TxEditorImageClickEvent>();\n\n readonly translations = injectTranslations();\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('editorContent', this, this.pt, this.ptOptions);\n private readonly body = viewChild<ElementRef<HTMLElement>>('body');\n protected readonly preview = signal<{ src: string; alt: string } | null>(null);\n protected readonly previewOpen = signal(false);\n protected readonly safeHtml = computed(() => this.sanitizer.bypassSecurityTrustHtml(sanitizeEditorHtml(fromQuillHtml(this.html(), this.document), this.document)));\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-editor-content'), ...this.passThrough().root?.style }));\n\n constructor() {\n inject(TxStyleLoader).load(TxEditorProseStyles);\n afterRenderEffect(() => {\n this.safeHtml();\n const preview = this.previewImages();\n this.body()\n ?.nativeElement.querySelectorAll('img')\n .forEach((image) => {\n if (preview) {\n image.setAttribute('tabindex', '0');\n image.setAttribute('role', 'button');\n } else {\n image.removeAttribute('tabindex');\n image.removeAttribute('role');\n }\n });\n });\n }\n\n protected onClick(event: MouseEvent): void {\n const target = event.target as HTMLElement | null;\n if (target instanceof HTMLImageElement) {\n this.open(target, event);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n const target = event.target as HTMLElement | null;\n if (target instanceof HTMLImageElement && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n this.open(target, event);\n }\n }\n\n private open(target: HTMLImageElement, event: Event): void {\n const image = { src: target.currentSrc || target.src, alt: target.alt };\n this.imageClick.emit({ originalEvent: event as MouseEvent | KeyboardEvent, ...image });\n if (this.previewImages()) {\n this.preview.set(image);\n this.previewOpen.set(true);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAgB,cAAc,MAAc,UAA0B;CACpE,MAAM,SAAS,WAAW;CAC1B,IAAI,QACF,OAAO,IAAI,OAAM,CAAE,CAAC,gBAAgB,SAAS,KAAI,UAAW,WAAW,CAAC,CAAC;CAE3E,MAAM,QAAQ,UAAU,eAAe,mBAAmB,EAAE;CAC5D,IAAI,CAAC,OACH,OAAO;CAET,MAAM,KAAK,YAAY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A;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -2112,7 +2112,7 @@ var TxCalloutView = class {
|
|
|
2112
2112
|
};
|
|
2113
2113
|
function parseHtml(html, document) {
|
|
2114
2114
|
const container = document.implementation.createHTMLDocument("").createElement("div");
|
|
2115
|
-
container.innerHTML = fromQuillHtml(html ?? "");
|
|
2115
|
+
container.innerHTML = fromQuillHtml(html ?? "", document);
|
|
2116
2116
|
return DOMParser.fromSchema(txEditorSchema).parse(container, { preserveWhitespace: false });
|
|
2117
2117
|
}
|
|
2118
2118
|
function serializeHtml(doc, document) {
|
|
@@ -4007,7 +4007,7 @@ var TxEditor = class TxEditor extends TxFormControlBase {
|
|
|
4007
4007
|
callout: (node, view, getPos) => new TxCalloutView(node, view, getPos, () => this.translations().editorCalloutTone),
|
|
4008
4008
|
image: (node, view, getPos) => new TxImageView(node, view, getPos)
|
|
4009
4009
|
},
|
|
4010
|
-
transformPastedHTML: (html) => fromQuillHtml(html),
|
|
4010
|
+
transformPastedHTML: (html) => fromQuillHtml(html, this.document),
|
|
4011
4011
|
handlePaste: (view, event) => this.handleFiles(Array.from(event.clipboardData?.files ?? []), null) || this.pasteLink(view, event),
|
|
4012
4012
|
handleDrop: (view, event) => {
|
|
4013
4013
|
const files = Array.from(event.dataTransfer?.files ?? []);
|
|
@@ -4084,7 +4084,7 @@ var TxEditor = class TxEditor extends TxFormControlBase {
|
|
|
4084
4084
|
});
|
|
4085
4085
|
}
|
|
4086
4086
|
serialize(doc) {
|
|
4087
|
-
return formatEditorHtml(serializeHtml(doc, this.document), this.format());
|
|
4087
|
+
return formatEditorHtml(serializeHtml(doc, this.document), this.format(), this.document);
|
|
4088
4088
|
}
|
|
4089
4089
|
applyExternal(html) {
|
|
4090
4090
|
if (!this.view || (html ?? "") === this.lastValue) return;
|