@ecomcx/ecomweb-editor 1.31.0 → 1.33.0
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/package.json +3 -3
- package/src/locales/en/attrs.ts +10 -0
- package/src/locales/en/background.ts +17 -0
- package/src/locales/en/bindings.ts +1 -1
- package/src/locales/en/block-desc.ts +2 -0
- package/src/locales/en/block-style.ts +7 -4
- package/src/locales/en/block-titles.ts +2 -0
- package/src/locales/en/blocks.ts +12 -3
- package/src/locales/en/columns.ts +12 -0
- package/src/locales/en/controls.ts +21 -0
- package/src/locales/en/hints.ts +289 -1
- package/src/locales/en/index.ts +5 -2
- package/src/locales/en/layout.ts +32 -0
- package/src/locales/en/legacy.ts +1 -1
- package/src/locales/en/library.ts +38 -0
- package/src/locales/en/parts.ts +12 -0
- package/src/locales/en/placeholders.ts +12 -1
- package/src/locales/en/presets.ts +6 -0
- package/src/locales/en/v2.ts +21 -0
- package/src/locales/vi/attrs.ts +10 -0
- package/src/locales/vi/background.ts +17 -0
- package/src/locales/vi/bindings.ts +1 -1
- package/src/locales/vi/block-desc.ts +2 -0
- package/src/locales/vi/block-style.ts +7 -4
- package/src/locales/vi/block-titles.ts +2 -0
- package/src/locales/vi/blocks.ts +12 -3
- package/src/locales/vi/columns.ts +12 -0
- package/src/locales/vi/controls.ts +21 -0
- package/src/locales/vi/hints.ts +290 -2
- package/src/locales/vi/index.ts +5 -2
- package/src/locales/vi/layout.ts +32 -0
- package/src/locales/vi/legacy.ts +1 -1
- package/src/locales/vi/library.ts +38 -0
- package/src/locales/vi/parts.ts +12 -0
- package/src/locales/vi/placeholders.ts +12 -1
- package/src/locales/vi/presets.ts +6 -0
- package/src/locales/vi/v2.ts +21 -0
- package/src/shared/panel-store.ts +3 -3
- package/src/shared/patterns.ts +3 -52
- package/src/shared/style-panel.tsx +2 -2
- package/src/shared/types.ts +2 -0
- package/src/v2/blocks/columns-inspector.tsx +210 -0
- package/src/v2/blocks/form.tsx +4 -4
- package/src/v2/blocks/index.ts +10 -4
- package/src/v2/blocks/inline-style.ts +1 -1
- package/src/v2/blocks/layout.tsx +211 -44
- package/src/v2/blocks/media.tsx +22 -13
- package/src/v2/blocks/resize.tsx +172 -4
- package/src/v2/blocks/text.tsx +14 -7
- package/src/v2/blocks/theme.tsx +63 -19
- package/src/v2/blocks/tools.tsx +50 -5
- package/src/v2/blocks/widgets.tsx +44 -16
- package/src/v2/canvas/block-list.tsx +23 -3
- package/src/v2/canvas/canvas-css.ts +70 -4
- package/src/v2/canvas/canvas.tsx +22 -5
- package/src/v2/canvas/dnd.ts +34 -3
- package/src/v2/canvas/move-animation.ts +94 -0
- package/src/v2/canvas/spacing-viz.ts +51 -0
- package/src/v2/core/block-presets.ts +68 -0
- package/src/v2/core/host.ts +6 -1
- package/src/v2/core/structure.ts +2 -1
- package/src/v2/editor.css +238 -9
- package/src/v2/editor.tsx +8 -2
- package/src/v2/ui/attr-form.tsx +59 -12
- package/src/v2/ui/attr-hints.ts +140 -9
- package/src/v2/ui/background-panel.tsx +65 -21
- package/src/v2/ui/bindings.tsx +3 -0
- package/src/v2/ui/block-icons.tsx +152 -0
- package/src/v2/ui/block-menu.ts +22 -0
- package/src/v2/ui/block-style-panel.tsx +14 -3
- package/src/v2/ui/color-field.tsx +74 -9
- package/src/v2/ui/divider-panel.tsx +58 -0
- package/src/v2/ui/group-width.tsx +38 -0
- package/src/v2/ui/icon-picker.tsx +51 -0
- package/src/v2/ui/inserter.tsx +61 -12
- package/src/v2/ui/inspector.tsx +48 -16
- package/src/v2/ui/layout-panel.tsx +5 -47
- package/src/v2/ui/list-view.tsx +81 -7
- package/src/v2/ui/motion-panel.tsx +2 -1
- package/src/v2/ui/parts-panel.tsx +164 -0
- package/src/v2/ui/pattern-library.tsx +228 -0
- package/src/v2/ui/preset-bar.tsx +83 -0
- package/src/v2/ui/style-controls.tsx +65 -15
- package/src/v2/ui/style-supports.ts +1 -1
- package/src/v2/ui/style-tab.tsx +127 -41
- package/src/v2/ui/toolbar.tsx +52 -13
- package/src/v2/ui/unit-controls.tsx +88 -39
- package/src/locales/en/patterns.ts +0 -50
- package/src/locales/vi/patterns.ts +0 -50
- package/src/shared/patterns-kit.ts +0 -7
- package/src/shared/patterns-library.ts +0 -172
package/src/v2/ui/style-tab.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { normalizeStyle, type BlockStyle, type Device } from "@ecomcx/ecomweb-content";
|
|
2
|
-
import { AlignCenter, AlignJustify, AlignLeft, AlignRight
|
|
2
|
+
import { AlignCenter, AlignJustify, AlignLeft, AlignRight } from "lucide-react";
|
|
3
3
|
import { useEffect, useState, type ReactNode } from "react";
|
|
4
4
|
import { labelsLegacy, type EditorLabels } from "../../shared/labels";
|
|
5
5
|
import { useEditor } from "../context";
|
|
6
6
|
import { ColorInput } from "./color-field";
|
|
7
|
-
import {
|
|
7
|
+
import { GradientField } from "./layout-panel";
|
|
8
8
|
import { MotionPanel } from "./motion-panel";
|
|
9
|
-
import { Section, Seg, cx } from "./style-controls";
|
|
9
|
+
import { Row, Section, Seg, StateTabs, cx } from "./style-controls";
|
|
10
10
|
import { styleGroups, type StyleGroup } from "./style-supports";
|
|
11
|
-
import { SpacingControl, UnitInput } from "./unit-controls";
|
|
11
|
+
import { FourInput, SpacingControl, UnitInput } from "./unit-controls";
|
|
12
12
|
import { useMsgs } from "../i18n";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -17,12 +17,18 @@ import { useMsgs } from "../i18n";
|
|
|
17
17
|
* chưa đặt cho khổ nhỏ thì hiện giá trị kế thừa từ khổ lớn hơn.
|
|
18
18
|
*/
|
|
19
19
|
type Style = BlockStyle & Record<string, any>;
|
|
20
|
-
const RESPONSIVE = new Set(["padding", "margin", "gap", "width", "maxWidth", "minHeight", "fontSize", "lineHeight", "letterSpacing", "textAlign"]);
|
|
20
|
+
const RESPONSIVE = new Set(["padding", "margin", "gap", "width", "maxWidth", "minHeight", "fontSize", "lineHeight", "letterSpacing", "textAlign", "order"]);
|
|
21
21
|
const SIZES = ["sm", "md", "lg", "xl", "2xl"];
|
|
22
22
|
const SPACES = ["0", "xs", "sm", "md", "lg", "xl", "2xl"];
|
|
23
23
|
const WEIGHTS = ["300", "400", "500", "600", "700", "800", "900"];
|
|
24
|
-
const TYPO = ["fontFamily", "fontSize", "lineHeight", "letterSpacing", "fontWeight", "fontStyle", "textDecoration", "textTransform", "textAlign"];
|
|
25
|
-
const SPACING = ["padding", "margin"
|
|
24
|
+
const TYPO = ["fontFamily", "fontSize", "lineHeight", "letterSpacing", "fontWeight", "fontStyle", "textDecoration", "textTransform", "textAlign", "textShadow", "writingMode"];
|
|
25
|
+
const SPACING = ["padding", "margin"];
|
|
26
|
+
const STRUCTURE = ["gap", "width", "maxWidth", "minHeight", "aspectRatio", "zIndex", "grow", "order"];
|
|
27
|
+
type State = "normal" | "hover";
|
|
28
|
+
|
|
29
|
+
/** Bậc preset theo cỡ tăng dần (theme có thể khai lộn thứ tự: lg trước md). Tên lạ giữ thứ tự khai, đứng sau. */
|
|
30
|
+
const STEP_ORDER = ["0", "none", "3xs", "2xs", "xxs", "xs", "sm", "md", "base", "lg", "xl", "2xl", "xxl", "3xl", "4xl", "5xl", "6xl"];
|
|
31
|
+
export const byStep = (keys: string[]) => [...keys].sort((a, b) => { const i = STEP_ORDER.indexOf(a), j = STEP_ORDER.indexOf(b); return (i < 0 ? 99 : i) - (j < 0 ? 99 : j); });
|
|
26
32
|
|
|
27
33
|
/** Ô giá trị (preset như `lg` hoặc `16px`, `1.5rem`…): lưu khi rời ô / Enter; sai thì viền đỏ, không lưu. */
|
|
28
34
|
function ValueInput({ value, onCommit, check, placeholder, label, inherited }: { value?: string | number; onCommit(v: string | null): void; check(v: string): boolean; placeholder?: string; label: string; inherited?: string }) {
|
|
@@ -44,18 +50,44 @@ function ValueInput({ value, onCommit, check, placeholder, label, inherited }: {
|
|
|
44
50
|
* `part`: "style" = biến thể, chữ, màu (tab Kiểu dáng); "advanced" = khoảng cách, viền, bố cục / hiệu ứng, hover, chuyển động, ẩn hiện
|
|
45
51
|
* (tab Nâng cao — lớp chung của mọi khối như Advanced của Elementor); bỏ trống = tất cả. Ô Nền vẽ ở BackgroundControl.
|
|
46
52
|
*/
|
|
47
|
-
|
|
53
|
+
function TextShadowRow({ style, set }: { style: BlockStyle; set(k: "textShadow", v: BlockStyle["textShadow"]): void }) {
|
|
54
|
+
const lt = useMsgs("layout") as Record<string, string>;
|
|
55
|
+
const sh = style.textShadow;
|
|
56
|
+
const put = (p: Partial<NonNullable<BlockStyle["textShadow"]>>) => set("textShadow", { x: 0, y: 2, blur: 4, color: "black/30", ...sh, ...p });
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
<label className="ecx-check-row"><input type="checkbox" role="switch" className="ecx-switch" aria-label={lt.textShadow} checked={!!sh} onChange={(e) => set("textShadow", e.target.checked ? { x: 0, y: 2, blur: 4, color: "black/30" } : undefined)} /> {lt.textShadow}</label>
|
|
60
|
+
{sh && (
|
|
61
|
+
<div className="ecx-textshadow">
|
|
62
|
+
{([["x", lt.tsX, -20, 20], ["y", lt.tsY, -20, 20], ["blur", lt.tsBlur, 0, 40]] as const).map(([k, label, min, max]) => (
|
|
63
|
+
<label key={k} className="ecx-textshadow-row"><span>{label}: {sh[k]}px</span><input type="range" className="ecx-range" min={min} max={max} aria-label={label} value={sh[k]} onChange={(e) => put({ [k]: Number(e.target.value) })} /></label>
|
|
64
|
+
))}
|
|
65
|
+
<ColorInput label={lt.tsColor} value={sh.color} onChange={(c) => put({ color: c ?? "black/30" })} />
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, variants, variant, onVariantChange, part, lead, parts, structure }: {
|
|
48
73
|
type: string; style: unknown; onChange(style: BlockStyle | null): void; device: Device; onDeviceChange(d: Device): void;
|
|
49
74
|
variants?: Array<{ name: string; label: string }>; variant?: string | null; onVariantChange?(v: string | null): void; part?: "style" | "advanced";
|
|
50
75
|
/** Mục vẽ sau Chữ / Màu (mục riêng của khối, ô Nền). */
|
|
51
76
|
lead?: ReactNode;
|
|
77
|
+
/** Ô đứng đầu mục Cấu trúc (vd thẻ HTML của khối chứa — là thuộc tính của khối, không nằm trong style). */
|
|
78
|
+
structure?: ReactNode;
|
|
79
|
+
/** Khối chia phần: các phần đứng đầu; Kiểu chữ / Màu chung của cả khối chỉ hiện khi đã có giá trị (nội dung cũ). */
|
|
80
|
+
parts?: boolean;
|
|
52
81
|
}) {
|
|
53
82
|
const { host, labels, registry } = useEditor();
|
|
54
83
|
const t = labelsLegacy(labels.lang);
|
|
55
84
|
const ct = useMsgs("controls");
|
|
85
|
+
const lt = useMsgs("layout");
|
|
86
|
+
const [colorState, setColorState] = useState<State>("normal");
|
|
87
|
+
const [borderState, setBorderState] = useState<State>("normal");
|
|
56
88
|
const presets = host.presets;
|
|
57
|
-
const sizes = presets?.fontSizes ? Object.keys(presets.fontSizes) : SIZES;
|
|
58
|
-
const spaces = presets?.spacing ? ["0", ...Object.keys(presets.spacing)] : SPACES;
|
|
89
|
+
const sizes = presets?.fontSizes ? byStep(Object.keys(presets.fontSizes)) : SIZES;
|
|
90
|
+
const spaces = presets?.spacing ? ["0", ...byStep(Object.keys(presets.spacing))] : SPACES;
|
|
59
91
|
const fonts = presets?.fonts ? Object.keys(presets.fonts) : ["body", "heading", "mono"];
|
|
60
92
|
const style: Style = (normalizeStyle(raw) ?? {}) as Style;
|
|
61
93
|
|
|
@@ -75,7 +107,7 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
75
107
|
} else next[k] = v === "" ? undefined : v;
|
|
76
108
|
commit(next);
|
|
77
109
|
};
|
|
78
|
-
const setGroup = (k: "color" | "border", sub: string, v: unknown) => set(k, { ...(style[k] ?? {}), [sub]: v });
|
|
110
|
+
const setGroup = (k: "color" | "border" | "link", sub: string, v: unknown) => set(k, { ...(style[k] ?? {}), [sub]: v });
|
|
79
111
|
// Khoá theo khổ (cỡ chữ, khoảng cách…): chỉ bỏ giá trị của khổ đang chọn, không xoá các khổ khác
|
|
80
112
|
const reset = (keys: string[]) => {
|
|
81
113
|
const next: Style = { ...style };
|
|
@@ -89,23 +121,33 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
89
121
|
};
|
|
90
122
|
const has = (keys: string[]) => keys.some((k) => RESPONSIVE.has(k) && device !== "base" ? style[k]?.[device] !== undefined : style[k] !== undefined);
|
|
91
123
|
const ok = (k: string) => (v: string) => !!normalizeStyle({ [k]: v });
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
124
|
+
// Ô chuẩn: cụm khổ màn hình nếu ô chỉnh theo khổ; nút ↶ khi ô (ở khổ đang xem) đã có giá trị
|
|
125
|
+
const KEYS: Record<string, string[]> = { appearance: ["fontWeight", "fontStyle"], decoration: ["textDecoration"], transform: ["textTransform"], borderWidth: [], borderStyle: [], borderColor: [] };
|
|
126
|
+
const row = (k: string, label: string, control: ReactNode) => {
|
|
127
|
+
const keys = KEYS[k] ?? [k];
|
|
128
|
+
return <Row key={k} label={label} device={RESPONSIVE.has(k) ? device : undefined} onReset={keys.length && has(keys) ? () => reset(keys) : undefined}>{control}</Row>;
|
|
129
|
+
};
|
|
96
130
|
// Nhóm khối hỗ trợ; nhóm đã có giá trị vẫn hiện để sửa / xoá (dữ liệu cũ, khối dán từ nơi khác)
|
|
97
131
|
const groups = styleGroups(type, registry.get(type));
|
|
98
|
-
|
|
99
|
-
const
|
|
132
|
+
// Như bộ khối lớn: Kiểu dáng = chữ, màu, viền, nền & hiệu ứng, khi rê chuột; Nâng cao = khoảng cách, bố cục, ghim, chuyển động, hiển thị
|
|
133
|
+
const inPart = (g: StyleGroup) => !part || (part === "style") === ["typography", "color", "border"].includes(g);
|
|
134
|
+
const show = (g: StyleGroup, keys: string[]) => inPart(g) && ((groups.has(g) && !(parts && (g === "typography" || g === "color"))) || keys.some((k) => style[k] !== undefined));
|
|
135
|
+
const container = registry.get(type)?.kind === "container";
|
|
136
|
+
// Trạng thái rê chuột nằm ngay trong mục Màu / Viền (công tắc Thường · Rê chuột), không còn mục "Khi rê chuột" riêng
|
|
137
|
+
const hoverOk = groups.has("hover") || style.hover !== undefined;
|
|
138
|
+
const fxOk = groups.has("effects") || ["gradient", "shadow", "aspectRatio", "position"].some((k) => style[k] !== undefined);
|
|
139
|
+
const setHover = (patch: NonNullable<BlockStyle["hover"]>) => set("hover", { ...style.hover, ...patch });
|
|
140
|
+
const shadows = ["sm", "md", "lg", "xl", ...Object.keys(presets?.shadows ?? {}).filter((x) => !["sm", "md", "lg", "xl"].includes(x))];
|
|
141
|
+
const shadowSelect = (value: string | undefined, onPick: (v: string | undefined) => void, label: string, none = true) => (
|
|
142
|
+
<select className="ecx-input" aria-label={label} value={value ?? ""} onChange={(e) => onPick(e.target.value || undefined)}>
|
|
143
|
+
<option value="">—</option>{none && <option value="none">{lt.none}</option>}
|
|
144
|
+
{shadows.map((x) => <option key={x} value={x}>{x.toUpperCase()}</option>)}
|
|
145
|
+
</select>
|
|
146
|
+
);
|
|
100
147
|
const appearance = `${style.fontWeight ?? ""}${style.fontStyle === "italic" ? "i" : ""}`;
|
|
101
148
|
|
|
102
149
|
return (
|
|
103
150
|
<div className="ecx-style-tab">
|
|
104
|
-
<div className="ecx-style-device">
|
|
105
|
-
<span className="ecx-field-label">{t.device}</span>
|
|
106
|
-
<Seg label={t.device} value={device} onChange={(d) => onDeviceChange(d ?? "base")}
|
|
107
|
-
options={[["base", Monitor, t.device_base], ["tablet", Tablet, t.device_tablet], ["mobile", Smartphone, t.device_mobile]]} />
|
|
108
|
-
</div>
|
|
109
151
|
|
|
110
152
|
{part !== "advanced" && variants && variants.length > 0 && (
|
|
111
153
|
<div className="ecx-style-row">
|
|
@@ -119,7 +161,9 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
119
161
|
</div>
|
|
120
162
|
)}
|
|
121
163
|
|
|
122
|
-
{
|
|
164
|
+
{parts && lead}
|
|
165
|
+
|
|
166
|
+
{show("typography", TYPO) && <Section title={t.style_typography} modified={has(TYPO)} onReset={() => reset(TYPO)} moreOpen={has(["fontFamily", "letterSpacing", "textDecoration", "textTransform", "textShadow", "writingMode"])}
|
|
123
167
|
more={<>
|
|
124
168
|
{row("fontFamily", t.style_fontFamily,
|
|
125
169
|
<select className="ecx-input" value={style.fontFamily ?? ""} aria-label={t.style_fontFamily} onChange={(e) => set("fontFamily", e.target.value || undefined)}>
|
|
@@ -131,6 +175,9 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
131
175
|
options={[["none", "—", t.none], ["underline", "U̲", t.underlineText], ["line-through", "S̶", t.strikeText]]} />)}
|
|
132
176
|
{row("transform", t.style_transform, <Seg label={t.style_transform} value={style.textTransform} onChange={(v) => set("textTransform", v)}
|
|
133
177
|
options={[["none", "—", t.none], ["uppercase", "AB", t.upper], ["lowercase", "ab", t.lower], ["capitalize", "Ab", t.capitalize]]} />)}
|
|
178
|
+
{row("writingMode", lt.writingMode, <Seg label={lt.writingMode} value={style.writingMode ?? "horizontal"} onChange={(v) => set("writingMode", v === "vertical" ? "vertical" : undefined)}
|
|
179
|
+
options={[["horizontal", lt.wmHorizontal, lt.wmHorizontal], ["vertical", lt.wmVertical, lt.wmVertical]]} />)}
|
|
180
|
+
<TextShadowRow style={style} set={set} />
|
|
134
181
|
</>}>
|
|
135
182
|
{row("fontSize", t.style_fontSize, <>
|
|
136
183
|
<Seg label={t.style_fontSize} value={get("fontSize")} onChange={(v) => set("fontSize", v)} options={sizes.map((v) => [v, v.toUpperCase(), presets?.fontSizes?.[v] ? `${v} · ${presets.fontSizes[v]}` : v] as [string, string, string])} />
|
|
@@ -150,31 +197,70 @@ export function StyleTab({ type, style: raw, onChange, device, onDeviceChange, v
|
|
|
150
197
|
options={[["left", AlignLeft, t.alignLeft], ["center", AlignCenter, t.alignCenter], ["right", AlignRight, t.alignRight], ["justify", AlignJustify, t.alignJustify]]} />)}
|
|
151
198
|
</Section>}
|
|
152
199
|
|
|
153
|
-
{show("color", ["color"]) && <Section title={t.style_color} modified={has(["color"])} onReset={() =>
|
|
154
|
-
{
|
|
155
|
-
{
|
|
156
|
-
|
|
200
|
+
{show("color", ["color", "textGradient", "link"]) && <Section title={t.style_color} modified={has(["color", "textGradient", "link"]) || !!style.hover?.color} onReset={() => commit({ ...style, color: undefined, textGradient: undefined, link: undefined, hover: style.hover && { ...style.hover, color: undefined } })}>
|
|
201
|
+
{hoverOk && <StateTabs value={colorState} onChange={setColorState} />}
|
|
202
|
+
{hoverOk && colorState === "hover" ? <>
|
|
203
|
+
<ColorInput label={t.style_text} value={style.hover?.color?.text} onChange={(v) => setHover({ color: { ...style.hover?.color, text: v } })} />
|
|
204
|
+
{!groups.has("background") && <ColorInput label={t.style_background} value={style.hover?.color?.background} onChange={(v) => setHover({ color: { ...style.hover?.color, background: v } })} />}
|
|
205
|
+
{container && <ColorInput label={t.style_linkHover} value={style.link?.hover} onChange={(v) => setGroup("link", "hover", v)} />}
|
|
206
|
+
</> : <>
|
|
207
|
+
<ColorInput label={t.style_text} value={style.color?.text} onChange={(v) => setGroup("color", "text", v)} />
|
|
208
|
+
{/* Khối có ô Nền: màu nền / nền chuyển màu sửa ở đó (một chỗ) */}
|
|
209
|
+
{!groups.has("background") && <ColorInput label={t.style_background} value={style.color?.background} onChange={(v) => setGroup("color", "background", v)} />}
|
|
210
|
+
{!groups.has("background") && fxOk && <Row label={lt.gradient} onReset={has(["gradient"]) ? () => reset(["gradient"]) : undefined}><GradientField value={style.gradient} onChange={(v) => set("gradient", v)} /></Row>}
|
|
211
|
+
<Row label={t.style_textGradient} onReset={has(["textGradient"]) ? () => reset(["textGradient"]) : undefined}><GradientField value={style.textGradient} onChange={(v) => set("textGradient", v)} /></Row>
|
|
212
|
+
{/* Khối chứa: màu liên kết của nội dung bên trong (Đoạn / Tiêu đề có mục Liên kết riêng) */}
|
|
213
|
+
{container && <ColorInput label={t.style_link} value={style.link?.color} onChange={(v) => setGroup("link", "color", v)} />}
|
|
214
|
+
{container && !hoverOk && <ColorInput label={t.style_linkHover} value={style.link?.hover} onChange={(v) => setGroup("link", "hover", v)} />}
|
|
215
|
+
</>}
|
|
157
216
|
</Section>}
|
|
158
217
|
|
|
159
|
-
{lead}
|
|
218
|
+
{!parts && lead}
|
|
160
219
|
|
|
161
|
-
{show("spacing", SPACING) && <Section title={t.style_spacing} modified={has(SPACING)} onReset={() => reset(SPACING)}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<SpacingControl label={t.style_padding} steps={spaces} value={get("padding")} inherited={inherited("padding")} onChange={(v) => set("padding", v)} labels={{ vertical: ct.vertical, horizontal: ct.horizontal, top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft, link: t.linkSides, unlink: t.unlinkSides }} />
|
|
165
|
-
<SpacingControl label={t.style_margin} steps={spaces} value={get("margin")} inherited={inherited("margin")} onChange={(v) => set("margin", v)} labels={{ vertical: ct.vertical, horizontal: ct.horizontal, top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft, link: t.linkSides, unlink: t.unlinkSides }} />
|
|
220
|
+
{show("spacing", SPACING) && <Section title={t.style_spacing} modified={has(SPACING)} onReset={() => reset(SPACING)}>
|
|
221
|
+
<SpacingControl kind="padding" device={device} onReset={has(["padding"]) ? () => reset(["padding"]) : undefined} label={t.style_padding} steps={spaces} value={get("padding")} inherited={inherited("padding")} onChange={(v) => set("padding", v)} labels={{ vertical: ct.vertical, horizontal: ct.horizontal, top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft, link: t.linkSides, unlink: t.unlinkSides }} />
|
|
222
|
+
<SpacingControl kind="margin" device={device} onReset={has(["margin"]) ? () => reset(["margin"]) : undefined} label={t.style_margin} steps={spaces} value={get("margin")} inherited={inherited("margin")} onChange={(v) => set("margin", v)} labels={{ vertical: ct.vertical, horizontal: ct.horizontal, top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft, link: t.linkSides, unlink: t.unlinkSides }} />
|
|
166
223
|
</Section>}
|
|
167
224
|
|
|
168
|
-
{
|
|
169
|
-
|
|
170
|
-
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
{
|
|
225
|
+
{/* Cấu trúc: kích thước khối (rộng, rộng tối đa, cao tối thiểu, tỉ lệ khung), khe giữa khối con */}
|
|
226
|
+
{inPart("spacing") && (groups.has("spacing") || has(STRUCTURE)) && <Section title={ct.structure} modified={has(STRUCTURE)} onReset={() => reset(STRUCTURE)} defaultOpen={has(STRUCTURE)}>
|
|
227
|
+
{structure}
|
|
228
|
+
{(["width", "maxWidth", "minHeight", ...(container ? ["gap" as const] : [])] as const).map((k) =>
|
|
229
|
+
row(k, t[`style_${k}`], <ValueInput label={t[`style_${k}`]} value={get(k)} inherited={inherited(k)} check={ok(k)} placeholder={k === "gap" ? "md, 24px" : "100%, 640px, 60vh"} onCommit={(v) => set(k, v)} />))}
|
|
230
|
+
{container && ([["zIndex", -1, 9999], ["grow", 0, 10], ["order", -10, 10]] as const).map(([k, min, max]) =>
|
|
231
|
+
row(k, ct[k], <input className="ecx-input" type="number" min={min} max={max} step={1} aria-label={ct[k]} value={get(k) ?? ""} placeholder={inherited(k)}
|
|
232
|
+
onChange={(e) => set(k, e.target.value === "" ? undefined : Number(e.target.value))} />))}
|
|
233
|
+
{container && <p className="ecx-field-help">{ct.orderHelp}</p>}
|
|
234
|
+
{fxOk && row("aspectRatio", lt.ratio,
|
|
235
|
+
<select className="ecx-input" aria-label={lt.ratio} value={style.aspectRatio ?? ""} onChange={(e) => set("aspectRatio", e.target.value || undefined)}>
|
|
236
|
+
<option value="">—</option>
|
|
237
|
+
{["1/1", "4/3", "3/2", "16/9", "21/9", "3/4", "2/3", "9/16"].map((r) => <option key={r} value={r}>{r.replace("/", ":")}</option>)}
|
|
238
|
+
</select>)}
|
|
174
239
|
</Section>}
|
|
175
240
|
|
|
176
|
-
{
|
|
177
|
-
|
|
241
|
+
{inPart("border") && (groups.has("border") || fxOk || has(["border", "radius"]) || !!(style.hover?.border || style.hover?.shadow || style.hover?.lift)) && <Section title={t.style_border} modified={has(["border", "radius", "shadow"]) || !!(style.hover?.border || style.hover?.shadow || style.hover?.lift)}
|
|
242
|
+
onReset={() => commit({ ...style, border: undefined, radius: undefined, shadow: undefined, hover: style.hover && { ...style.hover, border: undefined, shadow: undefined, lift: undefined } })}
|
|
243
|
+
defaultOpen={has(["border", "radius", "shadow"])}>
|
|
244
|
+
{hoverOk && <StateTabs value={borderState} onChange={setBorderState} />}
|
|
245
|
+
{hoverOk && borderState === "hover" ? <>
|
|
246
|
+
<ColorInput label={t.style_borderColor} value={style.hover?.border?.color} onChange={(v) => setHover({ border: v ? { color: v } : undefined })} />
|
|
247
|
+
<Row label={lt.shadow}>{shadowSelect(style.hover?.shadow, (v) => setHover({ shadow: v }), `${lt.hover} ${lt.shadow}`, false)}</Row>
|
|
248
|
+
<label className="ecx-check"><input type="checkbox" checked={!!style.hover?.lift} onChange={(e) => setHover({ lift: e.target.checked || undefined })} /> {lt.lift}</label>
|
|
249
|
+
</> : <>
|
|
250
|
+
{(groups.has("border") || has(["border", "radius"])) && <>
|
|
251
|
+
<FourInput label={t.style_borderWidth} keys={["top", "right", "bottom", "left"]} keyLabels={{ top: ct.sideTop, right: ct.sideRight, bottom: ct.sideBottom, left: ct.sideLeft }} value={style.border?.width} max={20} units={["px", "em", "rem"]} onChange={(v) => setGroup("border", "width", v)} />
|
|
252
|
+
{row("borderStyle", t.style_borderStyle, <Seg label={t.style_borderStyle} value={style.border?.style} onChange={(v) => setGroup("border", "style", v)}
|
|
253
|
+
options={[["solid", "—", t.border_solid], ["dashed", "- -", t.border_dashed], ["dotted", "···", t.border_dotted]]} />)}
|
|
254
|
+
<ColorInput label={t.style_borderColor} value={style.border?.color} onChange={(v) => setGroup("border", "color", v)} />
|
|
255
|
+
<FourInput label={t.style_radius} corners keys={["topLeft", "topRight", "bottomRight", "bottomLeft"]} keyLabels={{ topLeft: ct.cornerTopLeft, topRight: ct.cornerTopRight, bottomRight: ct.cornerBottomRight, bottomLeft: ct.cornerBottomLeft }} value={style.radius} max={60} units={["px", "%", "em", "rem"]} onReset={has(["radius"]) ? () => reset(["radius"]) : undefined} onChange={(v) => set("radius", v)} />
|
|
256
|
+
</>}
|
|
257
|
+
{fxOk && row("shadow", lt.shadow, shadowSelect(style.shadow, (v) => set("shadow", v), lt.shadow))}
|
|
258
|
+
</>}
|
|
259
|
+
</Section>}
|
|
260
|
+
|
|
261
|
+
{part === "advanced" && fxOk && <Section title={lt.sticky} modified={!!style.position} defaultOpen={!!style.position}>
|
|
262
|
+
<label className="ecx-check"><input type="checkbox" checked={!!style.position} onChange={(e) => set("position", e.target.checked ? { type: "sticky" } : undefined)} /> {lt.sticky}</label>
|
|
263
|
+
</Section>}
|
|
178
264
|
|
|
179
265
|
{show("motion", ["motion"]) && <MotionPanel type={type} style={raw} onChange={onChange} />}
|
|
180
266
|
|
package/src/v2/ui/toolbar.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WIDE_BLOCKS } from "@ecomcx/ecomweb-content";
|
|
2
2
|
import { clearCells, mergeRange, selectedCellRect } from "../core/tables";
|
|
3
3
|
import { AiTools } from "./ai";
|
|
4
|
-
import { Eraser, TableCellsMerge, StickyNote, Keyboard, MoveHorizontal, Maximize2, RectangleHorizontal, AlignCenter, AlignLeft, AlignRight, ArrowUpLeft, Bold, ChevronDown, ChevronUp, Code, Copy, CopyPlus, GripVertical, IndentDecrease, IndentIncrease, Italic, Link2, Link2Off, MoreVertical, PanelTop, Strikethrough, Trash2, Underline, Ungroup, Group as GroupIcon, Blocks, ArrowUpToLine, ArrowDownToLine, Shapes, Lock, Subscript, Superscript, Highlighter, Paintbrush, ClipboardPaste } from "lucide-react";
|
|
4
|
+
import { Eraser, TableCellsMerge, StickyNote, Keyboard, MoveHorizontal, Maximize2, RectangleHorizontal, AlignCenter, AlignLeft, AlignRight, ArrowUpLeft, Bold, ChevronDown, ChevronUp, Code, Copy, CopyPlus, GripVertical, IndentDecrease, IndentIncrease, Italic, Link2, Link2Off, MoreVertical, PanelTop, Strikethrough, Trash2, Underline, Ungroup, Group as GroupIcon, Blocks, ArrowUpToLine, ArrowDownToLine, Shapes, Lock, Subscript, Superscript, Highlighter, Paintbrush, ClipboardPaste, Scissors, PenLine, Eye, EyeOff } from "lucide-react";
|
|
5
5
|
import { TextSelection } from "prosemirror-state";
|
|
6
6
|
import type { EditorView } from "prosemirror-view";
|
|
7
7
|
import { useEffect, useLayoutEffect, useRef, useState, type ComponentType, type KeyboardEvent as ReactKeyboardEvent, type ReactNode } from "react";
|
|
@@ -19,7 +19,7 @@ import type { BlockTransform } from "../core/registry";
|
|
|
19
19
|
import { insertSibling, richViews } from "../text/rich-text";
|
|
20
20
|
import { canContain } from "../core/structure";
|
|
21
21
|
import { blockActionsFor } from "../../shared/panel-store";
|
|
22
|
-
import { copyStyle, hasCopiedStyle, menuPosition, pastedStyle } from "./block-menu";
|
|
22
|
+
import { copyStyle, hasCopiedStyle, isHidden, menuPosition, pastedStyle, toggleHidden } from "./block-menu";
|
|
23
23
|
|
|
24
24
|
const cx = (...c: unknown[]) => c.filter((x): x is string => typeof x === "string" && x !== "").join(" ");
|
|
25
25
|
|
|
@@ -90,7 +90,7 @@ export function BlockToolbar({ placement = "floating" }: { placement?: "floating
|
|
|
90
90
|
const sel = useEditorState((s) => s.selection);
|
|
91
91
|
useEditorState((s) => s.revision);
|
|
92
92
|
const [link, setLink] = useState<string | null>(null);
|
|
93
|
-
const [
|
|
93
|
+
const [dialog, setDialog] = useState<"lock" | "rename" | null>(null);
|
|
94
94
|
useEffect(() => { ui.openLink = (key) => setLink(key); return () => { ui.openLink = null; }; }, [ui]);
|
|
95
95
|
|
|
96
96
|
const ids = sel.ids.length ? sel.ids : sel.editing ? [sel.editing] : [];
|
|
@@ -208,7 +208,7 @@ export function BlockToolbar({ placement = "floating" }: { placement?: "floating
|
|
|
208
208
|
<ToolButton label={labels.moveDown} onClick={() => store.moveBy(ordered, 1)}><ChevronDown className="ecx-icon ecx-icon-sm" /></ToolButton>
|
|
209
209
|
</div>
|
|
210
210
|
</>}
|
|
211
|
-
{isLocked && <ToolButton label={labels.locked} onClick={() =>
|
|
211
|
+
{isLocked && <ToolButton label={labels.locked} onClick={() => setDialog("lock")} className="ecx-lock-badge"><Lock className="ecx-icon" /></ToolButton>}
|
|
212
212
|
</div>
|
|
213
213
|
{sameType && type?.variations?.some((v) => v.attrs && v.isActive) && (
|
|
214
214
|
<div className="ecx-tool-group">
|
|
@@ -250,13 +250,25 @@ export function BlockToolbar({ placement = "floating" }: { placement?: "floating
|
|
|
250
250
|
{Extra && <div className="ecx-tool-group"><Extra {...editProps} /></div>}
|
|
251
251
|
{(nodes.length === 1 || cellSel) && contextTools(loc.ancestors, first.id)}
|
|
252
252
|
{nested && <div className="ecx-tool-group"><ToolButton label={labels.editOriginal} className="ecx-tool-wide" onClick={() => store.enterFocus(nested)}><PanelTop className="ecx-icon" /><span className="ecx-tool-text">{labels.editOriginal}</span></ToolButton></div>}
|
|
253
|
+
{/* Chép / dán kiểu dáng ngay trên thanh (như các bộ khối lớn) — vẫn còn trong menu ⋮ */}
|
|
254
|
+
{nodes.length === 1 && !type?.plain && (
|
|
255
|
+
<div className="ecx-tool-group">
|
|
256
|
+
<Dropdown label={labels.copyPasteStyle} trigger={<Paintbrush className="ecx-icon" />}>
|
|
257
|
+
{(close) => <>
|
|
258
|
+
<MenuItem icon={Paintbrush} label={labels.copyStyle} onClick={() => { close(); copyStyle(first.attrs); ui.announce(labels.styleCopied); }} />
|
|
259
|
+
{hasCopiedStyle() && ordered.every((id) => !store.isContentOnly(id) && store.modeOf(id) !== "disabled") && <MenuItem icon={ClipboardPaste} label={labels.pasteStyle} onClick={() => { close(); store.setAttrs(ordered, pastedStyle()!); }} />}
|
|
260
|
+
</>}
|
|
261
|
+
</Dropdown>
|
|
262
|
+
</div>
|
|
263
|
+
)}
|
|
253
264
|
<div className="ecx-tool-group">
|
|
254
265
|
<Dropdown label={labels.more} trigger={<MoreVertical className="ecx-icon" />}>
|
|
255
|
-
{(close) => <BlockMenuItems ids={ids} close={close}
|
|
266
|
+
{(close) => <BlockMenuItems ids={ids} close={close} onDialog={setDialog} />}
|
|
256
267
|
</Dropdown>
|
|
257
268
|
</div>
|
|
258
269
|
</div>
|
|
259
|
-
{
|
|
270
|
+
{dialog === "lock" && <LockDialog block={first} onClose={() => setDialog(null)} />}
|
|
271
|
+
{dialog === "rename" && <RenameDialog block={first} onClose={() => setDialog(null)} />}
|
|
260
272
|
{link && view && (() => {
|
|
261
273
|
const anchor = fixed ? document.querySelector(".ecx-toolbar.is-fixed")?.getBoundingClientRect() : null;
|
|
262
274
|
return <LinkPopover viewKey={link} top={anchor ? anchor.bottom + 4 : top + height + 4} left={anchor ? anchor.left : left} onClose={() => setLink(null)} />;
|
|
@@ -308,7 +320,7 @@ function MarkTools({ view, onLink }: { view: EditorView; onLink(): void }) {
|
|
|
308
320
|
}
|
|
309
321
|
|
|
310
322
|
/** Mục của menu ⋮ trên thanh công cụ khối — dùng chung với menu chuột phải (BlockContextMenu). */
|
|
311
|
-
function BlockMenuItems({ ids, close,
|
|
323
|
+
export function BlockMenuItems({ ids, close, onDialog }: { ids: string[]; close(): void; onDialog(kind: "lock" | "rename"): void }) {
|
|
312
324
|
const ctx = useEditor();
|
|
313
325
|
const { store, ui, labels } = ctx;
|
|
314
326
|
const nodes = ids.map((id) => store.block(id)).filter(Boolean) as BNode[];
|
|
@@ -322,11 +334,13 @@ function BlockMenuItems({ ids, close, onLock }: { ids: string[]; close(): void;
|
|
|
322
334
|
const insertable = store.canInsertInto(parent?.id ?? null);
|
|
323
335
|
const canGroup = canContain(parent?.type ?? null, "group");
|
|
324
336
|
const styleEditable = ordered.every((id) => !store.isContentOnly(id) && store.modeOf(id) !== "disabled");
|
|
337
|
+
const hidden = isHidden(first);
|
|
325
338
|
const copy = async () => {
|
|
326
339
|
const s = serializeBlocks(ordered.map((id) => store.block(id)!));
|
|
327
340
|
try {
|
|
328
341
|
await navigator.clipboard.write([new ClipboardItem({ "text/plain": new Blob([s.text], { type: "text/plain" }), "text/html": new Blob([s.html], { type: "text/html" }) })]);
|
|
329
|
-
|
|
342
|
+
return true;
|
|
343
|
+
} catch { return false; /* trình duyệt chặn ghi clipboard: người dùng vẫn chép được bằng Ctrl+C */ }
|
|
330
344
|
};
|
|
331
345
|
/** Tạo mẫu từ các khối đang chọn; mẫu đồng bộ → thay khối bằng tham chiếu tới mẫu. */
|
|
332
346
|
const createPattern = async () => {
|
|
@@ -346,7 +360,8 @@ function BlockMenuItems({ ids, close, onLock }: { ids: string[]; close(): void;
|
|
|
346
360
|
<MenuItem icon={ArrowUpToLine} label={labels.insertBefore} shortcut={`${mod}⌥T`} onClick={() => { close(); insertSibling(store, ordered[0], 0); }} />
|
|
347
361
|
<MenuItem icon={ArrowDownToLine} label={labels.insertAfter} shortcut={`${mod}⌥Y`} onClick={() => { close(); insertSibling(store, ordered[ordered.length - 1], 1); }} />
|
|
348
362
|
</>}
|
|
349
|
-
<MenuItem icon={Copy} label={labels.copy} onClick={() => { close(); void copy(); }} />
|
|
363
|
+
<MenuItem icon={Copy} label={labels.copy} shortcut={`${mod}C`} onClick={() => { close(); void copy(); }} />
|
|
364
|
+
{removable && <MenuItem icon={Scissors} label={labels.cut} shortcut={`${mod}X`} onClick={() => { close(); void copy().then((ok) => { if (ok) store.remove(ordered); }); /* chép không được thì không xoá */ }} />}
|
|
350
365
|
<MenuItem icon={Paintbrush} label={labels.copyStyle} onClick={() => { close(); copyStyle(first.attrs); ui.announce(labels.styleCopied); }} />
|
|
351
366
|
{hasCopiedStyle() && styleEditable && <MenuItem icon={ClipboardPaste} label={labels.pasteStyle} onClick={() => { close(); store.setAttrs(ordered, pastedStyle()!); }} />}
|
|
352
367
|
{ctx.host.createPattern && <MenuItem icon={Shapes} label={labels.createPattern} onClick={() => { close(); void createPattern(); }} />}
|
|
@@ -359,7 +374,9 @@ function BlockMenuItems({ ids, close, onLock }: { ids: string[]; close(): void;
|
|
|
359
374
|
))}
|
|
360
375
|
{canGroup && removable && movable && insertable && <MenuItem icon={GroupIcon} label={labels.group} onClick={() => { close(); store.wrap(ordered, "group"); }} />}
|
|
361
376
|
{nodes.length === 1 && first.content && first.type === "group" && removable && <MenuItem icon={Ungroup} label={labels.ungroup} onClick={() => { close(); store.unwrap(first.id); }} />}
|
|
362
|
-
{nodes.length === 1 && !store.isContentOnly(first.id) && <MenuItem icon={Lock} label={labels.lock} onClick={() => { close();
|
|
377
|
+
{nodes.length === 1 && !store.isContentOnly(first.id) && <MenuItem icon={Lock} label={labels.lock} onClick={() => { close(); onDialog("lock"); }} />}
|
|
378
|
+
{nodes.length === 1 && <MenuItem icon={PenLine} label={labels.rename} onClick={() => { close(); onDialog("rename"); }} />}
|
|
379
|
+
{styleEditable && <MenuItem icon={hidden ? Eye : EyeOff} label={hidden ? labels.show : labels.hide} onClick={() => { close(); toggleHidden(store, ordered); }} />}
|
|
363
380
|
{removable && <MenuItem icon={Trash2} label={labels.remove} shortcut="⇧⌥Z" danger onClick={() => { close(); store.remove(ordered); }} />}
|
|
364
381
|
</>
|
|
365
382
|
);
|
|
@@ -375,7 +392,7 @@ export function BlockContextMenu() {
|
|
|
375
392
|
const at = ui.contextMenu;
|
|
376
393
|
const ref = useRef<HTMLDivElement>(null);
|
|
377
394
|
const [pos, setPos] = useState<{ top: number; left: number } | null>(null);
|
|
378
|
-
const [
|
|
395
|
+
const [dlg, setDlg] = useState<{ kind: "lock" | "rename"; block: BNode } | null>(null);
|
|
379
396
|
// refocus: bàn phím quay về khối (Esc / Tab) hoặc khung soạn (chọn mục xong — khối có thể đã bị xoá / thay)
|
|
380
397
|
const close = (refocus?: "block" | "canvas") => {
|
|
381
398
|
const id = ui.contextMenu?.ids[0];
|
|
@@ -418,10 +435,11 @@ export function BlockContextMenu() {
|
|
|
418
435
|
else if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); close("block"); }
|
|
419
436
|
else if (e.key === "Tab") { e.preventDefault(); close("block"); }
|
|
420
437
|
}}>
|
|
421
|
-
<BlockMenuItems ids={at.ids} close={() => close("canvas")}
|
|
438
|
+
<BlockMenuItems ids={at.ids} close={() => close("canvas")} onDialog={(kind) => { const b = store.block(at.ids[0]); if (b) setDlg({ kind, block: b }); }} />
|
|
422
439
|
</div>
|
|
423
440
|
)}
|
|
424
|
-
{lock && <LockDialog block={
|
|
441
|
+
{dlg?.kind === "lock" && <LockDialog block={dlg.block} onClose={() => setDlg(null)} />}
|
|
442
|
+
{dlg?.kind === "rename" && <RenameDialog block={dlg.block} onClose={() => setDlg(null)} />}
|
|
425
443
|
</>
|
|
426
444
|
);
|
|
427
445
|
}
|
|
@@ -542,3 +560,24 @@ function LockDialog({ block, onClose }: { block: BNode; onClose(): void }) {
|
|
|
542
560
|
</div>
|
|
543
561
|
);
|
|
544
562
|
}
|
|
563
|
+
|
|
564
|
+
/** Đổi tên khối (chỉ trong trình soạn: cây khối, bảng cài đặt, đường dẫn khối). Để trống = tên mặc định. */
|
|
565
|
+
function RenameDialog({ block, onClose }: { block: BNode; onClose(): void }) {
|
|
566
|
+
const { store, labels, registry } = useEditor();
|
|
567
|
+
const [name, setName] = useState(typeof block.attrs.customName === "string" ? block.attrs.customName : "");
|
|
568
|
+
const save = () => { store.setAttrs([block.id], { customName: name.trim().slice(0, 80) || undefined }); onClose(); };
|
|
569
|
+
return (
|
|
570
|
+
<div className="ecx-modal-backdrop" onMouseDown={(e) => { if (e.target === e.currentTarget) onClose(); }} onKeyDown={(e) => { if (e.key === "Escape") onClose(); else trapTab(e); }}>
|
|
571
|
+
<div className="ecx-modal" role="dialog" aria-modal="true" aria-label={labels.renameTitle}>
|
|
572
|
+
<header className="ecx-modal-header"><h2>{labels.renameTitle}</h2></header>
|
|
573
|
+
<form className="ecx-lock-body" onSubmit={(e) => { e.preventDefault(); save(); }}>
|
|
574
|
+
<input className="ecx-input" value={name} maxLength={80} placeholder={registry.get(block.type)?.title ?? block.type} aria-label={labels.renameTitle} autoFocus onChange={(e) => setName(e.target.value)} />
|
|
575
|
+
<div className="ecx-popover-actions">
|
|
576
|
+
<button type="button" className="ecx-btn" onClick={onClose}>{labels.cancel}</button>
|
|
577
|
+
<button type="submit" className="ecx-btn ecx-btn-primary">{labels.save}</button>
|
|
578
|
+
</div>
|
|
579
|
+
</form>
|
|
580
|
+
</div>
|
|
581
|
+
</div>
|
|
582
|
+
);
|
|
583
|
+
}
|