@bikdotai/bik-component-library 0.0.817-beta.12 → 0.0.817-beta.13

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,9 +1,9 @@
1
1
  import { DOMSerializer as v, DOMParser as a } from "../node_modules/prosemirror-model/dist/index.js";
2
- import { normalizeHardBreaks as g } from "./extensions/plainClipboard/pasteUtils.js";
3
- function p(t) {
4
- if (!t || typeof document > "u") return t;
5
- const e = document.createElement("div");
6
- return e.innerHTML = t, e.querySelectorAll("span").forEach((i) => {
2
+ import { normalizeHardBreaks as p } from "./extensions/plainClipboard/pasteUtils.js";
3
+ function g(e) {
4
+ if (!e || typeof document > "u") return e;
5
+ const t = document.createElement("div");
6
+ return t.innerHTML = e, t.querySelectorAll("span").forEach((i) => {
7
7
  if (i.hasAttribute("style") || i.hasAttribute("data-variable"))
8
8
  return;
9
9
  const n = i.parentNode;
@@ -11,112 +11,120 @@ function p(t) {
11
11
  for (; i.firstChild; ) n.insertBefore(i.firstChild, i);
12
12
  n.removeChild(i);
13
13
  }
14
- }), e.querySelectorAll("p").forEach((i) => {
14
+ }), t.querySelectorAll("p").forEach((i) => {
15
15
  i.querySelectorAll("br").length === 1 && (i.textContent ?? "").trim() === "" && (i.innerHTML = "");
16
- }), e.innerHTML;
16
+ }), t.innerHTML;
17
17
  }
18
- function u(t) {
19
- const e = document.createElement("div");
20
- e.innerHTML = t;
21
- const i = e.querySelectorAll("p");
22
- for (const n of Array.from(i)) {
23
- if (n.childNodes.length === 0) {
24
- n.appendChild(document.createElement("br"));
18
+ function u(e) {
19
+ const t = document.createElement("div");
20
+ t.innerHTML = e;
21
+ const i = document.createTreeWalker(t, NodeFilter.SHOW_TEXT);
22
+ let n;
23
+ for (; n = i.nextNode(); )
24
+ n.nodeValue && n.nodeValue.includes(" ") && (n.nodeValue = n.nodeValue.replace(/ {2}/g, "  "));
25
+ const s = t.querySelectorAll("p");
26
+ for (const r of Array.from(s)) {
27
+ if (r.childNodes.length === 0) {
28
+ r.appendChild(document.createElement("br"));
25
29
  continue;
26
30
  }
27
- n.lastChild instanceof HTMLBRElement && n.childNodes.length > 1 && n.appendChild(document.createElement("br"));
31
+ r.lastChild instanceof HTMLBRElement && r.childNodes.length > 1 && r.appendChild(document.createElement("br"));
28
32
  }
29
- return e.innerHTML;
33
+ return t.innerHTML;
30
34
  }
31
- function C(t, e) {
32
- const i = p(e), n = document.createElement("div");
35
+ function k(e, t) {
36
+ const i = g(t), n = document.createElement("div");
33
37
  n.innerHTML = i;
34
- const s = a.fromSchema(t.schema).parseSlice(n);
38
+ const s = a.fromSchema(e.schema).parseSlice(n, {
39
+ preserveWhitespace: !0
40
+ });
35
41
  if (s.size === 0) return;
36
- const { from: r, to: c } = t.state.selection, o = t.state.tr.replaceRange(r, c, s);
37
- t.view.dispatch(o);
42
+ const { from: r, to: c } = e.state.selection, o = e.state.tr.replaceRange(r, c, s);
43
+ e.view.dispatch(o);
38
44
  }
39
- const f = (t) => `<div data-section-divider="${t}" style="display:none;height:0;line-height:0;overflow:hidden;"></div>`;
40
- function k(t, e) {
41
- let i = t;
42
- for (const n of e)
43
- i += f(n.id) + n.content;
45
+ const d = (e) => `<div data-section-divider="${e}" style="display:none;height:0;line-height:0;overflow:hidden;"></div>`;
46
+ function C(e, t) {
47
+ let i = e;
48
+ for (const n of t)
49
+ i += d(n.id) + n.content;
44
50
  return i;
45
51
  }
46
- function y(t) {
47
- return t ? A(t).get("body") ?? t : "";
52
+ function y(e) {
53
+ return e ? A(e).get("body") ?? e : "";
48
54
  }
49
- function E(t) {
50
- if (!t) return "";
51
- const e = y(t);
52
- return t.substring(e.length);
55
+ function E(e) {
56
+ if (!e) return "";
57
+ const t = y(e);
58
+ return e.substring(t.length);
53
59
  }
54
- function A(t) {
55
- const e = /* @__PURE__ */ new Map(), i = /<div[^>]*data-section-divider="([^"]*)[^>]*>\s*<\/div>/g, n = [];
60
+ function A(e) {
61
+ const t = /* @__PURE__ */ new Map(), i = /<div[^>]*data-section-divider="([^"]*)[^>]*>\s*<\/div>/g, n = [];
56
62
  let s;
57
- for (; (s = i.exec(t)) !== null; )
63
+ for (; (s = i.exec(e)) !== null; )
58
64
  n.push({
59
65
  id: s[1],
60
66
  index: s.index,
61
67
  endIndex: s.index + s[0].length
62
68
  });
63
69
  if (n.length === 0)
64
- return e.set("body", t), e;
65
- e.set("body", t.slice(0, n[0].index));
70
+ return t.set("body", e), t;
71
+ t.set("body", e.slice(0, n[0].index));
66
72
  for (let r = 0; r < n.length; r++) {
67
- const c = n[r].endIndex, o = r + 1 < n.length ? n[r + 1].index : t.length;
68
- e.set(n[r].id, t.slice(c, o));
73
+ const c = n[r].endIndex, o = r + 1 < n.length ? n[r + 1].index : e.length;
74
+ t.set(n[r].id, e.slice(c, o));
69
75
  }
70
- return e;
76
+ return t;
71
77
  }
72
- function b(t, e) {
73
- const i = d(t, e);
78
+ function b(e, t) {
79
+ const i = f(e, t);
74
80
  if (i === -1)
75
81
  return { html: "", text: "", isEmpty: !0, characterCount: 0 };
76
- const n = m(t, e), s = t.state.doc.slice(i, n), r = document.createElement("div"), c = v.fromSchema(t.schema);
82
+ const n = m(e, t), s = e.state.doc.slice(i, n), r = document.createElement("div"), c = v.fromSchema(e.schema);
77
83
  r.appendChild(c.serializeFragment(s.content));
78
84
  const o = u(r.innerHTML), l = r.textContent ?? "";
79
85
  return { html: o, text: l, isEmpty: !l.trim(), characterCount: l.length };
80
86
  }
81
- function x(t, e) {
87
+ function x(e, t) {
82
88
  const i = document.createElement("div");
83
- return i.innerHTML = e, a.fromSchema(t.schema).parse(i).content;
89
+ return i.innerHTML = t, a.fromSchema(e.schema).parse(i, {
90
+ preserveWhitespace: !0
91
+ }).content;
84
92
  }
85
- function M(t, e, i) {
86
- const n = d(t, e);
93
+ function T(e, t, i) {
94
+ const n = f(e, t);
87
95
  if (n === -1) {
88
- const l = t.state.doc.content.size, h = f(e) + i;
89
- t.commands.insertContentAt(l, h, {
96
+ const l = e.state.doc.content.size, h = d(t) + i;
97
+ e.commands.insertContentAt(l, h, {
90
98
  updateSelection: !1
91
99
  });
92
100
  return;
93
101
  }
94
- const s = m(t, e), r = x(t, i), { tr: c } = t.state, o = e === "body" ? 0 : n;
95
- c.replaceWith(o, s, r), c.setMeta("addToHistory", !1), t.view.dispatch(c);
102
+ const s = m(e, t), r = x(e, i), { tr: c } = e.state, o = t === "body" ? 0 : n;
103
+ c.replaceWith(o, s, r), c.setMeta("addToHistory", !1), e.view.dispatch(c);
96
104
  }
97
- function L(t) {
98
- return b(t, "body");
105
+ function M(e) {
106
+ return b(e, "body");
99
107
  }
100
- function z(t) {
108
+ function L(e) {
101
109
  return {
102
- bold: t.isActive("bold"),
103
- italic: t.isActive("italic"),
104
- underline: t.isActive("underline"),
105
- strike: t.isActive("strike"),
106
- bulletList: t.isActive("bulletList"),
107
- orderedList: t.isActive("orderedList"),
108
- blockquote: t.isActive("blockquote"),
109
- codeBlock: t.isActive("codeBlock"),
110
+ bold: e.isActive("bold"),
111
+ italic: e.isActive("italic"),
112
+ underline: e.isActive("underline"),
113
+ strike: e.isActive("strike"),
114
+ bulletList: e.isActive("bulletList"),
115
+ orderedList: e.isActive("orderedList"),
116
+ blockquote: e.isActive("blockquote"),
117
+ codeBlock: e.isActive("codeBlock"),
110
118
  link: (() => {
111
- if (t.isActive("link"))
112
- return { href: t.getAttributes("link").href ?? "" };
113
- const { $from: e } = t.state.selection;
114
- if (e.pos > 0) {
115
- const n = e.doc.resolve(e.pos).marks().find((s) => s.type.name === "link");
119
+ if (e.isActive("link"))
120
+ return { href: e.getAttributes("link").href ?? "" };
121
+ const { $from: t } = e.state.selection;
122
+ if (t.pos > 0) {
123
+ const n = t.doc.resolve(t.pos).marks().find((s) => s.type.name === "link");
116
124
  if (n)
117
125
  return { href: n.attrs.href ?? "" };
118
126
  {
119
- const r = e.nodeBefore?.marks.find(
127
+ const r = t.nodeBefore?.marks.find(
120
128
  (c) => c.type.name === "link"
121
129
  );
122
130
  if (r)
@@ -125,38 +133,38 @@ function z(t) {
125
133
  }
126
134
  return null;
127
135
  })(),
128
- textAlign: t.isActive({ textAlign: "center" }) ? "center" : t.isActive({ textAlign: "right" }) ? "right" : t.isActive({ textAlign: "justify" }) ? "justify" : t.isActive({ textAlign: "left" }) ? "left" : null,
129
- fontFamily: t.getAttributes("textStyle").fontFamily ?? null,
130
- fontSize: t.getAttributes("textStyle").fontSize ?? null,
131
- color: t.getAttributes("textStyle").color ?? null,
132
- highlight: t.isActive("highlight") ? t.getAttributes("highlight").color ?? "default" : null,
133
- superscript: t.isActive("superscript"),
134
- subscript: t.isActive("subscript")
136
+ textAlign: e.isActive({ textAlign: "center" }) ? "center" : e.isActive({ textAlign: "right" }) ? "right" : e.isActive({ textAlign: "justify" }) ? "justify" : e.isActive({ textAlign: "left" }) ? "left" : null,
137
+ fontFamily: e.getAttributes("textStyle").fontFamily ?? null,
138
+ fontSize: e.getAttributes("textStyle").fontSize ?? null,
139
+ color: e.getAttributes("textStyle").color ?? null,
140
+ highlight: e.isActive("highlight") ? e.getAttributes("highlight").color ?? "default" : null,
141
+ superscript: e.isActive("superscript"),
142
+ subscript: e.isActive("subscript")
135
143
  };
136
144
  }
137
- function T(t) {
138
- const e = u(t.getHTML()), i = g(t.state.doc.content), n = t.schema.node("doc", null, i), s = n.textBetween(0, n.content.size, `
145
+ function z(e) {
146
+ const t = u(e.getHTML()), i = p(e.state.doc.content), n = e.schema.node("doc", null, i), s = n.textBetween(0, n.content.size, `
139
147
 
140
148
  `, `
141
149
  `);
142
150
  return {
143
- html: e,
151
+ html: t,
144
152
  text: s,
145
- isEmpty: t.isEmpty,
153
+ isEmpty: e.isEmpty,
146
154
  characterCount: s.length
147
155
  };
148
156
  }
149
- function d(t, e) {
150
- if (e === "body") return 1;
157
+ function f(e, t) {
158
+ if (t === "body") return 1;
151
159
  let i = -1;
152
- return t.state.doc.descendants((n, s) => {
160
+ return e.state.doc.descendants((n, s) => {
153
161
  if (i !== -1) return !1;
154
- n.type.name === "sectionDivider" && n.attrs.sectionId === e && (i = s + n.nodeSize);
162
+ n.type.name === "sectionDivider" && n.attrs.sectionId === t && (i = s + n.nodeSize);
155
163
  }), i;
156
164
  }
157
- function m(t, e) {
158
- const i = t.state.doc, n = i.content.size;
159
- if (e === "body") {
165
+ function m(e, t) {
166
+ const i = e.state.doc, n = i.content.size;
167
+ if (t === "body") {
160
168
  let c = -1;
161
169
  return i.descendants((o, l) => {
162
170
  if (c !== -1) return !1;
@@ -167,25 +175,25 @@ function m(t, e) {
167
175
  return i.descendants((c, o) => {
168
176
  if (r !== -1) return !1;
169
177
  if (!s)
170
- return c.type.name === "sectionDivider" && c.attrs.sectionId === e && (s = !0), !1;
178
+ return c.type.name === "sectionDivider" && c.attrs.sectionId === t && (s = !0), !1;
171
179
  c.type.name === "sectionDivider" && (r = o);
172
180
  }), r !== -1 ? r : n;
173
181
  }
174
182
  export {
175
- f as SECTION_DIVIDER_HTML,
176
- k as buildSectionedContent,
177
- z as extractActiveFormats,
183
+ d as SECTION_DIVIDER_HTML,
184
+ C as buildSectionedContent,
185
+ L as extractActiveFormats,
178
186
  A as extractAllSectionsFromHtml,
179
- L as extractBodyContent,
180
- T as extractContent,
187
+ M as extractBodyContent,
188
+ z as extractContent,
181
189
  b as extractSectionContent,
182
190
  m as findSectionEndPos,
183
- d as findSectionStartPos,
191
+ f as findSectionStartPos,
184
192
  y as getBodyHtml,
185
193
  E as getSectionsHtml,
186
- C as insertInlineHtml,
187
- p as normalizeHtml,
188
- M as setSectionContentInEditor,
194
+ k as insertInlineHtml,
195
+ g as normalizeHtml,
196
+ T as setSectionContentInEditor,
189
197
  u as toPortableHtml
190
198
  };
191
199
  //# sourceMappingURL=BikEditor.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BikEditor.utils.js","sources":["../../../src/editor/BikEditor.utils.ts"],"sourcesContent":["import { Editor } from '@tiptap/core';\nimport { DOMParser, DOMSerializer } from 'prosemirror-model';\nimport { EditorSnapshot, FormatState } from './BikEditor.types';\nimport { normalizeHardBreaks } from './extensions/plainClipboard/pasteUtils';\n\n// ---------------------------------------------------------------------------\n// HTML normalisation\n// ---------------------------------------------------------------------------\n\n/**\n * Normalise HTML before passing it to TipTap.\n *\n * 1. Unwrap style-less `<span>` wrappers (plain spans, and editor-cursor spans\n * like Quill's `<span class=\"ql-cursor\">`). Spans that carry inline styling\n * (`color` / `font-family` / `font-size` render as styled spans) or that\n * represent a `{{variable}}` token are PRESERVED — otherwise a setContent\n * round-trip would silently drop colour/font formatting that paste keeps.\n * 2. Collapse placeholder paragraphs (`<p><br></p>`) to `<p></p>`. ProseMirror\n * parses `<p></p>` as an empty paragraph and adds its own DOM `<br>` for the\n * cursor — one blank line, correct height. Leaving the source `<br>` would\n * create a `hard_break` child AND the cursor `<br>` → double-height blank line.\n *\n * Uses the DOM (regex cannot selectively pair span tags). `normalizeHtml` runs\n * in the component body for `initialContent`, so it is guarded for SSR: the\n * editor is created lazily on the client (`immediatelyRender: false`), meaning\n * the value is only parsed client-side and passing through on the server is safe.\n */\nexport function normalizeHtml(html: string): string {\n\tif (!html || typeof document === 'undefined') return html;\n\n\tconst container = document.createElement('div');\n\tcontainer.innerHTML = html;\n\n\tcontainer.querySelectorAll('span').forEach((span) => {\n\t\tif (span.hasAttribute('style') || span.hasAttribute('data-variable'))\n\t\t\treturn;\n\t\tconst parent = span.parentNode;\n\t\tif (!parent) return;\n\t\twhile (span.firstChild) parent.insertBefore(span.firstChild, span);\n\t\tparent.removeChild(span);\n\t});\n\n\tcontainer.querySelectorAll('p').forEach((p) => {\n\t\tif (\n\t\t\tp.querySelectorAll('br').length === 1 &&\n\t\t\t(p.textContent ?? '').trim() === ''\n\t\t) {\n\t\t\tp.innerHTML = '';\n\t\t}\n\t});\n\n\treturn container.innerHTML;\n}\n\n/**\n * Make editor HTML portable across email clients and chat renderers.\n *\n * 1. Double a trailing `<br>` in content paragraphs so the blank line is\n * visible. A single trailing `<br>` before `</p>` is swallowed by most\n * email clients; `<br><br>` renders as a visible blank line (matches\n * Gmail's output).\n * 2. Convert empty `<p></p>` to `<p><br></p>` — email clients collapse\n * zero-height paragraphs without a `<br>`.\n */\nexport function toPortableHtml(html: string): string {\n\tconst div = document.createElement('div');\n\tdiv.innerHTML = html;\n\tconst blocks = div.querySelectorAll('p');\n\tfor (const p of Array.from(blocks)) {\n\t\tif (p.childNodes.length === 0) {\n\t\t\tp.appendChild(document.createElement('br'));\n\t\t\tcontinue;\n\t\t}\n\t\tconst last = p.lastChild;\n\t\tif (last instanceof HTMLBRElement && p.childNodes.length > 1) {\n\t\t\tp.appendChild(document.createElement('br'));\n\t\t}\n\t}\n\treturn div.innerHTML;\n}\n\n// ---------------------------------------------------------------------------\n// Inline content insertion\n// ---------------------------------------------------------------------------\n\n/**\n * Insert HTML at the current cursor position, merging the first paragraph\n * inline while preserving the block structure of subsequent paragraphs/lists.\n *\n * Uses `parseSlice` which returns an open-ended Slice — the first block merges\n * at the cursor, middle blocks stay intact, and the last block merges with any\n * text that follows the cursor.\n */\nexport function insertInlineHtml(editor: Editor, html: string): void {\n\tconst normalised = normalizeHtml(html);\n\tconst dom = document.createElement('div');\n\tdom.innerHTML = normalised;\n\tconst slice = DOMParser.fromSchema(editor.schema).parseSlice(dom);\n\n\tif (slice.size === 0) return;\n\n\tconst { from, to } = editor.state.selection;\n\tconst tr = editor.state.tr.replaceRange(from, to, slice);\n\teditor.view.dispatch(tr);\n}\n\n// ---------------------------------------------------------------------------\n// Section divider HTML\n// ---------------------------------------------------------------------------\n\nexport const SECTION_DIVIDER_HTML = (id: string) =>\n\t`<div data-section-divider=\"${id}\" style=\"display:none;height:0;line-height:0;overflow:hidden;\"></div>`;\n\n/**\n * Build initial HTML for an editor with one or more named sections below the body.\n * Each section is separated by an invisible divider node.\n *\n * @example\n * buildSectionedContent('<p>Body</p>', [\n * { id: 'signature', content: '<p>Alice</p>' },\n * { id: 'forwarded', content: '<p>--- fwd ---</p>' },\n * ])\n */\nexport function buildSectionedContent(\n\tbody: string,\n\tsections: Array<{ id: string; content: string }>,\n): string {\n\tlet html = body;\n\tfor (const s of sections) {\n\t\thtml += SECTION_DIVIDER_HTML(s.id) + s.content;\n\t}\n\treturn html;\n}\n\n// ---------------------------------------------------------------------------\n// Section extraction\n// ---------------------------------------------------------------------------\n\n/**\n * Parse the editor HTML into a Map of sectionId → raw HTML string.\n * The special key `'body'` always holds the content before the first divider.\n * Map iteration order matches document order.\n */\nexport function extractAllSections(editor: Editor): Map<string, string> {\n\treturn extractAllSectionsFromHtml(editor.getHTML());\n}\n\n/**\n * Extract just the body portion (everything before the first section divider)\n * from an HTML string produced by BikEditor. Safe to call on plain HTML too —\n * returns the full string when no dividers are present.\n */\nexport function getBodyHtml(html: string): string {\n\tif (!html) return '';\n\tconst sections = extractAllSectionsFromHtml(html);\n\treturn sections.get('body') ?? html;\n}\n\n/**\n * Extract everything from the first section divider onward (dividers + their\n * content). Returns an empty string when there are no sections.\n */\nexport function getSectionsHtml(html: string): string {\n\tif (!html) return '';\n\tconst body = getBodyHtml(html);\n\treturn html.substring(body.length);\n}\n\nexport function extractAllSectionsFromHtml(html: string): Map<string, string> {\n\tconst sections = new Map<string, string>();\n\tconst dividerRegex =\n\t\t/<div[^>]*data-section-divider=\"([^\"]*)[^>]*>\\s*<\\/div>/g;\n\tconst dividers: Array<{ id: string; index: number; endIndex: number }> = [];\n\n\tlet match: RegExpExecArray | null;\n\twhile ((match = dividerRegex.exec(html)) !== null) {\n\t\tdividers.push({\n\t\t\tid: match[1],\n\t\t\tindex: match.index,\n\t\t\tendIndex: match.index + match[0].length,\n\t\t});\n\t}\n\n\tif (dividers.length === 0) {\n\t\tsections.set('body', html);\n\t\treturn sections;\n\t}\n\n\tsections.set('body', html.slice(0, dividers[0].index));\n\tfor (let i = 0; i < dividers.length; i++) {\n\t\tconst start = dividers[i].endIndex;\n\t\tconst end = i + 1 < dividers.length ? dividers[i + 1].index : html.length;\n\t\tsections.set(dividers[i].id, html.slice(start, end));\n\t}\n\n\treturn sections;\n}\n\n/** Returns BikEditorContent for a single named section (or 'body'). */\nexport function extractSectionContent(\n\teditor: Editor,\n\tid: string,\n): EditorSnapshot {\n\tconst startPos = findSectionStartPos(editor, id);\n\tif (startPos === -1)\n\t\treturn { html: '', text: '', isEmpty: true, characterCount: 0 };\n\tconst endPos = findSectionEndPos(editor, id);\n\tconst slice = editor.state.doc.slice(startPos, endPos);\n\tconst container = document.createElement('div');\n\tconst serializer = DOMSerializer.fromSchema(editor.schema);\n\tcontainer.appendChild(serializer.serializeFragment(slice.content));\n\tconst html = toPortableHtml(container.innerHTML);\n\tconst text = container.textContent ?? '';\n\treturn { html, text, isEmpty: !text.trim(), characterCount: text.length };\n}\n\n/**\n * Parse an HTML string into ProseMirror nodes using the editor's schema.\n */\nfunction parseHtmlToNodes(editor: Editor, html: string) {\n\tconst container = document.createElement('div');\n\tcontainer.innerHTML = html;\n\treturn DOMParser.fromSchema(editor.schema).parse(container).content;\n}\n\n/**\n * Replace the content of a single named section without touching others.\n * Uses a ProseMirror transaction to replace only the target range,\n * preserving undo history and other sections' state.\n * If the section doesn't exist yet, it is appended at the end of the document.\n */\nexport function setSectionContentInEditor(\n\teditor: Editor,\n\tid: string,\n\thtml: string,\n): void {\n\tconst startPos = findSectionStartPos(editor, id);\n\tif (startPos === -1) {\n\t\tconst endPos = editor.state.doc.content.size;\n\t\tconst dividerHtml = SECTION_DIVIDER_HTML(id) + html;\n\t\teditor.commands.insertContentAt(endPos, dividerHtml, {\n\t\t\tupdateSelection: false,\n\t\t});\n\t\treturn;\n\t}\n\tconst endPos = findSectionEndPos(editor, id);\n\tconst fragment = parseHtmlToNodes(editor, html);\n\tconst { tr } = editor.state;\n\t// For body, replace from position 0 (before the first paragraph's opening\n\t// boundary) so ProseMirror swaps entire block nodes cleanly. Position 1\n\t// (inside the paragraph) would force ProseMirror to close the open paragraph\n\t// first, creating a ghost empty <p></p>.\n\tconst replaceFrom = id === 'body' ? 0 : startPos;\n\ttr.replaceWith(replaceFrom, endPos, fragment);\n\ttr.setMeta('addToHistory', false);\n\teditor.view.dispatch(tr);\n}\n\n// ---------------------------------------------------------------------------\n// Convenience shorthands (body = first section)\n// ---------------------------------------------------------------------------\n\n/** Extract BikEditorContent for just the body (before the first divider). */\nexport function extractBodyContent(editor: Editor): EditorSnapshot {\n\treturn extractSectionContent(editor, 'body');\n}\n\n// ---------------------------------------------------------------------------\n// Active formats\n// ---------------------------------------------------------------------------\n\nexport function extractActiveFormats(editor: Editor): FormatState {\n\treturn {\n\t\tbold: editor.isActive('bold'),\n\t\titalic: editor.isActive('italic'),\n\t\tunderline: editor.isActive('underline'),\n\t\tstrike: editor.isActive('strike'),\n\t\tbulletList: editor.isActive('bulletList'),\n\t\torderedList: editor.isActive('orderedList'),\n\t\tblockquote: editor.isActive('blockquote'),\n\t\tcodeBlock: editor.isActive('codeBlock'),\n\t\tlink: (() => {\n\t\t\tif (editor.isActive('link')) {\n\t\t\t\treturn { href: editor.getAttributes('link')['href'] ?? '' };\n\t\t\t}\n\t\t\tconst { $from } = editor.state.selection;\n\t\t\tif ($from.pos > 0) {\n\t\t\t\tconst before = $from.doc.resolve($from.pos);\n\t\t\t\tconst linkMark = before.marks().find((m) => m.type.name === 'link');\n\t\t\t\tif (!linkMark) {\n\t\t\t\t\tconst nodeBefore = $from.nodeBefore;\n\t\t\t\t\tconst markOnPrev = nodeBefore?.marks.find(\n\t\t\t\t\t\t(m) => m.type.name === 'link',\n\t\t\t\t\t);\n\t\t\t\t\tif (markOnPrev) {\n\t\t\t\t\t\treturn { href: markOnPrev.attrs['href'] ?? '' };\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn { href: linkMark.attrs['href'] ?? '' };\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t})(),\n\t\ttextAlign: editor.isActive({ textAlign: 'center' })\n\t\t\t? 'center'\n\t\t\t: editor.isActive({ textAlign: 'right' })\n\t\t\t? 'right'\n\t\t\t: editor.isActive({ textAlign: 'justify' })\n\t\t\t? 'justify'\n\t\t\t: editor.isActive({ textAlign: 'left' })\n\t\t\t? 'left'\n\t\t\t: null,\n\t\tfontFamily: editor.getAttributes('textStyle')['fontFamily'] ?? null,\n\t\tfontSize: editor.getAttributes('textStyle')['fontSize'] ?? null,\n\t\tcolor: editor.getAttributes('textStyle')['color'] ?? null,\n\t\thighlight: editor.isActive('highlight')\n\t\t\t? editor.getAttributes('highlight')['color'] ?? 'default'\n\t\t\t: null,\n\t\tsuperscript: editor.isActive('superscript'),\n\t\tsubscript: editor.isActive('subscript'),\n\t};\n}\n\nexport function extractContent(editor: Editor): EditorSnapshot {\n\tconst html = toPortableHtml(editor.getHTML());\n\tconst normalized = normalizeHardBreaks(editor.state.doc.content);\n\tconst tempDoc = editor.schema.node('doc', null, normalized);\n\t// Paragraph boundary → blank line (\\n\\n), soft line break (hardBreak) → \\n.\n\t// Matches Gmail's plain-text output for the same content.\n\tconst text = tempDoc.textBetween(0, tempDoc.content.size, '\\n\\n', '\\n');\n\treturn {\n\t\thtml,\n\t\ttext,\n\t\tisEmpty: editor.isEmpty,\n\t\tcharacterCount: text.length,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Section position helpers (used by insertAtSectionStart/End and appendBodyContent)\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the ProseMirror position immediately after a section's opening divider\n * (i.e. the start of the section's own content).\n * For `'body'`, returns 1 (beginning of the document).\n * Returns -1 if the named section's divider is not found.\n */\nexport function findSectionStartPos(editor: Editor, sectionId: string): number {\n\tif (sectionId === 'body') return 1;\n\tlet startPos = -1;\n\teditor.state.doc.descendants((node, pos) => {\n\t\tif (startPos !== -1) return false;\n\t\tif (\n\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\tnode.attrs['sectionId'] === sectionId\n\t\t) {\n\t\t\tstartPos = pos + node.nodeSize; // position right after the divider\n\t\t}\n\t});\n\treturn startPos;\n}\n\n/**\n * Returns the ProseMirror position at the end of a named section's content:\n * - For `'body'`: position of the first section divider, or end of document.\n * - For a named section: position of the next divider, or end of document.\n */\nexport function findSectionEndPos(editor: Editor, sectionId: string): number {\n\tconst doc = editor.state.doc;\n\tconst docSize = doc.content.size;\n\n\tif (sectionId === 'body') {\n\t\tlet firstDividerPos = -1;\n\t\tdoc.descendants((node, pos) => {\n\t\t\tif (firstDividerPos !== -1) return false;\n\t\t\tif (node.type.name === 'sectionDivider') {\n\t\t\t\tfirstDividerPos = pos;\n\t\t\t}\n\t\t});\n\t\treturn firstDividerPos !== -1 ? firstDividerPos : docSize;\n\t}\n\n\tlet passedSection = false;\n\tlet nextDividerPos = -1;\n\tdoc.descendants((node, pos) => {\n\t\tif (nextDividerPos !== -1) return false;\n\t\tif (!passedSection) {\n\t\t\tif (\n\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\tnode.attrs['sectionId'] === sectionId\n\t\t\t) {\n\t\t\t\tpassedSection = true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tif (node.type.name === 'sectionDivider') {\n\t\t\tnextDividerPos = pos;\n\t\t}\n\t});\n\treturn nextDividerPos !== -1 ? nextDividerPos : docSize;\n}\n"],"names":["normalizeHtml","html","container","span","parent","p","toPortableHtml","div","blocks","insertInlineHtml","editor","normalised","dom","slice","DOMParser","from","to","tr","SECTION_DIVIDER_HTML","id","buildSectionedContent","body","sections","s","getBodyHtml","extractAllSectionsFromHtml","getSectionsHtml","dividerRegex","dividers","match","i","start","end","extractSectionContent","startPos","findSectionStartPos","endPos","findSectionEndPos","serializer","DOMSerializer","text","parseHtmlToNodes","setSectionContentInEditor","dividerHtml","fragment","replaceFrom","extractBodyContent","extractActiveFormats","$from","linkMark","m","markOnPrev","extractContent","normalized","normalizeHardBreaks","tempDoc","sectionId","node","pos","doc","docSize","firstDividerPos","passedSection","nextDividerPos"],"mappings":";;AA2BO,SAASA,EAAcC,GAAsB;AACnD,MAAI,CAACA,KAAQ,OAAO,WAAa,IAAa,QAAOA;AAErD,Q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D,IAAUD,EAAI,QAAQ;AAE5B,MAAIH,MAAc,QAAQ;AACzB,QAAIK,IAAkB;AACtB,WAAAF,EAAI,YAAY,CAACF,GAAMC,MAAQ;AAC9B,UAAIG,MAAoB,GAAI,QAAO;AACnC,MAAIJ,EAAK,KAAK,SAAS,qBACtBI,IAAkBH;AAAA,IAEpB,CAAC,GACMG,MAAoB,KAAKA,IAAkBD;AAAA,EACnD;AAEA,MAAIE,IAAgB,IAChBC,IAAiB;AACrB,SAAAJ,EAAI,YAAY,CAACF,GAAMC,MAAQ;AAC9B,QAAIK,MAAmB,GAAI,QAAO;AAClC,QAAI,CAACD;AACJ,aACCL,EAAK,KAAK,SAAS,oBACnBA,EAAK,MAAM,cAAiBD,MAE5BM,IAAgB,KAEV;AAER,IAAIL,EAAK,KAAK,SAAS,qBACtBM,IAAiBL;AAAA,EAEnB,CAAC,GACMK,MAAmB,KAAKA,IAAiBH;AACjD;"}
1
+ {"version":3,"file":"BikEditor.utils.js","sources":["../../../src/editor/BikEditor.utils.ts"],"sourcesContent":["import { Editor } from '@tiptap/core';\nimport { DOMParser, DOMSerializer } from 'prosemirror-model';\nimport { EditorSnapshot, FormatState } from './BikEditor.types';\nimport { normalizeHardBreaks } from './extensions/plainClipboard/pasteUtils';\n\n// ---------------------------------------------------------------------------\n// HTML normalisation\n// ---------------------------------------------------------------------------\n\n/**\n * Normalise HTML before passing it to TipTap.\n *\n * 1. Unwrap style-less `<span>` wrappers (plain spans, and editor-cursor spans\n * like Quill's `<span class=\"ql-cursor\">`). Spans that carry inline styling\n * (`color` / `font-family` / `font-size` render as styled spans) or that\n * represent a `{{variable}}` token are PRESERVED — otherwise a setContent\n * round-trip would silently drop colour/font formatting that paste keeps.\n * 2. Collapse placeholder paragraphs (`<p><br></p>`) to `<p></p>`. ProseMirror\n * parses `<p></p>` as an empty paragraph and adds its own DOM `<br>` for the\n * cursor — one blank line, correct height. Leaving the source `<br>` would\n * create a `hard_break` child AND the cursor `<br>` → double-height blank line.\n *\n * Uses the DOM (regex cannot selectively pair span tags). `normalizeHtml` runs\n * in the component body for `initialContent`, so it is guarded for SSR: the\n * editor is created lazily on the client (`immediatelyRender: false`), meaning\n * the value is only parsed client-side and passing through on the server is safe.\n */\nexport function normalizeHtml(html: string): string {\n\tif (!html || typeof document === 'undefined') return html;\n\n\tconst container = document.createElement('div');\n\tcontainer.innerHTML = html;\n\n\tcontainer.querySelectorAll('span').forEach((span) => {\n\t\tif (span.hasAttribute('style') || span.hasAttribute('data-variable'))\n\t\t\treturn;\n\t\tconst parent = span.parentNode;\n\t\tif (!parent) return;\n\t\twhile (span.firstChild) parent.insertBefore(span.firstChild, span);\n\t\tparent.removeChild(span);\n\t});\n\n\tcontainer.querySelectorAll('p').forEach((p) => {\n\t\tif (\n\t\t\tp.querySelectorAll('br').length === 1 &&\n\t\t\t(p.textContent ?? '').trim() === ''\n\t\t) {\n\t\t\tp.innerHTML = '';\n\t\t}\n\t});\n\n\treturn container.innerHTML;\n}\n\n/**\n * Make editor HTML portable across email clients and chat renderers.\n *\n * 1. Preserve consecutive spaces by converting every second space in a run\n * to `&nbsp;` (U+00A0). Standard HTML collapses adjacent regular spaces;\n * alternating with `&nbsp;` prevents that — same convention Gmail uses.\n * 2. Double a trailing `<br>` in content paragraphs so the blank line is\n * visible. A single trailing `<br>` before `</p>` is swallowed by most\n * email clients; `<br><br>` renders as a visible blank line (matches\n * Gmail's output).\n * 3. Convert empty `<p></p>` to `<p><br></p>` — email clients collapse\n * zero-height paragraphs without a `<br>`.\n */\nexport function toPortableHtml(html: string): string {\n\tconst div = document.createElement('div');\n\tdiv.innerHTML = html;\n\n\tconst walker = document.createTreeWalker(div, NodeFilter.SHOW_TEXT);\n\tlet textNode: Text | null;\n\twhile ((textNode = walker.nextNode() as Text | null)) {\n\t\tif (textNode.nodeValue && textNode.nodeValue.includes(' ')) {\n\t\t\ttextNode.nodeValue = textNode.nodeValue.replace(/ {2}/g, '  ');\n\t\t}\n\t}\n\n\tconst blocks = div.querySelectorAll('p');\n\tfor (const p of Array.from(blocks)) {\n\t\tif (p.childNodes.length === 0) {\n\t\t\tp.appendChild(document.createElement('br'));\n\t\t\tcontinue;\n\t\t}\n\t\tconst last = p.lastChild;\n\t\tif (last instanceof HTMLBRElement && p.childNodes.length > 1) {\n\t\t\tp.appendChild(document.createElement('br'));\n\t\t}\n\t}\n\treturn div.innerHTML;\n}\n\n// ---------------------------------------------------------------------------\n// Inline content insertion\n// ---------------------------------------------------------------------------\n\n/**\n * Insert HTML at the current cursor position, merging the first paragraph\n * inline while preserving the block structure of subsequent paragraphs/lists.\n *\n * Uses `parseSlice` which returns an open-ended Slice — the first block merges\n * at the cursor, middle blocks stay intact, and the last block merges with any\n * text that follows the cursor.\n */\nexport function insertInlineHtml(editor: Editor, html: string): void {\n\tconst normalised = normalizeHtml(html);\n\tconst dom = document.createElement('div');\n\tdom.innerHTML = normalised;\n\tconst slice = DOMParser.fromSchema(editor.schema).parseSlice(dom, {\n\t\tpreserveWhitespace: true,\n\t});\n\n\tif (slice.size === 0) return;\n\n\tconst { from, to } = editor.state.selection;\n\tconst tr = editor.state.tr.replaceRange(from, to, slice);\n\teditor.view.dispatch(tr);\n}\n\n// ---------------------------------------------------------------------------\n// Section divider HTML\n// ---------------------------------------------------------------------------\n\nexport const SECTION_DIVIDER_HTML = (id: string) =>\n\t`<div data-section-divider=\"${id}\" style=\"display:none;height:0;line-height:0;overflow:hidden;\"></div>`;\n\n/**\n * Build initial HTML for an editor with one or more named sections below the body.\n * Each section is separated by an invisible divider node.\n *\n * @example\n * buildSectionedContent('<p>Body</p>', [\n * { id: 'signature', content: '<p>Alice</p>' },\n * { id: 'forwarded', content: '<p>--- fwd ---</p>' },\n * ])\n */\nexport function buildSectionedContent(\n\tbody: string,\n\tsections: Array<{ id: string; content: string }>,\n): string {\n\tlet html = body;\n\tfor (const s of sections) {\n\t\thtml += SECTION_DIVIDER_HTML(s.id) + s.content;\n\t}\n\treturn html;\n}\n\n// ---------------------------------------------------------------------------\n// Section extraction\n// ---------------------------------------------------------------------------\n\n/**\n * Parse the editor HTML into a Map of sectionId → raw HTML string.\n * The special key `'body'` always holds the content before the first divider.\n * Map iteration order matches document order.\n */\nexport function extractAllSections(editor: Editor): Map<string, string> {\n\treturn extractAllSectionsFromHtml(editor.getHTML());\n}\n\n/**\n * Extract just the body portion (everything before the first section divider)\n * from an HTML string produced by BikEditor. Safe to call on plain HTML too —\n * returns the full string when no dividers are present.\n */\nexport function getBodyHtml(html: string): string {\n\tif (!html) return '';\n\tconst sections = extractAllSectionsFromHtml(html);\n\treturn sections.get('body') ?? html;\n}\n\n/**\n * Extract everything from the first section divider onward (dividers + their\n * content). Returns an empty string when there are no sections.\n */\nexport function getSectionsHtml(html: string): string {\n\tif (!html) return '';\n\tconst body = getBodyHtml(html);\n\treturn html.substring(body.length);\n}\n\nexport function extractAllSectionsFromHtml(html: string): Map<string, string> {\n\tconst sections = new Map<string, string>();\n\tconst dividerRegex =\n\t\t/<div[^>]*data-section-divider=\"([^\"]*)[^>]*>\\s*<\\/div>/g;\n\tconst dividers: Array<{ id: string; index: number; endIndex: number }> = [];\n\n\tlet match: RegExpExecArray | null;\n\twhile ((match = dividerRegex.exec(html)) !== null) {\n\t\tdividers.push({\n\t\t\tid: match[1],\n\t\t\tindex: match.index,\n\t\t\tendIndex: match.index + match[0].length,\n\t\t});\n\t}\n\n\tif (dividers.length === 0) {\n\t\tsections.set('body', html);\n\t\treturn sections;\n\t}\n\n\tsections.set('body', html.slice(0, dividers[0].index));\n\tfor (let i = 0; i < dividers.length; i++) {\n\t\tconst start = dividers[i].endIndex;\n\t\tconst end = i + 1 < dividers.length ? dividers[i + 1].index : html.length;\n\t\tsections.set(dividers[i].id, html.slice(start, end));\n\t}\n\n\treturn sections;\n}\n\n/** Returns BikEditorContent for a single named section (or 'body'). */\nexport function extractSectionContent(\n\teditor: Editor,\n\tid: string,\n): EditorSnapshot {\n\tconst startPos = findSectionStartPos(editor, id);\n\tif (startPos === -1)\n\t\treturn { html: '', text: '', isEmpty: true, characterCount: 0 };\n\tconst endPos = findSectionEndPos(editor, id);\n\tconst slice = editor.state.doc.slice(startPos, endPos);\n\tconst container = document.createElement('div');\n\tconst serializer = DOMSerializer.fromSchema(editor.schema);\n\tcontainer.appendChild(serializer.serializeFragment(slice.content));\n\tconst html = toPortableHtml(container.innerHTML);\n\tconst text = container.textContent ?? '';\n\treturn { html, text, isEmpty: !text.trim(), characterCount: text.length };\n}\n\n/**\n * Parse an HTML string into ProseMirror nodes using the editor's schema.\n */\nfunction parseHtmlToNodes(editor: Editor, html: string) {\n\tconst container = document.createElement('div');\n\tcontainer.innerHTML = html;\n\treturn DOMParser.fromSchema(editor.schema).parse(container, {\n\t\tpreserveWhitespace: true,\n\t}).content;\n}\n\n/**\n * Replace the content of a single named section without touching others.\n * Uses a ProseMirror transaction to replace only the target range,\n * preserving undo history and other sections' state.\n * If the section doesn't exist yet, it is appended at the end of the document.\n */\nexport function setSectionContentInEditor(\n\teditor: Editor,\n\tid: string,\n\thtml: string,\n): void {\n\tconst startPos = findSectionStartPos(editor, id);\n\tif (startPos === -1) {\n\t\tconst endPos = editor.state.doc.content.size;\n\t\tconst dividerHtml = SECTION_DIVIDER_HTML(id) + html;\n\t\teditor.commands.insertContentAt(endPos, dividerHtml, {\n\t\t\tupdateSelection: false,\n\t\t});\n\t\treturn;\n\t}\n\tconst endPos = findSectionEndPos(editor, id);\n\tconst fragment = parseHtmlToNodes(editor, html);\n\tconst { tr } = editor.state;\n\t// For body, replace from position 0 (before the first paragraph's opening\n\t// boundary) so ProseMirror swaps entire block nodes cleanly. Position 1\n\t// (inside the paragraph) would force ProseMirror to close the open paragraph\n\t// first, creating a ghost empty <p></p>.\n\tconst replaceFrom = id === 'body' ? 0 : startPos;\n\ttr.replaceWith(replaceFrom, endPos, fragment);\n\ttr.setMeta('addToHistory', false);\n\teditor.view.dispatch(tr);\n}\n\n// ---------------------------------------------------------------------------\n// Convenience shorthands (body = first section)\n// ---------------------------------------------------------------------------\n\n/** Extract BikEditorContent for just the body (before the first divider). */\nexport function extractBodyContent(editor: Editor): EditorSnapshot {\n\treturn extractSectionContent(editor, 'body');\n}\n\n// ---------------------------------------------------------------------------\n// Active formats\n// ---------------------------------------------------------------------------\n\nexport function extractActiveFormats(editor: Editor): FormatState {\n\treturn {\n\t\tbold: editor.isActive('bold'),\n\t\titalic: editor.isActive('italic'),\n\t\tunderline: editor.isActive('underline'),\n\t\tstrike: editor.isActive('strike'),\n\t\tbulletList: editor.isActive('bulletList'),\n\t\torderedList: editor.isActive('orderedList'),\n\t\tblockquote: editor.isActive('blockquote'),\n\t\tcodeBlock: editor.isActive('codeBlock'),\n\t\tlink: (() => {\n\t\t\tif (editor.isActive('link')) {\n\t\t\t\treturn { href: editor.getAttributes('link')['href'] ?? '' };\n\t\t\t}\n\t\t\tconst { $from } = editor.state.selection;\n\t\t\tif ($from.pos > 0) {\n\t\t\t\tconst before = $from.doc.resolve($from.pos);\n\t\t\t\tconst linkMark = before.marks().find((m) => m.type.name === 'link');\n\t\t\t\tif (!linkMark) {\n\t\t\t\t\tconst nodeBefore = $from.nodeBefore;\n\t\t\t\t\tconst markOnPrev = nodeBefore?.marks.find(\n\t\t\t\t\t\t(m) => m.type.name === 'link',\n\t\t\t\t\t);\n\t\t\t\t\tif (markOnPrev) {\n\t\t\t\t\t\treturn { href: markOnPrev.attrs['href'] ?? '' };\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn { href: linkMark.attrs['href'] ?? '' };\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t})(),\n\t\ttextAlign: editor.isActive({ textAlign: 'center' })\n\t\t\t? 'center'\n\t\t\t: editor.isActive({ textAlign: 'right' })\n\t\t\t? 'right'\n\t\t\t: editor.isActive({ textAlign: 'justify' })\n\t\t\t? 'justify'\n\t\t\t: editor.isActive({ textAlign: 'left' })\n\t\t\t? 'left'\n\t\t\t: null,\n\t\tfontFamily: editor.getAttributes('textStyle')['fontFamily'] ?? null,\n\t\tfontSize: editor.getAttributes('textStyle')['fontSize'] ?? null,\n\t\tcolor: editor.getAttributes('textStyle')['color'] ?? null,\n\t\thighlight: editor.isActive('highlight')\n\t\t\t? editor.getAttributes('highlight')['color'] ?? 'default'\n\t\t\t: null,\n\t\tsuperscript: editor.isActive('superscript'),\n\t\tsubscript: editor.isActive('subscript'),\n\t};\n}\n\nexport function extractContent(editor: Editor): EditorSnapshot {\n\tconst html = toPortableHtml(editor.getHTML());\n\tconst normalized = normalizeHardBreaks(editor.state.doc.content);\n\tconst tempDoc = editor.schema.node('doc', null, normalized);\n\t// Paragraph boundary → blank line (\\n\\n), soft line break (hardBreak) → \\n.\n\t// Matches Gmail's plain-text output for the same content.\n\tconst text = tempDoc.textBetween(0, tempDoc.content.size, '\\n\\n', '\\n');\n\treturn {\n\t\thtml,\n\t\ttext,\n\t\tisEmpty: editor.isEmpty,\n\t\tcharacterCount: text.length,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Section position helpers (used by insertAtSectionStart/End and appendBodyContent)\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the ProseMirror position immediately after a section's opening divider\n * (i.e. the start of the section's own content).\n * For `'body'`, returns 1 (beginning of the document).\n * Returns -1 if the named section's divider is not found.\n */\nexport function findSectionStartPos(editor: Editor, sectionId: string): number {\n\tif (sectionId === 'body') return 1;\n\tlet startPos = -1;\n\teditor.state.doc.descendants((node, pos) => {\n\t\tif (startPos !== -1) return false;\n\t\tif (\n\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\tnode.attrs['sectionId'] === sectionId\n\t\t) {\n\t\t\tstartPos = pos + node.nodeSize; // position right after the divider\n\t\t}\n\t});\n\treturn startPos;\n}\n\n/**\n * Returns the ProseMirror position at the end of a named section's content:\n * - For `'body'`: position of the first section divider, or end of document.\n * - For a named section: position of the next divider, or end of document.\n */\nexport function findSectionEndPos(editor: Editor, sectionId: string): number {\n\tconst doc = editor.state.doc;\n\tconst docSize = doc.content.size;\n\n\tif (sectionId === 'body') {\n\t\tlet firstDividerPos = -1;\n\t\tdoc.descendants((node, pos) => {\n\t\t\tif (firstDividerPos !== -1) return false;\n\t\t\tif (node.type.name === 'sectionDivider') {\n\t\t\t\tfirstDividerPos = pos;\n\t\t\t}\n\t\t});\n\t\treturn firstDividerPos !== -1 ? firstDividerPos : docSize;\n\t}\n\n\tlet passedSection = false;\n\tlet nextDividerPos = -1;\n\tdoc.descendants((node, pos) => {\n\t\tif (nextDividerPos !== -1) return false;\n\t\tif (!passedSection) {\n\t\t\tif (\n\t\t\t\tnode.type.name === 'sectionDivider' &&\n\t\t\t\tnode.attrs['sectionId'] === sectionId\n\t\t\t) {\n\t\t\t\tpassedSection = true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tif (node.type.name === 'sectionDivider') {\n\t\t\tnextDividerPos = pos;\n\t\t}\n\t});\n\treturn nextDividerPos !== -1 ? nextDividerPos : docSize;\n}\n"],"names":["normalizeHtml","html","container","span","parent","p","toPortableHtml","div","walker","textNode","blocks","insertInlineHtml","editor","normalised","dom","slice","DOMParser","from","to","tr","SECTION_DIVIDER_HTML","id","buildSectionedContent","body","sections","s","getBodyHtml","extractAllSectionsFromHtml","getSectionsHtml","dividerRegex","dividers","match","i","start","end","extractSectionContent","startPos","findSectionStartPos","endPos","findSectionEndPos","serializer","DOMSerializer","text","parseHtmlToNodes","setSectionContentInEditor","dividerHtml","fragment","replaceFrom","extractBodyContent","extractActiveFormats","$from","linkMark","m","markOnPrev","extractContent","normalized","normalizeHardBreaks","tempDoc","sectionId","node","pos","doc","docSize","firstDividerPos","passedSection","nextDividerPos"],"mappings":";;AA2BO,SAASA,EAAcC,GAAsB;AACnD,MAAI,CAACA,KAAQ,OAAO,WAAa,IAAa,QAAOA;AAErD,QAAMC,IAAY,SAAS,cAAc,KAAK;AAC9C,SAAAA,EAAU,YAAYD,GAEtBC,EAAU,iBAAiB,MAAM,EAAE,QAAQ,CAACC,MAAS;AACpD,QAA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M,cAAiBD,MAE5BtB,IAAWwB,IAAMD,EAAK;AAAA,EAExB,CAAC,GACMvB;AACR;AAOO,SAASG,EAAkB3B,GAAgB8C,GAA2B;AAC5E,QAAMG,IAAMjD,EAAO,MAAM,KACnBkD,IAAUD,EAAI,QAAQ;AAE5B,MAAIH,MAAc,QAAQ;AACzB,QAAIK,IAAkB;AACtB,WAAAF,EAAI,YAAY,CAACF,GAAMC,MAAQ;AAC9B,UAAIG,MAAoB,GAAI,QAAO;AACnC,MAAIJ,EAAK,KAAK,SAAS,qBACtBI,IAAkBH;AAAA,IAEpB,CAAC,GACMG,MAAoB,KAAKA,IAAkBD;AAAA,EACnD;AAEA,MAAIE,IAAgB,IAChBC,IAAiB;AACrB,SAAAJ,EAAI,YAAY,CAACF,GAAMC,MAAQ;AAC9B,QAAIK,MAAmB,GAAI,QAAO;AAClC,QAAI,CAACD;AACJ,aACCL,EAAK,KAAK,SAAS,oBACnBA,EAAK,MAAM,cAAiBD,MAE5BM,IAAgB,KAEV;AAER,IAAIL,EAAK,KAAK,SAAS,qBACtBM,IAAiBL;AAAA,EAEnB,CAAC,GACMK,MAAmB,KAAKA,IAAiBH;AACjD;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.817-beta.12",
3
+ "version": "0.0.817-beta.13",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",