@uva-glass/component-library 3.42.3 → 3.42.4
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.
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
import { g as s } from "../../LexicalLink.prod-ZZwC5ABn.js";
|
|
2
2
|
import { r as n, Y as i } from "../../LexicalList.prod-UurCu6DK.js";
|
|
3
3
|
import { ae as a, q as c } from "../../Lexical.prod-qYl_ifJ6.js";
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
6
|
-
let r =
|
|
4
|
+
import { y as m } from "../../LexicalTable.prod-COFf1Spn.js";
|
|
5
|
+
const d = (e) => /^<(b|i|u|strong|em|mark|small|del|ins|sub|sup|div|p|span|h[1-6]|a|img|table|tr|td|th|ul|ol|li|blockquote|pre|code|br)(\s+[^>]*)?>/i.test(e.trim()), f = (e) => {
|
|
6
|
+
let r = e.replace(/<b><strong>/gi, "<strong>");
|
|
7
7
|
return r = r.replace(/<\/strong><\/b>/gi, "</strong>"), r;
|
|
8
|
-
},
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
for (const
|
|
12
|
-
|
|
13
|
-
return
|
|
14
|
-
},
|
|
15
|
-
[a,
|
|
16
|
-
[c,
|
|
17
|
-
[n,
|
|
18
|
-
[i,
|
|
19
|
-
[m,
|
|
20
|
-
[
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
e.scrollHeight > e.clientHeight && e.addEventListener("scroll", t);
|
|
8
|
+
}, h = (e) => e.replace(/<div[^>]*>\s*(<table[\s\S]*?<\/table>)\s*<\/div>/gi, "$1"), o = (e, r) => {
|
|
9
|
+
const t = r.exportDOM(e);
|
|
10
|
+
if (t && t.element instanceof HTMLElement)
|
|
11
|
+
for (const l of [t.element, ...t.element.querySelectorAll('[style],[class],[dir="ltr"]')])
|
|
12
|
+
l.removeAttribute("class"), l.getAttribute("style") && (l.setAttribute("style", ""), l.removeAttribute("style")), l.getAttribute("dir") === "ltr" && l.removeAttribute("dir");
|
|
13
|
+
return t;
|
|
14
|
+
}, v = /* @__PURE__ */ new Map([
|
|
15
|
+
[a, o],
|
|
16
|
+
[c, o],
|
|
17
|
+
[n, o],
|
|
18
|
+
[i, o],
|
|
19
|
+
[m, o],
|
|
20
|
+
[s, o]
|
|
21
|
+
]), y = (e) => {
|
|
22
|
+
document.querySelectorAll("*").forEach((t) => {
|
|
23
|
+
t.scrollHeight > t.clientHeight && t.addEventListener("scroll", e);
|
|
25
24
|
});
|
|
26
|
-
},
|
|
27
|
-
document.querySelectorAll("*").forEach((
|
|
28
|
-
|
|
25
|
+
}, A = (e) => {
|
|
26
|
+
document.querySelectorAll("*").forEach((t) => {
|
|
27
|
+
t.scrollHeight > t.clientHeight && t.removeEventListener("scroll", e);
|
|
29
28
|
});
|
|
30
29
|
};
|
|
31
30
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
h as cleanUpTable,
|
|
32
|
+
v as exportMap,
|
|
33
|
+
d as isStartingWithHtmlTag,
|
|
34
|
+
f as mergeBoldStrongTags,
|
|
35
|
+
A as removeScrollableContainers,
|
|
36
|
+
o as removeStylesExportDOM,
|
|
37
|
+
y as setScrollableContainers
|
|
39
38
|
};
|
|
40
39
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../src/components/RteEditor/helpers.ts"],"sourcesContent":["import { LinkNode } from '@lexical/link';\nimport { ListNode, ListItemNode } from '@lexical/list';\nimport { ParagraphNode, TextNode } from 'lexical';\nimport { TableCellNode
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../src/components/RteEditor/helpers.ts"],"sourcesContent":["import { LinkNode } from '@lexical/link';\nimport { ListNode, ListItemNode } from '@lexical/list';\nimport { ParagraphNode, TextNode } from 'lexical';\nimport { TableCellNode } from '@lexical/table';\n\nimport type { DOMExportOutput, Klass, LexicalEditor, LexicalNode } from 'lexical';\n\nexport const isStartingWithHtmlTag = (str: string): boolean => {\n const htmlTagPattern =\n /^<(b|i|u|strong|em|mark|small|del|ins|sub|sup|div|p|span|h[1-6]|a|img|table|tr|td|th|ul|ol|li|blockquote|pre|code|br)(\\s+[^>]*)?>/i;\n return htmlTagPattern.test(str.trim());\n};\n\nexport const mergeBoldStrongTags = (html: string): string => {\n let mergedHtml = html.replace(/<b><strong>/gi, '<strong>');\n mergedHtml = mergedHtml.replace(/<\\/strong><\\/b>/gi, '</strong>');\n return mergedHtml;\n};\n\nexport const cleanUpTable = (html: string): string =>\n html.replace(/<div[^>]*>\\s*(<table[\\s\\S]*?<\\/table>)\\s*<\\/div>/gi, '$1');\n\nexport const removeStylesExportDOM = (editor: LexicalEditor, target: LexicalNode): DOMExportOutput => {\n const output = target.exportDOM(editor);\n if (output && output.element instanceof HTMLElement) {\n for (const el of [output.element, ...output.element.querySelectorAll('[style],[class],[dir=\"ltr\"]')]) {\n el.removeAttribute('class');\n if (el.getAttribute('style')) {\n el.setAttribute('style', '');\n el.removeAttribute('style');\n }\n if (el.getAttribute('dir') === 'ltr') {\n el.removeAttribute('dir');\n }\n }\n }\n return output;\n};\n\nexport const exportMap = new Map<Klass<LexicalNode>, (editor: LexicalEditor, target: LexicalNode) => DOMExportOutput>([\n [ParagraphNode, removeStylesExportDOM],\n [TextNode, removeStylesExportDOM],\n [ListNode, removeStylesExportDOM],\n [ListItemNode, removeStylesExportDOM],\n [TableCellNode, removeStylesExportDOM],\n [LinkNode, removeStylesExportDOM],\n]);\n\nexport const setScrollableContainers = (fn: (event: Event) => void) => {\n const scrollableContainers = document.querySelectorAll('*');\n scrollableContainers.forEach((container) => {\n if (container.scrollHeight > container.clientHeight) {\n container.addEventListener('scroll', fn);\n }\n });\n};\n\nexport const removeScrollableContainers = (fn: (event: Event) => void) => {\n const scrollableContainers = document.querySelectorAll('*');\n scrollableContainers.forEach((container) => {\n if (container.scrollHeight > container.clientHeight) {\n container.removeEventListener('scroll', fn);\n }\n });\n};\n"],"names":["isStartingWithHtmlTag","str","mergeBoldStrongTags","html","mergedHtml","cleanUpTable","removeStylesExportDOM","editor","target","output","el","exportMap","ParagraphNode","TextNode","ListNode","ListItemNode","TableCellNode","LinkNode","setScrollableContainers","fn","container","removeScrollableContainers"],"mappings":";;;;AAOO,MAAMA,IAAwB,CAACC,MAElC,qIACoB,KAAKA,EAAI,KAAA,CAAM,GAG1BC,IAAsB,CAACC,MAAyB;AAC3D,MAAIC,IAAaD,EAAK,QAAQ,iBAAiB,UAAU;AACzD,SAAAC,IAAaA,EAAW,QAAQ,qBAAqB,WAAW,GACzDA;AACT,GAEaC,IAAe,CAACF,MAC3BA,EAAK,QAAQ,sDAAsD,IAAI,GAE5DG,IAAwB,CAACC,GAAuBC,MAAyC;AACpG,QAAMC,IAASD,EAAO,UAAUD,CAAM;AACtC,MAAIE,KAAUA,EAAO,mBAAmB;AACtC,eAAWC,KAAM,CAACD,EAAO,SAAS,GAAGA,EAAO,QAAQ,iBAAiB,6BAA6B,CAAC;AACjG,MAAAC,EAAG,gBAAgB,OAAO,GACtBA,EAAG,aAAa,OAAO,MACzBA,EAAG,aAAa,SAAS,EAAE,GAC3BA,EAAG,gBAAgB,OAAO,IAExBA,EAAG,aAAa,KAAK,MAAM,SAC7BA,EAAG,gBAAgB,KAAK;AAI9B,SAAOD;AACT,GAEaE,wBAAgB,IAAyF;AAAA,EACpH,CAACC,GAAeN,CAAqB;AAAA,EACrC,CAACO,GAAUP,CAAqB;AAAA,EAChC,CAACQ,GAAUR,CAAqB;AAAA,EAChC,CAACS,GAAcT,CAAqB;AAAA,EACpC,CAACU,GAAeV,CAAqB;AAAA,EACrC,CAACW,GAAUX,CAAqB;AAClC,CAAC,GAEYY,IAA0B,CAACC,MAA+B;AAErE,EAD6B,SAAS,iBAAiB,GAAG,EACrC,QAAQ,CAACC,MAAc;AAC1C,IAAIA,EAAU,eAAeA,EAAU,gBACrCA,EAAU,iBAAiB,UAAUD,CAAE;AAAA,EAE3C,CAAC;AACH,GAEaE,IAA6B,CAACF,MAA+B;AAExE,EAD6B,SAAS,iBAAiB,GAAG,EACrC,QAAQ,CAACC,MAAc;AAC1C,IAAIA,EAAU,eAAeA,EAAU,gBACrCA,EAAU,oBAAoB,UAAUD,CAAE;AAAA,EAE9C,CAAC;AACH;"}
|