@pinkpixel/marzipan 1.2.0 → 1.2.2
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/README.md +2 -2
- package/dist/index-DNhI8UtW.js +31 -0
- package/dist/index-DNhI8UtW.js.map +1 -0
- package/dist/index-ZtRPyDzL.js +31 -0
- package/dist/index-ZtRPyDzL.js.map +1 -0
- package/dist/index.js +118 -141
- package/dist/index.js.map +1 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +6 -10
- package/dist/parser.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/tableGenerator.js +1 -1
- package/dist/plugins/tableGridPlugin.d.ts +1 -1
- package/dist/plugins/tableGridPlugin.d.ts.map +1 -1
- package/dist/plugins/tableGridPlugin.js +76 -87
- package/dist/plugins/tableGridPlugin.js.map +1 -1
- package/dist/plugins/tablePlugin.js +1 -1
- package/dist/plugins/utils/table.d.ts +2 -4
- package/dist/plugins/utils/table.d.ts.map +1 -1
- package/dist/plugins/utils/table.js +10 -13
- package/dist/plugins/utils/table.js.map +1 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +46 -69
- package/dist/styles.js.map +1 -1
- package/dist/table-DkW9Xd6r.js +33 -0
- package/dist/table-DkW9Xd6r.js.map +1 -0
- package/dist/table-DtH1DJ20.js +31 -0
- package/dist/table-DtH1DJ20.js.map +1 -0
- package/docs/.vitepress/config.ts +1 -1
- package/docs/plugins.md +31 -41
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as st } from "./index-
|
|
2
|
-
import { b as ct, r as pt } from "./table-
|
|
1
|
+
import { i as st } from "./index-ZtRPyDzL.js";
|
|
2
|
+
import { b as ct, r as pt } from "./table-DtH1DJ20.js";
|
|
3
3
|
import { imagePickerPlugin as mt } from "./plugins/imagePicker.js";
|
|
4
4
|
import { imageManagerPlugin as ut, imageManagerStyles as ft } from "./plugins/imageManagerPlugin.js";
|
|
5
5
|
import { imagePickerPlugin as bt } from "./plugins/imagePickerPlugin.js";
|
|
@@ -9,7 +9,7 @@ import { tableGeneratorPlugin as zt } from "./plugins/tableGenerator.js";
|
|
|
9
9
|
import { tableGridPlugin as St, tableGridStyles as Ct } from "./plugins/tableGridPlugin.js";
|
|
10
10
|
import { tablePlugin as Et } from "./plugins/tablePlugin.js";
|
|
11
11
|
import { tinyHighlightPlugin as $t, tinyHighlightStyles as Mt } from "./plugins/tinyHighlight.js";
|
|
12
|
-
const
|
|
12
|
+
const R = class R {
|
|
13
13
|
/**
|
|
14
14
|
* Reset link index (call before parsing a new document)
|
|
15
15
|
*/
|
|
@@ -360,7 +360,7 @@ const N = class N {
|
|
|
360
360
|
const p = this.escapeHtml(l), h = l.match(/^<!--\s*mz-table:\s*(.+?)\s*-->$/);
|
|
361
361
|
if (h) {
|
|
362
362
|
const m = this.generateBlockId();
|
|
363
|
-
return `<div class="mz-table-annotation" data-mz-annotation="${this.escapeHtml(h[1])}" data-block-id="${m}" data-block-type="table-annotation" data-line-start="${c}" data-line-end="${c}"
|
|
363
|
+
return `<div class="mz-table-annotation" data-mz-annotation="${this.escapeHtml(h[1])}" data-block-id="${m}" data-block-type="table-annotation" data-line-start="${c}" data-line-end="${c}">${p}</div>`;
|
|
364
364
|
}
|
|
365
365
|
if (this.isTableRow(p)) {
|
|
366
366
|
const m = this.generateBlockId();
|
|
@@ -386,7 +386,7 @@ const N = class N {
|
|
|
386
386
|
const m = p[h];
|
|
387
387
|
if (!m.parentNode) continue;
|
|
388
388
|
if (m.classList && m.classList.contains("mz-table-annotation")) {
|
|
389
|
-
d = m.getAttribute("data-mz-annotation") || ""
|
|
389
|
+
d = m.getAttribute("data-mz-annotation") || "";
|
|
390
390
|
continue;
|
|
391
391
|
}
|
|
392
392
|
if (m.classList && (m.classList.contains("table-row") || m.classList.contains("table-separator"))) {
|
|
@@ -395,22 +395,22 @@ const N = class N {
|
|
|
395
395
|
m.remove();
|
|
396
396
|
continue;
|
|
397
397
|
}
|
|
398
|
-
c = this.parseTableAlignments(m.textContent || ""), s.querySelectorAll("thead th").forEach((
|
|
398
|
+
c = this.parseTableAlignments(m.textContent || ""), s.querySelectorAll("thead th").forEach((V, L) => {
|
|
399
399
|
const z = c[L];
|
|
400
|
-
z && z !== "left" && (
|
|
401
|
-
}), l = !1
|
|
400
|
+
z && z !== "left" && (V.style.textAlign = z);
|
|
401
|
+
}), l = !1;
|
|
402
402
|
continue;
|
|
403
403
|
}
|
|
404
404
|
if (!s) {
|
|
405
405
|
if (s = document.createElement("table"), s.className = "marzipan-table", d) {
|
|
406
|
-
const
|
|
407
|
-
|
|
406
|
+
const I = d.match(/header=(\S+)/);
|
|
407
|
+
I && s.classList.add(`mz-header-${I[1]}`), d = null;
|
|
408
408
|
}
|
|
409
409
|
t.insertBefore(s, m), l = !0, c = [];
|
|
410
410
|
}
|
|
411
411
|
const b = m.textContent, v = l ? "th" : "td", k = this.parseTableRow(b, v, l ? [] : c);
|
|
412
412
|
let y;
|
|
413
|
-
l ? (y = s.querySelector("thead"), y || (y = document.createElement("thead"), s.appendChild(y))) : (y = s.querySelector("tbody"), y || (y = document.createElement("tbody"), s.appendChild(y))), y.innerHTML += k
|
|
413
|
+
l ? (y = s.querySelector("thead"), y || (y = document.createElement("thead"), s.appendChild(y))) : (y = s.querySelector("tbody"), y || (y = document.createElement("tbody"), s.appendChild(y))), y.innerHTML += k;
|
|
414
414
|
continue;
|
|
415
415
|
} else
|
|
416
416
|
s = null, l = !1, c = [];
|
|
@@ -606,12 +606,12 @@ const N = class N {
|
|
|
606
606
|
`);
|
|
607
607
|
}
|
|
608
608
|
};
|
|
609
|
-
|
|
609
|
+
R.linkIndex = 0, R.blockIndex = 0, R.LIST_PATTERNS = {
|
|
610
610
|
bullet: /^(\s*)([-*+])\s+(.*)$/,
|
|
611
611
|
numbered: /^(\s*)(\d+)\.\s+(.*)$/,
|
|
612
612
|
checkbox: /^(\s*)-\s+\[([ x])\]\s+(.*)$/
|
|
613
613
|
};
|
|
614
|
-
let $ =
|
|
614
|
+
let $ = R;
|
|
615
615
|
const C = {
|
|
616
616
|
bold: {
|
|
617
617
|
prefix: "**",
|
|
@@ -690,29 +690,29 @@ function E(i) {
|
|
|
690
690
|
};
|
|
691
691
|
return e.scanFor = i.scanFor ?? null, e;
|
|
692
692
|
}
|
|
693
|
-
let
|
|
693
|
+
let N = !1;
|
|
694
694
|
function de(i) {
|
|
695
|
-
|
|
695
|
+
N = i;
|
|
696
696
|
}
|
|
697
|
-
function
|
|
698
|
-
return
|
|
697
|
+
function U() {
|
|
698
|
+
return N;
|
|
699
699
|
}
|
|
700
700
|
function x(i, e, t) {
|
|
701
|
-
|
|
701
|
+
N && (console.group(`🔍 ${i}`), console.log(e), console.groupEnd());
|
|
702
702
|
}
|
|
703
|
-
function
|
|
704
|
-
if (!
|
|
703
|
+
function O(i, e) {
|
|
704
|
+
if (!N) return;
|
|
705
705
|
const t = i.value.slice(i.selectionStart, i.selectionEnd);
|
|
706
706
|
console.group(`📍 Selection: ${e}`), console.log("Position:", `${i.selectionStart}-${i.selectionEnd}`), console.log("Selected text:", JSON.stringify(t)), console.log("Length:", t.length);
|
|
707
707
|
const n = i.value.slice(Math.max(0, i.selectionStart - 10), i.selectionStart), r = i.value.slice(i.selectionEnd, Math.min(i.value.length, i.selectionEnd + 10));
|
|
708
708
|
console.log("Context:", `${JSON.stringify(n)}[SELECTION]${JSON.stringify(r)}`), console.groupEnd();
|
|
709
709
|
}
|
|
710
710
|
function q(i) {
|
|
711
|
-
|
|
711
|
+
N && (console.group("📝 Result"), console.log("Text to insert:", JSON.stringify(i.text)), console.log("New selection:", `${i.selectionStart}-${i.selectionEnd}`), console.groupEnd());
|
|
712
712
|
}
|
|
713
713
|
let S = null;
|
|
714
714
|
function H(i, e) {
|
|
715
|
-
const t =
|
|
715
|
+
const t = U();
|
|
716
716
|
t && (console.group("🔧 insertText"), console.log("Current selection:", `${i.selectionStart}-${i.selectionEnd}`), console.log("Text to insert:", JSON.stringify(e.text)), console.log("New selection to set:", e.selectionStart, "-", e.selectionEnd)), i.focus();
|
|
717
717
|
const n = i.selectionStart, r = i.selectionEnd, o = i.value.slice(0, n), a = i.value.slice(r);
|
|
718
718
|
t && (console.log("Before text (last 20):", JSON.stringify(o.slice(-20))), console.log("After text (first 20):", JSON.stringify(a.slice(0, 20))), console.log(
|
|
@@ -772,7 +772,7 @@ function me(i) {
|
|
|
772
772
|
function Te() {
|
|
773
773
|
return S === !0 ? "native" : S === !1 ? "manual" : "auto";
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function D(i) {
|
|
776
776
|
return i.trim().split(`
|
|
777
777
|
`).length > 1;
|
|
778
778
|
}
|
|
@@ -818,7 +818,7 @@ function ue(i, e) {
|
|
|
818
818
|
const t = i.selectionStart, n = i.selectionEnd, r = i.scrollTop;
|
|
819
819
|
e(), i.selectionStart = t, i.selectionEnd = n, i.scrollTop = r;
|
|
820
820
|
}
|
|
821
|
-
function
|
|
821
|
+
function F(i, e, t = {}) {
|
|
822
822
|
const n = i.selectionStart, r = i.selectionEnd, o = n === r, a = i.value;
|
|
823
823
|
let s = n;
|
|
824
824
|
for (; s > 0 && a[s - 1] !== `
|
|
@@ -868,8 +868,8 @@ function A(i, e) {
|
|
|
868
868
|
surroundWithNewlines: c,
|
|
869
869
|
trimFirst: d
|
|
870
870
|
} = e, p = i.selectionStart, h = i.selectionEnd;
|
|
871
|
-
let m = i.value.slice(i.selectionStart, i.selectionEnd), u =
|
|
872
|
-
` : t, f =
|
|
871
|
+
let m = i.value.slice(i.selectionStart, i.selectionEnd), u = D(m) && r && r.length > 0 ? `${r}
|
|
872
|
+
` : t, f = D(m) && o && o.length > 0 ? `
|
|
873
873
|
${o}` : n;
|
|
874
874
|
if (s) {
|
|
875
875
|
const L = i.value[i.selectionStart - 1];
|
|
@@ -906,8 +906,8 @@ ${o}` : n;
|
|
|
906
906
|
const z = u + f.replace(a, m);
|
|
907
907
|
return g = g + u.length, b = g, { text: z, selectionStart: g, selectionEnd: b };
|
|
908
908
|
}
|
|
909
|
-
const
|
|
910
|
-
return g = g + u.length + m.length +
|
|
909
|
+
const I = u + m + f, V = f.indexOf(a);
|
|
910
|
+
return g = g + u.length + m.length + V, b = g + a.length, { text: I, selectionStart: g, selectionEnd: b };
|
|
911
911
|
}
|
|
912
912
|
function K(i, e) {
|
|
913
913
|
const { prefix: t, suffix: n, surroundWithNewlines: r } = e;
|
|
@@ -945,7 +945,7 @@ function oe(i) {
|
|
|
945
945
|
processed: n
|
|
946
946
|
};
|
|
947
947
|
}
|
|
948
|
-
function
|
|
948
|
+
function B(i, e) {
|
|
949
949
|
return e ? "- " : `${i + 1}. `;
|
|
950
950
|
}
|
|
951
951
|
function Me(i, e) {
|
|
@@ -957,18 +957,18 @@ function Ae(i, e) {
|
|
|
957
957
|
let n = i.selectionStart, r = i.selectionEnd;
|
|
958
958
|
he(i);
|
|
959
959
|
const o = i.value.slice(i.selectionStart, i.selectionEnd), [a, s, l] = Me(e, o), c = l.split(`
|
|
960
|
-
`).map((f, g) => `${
|
|
960
|
+
`).map((f, g) => `${B(g, e.unorderedList)}${f}`), d = c.reduce((f, g, b) => f + B(b, e.unorderedList).length, 0), p = c.reduce((f, g, b) => f + B(b, !e.unorderedList).length, 0);
|
|
961
961
|
if (a.processed)
|
|
962
|
-
return t ? (n = Math.max(n -
|
|
962
|
+
return t ? (n = Math.max(n - B(0, e.unorderedList).length, 0), r = n) : (n = i.selectionStart, r = i.selectionEnd - d), { text: l, selectionStart: n, selectionEnd: r };
|
|
963
963
|
const { newlinesToAppend: h, newlinesToPrepend: m } = W(i), u = h + c.join(`
|
|
964
964
|
`) + m;
|
|
965
965
|
return t ? (n = Math.max(
|
|
966
|
-
n +
|
|
966
|
+
n + B(0, e.unorderedList).length + h.length,
|
|
967
967
|
0
|
|
968
968
|
), r = n) : s.processed ? (n = Math.max(i.selectionStart + h.length, 0), r = i.selectionEnd + h.length + d - p) : (n = Math.max(i.selectionStart + h.length, 0), r = i.selectionEnd + h.length + d), { text: u, selectionStart: n, selectionEnd: r };
|
|
969
969
|
}
|
|
970
970
|
function fe(i, e) {
|
|
971
|
-
const t =
|
|
971
|
+
const t = F(
|
|
972
972
|
i,
|
|
973
973
|
(n) => Ae(n, e),
|
|
974
974
|
{
|
|
@@ -1020,7 +1020,7 @@ function fe(i, e) {
|
|
|
1020
1020
|
);
|
|
1021
1021
|
H(i, t);
|
|
1022
1022
|
}
|
|
1023
|
-
function
|
|
1023
|
+
function Pe(i, e) {
|
|
1024
1024
|
const t = C[e];
|
|
1025
1025
|
if (!t) return !1;
|
|
1026
1026
|
const n = t.prefix ?? "", r = t.suffix ?? "";
|
|
@@ -1078,7 +1078,7 @@ function be(i, e = {}) {
|
|
|
1078
1078
|
i.selectionStart = c, i.selectionEnd = d;
|
|
1079
1079
|
return;
|
|
1080
1080
|
}
|
|
1081
|
-
if (r &&
|
|
1081
|
+
if (r && Pe(s.slice(o, a), r)) {
|
|
1082
1082
|
const l = C[r], c = (l.prefix ?? "").length, d = (l.suffix ?? "").length;
|
|
1083
1083
|
i.selectionStart = Math.max(0, o - c), i.selectionEnd = Math.min(s.length, a + d);
|
|
1084
1084
|
return;
|
|
@@ -1097,9 +1097,9 @@ function T(i) {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
function J(i) {
|
|
1099
1099
|
if (!T(i)) return;
|
|
1100
|
-
x("toggleBold", "Starting"),
|
|
1100
|
+
x("toggleBold", "Starting"), O(i, "Before");
|
|
1101
1101
|
const e = E(C.bold), t = A(i, e);
|
|
1102
|
-
q(t), H(i, t),
|
|
1102
|
+
q(t), H(i, t), O(i, "After");
|
|
1103
1103
|
}
|
|
1104
1104
|
function G(i) {
|
|
1105
1105
|
if (!T(i)) return;
|
|
@@ -1142,17 +1142,17 @@ function Y(i) {
|
|
|
1142
1142
|
}
|
|
1143
1143
|
function ee(i) {
|
|
1144
1144
|
if (!T(i)) return;
|
|
1145
|
-
x("toggleQuote", "Starting"),
|
|
1146
|
-
const e = E(C.quote), t =
|
|
1145
|
+
x("toggleQuote", "Starting"), O(i, "Initial");
|
|
1146
|
+
const e = E(C.quote), t = F(
|
|
1147
1147
|
i,
|
|
1148
1148
|
(n) => K(n, e),
|
|
1149
1149
|
{ prefix: e.prefix }
|
|
1150
1150
|
);
|
|
1151
|
-
q(t), H(i, t),
|
|
1151
|
+
q(t), H(i, t), O(i, "Final");
|
|
1152
1152
|
}
|
|
1153
1153
|
function te(i) {
|
|
1154
1154
|
if (!T(i)) return;
|
|
1155
|
-
const e = E(C.taskList), t =
|
|
1155
|
+
const e = E(C.taskList), t = F(
|
|
1156
1156
|
i,
|
|
1157
1157
|
(n) => K(n, e),
|
|
1158
1158
|
{ prefix: e.prefix }
|
|
@@ -1174,7 +1174,7 @@ function ke(i) {
|
|
|
1174
1174
|
`;
|
|
1175
1175
|
i.setRangeText(o, e, i.selectionEnd, "end"), i.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1177
|
+
function _e(i, e, t) {
|
|
1178
1178
|
let n = e;
|
|
1179
1179
|
for (; n > 0 && i[n - 1] !== `
|
|
1180
1180
|
`; )
|
|
@@ -1185,18 +1185,18 @@ function Pe(i, e, t) {
|
|
|
1185
1185
|
r += 1;
|
|
1186
1186
|
return { lineStart: n, lineEnd: r };
|
|
1187
1187
|
}
|
|
1188
|
-
function
|
|
1188
|
+
function j(i, e = 1, t = !1) {
|
|
1189
1189
|
if (!T(i)) return;
|
|
1190
1190
|
(e < 1 || e > 6) && (e = 1), x("insertHeader", "============ START ============"), x("insertHeader", `Level: ${e}, Toggle: ${t}`), x("insertHeader", `Initial cursor: ${i.selectionStart}-${i.selectionEnd}`);
|
|
1191
1191
|
const n = `header${e === 1 ? "1" : e}`, r = E(C[n] || C.header1);
|
|
1192
1192
|
x("insertHeader", `Style prefix: "${r.prefix}"`);
|
|
1193
|
-
const o = i.value, a = i.selectionStart, s = i.selectionEnd, { lineStart: l, lineEnd: c } =
|
|
1193
|
+
const o = i.value, a = i.selectionStart, s = i.selectionEnd, { lineStart: l, lineEnd: c } = _e(o, a, s), d = o.slice(l, c);
|
|
1194
1194
|
x("insertHeader", `Current line (before): "${d}"`);
|
|
1195
1195
|
const p = d.match(/^(#{1,6})\s*/), h = p ? p[1].length : 0, m = p ? p[0].length : 0;
|
|
1196
1196
|
x("insertHeader", `Existing header match: ${p ? p[0] : "none"}`), x("insertHeader", `Existing level: ${h}`), x("insertHeader", `Target level: ${e}`);
|
|
1197
1197
|
const u = t && h === e;
|
|
1198
1198
|
x("insertHeader", `Should toggle OFF: ${u}`);
|
|
1199
|
-
const f =
|
|
1199
|
+
const f = F(
|
|
1200
1200
|
i,
|
|
1201
1201
|
(g) => {
|
|
1202
1202
|
const b = g.value.slice(g.selectionStart, g.selectionEnd);
|
|
@@ -1237,13 +1237,13 @@ function O(i, e = 1, t = !1) {
|
|
|
1237
1237
|
q(f), x("insertHeader", "============ END ============"), H(i, f);
|
|
1238
1238
|
}
|
|
1239
1239
|
function ye(i) {
|
|
1240
|
-
|
|
1240
|
+
j(i, 1, !0);
|
|
1241
1241
|
}
|
|
1242
1242
|
function xe(i) {
|
|
1243
|
-
|
|
1243
|
+
j(i, 2, !0);
|
|
1244
1244
|
}
|
|
1245
1245
|
function ze(i) {
|
|
1246
|
-
|
|
1246
|
+
j(i, 3, !0);
|
|
1247
1247
|
}
|
|
1248
1248
|
function Le(i, e) {
|
|
1249
1249
|
if (!T(i)) return;
|
|
@@ -1251,7 +1251,7 @@ function Le(i, e) {
|
|
|
1251
1251
|
let n;
|
|
1252
1252
|
if (t.multiline) {
|
|
1253
1253
|
const r = i.value.slice(i.selectionStart, i.selectionEnd);
|
|
1254
|
-
|
|
1254
|
+
D(r) ? n = K(i, t) : n = A(i, t);
|
|
1255
1255
|
} else
|
|
1256
1256
|
n = A(i, t);
|
|
1257
1257
|
H(i, n);
|
|
@@ -1267,7 +1267,7 @@ const ae = {
|
|
|
1267
1267
|
toggleNumberedList: Y,
|
|
1268
1268
|
toggleQuote: ee,
|
|
1269
1269
|
toggleTaskList: te,
|
|
1270
|
-
insertHeader:
|
|
1270
|
+
insertHeader: j,
|
|
1271
1271
|
toggleH1: ye,
|
|
1272
1272
|
toggleH2: xe,
|
|
1273
1273
|
toggleH3: ze,
|
|
@@ -1278,7 +1278,7 @@ const ae = {
|
|
|
1278
1278
|
preserveSelection: ue,
|
|
1279
1279
|
setUndoMethod: me,
|
|
1280
1280
|
setDebugMode: de,
|
|
1281
|
-
getDebugMode:
|
|
1281
|
+
getDebugMode: U
|
|
1282
1282
|
}, Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1283
1283
|
__proto__: null,
|
|
1284
1284
|
actions: ae,
|
|
@@ -1286,10 +1286,10 @@ const ae = {
|
|
|
1286
1286
|
default: ae,
|
|
1287
1287
|
expandSelection: be,
|
|
1288
1288
|
getActiveFormats: Z,
|
|
1289
|
-
getDebugMode:
|
|
1289
|
+
getDebugMode: U,
|
|
1290
1290
|
getUndoMethod: Te,
|
|
1291
1291
|
hasFormat: ge,
|
|
1292
|
-
insertHeader:
|
|
1292
|
+
insertHeader: j,
|
|
1293
1293
|
insertHorizontalRule: ke,
|
|
1294
1294
|
insertLink: Q,
|
|
1295
1295
|
preserveSelection: ue,
|
|
@@ -1355,7 +1355,7 @@ class Se {
|
|
|
1355
1355
|
destroy() {
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
1358
|
-
const
|
|
1358
|
+
const _ = {
|
|
1359
1359
|
name: "solar",
|
|
1360
1360
|
colors: {
|
|
1361
1361
|
bgPrimary: "#faf0ca",
|
|
@@ -1458,10 +1458,10 @@ const I = {
|
|
|
1458
1458
|
// Table/element borders
|
|
1459
1459
|
}
|
|
1460
1460
|
}, le = {
|
|
1461
|
-
solar:
|
|
1461
|
+
solar: _,
|
|
1462
1462
|
cave: se,
|
|
1463
1463
|
// Aliases for backward compatibility
|
|
1464
|
-
light:
|
|
1464
|
+
light: _,
|
|
1465
1465
|
dark: se
|
|
1466
1466
|
};
|
|
1467
1467
|
function M(i) {
|
|
@@ -2270,42 +2270,71 @@ function je(i = {}) {
|
|
|
2270
2270
|
height: 2px !important;
|
|
2271
2271
|
}
|
|
2272
2272
|
|
|
2273
|
-
/*
|
|
2273
|
+
/* ──────────────────────────────────────────────────────────────────
|
|
2274
|
+
* TABLES
|
|
2275
|
+
*
|
|
2276
|
+
* Strategy: in edit mode the raw pipe lines (table-row, table-separator,
|
|
2277
|
+
* mz-table-annotation) stay as plain <div> text lines — perfectly
|
|
2278
|
+
* line-aligned with the textarea because they are just text. The
|
|
2279
|
+
* postProcessHTML assembles a real <table> in the DOM alongside those
|
|
2280
|
+
* divs, but we hide the <table> in edit mode and show only the raw lines.
|
|
2281
|
+
* In preview mode we flip: hide the raw lines, show the <table>.
|
|
2282
|
+
* ────────────────────────────────────────────────────────────────── */
|
|
2283
|
+
|
|
2284
|
+
/* Edit mode: hide the rendered <table>, show the raw lines */
|
|
2285
|
+
.marzipan-container:not(.preview-mode) .marzipan-preview .marzipan-table {
|
|
2286
|
+
display: none !important;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
/* Edit mode: dim annotation comment and separator so they look secondary */
|
|
2290
|
+
.marzipan-container:not(.preview-mode) .marzipan-preview .mz-table-annotation,
|
|
2291
|
+
.marzipan-container:not(.preview-mode) .marzipan-preview .table-separator {
|
|
2292
|
+
opacity: 0.45 !important;
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
/* Preview mode: hide raw pipe lines, show the <table> */
|
|
2296
|
+
.marzipan-container.preview-mode .marzipan-preview .table-row,
|
|
2297
|
+
.marzipan-container.preview-mode .marzipan-preview .table-separator,
|
|
2298
|
+
.marzipan-container.preview-mode .marzipan-preview .mz-table-annotation {
|
|
2299
|
+
display: none !important;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
/* ── Rendered table styles (preview mode only) ── */
|
|
2274
2303
|
.marzipan-preview .marzipan-table {
|
|
2275
2304
|
border-collapse: collapse !important;
|
|
2276
|
-
margin:
|
|
2305
|
+
margin: 0.5em 0 !important;
|
|
2277
2306
|
width: auto !important;
|
|
2278
|
-
overflow: auto !important;
|
|
2279
2307
|
display: table !important;
|
|
2280
2308
|
}
|
|
2281
|
-
|
|
2309
|
+
|
|
2282
2310
|
.marzipan-preview .marzipan-table th,
|
|
2283
2311
|
.marzipan-preview .marzipan-table td {
|
|
2284
2312
|
border: 1px solid var(--border, rgba(128,128,128,0.4)) !important;
|
|
2285
|
-
padding: 0.
|
|
2313
|
+
padding: 0.5em 1em !important;
|
|
2286
2314
|
text-align: left !important;
|
|
2287
2315
|
}
|
|
2288
|
-
|
|
2316
|
+
|
|
2289
2317
|
.marzipan-preview .marzipan-table th {
|
|
2290
2318
|
background: var(--bg-secondary, rgba(128,128,128,0.15)) !important;
|
|
2291
2319
|
font-weight: 600 !important;
|
|
2320
|
+
padding: 0.65em 1em !important;
|
|
2292
2321
|
}
|
|
2293
|
-
|
|
2322
|
+
|
|
2294
2323
|
.marzipan-preview .marzipan-table tr:nth-child(even) td {
|
|
2295
2324
|
background: var(--bg-secondary, rgba(128,128,128,0.05)) !important;
|
|
2296
2325
|
}
|
|
2297
|
-
|
|
2326
|
+
|
|
2298
2327
|
.marzipan-preview .marzipan-table thead,
|
|
2299
2328
|
.marzipan-preview .marzipan-table tbody,
|
|
2300
2329
|
.marzipan-preview .marzipan-table tr {
|
|
2301
2330
|
display: table-row-group !important;
|
|
2302
2331
|
}
|
|
2303
|
-
|
|
2332
|
+
|
|
2304
2333
|
.marzipan-preview .marzipan-table tr {
|
|
2305
2334
|
display: table-row !important;
|
|
2306
2335
|
}
|
|
2307
2336
|
|
|
2308
|
-
/*
|
|
2337
|
+
/* Column alignment */
|
|
2309
2338
|
.marzipan-preview .marzipan-table th[style*="text-align: center"],
|
|
2310
2339
|
.marzipan-preview .marzipan-table td[style*="text-align: center"] {
|
|
2311
2340
|
text-align: center !important;
|
|
@@ -2315,65 +2344,13 @@ function je(i = {}) {
|
|
|
2315
2344
|
text-align: right !important;
|
|
2316
2345
|
}
|
|
2317
2346
|
|
|
2318
|
-
/*
|
|
2319
|
-
.marzipan-preview .marzipan-table.mz-
|
|
2320
|
-
|
|
2321
|
-
}
|
|
2322
|
-
.marzipan-preview .marzipan-table.mz-
|
|
2323
|
-
|
|
2324
|
-
}
|
|
2325
|
-
|
|
2326
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tr:nth-child(even) td { background: transparent !important; }
|
|
2327
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+1) td { background: rgba(236,72,153,0.10) !important; }
|
|
2328
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+2) td { background: rgba(139,92,246,0.10) !important; }
|
|
2329
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+3) td { background: rgba(6,182,212,0.10) !important; }
|
|
2330
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+4) td { background: rgba(16,185,129,0.10) !important; }
|
|
2331
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+5) td { background: rgba(245,158,11,0.10) !important; }
|
|
2332
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+6) td { background: rgba(59,130,246,0.10) !important; }
|
|
2333
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow th {
|
|
2334
|
-
background: rgba(236,72,153,0.18) !important;
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
.marzipan-preview .marzipan-table.mz-table-minimal {
|
|
2338
|
-
border: none !important;
|
|
2339
|
-
}
|
|
2340
|
-
.marzipan-preview .marzipan-table.mz-table-minimal th,
|
|
2341
|
-
.marzipan-preview .marzipan-table.mz-table-minimal td {
|
|
2342
|
-
border: none !important;
|
|
2343
|
-
border-bottom: 1px solid var(--border, rgba(128,128,128,0.25)) !important;
|
|
2344
|
-
}
|
|
2345
|
-
.marzipan-preview .marzipan-table.mz-table-minimal th {
|
|
2346
|
-
border-bottom: 2px solid var(--border, rgba(128,128,128,0.5)) !important;
|
|
2347
|
-
background: transparent !important;
|
|
2348
|
-
}
|
|
2349
|
-
.marzipan-preview .marzipan-table.mz-table-minimal tr:nth-child(even) td {
|
|
2350
|
-
background: transparent !important;
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
/* Table border style presets */
|
|
2354
|
-
.marzipan-preview .marzipan-table.mz-border-dashed th,
|
|
2355
|
-
.marzipan-preview .marzipan-table.mz-border-dashed td {
|
|
2356
|
-
border-style: dashed !important;
|
|
2357
|
-
}
|
|
2358
|
-
.marzipan-preview .marzipan-table.mz-border-dotted th,
|
|
2359
|
-
.marzipan-preview .marzipan-table.mz-border-dotted td {
|
|
2360
|
-
border-style: dotted !important;
|
|
2361
|
-
}
|
|
2362
|
-
.marzipan-preview .marzipan-table.mz-border-double th,
|
|
2363
|
-
.marzipan-preview .marzipan-table.mz-border-double td {
|
|
2364
|
-
border-style: double !important;
|
|
2365
|
-
border-width: 3px !important;
|
|
2366
|
-
}
|
|
2367
|
-
.marzipan-preview .marzipan-table.mz-border-none th,
|
|
2368
|
-
.marzipan-preview .marzipan-table.mz-border-none td {
|
|
2369
|
-
border-color: transparent !important;
|
|
2370
|
-
}
|
|
2371
|
-
|
|
2372
|
-
/* In preview mode - hide table syntax markers */
|
|
2373
|
-
.marzipan-container.preview-mode .marzipan-wrapper .marzipan-preview .table-row,
|
|
2374
|
-
.marzipan-container.preview-mode .marzipan-wrapper .marzipan-preview .table-separator {
|
|
2375
|
-
display: none !important;
|
|
2376
|
-
}
|
|
2347
|
+
/* Header color options */
|
|
2348
|
+
.marzipan-preview .marzipan-table.mz-header-pink th { background: rgba(236,72,153,0.22) !important; }
|
|
2349
|
+
.marzipan-preview .marzipan-table.mz-header-purple th { background: rgba(139,92,246,0.22) !important; }
|
|
2350
|
+
.marzipan-preview .marzipan-table.mz-header-blue th { background: rgba(59,130,246,0.22) !important; }
|
|
2351
|
+
.marzipan-preview .marzipan-table.mz-header-cyan th { background: rgba(6,182,212,0.22) !important; }
|
|
2352
|
+
.marzipan-preview .marzipan-table.mz-header-green th { background: rgba(16,185,129,0.22) !important; }
|
|
2353
|
+
.marzipan-preview .marzipan-table.mz-header-amber th { background: rgba(245,158,11,0.22) !important; }
|
|
2377
2354
|
|
|
2378
2355
|
/* Images - responsive and styled */
|
|
2379
2356
|
.marzipan-preview .marzipan-image {
|
|
@@ -2402,9 +2379,9 @@ const Oe = `<svg viewBox="0 0 18 18">
|
|
|
2402
2379
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="8" x2="10" y1="14" y2="4"></line>
|
|
2403
2380
|
</svg>`, Ve = `<svg viewBox="0 0 18 18">
|
|
2404
2381
|
<path fill="currentColor" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"></path>
|
|
2405
|
-
</svg>`, Ue = `<svg viewBox="0 0 18 18">
|
|
2406
|
-
<path fill="currentColor" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"></path>
|
|
2407
2382
|
</svg>`, De = `<svg viewBox="0 0 18 18">
|
|
2383
|
+
<path fill="currentColor" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"></path>
|
|
2384
|
+
</svg>`, Ue = `<svg viewBox="0 0 18 18">
|
|
2408
2385
|
<path fill="currentColor" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"></path>
|
|
2409
2386
|
</svg>`, qe = `<svg viewBox="0 0 18 18">
|
|
2410
2387
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="7" x2="11" y1="7" y2="11"></line>
|
|
@@ -2457,8 +2434,8 @@ const Oe = `<svg viewBox="0 0 18 18">
|
|
|
2457
2434
|
orderedList: { name: "orderedList", icon: Ze, title: "Numbered List", action: "toggleNumberedList" },
|
|
2458
2435
|
taskList: { name: "taskList", icon: Ge, title: "Task List", action: "toggleTaskList" },
|
|
2459
2436
|
h1: { name: "h1", icon: Ve, title: "Heading 1", action: "insertH1" },
|
|
2460
|
-
h2: { name: "h2", icon:
|
|
2461
|
-
h3: { name: "h3", icon:
|
|
2437
|
+
h2: { name: "h2", icon: De, title: "Heading 2", action: "insertH2" },
|
|
2438
|
+
h3: { name: "h3", icon: Ue, title: "Heading 3", action: "insertH3" },
|
|
2462
2439
|
view: { name: "viewMode", icon: Qe, title: "View mode", action: "toggle-view-menu", hasDropdown: !0 },
|
|
2463
2440
|
plain: { name: "togglePlain", icon: Xe, title: "Toggle plain textarea", action: "toggle-plain" }
|
|
2464
2441
|
}, et = [
|
|
@@ -2896,7 +2873,7 @@ const w = class w {
|
|
|
2896
2873
|
}
|
|
2897
2874
|
_resolveTheme() {
|
|
2898
2875
|
let e = this.instanceTheme;
|
|
2899
|
-
return typeof e == "string" && (e = M(e)), e || (e = w.currentTheme ||
|
|
2876
|
+
return typeof e == "string" && (e = M(e)), e || (e = w.currentTheme || _), typeof e == "string" && (e = M(e)), this.instanceColors ? ce(e, this.instanceColors) : e;
|
|
2900
2877
|
}
|
|
2901
2878
|
_applyTheme(e) {
|
|
2902
2879
|
if (!e) return;
|
|
@@ -3354,7 +3331,7 @@ const w = class w {
|
|
|
3354
3331
|
if (w.stylesInjected && !e) return;
|
|
3355
3332
|
const t = document.querySelector("style.marzipan-styles");
|
|
3356
3333
|
t && t.remove();
|
|
3357
|
-
const n = w.currentTheme ||
|
|
3334
|
+
const n = w.currentTheme || _, r = je({ theme: n }), o = document.createElement("style");
|
|
3358
3335
|
o.className = "marzipan-styles", o.textContent = r, document.head.appendChild(o), w.stylesInjected = !0;
|
|
3359
3336
|
}
|
|
3360
3337
|
/**
|
|
@@ -3407,28 +3384,28 @@ const w = class w {
|
|
|
3407
3384
|
}
|
|
3408
3385
|
};
|
|
3409
3386
|
w.instances = /* @__PURE__ */ new WeakMap(), w.stylesInjected = !1, w.globalListenersInitialized = !1, w.instanceCount = 0;
|
|
3410
|
-
let
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
solar:
|
|
3387
|
+
let P = w;
|
|
3388
|
+
P.MarkdownParser = $;
|
|
3389
|
+
P.ShortcutsManager = Se;
|
|
3390
|
+
P.themes = {
|
|
3391
|
+
solar: _,
|
|
3415
3392
|
cave: M("cave"),
|
|
3416
3393
|
light: M("light"),
|
|
3417
3394
|
dark: M("dark")
|
|
3418
3395
|
};
|
|
3419
|
-
|
|
3420
|
-
|
|
3396
|
+
P.getTheme = M;
|
|
3397
|
+
P.currentTheme = _;
|
|
3421
3398
|
export {
|
|
3422
3399
|
rt as LinkTooltip,
|
|
3423
3400
|
$ as MarkdownParser,
|
|
3424
|
-
|
|
3401
|
+
P as Marzipan,
|
|
3425
3402
|
Se as ShortcutsManager,
|
|
3426
3403
|
nt as Toolbar,
|
|
3427
3404
|
Ie as actions,
|
|
3428
3405
|
ct as buildTableMarkdown,
|
|
3429
3406
|
se as cave,
|
|
3430
3407
|
mt as coreImagePickerPlugin,
|
|
3431
|
-
|
|
3408
|
+
P as default,
|
|
3432
3409
|
je as generateStyles,
|
|
3433
3410
|
M as getTheme,
|
|
3434
3411
|
ut as imageManagerPlugin,
|
|
@@ -3439,7 +3416,7 @@ export {
|
|
|
3439
3416
|
yt as mermaidPlugin,
|
|
3440
3417
|
st as plugins,
|
|
3441
3418
|
pt as resolvePositiveInteger,
|
|
3442
|
-
|
|
3419
|
+
_ as solar,
|
|
3443
3420
|
zt as tableGeneratorPlugin,
|
|
3444
3421
|
St as tableGridPlugin,
|
|
3445
3422
|
Ct as tableGridStyles,
|