@enyxs/wikex-components 0.11.20 → 0.11.22
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 +146 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -325,9 +325,10 @@ function parseCmsRichText(value4) {
|
|
|
325
325
|
if (!mark || !Number.isInteger(mark.start) || !Number.isInteger(mark.end) || mark.start < 0 || mark.end <= mark.start || mark.end > raw.text.length) continue;
|
|
326
326
|
const next = { start: mark.start, end: mark.end };
|
|
327
327
|
if (typeof mark.bold === "boolean") next.bold = mark.bold;
|
|
328
|
+
if (typeof mark.italic === "boolean") next.italic = mark.italic;
|
|
328
329
|
if (typeof mark.underline === "boolean") next.underline = mark.underline;
|
|
329
330
|
if (typeof mark.href === "string") next.href = safeCmsTextHref(mark.href);
|
|
330
|
-
if (next.bold !== void 0 || next.underline !== void 0 || next.href) marks.push(next);
|
|
331
|
+
if (next.bold !== void 0 || next.italic !== void 0 || next.underline !== void 0 || next.href) marks.push(next);
|
|
331
332
|
}
|
|
332
333
|
return { text: raw.text, marks };
|
|
333
334
|
}
|
|
@@ -363,10 +364,10 @@ function patchCmsRichText(value4, text, start, end, patch) {
|
|
|
363
364
|
const style = {};
|
|
364
365
|
rich.marks.filter((m) => m.start <= a && m.end >= b).forEach((m) => Object.assign(style, m));
|
|
365
366
|
if (a >= start && b <= end) Object.assign(style, patch);
|
|
366
|
-
const next = { start: a, end: b, bold: style.bold, underline: style.underline, newTab: style.newTab, href: style.href ? safeCmsTextHref(style.href) : void 0 };
|
|
367
|
-
if (next.bold === void 0 && next.underline === void 0 && !next.href) continue;
|
|
367
|
+
const next = { start: a, end: b, bold: style.bold, italic: style.italic, underline: style.underline, newTab: style.newTab, href: style.href ? safeCmsTextHref(style.href) : void 0 };
|
|
368
|
+
if (next.bold === void 0 && next.italic === void 0 && next.underline === void 0 && !next.href) continue;
|
|
368
369
|
const previous = marks[marks.length - 1];
|
|
369
|
-
if (previous && previous.end === a && previous.bold === next.bold && previous.underline === next.underline && previous.href === next.href && previous.newTab === next.newTab) previous.end = b;
|
|
370
|
+
if (previous && previous.end === a && previous.bold === next.bold && previous.italic === next.italic && previous.underline === next.underline && previous.href === next.href && previous.newTab === next.newTab) previous.end = b;
|
|
370
371
|
else marks.push(next);
|
|
371
372
|
}
|
|
372
373
|
return { text, marks };
|
|
@@ -390,9 +391,10 @@ function renderCmsRichText(children, value4, allowLinks = true) {
|
|
|
390
391
|
const end = points[index + 1];
|
|
391
392
|
const mark = Object.assign({}, ...rich.marks.filter((m) => m.start <= start && m.end >= end));
|
|
392
393
|
const part = text.slice(start - base, end - base);
|
|
393
|
-
if (mark.bold === void 0 && mark.underline === void 0 && !mark.href) return part;
|
|
394
|
+
if (mark.bold === void 0 && mark.italic === void 0 && mark.underline === void 0 && !mark.href) return part;
|
|
394
395
|
const style = {
|
|
395
396
|
...mark.bold !== void 0 ? { fontWeight: mark.bold ? 700 : 400 } : {},
|
|
397
|
+
...mark.italic !== void 0 ? { fontStyle: mark.italic ? "italic" : "normal" } : {},
|
|
396
398
|
...mark.underline !== void 0 ? { textDecorationLine: mark.underline ? "underline" : "none" } : {}
|
|
397
399
|
};
|
|
398
400
|
return mark.href && links ? /* @__PURE__ */ jsx2("a", { href: mark.href, target: mark.newTab ? "_blank" : void 0, rel: mark.newTab ? "noopener noreferrer" : void 0, style: { color: "inherit", textDecoration: "underline", ...style }, children: part }, start) : /* @__PURE__ */ jsx2("span", { style, children: part }, start);
|
|
@@ -16608,7 +16610,7 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
|
|
|
16608
16610
|
"data-cms-text-toolbar": true,
|
|
16609
16611
|
sx: { display: "flex", flexDirection: "column", gap: 0.5, p: 0.75, border: "1px solid", borderColor: "divider", borderRadius: 1, bgcolor: "background.paper", boxShadow: 8, color: "text.primary", maxWidth: "100%" },
|
|
16610
16612
|
children: [
|
|
16611
|
-
/* @__PURE__ */ jsxs40(Box7, { sx: { ...groupSx, flexWrap: "wrap", pb: 0.5, borderBottom: "1px solid", borderColor: "divider" }, children: [
|
|
16613
|
+
/* @__PURE__ */ jsxs40(Box7, { sx: { ...groupSx, flexWrap: "wrap", "& > .MuiInputBase-root:nth-of-type(-n+2)": { flexGrow: 1 }, pb: 0.5, borderBottom: "1px solid", borderColor: "divider" }, children: [
|
|
16612
16614
|
/* @__PURE__ */ jsxs40(
|
|
16613
16615
|
Select3,
|
|
16614
16616
|
{
|
|
@@ -16628,7 +16630,7 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
|
|
|
16628
16630
|
),
|
|
16629
16631
|
structureControls
|
|
16630
16632
|
] }),
|
|
16631
|
-
/* @__PURE__ */ jsxs40(Box7, { sx: { ...groupSx, flexWrap: "wrap" }, children: [
|
|
16633
|
+
/* @__PURE__ */ jsxs40(Box7, { sx: { ...groupSx, flexWrap: "wrap", justifyContent: "space-between" }, children: [
|
|
16632
16634
|
/* @__PURE__ */ jsx47(Tooltip, { title: "C\u1EE1 ch\u1EEF (px)", ...tooltipProps, children: /* @__PURE__ */ jsx47(
|
|
16633
16635
|
TextField3,
|
|
16634
16636
|
{
|
|
@@ -16680,7 +16682,7 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
|
|
|
16680
16682
|
"aria-label": label,
|
|
16681
16683
|
onMouseDown: (event) => event.preventDefault(),
|
|
16682
16684
|
onClick: () => onLayoutChange({ textAlign: align }),
|
|
16683
|
-
sx: { width: 30, height: 30, p: 0.5, border: 0 },
|
|
16685
|
+
sx: { width: 30, minWidth: 30, height: 30, p: 0.5, border: 0 },
|
|
16684
16686
|
children: /* @__PURE__ */ jsx47(SvgIcon, { sx: { fontSize: 19 }, children: /* @__PURE__ */ jsx47("path", { d: align === "left" ? "M3 4h18v2H3zm0 5h12v2H3zm0 5h18v2H3zm0 5h12v2H3z" : align === "right" ? "M3 4h18v2H3zm6 5h12v2H9zm-6 5h18v2H3zm6 5h12v2H9z" : "M3 4h18v2H3zm3 5h12v2H6zm-3 5h18v2H3zm3 5h12v2H6z" }) })
|
|
16685
16687
|
}
|
|
16686
16688
|
) }, align)) }),
|
|
@@ -16701,7 +16703,7 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
|
|
|
16701
16703
|
}
|
|
16702
16704
|
}
|
|
16703
16705
|
),
|
|
16704
|
-
/* @__PURE__ */ jsx47(Tooltip, { title: "\u0110\u1EB7t l\u1EA1i \u0111\u1ECBnh d\u1EA1ng ch\u1EEF", ...tooltipProps, children: /* @__PURE__ */ jsx47(IconButton3, { size: "small", "aria-label": "\u0110\u1EB7t l\u1EA1i \u0111\u1ECBnh d\u1EA1ng ch\u1EEF", onClick: onReset, sx: { width: 30, height: 30
|
|
16706
|
+
/* @__PURE__ */ jsx47(Tooltip, { title: "\u0110\u1EB7t l\u1EA1i \u0111\u1ECBnh d\u1EA1ng ch\u1EEF", ...tooltipProps, children: /* @__PURE__ */ jsx47(IconButton3, { size: "small", "aria-label": "\u0110\u1EB7t l\u1EA1i \u0111\u1ECBnh d\u1EA1ng ch\u1EEF", onClick: onReset, sx: { width: 30, height: 30 }, children: /* @__PURE__ */ jsx47(SvgIcon, { sx: { fontSize: 19 }, children: /* @__PURE__ */ jsx47("path", { d: "m18 4 3 3-9 9-3-3 9-9zM8 14l3 3-3 3H4l-3-3 4-4 3 1zm4 6h10v2H10z" }) }) }) })
|
|
16705
16707
|
] })
|
|
16706
16708
|
]
|
|
16707
16709
|
}
|