@ecomcx/ecomweb-editor 1.33.0 → 1.34.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 +2 -1
- package/src/locales/en/background.ts +5 -0
- package/src/locales/en/bindings.ts +4 -0
- package/src/locales/en/block-desc.ts +4 -11
- package/src/locales/en/block-style.ts +17 -6
- package/src/locales/en/block-titles.ts +38 -16
- package/src/locales/en/blocks.ts +36 -6
- package/src/locales/en/columns.ts +1 -0
- package/src/locales/en/controls.ts +1 -1
- package/src/locales/en/hints.ts +241 -12
- package/src/locales/en/index.ts +3 -1
- package/src/locales/en/layout.ts +13 -0
- package/src/locales/en/motion.ts +16 -0
- package/src/locales/en/palette.ts +8 -0
- package/src/locales/en/parts.ts +2 -1
- package/src/locales/en/pattern-overrides.ts +14 -0
- package/src/locales/en/placeholders.ts +6 -3
- package/src/locales/en/v2.ts +2 -0
- package/src/locales/vi/attrs.ts +3 -2
- package/src/locales/vi/background.ts +5 -0
- package/src/locales/vi/bindings.ts +4 -0
- package/src/locales/vi/block-desc.ts +7 -14
- package/src/locales/vi/block-style.ts +18 -7
- package/src/locales/vi/block-titles.ts +48 -26
- package/src/locales/vi/blocks.ts +36 -6
- package/src/locales/vi/columns.ts +1 -0
- package/src/locales/vi/controls.ts +1 -1
- package/src/locales/vi/hints.ts +241 -12
- package/src/locales/vi/index.ts +3 -1
- package/src/locales/vi/layout.ts +13 -0
- package/src/locales/vi/motion.ts +16 -0
- package/src/locales/vi/palette.ts +8 -0
- package/src/locales/vi/parts.ts +2 -1
- package/src/locales/vi/pattern-overrides.ts +14 -0
- package/src/locales/vi/placeholders.ts +7 -4
- package/src/locales/vi/v2.ts +2 -0
- package/src/v2/blocks/columns-inspector.tsx +11 -2
- package/src/v2/blocks/index.ts +9 -6
- package/src/v2/blocks/layout-options.tsx +80 -0
- package/src/v2/blocks/layout.tsx +331 -124
- package/src/v2/blocks/media.tsx +51 -21
- package/src/v2/blocks/resize.tsx +50 -19
- package/src/v2/blocks/social-icons.ts +22 -0
- package/src/v2/blocks/text.tsx +12 -50
- package/src/v2/blocks/theme.tsx +13 -19
- package/src/v2/blocks/tools.tsx +24 -2
- package/src/v2/blocks/widgets.tsx +84 -28
- package/src/v2/canvas/block-list.tsx +30 -4
- package/src/v2/canvas/canvas-css.ts +81 -9
- package/src/v2/canvas/canvas.tsx +63 -7
- package/src/v2/canvas/dnd.ts +7 -0
- package/src/v2/canvas/variation-picker.tsx +63 -0
- package/src/v2/context.tsx +48 -0
- package/src/v2/core/bindings.ts +6 -1
- package/src/v2/core/block-presets.ts +10 -0
- package/src/v2/core/clipboard.ts +5 -5
- package/src/v2/core/host.ts +2 -0
- package/src/v2/core/model.ts +6 -6
- package/src/v2/core/registry.ts +15 -0
- package/src/v2/core/store.ts +9 -9
- package/src/v2/core/structure.ts +1 -3
- package/src/v2/editor.css +74 -0
- package/src/v2/editor.tsx +22 -7
- package/src/v2/text/rich-text.tsx +20 -5
- package/src/v2/ui/ai-markdown.ts +52 -0
- package/src/v2/ui/ai.tsx +81 -14
- package/src/v2/ui/attr-form.tsx +26 -6
- package/src/v2/ui/attr-hints.ts +115 -16
- package/src/v2/ui/background-panel.tsx +22 -0
- package/src/v2/ui/bg-video-preview.tsx +7 -0
- package/src/v2/ui/bindings.tsx +7 -2
- package/src/v2/ui/block-icons.tsx +3 -10
- package/src/v2/ui/block-live-preview.tsx +21 -0
- package/src/v2/ui/block-style-panel.tsx +3 -1
- package/src/v2/ui/command-palette.tsx +125 -0
- package/src/v2/ui/icon-picker.tsx +88 -21
- package/src/v2/ui/icon-svg.tsx +21 -0
- package/src/v2/ui/inserter.tsx +62 -12
- package/src/v2/ui/inspector.tsx +12 -6
- package/src/v2/ui/layout-panel.tsx +1 -1
- package/src/v2/ui/motion-panel.tsx +22 -13
- package/src/v2/ui/option-thumbs.tsx +81 -0
- package/src/v2/ui/pattern-library.tsx +2 -1
- package/src/v2/ui/pattern-overrides.tsx +67 -0
- package/src/v2/ui/placeholders.tsx +21 -2
- package/src/v2/ui/preset-bar.tsx +5 -5
- package/src/v2/ui/style-supports.ts +2 -3
- package/src/v2/ui/style-tab.tsx +83 -20
- package/src/v2/ui/toolbar.tsx +40 -6
- package/src/v2/ui/transform-panel.tsx +77 -0
package/src/locales/vi/index.ts
CHANGED
|
@@ -26,5 +26,7 @@ import { patternLib } from "./pattern-lib";
|
|
|
26
26
|
import { shortcuts } from "./shortcuts";
|
|
27
27
|
import { placeholders } from "./placeholders";
|
|
28
28
|
import { library } from "./library";
|
|
29
|
+
import { palette } from "./palette";
|
|
30
|
+
import { patternOverrides } from "./pattern-overrides";
|
|
29
31
|
|
|
30
|
-
export const vi = { v2, legacy, attrs, background, bindings, blockStyle, blockDesc, blockTitles, blocks, controls, columns, hints, parts, presets, layout, legacyBasic, legacyDynamic, motion, library, patternLib, placeholders, shortcuts };
|
|
32
|
+
export const vi = { patternOverrides, v2, legacy, attrs, background, bindings, blockStyle, blockDesc, blockTitles, blocks, controls, columns, hints, parts, presets, layout, legacyBasic, legacyDynamic, motion, library, patternLib, placeholders, shortcuts, palette };
|
package/src/locales/vi/layout.ts
CHANGED
|
@@ -21,6 +21,18 @@ export const layout = {
|
|
|
21
21
|
none: "Không",
|
|
22
22
|
shadow: "Đổ bóng",
|
|
23
23
|
ratio: "Tỉ lệ khung",
|
|
24
|
+
customCss: "CSS riêng của khối", customCssHelp: "Viết CSS chỉ tác động trong khối này, dùng \"selector\" để chỉ chính khối. Ví dụ: selector:hover { opacity: .8 }", customCssDropped: "Đã bỏ phần không an toàn", customCssExample: "selector { box-shadow: 0 4px 12px #0002 }\nselector:hover { opacity: .85 }\nselector img { border-radius: 8px }",
|
|
25
|
+
backdrop: "Kính mờ", backdropBlur: "Làm mờ nền phía sau", backdropHelp: "Làm mờ phần nền nằm sau khối (hiệu ứng kính). Hợp với khối có nền màu hơi trong suốt.",
|
|
26
|
+
inheritedValue: "kế thừa", placeTitle: "Vị trí", placeType: "Kiểu định vị", placeTypeRelative: "Tương đối", placeTypeAbsolute: "Tuyệt đối", placeTypeFixed: "Cố định",
|
|
27
|
+
placeTop: "Trên", placeRight: "Phải", placeBottom: "Dưới", placeLeft: "Trái",
|
|
28
|
+
placeHelpRelative: "Giữ chỗ cũ trong bố cục, rồi dịch đi theo các giá trị trên (không đẩy khối khác).",
|
|
29
|
+
placeHelpAbsolute: "Rút khỏi bố cục và đặt theo mép của khối cha (khối cha tự thành điểm neo). Dùng cho huy hiệu, ảnh chồng lên khối khác.",
|
|
30
|
+
placeHelpFixed: "Dính vào màn hình khi cuộn (nút nổi, thanh dính). Nhớ đặt khổ điện thoại để không che nội dung.",
|
|
31
|
+
transformTitle: "Biến đổi", rotate: "Xoay", scale: "Phóng to / thu nhỏ", skewX: "Nghiêng ngang", skewY: "Nghiêng dọc", moveX: "Dịch ngang", moveY: "Dịch dọc", origin: "Điểm gốc",
|
|
32
|
+
origin_top_left: "Trên trái", origin_top: "Trên giữa", origin_top_right: "Trên phải", origin_left: "Giữa trái", origin_center: "Chính giữa", origin_right: "Giữa phải", origin_bottom_left: "Dưới trái", origin_bottom: "Dưới giữa", origin_bottom_right: "Dưới phải",
|
|
33
|
+
audience: "Ai xem được", audienceAll: "Mọi người", audienceGuest: "Chỉ khách (chưa đăng nhập)", audienceUser: "Chỉ thành viên đã đăng nhập", audienceHelp: "Chỉ ẩn trên trình duyệt, không dùng cho nội dung bí mật. Trình soạn vẫn hiện để bạn sửa.",
|
|
34
|
+
schedule: "Lịch hiển thị", scheduleFrom: "Hiện từ", scheduleUntil: "Hiện đến", scheduleHelp: "Website chỉ hiện khối trong khoảng này (giờ của máy bạn). Trình soạn vẫn hiện để bạn sửa. Trang được lưu đệm có thể trễ vài phút.",
|
|
35
|
+
hoverPreview: "Xem trước khi rê chuột", hoverPreviewHelp: "Hiện khối như đang rê chuột để chỉnh màu / viền / bóng lúc rê",
|
|
24
36
|
sticky: "Ghim khi cuộn",
|
|
25
37
|
top: "Cách mép trên",
|
|
26
38
|
hover: "Khi rê chuột",
|
|
@@ -58,6 +70,7 @@ export const layout = {
|
|
|
58
70
|
divider_tilt: "Vát",
|
|
59
71
|
divider_triangle: "Tam giác",
|
|
60
72
|
divider_zigzag: "Răng cưa",
|
|
73
|
+
divider_arrow: "Mũi tên", divider_stairs: "Bậc thang", divider_ripple: "Sóng đôi", divider_mountains: "Núi",
|
|
61
74
|
textShadow: "Bóng chữ",
|
|
62
75
|
tsX: "Lệch ngang",
|
|
63
76
|
tsY: "Lệch dọc",
|
package/src/locales/vi/motion.ts
CHANGED
|
@@ -14,6 +14,12 @@ export const motion = {
|
|
|
14
14
|
stagger: "Hiện lần lượt từng khối con",
|
|
15
15
|
hover: "Hiệu ứng rê chuột",
|
|
16
16
|
plugin: "Plugin",
|
|
17
|
+
ease: "Nhịp chạy",
|
|
18
|
+
eases: { smooth: "Mượt", snappy: "Dứt khoát", bounce: "Nảy", linear: "Đều" },
|
|
19
|
+
loop: "Chuyển động lặp",
|
|
20
|
+
loops: { float: "Nổi lên xuống", pulse: "Đập nhẹ", spin: "Xoay vòng", swing: "Lắc nhẹ" },
|
|
21
|
+
parallax: "Thị sai khi cuộn",
|
|
22
|
+
parallaxes: { slow: "Chậm", fast: "Nhanh", reverse: "Ngược chiều" },
|
|
17
23
|
in: {
|
|
18
24
|
fade: "Mờ dần",
|
|
19
25
|
"slide-up": "Trượt lên",
|
|
@@ -23,11 +29,21 @@ export const motion = {
|
|
|
23
29
|
"zoom-in": "Phóng to dần",
|
|
24
30
|
"zoom-out": "Thu nhỏ dần",
|
|
25
31
|
"blur-in": "Rõ dần",
|
|
32
|
+
"flip-x": "Lật ngang",
|
|
33
|
+
"flip-y": "Lật dọc",
|
|
34
|
+
"rotate-in": "Xoay vào",
|
|
35
|
+
"bounce-in": "Nảy vào",
|
|
36
|
+
"reveal-up": "Mở từ dưới lên",
|
|
37
|
+
"reveal-left": "Mở từ trái sang",
|
|
26
38
|
},
|
|
27
39
|
hv: {
|
|
28
40
|
lift: "Nhấc lên",
|
|
29
41
|
grow: "Phóng to",
|
|
30
42
|
brighten: "Sáng lên",
|
|
31
43
|
glow: "Phát sáng",
|
|
44
|
+
rotate: "Xoay nhẹ",
|
|
45
|
+
tilt: "Nghiêng 3D",
|
|
46
|
+
gray: "Từ đen trắng ra màu",
|
|
47
|
+
shrink: "Thu nhỏ",
|
|
32
48
|
},
|
|
33
49
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Bảng lệnh (⌘⇧P / Ctrl+Shift+P): tìm nhanh thao tác, chế độ xem, khối để chèn, hoặc nhảy tới một khối trong trang. */
|
|
2
|
+
export const palette = {
|
|
3
|
+
title: "Bảng lệnh", placeholder: "Gõ tên lệnh, khối cần chèn hoặc chữ trong trang…", empty: "Không có lệnh nào khớp", hint: "↑ ↓ chọn · Enter chạy · Esc đóng",
|
|
4
|
+
groupActions: "Thao tác", groupView: "Xem", groupInsert: "Chèn khối", groupGoto: "Đi tới khối",
|
|
5
|
+
save: "Lưu", undo: "Hoàn tác", redo: "Làm lại", selectParent: "Chọn khối cha", duplicate: "Nhân đôi khối đang chọn", remove: "Xoá khối đang chọn", moveUp: "Chuyển khối lên", moveDown: "Chuyển khối xuống", copyStyle: "Chép kiểu khối đang chọn", pasteStyle: "Dán kiểu vào khối đang chọn",
|
|
6
|
+
desktop: "Xem khổ máy tính", tablet: "Xem khổ máy tính bảng", mobile: "Xem khổ điện thoại", listView: "Mở / đóng danh sách khối", settings: "Mở / đóng bảng cài đặt", inserter: "Mở bảng chèn khối", zoomOut: "Thu nhỏ để sắp xếp", library: "Mở thư viện mẫu",
|
|
7
|
+
insert: "Chèn", goto: "Đi tới",
|
|
8
|
+
};
|
package/src/locales/vi/parts.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** Phần của khối (content 1.26 PartSpec) và ô của phần. */
|
|
2
2
|
export const parts = {
|
|
3
|
+
frame: "Khung viền", subtitle: "Phụ đề",
|
|
3
4
|
box: "Khung", icon: "Icon", title: "Tiêu đề", text: "Mô tả", image: "Ảnh", quote: "Lời trích", avatar: "Ảnh đại diện", name: "Tên", role: "Chức danh",
|
|
4
|
-
quoteMark: "Dấu trích", rating: "Sao đánh giá", required: "Dấu * bắt buộc", help: "Gợi ý dưới ô", error: "Báo lỗi", success: "Báo thành công", input: "Ô nhập", map: "Khung bản đồ", number: "Số", label: "Nhãn", track: "Nền thanh", bar: "Thanh", item: "Mục",
|
|
5
|
+
more: "Nút Xem thêm", quoteMark: "Dấu trích", rating: "Sao đánh giá", required: "Dấu * bắt buộc", help: "Gợi ý dưới ô", error: "Báo lỗi", success: "Báo thành công", input: "Ô nhập", map: "Khung bản đồ", number: "Số", label: "Nhãn", track: "Nền thanh", bar: "Thanh", item: "Mục",
|
|
5
6
|
paneTitle: "Tiêu đề mục", paneContent: "Nội dung mục", tabList: "Thanh tab", tab: "Nút tab", panel: "Nội dung tab", button: "Nút", caption: "Chú thích",
|
|
6
7
|
tableHead: "Ô tiêu đề", tableCell: "Ô thường", unitBox: "Ô thời gian", unitLabel: "Chữ đơn vị", content: "Vùng nội dung",
|
|
7
8
|
highlight: "Chữ tô sáng", link: "Liên kết", active: "Đang mở / chọn",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Mẫu đồng bộ sửa riêng vài ô. */
|
|
2
|
+
export const patternOverrides = {
|
|
3
|
+
title: "Ô sửa riêng của mẫu",
|
|
4
|
+
none: "Mẫu này chưa có khối nào cho sửa riêng. Mở mẫu, chọn khối rồi bật “Cho phép sửa riêng” ở tab Nâng cao.",
|
|
5
|
+
followPattern: "Theo mẫu",
|
|
6
|
+
help: "Để trống = giống mẫu (đồng bộ). Nhập giá trị = chỉ chỗ dùng mẫu này khác đi.",
|
|
7
|
+
allowTitle: "Sửa riêng khi dùng mẫu",
|
|
8
|
+
allow: "Cho phép sửa riêng ở mỗi chỗ dùng mẫu",
|
|
9
|
+
allowHelp: "Chữ / ảnh / liên kết của khối này sẽ đặt riêng được ở từng chỗ dùng mẫu; kiểu dáng vẫn theo mẫu.",
|
|
10
|
+
key: "Mã ô",
|
|
11
|
+
attrContent: "Nội dung", attrSrc: "Ảnh", attrAlt: "Mô tả ảnh", attrCaption: "Chú thích", attrText: "Chữ", attrHref: "Liên kết", attrTitle: "Tiêu đề", attrSubtitle: "Phụ đề",
|
|
12
|
+
attrQuote: "Lời đánh giá", attrName: "Tên", attrRole: "Chức vụ", attrPoster: "Ảnh xem trước", attrAddress: "Địa chỉ", attrPlaceholder: "Chữ gợi ý", attrButtonText: "Chữ trên nút",
|
|
13
|
+
attrSummary: "Tiêu đề mục", attrCitation: "Nguồn trích dẫn", attrLabel: "Nhãn", attrTooltip: "Chú thích khi rê chuột", attrPrefix: "Tiền tố", attrSuffix: "Hậu tố", attrTarget: "Thời điểm đích",
|
|
14
|
+
};
|
|
@@ -15,23 +15,25 @@ export const placeholders = {
|
|
|
15
15
|
missing: "Còn thiếu: {fields}",
|
|
16
16
|
paragraph: "Viết nội dung, hoặc gõ / để chọn khối",
|
|
17
17
|
listItem: "Mục danh sách…",
|
|
18
|
-
taskItem: "Việc cần làm…",
|
|
19
18
|
heading: "Tiêu đề…",
|
|
20
19
|
quote: "Nhập câu trích dẫn…",
|
|
21
20
|
citation: "Thêm nguồn…",
|
|
22
21
|
speaker: "Thêm tên người nói…",
|
|
23
22
|
caption: "Thêm chú thích…",
|
|
23
|
+
popupPreview: "Xem thử hộp thoại", popupPreviewing: "Đang xem thử", popupPreviewClose: "Đóng xem thử",
|
|
24
|
+
addTestimonial: "Thêm đánh giá",
|
|
25
|
+
popupTrigger: "Chữ trên nút mở…", popupContent: "Nội dung popup",
|
|
24
26
|
detailsSummary: "Tiêu đề khi thu gọn…",
|
|
25
27
|
calloutTitle: "Tiêu đề (không bắt buộc)…",
|
|
26
28
|
code: "// Dán hoặc gõ mã…",
|
|
27
|
-
preformatted: "Văn bản giữ nguyên khoảng trắng…",
|
|
28
29
|
buttonText: "Chữ trên nút",
|
|
29
30
|
tabTitle: "Tên tab…",
|
|
30
31
|
addTab: "Thêm tab",
|
|
31
32
|
moveTabLeft: "Dời tab đang mở sang trái",
|
|
32
33
|
moveTabRight: "Dời tab đang mở sang phải",
|
|
33
34
|
addItem: "Thêm mục",
|
|
34
|
-
addSlide: "Thêm slide",
|
|
35
|
+
addSlide: "Thêm slide", removeSlide: "Xoá slide này", slideOf: "Slide",
|
|
36
|
+
duplicateSlide: "Nhân đôi slide", moveSlideLeft: "Đưa slide sang trái", moveSlideRight: "Đưa slide sang phải",
|
|
35
37
|
slide: "Slide",
|
|
36
38
|
prevSlide: "Slide trước",
|
|
37
39
|
nextSlide: "Slide sau",
|
|
@@ -67,7 +69,7 @@ export const placeholders = {
|
|
|
67
69
|
tocHint: "Tự lấy các tiêu đề H2–H{n} trong bài. Bài chưa có tiêu đề → mục lục trống trên website.",
|
|
68
70
|
socialAdd: "Thêm Facebook, Zalo, YouTube…",
|
|
69
71
|
socialNetwork: "Mạng",
|
|
70
|
-
spacer: "Khoảng
|
|
72
|
+
spacer: "Khoảng cách {size} · kéo cạnh dưới để đổi",
|
|
71
73
|
separator: "Đường kẻ",
|
|
72
74
|
galleryAdd: "Thêm ảnh vào gallery",
|
|
73
75
|
boxMedia: "Thả ảnh hoặc chọn icon",
|
|
@@ -101,6 +103,7 @@ export const placeholders = {
|
|
|
101
103
|
openSettings: "Mở cài đặt",
|
|
102
104
|
cdDays: "ngày", cdHours: "giờ", cdMinutes: "phút", cdSeconds: "giây",
|
|
103
105
|
"mapAddress": "Gõ địa chỉ để hiện bản đồ…",
|
|
106
|
+
countdownMode: "Kiểu đếm", countdownModeDate: "Ngày cố định", countdownModeEvergreen: "Mỗi người xem một lần", countdownHours: "Giờ", countdownMinutes: "Phút", countdownEvergreenHint: "Mỗi người xem bắt đầu đếm từ lần đầu vào trang (lưu trên trình duyệt của họ), nên ai cũng có đủ thời gian.",
|
|
104
107
|
countdownZone: "Múi giờ",
|
|
105
108
|
countdownZoneLocal: "Theo máy người xem",
|
|
106
109
|
};
|
package/src/locales/vi/v2.ts
CHANGED
|
@@ -104,6 +104,8 @@ export const v2 = {
|
|
|
104
104
|
undo: "Hoàn tác",
|
|
105
105
|
redo: "Làm lại",
|
|
106
106
|
listView: "Cây khối",
|
|
107
|
+
commandPalette: "Bảng lệnh",
|
|
108
|
+
resizeGap: "đổi khoảng cách cột",
|
|
107
109
|
settings: "Cài đặt",
|
|
108
110
|
noSelection: "Chọn một khối để chỉnh",
|
|
109
111
|
editOriginal: "Chỉnh sửa bản gốc",
|
|
@@ -8,7 +8,6 @@ import { useMsgs } from "../i18n";
|
|
|
8
8
|
import { Row, Section, Seg, cx } from "../ui/style-controls";
|
|
9
9
|
import { byStep } from "../ui/style-tab";
|
|
10
10
|
import { UnitInput } from "../ui/unit-controls";
|
|
11
|
-
import { DividerSection } from "../ui/divider-panel";
|
|
12
11
|
import { makeBlock } from "../core/model";
|
|
13
12
|
|
|
14
13
|
type Responsive<T> = T | Partial<Record<Device, T>>;
|
|
@@ -135,7 +134,6 @@ export function ColumnsInspector({ block, attrs, setAttrs }: BlockEditProps) {
|
|
|
135
134
|
<UnitInput label={t.rowMaxWidth} value={rowMax} units={["px", "rem", "%"]} max={1600} onChange={setRowMax} />
|
|
136
135
|
</Row>
|
|
137
136
|
</Section>
|
|
138
|
-
<DividerSection attrs={attrs} setAttrs={setAttrs} />
|
|
139
137
|
</>
|
|
140
138
|
);
|
|
141
139
|
}
|
|
@@ -157,6 +155,9 @@ export function ColumnInspector({ attrs, setAttrs }: BlockEditProps) {
|
|
|
157
155
|
const resp = <K extends "textAlign" | "maxWidth">(k: K) => atDevice<string>(style[k] as Responsive<string>, device);
|
|
158
156
|
const setResp = (k: "textAlign" | "maxWidth", v: string | undefined) => setAttrs({ style: normalizeStyle({ ...style, [k]: mapDevice(style[k] as Responsive<string>, device, v) }) ?? undefined });
|
|
159
157
|
const href = typeof attrs.href === "string" ? attrs.href : "";
|
|
158
|
+
const orderMobile = (style.order as { mobile?: number } | undefined)?.mobile;
|
|
159
|
+
const mobileOrder = typeof orderMobile === "number" ? Math.sign(orderMobile) : 0;
|
|
160
|
+
const setMobileOrder = (v: number) => setAttrs({ style: normalizeStyle({ ...style, order: { ...((style.order as object) ?? {}), mobile: v === 0 ? undefined : v } }) ?? undefined });
|
|
160
161
|
const gap = atDevice<string>(style.gap as Responsive<string>, device);
|
|
161
162
|
const setGap = (v: string | undefined) => setAttrs({ style: normalizeStyle({ ...style, gap: mapDevice(style.gap as Responsive<string>, device, v), ...(v === undefined ? {} : { layout }) }) ?? undefined });
|
|
162
163
|
return (
|
|
@@ -194,6 +195,14 @@ export function ColumnInspector({ attrs, setAttrs }: BlockEditProps) {
|
|
|
194
195
|
<UnitInput label={t.maxWidth} value={resp("maxWidth")} units={["px", "rem", "%"]} max={1600} onChange={(v) => setResp("maxWidth", v)} />
|
|
195
196
|
</Row>
|
|
196
197
|
</Section>
|
|
198
|
+
{/* Thứ tự khi các cột xếp chồng trên điện thoại: đưa cột này lên đầu / xuống cuối mà không phải đổi thứ tự trong khung soạn */}
|
|
199
|
+
<Section title={t.mobileOrder} modified={mobileOrder !== 0} defaultOpen={mobileOrder !== 0}>
|
|
200
|
+
<Row label={t.mobileOrder} onReset={mobileOrder !== 0 ? () => setMobileOrder(0) : undefined}>
|
|
201
|
+
<Seg label={t.mobileOrder} value={String(mobileOrder)} onChange={(v) => setMobileOrder(Number(v))}
|
|
202
|
+
options={[["0", ArrowDown, t.orderKeep], ["-1", ArrowUp, t.orderFirst], ["1", ArrowDown, t.orderLast]]} />
|
|
203
|
+
<p className="ecx-field-help">{t.mobileOrderHelp}</p>
|
|
204
|
+
</Row>
|
|
205
|
+
</Section>
|
|
197
206
|
{/* Liên kết phủ cả cột (cả cột thành một vùng bấm) */}
|
|
198
207
|
<Section title={t.overlayLink} modified={!!href} defaultOpen={!!href}>
|
|
199
208
|
<Row label={t.linkUrl}>
|
package/src/v2/blocks/index.ts
CHANGED
|
@@ -14,9 +14,9 @@ import { blockDescription } from "../ui/block-descriptions";
|
|
|
14
14
|
/** Tên khối theo ngôn ngữ giao diện (khối có nhãn trong bộ chữ). */
|
|
15
15
|
const TITLE_KEYS: Partial<Record<string, keyof V2Labels>> = {
|
|
16
16
|
paragraph: "paragraph", heading: "heading", bulletList: "list", orderedList: "orderedList", blockquote: "quote", codeBlock: "codeBlock",
|
|
17
|
-
|
|
18
|
-
button: "button", spacer: "spacer",
|
|
19
|
-
|
|
17
|
+
image: "image", group: "groupBlock", columns: "columns", column: "column", buttons: "buttons",
|
|
18
|
+
button: "button", spacer: "spacer", details: "details", table: "table", templatePart: "templatePart", syncedPattern: "syncedPattern",
|
|
19
|
+
cover: "cover", customHtml: "html", embed: "embed",
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -41,15 +41,18 @@ function withStyleAttrs(t: BlockType): BlockType["attributes"] {
|
|
|
41
41
|
|
|
42
42
|
export function coreBlockTypes(labels: V2Labels): BlockType[] {
|
|
43
43
|
const names = messages("blockTitles", labels.lang);
|
|
44
|
-
return [...textBlocks(), ...layoutBlocks(), ...mediaBlocks(), ...formBlocks(labels.lang), ...widgetBlocks(labels.lang), ...themeBlocks()].map((t) => {
|
|
44
|
+
return [...textBlocks(), ...layoutBlocks(labels.lang), ...mediaBlocks(), ...formBlocks(labels.lang), ...widgetBlocks(labels.lang), ...themeBlocks()].map((t) => {
|
|
45
45
|
const key = TITLE_KEYS[t.name];
|
|
46
46
|
const str = (v: unknown) => (typeof v === "string" ? v : undefined);
|
|
47
|
-
const title = key ? String(labels[key]) :
|
|
47
|
+
const title = str(names[t.name]) ?? (key ? String(labels[key]) : t.title);
|
|
48
48
|
// Biến thể đứng riêng (Hàng ngang / Xếp dọc / Lưới) theo ngôn ngữ
|
|
49
49
|
// Icon 2 lớp của bộ lõi (block-icons.tsx); biến thể dùng icon riêng nếu có, không thì icon của khối
|
|
50
50
|
const icon = BLOCK_ICONS[t.name] ?? t.icon;
|
|
51
51
|
const variations = t.variations?.map((v) => { const vt = str(names[`${t.name}/${v.name}`]); return { ...v, ...(vt ? { title: vt } : {}), icon: BLOCK_ICONS[v.name] ?? (t.name === "columns" ? columnsIcon(v.name) : undefined) ?? (BLOCK_ICONS[t.name] ? icon : v.icon) }; });
|
|
52
|
-
|
|
52
|
+
// Nhóm rộng hết trang có khung nội dung = Section (ô "Section" ở bảng chèn): bảng phải ghi đúng tên người dùng vừa chèn
|
|
53
|
+
const titleOf = t.name === "group" ? (a: Record<string, unknown>) => (a.align === "full" && a.constrained === true ? str(names["group/section"]) : undefined) : t.titleOf;
|
|
54
|
+
const aliases = [...new Set([t.title, key ? String(labels[key]) : "", ...(t.aliases ?? [])].filter((x) => x && x !== title))];
|
|
55
|
+
return { ...t, title, aliases, titleOf, icon, variations, description: t.description ?? blockDescription(t.name, labels.lang), attributes: withStyleAttrs(t) };
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
58
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { BlockLayout } from "../core/registry";
|
|
3
|
+
import { bar, box, Thumb } from "../canvas/variation-picker";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Bố cục chọn sẵn của các khối có nhiều kiểu bố trí (thẻ có hình thu nhỏ): hiện ngay sau khi chèn và ở đầu bảng phải.
|
|
7
|
+
* Mỗi bố cục chỉ đặt vài thuộc tính cấu trúc — nội dung giữ nguyên khi đổi bố cục.
|
|
8
|
+
*/
|
|
9
|
+
type M = Record<string, string>;
|
|
10
|
+
|
|
11
|
+
const lines = (x: number, y: number, w: number) => [bar(x, y, w), bar(x, y + 9, w - 10), bar(x, y + 18, w - 4)];
|
|
12
|
+
|
|
13
|
+
export function tabsLayouts(m: M): BlockLayout[] {
|
|
14
|
+
const strip = (xs: number[], w: number) => xs.map((x, i) => bar(x, 9, w, 6, i === 0));
|
|
15
|
+
return [
|
|
16
|
+
{ id: "left", label: m.layoutTabsLeft, attrs: { orientation: "horizontal", tabsAlign: "flex-start" }, thumb: <Thumb>{strip([8, 30, 52], 18)}{bar(8, 17, 80, 1)}{lines(8, 26, 80)}</Thumb> },
|
|
17
|
+
{ id: "center", label: m.layoutTabsCenter, attrs: { orientation: "horizontal", tabsAlign: "center" }, thumb: <Thumb>{strip([19, 41, 63], 14)}{bar(8, 17, 80, 1)}{lines(8, 26, 80)}</Thumb> },
|
|
18
|
+
{ id: "spread", label: m.layoutTabsSpread, attrs: { orientation: "horizontal", tabsAlign: "space-between" }, thumb: <Thumb>{strip([8, 35, 62], 26)}{bar(8, 17, 80, 1)}{lines(8, 26, 80)}</Thumb> },
|
|
19
|
+
{ id: "vertical", label: m.layoutTabsVertical, attrs: { orientation: "vertical" }, thumb: <Thumb>{[10, 22, 34].map((y, i) => bar(8, y, 22, 8, i === 0))}{bar(33, 8, 1, 40)}{lines(39, 10, 49)}</Thumb> },
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const chevron = (x: number, y: number) => <path key={`c${x},${y}`} d={`M${x} ${y} l3 3 l3 -3`} className="is-line" />;
|
|
24
|
+
const plus = (x: number, y: number) => <path key={`p${x},${y}`} d={`M${x} ${y + 3} h6 M${x + 3} ${y} v6`} className="is-line" />;
|
|
25
|
+
|
|
26
|
+
export function accordionLayouts(m: M): BlockLayout[] {
|
|
27
|
+
const rows = (mark: (x: number, y: number) => ReactElement, side: "left" | "right") => [8, 26, 44].map((y) => [box(8, y, 80, 14), bar(side === "left" ? 22 : 14, y + 5, 40), mark(side === "left" ? 13 : 76, y + 5)]);
|
|
28
|
+
return [
|
|
29
|
+
{ id: "arrow", label: m.layoutAcc1, attrs: { columns: 1, icon: "arrow", iconSide: "right" }, thumb: <Thumb>{rows(chevron, "right")}</Thumb> },
|
|
30
|
+
{ id: "plus", label: m.layoutAccPlus, attrs: { columns: 1, icon: "plus", iconSide: "right" }, thumb: <Thumb>{rows(plus, "right")}</Thumb> },
|
|
31
|
+
{ id: "two", label: m.layoutAcc2, attrs: { columns: 2, icon: "arrow", iconSide: "right" }, thumb: <Thumb>{[8, 36].flatMap((y) => [8, 50].map((x) => [box(x, y, 38, 22), bar(x + 6, y + 8, 18), chevron(x + 28, y + 8)]))}</Thumb> },
|
|
32
|
+
{ id: "left", label: m.layoutAccLeft, attrs: { columns: 1, icon: "arrow", iconSide: "left" }, thumb: <Thumb>{rows(chevron, "left")}</Thumb> },
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const dot = (x: number, y: number, round = false) => <rect key={`d${x},${y}`} x={x} y={y} width={7} height={7} rx={round ? 3.5 : 1.5} className="is-accent" />;
|
|
37
|
+
|
|
38
|
+
export function iconListLayouts(m: M): BlockLayout[] {
|
|
39
|
+
return [
|
|
40
|
+
{ id: "list", label: m.layoutListV, attrs: { layout: "list", columns: 1, iconStyle: "plain" }, thumb: <Thumb>{[10, 25, 40].flatMap((y) => [dot(10, y), bar(23, y + 1.5, 50)])}</Thumb> },
|
|
41
|
+
{ id: "inline", label: m.layoutListInline, attrs: { layout: "inline" }, thumb: <Thumb>{[6, 36, 66].flatMap((x) => [dot(x, 28), bar(x + 10, 29.5, 14)])}</Thumb> },
|
|
42
|
+
{ id: "two", label: m.layoutList2, attrs: { layout: "list", columns: 2, iconStyle: "plain" }, thumb: <Thumb>{[10, 25, 40].flatMap((y) => [8, 52].flatMap((x) => [dot(x, y), bar(x + 12, y + 1.5, 24)]))}</Thumb> },
|
|
43
|
+
{ id: "circle", label: m.layoutListCircle, attrs: { layout: "list", columns: 1, iconStyle: "circle" }, thumb: <Thumb>{[10, 25, 40].flatMap((y) => [dot(10, y, true), bar(23, y + 1.5, 50)])}</Thumb> },
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function testimonialLayouts(m: M): BlockLayout[] {
|
|
48
|
+
const quote = [bar(18, 16, 60), bar(18, 25, 52), bar(18, 34, 56)];
|
|
49
|
+
const who = [<circle key="a" cx={24} cy={48} r={4} className="is-accent" />, bar(32, 46, 24, 3)];
|
|
50
|
+
return [
|
|
51
|
+
{ id: "card", label: m.layoutTestCard, attrs: { variant: "card" }, thumb: <Thumb>{box(8, 6, 80, 52)}{quote}{who}</Thumb> },
|
|
52
|
+
{ id: "plain", label: m.layoutTestPlain, attrs: { variant: "plain" }, thumb: <Thumb>{quote}{who}</Thumb> },
|
|
53
|
+
{ id: "bubble", label: m.layoutTestBubble, attrs: { variant: "bubble" }, thumb: <Thumb>{box(8, 6, 80, 38)}<polygon key="t" points="22,44 30,44 24,52" className="is-box" />{[bar(18, 14, 60), bar(18, 23, 52), bar(18, 32, 56)]}<circle key="a" cx={36} cy={56} r={3} className="is-accent" /></Thumb> },
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function carouselLayouts(m: M): BlockLayout[] {
|
|
58
|
+
const slides = (n: number) => Array.from({ length: n }, (_, i) => { const w = (84 - (n - 1) * 6) / n; const x = 6 + i * (w + 6); return [box(x, 8, w, 38, i === 0), bar(x + 5, 20, Math.max(8, w - 10)), bar(x + 5, 29, Math.max(6, w - 16))]; });
|
|
59
|
+
const dots = [<circle key="d1" cx={42} cy={56} r={2.4} className="is-accent" />, <circle key="d2" cx={48} cy={56} r={2.4} />, <circle key="d3" cx={54} cy={56} r={2.4} />];
|
|
60
|
+
return [1, 2, 3].map((n) => ({ id: `s${n}`, label: m[`layoutSlides${n}`], attrs: { slidesPerView: n }, thumb: <Thumb>{slides(n)}{dots}</Thumb> }));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function iconBoxLayouts(m: M): BlockLayout[] {
|
|
64
|
+
const text = (x: number, y: number, w: number) => [bar(x, y, w, 5), bar(x, y + 9, w - 6), bar(x, y + 17, w - 12)];
|
|
65
|
+
return [
|
|
66
|
+
{ id: "top", label: m.layoutBoxTop, attrs: { position: "top", iconStyle: "plain" }, thumb: <Thumb>{dot(44, 8)}{text(22, 26, 52)}</Thumb> },
|
|
67
|
+
{ id: "circle", label: m.layoutBoxCircle, attrs: { position: "top", iconStyle: "circle" }, thumb: <Thumb><circle key="c" cx={48} cy={15} r={8} className="is-accent" />{text(22, 28, 52)}</Thumb> },
|
|
68
|
+
{ id: "left", label: m.layoutBoxLeft, attrs: { position: "left" }, thumb: <Thumb>{dot(8, 12)}{text(24, 12, 62)}</Thumb> },
|
|
69
|
+
{ id: "right", label: m.layoutBoxRight, attrs: { position: "right" }, thumb: <Thumb>{dot(81, 12)}{text(8, 12, 62)}</Thumb> },
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function progressLayouts(m: M): BlockLayout[] {
|
|
74
|
+
const track = (y: number, h = 6) => [<rect key={`t${y}`} x={8} y={y} width={80} height={h} rx={h / 2} />, <rect key={`f${y}`} x={8} y={y} width={56} height={h} rx={h / 2} className="is-accent" />];
|
|
75
|
+
return [
|
|
76
|
+
{ id: "above", label: m.layoutBarAbove, attrs: { textPosition: "above" }, thumb: <Thumb>{bar(8, 14, 30)}{bar(76, 14, 12)}{track(26)}</Thumb> },
|
|
77
|
+
{ id: "inside", label: m.layoutBarInside, attrs: { textPosition: "inside" }, thumb: <Thumb>{track(22, 16)}{bar(14, 28, 20, 3)}</Thumb> },
|
|
78
|
+
{ id: "below", label: m.layoutBarBelow, attrs: { textPosition: "below" }, thumb: <Thumb>{track(16)}{bar(8, 30, 30)}{bar(76, 30, 12)}</Thumb> },
|
|
79
|
+
];
|
|
80
|
+
}
|