feat(pages): on-page editor with canvas, side panel, section tools, undo and refusals
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
1 parent
d31661fd3e
commit
5f2ddf90ba
10 files changed
+660
-121
No files matched your search
@@ -0,0 +1,35 @@
|
||||
-- The labels added by add-page-visual-editor, cut from the output of `npm run i18n:sql`. Run it only in an environment that already ran add-zh-cn-messages/sql/03-zh-cn-messages.sql; otherwise run that 03 file, which includes these labels.
|
||||
SET NAMES utf8mb4;
|
||||
USE `service-system`;
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesLeaveTitle', JSON_OBJECT('en_US', 'Leave without saving?', 'zh_CN', '不保存就离开?'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesLeaveTitle') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '不保存就离开?') WHERE LOWER(code) = LOWER('PagesLeaveTitle') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesLeaveMessage', JSON_OBJECT('en_US', 'Your changes to this page are not saved. Leave and lose them?', 'zh_CN', '此页面的修改尚未保存。离开将丢失这些修改,确定离开吗?'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesLeaveMessage') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '此页面的修改尚未保存。离开将丢失这些修改,确定离开吗?') WHERE LOWER(code) = LOWER('PagesLeaveMessage') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesLeave', JSON_OBJECT('en_US', 'Leave', 'zh_CN', '离开'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesLeave') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '离开') WHERE LOWER(code) = LOWER('PagesLeave') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesSaveToUpdate', JSON_OBJECT('en_US', 'Save to update', 'zh_CN', '保存后更新'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesSaveToUpdate') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '保存后更新') WHERE LOWER(code) = LOWER('PagesSaveToUpdate') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesLinkRefused', JSON_OBJECT('en_US', 'That link is not allowed. Use https://, mailto:, tel:, a path starting with / or #name.', 'zh_CN', '不允许此链接。请使用 https://、mailto:、tel:、以 / 开头的路径或 #名称。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesLinkRefused') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '不允许此链接。请使用 https://、mailto:、tel:、以 / 开头的路径或 #名称。') WHERE LOWER(code) = LOWER('PagesLinkRefused') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesAddSection', JSON_OBJECT('en_US', 'Add section', 'zh_CN', '添加区块'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesAddSection') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '添加区块') WHERE LOWER(code) = LOWER('PagesAddSection') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesDragSection', JSON_OBJECT('en_US', 'Drag to move', 'zh_CN', '拖动以移动'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesDragSection') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '拖动以移动') WHERE LOWER(code) = LOWER('PagesDragSection') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesDuplicateSection', JSON_OBJECT('en_US', 'Duplicate section', 'zh_CN', '复制区块'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesDuplicateSection') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '复制区块') WHERE LOWER(code) = LOWER('PagesDuplicateSection') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesPageSettings', JSON_OBJECT('en_US', 'Page settings', 'zh_CN', '页面设置'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesPageSettings') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '页面设置') WHERE LOWER(code) = LOWER('PagesPageSettings') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesCanvas', JSON_OBJECT('en_US', 'Page canvas', 'zh_CN', '页面画布'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesCanvas') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '页面画布') WHERE LOWER(code) = LOWER('PagesCanvas') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesCanvasView', JSON_OBJECT('en_US', 'Canvas view', 'zh_CN', '画布视图'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesCanvasView') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '画布视图') WHERE LOWER(code) = LOWER('PagesCanvasView') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesDesktop', JSON_OBJECT('en_US', 'Desktop', 'zh_CN', '桌面'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesDesktop') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '桌面') WHERE LOWER(code) = LOWER('PagesDesktop') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesPhone', JSON_OBJECT('en_US', 'Phone', 'zh_CN', '手机'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesPhone') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '手机') WHERE LOWER(code) = LOWER('PagesPhone') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesUndo', JSON_OBJECT('en_US', 'Undo', 'zh_CN', '撤销'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesUndo') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '撤销') WHERE LOWER(code) = LOWER('PagesUndo') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesRedo', JSON_OBJECT('en_US', 'Redo', 'zh_CN', '重做'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesRedo') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '重做') WHERE LOWER(code) = LOWER('PagesRedo') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesUntitled', JSON_OBJECT('en_US', 'Untitled page', 'zh_CN', '未命名页面'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesUntitled') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '未命名页面') WHERE LOWER(code) = LOWER('PagesUntitled') AND area = 'A';
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Co-Lite change add-page-visual-editor: rollback. Deploy the previous portal image first; this only removes its labels.
|
||||
USE `service-system`;
|
||||
DELETE FROM message WHERE code IN ('PagesLeaveTitle', 'PagesLeaveMessage', 'PagesLeave', 'PagesSaveToUpdate', 'PagesLinkRefused', 'PagesAddSection', 'PagesDragSection', 'PagesDuplicateSection', 'PagesPageSettings', 'PagesCanvas', 'PagesCanvasView', 'PagesDesktop', 'PagesPhone', 'PagesUndo', 'PagesRedo', 'PagesUntitled') AND area = 'A';
|
||||
@@ -25,20 +25,20 @@ Design: `design.md`. Every task is TDD. Work is serial in the main session, with
|
||||
- [x] 2.1 `PageCanvas`: the frame, the Desktop view (1280 px scaled) and the Phone view (390 px), live updates from the draft, and links and buttons inert.
|
||||
- [x] 2.2 Edit-mode hooks in `CmsBlocks`: `EditContext`, `EditableText` for every plain text field with its server limit, image spots, `Section` outline and `data-index`. Public rendering stays unchanged: the existing `CmsBlocks*.test.tsx` stay green.
|
||||
- [x] 2.3 Rich text in place: `RichTextEditor` bare mode with a floating toolbar (test: an unsafe link is refused with a message).
|
||||
- [ ] 2.4 Custom HTML on the canvas: the saved-draft frame, the "Save to update" mark, and a reload after save.
|
||||
- [x] 2.4 Custom HTML on the canvas: the saved-draft frame, the "Save to update" mark, and a reload after save.
|
||||
|
||||
## 3. Editor
|
||||
|
||||
- [ ] 3.1 `VisualEditor` layout:
|
||||
- [x] 3.1 `VisualEditor` layout:
|
||||
- The top bar: title, status, Desktop and Phone, undo and redo, Duplicate, Preview, View page, Delete, Save.
|
||||
- The change 2 banner with Publish changes and Discard changes.
|
||||
- The side panel: `BlockFields` for the selected block, or the page settings.
|
||||
- The editor is chosen by width, 1024 px and up.
|
||||
- [ ] 3.2 Selection and section actions: select, toolbar (up, down, duplicate, delete), "Add section" between sections and at the end, native drag reorder (reorder function unit-tested), and the keyboard path.
|
||||
- [ ] 3.3 Undo and redo: history of 50, one step per field edit and per action, Ctrl+Z and Ctrl+Shift+Z, kept across saves.
|
||||
- [ ] 3.4 Refusals on the canvas: select, outline, scroll into view, message at the panel field; page-field refusals in the page settings.
|
||||
- [ ] 3.5 Templates (`?template=`) and Duplicate (`?from=`) open in the visual editor.
|
||||
- [ ] 3.6 Labels in `defaultMessages.ts` and `zh_CN.seed.json`, `npm run i18n:sql`, `sql/01-visual-editor-labels.sql`, `sql/99-rollback.sql`.
|
||||
- [x] 3.2 Selection and section actions: select, toolbar (up, down, duplicate, delete), "Add section" between sections and at the end, native drag reorder (reorder function unit-tested), and the keyboard path.
|
||||
- [x] 3.3 Undo and redo: history of 50, one step per field edit and per action, Ctrl+Z and Ctrl+Shift+Z, kept across saves.
|
||||
- [x] 3.4 Refusals on the canvas: select, outline, scroll into view, message at the panel field; page-field refusals in the page settings.
|
||||
- [x] 3.5 Templates (`?template=`) and Duplicate (`?from=`) open in the visual editor.
|
||||
- [x] 3.6 Labels in `defaultMessages.ts` and `zh_CN.seed.json`, `npm run i18n:sql`, `sql/01-visual-editor-labels.sql`, `sql/99-rollback.sql`.
|
||||
|
||||
## 4. Release
|
||||
|
||||
|
||||
Reference in new issue
Block a user