@enyxs/wikex-components 0.11.20 → 0.11.21
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/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -6
- 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);
|
|
@@ -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)) }),
|