@ecomcx/ecomweb-editor 1.30.0 → 1.32.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/block-desc.ts +1 -0
- package/src/locales/en/block-style.ts +7 -4
- package/src/locales/en/block-titles.ts +1 -0
- package/src/locales/en/blocks.ts +10 -2
- package/src/locales/en/columns.ts +12 -0
- package/src/locales/en/controls.ts +21 -0
- package/src/locales/en/hints.ts +215 -1
- package/src/locales/en/index.ts +6 -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 +104 -0
- 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/block-desc.ts +1 -0
- package/src/locales/vi/block-style.ts +7 -4
- package/src/locales/vi/block-titles.ts +1 -0
- package/src/locales/vi/blocks.ts +10 -2
- package/src/locales/vi/columns.ts +12 -0
- package/src/locales/vi/controls.ts +21 -0
- package/src/locales/vi/hints.ts +216 -2
- package/src/locales/vi/index.ts +6 -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 +103 -0
- 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/compat.tsx +91 -5
- package/src/v2/blocks/form.tsx +7 -4
- package/src/v2/blocks/index.ts +10 -4
- package/src/v2/blocks/inline-style.ts +1 -1
- package/src/v2/blocks/layout.tsx +305 -83
- package/src/v2/blocks/media.tsx +91 -81
- package/src/v2/blocks/resize.tsx +172 -4
- package/src/v2/blocks/text.tsx +60 -22
- package/src/v2/blocks/theme.tsx +83 -17
- package/src/v2/blocks/tools.tsx +50 -5
- package/src/v2/blocks/widgets.tsx +85 -20
- package/src/v2/canvas/block-list.tsx +21 -6
- package/src/v2/canvas/canvas-css.ts +139 -7
- package/src/v2/canvas/canvas.tsx +20 -3
- package/src/v2/canvas/dnd.ts +34 -3
- package/src/v2/canvas/move-animation.ts +94 -0
- package/src/v2/canvas/server-block.tsx +7 -4
- package/src/v2/canvas/spacing-viz.ts +51 -0
- package/src/v2/core/block-presets.ts +68 -0
- package/src/v2/core/host.ts +14 -0
- package/src/v2/core/registry.ts +3 -1
- package/src/v2/core/structure.ts +4 -2
- package/src/v2/editor.css +244 -11
- package/src/v2/editor.tsx +8 -2
- package/src/v2/index.ts +3 -0
- package/src/v2/ui/ai.tsx +9 -5
- package/src/v2/ui/attr-form.tsx +42 -13
- package/src/v2/ui/attr-hints.ts +104 -6
- package/src/v2/ui/background-panel.tsx +65 -21
- 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 +51 -7
- 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/{blocks → ui}/media-actions.tsx +4 -3
- 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/placeholders.tsx +205 -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 +59 -16
- 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/editor.css
CHANGED
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
.ecx-editor :focus-visible { outline: 2px solid var(--ecx-ed-accent); outline-offset: 1px; }
|
|
26
26
|
.ecx-icon { width: 16px; height: 16px; flex: none; }
|
|
27
27
|
.ecx-icon-sm { width: 14px; height: 14px; }
|
|
28
|
+
/* Icon 2 lớp của khối (block-icons.tsx): đặc = màu nhấn, nền = màu nhấn nhạt */
|
|
29
|
+
.ecx-duo { --ecx-ico-a: var(--ecx-ed-accent); --ecx-ico-b: color-mix(in srgb, var(--ecx-ed-accent) 22%, transparent); --ecx-ico-w: var(--ecx-ed-panel); }
|
|
28
30
|
.ecx-muted { color: var(--ecx-ed-muted); margin: 0; font-size: 12px; }
|
|
29
31
|
@keyframes ecx-pop { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
|
|
30
32
|
@keyframes ecx-slide-r { from { transform: translateX(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
.ecx-topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 52px; padding: 0 10px; border-bottom: 1px solid var(--ecx-ed-line); background: var(--ecx-ed-panel); flex: none; }
|
|
35
37
|
.ecx-topbar-start, .ecx-topbar-end { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
36
38
|
.ecx-topbar .ecx-tool-group { gap: 2px; padding: 2px; border-radius: 8px; background: var(--ecx-ed-subtle); }
|
|
37
|
-
.ecx-body { display: flex; flex: 1; min-height: 0; position: relative; }
|
|
39
|
+
.ecx-body { display: flex; flex: 1; min-height: 0; position: relative; overflow-x: clip; } /* bảng bên trượt vào (translateX) không làm trang tràn ngang lúc đầu */
|
|
38
40
|
.ecx-left { width: 300px; flex: none; border-right: 1px solid var(--ecx-ed-line); overflow: auto; background: var(--ecx-ed-panel); animation: ecx-slide-r .2s var(--ecx-ed-ease); }
|
|
39
41
|
.ecx-right { width: 296px; flex: none; border-left: 1px solid var(--ecx-ed-line); overflow: auto; background: var(--ecx-ed-panel); animation: ecx-slide-l .2s var(--ecx-ed-ease); }
|
|
40
42
|
.ecx-main { flex: 1; min-width: 0; display: flex; background: var(--ecx-ed-bg); }
|
|
@@ -49,6 +51,20 @@
|
|
|
49
51
|
.ecx-right, .ecx-left { position: absolute; top: 0; bottom: 0; z-index: 20; box-shadow: var(--ecx-ed-shadow); }
|
|
50
52
|
.ecx-right { right: 0; } .ecx-left { left: 0; }
|
|
51
53
|
}
|
|
54
|
+
/* Điện thoại: thanh trên cuộn ngang (không tràn trang, không chồng nút), bảng hai bên rộng tối đa 92% màn hình */
|
|
55
|
+
@media (max-width: 640px) {
|
|
56
|
+
.ecx-topbar { padding: 0 6px; gap: 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; justify-content: flex-start; }
|
|
57
|
+
.ecx-topbar::-webkit-scrollbar { display: none; }
|
|
58
|
+
.ecx-topbar-start, .ecx-topbar-end { flex: none; }
|
|
59
|
+
.ecx-topbar-end { margin-left: auto; }
|
|
60
|
+
.ecx-topbar-start > :first-child { white-space: nowrap; }
|
|
61
|
+
.ecx-right, .ecx-left { width: min(92vw, 340px); }
|
|
62
|
+
/* Rút gọn để nút Lưu luôn thấy: bỏ nhóm đổi khổ (trên điện thoại xem thử bằng chính màn hình) và chữ của nút Thư viện mẫu */
|
|
63
|
+
.ecx-topbar .ecx-tool-group[aria-label] { display: none; }
|
|
64
|
+
.ecx-topbar .ecx-lib-open { font-size: 0; gap: 0; padding: 0 8px; }
|
|
65
|
+
.ecx-topbar .ecx-lib-open svg { font-size: 14px; }
|
|
66
|
+
.ecx-topbar-end { position: sticky; right: 0; background: var(--ecx-ed-panel); padding-left: 6px; }
|
|
67
|
+
}
|
|
52
68
|
|
|
53
69
|
/* Nút */
|
|
54
70
|
.ecx-tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px;
|
|
@@ -119,6 +135,7 @@
|
|
|
119
135
|
.ecx-block-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--ecx-ed-fg);
|
|
120
136
|
font: inherit; font-size: 12px; line-height: 1.3; text-align: center; cursor: pointer; touch-action: none; user-select: none; transition: background-color .12s ease, border-color .12s ease; }
|
|
121
137
|
.ecx-block-tile .ecx-icon { width: 22px; height: 22px; color: var(--ecx-ed-muted); }
|
|
138
|
+
.ecx-block-tile .ecx-icon.ecx-duo { width: 28px; height: 28px; }
|
|
122
139
|
.ecx-block-tile:hover { background: var(--ecx-ed-hover); border-color: var(--ecx-ed-line); }
|
|
123
140
|
.ecx-block-tile:hover .ecx-icon { color: var(--ecx-ed-accent); }
|
|
124
141
|
.ecx-pattern-card { display: flex; flex-direction: column; gap: 2px; width: 100%; margin-bottom: 6px; padding: 10px 12px; border: 1px solid var(--ecx-ed-line); border-radius: 8px; background: var(--ecx-ed-panel);
|
|
@@ -130,7 +147,7 @@
|
|
|
130
147
|
.ecx-inspector.is-empty { padding-top: 24px; }
|
|
131
148
|
.ecx-block-card { display: flex; gap: 10px; align-items: flex-start; }
|
|
132
149
|
.ecx-card-icon { width: 32px; height: 32px; padding: 7px; border-radius: 8px; background: var(--ecx-ed-accent-soft); color: var(--ecx-ed-accent); }
|
|
133
|
-
.ecx-block-card strong { display: block; font-size:
|
|
150
|
+
.ecx-block-card strong { display: block; font-size: 14px; font-weight: 600; margin: 0; }
|
|
134
151
|
.ecx-tabs { display: flex; gap: 2px; margin: 0 -16px; padding: 0 16px; border-bottom: 1px solid var(--ecx-ed-line); }
|
|
135
152
|
.ecx-tabs button { position: relative; flex: 1; height: 40px; border: 0; background: none; font: inherit; font-weight: 500; color: var(--ecx-ed-muted); cursor: pointer; }
|
|
136
153
|
.ecx-tabs button:hover { color: var(--ecx-ed-fg); }
|
|
@@ -144,6 +161,8 @@
|
|
|
144
161
|
select.ecx-input { padding-right: 6px; }
|
|
145
162
|
.ecx-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
|
|
146
163
|
.ecx-check input { accent-color: var(--ecx-ed-accent); width: 15px; height: 15px; }
|
|
164
|
+
/* Ô nhập nhỏ trong menu của thanh công cụ (vd liên kết của nút) */
|
|
165
|
+
.ecx-tool-form { display: grid; gap: 8px; width: 280px; padding: 8px; }
|
|
147
166
|
.ecx-color-row { display: flex; gap: 6px; align-items: center; }
|
|
148
167
|
.ecx-color-row input[type="color"] { width: 32px; height: 32px; padding: 2px; border: 1px solid var(--ecx-ed-line); border-radius: 6px; background: var(--ecx-ed-panel); }
|
|
149
168
|
.ecx-advanced { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--ecx-ed-line); padding-top: 10px; }
|
|
@@ -170,17 +189,48 @@ select.ecx-input { padding-right: 6px; }
|
|
|
170
189
|
.ecx-twisty { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--ecx-ed-muted); cursor: pointer; flex: none; }
|
|
171
190
|
.ecx-twisty:hover { background: var(--ecx-ed-hover); }
|
|
172
191
|
.ecx-twisty .ecx-icon { width: 14px; height: 14px; }
|
|
192
|
+
.ecx-list-menu { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: auto; padding: 0; border: 0; border-radius: 4px; background: none; color: inherit; cursor: pointer; opacity: 0; }
|
|
193
|
+
.ecx-list-row:hover .ecx-list-menu, .ecx-list-row.is-selected .ecx-list-menu, .ecx-list-menu:focus-visible { opacity: 1; }
|
|
194
|
+
.ecx-list-menu:hover { background: var(--ecx-ed-hover); }
|
|
195
|
+
.ecx-left-tabs { position: sticky; top: 0; z-index: 1; margin: 0; padding: 0 4px 0 8px; background: var(--ecx-ed-panel); }
|
|
196
|
+
.ecx-left-tabs button[role=tab] { flex: none; padding: 0 10px; }
|
|
197
|
+
.ecx-left-close { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: 4px 0 4px auto; border: 0; border-radius: 6px; background: none; color: var(--ecx-ed-muted); cursor: pointer; }
|
|
198
|
+
.ecx-left-close:hover { background: var(--ecx-ed-hover); color: var(--ecx-ed-fg); }
|
|
199
|
+
.ecx-tabs .ecx-left-close { flex: none; height: 32px; }
|
|
200
|
+
.ecx-tablist { display: flex; flex: 1; gap: 2px; }
|
|
201
|
+
.ecx-left-tabs .ecx-tablist { flex: none; }
|
|
202
|
+
.ecx-outline { padding: 12px 16px; }
|
|
203
|
+
.ecx-outline-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; }
|
|
204
|
+
.ecx-outline-stats div { padding: 8px; border-radius: 8px; background: var(--ecx-ed-subtle); }
|
|
205
|
+
.ecx-outline-stats dt { font-size: 11px; color: var(--ecx-ed-muted); }
|
|
206
|
+
.ecx-outline-stats dd { margin: 2px 0 0; font-weight: 600; }
|
|
207
|
+
.ecx-outline-heads { list-style: none; margin: 0; padding: 0; }
|
|
208
|
+
.ecx-outline-heads button { display: flex; align-items: baseline; gap: 6px; width: 100%; padding: 5px 6px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
209
|
+
.ecx-outline-heads button:hover { background: var(--ecx-ed-hover); }
|
|
210
|
+
.ecx-outline-level { flex: none; font: 600 11px var(--ecx-ed-font); color: var(--ecx-ed-muted); }
|
|
211
|
+
.ecx-outline-warn { font-size: 11px; font-style: normal; color: var(--ecx-ed-danger, #b42318); }
|
|
212
|
+
.ecx-media-kinds { margin: 4px 0 10px; }
|
|
213
|
+
.ecx-media-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
|
|
214
|
+
.ecx-media-grid.is-files { grid-template-columns: 1fr; }
|
|
215
|
+
.ecx-media-item { display: block; aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--ecx-ed-line); border-radius: 8px; background: var(--ecx-ed-subtle); cursor: pointer; }
|
|
216
|
+
.ecx-media-grid.is-files .ecx-media-item { aspect-ratio: auto; padding: 8px 10px; text-align: left; font: inherit; color: inherit; overflow-wrap: anywhere; }
|
|
217
|
+
.ecx-media-item:hover, .ecx-media-item:focus-visible { border-color: var(--ecx-ed-accent); }
|
|
218
|
+
.ecx-media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
|
173
219
|
.ecx-list-drag { opacity: 0; cursor: grab; touch-action: none; display: inline-flex; color: var(--ecx-ed-faint); }
|
|
174
220
|
.ecx-list-row:hover .ecx-list-drag { opacity: 1; }
|
|
175
221
|
|
|
176
222
|
/* Kéo thả */
|
|
177
|
-
.ecx-drop-line { position: fixed; z-index: 45; background: var(--ecx-ed-accent, #1a597b); border-radius: 2px; pointer-events: none; box-shadow: 0 0 0 1px #fff; }
|
|
223
|
+
.ecx-drop-line { position: fixed; z-index: 45; background: var(--ecx-ed-accent, #1a597b); border-radius: 2px; pointer-events: none; box-shadow: 0 0 0 1px #fff, 0 0 0 7px color-mix(in srgb, var(--ecx-ed-accent, #1a597b) 22%, transparent); } /* vị trí thả: dải xanh rõ, không chỉ vạch mảnh */
|
|
224
|
+
.ecx-drop-line { transform-origin: center; animation: ecx-drop-grow .2s ease-out; }
|
|
225
|
+
.ecx-drop-line[data-horizontal] { animation-name: ecx-drop-grow-y; }
|
|
226
|
+
@keyframes ecx-drop-grow { from { transform: scaleX(0); opacity: 0; } }
|
|
227
|
+
@keyframes ecx-drop-grow-y { from { transform: scaleY(0); opacity: 0; } }
|
|
178
228
|
.ecx-drag-chip.is-blocked { opacity: .55; }
|
|
179
229
|
.ecx-drag-chip { display: inline-flex; align-items: center; gap: 6px; position: fixed; z-index: 46; padding: 3px 8px; background: var(--ecx-ed-fg, #0f1e29); color: var(--ecx-ed-panel, #fff); border-radius: 6px; font: 600 12px var(--ecx-ed-font, system-ui); pointer-events: none; box-shadow: var(--ecx-ed-shadow); }
|
|
180
230
|
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none !important; }
|
|
181
231
|
|
|
182
232
|
@media (prefers-reduced-motion: reduce) {
|
|
183
|
-
.ecx-toolbar, .ecx-menu, .ecx-popover, .ecx-left, .ecx-right { animation: none; }
|
|
233
|
+
.ecx-toolbar, .ecx-menu, .ecx-popover, .ecx-left, .ecx-right, .ecx-drop-line { animation: none; }
|
|
184
234
|
.ecx-pattern-card:hover, .ecx-tool:active:not(:disabled) { transform: none; }
|
|
185
235
|
}
|
|
186
236
|
|
|
@@ -244,10 +294,58 @@ body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select:
|
|
|
244
294
|
/* Bố cục, nền & hiệu ứng, hover (tab Kiểu dáng) */
|
|
245
295
|
.ecx-layout-panel { display: flex; flex-direction: column; border-top: 1px solid var(--ecx-ed-line); margin-top: 4px; }
|
|
246
296
|
.ecx-style-section { border-bottom: 1px solid var(--ecx-ed-line); }
|
|
247
|
-
.ecx-style-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height:
|
|
248
|
-
.ecx-style-section-toggle { display: flex; align-items: center; gap:
|
|
249
|
-
.ecx-
|
|
297
|
+
.ecx-style-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
|
|
298
|
+
.ecx-style-section-toggle { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ecx-ed-fg); font: inherit; font-weight: 600; cursor: pointer; text-align: left; transition: color .05s linear; }
|
|
299
|
+
.ecx-style-section-toggle:hover { color: var(--ecx-ed-accent); }
|
|
300
|
+
.ecx-style-section-title { display: inline-flex; align-items: center; gap: 6px; flex: none; }
|
|
301
|
+
.ecx-style-section-title .ecx-dot { background: #e8890c; }
|
|
302
|
+
/* Mục gập: một dòng tóm tắt bên phải tiêu đề (vd "Chưa có hiệu ứng") */
|
|
303
|
+
.ecx-style-section-summary { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font-weight: 400; font-size: 12px; color: var(--ecx-ed-muted); }
|
|
304
|
+
.ecx-chevron { margin-left: auto; flex: none; color: var(--ecx-ed-muted); transition: transform .15s var(--ecx-ed-ease); }
|
|
250
305
|
.ecx-chevron.is-open { transform: rotate(90deg); }
|
|
306
|
+
/* Hàng điều khiển: nhãn · ↶ · (công cụ) · cụm khổ màn hình */
|
|
307
|
+
.ecx-row-head { display: flex; align-items: center; gap: 4px; min-height: 20px; }
|
|
308
|
+
.ecx-row-head .ecx-field-label { flex: none; }
|
|
309
|
+
.ecx-row-tools { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
|
|
310
|
+
.ecx-row-reset { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: #e8890c; cursor: pointer; }
|
|
311
|
+
.ecx-row-reset:hover { background: var(--ecx-ed-subtle); }
|
|
312
|
+
.ecx-row-reset .ecx-icon { width: 12px; height: 12px; }
|
|
313
|
+
.ecx-field-wrap { position: relative; }
|
|
314
|
+
.ecx-field-reset { position: absolute; top: 0; right: 0; }
|
|
315
|
+
.ecx-row-devices { display: inline-flex; gap: 1px; }
|
|
316
|
+
.ecx-row-devices button { display: inline-grid; place-items: center; width: 20px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--ecx-ed-faint, #a3adb7); cursor: pointer; transition: color .05s linear; }
|
|
317
|
+
.ecx-row-devices button:hover { background: var(--ecx-ed-subtle); color: var(--ecx-ed-fg); }
|
|
318
|
+
.ecx-row-devices button.is-active { color: var(--ecx-ed-accent); }
|
|
319
|
+
.ecx-row-devices .ecx-icon { width: 13px; height: 13px; }
|
|
320
|
+
/* Ô màu gọn + bảng màu */
|
|
321
|
+
.ecx-color-field { position: relative; }
|
|
322
|
+
.ecx-color-row-btn { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--ecx-ed-line); border-radius: 8px; background: var(--ecx-ed-panel); color: var(--ecx-ed-fg); font: inherit; cursor: pointer; text-align: left; transition: border-color .05s linear; }
|
|
323
|
+
.ecx-color-row-btn:hover, .ecx-color-row-btn.is-open { border-color: var(--ecx-ed-accent); }
|
|
324
|
+
.ecx-color-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); position: relative; overflow: hidden; }
|
|
325
|
+
.ecx-color-dot.is-none { background: var(--ecx-ed-panel); }
|
|
326
|
+
.ecx-color-dot.is-none::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 45%, #e05252 45%, #e05252 55%, transparent 55%); }
|
|
327
|
+
.ecx-color-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
|
|
328
|
+
.ecx-color-value { flex: none; font-size: 12px; color: var(--ecx-ed-muted); }
|
|
329
|
+
.ecx-color-pop { position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; width: 248px; padding: 10px; border: 1px solid var(--ecx-ed-line); border-radius: 10px; background: var(--ecx-ed-panel); box-shadow: var(--ecx-ed-shadow); animation: ecx-pop .1s linear; }
|
|
330
|
+
.ecx-pop-title { margin: 0 2px 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ecx-ed-muted); }
|
|
331
|
+
.ecx-color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
|
|
332
|
+
.ecx-color-cell { height: 28px; padding: 0; border: 1px solid rgb(0 0 0 / .1); border-radius: 7px; cursor: pointer; }
|
|
333
|
+
.ecx-color-cell.is-active { outline: 2px solid var(--ecx-ed-accent); outline-offset: 2px; }
|
|
334
|
+
.ecx-color-alpha { display: grid; grid-template-columns: auto 1fr 3ch; align-items: center; gap: 8px; margin: 10px 2px 0; font-size: 12.5px; }
|
|
335
|
+
.ecx-color-alpha input[type=range] { width: 100%; accent-color: var(--ecx-ed-accent); }
|
|
336
|
+
.ecx-color-alpha output { text-align: end; color: var(--ecx-ed-muted); font-variant-numeric: tabular-nums; }
|
|
337
|
+
.ecx-pop-hint { margin: 8px 2px 0; font-size: 11.5px; line-height: 1.4; color: var(--ecx-ed-muted); }
|
|
338
|
+
.ecx-pop-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ecx-ed-line); }
|
|
339
|
+
.ecx-pop-custom { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; }
|
|
340
|
+
/* Mô tả khối: nút ⓘ + chú thích khi rê */
|
|
341
|
+
.ecx-block-card { align-items: center; }
|
|
342
|
+
.ecx-card-info { position: relative; display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: -4px; border-radius: 50%; color: var(--ecx-ed-muted); cursor: help; }
|
|
343
|
+
.ecx-card-info .ecx-icon { width: 14px; height: 14px; }
|
|
344
|
+
.ecx-card-tip { position: absolute; z-index: 30; top: calc(100% + 6px); left: -40px; width: 230px; padding: 8px 10px; border-radius: 8px; background: var(--ecx-ed-fg, #0f1e29); color: var(--ecx-ed-panel, #fff); font-size: 12px; font-weight: 400; line-height: 1.45; opacity: 0; pointer-events: none; transition: opacity .1s linear .3s; }
|
|
345
|
+
.ecx-card-info:hover .ecx-card-tip, .ecx-card-info:focus .ecx-card-tip { opacity: 1; }
|
|
346
|
+
/* Tab có icon */
|
|
347
|
+
.ecx-inspector .ecx-tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 54px; font-size: 12.5px; }
|
|
348
|
+
.ecx-inspector .ecx-tabs button .ecx-icon { width: 17px; height: 17px; }
|
|
251
349
|
.ecx-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ecx-ed-accent); }
|
|
252
350
|
.ecx-link-btn { padding: 2px 4px; border: 0; background: none; color: var(--ecx-ed-accent); font: 500 12.5px var(--ecx-ed-font); cursor: pointer; border-radius: 4px; }
|
|
253
351
|
.ecx-link-btn:hover { text-decoration: underline; }
|
|
@@ -264,10 +362,14 @@ body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select:
|
|
|
264
362
|
.ecx-style-section-body { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; }
|
|
265
363
|
.ecx-style-row { display: flex; flex-direction: column; gap: 6px; }
|
|
266
364
|
.ecx-device-tag { margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--ecx-ed-accent-soft); color: var(--ecx-ed-accent); font-style: normal; font-size: 10px; }
|
|
267
|
-
|
|
268
|
-
.ecx-seg
|
|
269
|
-
.ecx-seg-btn
|
|
270
|
-
.ecx-seg-btn
|
|
365
|
+
/* Cụm nút chọn: khung viền kín hết chiều ngang, ô đang chọn tô đặc màu chính (dễ thấy lựa chọn hiện tại) */
|
|
366
|
+
.ecx-seg { display: flex; width: 100%; gap: 2px; padding: 2px; border: 1px solid var(--ecx-ed-line-strong); border-radius: 7px; background: var(--ecx-ed-panel); }
|
|
367
|
+
.ecx-seg-btn { display: inline-flex; align-items: center; justify-content: center; flex: 1 1 0; min-width: 28px; height: 30px; padding: 0 6px; border: 0; border-radius: 5px; background: none; color: var(--ecx-ed-fg); cursor: pointer; transition: background-color .12s ease, color .12s ease; }
|
|
368
|
+
.ecx-seg-btn:hover { background: var(--ecx-ed-hover); }
|
|
369
|
+
.ecx-seg-btn.is-active { background: var(--ecx-ed-accent); color: var(--ecx-ed-accent-fg); }
|
|
370
|
+
.ecx-state-tabs { border: 0; padding: 3px; background: var(--ecx-ed-subtle); }
|
|
371
|
+
.ecx-state-tabs .ecx-seg-btn { color: var(--ecx-ed-muted); }
|
|
372
|
+
.ecx-state-tabs .ecx-seg-btn.is-active { background: var(--ecx-ed-panel); color: var(--ecx-ed-accent); box-shadow: 0 1px 2px rgb(14 40 58 / .12); }
|
|
271
373
|
.ecx-seg.is-text { display: flex; flex-wrap: wrap; width: 100%; }
|
|
272
374
|
.ecx-seg.is-text .ecx-seg-btn { flex: 1 1 auto; font: 500 12.5px var(--ecx-ed-font); white-space: nowrap; }
|
|
273
375
|
.ecx-field-help { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; color: var(--ecx-ed-muted); }
|
|
@@ -355,7 +457,138 @@ body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select:
|
|
|
355
457
|
/* Nút "+ Thêm section" giữa hai section cấp trên cùng */
|
|
356
458
|
.ecx-section-adder { position: fixed; z-index: 30; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; border: 0; background: var(--ecx-ed-accent); color: var(--ecx-ed-accent-fg); box-shadow: var(--ecx-ed-shadow); cursor: pointer; }
|
|
357
459
|
.ecx-section-adder:hover { background: var(--ecx-ed-accent-hover); }
|
|
460
|
+
/* Đang kéo khối: nút không chen giữa đường kéo */
|
|
461
|
+
body.is-dragging .ecx-section-adder { display: none; }
|
|
358
462
|
.ecx-section-adder:focus-visible { outline: 2px solid var(--ecx-ed-accent); outline-offset: 2px; }
|
|
359
463
|
.ecx-section-adder .ecx-icon { width: 16px; height: 16px; }
|
|
360
464
|
.ecx-inserter-popover .ecx-tabs { margin-bottom: 6px; }
|
|
361
465
|
.ecx-inserter-patterns { max-height: 320px; overflow-y: auto; }
|
|
466
|
+
|
|
467
|
+
/* Đệm / lề 4 cạnh: vạch đậm ở đúng cạnh của mỗi ô; bảng chọn bậc */
|
|
468
|
+
.ecx-box4 { position: relative; }
|
|
469
|
+
.ecx-box4-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
|
|
470
|
+
.ecx-four { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
|
|
471
|
+
.ecx-four-cell { display: grid; gap: 2px; min-width: 0; }
|
|
472
|
+
.ecx-four-cell small { font-size: 11px; color: var(--ecx-ed-muted); }
|
|
473
|
+
.ecx-box4-cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 42px; padding: 0; border: 1px solid var(--ecx-ed-line); border-radius: 7px; background: var(--ecx-ed-panel); color: var(--ecx-ed-fg); font: inherit; cursor: pointer; transition: border-color .05s linear; }
|
|
474
|
+
.ecx-box4-cell small { font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ecx-ed-muted); }
|
|
475
|
+
.ecx-box4-cell b { font-size: 12.5px; font-weight: 600; }
|
|
476
|
+
.ecx-box4-cell::after { content: ""; position: absolute; background: var(--ecx-ed-line-strong, #c9d0d7); border-radius: 2px; }
|
|
477
|
+
.ecx-box4-cell.is-top::after { top: -1px; left: 8px; right: 8px; height: 3px; }
|
|
478
|
+
.ecx-box4-cell.is-bottom::after { bottom: -1px; left: 8px; right: 8px; height: 3px; }
|
|
479
|
+
.ecx-box4-cell.is-left::after { left: -1px; top: 8px; bottom: 8px; width: 3px; }
|
|
480
|
+
.ecx-box4-cell.is-right::after { right: -1px; top: 8px; bottom: 8px; width: 3px; }
|
|
481
|
+
.ecx-box4-cell.is-set::after { background: var(--ecx-ed-accent); }
|
|
482
|
+
.ecx-box4-cell:hover, .ecx-box4-cell.is-open { border-color: var(--ecx-ed-accent); }
|
|
483
|
+
.ecx-link-toggle { display: inline-grid; place-items: center; width: 22px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--ecx-ed-muted); cursor: pointer; }
|
|
484
|
+
.ecx-link-toggle.is-on { background: var(--ecx-ed-accent); color: var(--ecx-ed-accent-fg); }
|
|
485
|
+
.ecx-link-toggle .ecx-icon { width: 13px; height: 13px; }
|
|
486
|
+
.ecx-box4-pop { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--ecx-ed-line); border-radius: 10px; background: var(--ecx-ed-panel); box-shadow: var(--ecx-ed-shadow); animation: ecx-pop .1s linear; }
|
|
487
|
+
.ecx-box4-pop .ecx-pop-title { margin: 0; }
|
|
488
|
+
.ecx-box4-steps { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
489
|
+
.ecx-box4-steps .ecx-chip { min-width: 36px; font-weight: 600; }
|
|
490
|
+
.ecx-box4-pop .ecx-pop-foot { margin-top: 0; }
|
|
491
|
+
.ecx-style-section-head .ecx-switch { margin-right: 2px; }
|
|
492
|
+
/* Bộ cột: bộ đếm số cột, hình bố cục */
|
|
493
|
+
.ecx-stepper { display: flex; align-items: center; height: 34px; border: 1px solid var(--ecx-ed-line); border-radius: 8px; overflow: hidden; }
|
|
494
|
+
.ecx-stepper button { width: 36px; height: 100%; border: 0; background: var(--ecx-ed-subtle); color: var(--ecx-ed-fg); font: 600 16px var(--ecx-ed-font); cursor: pointer; }
|
|
495
|
+
.ecx-stepper button:disabled { opacity: .4; cursor: default; }
|
|
496
|
+
.ecx-stepper output { flex: 1; text-align: center; font-weight: 600; }
|
|
497
|
+
.ecx-layout-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
|
|
498
|
+
.ecx-layout-thumb { display: flex; gap: 3px; height: 40px; padding: 7px; border: 1px solid var(--ecx-ed-line); border-radius: 8px; background: var(--ecx-ed-panel); cursor: pointer; transition: border-color .05s linear; }
|
|
499
|
+
.ecx-layout-thumb i { flex: 1; min-width: 4px; border-radius: 2px; background: var(--ecx-ed-line-strong, #c9d0d7); }
|
|
500
|
+
.ecx-layout-thumb.is-stack { flex-direction: column; }
|
|
501
|
+
.ecx-layout-thumb.is-stack i { flex: 1; }
|
|
502
|
+
.ecx-layout-thumb:hover { border-color: var(--ecx-ed-accent); }
|
|
503
|
+
.ecx-layout-thumb.is-active { border-color: var(--ecx-ed-accent); background: var(--ecx-ed-accent-soft); }
|
|
504
|
+
.ecx-layout-thumb.is-active i { background: var(--ecx-ed-accent); }
|
|
505
|
+
/* Hàng Kiểu (kiểu đặt sẵn) */
|
|
506
|
+
.ecx-preset { position: relative; display: flex; flex-direction: column; gap: 6px; }
|
|
507
|
+
.ecx-preset-row { display: flex; gap: 6px; }
|
|
508
|
+
.ecx-preset-btn { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--ecx-ed-line); border-radius: 8px; background: var(--ecx-ed-panel); color: var(--ecx-ed-fg); font: inherit; cursor: pointer; transition: border-color .05s linear; }
|
|
509
|
+
.ecx-preset-btn:hover, .ecx-preset-btn.is-open { border-color: var(--ecx-ed-accent); }
|
|
510
|
+
.ecx-preset-edited { font-style: normal; color: #e8890c; }
|
|
511
|
+
.ecx-preset-reset { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--ecx-ed-line); border-radius: 8px; background: var(--ecx-ed-panel); color: var(--ecx-ed-muted); cursor: pointer; }
|
|
512
|
+
.ecx-preset-reset:disabled { opacity: .4; cursor: default; }
|
|
513
|
+
.ecx-preset-menu { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; right: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 1px solid var(--ecx-ed-line); border-radius: 10px; background: var(--ecx-ed-panel); box-shadow: var(--ecx-ed-shadow); animation: ecx-pop .1s linear; }
|
|
514
|
+
.ecx-preset-menu hr { width: 100%; margin: 6px 0; border: 0; border-top: 1px solid var(--ecx-ed-line); }
|
|
515
|
+
.ecx-preset-line { display: flex; align-items: center; }
|
|
516
|
+
.ecx-preset-item { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--ecx-ed-fg); font: inherit; text-align: left; cursor: pointer; }
|
|
517
|
+
.ecx-preset-item:hover { background: var(--ecx-ed-subtle); }
|
|
518
|
+
.ecx-preset-item .ecx-icon { width: 15px; height: 15px; }
|
|
519
|
+
.ecx-preset-item[aria-checked=true] { font-weight: 600; }
|
|
520
|
+
.ecx-preset-item[aria-checked=true] .ecx-icon { margin-left: auto; color: var(--ecx-ed-accent); }
|
|
521
|
+
.ecx-preset-del { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--ecx-ed-muted); cursor: pointer; }
|
|
522
|
+
.ecx-preset-del:hover { background: var(--ecx-ed-subtle); color: #c0392b; }
|
|
523
|
+
.ecx-preset-name { display: flex; gap: 6px; padding: 2px; }
|
|
524
|
+
/* Ô chọn icon: lưới có ô tìm */
|
|
525
|
+
.ecx-icon-picker { position: relative; }
|
|
526
|
+
.ecx-icon-picker-btn { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--ecx-ed-line); border-radius: 8px; background: var(--ecx-ed-panel); color: var(--ecx-ed-fg); font: inherit; cursor: pointer; transition: border-color .05s linear; }
|
|
527
|
+
.ecx-icon-picker-btn:hover, .ecx-icon-picker-btn.is-open { border-color: var(--ecx-ed-accent); }
|
|
528
|
+
.ecx-icon-picker-name { flex: 1; text-align: left; font-size: 12px; color: var(--ecx-ed-muted); }
|
|
529
|
+
.ecx-icon-pop { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; right: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--ecx-ed-line); border-radius: 10px; background: var(--ecx-ed-panel); box-shadow: var(--ecx-ed-shadow); animation: ecx-pop .1s linear; }
|
|
530
|
+
.ecx-icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; max-height: 220px; overflow: auto; }
|
|
531
|
+
.ecx-icon-cell { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--ecx-ed-fg); cursor: pointer; }
|
|
532
|
+
.ecx-icon-cell:hover { background: var(--ecx-ed-subtle); }
|
|
533
|
+
.ecx-icon-cell.is-active { border-color: var(--ecx-ed-accent); background: var(--ecx-ed-accent-soft); color: var(--ecx-ed-accent); }
|
|
534
|
+
|
|
535
|
+
.ecx-check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
|
|
536
|
+
|
|
537
|
+
/* Thư viện mẫu (pattern-library.tsx): hộp gần toàn màn hình, cột trái danh mục, lưới xem trước thật */
|
|
538
|
+
.ecx-lib-open { gap: 6px; height: 32px; padding: 0 10px; font-weight: 500; }
|
|
539
|
+
.ecx-lib-backdrop { z-index: 1000; }
|
|
540
|
+
.ecx-lib { position: fixed; inset: 24px; display: grid; grid-template-columns: 240px 1fr; overflow: hidden; border-radius: 14px; background: var(--ecx-ed-panel); color: var(--ecx-ed-fg); box-shadow: 0 24px 64px rgb(14 40 58 / .3); font: 14px/1.45 var(--ecx-ed-font); }
|
|
541
|
+
.ecx-lib-side { display: flex; flex-direction: column; gap: 12px; padding: 16px; overflow: auto; border-right: 1px solid var(--ecx-ed-line); background: var(--ecx-ed-subtle); }
|
|
542
|
+
.ecx-lib-side .ecx-tabs { margin: 0 -16px; }
|
|
543
|
+
.ecx-lib-mode { display: flex; border: 1px solid var(--ecx-ed-line); border-radius: 8px; overflow: hidden; background: var(--ecx-ed-panel); }
|
|
544
|
+
.ecx-lib-mode button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 34px; border: 0; background: none; color: var(--ecx-ed-fg); font: inherit; font-size: 13px; cursor: pointer; }
|
|
545
|
+
.ecx-lib-mode button.is-active { background: var(--ecx-ed-accent); color: var(--ecx-ed-accent-fg); }
|
|
546
|
+
.ecx-lib-cats { display: flex; flex-direction: column; gap: 1px; }
|
|
547
|
+
.ecx-lib-cats button { padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
548
|
+
.ecx-lib-cats button:hover { background: var(--ecx-ed-hover); }
|
|
549
|
+
.ecx-lib-cats button[aria-current] { background: var(--ecx-ed-panel); font-weight: 600; box-shadow: 0 1px 2px rgb(14 40 58 / .08); }
|
|
550
|
+
.ecx-lib-scheme { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
|
|
551
|
+
.ecx-lib-scheme div { display: flex; gap: 8px; }
|
|
552
|
+
.ecx-lib-scheme button { width: 26px; height: 26px; padding: 0; border: 2px solid var(--ecx-ed-panel); border-radius: 50%; box-shadow: 0 0 0 1px var(--ecx-ed-line); cursor: pointer; }
|
|
553
|
+
.ecx-lib-scheme .is-light { background: #fff; } .ecx-lib-scheme .is-dark { background: #0f1b24; } .ecx-lib-scheme .is-brand { background: var(--ecx-ed-accent); }
|
|
554
|
+
.ecx-lib-scheme button.is-active { box-shadow: 0 0 0 2px var(--ecx-ed-accent); }
|
|
555
|
+
.ecx-lib-main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
|
|
556
|
+
.ecx-lib-bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--ecx-ed-line); }
|
|
557
|
+
.ecx-lib-search { display: flex; align-items: center; gap: 8px; width: min(320px, 50%); height: 36px; padding: 0 10px; border: 1px solid var(--ecx-ed-line); border-radius: 8px; }
|
|
558
|
+
.ecx-lib-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: inherit; font: inherit; }
|
|
559
|
+
.ecx-lib-close { margin-left: auto; display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--ecx-ed-muted); cursor: pointer; }
|
|
560
|
+
.ecx-lib-close:hover { background: var(--ecx-ed-hover); color: var(--ecx-ed-fg); }
|
|
561
|
+
.ecx-lib-ai { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px 18px; border-bottom: 1px solid var(--ecx-ed-line); background: var(--ecx-ed-subtle); }
|
|
562
|
+
.ecx-lib-ai label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ecx-ed-muted); }
|
|
563
|
+
.ecx-lib-ai .is-wide { grid-column: 1 / -1; }
|
|
564
|
+
.ecx-lib-ai .ecx-btn { align-self: end; justify-self: start; gap: 6px; }
|
|
565
|
+
.ecx-lib-error { grid-column: 1 / -1; margin: 0; color: var(--ecx-ed-danger); }
|
|
566
|
+
.ecx-lib-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; align-content: start; padding: 18px; overflow: auto; }
|
|
567
|
+
.ecx-lib-grid.is-pages { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
|
|
568
|
+
.ecx-lib-card { display: block; padding: 0; border: 1px solid var(--ecx-ed-line); border-radius: 10px; background: var(--ecx-ed-panel); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .1s linear, box-shadow .1s linear; }
|
|
569
|
+
.ecx-lib-card:hover, .ecx-lib-card:focus-visible { border-color: var(--ecx-ed-accent); box-shadow: 0 6px 18px rgb(14 40 58 / .12); outline: none; }
|
|
570
|
+
.ecx-lib-card-name { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--ecx-ed-line); font-size: 13px; }
|
|
571
|
+
.ecx-lib-card-name em { font-style: normal; color: var(--ecx-ed-muted); }
|
|
572
|
+
.ecx-lib-preview { position: relative; overflow: hidden; border-radius: 9px 9px 0 0; background: #fff; pointer-events: none; }
|
|
573
|
+
.ecx-lib-preview-inner { transform-origin: 0 0; }
|
|
574
|
+
.ecx-lib-preview-inner .ecx-canvas-wrap, .ecx-lib-preview-inner .ecx-canvas { height: 100%; }
|
|
575
|
+
@media (max-width: 720px) { .ecx-lib { inset: 0; border-radius: 0; grid-template-columns: 1fr; } .ecx-lib-side { display: none; } }
|
|
576
|
+
|
|
577
|
+
/* Hàng sửa một mục của danh sách (chữ; icon + liên kết + xoá) */
|
|
578
|
+
.ecx-item-row { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--ecx-ed-line); border-radius: 8px; }
|
|
579
|
+
.ecx-item-row-sub { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; gap: 4px; align-items: center; }
|
|
580
|
+
|
|
581
|
+
.ecx-quick-colors { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; max-width: 200px; }
|
|
582
|
+
.ecx-quick-colors .ecx-color-dot { width: 24px; height: 24px; border: 0; padding: 0; cursor: pointer; }
|
|
583
|
+
.ecx-quick-colors .ecx-color-dot:hover, .ecx-quick-colors .ecx-color-dot:focus-visible { outline: 2px solid var(--ecx-ed-accent, #1a597b); outline-offset: 2px; }
|
|
584
|
+
|
|
585
|
+
.ecx-divider-side + .ecx-divider-side { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ecx-ed-line, #e5e7eb); }
|
|
586
|
+
.ecx-divider-shapes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
|
|
587
|
+
.ecx-divider-shape { min-width: 0; height: 32px; padding: 0 2px; border: 1px solid var(--ecx-ed-line, #d1d5db); border-radius: 6px; background: var(--ecx-ed-panel, #fff); color: var(--ecx-ed-muted, #5d6a75); font: inherit; font-size: 11px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
|
|
588
|
+
.ecx-divider-shape svg { width: 22px; height: 12px; }
|
|
589
|
+
.ecx-divider-shape:hover { border-color: var(--ecx-ed-accent, #1a597b); }
|
|
590
|
+
.ecx-divider-shape.is-active { border-color: var(--ecx-ed-accent, #1a597b); background: var(--ecx-ed-accent, #1a597b); color: #fff; }
|
|
591
|
+
|
|
592
|
+
.ecx-textshadow { display: grid; gap: 10px; margin-top: 10px; }
|
|
593
|
+
.ecx-textshadow-row { display: grid; gap: 4px; font-size: 12px; color: var(--ecx-ed-muted, #5d6a75); }
|
|
594
|
+
.ecx-textshadow-row .ecx-range { width: 100%; }
|
package/src/v2/editor.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ensurePresets } from "./core/block-presets";
|
|
1
2
|
import type { RichNode } from "@ecomcx/ecomweb-content";
|
|
2
3
|
import { normalizeContent } from "@ecomcx/ecomweb-content";
|
|
3
4
|
import { ListTree, Monitor, Plus, Redo2, Smartphone, Tablet, Undo2, X, PanelRight, ZoomOut } from "lucide-react";
|
|
@@ -18,6 +19,7 @@ import { blocksFromDoc, docFromBlocks, type BNode } from "./core/model";
|
|
|
18
19
|
import { BlockTypeRegistry } from "./core/registry";
|
|
19
20
|
import { Inspector } from "./ui/inspector";
|
|
20
21
|
import { ListView } from "./ui/list-view";
|
|
22
|
+
import { PatternLibraryButton } from "./ui/pattern-library";
|
|
21
23
|
import { PrefsStore, usePrefs, type PrefsStorage } from "./prefs";
|
|
22
24
|
import { Breadcrumbs, CodeEditor, MoreMenu } from "./ui/options";
|
|
23
25
|
import { EditorStore, type DocRecord } from "./core/store";
|
|
@@ -106,6 +108,8 @@ export function EditorProvider({ store: given, value, kind, title, host = {}, la
|
|
|
106
108
|
}, []);
|
|
107
109
|
// Khối của plugin (registerBlock) + mẫu có sẵn của lõi
|
|
108
110
|
useEffect(() => syncPluginBlocks(registry), [registry]);
|
|
111
|
+
// Kiểu đặt sẵn / mặc định khi chèn: nạp ngay khi mở trình soạn (khối chèn đầu tiên đã nhận mặc định)
|
|
112
|
+
useEffect(() => ensurePresets(host.blockPresets?.load), [host]);
|
|
109
113
|
useEffect(() => { registerCoreBindingSources(allLabels.lang); }, [allLabels.lang]);
|
|
110
114
|
useEffect(() => { if (!registeredPatterns().some((p) => p.name.startsWith("core/"))) registerCorePatterns(allLabels.lang); }, [allLabels.lang]);
|
|
111
115
|
const ctx: EditorContextValue = useMemo(() => ({ store, registry, host, labels: allLabels, ui, prefs }), [store, registry, host, allLabels, ui, prefs]);
|
|
@@ -181,7 +185,8 @@ function EditorShell({ className, onSave, header, actions, menuExtra, canvasBefo
|
|
|
181
185
|
const p = usePrefs(ctx.prefs);
|
|
182
186
|
const [left, setLeft] = useState<"inserter" | "list" | null>(() => (ctx.prefs.get().showListView ? "list" : null));
|
|
183
187
|
useEffect(() => { ctx.ui.browseAll = () => setLeft("inserter"); return () => { ctx.ui.browseAll = null; }; }, [ctx.ui]);
|
|
184
|
-
|
|
188
|
+
// Điện thoại: bảng bên phải mở đè lên canvas nên mặc định đóng (mở bằng nút ở thanh trên)
|
|
189
|
+
const [right, setRight] = useState(() => typeof window === "undefined" || window.innerWidth > 640);
|
|
185
190
|
// Khổ ban đầu do ứng dụng chọn; sau đó dùng chung qua ui.device (DeviceSwitcher, tab Kiểu dáng)
|
|
186
191
|
useEffect(() => { if (defaultDevice) ctx.ui.setDevice(defaultDevice); }, [ctx.ui, defaultDevice]);
|
|
187
192
|
const [saving, setSaving] = useState<"idle" | "saving" | "saved" | "error">("idle");
|
|
@@ -233,6 +238,7 @@ function EditorShell({ className, onSave, header, actions, menuExtra, canvasBefo
|
|
|
233
238
|
<ToolButton label={labels.undo} disabled={!store.canUndo} onClick={() => store.undo()}><Undo2 className="ecx-icon" /></ToolButton>
|
|
234
239
|
<ToolButton label={labels.redo} disabled={!store.canRedo} onClick={() => store.redo()}><Redo2 className="ecx-icon" /></ToolButton>
|
|
235
240
|
{!p.distractionFree && <ToolButton label={labels.listView} active={left === "list"} onClick={() => setLeft(left === "list" ? null : "list")}><ListTree className="ecx-icon" /></ToolButton>}
|
|
241
|
+
{!p.distractionFree && p.mode === "visual" && <PatternLibraryButton renderPreview={(value) => <EditorProvider value={value} kind="pattern-preview" registry={ctx.registry} labels={ctx.labels} host={{ ...ctx.host, documents: undefined, ai: undefined }}><Canvas /></EditorProvider>} />}
|
|
236
242
|
<FrameToggle />
|
|
237
243
|
{p.mode === "visual" && <ZoomToggle />}
|
|
238
244
|
</div>
|
|
@@ -251,7 +257,7 @@ function EditorShell({ className, onSave, header, actions, menuExtra, canvasBefo
|
|
|
251
257
|
{error && <div className="ecx-notice is-error" role="alert">{error}</div>}
|
|
252
258
|
{p.fixedToolbar && p.mode === "visual" && <div className="ecx-fixed-toolbar"><BlockToolbar placement="fixed" /></div>}
|
|
253
259
|
<div className="ecx-body">
|
|
254
|
-
{left && !p.distractionFree && <aside className="ecx-left">{left === "inserter" ? <InserterPanel onClose={() => setLeft(null)} /> : <ListView />}</aside>}
|
|
260
|
+
{left && !p.distractionFree && <aside className="ecx-left">{left === "inserter" ? <InserterPanel onClose={() => setLeft(null)} onInserted={() => { /* Điện thoại: bảng đè lên canvas nên chèn xong thì đóng để tiếp tục soạn */ if (window.innerWidth <= 640) setLeft(null); }} /> : <ListView onClose={() => setLeft(null)} />}</aside>}
|
|
255
261
|
<main className="ecx-main">{p.mode === "code" ? <CodeEditor /> : <Canvas before={canvasBefore} />}</main>
|
|
256
262
|
{right && !p.distractionFree && <aside className="ecx-right"><Inspector blockStyles={blockStyles} /></aside>}
|
|
257
263
|
</div>
|
package/src/v2/index.ts
CHANGED
|
@@ -9,6 +9,9 @@ export { BlockToolbar, BlockContextMenu, DropIndicator, ToolButton, Dropdown, Me
|
|
|
9
9
|
export { InserterPanel, InserterPopover, rankOptions, useInsertOptions, type InsertOption } from "./ui/inserter";
|
|
10
10
|
export { Inspector } from "./ui/inspector";
|
|
11
11
|
export { AttrForm } from "./ui/attr-form";
|
|
12
|
+
export { MediaPlaceholder, TextPlaceholder, LinkPlaceholder, PickPlaceholder, AddBlockButton, AddItemButton, MissingNote, type MediaPlaceholderProps, type TextPlaceholderProps, type LinkPlaceholderProps, type PickPlaceholderProps, type AddBlockButtonProps } from "./ui/placeholders";
|
|
13
|
+
export { MediaActions, useFileDrop } from "./ui/media-actions";
|
|
14
|
+
export { placeholderFields } from "./blocks/compat";
|
|
12
15
|
export { ListView, blockLabel } from "./ui/list-view";
|
|
13
16
|
export { Block, InnerBlocks, NestedDoc, DocBlocks, Appender, FallbackEdit, useBlockProps } from "./canvas/block-list";
|
|
14
17
|
export { RichText, richViews, type RichTextProps } from "./text/rich-text";
|
package/src/v2/ui/ai.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Sparkles } from "lucide-react";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { useEditor } from "../context";
|
|
4
|
-
import {
|
|
4
|
+
import type { RichNode } from "@ecomcx/ecomweb-content";
|
|
5
|
+
import { fromRich, inlineText, makeBlock, type BNode } from "../core/model";
|
|
5
6
|
import { Modal } from "./options";
|
|
6
7
|
import { Dropdown, MenuItem, ToolButton } from "./toolbar";
|
|
7
8
|
|
|
@@ -95,19 +96,22 @@ export function AiWrite() {
|
|
|
95
96
|
const { host, labels, store, ui } = useEditor();
|
|
96
97
|
const [at, setAt] = useState<{ blockId?: string; docId: string; parentId: string | null; index: number } | null>(null);
|
|
97
98
|
const [prompt, setPrompt] = useState("");
|
|
98
|
-
const [state, setState] = useState<{ loading: boolean; text?: string; error?: string }>({ loading: false });
|
|
99
|
+
const [state, setState] = useState<{ loading: boolean; text?: string; nodes?: RichNode[]; error?: string }>({ loading: false });
|
|
99
100
|
useEffect(() => { ui.openAiWrite = (a) => { setAt(a); setPrompt(""); setState({ loading: false }); }; return () => { ui.openAiWrite = null; }; }, [ui]);
|
|
100
101
|
if (!at || !host.ai) return null;
|
|
101
102
|
const run = async () => {
|
|
102
103
|
if (!prompt.trim()) return;
|
|
103
104
|
setState({ loading: true });
|
|
104
|
-
try {
|
|
105
|
-
|
|
105
|
+
try {
|
|
106
|
+
const r = host.ai!.write ? await host.ai!.write(prompt.trim()) : { text: await host.ai!.run("write", prompt.trim(), {}) };
|
|
107
|
+
setState({ loading: false, text: r.text, nodes: Array.isArray(r.nodes) && r.nodes.length ? r.nodes as RichNode[] : undefined });
|
|
108
|
+
} catch (e) { setState({ loading: false, error: (e as Error).message }); }
|
|
106
109
|
};
|
|
107
110
|
const paragraphs = (state.text ?? "").split(/\n{2,}/).map((p) => p.trim()).filter(Boolean);
|
|
108
111
|
const insert = () => {
|
|
109
112
|
if (!paragraphs.length) return;
|
|
110
|
-
|
|
113
|
+
// Có khối dạng lưu (tiêu đề, danh sách) thì chèn đúng khối; ứng dụng cũ chỉ trả chữ → mỗi đoạn một khối đoạn văn
|
|
114
|
+
const nodes = state.nodes ? state.nodes.map(fromRich) : paragraphs.map((p) => makeBlock("paragraph", {}, p));
|
|
111
115
|
store.batch(() => {
|
|
112
116
|
if (at.blockId && store.block(at.blockId)) store.replace(at.blockId, nodes);
|
|
113
117
|
else store.insert(at.docId, at.parentId, at.index, nodes);
|
package/src/v2/ui/attr-form.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BlockAttrSpec } from "@ecomcx/ecomweb-content";
|
|
2
|
-
import {
|
|
2
|
+
import { AlignCenter, AlignHorizontalSpaceBetween, AlignJustify, AlignLeft, AlignRight, RotateCcw } from "lucide-react";
|
|
3
|
+
import { useEffect, useState, type ComponentType, type ReactNode } from "react";
|
|
3
4
|
import { useEditor } from "../context";
|
|
4
5
|
import type { Choice, ChoiceKind } from "../core/host";
|
|
5
6
|
import type { BlockType } from "../core/registry";
|
|
@@ -7,6 +8,7 @@ import { messages } from "../../i18n";
|
|
|
7
8
|
import { blockOptions } from "../../shared/block-defs";
|
|
8
9
|
import { DEFAULT_IMAGE_SIZES, hintOf, hintText, imageSizeLabel, optionLabel, type AttrHint } from "./attr-hints";
|
|
9
10
|
import { ColorInput } from "./color-field";
|
|
11
|
+
import { IconPicker } from "./icon-picker";
|
|
10
12
|
import { mediaSrcsets } from "../core/media";
|
|
11
13
|
|
|
12
14
|
export const cx = (...c: unknown[]) => c.filter((x): x is string => typeof x === "string" && x !== "").join(" ");
|
|
@@ -16,10 +18,10 @@ export const attrName = (name: string, lang: string): string | undefined => { co
|
|
|
16
18
|
/** Thuộc tính sửa ở chỗ khác (thanh công cụ, trên khung soạn) hoặc dữ liệu kỹ thuật. */
|
|
17
19
|
const HIDDEN_ATTRS = new Set(["style", "blockStyle", "anchor", "className", "mediaId", "srcset", "webpSrcset", "images", "links", "colwidth", "colspan", "rowspan", "_v", "id"]); // gộp ô: dùng lệnh Gộp / Tách của công cụ bảng (sửa số tay làm lệch bảng)
|
|
18
20
|
|
|
19
|
-
const attrLabel = (name: string, spec: BlockAttrSpec, lang: string, translate?: (s: string) => string) =>
|
|
21
|
+
export const attrLabel = (name: string, spec: BlockAttrSpec, lang: string, translate?: (s: string) => string) =>
|
|
20
22
|
spec.label ? (translate ? translate(spec.label) : spec.label) : attrName(name, lang) ?? name;
|
|
21
23
|
|
|
22
|
-
function controlOf(spec: BlockAttrSpec): NonNullable<BlockAttrSpec["control"]> {
|
|
24
|
+
export function controlOf(spec: BlockAttrSpec): NonNullable<BlockAttrSpec["control"]> {
|
|
23
25
|
if (spec.control) return spec.control;
|
|
24
26
|
if (spec.enum) return "select";
|
|
25
27
|
switch (spec.type) {
|
|
@@ -54,12 +56,17 @@ function useChoices(kind: ChoiceKind | undefined, args: Record<string, string> |
|
|
|
54
56
|
return state?.key === key ? state.list : undefined;
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
/** Giá trị căn → biểu tượng (như thanh căn chữ của WP): hàng chọn căn chỉ toàn các giá trị này thì vẽ bằng biểu tượng, chữ nằm ở tooltip / nhãn đọc màn hình. */
|
|
60
|
+
const ALIGN_ICONS: Record<string, ComponentType<{ className?: string }>> = { left: AlignLeft, center: AlignCenter, right: AlignRight, justify: AlignJustify, "space-between": AlignHorizontalSpaceBetween };
|
|
57
61
|
function SegText({ value, options, onChange, label }: { value: string | undefined; options: Array<[string, string]>; onChange(v: string | undefined): void; label: string }) {
|
|
62
|
+
// Từ 3 lựa chọn trở lên: hai lựa chọn trái / phải thường là vị trí (icon trước / sau chữ), không phải căn
|
|
63
|
+
const icons = options.length > 2 && options.every(([v]) => ALIGN_ICONS[v]);
|
|
58
64
|
return (
|
|
59
|
-
<div role="radiogroup" aria-label={label} className="ecx-seg is-text">
|
|
60
|
-
{options.map(([v, text]) =>
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
<div role="radiogroup" aria-label={label} className={cx("ecx-seg", !icons && "is-text")}>
|
|
66
|
+
{options.map(([v, text]) => {
|
|
67
|
+
const Icon = icons ? ALIGN_ICONS[v] : undefined;
|
|
68
|
+
return <button key={v} type="button" role="radio" aria-checked={value === v} aria-label={Icon ? text : undefined} title={Icon ? text : undefined} className={cx("ecx-seg-btn", value === v && "is-active")} onClick={() => onChange(value === v ? undefined : v)}>{Icon ? <Icon className="ecx-icon" /> : text}</button>;
|
|
69
|
+
})}
|
|
63
70
|
</div>
|
|
64
71
|
);
|
|
65
72
|
}
|
|
@@ -89,9 +96,26 @@ export function AttrForm({ type, attrs, onChange }: { type: BlockType; attrs: Re
|
|
|
89
96
|
.map(([k, s]) => [k, s, hintOf(type.name, k)] as const)
|
|
90
97
|
.filter(([k, s, h]) => !HIDDEN_ATTRS.has(k) && controlOf(s) !== "hidden" && h.control !== "hidden" && (!h.when || h.when(attrs)));
|
|
91
98
|
if (!entries.length) return null;
|
|
99
|
+
const resetLabel = String(messages("controls", lang).reset ?? "Reset");
|
|
92
100
|
return (
|
|
93
101
|
<div className="ecx-form">
|
|
94
102
|
{entries.map(([k, spec, hint]) => {
|
|
103
|
+
const node = field(k, spec, hint);
|
|
104
|
+
// Ô đã đổi khác mặc định: nút ↶ về mặc định (như ô của tab Kiểu dáng)
|
|
105
|
+
const v = attrs[k];
|
|
106
|
+
if (v === undefined || v === null || v === "" || JSON.stringify(v) === JSON.stringify(spec.default) || !node) return node;
|
|
107
|
+
const label = hintText(hint, "label", lang) ?? attrLabel(k, spec, lang, translate);
|
|
108
|
+
return (
|
|
109
|
+
<div key={k} className="ecx-field-wrap">
|
|
110
|
+
{node}
|
|
111
|
+
<button type="button" className="ecx-row-reset ecx-field-reset" title={resetLabel} aria-label={`${resetLabel}: ${label}`} onClick={() => onChange({ [k]: undefined })}><RotateCcw className="ecx-icon" /></button>
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
})}
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
function field(k: string, spec: BlockAttrSpec, hint: AttrHint) {
|
|
95
119
|
const label = hintText(hint, "label", lang) ?? attrLabel(k, spec, lang, translate);
|
|
96
120
|
const value = attrs[k] ?? spec.default;
|
|
97
121
|
const set = (v: unknown) => onChange({ [k]: v === "" || v === spec.default ? undefined : v });
|
|
@@ -109,7 +133,11 @@ export function AttrForm({ type, attrs, onChange }: { type: BlockType; attrs: Re
|
|
|
109
133
|
return <label key={k} className="ecx-check"><input type="checkbox" checked={value === "_blank"} onChange={(e) => set(e.target.checked ? "_blank" : undefined)} /> {labels.openInNewTab}</label>;
|
|
110
134
|
case "segmented":
|
|
111
135
|
return <Field key={k} label={label} group><SegText label={label} value={value == null ? undefined : String(value)} options={opts()} onChange={(v) => set(v === undefined ? undefined : parse(v))} />{help}</Field>;
|
|
112
|
-
case "select":
|
|
136
|
+
case "select": {
|
|
137
|
+
// Ít lựa chọn, chữ ngắn → dãy nút bấm (một chạm, thấy hết lựa chọn) như bảng của các bộ khối lớn; cấp tiêu đề → H1…H6
|
|
138
|
+
const list = k === "level" ? opts().map(([v]) => [v, `H${v}`] as [string, string]) : opts();
|
|
139
|
+
if (list.length >= 2 && list.length <= 6 && list.every(([, text]) => text.length <= 12))
|
|
140
|
+
return <Field key={k} label={label} group><SegText label={label} value={value == null ? undefined : String(value)} options={list} onChange={(v) => set(v === undefined ? undefined : parse(v))} />{help}</Field>;
|
|
113
141
|
return (
|
|
114
142
|
<Field key={k} label={label}>
|
|
115
143
|
<select className="ecx-input" value={value == null ? "" : String(value)} onChange={(e) => set(parse(e.target.value))}>
|
|
@@ -119,6 +147,9 @@ export function AttrForm({ type, attrs, onChange }: { type: BlockType; attrs: Re
|
|
|
119
147
|
{help}
|
|
120
148
|
</Field>
|
|
121
149
|
);
|
|
150
|
+
}
|
|
151
|
+
case "icon":
|
|
152
|
+
return <Field key={k} label={label}><IconPicker label={label} value={value == null ? undefined : String(value)} allowNone={hint.allowNone} onChange={(v) => set(v)} />{help}</Field>;
|
|
122
153
|
case "choice":
|
|
123
154
|
return <Field key={k} label={label}><ChoiceField hint={hint} attrs={attrs} value={value} set={set} label={label} />{help}</Field>;
|
|
124
155
|
case "range": {
|
|
@@ -151,7 +182,7 @@ export function AttrForm({ type, attrs, onChange }: { type: BlockType; attrs: Re
|
|
|
151
182
|
case "textarea":
|
|
152
183
|
return <Field key={k} label={label}><textarea className="ecx-input" rows={3} value={value == null ? "" : String(value)} onChange={(e) => set(e.target.value)} />{help}</Field>;
|
|
153
184
|
case "color":
|
|
154
|
-
return <
|
|
185
|
+
return <div key={k} className="ecx-field"><ColorInput label={label} value={value == null ? undefined : String(value)} onChange={(v) => set(v)} />{help}</div>;
|
|
155
186
|
case "media":
|
|
156
187
|
return (
|
|
157
188
|
<Field key={k} label={label}>
|
|
@@ -163,9 +194,7 @@ export function AttrForm({ type, attrs, onChange }: { type: BlockType; attrs: Re
|
|
|
163
194
|
</Field>
|
|
164
195
|
);
|
|
165
196
|
default:
|
|
166
|
-
return <Field key={k} label={label}><input className="ecx-input" type={controlOf(spec) === "url" ? "url" : "text"} value={value == null ? "" : String(value)} onChange={(e) => set(e.target.value)} />{help}</Field>;
|
|
197
|
+
return <Field key={k} label={label}><input className="ecx-input" type={controlOf(spec) === "url" ? "url" : "text"} value={value == null ? "" : String(value)} placeholder={hintText(hint, "placeholder", lang)} onChange={(e) => set(e.target.value)} />{help}</Field>;
|
|
167
198
|
}
|
|
168
|
-
|
|
169
|
-
</div>
|
|
170
|
-
);
|
|
199
|
+
}
|
|
171
200
|
}
|