@ecomcx/ecomweb-editor 1.27.0 → 1.29.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.
Files changed (42) hide show
  1. package/package.json +3 -3
  2. package/src/locales/en/attrs.ts +10 -0
  3. package/src/locales/en/background.ts +22 -0
  4. package/src/locales/en/block-desc.ts +36 -1
  5. package/src/locales/en/block-titles.ts +6 -0
  6. package/src/locales/en/blocks.ts +18 -0
  7. package/src/locales/en/hints.ts +38 -0
  8. package/src/locales/en/index.ts +2 -1
  9. package/src/locales/en/v2.ts +5 -0
  10. package/src/locales/vi/attrs.ts +10 -0
  11. package/src/locales/vi/background.ts +22 -0
  12. package/src/locales/vi/block-desc.ts +36 -1
  13. package/src/locales/vi/block-titles.ts +6 -0
  14. package/src/locales/vi/blocks.ts +18 -0
  15. package/src/locales/vi/hints.ts +38 -0
  16. package/src/locales/vi/index.ts +2 -1
  17. package/src/locales/vi/v2.ts +5 -0
  18. package/src/shared/block-defs.ts +5 -0
  19. package/src/shared/panel-store.ts +67 -7
  20. package/src/v2/blocks/compat.tsx +1 -0
  21. package/src/v2/blocks/index.ts +4 -2
  22. package/src/v2/blocks/theme.tsx +3 -1
  23. package/src/v2/blocks/widgets.tsx +65 -0
  24. package/src/v2/canvas/block-list.tsx +3 -1
  25. package/src/v2/canvas/canvas.tsx +80 -7
  26. package/src/v2/canvas/dnd.ts +15 -2
  27. package/src/v2/context.tsx +6 -0
  28. package/src/v2/core/registry.ts +2 -1
  29. package/src/v2/editor.css +21 -0
  30. package/src/v2/editor.tsx +20 -6
  31. package/src/v2/index.ts +3 -3
  32. package/src/v2/ui/attr-hints.ts +15 -1
  33. package/src/v2/ui/background-panel.tsx +83 -0
  34. package/src/v2/ui/block-menu.ts +19 -0
  35. package/src/v2/ui/inserter.tsx +21 -6
  36. package/src/v2/ui/inspector.tsx +66 -9
  37. package/src/v2/ui/layout-panel.tsx +5 -5
  38. package/src/v2/ui/section-adder.tsx +58 -0
  39. package/src/v2/ui/style-supports.ts +29 -0
  40. package/src/v2/ui/style-tab.tsx +24 -15
  41. package/src/v2/ui/toolbar.tsx +123 -34
  42. package/src/v2/ui/unit-controls.tsx +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecomcx/ecomweb-editor",
3
- "version": "1.27.0",
3
+ "version": "1.29.0",
4
4
  "description": "Trình soạn nội dung dạng khối của CMS — dùng độc lập trong mọi dự án React (1.x: TipTap; ./v2: cây khối, khung soạn iframe, sửa header/footer tại chỗ).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "*.css"
30
30
  ],
31
31
  "peerDependencies": {
32
- "@ecomcx/ecomweb-content": "^1.21.0",
32
+ "@ecomcx/ecomweb-content": "^1.23.0",
33
33
  "react": ">=18",
34
34
  "react-dom": ">=18"
35
35
  },
@@ -45,7 +45,7 @@
45
45
  "prosemirror-view": "1.42.7"
46
46
  },
47
47
  "devDependencies": {
48
- "@ecomcx/ecomweb-content": "^1.21.0",
48
+ "@ecomcx/ecomweb-content": "^1.23.0",
49
49
  "@playwright/test": "1.53.0",
50
50
  "@types/react": "19.2.2",
51
51
  "@types/react-dom": "19.2.2",
@@ -76,4 +76,14 @@ export const attrs = {
76
76
  submitText: "Submit button text",
77
77
  successMessage: "Thank-you message",
78
78
  notifyEmail: "Notification email",
79
+ icon: "Icon",
80
+ quote: "Quote",
81
+ name: "Name",
82
+ role: "Role",
83
+ label: "Label",
84
+ value: "Value",
85
+ end: "End number",
86
+ suffix: "Suffix",
87
+ duration: "Duration (ms)",
88
+ showValue: "Show percentage",
79
89
  };
@@ -0,0 +1,22 @@
1
+ /** Background image section of the Style tab (image, size, focal point, repeat, fixed, overlay). */
2
+ export const background = {
3
+ title: "Background image",
4
+ image: "Image",
5
+ choose: "Choose image",
6
+ replace: "Replace",
7
+ remove: "Remove",
8
+ url: "Image URL",
9
+ inherited: "Using the image of the larger screen. Choose another image to override it for this screen.",
10
+ size: "Fit",
11
+ cover: "Cover",
12
+ cover_help: "Fill the block, the image may be cropped",
13
+ contain: "Contain",
14
+ contain_help: "Show the whole image, may leave empty space",
15
+ auto: "Original",
16
+ auto_help: "Keep the image's original size",
17
+ focal: "Focal point",
18
+ repeat: "Repeat image",
19
+ fixed: "Fixed while scrolling (parallax, desktop only)",
20
+ overlay: "Overlay",
21
+ opacity: "Overlay strength",
22
+ };
@@ -20,7 +20,7 @@ export const blockDesc = {
20
20
  file: "A downloadable file (PDF…), optionally embedded.",
21
21
  youtube: "Embed a YouTube video.",
22
22
  embed: "Embed content from a URL.",
23
- group: "Gather blocks in a container to style them together.",
23
+ group: "Gather blocks in a container to style them together: background colour, gradient or background image (Styles), spacing, row / stack / grid layout.",
24
24
  columns: "Display content in columns; drag to resize.",
25
25
  buttons: "Prompt visitors to take action with buttons.",
26
26
  spacer: "Add white space between blocks.",
@@ -52,4 +52,39 @@ export const blockDesc = {
52
52
  templatePart: "A shared part (header, footer…) — edit once, update everywhere.",
53
53
  form: "Basic contact / sign-up form: submissions are kept in the admin and emailed. Advanced forms: plugins.",
54
54
  formField: "One field of a form: text, email, phone, message, choice, consent…",
55
+ column: "One column inside Columns; set its width, can have its own background or background image.",
56
+ button: "A linked button (primary / secondary / outline) inside Buttons.",
57
+ accordion: "Collapsible items (FAQ) — each item is a Details block.",
58
+ tabs: "Content split into tabs; click a tab name to switch.",
59
+ tab: "One tab inside Tabs: its title and content.",
60
+ carousel: "Sliding slides (images, cards, testimonials); choose how many show at once.",
61
+ shortcode: "Insert a plugin feature by its shortcode.",
62
+ countdown: "Countdown timer to a date (sale, event).",
63
+ rating: "Star rating (e.g. 4.5 / 5).",
64
+ icon: "Small icon (check, star, phone…) with size and colour.",
65
+ footnotes: "Numbered footnotes at the end of the post.",
66
+ pageBreak: "Split the post into several pages.",
67
+ readMore: "“Read more” link to the post (in post lists).",
68
+ commentsCount: "Number of comments on the post.",
69
+ avatar: "The post author’s avatar.",
70
+ queryTotal: "Total number of posts found by the list.",
71
+ loginout: "Log in / Log out link depending on the visitor.",
72
+ termList: "List of categories / tags (list or cloud).",
73
+ pageList: "The site’s pages, by level.",
74
+ archives: "Links to posts by month.",
75
+ postTemplate: "How each post looks inside a post list.",
76
+ pagination: "Previous / next and page numbers for a post list.",
77
+ queryEmpty: "Content shown when the post list is empty.",
78
+ syncedPattern: "Shared pattern — edit once, changes on every page using it.",
79
+ listItem: "One list item.",
80
+ taskItem: "One to-do with a checkbox.",
81
+ tableRow: "One table row.",
82
+ tableHeader: "Table header cell.",
83
+ tableCell: "One table cell.",
84
+ iconBox: "Icon + title + description (feature / service card), optional link; icon on top or to the left.",
85
+ imageBox: "Image + title + description (service / product / location card), optional link.",
86
+ iconList: "List with an icon at the start of each line (benefits, checklist, contact details), vertical or inline; each item can link.",
87
+ counter: "Highlighted number (e.g. 1,200+ customers) that counts up when scrolled into view; prefix / suffix and label.",
88
+ testimonial: "Customer testimonial: quote, name, role and avatar.",
89
+ progressBar: "Labelled progress bar with a percentage (skills, goals) that fills when scrolled into view.",
55
90
  };
@@ -54,4 +54,10 @@ export const blockTitles = {
54
54
  queryEmpty: "No results",
55
55
  form: "Form",
56
56
  formField: "Form field",
57
+ iconBox: "Icon Box",
58
+ imageBox: "Image Box",
59
+ iconList: "Icon List",
60
+ counter: "Counter",
61
+ testimonial: "Testimonial",
62
+ progressBar: "Progress Bar",
57
63
  };
@@ -58,4 +58,22 @@ export const blocks = {
58
58
  fieldName: "Full name",
59
59
  option1: "Option 1",
60
60
  option2: "Option 2",
61
+ widgetEmpty: "Add items in the settings panel",
62
+ iconListItems: "Items (one per line, add a link: text | /path)",
63
+ widget_title: "Title",
64
+ widget_text: "Short description",
65
+ widget_quote: "What a customer says about you",
66
+ widget_name: "Customer name",
67
+ widget_role: "Role / company",
68
+ widget_label: "Label",
69
+ sampleTitle: "Feature title",
70
+ sampleText: "A short line on the benefit for the customer.",
71
+ sampleItem1: "First benefit",
72
+ sampleItem2: "Second benefit",
73
+ sampleItem3: "Third benefit",
74
+ sampleCounter: "Happy customers",
75
+ sampleQuote: "Caring service and on-time delivery. I will be back!",
76
+ sampleName: "Customer name",
77
+ sampleRole: "Role, company",
78
+ sampleSkill: "Skill",
61
79
  };
@@ -201,4 +201,42 @@ export const hints = {
201
201
  "formField.kind.opt.consent": "Consent",
202
202
  "formField.kind.opt.number": "Number",
203
203
  "formField.kind.opt.date": "Date",
204
+ "iconBox.icon.opt.check": "Check",
205
+ "iconBox.icon.opt.x": "X",
206
+ "iconBox.icon.opt.star": "Star",
207
+ "iconBox.icon.opt.heart": "Heart",
208
+ "iconBox.icon.opt.arrowRight": "Arrow right",
209
+ "iconBox.icon.opt.phone": "Phone",
210
+ "iconBox.icon.opt.mail": "Mail",
211
+ "iconBox.icon.opt.mapPin": "Map pin",
212
+ "iconBox.icon.opt.clock": "Clock",
213
+ "iconBox.icon.opt.info": "Info",
214
+ "iconBox.icon.opt.alert": "Alert",
215
+ "iconBox.icon.opt.externalLink": "External link",
216
+ "iconList.icon.opt.check": "Check",
217
+ "iconList.icon.opt.x": "X",
218
+ "iconList.icon.opt.star": "Star",
219
+ "iconList.icon.opt.heart": "Heart",
220
+ "iconList.icon.opt.arrowRight": "Arrow right",
221
+ "iconList.icon.opt.phone": "Phone",
222
+ "iconList.icon.opt.mail": "Mail",
223
+ "iconList.icon.opt.mapPin": "Map pin",
224
+ "iconList.icon.opt.clock": "Clock",
225
+ "iconList.icon.opt.info": "Info",
226
+ "iconList.icon.opt.alert": "Alert",
227
+ "iconList.icon.opt.externalLink": "External link",
228
+ "iconBox.position.label": "Icon position",
229
+ "iconBox.position.opt.top": "Top",
230
+ "iconBox.position.opt.left": "Left",
231
+ "imageBox.src.label": "Image",
232
+ "testimonial.src.label": "Avatar",
233
+ "counter.start.label": "Count from",
234
+ "counter.prefix.label": "Prefix (e.g. ~, $)",
235
+ "counter.separator.label": "Thousands separator",
236
+ "counter.separator.opt.none": "None",
237
+ "counter.separator.opt.space": "Space",
238
+ "counter.duration.help": "0 = show the final number at once. Visitors who prefer reduced motion always see the final number.",
239
+ "iconList.layout.opt.list": "Vertical",
240
+ "iconList.layout.opt.inline": "Inline",
241
+ "progressBar.value.label": "Percent",
204
242
  };
@@ -12,9 +12,10 @@ import { layout } from "./layout";
12
12
  import { legacyBasic } from "./legacy-basic";
13
13
  import { legacyDynamic } from "./legacy-dynamic";
14
14
  import { motion } from "./motion";
15
+ import { background } from "./background";
15
16
  import { patternLib } from "./pattern-lib";
16
17
  import { patterns } from "./patterns";
17
18
  import { shortcuts } from "./shortcuts";
18
19
 
19
20
  /** Tiếng Anh: đủ khoá như vi/ (thiếu khoá là lỗi biên dịch) và là ngôn ngữ dự phòng của mọi ngôn ngữ khác. */
20
- export const en: typeof vi = { v2, legacy, attrs, bindings, blockDesc, blockTitles, blocks, controls, hints, layout, legacyBasic, legacyDynamic, motion, patternLib, patterns, shortcuts };
21
+ export const en: typeof vi = { v2, legacy, attrs, background, bindings, blockDesc, blockTitles, blocks, controls, hints, layout, legacyBasic, legacyDynamic, motion, patternLib, patterns, shortcuts };
@@ -5,6 +5,7 @@ export const v2 = {
5
5
  typeSlash: "Type / to choose a block",
6
6
  emptyDoc: "Start writing or type / to insert a block",
7
7
  addBlock: "Add block",
8
+ addSection: "Add section",
8
9
  search: "Search blocks",
9
10
  noResults: "No blocks found",
10
11
  blocks: "Blocks",
@@ -20,6 +21,10 @@ export const v2 = {
20
21
  group: "Group",
21
22
  ungroup: "Ungroup",
22
23
  copy: "Copy",
24
+ copyStyle: "Copy style",
25
+ pasteStyle: "Paste style",
26
+ styleCopied: "Style copied",
27
+ blockMenu: "Block actions",
23
28
  more: "More",
24
29
  transform: "Transform",
25
30
  bold: "Bold",
@@ -76,4 +76,14 @@ export const attrs = {
76
76
  submitText: "Chữ trên nút gửi",
77
77
  successMessage: "Lời cảm ơn sau khi gửi",
78
78
  notifyEmail: "Email nhận thông báo",
79
+ icon: "Icon",
80
+ quote: "Lời chứng thực",
81
+ name: "Tên",
82
+ role: "Chức danh",
83
+ label: "Nhãn",
84
+ value: "Giá trị",
85
+ end: "Số cuối",
86
+ suffix: "Hậu tố",
87
+ duration: "Thời gian chạy (ms)",
88
+ showValue: "Hiện phần trăm",
79
89
  };
@@ -0,0 +1,22 @@
1
+ /** Mục Ảnh nền trong tab Kiểu dáng (ảnh, cách phủ, điểm lấy nét, lặp, cố định, lớp phủ). */
2
+ export const background = {
3
+ title: "Ảnh nền",
4
+ image: "Ảnh",
5
+ choose: "Chọn ảnh",
6
+ replace: "Đổi ảnh",
7
+ remove: "Bỏ ảnh",
8
+ url: "Đường dẫn ảnh",
9
+ inherited: "Đang dùng ảnh của khổ lớn hơn. Chọn ảnh khác để thay riêng cho khổ này.",
10
+ size: "Cách phủ",
11
+ cover: "Phủ kín",
12
+ cover_help: "Ảnh phủ kín khối, có thể bị cắt bớt",
13
+ contain: "Vừa khung",
14
+ contain_help: "Hiện trọn ảnh, có thể còn khoảng trống",
15
+ auto: "Gốc",
16
+ auto_help: "Giữ kích thước gốc của ảnh",
17
+ focal: "Điểm lấy nét",
18
+ repeat: "Lặp lại ảnh",
19
+ fixed: "Cố định khi cuộn (parallax, chỉ trên máy tính)",
20
+ overlay: "Lớp phủ",
21
+ opacity: "Độ đậm lớp phủ",
22
+ };
@@ -20,7 +20,7 @@ export const blockDesc = {
20
20
  file: "Liên kết tải tệp (PDF…), có thể xem ngay trên trang.",
21
21
  youtube: "Nhúng video YouTube.",
22
22
  embed: "Nhúng nội dung từ địa chỉ (Facebook, TikTok, bản đồ…).",
23
- group: "Gom nhiều khối vào một khung để tô nền, căn lề, bố cục chung.",
23
+ group: "Gom nhiều khối vào một khung để tô nền (màu, chuyển màu, ảnh nền trong Kiểu dáng), căn lề, bố cục hàng / cột / lưới.",
24
24
  columns: "Chia nội dung thành nhiều cột, kéo để đổi độ rộng.",
25
25
  buttons: "Một hoặc nhiều nút kêu gọi hành động.",
26
26
  spacer: "Khoảng trống giữa các khối.",
@@ -52,4 +52,39 @@ export const blockDesc = {
52
52
  templatePart: "Phần dùng chung (header, footer…) — sửa một nơi, đổi mọi trang.",
53
53
  form: "Form liên hệ / đăng ký cơ bản: bài gửi lưu trong admin và báo qua email. Form nâng cao: plugin.",
54
54
  formField: "Một ô của form: chữ, email, điện thoại, nội dung, chọn, đồng ý…",
55
+ column: "Một cột trong khối Cột; chỉnh độ rộng, có thể tô nền / ảnh nền riêng.",
56
+ button: "Một nút bấm có liên kết (chính / phụ / viền) — nằm trong khối Nút.",
57
+ accordion: "Nhiều mục gập / mở (câu hỏi thường gặp) — mỗi mục là khối Nội dung ẩn.",
58
+ tabs: "Nội dung chia thẻ, bấm tên thẻ để chuyển.",
59
+ tab: "Một thẻ trong khối Thẻ: tên thẻ và nội dung bên trong.",
60
+ carousel: "Trình chiếu nhiều trang trượt (ảnh, thẻ, lời chứng thực), chọn số trang hiện cùng lúc.",
61
+ shortcode: "Chèn tính năng của plugin bằng mã ngắn.",
62
+ countdown: "Đồng hồ đếm ngược tới một thời điểm (khuyến mãi, sự kiện).",
63
+ rating: "Số sao đánh giá (ví dụ 4,5 / 5).",
64
+ icon: "Biểu tượng nhỏ (dấu tích, sao, điện thoại…) đổi cỡ và màu.",
65
+ footnotes: "Danh sách chú thích cuối bài, tự đánh số.",
66
+ pageBreak: "Ngắt bài thành nhiều trang.",
67
+ readMore: "Liên kết “Đọc tiếp” tới bài (dùng trong danh sách bài).",
68
+ commentsCount: "Số bình luận của bài.",
69
+ avatar: "Ảnh đại diện của tác giả bài.",
70
+ queryTotal: "Tổng số bài tìm thấy của danh sách.",
71
+ loginout: "Liên kết Đăng nhập / Đăng xuất theo trạng thái người xem.",
72
+ termList: "Danh sách chuyên mục / thẻ (dạng danh sách hoặc đám mây).",
73
+ pageList: "Danh sách các trang của website, theo cấp.",
74
+ archives: "Liên kết lưu trữ bài theo tháng.",
75
+ postTemplate: "Khuôn hiển thị mỗi bài trong khối Danh sách bài.",
76
+ pagination: "Nút trang trước / sau và số trang của danh sách bài.",
77
+ queryEmpty: "Nội dung hiện khi danh sách bài không có bài nào.",
78
+ syncedPattern: "Mẫu dùng chung — sửa một nơi, đổi ở mọi trang dùng nó.",
79
+ listItem: "Một mục của danh sách.",
80
+ taskItem: "Một việc có ô đánh dấu trong danh sách việc.",
81
+ tableRow: "Một hàng của bảng.",
82
+ tableHeader: "Ô tiêu đề của bảng.",
83
+ tableCell: "Một ô của bảng.",
84
+ iconBox: "Icon + tiêu đề + mô tả (thẻ tính năng / dịch vụ), có thể gắn liên kết; icon nằm trên hoặc bên trái.",
85
+ imageBox: "Ảnh + tiêu đề + mô tả (thẻ dịch vụ / sản phẩm / chi nhánh), có thể gắn liên kết.",
86
+ iconList: "Danh sách có icon ở đầu mỗi dòng (lợi ích, checklist, thông tin liên hệ), dọc hoặc hàng ngang; mỗi mục có thể có liên kết.",
87
+ counter: "Con số nổi bật (vd 1.200+ khách hàng) đếm lên khi cuộn tới; có tiền tố / hậu tố và nhãn.",
88
+ testimonial: "Lời chứng thực của khách hàng: câu trích, tên, chức danh và ảnh đại diện.",
89
+ progressBar: "Thanh tiến độ có nhãn và phần trăm (kỹ năng, mục tiêu), chạy lên khi cuộn tới.",
55
90
  };
@@ -54,4 +54,10 @@ export const blockTitles = {
54
54
  queryEmpty: "Khi không có bài",
55
55
  form: "Form",
56
56
  formField: "Ô nhập",
57
+ iconBox: "Hộp icon",
58
+ imageBox: "Hộp ảnh",
59
+ iconList: "Danh sách icon",
60
+ counter: "Bộ đếm số",
61
+ testimonial: "Lời chứng thực",
62
+ progressBar: "Thanh tiến độ",
57
63
  };
@@ -58,4 +58,22 @@ export const blocks = {
58
58
  fieldName: "Họ và tên",
59
59
  option1: "Lựa chọn 1",
60
60
  option2: "Lựa chọn 2",
61
+ widgetEmpty: "Thêm mục ở bảng cài đặt bên phải",
62
+ iconListItems: "Các mục (mỗi dòng một mục, thêm liên kết: chữ | /duong-dan)",
63
+ widget_title: "Tiêu đề",
64
+ widget_text: "Mô tả ngắn",
65
+ widget_quote: "Lời khách hàng nói về bạn",
66
+ widget_name: "Tên khách hàng",
67
+ widget_role: "Chức danh / công ty",
68
+ widget_label: "Nhãn",
69
+ sampleTitle: "Tiêu đề tính năng",
70
+ sampleText: "Mô tả ngắn về lợi ích cho khách hàng.",
71
+ sampleItem1: "Lợi ích thứ nhất",
72
+ sampleItem2: "Lợi ích thứ hai",
73
+ sampleItem3: "Lợi ích thứ ba",
74
+ sampleCounter: "Khách hàng hài lòng",
75
+ sampleQuote: "Dịch vụ tận tâm, giao hàng đúng hẹn. Tôi sẽ quay lại!",
76
+ sampleName: "Tên khách hàng",
77
+ sampleRole: "Chức danh, công ty",
78
+ sampleSkill: "Kỹ năng",
61
79
  };
@@ -201,4 +201,42 @@ export const hints = {
201
201
  "formField.kind.opt.consent": "Đồng ý (điều khoản)",
202
202
  "formField.kind.opt.number": "Số",
203
203
  "formField.kind.opt.date": "Ngày",
204
+ "iconBox.icon.opt.check": "Dấu tích",
205
+ "iconBox.icon.opt.x": "Dấu X",
206
+ "iconBox.icon.opt.star": "Ngôi sao",
207
+ "iconBox.icon.opt.heart": "Trái tim",
208
+ "iconBox.icon.opt.arrowRight": "Mũi tên phải",
209
+ "iconBox.icon.opt.phone": "Điện thoại",
210
+ "iconBox.icon.opt.mail": "Thư",
211
+ "iconBox.icon.opt.mapPin": "Ghim bản đồ",
212
+ "iconBox.icon.opt.clock": "Đồng hồ",
213
+ "iconBox.icon.opt.info": "Thông tin",
214
+ "iconBox.icon.opt.alert": "Cảnh báo",
215
+ "iconBox.icon.opt.externalLink": "Liên kết ngoài",
216
+ "iconList.icon.opt.check": "Dấu tích",
217
+ "iconList.icon.opt.x": "Dấu X",
218
+ "iconList.icon.opt.star": "Ngôi sao",
219
+ "iconList.icon.opt.heart": "Trái tim",
220
+ "iconList.icon.opt.arrowRight": "Mũi tên phải",
221
+ "iconList.icon.opt.phone": "Điện thoại",
222
+ "iconList.icon.opt.mail": "Thư",
223
+ "iconList.icon.opt.mapPin": "Ghim bản đồ",
224
+ "iconList.icon.opt.clock": "Đồng hồ",
225
+ "iconList.icon.opt.info": "Thông tin",
226
+ "iconList.icon.opt.alert": "Cảnh báo",
227
+ "iconList.icon.opt.externalLink": "Liên kết ngoài",
228
+ "iconBox.position.label": "Vị trí icon",
229
+ "iconBox.position.opt.top": "Trên",
230
+ "iconBox.position.opt.left": "Bên trái",
231
+ "imageBox.src.label": "Ảnh",
232
+ "testimonial.src.label": "Ảnh đại diện",
233
+ "counter.start.label": "Đếm từ",
234
+ "counter.prefix.label": "Tiền tố (vd ~, $)",
235
+ "counter.separator.label": "Dấu nhóm nghìn",
236
+ "counter.separator.opt.none": "Không",
237
+ "counter.separator.opt.space": "Khoảng trắng",
238
+ "counter.duration.help": "0 = hiện ngay số cuối. Người dùng chọn giảm chuyển động luôn thấy số cuối.",
239
+ "iconList.layout.opt.list": "Dọc",
240
+ "iconList.layout.opt.inline": "Hàng ngang",
241
+ "progressBar.value.label": "Phần trăm",
204
242
  };
@@ -17,8 +17,9 @@ import { layout } from "./layout";
17
17
  import { legacyBasic } from "./legacy-basic";
18
18
  import { legacyDynamic } from "./legacy-dynamic";
19
19
  import { motion } from "./motion";
20
+ import { background } from "./background";
20
21
  import { patternLib } from "./pattern-lib";
21
22
  import { patterns } from "./patterns";
22
23
  import { shortcuts } from "./shortcuts";
23
24
 
24
- export const vi = { v2, legacy, attrs, bindings, blockDesc, blockTitles, blocks, controls, hints, layout, legacyBasic, legacyDynamic, motion, patternLib, patterns, shortcuts };
25
+ export const vi = { v2, legacy, attrs, background, bindings, blockDesc, blockTitles, blocks, controls, hints, layout, legacyBasic, legacyDynamic, motion, patternLib, patterns, shortcuts };
@@ -5,6 +5,7 @@ export const v2 = {
5
5
  typeSlash: "Gõ / để chọn khối",
6
6
  emptyDoc: "Bắt đầu viết hoặc gõ / để chèn khối",
7
7
  addBlock: "Thêm khối",
8
+ addSection: "Thêm section",
8
9
  search: "Tìm khối",
9
10
  noResults: "Không tìm thấy khối",
10
11
  blocks: "Khối",
@@ -20,6 +21,10 @@ export const v2 = {
20
21
  group: "Gom vào nhóm",
21
22
  ungroup: "Bỏ nhóm",
22
23
  copy: "Sao chép",
24
+ copyStyle: "Chép kiểu dáng",
25
+ pasteStyle: "Dán kiểu dáng",
26
+ styleCopied: "Đã chép kiểu dáng",
27
+ blockMenu: "Thao tác với khối",
23
28
  more: "Thêm",
24
29
  transform: "Đổi loại khối",
25
30
  bold: "Đậm",
@@ -22,6 +22,11 @@ export interface RegisterBlockOptions {
22
22
  translate?(text: string): string;
23
23
  /** Khối của theme: chỉ chèn được khi soạn template / phần dùng chung (host.scope = "template"), không chèn vào bài viết. */
24
24
  templateOnly?: boolean;
25
+ /**
26
+ * Nhóm của tab Kiểu dáng khối hiện: "typography" "color" "background" "spacing" "border" "effects" "hover" "motion" "visibility".
27
+ * Không khai → khối chứa có đủ, khối khác có mọi nhóm trừ ảnh nền. [] = không có tab Kiểu dáng.
28
+ */
29
+ styleGroups?: string[];
25
30
  /** Khối chứa khối khác: nội dung có sẵn khi chèn (mặc định một đoạn văn trống). */
26
31
  initialContent?(): Array<Record<string, unknown>>;
27
32
  }
@@ -1,5 +1,6 @@
1
1
  /** Kho panel plugin (registerBlockPanel) — đăng ký ở đây, trình soạn đọc. */
2
2
  import type { ComponentType } from "react";
3
+ import { defineBlockControls, type BlockControls, type ControlSpec } from "@ecomcx/ecomweb-content";
3
4
 
4
5
  /** Props của panel plugin trong tab "Khối". */
5
6
  export interface BlockPanelProps {
@@ -16,27 +17,86 @@ export interface BlockPanel {
16
17
  id: string;
17
18
  /** Tiêu đề mục trong tab "Khối" (nhận "%khoá%" — admin dịch theo plugin). */
18
19
  title: string;
19
- /** Loại khối áp dụng; bỏ trống = mọi khối. */
20
- blocks?: string[];
20
+ /** Loại khối áp dụng; bỏ trống hoặc "*" = mọi khối. */
21
+ blocks?: string[] | "*";
22
+ /** Tab đặt panel: "block" (mặc định) hoặc "style" (tab Kiểu dáng). */
23
+ tab?: "block" | "style";
21
24
  /** Thứ tự (nhỏ đứng trước, mặc định 10). */
22
25
  order?: number;
23
26
  /**
24
27
  * Thuộc tính thêm vào khối (kể cả khối lõi), vd { lazy: { default: true } } — cần khai báo để trình soạn lưu được.
25
28
  * Bắt buộc có `blocks` khi khai báo thuộc tính. Website đọc được qua filter "post.blocks" hoặc renderer của plugin.
29
+ * Có `type` → ô tự vẽ: number/color/length/enum (sinh CSS), boolean/string/url/textarea/datetime (chỉ ô, editor 1.29).
30
+ * `label` và nhãn `options: [{ value, label }]` nhận "%khoá%" (admin dịch theo slug plugin, CMS ≥ 1.30).
26
31
  */
27
- attributes?: Record<string, { default?: unknown }>;
28
- component: ComponentType<BlockPanelProps>;
32
+ attributes?: Record<string, { default?: unknown; label?: string } | (ControlSpec & { label?: string })>;
33
+ /** Giao diện riêng; bỏ trống = trình soạn tự vẽ ô cho các thuộc tính có `type`. */
34
+ component?: ComponentType<BlockPanelProps>;
29
35
  }
30
36
 
31
37
 
32
38
  const panels = new Map<string, BlockPanel>();
33
39
  const listeners = new Set<() => void>();
34
40
  let snapshot: BlockPanel[] = [];
35
- const changed = () => { snapshot = [...panels.values()].sort((a, b) => (a.order ?? 10) - (b.order ?? 10)); listeners.forEach((l) => l()); };
36
- export function registerBlockPanel(panel: BlockPanel) { panels.set(panel.id, panel); changed(); }
41
+ const changed = () => {
42
+ snapshot = [...panels.values()].sort((a, b) => (a.order ?? 10) - (b.order ?? 10));
43
+ controls = snapshot.flatMap((p) => { const t = typed(p); return Object.keys(t).length ? [{ id: p.id, blocks: p.blocks ?? "*", attributes: t }] : []; });
44
+ listeners.forEach((l) => l());
45
+ };
46
+ /** Thuộc tính có `type` + `css` → ô điều khiển khai CSS (kiểm khai báo ngay lúc đăng ký: sai → ném lỗi). */
47
+ const typed = (p: BlockPanel) => Object.fromEntries(Object.entries(p.attributes ?? {}).filter(([, s]) => "type" in s && s.type)) as Record<string, ControlSpec>;
48
+ let controls: BlockControls[] = [];
49
+ export function registerBlockPanel(panel: BlockPanel) {
50
+ const t = typed(panel);
51
+ if (Object.keys(t).length) defineBlockControls({ id: panel.id, blocks: panel.blocks ?? "*", attributes: t });
52
+ panels.set(panel.id, panel); changed();
53
+ }
37
54
  export function unregisterBlockPanel(id: string) { const had = panels.delete(id); if (had) changed(); return had; }
38
55
 
39
56
  /** Panel áp dụng cho một loại khối. */
40
- export const blockPanelsFor = (type: string) => snapshot.filter((p) => !p.blocks || p.blocks.includes(type));
57
+ export const blockPanelsFor = (type: string, tab: "block" | "style" = "block") => snapshot.filter((p) => (p.blocks === undefined || p.blocks === "*" || p.blocks.includes(type)) && (p.tab ?? "block") === tab);
58
+ /** Ô điều khiển khai CSS của mọi panel (đầu vào của controlsCss — cùng hàm website dùng). */
59
+ export const blockControls = () => controls;
41
60
  export const blockPanels = () => snapshot;
42
61
  export function onBlockPanelsChange(l: () => void) { listeners.add(l); return () => { listeners.delete(l); }; }
62
+
63
+ // ---------------------------------------------------------------------------
64
+ // Hành động trên khối (registerBlockAction) — menu ⋮ của thanh công cụ khối
65
+ // ---------------------------------------------------------------------------
66
+ export interface BlockActionContext {
67
+ /** Các khối đang chọn (id, loại, thuộc tính). */
68
+ blocks: Array<{ id: string; type: string; attrs: Record<string, any> }>;
69
+ /** Đổi thuộc tính các khối đang chọn. */
70
+ setAttrs(attrs: Record<string, unknown>): void;
71
+ }
72
+ export interface BlockAction {
73
+ /** Mã duy nhất "slug-plugin/tên". */
74
+ id: string;
75
+ /** Nhãn trong menu (nhận "%khoá%"). */
76
+ label: string;
77
+ icon?: ComponentType<{ className?: string }>;
78
+ /** Loại khối áp dụng; bỏ trống / "*" = mọi khối. */
79
+ blocks?: string[] | "*";
80
+ run(ctx: BlockActionContext): void | Promise<void>;
81
+ }
82
+ const actions = new Map<string, BlockAction>();
83
+ let actionList: BlockAction[] = [];
84
+ export function registerBlockAction(a: BlockAction) { actions.set(a.id, a); actionList = [...actions.values()]; listeners.forEach((l) => l()); }
85
+ export function unregisterBlockAction(id: string) { const had = actions.delete(id); if (had) { actionList = [...actions.values()]; listeners.forEach((l) => l()); } return had; }
86
+ export const blockActionsFor = (types: string[]) => actionList.filter((a) => !a.blocks || a.blocks === "*" || types.every((t) => (a.blocks as string[]).includes(t)));
87
+
88
+ // ---------------------------------------------------------------------------
89
+ // Khối sẵn sàng (onBlockReady) + asset theo nhu cầu — khung soạn (iframe) đọc
90
+ // ---------------------------------------------------------------------------
91
+ export type BlockReadyFn = (el: HTMLElement, attrs: Record<string, unknown>) => void | (() => void);
92
+ export interface BlockAsset { kind: "script" | "style"; src: string; when: { blocks?: string[]; className?: string } }
93
+ let ready: Array<{ type: string; fn: BlockReadyFn }> = [];
94
+ let assets: BlockAsset[] = [];
95
+ export function onBlockReady(type: string, fn: BlockReadyFn) {
96
+ const e = { type, fn };
97
+ ready = [...ready, e]; listeners.forEach((l) => l());
98
+ return () => { ready = ready.filter((x) => x !== e); listeners.forEach((l) => l()); };
99
+ }
100
+ export function registerBlockAssets(list: BlockAsset[]) { assets = [...assets, ...list]; listeners.forEach((l) => l()); }
101
+ export const blockReadyFns = () => ready;
102
+ export const blockAssets = () => assets;
@@ -37,6 +37,7 @@ export function syncPluginBlocks(registry: BlockTypeRegistry): () => void {
37
37
  description: def.description ? t(def.description) : undefined,
38
38
  icon: o.icon ?? Blocks,
39
39
  templateOnly: o.templateOnly,
40
+ ...(o.styleGroups ? { supports: { style: o.styleGroups.length ? o.styleGroups : false } } : {}),
40
41
  edit: o.edit ? wrapV1Edit(o.edit) : undefined,
41
42
  // Không có xem trước riêng và không chứa khối con → website vẽ bằng renderer của theme/plugin (viết khối một lần)
42
43
  serverRender: !o.edit && def.content !== "blocks",
@@ -6,6 +6,8 @@ import { mediaBlocks } from "./media";
6
6
  import { textBlocks } from "./text";
7
7
  import { themeBlocks } from "./theme";
8
8
  import { formBlocks } from "./form";
9
+ import { widgetBlocks } from "./widgets";
10
+ import { blockDescription } from "../ui/block-descriptions";
9
11
 
10
12
  /** Tên khối theo ngôn ngữ giao diện (khối có nhãn trong bộ chữ). */
11
13
  const TITLE_KEYS: Partial<Record<string, keyof V2Labels>> = {
@@ -17,13 +19,13 @@ const TITLE_KEYS: Partial<Record<string, keyof V2Labels>> = {
17
19
 
18
20
  export function coreBlockTypes(labels: V2Labels): BlockType[] {
19
21
  const names = messages("blockTitles", labels.lang);
20
- return [...textBlocks(), ...layoutBlocks(), ...mediaBlocks(), ...formBlocks(labels.lang), ...themeBlocks()].map((t) => {
22
+ return [...textBlocks(), ...layoutBlocks(), ...mediaBlocks(), ...formBlocks(labels.lang), ...widgetBlocks(labels.lang), ...themeBlocks()].map((t) => {
21
23
  const key = TITLE_KEYS[t.name];
22
24
  const str = (v: unknown) => (typeof v === "string" ? v : undefined);
23
25
  const title = key ? String(labels[key]) : str(names[t.name]) ?? t.title;
24
26
  // Biến thể đứng riêng (Hàng ngang / Xếp dọc / Lưới) theo ngôn ngữ
25
27
  const variations = t.variations?.map((v) => { const vt = str(names[`${t.name}/${v.name}`]); return vt ? { ...v, title: vt } : v; });
26
- return { ...t, title, variations };
28
+ return { ...t, title, variations, description: t.description ?? blockDescription(t.name, labels.lang) };
27
29
  });
28
30
  }
29
31
 
@@ -1,5 +1,6 @@
1
1
  import { Star, AlignLeft, ArrowLeftRight, CalendarDays, ChevronsRight, Heading1, Copyright, FileText, Globe2, Image as ImageIcon, LayoutTemplate, ListOrdered, Menu, MessageSquare, PanelTop, Repeat2, Rows3, Search, SquareDashed, Tag, Type, User } from "lucide-react";
2
2
  import { useCallback, useEffect, useMemo, useState, type CSSProperties, type ReactNode } from "react";
3
+ import { ICON_PATHS } from "@ecomcx/ecomweb-content";
3
4
  import { Block, DocBlocks, InnerBlocks, NestedDoc } from "../canvas/block-list";
4
5
  import { DocScopeProvider, LoopPostContext, useDocScope, useDynamicData, useEditor, useEditorState } from "../context";
5
6
  import type { DynamicPost, QueryArgs } from "../core/host";
@@ -153,7 +154,8 @@ function LoginOutEdit({ block, blockProps }: BlockEditProps) {
153
154
  }
154
155
  function IconEdit({ block, blockProps }: BlockEditProps) {
155
156
  const size = Math.min(128, Math.max(12, Number(block.attrs.size) || 24));
156
- return <div {...merge(blockProps, "ecx-icon-block", align(block.attrs))}><span style={{ display: "inline-flex", alignItems: "center", gap: 6 }}><Star width={size} height={size} />{String(block.attrs.name ?? "star")}</span></div>;
157
+ const path = ICON_PATHS[String(block.attrs.name ?? "star")] ?? ICON_PATHS.star;
158
+ return <div {...merge(blockProps, "ecx-icon-block", align(block.attrs))}><svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" aria-hidden><path d={path} /></svg></div>;
157
159
  }
158
160
  function FootnotesEdit({ block, blockProps }: BlockEditProps) {
159
161
  return <aside {...merge(blockProps, "ecx-footnotes")}>{block.attrs.title ? <p className="ecx-footnotes-title">{String(block.attrs.title)}</p> : null}<ol><li>Chú thích 1</li><li>Chú thích 2</li></ol></aside>;