@enyxs/wikex-components 0.11.19 → 0.11.20
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 +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +153 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -92
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/README.md +0 -146
package/dist/index.mjs
CHANGED
|
@@ -216,8 +216,7 @@ function CmsAddedElements({ field }) {
|
|
|
216
216
|
value: context.content[item.field] ?? "",
|
|
217
217
|
component: "p",
|
|
218
218
|
sx: {
|
|
219
|
-
font: "inherit"
|
|
220
|
-
my: 1
|
|
219
|
+
font: "inherit"
|
|
221
220
|
},
|
|
222
221
|
editable: context.editable,
|
|
223
222
|
onChange: context.onChange
|
|
@@ -232,9 +231,9 @@ function CmsTextList({ field, type, children }) {
|
|
|
232
231
|
});
|
|
233
232
|
}
|
|
234
233
|
var NativeList = styled2.ul.withConfig({
|
|
235
|
-
componentId: "sc-
|
|
234
|
+
componentId: "sc-4154c689-0"
|
|
236
235
|
})([
|
|
237
|
-
|
|
236
|
+
`> li{display:list-item !important;padding-left:0 !important;}> li::before{content:none !important;}`
|
|
238
237
|
]);
|
|
239
238
|
function CmsTemplateList({ cmsAs, cmsId, children }) {
|
|
240
239
|
const context = useContext(ElementContext);
|
|
@@ -261,7 +260,8 @@ function CmsTemplateList({ cmsAs, cmsId, children }) {
|
|
|
261
260
|
const text = /* @__PURE__ */ _jsx(EditableText, {
|
|
262
261
|
component: "span",
|
|
263
262
|
sx: {
|
|
264
|
-
font: "inherit"
|
|
263
|
+
font: "inherit",
|
|
264
|
+
display: "block"
|
|
265
265
|
},
|
|
266
266
|
field: added.field,
|
|
267
267
|
value: context?.content[added.field] ?? "M\u1EE5c m\u1EDBi",
|
|
@@ -278,7 +278,8 @@ function CmsTemplateList({ cmsAs, cmsId, children }) {
|
|
|
278
278
|
if (!items.length) return null;
|
|
279
279
|
return /* @__PURE__ */ createElement(stored?.type || stored?.marker ? NativeList : cmsAs, {
|
|
280
280
|
...stored?.type || stored?.marker ? {
|
|
281
|
-
as:
|
|
281
|
+
as: cmsAs,
|
|
282
|
+
forwardedAs: stored?.type ?? (stored?.marker === "decimal" || stored?.marker === "lower-alpha" || stored?.marker === "lower-roman" ? "ol" : "ul"),
|
|
282
283
|
style: {
|
|
283
284
|
listStyleType: stored?.marker ?? (stored?.type === "ol" ? "decimal" : "disc")
|
|
284
285
|
}
|
|
@@ -411,6 +412,7 @@ function renderCmsRichText(children, value4, allowLinks = true) {
|
|
|
411
412
|
|
|
412
413
|
// src/shared/text-layout.ts
|
|
413
414
|
var CMS_TEXT_FONTS = {
|
|
415
|
+
"Inter, sans-serif": "Inter",
|
|
414
416
|
"Arial, sans-serif": "Arial",
|
|
415
417
|
"Georgia, serif": "Georgia",
|
|
416
418
|
'"Times New Roman", serif': "Times New Roman",
|
|
@@ -429,6 +431,9 @@ function parseCmsTextLayout(value4) {
|
|
|
429
431
|
if (typeof parsed.fontFamily === "string" && Object.prototype.hasOwnProperty.call(CMS_TEXT_FONTS, parsed.fontFamily)) layout.fontFamily = parsed.fontFamily;
|
|
430
432
|
if (typeof parsed.fontSize === "number" && Number.isFinite(parsed.fontSize) && parsed.fontSize >= 8 && parsed.fontSize <= 300) layout.fontSize = parsed.fontSize;
|
|
431
433
|
if (["p", "h1", "h2", "h3", "ul", "ol"].includes(parsed.blockType)) layout.blockType = parsed.blockType;
|
|
434
|
+
if (typeof parsed.lineHeight === "number" && Number.isFinite(parsed.lineHeight) && parsed.lineHeight >= 0.5 && parsed.lineHeight <= 5) layout.lineHeight = parsed.lineHeight;
|
|
435
|
+
if (["left", "center", "right"].includes(parsed.textAlign)) layout.textAlign = parsed.textAlign;
|
|
436
|
+
if (["ul", "ol"].includes(parsed.listType)) layout.listType = parsed.listType;
|
|
432
437
|
const richText = parseCmsRichText(parsed.richText);
|
|
433
438
|
if (richText) layout.richText = richText;
|
|
434
439
|
return layout;
|
|
@@ -437,11 +442,13 @@ function parseCmsTextLayout(value4) {
|
|
|
437
442
|
}
|
|
438
443
|
}
|
|
439
444
|
function cmsTextLayoutStyle(value4, templateBlock = false) {
|
|
440
|
-
const { width, height, fontFamily, fontSize, blockType } = parseCmsTextLayout(value4);
|
|
445
|
+
const { width, height, fontFamily, fontSize, blockType, lineHeight, textAlign } = parseCmsTextLayout(value4);
|
|
441
446
|
return {
|
|
442
|
-
...blockType && !templateBlock ? { fontSize: blockType === "h1" ? "2rem" : blockType === "h2" ? "1.5rem" : blockType === "h3" ? "1.25rem" : "1rem", fontWeight: blockType.startsWith("h") ? 700 : 400, lineHeight: 1.5 } : {},
|
|
447
|
+
...blockType && blockType !== "ul" && blockType !== "ol" && !templateBlock ? { fontSize: blockType === "h1" ? "2rem" : blockType === "h2" ? "1.5rem" : blockType === "h3" ? "1.25rem" : "1rem", fontWeight: blockType.startsWith("h") ? 700 : 400, lineHeight: 1.5 } : {},
|
|
443
448
|
...fontFamily ? { fontFamily } : {},
|
|
444
|
-
...fontSize ? { fontSize: `${fontSize}px
|
|
449
|
+
...fontSize ? { fontSize: `${fontSize}px` } : {},
|
|
450
|
+
...lineHeight ? { lineHeight } : {},
|
|
451
|
+
...textAlign ? { textAlign, justifyContent: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : "flex-start" } : {},
|
|
445
452
|
whiteSpace: "pre-wrap",
|
|
446
453
|
overflowWrap: "anywhere",
|
|
447
454
|
...width !== void 0 || height !== void 0 ? {
|
|
@@ -455,8 +462,8 @@ function cmsTextLayoutStyle(value4, templateBlock = false) {
|
|
|
455
462
|
function applyCmsTextLayout(element, value4) {
|
|
456
463
|
const styles = cmsTextLayoutStyle(value4);
|
|
457
464
|
const view = element.ownerDocument.defaultView;
|
|
458
|
-
if ((styles.width || styles.minHeight) && view?.getComputedStyle(element).display === "inline") {
|
|
459
|
-
styles.display = "inline-block";
|
|
465
|
+
if ((styles.textAlign || styles.width || styles.minHeight) && view?.getComputedStyle(element).display === "inline") {
|
|
466
|
+
styles.display = styles.textAlign ? "block" : "inline-block";
|
|
460
467
|
}
|
|
461
468
|
const previous = Object.keys(styles).map((key) => {
|
|
462
469
|
const property = key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
@@ -531,10 +538,12 @@ function EditableText({
|
|
|
531
538
|
}) {
|
|
532
539
|
const colorContext = useContext3(getTextColorContext());
|
|
533
540
|
const hidden = useCmsElementHidden(field);
|
|
534
|
-
const
|
|
541
|
+
const metadata = parseCmsTextLayout(colorContext?.content[`${field}TextLayout`]);
|
|
542
|
+
const legacyList = metadata.blockType === "ul" || metadata.blockType === "ol" ? metadata.blockType : void 0;
|
|
543
|
+
const listType = metadata.listType ?? legacyList;
|
|
544
|
+
const block = legacyList ? void 0 : metadata.blockType;
|
|
535
545
|
const templateBlock = useCmsTextBlock(block);
|
|
536
546
|
if (hidden) return /* @__PURE__ */ jsx3(CmsAddedElements, { field });
|
|
537
|
-
const isList = block === "ul" || block === "ol";
|
|
538
547
|
const colorValue = colorContext?.content[`${field}Color`];
|
|
539
548
|
const color = validTextColor(colorValue) ? colorValue : void 0;
|
|
540
549
|
const selected = editable && colorContext?.selectedTextField === field;
|
|
@@ -543,7 +552,7 @@ function EditableText({
|
|
|
543
552
|
"data-cms-text-field": field,
|
|
544
553
|
"data-cms-text-rendered": "true",
|
|
545
554
|
contentEditable: editable ? "plaintext-only" : false,
|
|
546
|
-
style: cmsTextLayoutStyle(colorContext?.content[`${field}TextLayout`], Boolean(templateBlock)),
|
|
555
|
+
style: { ...cmsTextLayoutStyle(colorContext?.content[`${field}TextLayout`], Boolean(templateBlock)), ...metadata.textAlign && !templateBlock ? { display: "block" } : {} },
|
|
547
556
|
suppressContentEditableWarning: true,
|
|
548
557
|
onBlur: (event) => onChange?.(field, readCmsEditableText(event.currentTarget)),
|
|
549
558
|
onClick: (event) => {
|
|
@@ -566,15 +575,16 @@ function EditableText({
|
|
|
566
575
|
"&:focus": { boxShadow: "0 0 0 2px #00A76F" }
|
|
567
576
|
}
|
|
568
577
|
},
|
|
578
|
+
...listType ? [{ font: "inherit", display: "block" }] : [],
|
|
569
579
|
...!templateBlock ? Array.isArray(sx) ? sx : sx ? [sx] : [] : [],
|
|
570
580
|
...color ? [{ color }] : [],
|
|
571
581
|
...selected ? [{ outline: "2px solid #00A76F", outlineOffset: 2 }] : []
|
|
572
582
|
],
|
|
573
583
|
children: renderCmsRichText(value4, parseCmsTextLayout(colorContext?.content[`${field}TextLayout`]).richText, component !== "a" && component !== "button")
|
|
574
584
|
};
|
|
575
|
-
const rendered = templateBlock ? /* @__PURE__ */ jsx3(Box, { component: templateBlock, ...textProps }, String(value4 ?? "")) : /* @__PURE__ */ jsx3(Typography, { component:
|
|
585
|
+
const rendered = templateBlock ? /* @__PURE__ */ jsx3(Box, { component: templateBlock, ...textProps }, String(value4 ?? "")) : /* @__PURE__ */ jsx3(Typography, { component: block ?? (listType ? "span" : component) ?? "div", variant, ...textProps }, String(value4 ?? ""));
|
|
576
586
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
577
|
-
|
|
587
|
+
listType ? /* @__PURE__ */ jsx3(CmsTextList, { field, type: listType, children: /* @__PURE__ */ jsx3("li", { children: rendered }) }) : rendered,
|
|
578
588
|
/* @__PURE__ */ jsx3(CmsAddedElements, { field })
|
|
579
589
|
] });
|
|
580
590
|
}
|
|
@@ -3537,16 +3547,20 @@ function ExactText({ cmsAs, children, style, cmsDefaultRichText, cmsField, ...pr
|
|
|
3537
3547
|
const entry = explicitField ? { field: explicitField, layout: content?.[`${explicitField}TextLayout`], color: typeof content?.[`${explicitField}Color`] === "string" ? String(content[`${explicitField}Color`]) : void 0 } : entries.get(normalize(plainText(children)));
|
|
3538
3548
|
if (explicitField && content?.[explicitField] !== void 0) children = String(content[explicitField]);
|
|
3539
3549
|
const hidden = useCmsElementHidden(entry?.field);
|
|
3540
|
-
const
|
|
3550
|
+
const metadata = parseCmsTextLayout(entry?.layout);
|
|
3551
|
+
const legacyList = metadata.blockType === "ul" || metadata.blockType === "ol" ? metadata.blockType : void 0;
|
|
3552
|
+
const listType = metadata.listType ?? legacyList;
|
|
3553
|
+
const block = legacyList ? void 0 : metadata.blockType;
|
|
3554
|
+
const listItem = cmsAs === "li" && Boolean(block);
|
|
3541
3555
|
const templateBlock = useCmsTextBlock(block);
|
|
3542
3556
|
if (hidden) return /* @__PURE__ */ jsx8(CmsAddedElements, { field: entry?.field });
|
|
3543
|
-
const
|
|
3544
|
-
const host = block ? isList ? "li" : block : cmsAs;
|
|
3557
|
+
const host = block ?? (listType ? "span" : cmsAs);
|
|
3545
3558
|
const layout = entry ? cmsTextLayoutStyle(entry.layout, Boolean(templateBlock)) : void 0;
|
|
3546
3559
|
const sized = layout?.width || layout?.minHeight;
|
|
3547
3560
|
const rendered = createElement2(templateBlock ?? (typeof cmsAs === "string" ? host : cmsAs), {
|
|
3548
3561
|
...block && !templateBlock && typeof cmsAs !== "string" ? { as: host } : {},
|
|
3549
3562
|
...props,
|
|
3563
|
+
...listItem ? { "data-cms-list-item": void 0 } : {},
|
|
3550
3564
|
// Replace the edited host when plain text changes; browser-created text nodes
|
|
3551
3565
|
// must not be reconciled against the previous annotation tree.
|
|
3552
3566
|
key: plainText(children),
|
|
@@ -3555,11 +3569,11 @@ function ExactText({ cmsAs, children, style, cmsDefaultRichText, cmsField, ...pr
|
|
|
3555
3569
|
"data-cms-text-rendered": "true",
|
|
3556
3570
|
"data-cms-text-default-rich": cmsDefaultRichText ? JSON.stringify(cmsDefaultRichText) : void 0,
|
|
3557
3571
|
"data-cms-text-sized": sized ? "true" : void 0,
|
|
3558
|
-
style: { ...style, ...layout, ...entry.color ? { color: entry.color } : {} }
|
|
3572
|
+
style: { ...style, ...layout, ...metadata.textAlign && host === "span" ? { display: "block" } : {}, ...entry.color ? { color: entry.color } : {} }
|
|
3559
3573
|
} : { style }
|
|
3560
3574
|
}, entry ? renderCmsRichText(children, parseCmsTextLayout(entry.layout).richText ?? cmsDefaultRichText, cmsAs !== "a" && cmsAs !== "button" && !props.href) : children);
|
|
3561
3575
|
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
3562
|
-
|
|
3576
|
+
listType && entry ? /* @__PURE__ */ jsx8(CmsTextList, { field: entry.field, type: listType, children: /* @__PURE__ */ jsx8("li", { children: rendered }) }) : listItem ? /* @__PURE__ */ jsx8("li", { "data-cms-list-item": props["data-cms-list-item"], children: rendered }) : rendered,
|
|
3563
3577
|
/* @__PURE__ */ jsx8(CmsAddedElements, { field: entry?.field })
|
|
3564
3578
|
] });
|
|
3565
3579
|
}
|
|
@@ -16532,12 +16546,30 @@ var wikexCommodityRoutes = wikexCommodityPageTemplates.map(({ route, slug, key }
|
|
|
16532
16546
|
|
|
16533
16547
|
// src/shared/text-toolbar.tsx
|
|
16534
16548
|
import { useEffect as useEffect11, useRef as useRef10, useState as useState16 } from "react";
|
|
16535
|
-
import { Box as Box7,
|
|
16549
|
+
import { Box as Box7, IconButton as IconButton3, InputAdornment as InputAdornment2, MenuItem as MenuItem3, Select as Select3, SvgIcon, TextField as TextField3, ToggleButton as ToggleButton2, Tooltip } from "@mui/material";
|
|
16536
16550
|
import { jsx as jsx47, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
16537
|
-
function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureControls, computedFontSize, onLayoutChange, onColorChange, onReset }) {
|
|
16551
|
+
function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureControls, computedFontSize, computedLineHeight, computedFontFamily, computedTextAlign, onLayoutChange, onColorChange, onReset }) {
|
|
16538
16552
|
const toolbarRef = useRef10(null);
|
|
16539
16553
|
const [hex, setHex] = useState16(color);
|
|
16540
16554
|
const displayedSize = String(computedFontSize ?? layout.fontSize ?? 16);
|
|
16555
|
+
const displayedLineHeight = String(layout.lineHeight ?? computedLineHeight ?? 1.5);
|
|
16556
|
+
const dirtyLineHeight = useRef10(false);
|
|
16557
|
+
const [lineHeight, setLineHeight] = useState16(displayedLineHeight);
|
|
16558
|
+
useEffect11(() => {
|
|
16559
|
+
dirtyLineHeight.current = false;
|
|
16560
|
+
setLineHeight(displayedLineHeight);
|
|
16561
|
+
}, [displayedLineHeight]);
|
|
16562
|
+
const commitLineHeight = () => {
|
|
16563
|
+
if (!dirtyLineHeight.current) return;
|
|
16564
|
+
dirtyLineHeight.current = false;
|
|
16565
|
+
if (!lineHeight.trim()) {
|
|
16566
|
+
onLayoutChange({ lineHeight: void 0 });
|
|
16567
|
+
return;
|
|
16568
|
+
}
|
|
16569
|
+
const value4 = Number(lineHeight);
|
|
16570
|
+
if (Number.isFinite(value4) && value4 >= 0.5 && value4 <= 5) onLayoutChange({ lineHeight: value4 });
|
|
16571
|
+
else setLineHeight(displayedLineHeight);
|
|
16572
|
+
};
|
|
16541
16573
|
const dirtySize = useRef10(false);
|
|
16542
16574
|
const [size, setSize] = useState16(displayedSize);
|
|
16543
16575
|
useEffect11(() => setHex(color), [color]);
|
|
@@ -16560,6 +16592,13 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
|
|
|
16560
16592
|
if (Number.isFinite(value4) && value4 >= 8 && value4 <= 300) onLayoutChange({ fontSize: value4 });
|
|
16561
16593
|
else setSize(displayedSize);
|
|
16562
16594
|
};
|
|
16595
|
+
const fontName = (computedFontFamily ?? layout.fontFamily ?? "Arial").split(",")[0].trim().replace(/^["']|["']$/g, "");
|
|
16596
|
+
const matchedFont = Object.entries(CMS_TEXT_FONTS).find(([family]) => family.split(",")[0].replace(/^["']|["']$/g, "").toLowerCase() === fontName.toLowerCase());
|
|
16597
|
+
const fontLabel = matchedFont?.[1] ?? fontName;
|
|
16598
|
+
const selectedFont = layout.fontFamily ?? matchedFont?.[0] ?? "";
|
|
16599
|
+
const tooltipProps = { slotProps: { popper: { sx: { zIndex: 1800 } } } };
|
|
16600
|
+
const inputSx = { width: 52, flexShrink: 0, "& .MuiInputBase-root": { height: 32 }, "& input": { py: 0.5, px: 0.75, fontSize: 12 } };
|
|
16601
|
+
const groupSx = { display: "flex", alignItems: "center", gap: 0.5 };
|
|
16563
16602
|
return /* @__PURE__ */ jsxs40(
|
|
16564
16603
|
Box7,
|
|
16565
16604
|
{
|
|
@@ -16567,80 +16606,103 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
|
|
|
16567
16606
|
role: "toolbar",
|
|
16568
16607
|
"aria-label": "\u0110\u1ECBnh d\u1EA1ng ch\u1EEF",
|
|
16569
16608
|
"data-cms-text-toolbar": true,
|
|
16570
|
-
sx: { display: "flex",
|
|
16609
|
+
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%" },
|
|
16571
16610
|
children: [
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
|
|
16576
|
-
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16611
|
+
/* @__PURE__ */ jsxs40(Box7, { sx: { ...groupSx, flexWrap: "wrap", pb: 0.5, borderBottom: "1px solid", borderColor: "divider" }, children: [
|
|
16612
|
+
/* @__PURE__ */ jsxs40(
|
|
16613
|
+
Select3,
|
|
16614
|
+
{
|
|
16615
|
+
size: "small",
|
|
16616
|
+
displayEmpty: true,
|
|
16617
|
+
value: selectedFont,
|
|
16618
|
+
inputProps: { "aria-label": "Font ch\u1EEF" },
|
|
16619
|
+
renderValue: (value4) => value4 ? CMS_TEXT_FONTS[value4] : fontLabel,
|
|
16620
|
+
MenuProps: { disableScrollLock: true, container: () => toolbarRef.current?.ownerDocument.body ?? null, sx: { zIndex: 1600 }, slotProps: { paper: { sx: { maxHeight: 320 } } } },
|
|
16621
|
+
sx: { width: 128, height: 30, fontSize: 12, "& .MuiSelect-select": { py: 0.5, pl: 1, pr: "24px !important" }, "& .MuiSelect-icon": { right: 3 } },
|
|
16622
|
+
onChange: (event) => onLayoutChange({ fontFamily: event.target.value || void 0 }),
|
|
16623
|
+
children: [
|
|
16624
|
+
!selectedFont && /* @__PURE__ */ jsx47(MenuItem3, { value: "", sx: { fontSize: 12 }, children: fontLabel }),
|
|
16625
|
+
Object.entries(CMS_TEXT_FONTS).map(([value4, label]) => /* @__PURE__ */ jsx47(MenuItem3, { value: value4, sx: { fontFamily: value4, fontSize: 13 }, children: label }, value4))
|
|
16626
|
+
]
|
|
16627
|
+
}
|
|
16628
|
+
),
|
|
16629
|
+
structureControls
|
|
16630
|
+
] }),
|
|
16631
|
+
/* @__PURE__ */ jsxs40(Box7, { sx: { ...groupSx, flexWrap: "wrap" }, children: [
|
|
16632
|
+
/* @__PURE__ */ jsx47(Tooltip, { title: "C\u1EE1 ch\u1EEF (px)", ...tooltipProps, children: /* @__PURE__ */ jsx47(
|
|
16633
|
+
TextField3,
|
|
16634
|
+
{
|
|
16635
|
+
size: "small",
|
|
16636
|
+
type: "number",
|
|
16637
|
+
value: size,
|
|
16638
|
+
slotProps: { htmlInput: { "aria-label": "C\u1EE1 ch\u1EEF (px)", min: 8, max: 300, step: 1 } },
|
|
16639
|
+
sx: inputSx,
|
|
16640
|
+
onChange: (event) => {
|
|
16641
|
+
dirtySize.current = true;
|
|
16642
|
+
setSize(event.target.value);
|
|
16643
|
+
},
|
|
16644
|
+
onBlur: commitSize,
|
|
16645
|
+
onKeyDown: (event) => {
|
|
16646
|
+
if (event.key === "Enter") {
|
|
16647
|
+
event.preventDefault();
|
|
16648
|
+
commitSize();
|
|
16649
|
+
}
|
|
16606
16650
|
}
|
|
16607
16651
|
}
|
|
16608
|
-
}
|
|
16609
|
-
|
|
16610
|
-
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
|
|
16621
|
-
|
|
16622
|
-
|
|
16623
|
-
|
|
16624
|
-
|
|
16625
|
-
|
|
16652
|
+
) }),
|
|
16653
|
+
/* @__PURE__ */ jsx47(Tooltip, { title: "Chi\u1EC1u cao d\xF2ng (l\u1EA7n c\u1EE1 ch\u1EEF)", ...tooltipProps, children: /* @__PURE__ */ jsx47(
|
|
16654
|
+
TextField3,
|
|
16655
|
+
{
|
|
16656
|
+
size: "small",
|
|
16657
|
+
type: "number",
|
|
16658
|
+
value: lineHeight,
|
|
16659
|
+
slotProps: { input: { startAdornment: /* @__PURE__ */ jsx47(InputAdornment2, { position: "start", sx: { mr: 0 }, children: /* @__PURE__ */ jsx47(SvgIcon, { sx: { fontSize: 17 }, children: /* @__PURE__ */ jsx47("path", { d: "M3 4 0 7h2v10H0l3 3 3-3H4V7h2L3 4zm5 2h16v2H8zm0 5h16v2H8zm0 5h16v2H8z" }) }) }) }, htmlInput: { "aria-label": "Chi\u1EC1u cao d\xF2ng", min: 0.5, max: 5, step: 0.1 } },
|
|
16660
|
+
sx: { ...inputSx, width: 78, "& .MuiInputBase-root": { height: 32, pl: 0.75 } },
|
|
16661
|
+
onChange: (event) => {
|
|
16662
|
+
dirtyLineHeight.current = true;
|
|
16663
|
+
setLineHeight(event.target.value);
|
|
16664
|
+
},
|
|
16665
|
+
onBlur: commitLineHeight,
|
|
16666
|
+
onKeyDown: (event) => {
|
|
16667
|
+
if (event.key === "Enter") {
|
|
16668
|
+
event.preventDefault();
|
|
16669
|
+
commitLineHeight();
|
|
16670
|
+
}
|
|
16626
16671
|
}
|
|
16627
16672
|
}
|
|
16628
|
-
}
|
|
16629
|
-
|
|
16630
|
-
|
|
16631
|
-
|
|
16632
|
-
|
|
16633
|
-
|
|
16634
|
-
|
|
16635
|
-
|
|
16636
|
-
|
|
16637
|
-
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
|
|
16641
|
-
|
|
16642
|
-
|
|
16643
|
-
|
|
16673
|
+
) }),
|
|
16674
|
+
/* @__PURE__ */ jsx47(Box7, { sx: groupSx, children: inlineControls }),
|
|
16675
|
+
/* @__PURE__ */ jsx47(Box7, { sx: { ...groupSx, borderLeft: "1px solid", borderColor: "divider", pl: 1, ml: 0.5 }, children: [["left", "C\u0103n tr\xE1i"], ["center", "C\u0103n gi\u1EEFa"], ["right", "C\u0103n ph\u1EA3i"]].map(([align, label]) => /* @__PURE__ */ jsx47(Tooltip, { title: label, ...tooltipProps, children: /* @__PURE__ */ jsx47(
|
|
16676
|
+
ToggleButton2,
|
|
16677
|
+
{
|
|
16678
|
+
value: align,
|
|
16679
|
+
selected: (layout.textAlign ?? computedTextAlign ?? "left") === align,
|
|
16680
|
+
"aria-label": label,
|
|
16681
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
16682
|
+
onClick: () => onLayoutChange({ textAlign: align }),
|
|
16683
|
+
sx: { width: 30, height: 30, p: 0.5, border: 0 },
|
|
16684
|
+
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
|
+
}
|
|
16686
|
+
) }, align)) }),
|
|
16687
|
+
colorPicker || /* @__PURE__ */ jsx47(
|
|
16688
|
+
TextField3,
|
|
16689
|
+
{
|
|
16690
|
+
size: "small",
|
|
16691
|
+
value: hex,
|
|
16692
|
+
slotProps: { htmlInput: { "aria-label": "M\xE3 m\xE0u ch\u1EEF", maxLength: 7, spellCheck: false } },
|
|
16693
|
+
sx: { ...inputSx, width: 76 },
|
|
16694
|
+
onChange: (event) => setHex(event.target.value),
|
|
16695
|
+
onBlur: commitColor,
|
|
16696
|
+
onKeyDown: (event) => {
|
|
16697
|
+
if (event.key === "Enter") {
|
|
16698
|
+
event.preventDefault();
|
|
16699
|
+
commitColor();
|
|
16700
|
+
}
|
|
16701
|
+
}
|
|
16702
|
+
}
|
|
16703
|
+
),
|
|
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, ml: "auto" }, 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
|
+
] })
|
|
16644
16706
|
]
|
|
16645
16707
|
}
|
|
16646
16708
|
);
|