@tmagic/editor 1.8.5 → 1.8.7
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/dist/es/{Editor.vue_vue_type_script_setup_true_lang.js → Editor.vue.js} +9 -9
- package/dist/es/{Editor.js → Editor2.vue.js} +1 -1
- package/dist/es/components/{CodeBlockEditor.vue_vue_type_script_setup_true_lang.js → CodeBlockEditor.vue.js} +5 -5
- package/dist/es/components/{CodeBlockEditor.js → CodeBlockEditor2.vue.js} +1 -1
- package/dist/es/components/{CodeParams.js → CodeParams2.vue.js} +1 -1
- package/dist/es/components/{CompareForm.js → CompareForm2.vue.js} +1 -1
- package/dist/es/components/{ContentMenu.vue_vue_type_script_setup_true_lang.js → ContentMenu.vue.js} +2 -2
- package/dist/es/components/{ContentMenu.js → ContentMenu2.vue.js} +1 -1
- package/dist/es/components/{FloatingBox.vue_vue_type_script_setup_true_lang.js → FloatingBox.vue.js} +2 -2
- package/dist/es/components/{FloatingBox.js → FloatingBox2.vue.js} +1 -1
- package/dist/es/components/{Icon.js → Icon2.vue.js} +1 -1
- package/dist/es/components/{Resizer.js → Resizer2.vue.js} +1 -1
- package/dist/es/components/{ScrollBar.js → ScrollBar2.vue.js} +1 -1
- package/dist/es/components/{ScrollViewer.vue_vue_type_script_setup_true_lang.js → ScrollViewer.vue.js} +3 -3
- package/dist/es/components/{ScrollViewer.js → ScrollViewer2.vue.js} +1 -1
- package/dist/es/components/{SearchInput.js → SearchInput2.vue.js} +1 -1
- package/dist/es/components/{SplitView.vue_vue_type_script_setup_true_lang.js → SplitView.vue.js} +1 -1
- package/dist/es/components/{SplitView.js → SplitView2.vue.js} +1 -1
- package/dist/es/components/{ToolButton.vue_vue_type_script_setup_true_lang.js → ToolButton.vue.js} +3 -3
- package/dist/es/components/{ToolButton.js → ToolButton2.vue.js} +1 -1
- package/dist/es/components/{Tree.vue_vue_type_script_setup_true_lang.js → Tree.vue.js} +1 -1
- package/dist/es/components/{Tree.js → Tree2.vue.js} +1 -1
- package/dist/es/components/{TreeNode.vue_vue_type_script_setup_true_lang.js → TreeNode.vue.js} +2 -2
- package/dist/es/components/{TreeNode.js → TreeNode2.vue.js} +1 -1
- package/dist/es/components/{ViewForm.js → ViewForm2.vue.js} +1 -1
- package/dist/es/fields/{Code.vue_vue_type_script_setup_true_lang.js → Code.vue.js} +1 -1
- package/dist/es/fields/{Code.js → Code2.vue.js} +1 -1
- package/dist/es/fields/{CodeLink.js → CodeLink2.vue.js} +1 -1
- package/dist/es/fields/{CodeSelect.js → CodeSelect2.vue.js} +1 -1
- package/dist/es/fields/{CodeSelectCol.vue_vue_type_script_setup_true_lang.js → CodeSelectCol.vue.js} +7 -7
- package/dist/es/fields/{CodeSelectCol.js → CodeSelectCol2.vue.js} +1 -1
- package/dist/es/fields/{CondOpSelect.js → CondOpSelect2.vue.js} +1 -1
- package/dist/es/fields/DataSourceFieldSelect/{FieldSelect.vue_vue_type_script_setup_true_lang.js → FieldSelect.vue.js} +55 -14
- package/dist/es/fields/DataSourceFieldSelect/{FieldSelect.js → FieldSelect2.vue.js} +1 -1
- package/dist/es/fields/DataSourceFieldSelect/{Index.vue_vue_type_script_setup_true_lang.js → Index.vue.js} +7 -7
- package/dist/es/fields/DataSourceFieldSelect/{Index.js → Index2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceFields.vue_vue_type_script_setup_true_lang.js → DataSourceFields.vue.js} +50 -17
- package/dist/es/fields/{DataSourceFields.js → DataSourceFields2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceInput.vue_vue_type_script_setup_true_lang.js → DataSourceInput.vue.js} +5 -5
- package/dist/es/fields/{DataSourceInput.js → DataSourceInput2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js → DataSourceMethodSelect.vue.js} +7 -7
- package/dist/es/fields/{DataSourceMethodSelect.js → DataSourceMethodSelect2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceMethods.vue_vue_type_script_setup_true_lang.js → DataSourceMethods.vue.js} +3 -3
- package/dist/es/fields/{DataSourceMethods.js → DataSourceMethods2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceMocks.vue_vue_type_script_setup_true_lang.js → DataSourceMocks.vue.js} +8 -8
- package/dist/es/fields/{DataSourceMocks.js → DataSourceMocks2.vue.js} +1 -1
- package/dist/es/fields/{DataSourceSelect.vue_vue_type_script_setup_true_lang.js → DataSourceSelect.vue.js} +5 -5
- package/dist/es/fields/{DataSourceSelect.js → DataSourceSelect2.vue.js} +1 -1
- package/dist/es/fields/{DisplayConds.js → DisplayConds2.vue.js} +1 -1
- package/dist/es/fields/{EventSelect.js → EventSelect2.vue.js} +1 -1
- package/dist/es/fields/{KeyValue.vue_vue_type_script_setup_true_lang.js → KeyValue.vue.js} +3 -3
- package/dist/es/fields/{KeyValue.js → KeyValue2.vue.js} +1 -1
- package/dist/es/fields/{PageFragmentSelect.vue_vue_type_script_setup_true_lang.js → PageFragmentSelect.vue.js} +4 -4
- package/dist/es/fields/{PageFragmentSelect.js → PageFragmentSelect2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/{Index.vue_vue_type_script_setup_true_lang.js → Index.vue.js} +7 -7
- package/dist/es/fields/StyleSetter/{Index.js → Index2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{BackgroundPosition.js → BackgroundPosition2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{Border.js → Border2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{Box.js → Box2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/configs.js +43 -43
- package/dist/es/fields/StyleSetter/pro/{Background.js → Background2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Border.vue_vue_type_script_setup_true_lang.js → Border.vue.js} +3 -3
- package/dist/es/fields/StyleSetter/pro/{Border.js → Border2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Font.js → Font2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Layout.vue_vue_type_script_setup_true_lang.js → Layout.vue.js} +4 -4
- package/dist/es/fields/StyleSetter/pro/{Layout.js → Layout2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Position.js → Position2.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Transform.js → Transform2.vue.js} +1 -1
- package/dist/es/fields/{UISelect.js → UISelect2.vue.js} +1 -1
- package/dist/es/fields/configs/codeSelect.js +2 -2
- package/dist/es/fields/configs/displayConds.js +1 -1
- package/dist/es/fields/configs/eventSelect.js +3 -3
- package/dist/es/fields/headless-validation.js +1 -1
- package/dist/es/hooks/use-code-block-edit.js +1 -1
- package/dist/es/hooks/use-compare-form.js +1 -1
- package/dist/es/hooks/use-editor-content-height.js +1 -1
- package/dist/es/hooks/use-filter.js +2 -2
- package/dist/es/hooks/use-float-box.js +1 -1
- package/dist/es/hooks/use-form-context.js +1 -1
- package/dist/es/hooks/use-node-status.js +1 -1
- package/dist/es/hooks/use-stage.js +28 -3
- package/dist/es/icons/{CenterIcon.js → CenterIcon2.vue.js} +1 -1
- package/dist/es/icons/{CodeIcon.js → CodeIcon2.vue.js} +1 -1
- package/dist/es/icons/{FolderMinusIcon.js → FolderMinusIcon2.vue.js} +1 -1
- package/dist/es/index.js +47 -47
- package/dist/es/initService.js +9 -9
- package/dist/es/layouts/{AddPageBox.vue_vue_type_script_setup_true_lang.js → AddPageBox.vue.js} +4 -4
- package/dist/es/layouts/{AddPageBox.js → AddPageBox2.vue.js} +1 -1
- package/dist/es/layouts/{CodeEditor.vue_vue_type_script_setup_true_lang.js → CodeEditor.vue.js} +5 -5
- package/dist/es/layouts/{CodeEditor.js → CodeEditor2.vue.js} +1 -1
- package/dist/es/layouts/{Framework.vue_vue_type_script_setup_true_lang.js → Framework.vue.js} +5 -5
- package/dist/es/layouts/{Framework.js → Framework2.vue.js} +1 -1
- package/dist/es/layouts/{NavMenu.vue_vue_type_script_setup_true_lang.js → NavMenu.vue.js} +5 -5
- package/dist/es/layouts/{NavMenu.js → NavMenu2.vue.js} +1 -1
- package/dist/es/layouts/{NavMenuColumn.vue_vue_type_script_setup_true_lang.js → NavMenuColumn.vue.js} +14 -6
- package/dist/es/layouts/{NavMenuColumn.js → NavMenuColumn2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{Bucket.vue_vue_type_script_setup_true_lang.js → Bucket.vue.js} +23 -7
- package/dist/es/layouts/history-list/{Bucket.js → Bucket2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{BucketTab.vue_vue_type_script_setup_true_lang.js → BucketTab.vue.js} +9 -4
- package/dist/es/layouts/history-list/{BucketTab.js → BucketTab2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{GroupRow.js → GroupRow2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js → HistoryDiffDialog.vue.js} +3 -3
- package/dist/es/layouts/history-list/{HistoryDiffDialog.js → HistoryDiffDialog2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{HistoryListPanel.vue_vue_type_script_setup_true_lang.js → HistoryListPanel.vue.js} +24 -6
- package/dist/es/layouts/history-list/{HistoryListPanel.js → HistoryListPanel2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{InitialRow.vue_vue_type_script_setup_true_lang.js → InitialRow.vue.js} +16 -5
- package/dist/es/layouts/history-list/{InitialRow.js → InitialRow2.vue.js} +1 -1
- package/dist/es/layouts/history-list/{PageTab.vue_vue_type_script_setup_true_lang.js → PageTab.vue.js} +20 -8
- package/dist/es/layouts/history-list/{PageTab.js → PageTab2.vue.js} +1 -1
- package/dist/es/layouts/history-list/composables.js +1 -1
- package/dist/es/layouts/history-list/useHistoryList.js +1 -1
- package/dist/es/layouts/history-list/useHistoryRevert.js +3 -3
- package/dist/es/layouts/page-bar/{AddButton.vue_vue_type_script_setup_true_lang.js → AddButton.vue.js} +6 -6
- package/dist/es/layouts/page-bar/{AddButton.js → AddButton2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{PageBar.vue_vue_type_script_setup_true_lang.js → PageBar.vue.js} +8 -8
- package/dist/es/layouts/page-bar/{PageBar.js → PageBar2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js → PageBarScrollContainer.vue.js} +2 -2
- package/dist/es/layouts/page-bar/{PageBarScrollContainer.js → PageBarScrollContainer2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{PageList.vue_vue_type_script_setup_true_lang.js → PageList.vue.js} +3 -3
- package/dist/es/layouts/page-bar/{PageList.js → PageList2.vue.js} +1 -1
- package/dist/es/layouts/page-bar/{Search.vue_vue_type_script_setup_true_lang.js → Search.vue.js} +3 -3
- package/dist/es/layouts/page-bar/{Search.js → Search2.vue.js} +1 -1
- package/dist/es/layouts/props-panel/{FormPanel.vue_vue_type_script_setup_true_lang.js → FormPanel.vue.js} +7 -7
- package/dist/es/layouts/props-panel/{FormPanel.js → FormPanel2.vue.js} +1 -1
- package/dist/es/layouts/props-panel/{PropsPanel.vue_vue_type_script_setup_true_lang.js → PropsPanel.vue.js} +7 -7
- package/dist/es/layouts/props-panel/{PropsPanel.js → PropsPanel2.vue.js} +1 -1
- package/dist/es/layouts/props-panel/use-style-panel.js +1 -1
- package/dist/es/layouts/sidebar/{ComponentListPanel.vue_vue_type_script_setup_true_lang.js → ComponentListPanel.vue.js} +7 -7
- package/dist/es/layouts/sidebar/{ComponentListPanel.js → ComponentListPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/{Sidebar.vue_vue_type_script_setup_true_lang.js → Sidebar.vue.js} +8 -8
- package/dist/es/layouts/sidebar/{Sidebar.js → Sidebar2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/code-block/{CodeBlockList.vue_vue_type_script_setup_true_lang.js → CodeBlockList.vue.js} +5 -5
- package/dist/es/layouts/sidebar/code-block/{CodeBlockList.js → CodeBlockList2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/code-block/{CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js → CodeBlockListPanel.vue.js} +6 -6
- package/dist/es/layouts/sidebar/code-block/{CodeBlockListPanel.js → CodeBlockListPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/code-block/useContentMenu.js +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceAddButton.vue_vue_type_script_setup_true_lang.js → DataSourceAddButton.vue.js} +2 -2
- package/dist/es/layouts/sidebar/data-source/{DataSourceAddButton.js → DataSourceAddButton2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js → DataSourceConfigPanel.vue.js} +4 -4
- package/dist/es/layouts/sidebar/data-source/{DataSourceConfigPanel.js → DataSourceConfigPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceList.vue_vue_type_script_setup_true_lang.js → DataSourceList.vue.js} +5 -5
- package/dist/es/layouts/sidebar/data-source/{DataSourceList.js → DataSourceList2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/{DataSourceListPanel.vue_vue_type_script_setup_true_lang.js → DataSourceListPanel.vue.js} +8 -8
- package/dist/es/layouts/sidebar/data-source/{DataSourceListPanel.js → DataSourceListPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/data-source/useContentMenu.js +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerMenu.vue_vue_type_script_setup_true_lang.js → LayerMenu.vue.js} +5 -5
- package/dist/es/layouts/sidebar/layer/{LayerMenu.js → LayerMenu2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerNodeContent.vue_vue_type_script_setup_true_lang.js → LayerNodeContent.vue.js} +3 -3
- package/dist/es/layouts/sidebar/layer/{LayerNodeContent.js → LayerNodeContent2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerNodeTool.js → LayerNodeTool2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerPanel.vue_vue_type_script_setup_true_lang.js → LayerPanel.vue.js} +7 -7
- package/dist/es/layouts/sidebar/layer/{LayerPanel.js → LayerPanel2.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/use-click.js +3 -3
- package/dist/es/layouts/sidebar/layer/use-drag.js +1 -1
- package/dist/es/layouts/sidebar/layer/use-keybinding.js +1 -1
- package/dist/es/layouts/sidebar/layer/use-node-status.js +2 -2
- package/dist/es/layouts/workspace/{Breadcrumb.js → Breadcrumb2.vue.js} +1 -1
- package/dist/es/layouts/workspace/{Workspace.vue_vue_type_script_setup_true_lang.js → Workspace.vue.js} +3 -3
- package/dist/es/layouts/workspace/{Workspace.js → Workspace2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{NodeListMenu.vue_vue_type_script_setup_true_lang.js → NodeListMenu.vue.js} +5 -5
- package/dist/es/layouts/workspace/viewer/{NodeListMenu.js → NodeListMenu2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{Stage.vue_vue_type_script_setup_true_lang.js → Stage.vue.js} +70 -55
- package/dist/es/layouts/workspace/viewer/{Stage.js → Stage2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{StageOverlay.vue_vue_type_script_setup_true_lang.js → StageOverlay.vue.js} +3 -3
- package/dist/es/layouts/workspace/viewer/{StageOverlay.js → StageOverlay2.vue.js} +1 -1
- package/dist/es/layouts/workspace/viewer/{ViewerMenu.vue_vue_type_script_setup_true_lang.js → ViewerMenu.vue.js} +6 -6
- package/dist/es/layouts/workspace/viewer/{ViewerMenu.js → ViewerMenu2.vue.js} +1 -1
- package/dist/es/plugin.js +24 -24
- package/dist/es/sdk/index.js +2 -2
- package/dist/es/sdk/services/CodeBlock.js +18 -18
- package/dist/es/sdk/services/DataSource.js +17 -17
- package/dist/es/sdk/services/Dep.js +3 -3
- package/dist/es/sdk/services/Editor.js +116 -81
- package/dist/es/sdk/services/Events.js +2 -2
- package/dist/es/sdk/services/History.js +45 -7
- package/dist/es/sdk/services/Props.js +6 -6
- package/dist/es/sdk/services/WebStorage.js +1 -1
- package/dist/es/sdk/utils/dep.js +2 -2
- package/dist/es/sdk/utils/operator.js +3 -3
- package/dist/es/sdk/validate/index.js +4 -4
- package/dist/es/sdk/wiring.js +2 -2
- package/dist/es/services/keybinding.js +2 -2
- package/dist/es/services/stageOverlay.js +2 -2
- package/dist/es/services/ui.js +2 -2
- package/dist/es/utils/code-block.js +2 -2
- package/dist/es/utils/content-menu.js +3 -3
- package/dist/es/utils/data-source/index.js +88 -5
- package/dist/es/utils/dep/collect-worker-client.js +1 -1
- package/dist/es/utils/dep/idle-task.js +1 -1
- package/dist/es/utils/editor.js +7 -6
- package/dist/es/utils/event.js +1 -1
- package/dist/es/utils/history.js +29 -10
- package/dist/es/utils/operator.js +1 -1
- package/dist/es/utils/page.js +21 -0
- package/dist/es/utils/props.js +1 -1
- package/dist/es/utils/type-match-rules.js +4 -4
- package/dist/es/utils/undo-redo.js +57 -9
- package/dist/tmagic-editor-headless.umd.cjs +257 -87
- package/dist/tmagic-editor-sdk.umd.cjs +225 -84
- package/dist/tmagic-editor.umd.cjs +814 -241
- package/package.json +8 -8
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +68 -9
- package/src/fields/DataSourceFields.vue +53 -10
- package/src/fields/DataSourceMocks.vue +2 -2
- package/src/hooks/use-stage.ts +26 -1
- package/src/layouts/NavMenuColumn.vue +8 -1
- package/src/layouts/history-list/Bucket.vue +30 -16
- package/src/layouts/history-list/BucketTab.vue +8 -1
- package/src/layouts/history-list/HistoryListPanel.vue +27 -0
- package/src/layouts/history-list/InitialRow.vue +17 -5
- package/src/layouts/history-list/PageTab.vue +32 -18
- package/src/layouts/workspace/viewer/Stage.vue +77 -57
- package/src/sdk/services/Editor.ts +56 -26
- package/src/sdk/services/History.ts +58 -11
- package/src/type.ts +19 -3
- package/src/utils/data-source/index.ts +151 -6
- package/src/utils/editor.ts +4 -0
- package/src/utils/history.ts +35 -10
- package/src/utils/page.ts +32 -0
- package/src/utils/undo-redo.ts +76 -12
- package/types/headless.d.ts +14 -3
- package/types/index.d.ts +234 -314
- package/types/sdk.d.ts +79 -59
- package/dist/es/components/{CodeParams.vue_vue_type_script_setup_true_lang.js → CodeParams.vue.js} +2 -2
- package/dist/es/components/{CompareForm.vue_vue_type_script_setup_true_lang.js → CompareForm.vue.js} +3 -3
- package/dist/es/components/{Icon.vue_vue_type_script_setup_true_lang.js → Icon.vue.js} +1 -1
- package/dist/es/components/{Resizer.vue_vue_type_script_setup_true_lang.js → Resizer.vue.js} +1 -1
- package/dist/es/components/{ScrollBar.vue_vue_type_script_setup_true_lang.js → ScrollBar.vue.js} +0 -0
- package/dist/es/components/{SearchInput.vue_vue_type_script_setup_true_lang.js → SearchInput.vue.js} +1 -1
- package/dist/es/components/{ViewForm.vue_vue_type_script_setup_true_lang.js → ViewForm.vue.js} +2 -2
- package/dist/es/fields/{CodeLink.vue_vue_type_script_setup_true_lang.js → CodeLink.vue.js} +1 -1
- package/dist/es/fields/{CodeSelect.vue_vue_type_script_setup_true_lang.js → CodeSelect.vue.js} +2 -2
- package/dist/es/fields/{CondOpSelect.vue_vue_type_script_setup_true_lang.js → CondOpSelect.vue.js} +3 -3
- package/dist/es/fields/{DisplayConds.vue_vue_type_script_setup_true_lang.js → DisplayConds.vue.js} +2 -2
- package/dist/es/fields/{EventSelect.vue_vue_type_script_setup_true_lang.js → EventSelect.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/components/{BackgroundPosition.vue_vue_type_script_setup_true_lang.js → BackgroundPosition.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/components/{Border.vue_vue_type_script_setup_true_lang.js → Border.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/components/{Box.vue_vue_type_script_setup_true_lang.js → Box.vue.js} +0 -0
- package/dist/es/fields/StyleSetter/icons/align-items/{Baseline.js → Baseline.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Center.js → Center.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{End.js → End.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{FlexEnd.js → FlexEnd.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{FlexStart.js → FlexStart.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Normal.js → Normal.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{SpaceAround.js → SpaceAround.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{SpaceBetween.js → SpaceBetween.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Start.js → Start.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/{Stretch.js → Stretch.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{NoRepeat.js → NoRepeat.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{Repeat.js → Repeat.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{RepeatX.js → RepeatX.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{RepeatY.js → RepeatY.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{Round.js → Round.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/background-repeat/{Space.js → Space.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Block.js → Block.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Flex.js → Flex.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Grid.js → Grid.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{Inline.js → Inline.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{InlineBlock.js → InlineBlock.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{InlineFlex.js → InlineFlex.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{InlineGrid.js → InlineGrid.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/display/{None.js → None.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{Column.js → Column.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{ColumnReverse.js → ColumnReverse.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{Row.js → Row.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/{RowReverse.js → RowReverse.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{Center.js → Center.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{FlexEnd.js → FlexEnd.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{FlexStart.js → FlexStart.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{SpaceAround.js → SpaceAround.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{SpaceBetween.js → SpaceBetween.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/justify-content/{SpaceEvenly.js → SpaceEvenly.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Center.js → Center.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{End.js → End.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Justify.js → Justify.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Left.js → Left.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{MatchParent.js → MatchParent.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Right.js → Right.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/{Start.js → Start.vue.js} +1 -1
- package/dist/es/fields/StyleSetter/pro/{Background.vue_vue_type_script_setup_true_lang.js → Background.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/pro/{Font.vue_vue_type_script_setup_true_lang.js → Font.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/pro/{Position.vue_vue_type_script_setup_true_lang.js → Position.vue.js} +2 -2
- package/dist/es/fields/StyleSetter/pro/{Transform.vue_vue_type_script_setup_true_lang.js → Transform.vue.js} +2 -2
- package/dist/es/fields/{UISelect.vue_vue_type_script_setup_true_lang.js → UISelect.vue.js} +5 -5
- package/dist/es/icons/{CenterIcon.vue_vue_type_script_setup_true_lang.js → CenterIcon.vue.js} +0 -0
- package/dist/es/icons/{CodeIcon.vue_vue_type_script_setup_true_lang.js → CodeIcon.vue.js} +0 -0
- package/dist/es/icons/{DatasourceIcon.js → DatasourceIcon.vue.js} +1 -1
- package/dist/es/icons/{FolderMinusIcon.vue_vue_type_script_setup_true_lang.js → FolderMinusIcon.vue.js} +0 -0
- package/dist/es/layouts/history-list/{GroupRow.vue_vue_type_script_setup_true_lang.js → GroupRow.vue.js} +1 -1
- package/dist/es/layouts/sidebar/layer/{LayerNodeTool.vue_vue_type_script_setup_true_lang.js → LayerNodeTool.vue.js} +2 -2
- package/dist/es/layouts/workspace/{Breadcrumb.vue_vue_type_script_setup_true_lang.js → Breadcrumb.vue.js} +2 -2
|
@@ -67,6 +67,7 @@ import type {
|
|
|
67
67
|
import { DragType, Layout } from '@editor/type';
|
|
68
68
|
import { getEditorConfig } from '@editor/utils/config';
|
|
69
69
|
import { KeyBindingContainerKey } from '@editor/utils/keybinding-config';
|
|
70
|
+
import { isSamePageItemsReorder } from '@editor/utils/page';
|
|
70
71
|
|
|
71
72
|
import NodeListMenu from './NodeListMenu.vue';
|
|
72
73
|
import StageOverlay from './StageOverlay.vue';
|
|
@@ -111,57 +112,62 @@ const zoom = computed(() => uiService.get('zoom'));
|
|
|
111
112
|
const node = computed(() => editorService.get('node'));
|
|
112
113
|
|
|
113
114
|
/**
|
|
114
|
-
*
|
|
115
|
+
* 双击选中进度:上次双击选中的节点 id
|
|
115
116
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* 只有元素未被完整显示时才需要打开 overlay 以展示完整内容
|
|
117
|
+
* 单击先于双击触发,会把当前选中重置到鼠标下最内层元素,
|
|
118
|
+
* 所以层级的推进不能读当前选中状态,只能由双击自己记录。
|
|
119
119
|
*/
|
|
120
|
-
|
|
121
|
-
const win = el.ownerDocument.defaultView;
|
|
122
|
-
if (!win) return false;
|
|
120
|
+
let lastDblclickSelectedId: string | undefined;
|
|
123
121
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
/**
|
|
123
|
+
* 遍历鼠标位置下的元素链,找出「有子元素没显示全」的滚动容器
|
|
124
|
+
*
|
|
125
|
+
* 被裁掉的子元素不参与 elementsFromPoint 命中,无需找回它们:
|
|
126
|
+
* 需要定位的是承载这些子元素的容器,交给 openOverlay 展开完整内容。
|
|
127
|
+
* 可视区域以页面(页面片)为界:容器可视区与页面矩形求交后,
|
|
128
|
+
* 只要有可选中子元素没完整落在该区域内,或容器内容本身就溢出了,
|
|
129
|
+
* 这个容器就是需要展开的滚动容器。
|
|
130
|
+
*
|
|
131
|
+
* 轮播等组件靠内部样式完成裁剪,容器自身的 computed overflow 可能是 visible,
|
|
132
|
+
* 因此不能拿 overflow 当门槛;openOverlay 也是按 scrollWidth/scrollHeight 展开,
|
|
133
|
+
* 内容溢出本身就是最可靠的信号。
|
|
134
|
+
* 页面自身是可视区域边界而不是滚动容器;iframe 级容器、以及 swiper-wrapper
|
|
135
|
+
* 这类没有节点 id 的纯 DOM 包裹层也不参与,否则会抢在真正的容器前面。
|
|
136
|
+
*/
|
|
137
|
+
const findScrollContainer = (els: HTMLElement[]): HTMLElement | null => {
|
|
138
|
+
const doc = stage?.renderer?.contentWindow?.document;
|
|
139
|
+
const pageEl = stage?.mask?.page ?? doc?.querySelector<HTMLElement>('.magic-ui-page, .magic-ui-page-fragment');
|
|
140
|
+
if (!pageEl) return null;
|
|
127
141
|
|
|
128
|
-
|
|
129
|
-
const elId = getIdFromEl()(el);
|
|
130
|
-
if (elId && pageIds.has(elId)) return false;
|
|
142
|
+
const pageRect = pageEl.getBoundingClientRect();
|
|
131
143
|
|
|
132
|
-
|
|
144
|
+
for (const el of els) {
|
|
145
|
+
if (el === pageEl || !pageEl.contains(el) || !getIdFromEl()(el)) continue;
|
|
133
146
|
|
|
134
|
-
|
|
135
|
-
const
|
|
147
|
+
const rect = el.getBoundingClientRect();
|
|
148
|
+
const visibleLeft = Math.max(rect.left, pageRect.left);
|
|
149
|
+
const visibleTop = Math.max(rect.top, pageRect.top);
|
|
150
|
+
const visibleRight = Math.min(rect.right, pageRect.right);
|
|
151
|
+
const visibleBottom = Math.min(rect.bottom, pageRect.bottom);
|
|
136
152
|
|
|
137
|
-
//
|
|
138
|
-
if (
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
153
|
+
// 轮播里未展示的 slide、超长列表等内容没落在容器里
|
|
154
|
+
if (el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight) return el;
|
|
141
155
|
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
['auto', 'scroll', 'hidden'].includes(overflowY) ||
|
|
147
|
-
parent.scrollWidth > parent.clientWidth ||
|
|
148
|
-
parent.scrollHeight > parent.clientHeight
|
|
149
|
-
) {
|
|
150
|
-
// 比较元素与容器的可视区域,判断元素是否被裁剪
|
|
151
|
-
const elRect = el.getBoundingClientRect();
|
|
152
|
-
const containerRect = parent.getBoundingClientRect();
|
|
156
|
+
for (const child of el.querySelectorAll<HTMLElement>('*')) {
|
|
157
|
+
if (!getIdFromEl()(child)) continue;
|
|
158
|
+
const childRect = child.getBoundingClientRect();
|
|
159
|
+
if (!childRect.width || !childRect.height) continue;
|
|
153
160
|
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
childRect.left < visibleLeft ||
|
|
162
|
+
childRect.top < visibleTop ||
|
|
163
|
+
childRect.right > visibleRight ||
|
|
164
|
+
childRect.bottom > visibleBottom
|
|
158
165
|
) {
|
|
159
|
-
return
|
|
166
|
+
return el;
|
|
160
167
|
}
|
|
161
168
|
}
|
|
162
|
-
parent = parent.parentElement;
|
|
163
169
|
}
|
|
164
|
-
return
|
|
170
|
+
return null;
|
|
165
171
|
};
|
|
166
172
|
|
|
167
173
|
watchEffect(() => {
|
|
@@ -183,31 +189,43 @@ watchEffect(() => {
|
|
|
183
189
|
}
|
|
184
190
|
|
|
185
191
|
const el = (await stage?.actionManager?.getElementFromPoint(event)) || null;
|
|
186
|
-
if (!el) return;
|
|
187
|
-
|
|
188
|
-
const id = getIdFromEl()(el);
|
|
189
192
|
|
|
190
|
-
if (
|
|
191
|
-
const
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
if (el) {
|
|
194
|
+
const id = getIdFromEl()(el);
|
|
195
|
+
if (id) {
|
|
196
|
+
const node = editorService.getNodeById(id);
|
|
197
|
+
if (node?.type === 'page-fragment-container' && node.pageFragmentId) {
|
|
198
|
+
await editorService.select(node.pageFragmentId);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
195
201
|
}
|
|
196
202
|
}
|
|
197
203
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
204
|
+
// 命中链只取一次:优先找需要展开的滚动容器,找不到再沿链向上选中
|
|
205
|
+
const els = stage?.renderer?.getElementsFromPoint(event) ?? [];
|
|
202
206
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
editorService.get('stage')?.select(nextId);
|
|
207
|
+
if (!props.disabledStageOverlay) {
|
|
208
|
+
const scrollContainer = findScrollContainer(els);
|
|
209
|
+
if (scrollContainer) {
|
|
210
|
+
stageOverlayService.openOverlay(scrollContainer);
|
|
211
|
+
return;
|
|
209
212
|
}
|
|
210
213
|
}
|
|
214
|
+
|
|
215
|
+
if (!el) return;
|
|
216
|
+
|
|
217
|
+
// 单击已把选中重置到链首,用上次双击选中的节点在链中的位置推进:
|
|
218
|
+
// 连续双击即可从组件一路选中到页面;换了位置(链里找不到上次节点)或已经选到
|
|
219
|
+
// 页面,则重新从父容器开始,保证每次双击都有选中反馈。
|
|
220
|
+
const ids = els.map((item) => getIdFromEl()(item)).filter((id): id is string => Boolean(id));
|
|
221
|
+
const lastIndex = lastDblclickSelectedId ? ids.indexOf(lastDblclickSelectedId) : -1;
|
|
222
|
+
const nextIndex = lastIndex >= 0 && lastIndex + 1 < ids.length ? lastIndex + 1 : 1;
|
|
223
|
+
const nextId = ids[nextIndex];
|
|
224
|
+
if (!nextId) return;
|
|
225
|
+
|
|
226
|
+
lastDblclickSelectedId = nextId;
|
|
227
|
+
await editorService.select(nextId);
|
|
228
|
+
editorService.get('stage')?.select(nextId);
|
|
211
229
|
});
|
|
212
230
|
|
|
213
231
|
editorService.set('stage', markRaw(stage));
|
|
@@ -234,7 +252,9 @@ watch(zoom, (zoom) => {
|
|
|
234
252
|
});
|
|
235
253
|
|
|
236
254
|
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
|
237
|
-
watch(page, (page) => {
|
|
255
|
+
watch(page, (page, prevPage) => {
|
|
256
|
+
// 子节点排序也会换成同 id 的页面对象。页面配置没变,不能走切页:updatePageId 会拆掉页面,select 会把选中打回页面
|
|
257
|
+
if (isSamePageItemsReorder(prevPage, page)) return;
|
|
238
258
|
if (runtime && page) {
|
|
239
259
|
editorService.set('stageLoading', true);
|
|
240
260
|
|
|
@@ -86,6 +86,16 @@ import { Protocol } from './WebStorage';
|
|
|
86
86
|
|
|
87
87
|
type MoveItem = { node: MNode; parent: MContainer; pageForOp: { name: string; id: Id } | null };
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* 撤销 / 重做回放的内部标记键:不导出,也不出现在公开的 {@link HistoryOpOptions} 里。
|
|
91
|
+
* 回放链路用它把 `isHistoryOp` 带进 `change` 事件;外部调用方即使传同名字符串字段也不会被读取,
|
|
92
|
+
* 避免一次真实编辑被误标成历史回放,从而绕过业务侧的加锁 / 埋点 / 自动保存。
|
|
93
|
+
*/
|
|
94
|
+
const HISTORY_OP = Symbol('isHistoryOp');
|
|
95
|
+
|
|
96
|
+
/** 读取仅供编辑器内部使用的回放标记。 */
|
|
97
|
+
const isReplay = (options: object): boolean => (options as { [HISTORY_OP]?: boolean })[HISTORY_OP] === true;
|
|
98
|
+
|
|
89
99
|
/** 把插入下标收敛到 [0, length]:非整数取整,非法 / 越界(含未记录)一律追加到末尾 */
|
|
90
100
|
const clampIndex = (index: number | undefined, length: number): number => {
|
|
91
101
|
const normalized = typeof index === 'number' ? Math.trunc(index) : length;
|
|
@@ -487,11 +497,13 @@ class Editor extends BaseService {
|
|
|
487
497
|
index: insertIndex,
|
|
488
498
|
});
|
|
489
499
|
|
|
490
|
-
|
|
500
|
+
if (!options.doNotFixPosition) {
|
|
501
|
+
const newStyle = fixNodePosition(node, parent, stage);
|
|
491
502
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
503
|
+
if (newStyle && (newStyle.top !== node.style.top || newStyle.left !== node.style.left)) {
|
|
504
|
+
node.style = newStyle;
|
|
505
|
+
await stage?.update({ config: cloneDeep(node), parentId: parent.id, root: cloneDeep(root) });
|
|
506
|
+
}
|
|
495
507
|
}
|
|
496
508
|
|
|
497
509
|
this.addModifiedNodeId(node.id);
|
|
@@ -520,6 +532,7 @@ class Editor extends BaseService {
|
|
|
520
532
|
historyDescription,
|
|
521
533
|
historySource,
|
|
522
534
|
} = options;
|
|
535
|
+
const isHistoryOp = isReplay(options);
|
|
523
536
|
|
|
524
537
|
const stage = this.get('stage');
|
|
525
538
|
|
|
@@ -619,6 +632,7 @@ class Editor extends BaseService {
|
|
|
619
632
|
data: newNodes.map((node) => ({ node, page: this.getPageOfNode(node.id) })),
|
|
620
633
|
historySource,
|
|
621
634
|
doNotPushHistory,
|
|
635
|
+
isHistoryOp,
|
|
622
636
|
});
|
|
623
637
|
|
|
624
638
|
// 页面 / 页面片新增不入历史栈(见上方 isPageOrFragment 分支),这里合并补发一次结构变更通知
|
|
@@ -722,6 +736,7 @@ class Editor extends BaseService {
|
|
|
722
736
|
*/
|
|
723
737
|
public async remove(nodeOrNodeList: MNode | MNode[], options: DslOpOptions = {}): Promise<void> {
|
|
724
738
|
const { doNotPushHistory = false, historyDescription, historySource } = options;
|
|
739
|
+
const isHistoryOp = isReplay(options);
|
|
725
740
|
this.captureSelectionBeforeOp();
|
|
726
741
|
|
|
727
742
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
@@ -767,7 +782,7 @@ class Editor extends BaseService {
|
|
|
767
782
|
}
|
|
768
783
|
|
|
769
784
|
this.emit('remove', nodes);
|
|
770
|
-
this.emit('change', { type: 'remove', data: changeItems, historySource, doNotPushHistory });
|
|
785
|
+
this.emit('change', { type: 'remove', data: changeItems, historySource, doNotPushHistory, isHistoryOp });
|
|
771
786
|
|
|
772
787
|
// 页面 / 页面片删除不入历史栈(见上方 isPageOrFragment 分支),这里合并补发一次结构变更通知
|
|
773
788
|
const removedPages = nodes.filter((node) => isPageOrFragment(node)) as (MPage | MPageFragment)[];
|
|
@@ -873,6 +888,7 @@ class Editor extends BaseService {
|
|
|
873
888
|
historySource,
|
|
874
889
|
invalidInfo,
|
|
875
890
|
} = data;
|
|
891
|
+
const isHistoryOp = isReplay(data);
|
|
876
892
|
|
|
877
893
|
const nodes = Array.isArray(config) ? config : [config];
|
|
878
894
|
|
|
@@ -922,6 +938,7 @@ class Editor extends BaseService {
|
|
|
922
938
|
data: updateData.map((node) => ({ node, page: this.getPageOfNode(node.newNode.id) })),
|
|
923
939
|
historySource,
|
|
924
940
|
doNotPushHistory,
|
|
941
|
+
isHistoryOp,
|
|
925
942
|
});
|
|
926
943
|
return Array.isArray(config) ? updateData.map((item) => item.newNode) : updateData[0].newNode;
|
|
927
944
|
}
|
|
@@ -1111,10 +1128,9 @@ class Editor extends BaseService {
|
|
|
1111
1128
|
* @param options 可选配置
|
|
1112
1129
|
* @param options.doNotPushHistory 是否不写入历史记录(默认 false)
|
|
1113
1130
|
*/
|
|
1114
|
-
public async moveLayer(
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
): Promise<void> {
|
|
1131
|
+
public async moveLayer(offset: number | LayerOffset, options: DslOpOptions = {}): Promise<void> {
|
|
1132
|
+
const { doNotPushHistory = false, historyDescription, historySource } = options;
|
|
1133
|
+
const isHistoryOp = isReplay(options);
|
|
1118
1134
|
this.captureSelectionBeforeOp();
|
|
1119
1135
|
|
|
1120
1136
|
const root = this.get('root');
|
|
@@ -1174,6 +1190,7 @@ class Editor extends BaseService {
|
|
|
1174
1190
|
offset,
|
|
1175
1191
|
historySource,
|
|
1176
1192
|
doNotPushHistory,
|
|
1193
|
+
isHistoryOp,
|
|
1177
1194
|
});
|
|
1178
1195
|
}
|
|
1179
1196
|
|
|
@@ -1288,8 +1305,10 @@ class Editor extends BaseService {
|
|
|
1288
1305
|
config: MNode | MNode[],
|
|
1289
1306
|
targetParent: MContainer,
|
|
1290
1307
|
targetIndex: number,
|
|
1291
|
-
|
|
1308
|
+
options: DslOpOptions = {},
|
|
1292
1309
|
) {
|
|
1310
|
+
const { doNotPushHistory = false, historyDescription, historySource } = options;
|
|
1311
|
+
const isHistoryOp = isReplay(options);
|
|
1293
1312
|
this.captureSelectionBeforeOp();
|
|
1294
1313
|
|
|
1295
1314
|
if (!targetParent || !Array.isArray(targetParent.items)) return;
|
|
@@ -1377,6 +1396,7 @@ class Editor extends BaseService {
|
|
|
1377
1396
|
targetParent,
|
|
1378
1397
|
historySource,
|
|
1379
1398
|
doNotPushHistory,
|
|
1399
|
+
isHistoryOp,
|
|
1380
1400
|
});
|
|
1381
1401
|
}
|
|
1382
1402
|
|
|
@@ -1499,7 +1519,8 @@ class Editor extends BaseService {
|
|
|
1499
1519
|
* @returns 反向后产生的新 step;目标不存在 / 未应用 / 反向失败时返回 null
|
|
1500
1520
|
*/
|
|
1501
1521
|
public async revertPageStep(index: number): Promise<StepValue | null> {
|
|
1502
|
-
const
|
|
1522
|
+
const pageId = this.get('page')?.id;
|
|
1523
|
+
const list = this.ctx.history.getStepList('page', pageId);
|
|
1503
1524
|
const entry = list[index];
|
|
1504
1525
|
if (!entry?.applied) return null;
|
|
1505
1526
|
|
|
@@ -1515,13 +1536,13 @@ class Editor extends BaseService {
|
|
|
1515
1536
|
if (!items.length || !items.every((item) => item.changeRecords?.length)) return null;
|
|
1516
1537
|
}
|
|
1517
1538
|
|
|
1518
|
-
// 反向应用产生的新 step 由内部 pushOpHistory 触发 history `change`
|
|
1539
|
+
// 反向应用产生的新 step 由内部 pushOpHistory 触发 history `change` 事件,签名 `(step, stepType, id)`。
|
|
1540
|
+
// 只关心当前页面栈产生的第一条;期间其它类型/其它页面的 push 不应覆盖结果。
|
|
1519
1541
|
let revertedStep: StepValue | null = null;
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
revertedStep = s;
|
|
1542
|
+
const captureRevert = (s: StepValue, type: string, id: Id) => {
|
|
1543
|
+
if (type === 'page' && id === pageId && !revertedStep) revertedStep = s;
|
|
1523
1544
|
};
|
|
1524
|
-
this.ctx.history.
|
|
1545
|
+
this.ctx.history.on('change', captureRevert);
|
|
1525
1546
|
|
|
1526
1547
|
const historyDescription = `回滚 #${index + 1}: ${describeStepForRevert(step)}`;
|
|
1527
1548
|
// revert 走 public add/remove/update,让操作以一条普通新 step 入栈;不要切换选区与页面,避免打断用户。
|
|
@@ -1936,9 +1957,11 @@ class Editor extends BaseService {
|
|
|
1936
1957
|
/**
|
|
1937
1958
|
* 构造一条页面级「set root」历史记录(不携带选区 / modifiedNodeIds 上下文)并落到该页面自己的栈。
|
|
1938
1959
|
*
|
|
1939
|
-
* 连续 set root
|
|
1940
|
-
*
|
|
1941
|
-
*
|
|
1960
|
+
* 连续 set root 替换:若该页栈最新一条已是**同来源、同为整页 update**的 set root 记录
|
|
1961
|
+
* ({@link StepValue.rootStep} 且 `source` 相同),则用本次记录**替换**它而非新增,避免源码反复保存时堆积记录。
|
|
1962
|
+
* 替换时必须把 `oldSchema` 追溯到最早那一跳,并沿用原 uuid:否则只剩「上一版 → 本版」,
|
|
1963
|
+
* 撤销到基线时 DSL 会停在中途版本且无法继续回退,已发出的 historyId 也会失效。
|
|
1964
|
+
* 其余情况(来源不同 / 页面增删)照常新增,保留完整变更链条。
|
|
1942
1965
|
*/
|
|
1943
1966
|
private pushPageDiffStep(
|
|
1944
1967
|
opType: HistoryOpType,
|
|
@@ -1961,11 +1984,16 @@ class Editor extends BaseService {
|
|
|
1961
1984
|
if (source) step.source = source;
|
|
1962
1985
|
|
|
1963
1986
|
const top = this.ctx.history.getCurrentPageStep(page.id);
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1987
|
+
const earliestOldSchema = top?.diff?.[0]?.oldSchema;
|
|
1988
|
+
if (top?.rootStep && top.source === source && opType === 'update' && top.opType === 'update' && earliestOldSchema) {
|
|
1989
|
+
this.ctx.history.replaceCurrentStep(
|
|
1990
|
+
'page',
|
|
1991
|
+
{ ...step, uuid: top.uuid, diff: [{ ...diffItem, oldSchema: earliestOldSchema }] },
|
|
1992
|
+
page.id,
|
|
1993
|
+
);
|
|
1994
|
+
return;
|
|
1968
1995
|
}
|
|
1996
|
+
this.ctx.history.push('page', step, page.id);
|
|
1969
1997
|
}
|
|
1970
1998
|
|
|
1971
1999
|
private pushOpHistory(
|
|
@@ -2017,8 +2045,8 @@ class Editor extends BaseService {
|
|
|
2017
2045
|
* 「重新插回节点」(撤销 remove / 重做 add)需按 step 记录的 parentId / index 精确还原,
|
|
2018
2046
|
* 不走 this.add,由手工 splice + stage.add 完成后补发等价的 add / change 事件(见 emitHistoryInsertEvents)。
|
|
2019
2047
|
*
|
|
2020
|
-
* 注意:这些路径都会发出 add / remove / update / change
|
|
2021
|
-
*
|
|
2048
|
+
* 注意:这些路径都会发出 add / remove / update / change 事件,且 `change` 事件带 `isHistoryOp: true`,
|
|
2049
|
+
* 业务侧可据此跳过仅针对「用户主动编辑」的副作用(加锁 / 埋点 / 自动保存等)。
|
|
2022
2050
|
*
|
|
2023
2051
|
* @param step 操作记录
|
|
2024
2052
|
* @param reverse true = 撤销,false = 重做
|
|
@@ -2036,6 +2064,7 @@ class Editor extends BaseService {
|
|
|
2036
2064
|
doNotSelect: true,
|
|
2037
2065
|
doNotSwitchPage: true,
|
|
2038
2066
|
doNotPushHistory: true,
|
|
2067
|
+
[HISTORY_OP]: true,
|
|
2039
2068
|
historySource: step.source,
|
|
2040
2069
|
} as const;
|
|
2041
2070
|
|
|
@@ -2142,7 +2171,7 @@ class Editor extends BaseService {
|
|
|
2142
2171
|
return cloneDeep(reverse ? oldNode : newNode);
|
|
2143
2172
|
});
|
|
2144
2173
|
if (configs.length) {
|
|
2145
|
-
await this.update(configs,
|
|
2174
|
+
await this.update(configs, commonOpts);
|
|
2146
2175
|
}
|
|
2147
2176
|
break;
|
|
2148
2177
|
}
|
|
@@ -2195,6 +2224,7 @@ class Editor extends BaseService {
|
|
|
2195
2224
|
historySource: source,
|
|
2196
2225
|
// 撤销/重做本身不再写入历史记录
|
|
2197
2226
|
doNotPushHistory: true,
|
|
2227
|
+
isHistoryOp: true,
|
|
2198
2228
|
});
|
|
2199
2229
|
}
|
|
2200
2230
|
|
|
@@ -135,11 +135,12 @@ class History extends BaseService {
|
|
|
135
135
|
* 注册一个扩展历史类型,使其可与内置 `page` / `codeBlock` / `dataSource` 一样走统一的
|
|
136
136
|
* {@link push} / {@link undo} / {@link redo}(按 id 分栈、独立 undo/redo)。
|
|
137
137
|
*
|
|
138
|
+
* 扩展类型与内置类型一样统一派发 `change` 事件,无需(也不支持)单独指定事件名。
|
|
139
|
+
*
|
|
138
140
|
* @param stepType 自定义历史类型标识(勿与内置类型重名)
|
|
139
|
-
* @param options.event push/undo/redo 后派发的事件名,缺省为 `${stepType}-history-change`
|
|
140
141
|
* @param options.name 历史面板中的展示名称(tab / 分组标题等),缺省回退到 stepType 本身
|
|
141
142
|
*/
|
|
142
|
-
public registerStepType(stepType: string, options: {
|
|
143
|
+
public registerStepType(stepType: string, options: { name?: string } = {}): void {
|
|
143
144
|
this.getStepBucket(stepType);
|
|
144
145
|
if (options.name !== undefined) this.state.stepNames[stepType] = options.name;
|
|
145
146
|
}
|
|
@@ -235,10 +236,20 @@ class History extends BaseService {
|
|
|
235
236
|
return first?.opType === 'initial' ? (first as StepValue) : undefined;
|
|
236
237
|
}
|
|
237
238
|
|
|
239
|
+
/**
|
|
240
|
+
* 目标栈「回到初始」是否可达:容量裁剪删掉已应用的真实步骤后撤销链断开,返回 false。
|
|
241
|
+
* 与是否存在 {@link getMarker} 基线无关——没有基线的栈同样可能因裁剪回不到加载时的 DSL,
|
|
242
|
+
* 历史面板的各 tab 统一用它判断初始行是否可高亮 / 可点击。
|
|
243
|
+
*/
|
|
244
|
+
public isInitialReachable(stepType: HistoryStepType, id?: Id): boolean {
|
|
245
|
+
if (!this.isValidStackId(id)) return true;
|
|
246
|
+
return this.state.steps[stepType]?.[id]?.isInitialReachable() ?? true;
|
|
247
|
+
}
|
|
248
|
+
|
|
238
249
|
/**
|
|
239
250
|
* 把一条步骤推入指定历史栈。统一入口,所有类型(page / codeBlock / dataSource / 扩展)行为完全一致:
|
|
240
|
-
* 按 `stepType` 选择目标栈类型,按 `id
|
|
241
|
-
*
|
|
251
|
+
* 按 `stepType` 选择目标栈类型,按 `id`(必填)选择具体栈,按需建栈后入栈,并派发历史变更事件
|
|
252
|
+
* (统一为 `change`,回调签名 `(step, stepType, id, isHistoryOp)`)。
|
|
242
253
|
*
|
|
243
254
|
* 跨页 / 跨资源操作(如 `moveToContainer` 把节点搬到其它页)必须显式传入目标 id,
|
|
244
255
|
* 否则无法落到正确的栈。step 可由 `createStackStep` 等构造后传入。
|
|
@@ -255,14 +266,14 @@ class History extends BaseService {
|
|
|
255
266
|
if (!this.isValidStackId(id)) return null;
|
|
256
267
|
this.fillStepMeta(step);
|
|
257
268
|
getOrCreateStack(this.getStepBucket(stepType), id).pushElement(step);
|
|
258
|
-
this.
|
|
269
|
+
this.emitStepChange(step, stepType, id);
|
|
259
270
|
return step;
|
|
260
271
|
}
|
|
261
272
|
|
|
262
273
|
/**
|
|
263
274
|
* 撤销指定历史栈的最近一次变更。统一入口,所有类型行为一致:
|
|
264
275
|
* 按 `id`(必填)+ `stepType` 定位栈,不会越过 index 0 的 initial 基线(所有类型同等适用),
|
|
265
|
-
* 仅在确有可撤销 step
|
|
276
|
+
* 仅在确有可撤销 step 时派发历史变更事件(签名同 {@link push})。
|
|
266
277
|
*
|
|
267
278
|
* @param stepType 历史类型
|
|
268
279
|
* @param id 目标栈 id(page 为 pageId,其余类型为对应资源 id),必填
|
|
@@ -278,7 +289,7 @@ class History extends BaseService {
|
|
|
278
289
|
// 不允许撤销越过初始基线(index 0 的 initial step);无基线时 floor 为 0。
|
|
279
290
|
if (undoRedo.getCursor() <= undoFloor(undoRedo)) return null;
|
|
280
291
|
const step = undoRedo.undo();
|
|
281
|
-
if (step) this.
|
|
292
|
+
if (step) this.emitStepChange(step, stepType, id, true);
|
|
282
293
|
return step;
|
|
283
294
|
}
|
|
284
295
|
|
|
@@ -297,7 +308,7 @@ class History extends BaseService {
|
|
|
297
308
|
const undoRedo = this.state.steps[stepType]?.[id];
|
|
298
309
|
if (!undoRedo) return null;
|
|
299
310
|
const step = undoRedo.redo();
|
|
300
|
-
if (step) this.
|
|
311
|
+
if (step) this.emitStepChange(step, stepType, id, true);
|
|
301
312
|
return step;
|
|
302
313
|
}
|
|
303
314
|
|
|
@@ -339,7 +350,7 @@ class History extends BaseService {
|
|
|
339
350
|
this.fillStepMeta(state);
|
|
340
351
|
|
|
341
352
|
if (!undoRedo.replaceCurrentElement(state)) return null;
|
|
342
|
-
this.
|
|
353
|
+
this.emitStepChange(state, stepType, id);
|
|
343
354
|
return state;
|
|
344
355
|
}
|
|
345
356
|
|
|
@@ -381,6 +392,9 @@ class History extends BaseService {
|
|
|
381
392
|
*
|
|
382
393
|
* 同一栈内任意时刻最多只有一条记录为 `saved`;从 IndexedDB 恢复时游标会被定位到最近一条已保存记录之后。
|
|
383
394
|
*
|
|
395
|
+
* 标记后把对应栈裁剪到容量上限({@link markStackSaved} → {@link UndoRedo.trim}):入栈与还原都不裁剪,
|
|
396
|
+
* 只有保存后才收敛,避免用户在落库前丢掉可撤销的历史;initial 基线与 set root 产生的记录不会被裁掉。
|
|
397
|
+
*
|
|
384
398
|
* @param stepType 历史类型
|
|
385
399
|
* @param id 目标栈 id;缺省表示标记全部类型 / 全部栈
|
|
386
400
|
*/
|
|
@@ -458,14 +472,33 @@ class History extends BaseService {
|
|
|
458
472
|
|
|
459
473
|
/**
|
|
460
474
|
* 用 {@link serialize} 导出的快照重建全部撤销/重做栈,会整体覆盖当前内存中的历史状态。
|
|
475
|
+
*
|
|
476
|
+
* 单个栈 / 单个类型的快照损坏只丢弃该部分,其余照常还原;
|
|
477
|
+
* 快照里的栈全部还原失败时抛出首个错误,此时内存中的历史状态保持不变
|
|
478
|
+
* (不会把「什么都没恢复」当成一次成功的还原)。
|
|
461
479
|
*/
|
|
462
480
|
public restore(snapshot: PersistedHistoryState): PersistedHistoryState {
|
|
463
481
|
// 各 step 的 diff 以序列化字符串存储(含函数),由 deserializeStacks 逐条用 parseDSL 还原。
|
|
464
482
|
const steps: HistoryState['steps'] = { page: {}, codeBlock: {}, dataSource: {} };
|
|
483
|
+
let firstError: unknown;
|
|
484
|
+
let stackCount = 0;
|
|
485
|
+
let restoredStackCount = 0;
|
|
486
|
+
|
|
465
487
|
Object.entries(snapshot.steps).forEach(([stepType, bucket]) => {
|
|
466
|
-
|
|
467
|
-
|
|
488
|
+
try {
|
|
489
|
+
// 兼容 jsonSafe 导出的快照(Map 被转成了 entries 数组)
|
|
490
|
+
const restored = deserializeStacks(convertExtraMaps(bucket, true) as any, this.ctx.parseDSL);
|
|
491
|
+
steps[stepType] = restored;
|
|
492
|
+
restoredStackCount += Object.keys(restored).length;
|
|
493
|
+
} catch (error) {
|
|
494
|
+
firstError ??= error;
|
|
495
|
+
}
|
|
496
|
+
stackCount += Object.keys(bucket ?? {}).length;
|
|
468
497
|
});
|
|
498
|
+
|
|
499
|
+
// 空桶恒能还原成功,因此按「快照里有栈但一个都没还原出来」判断整体失败
|
|
500
|
+
if (firstError && stackCount > 0 && restoredStackCount === 0) throw firstError;
|
|
501
|
+
|
|
469
502
|
this.state.steps = steps;
|
|
470
503
|
return snapshot;
|
|
471
504
|
}
|
|
@@ -602,6 +635,20 @@ class History extends BaseService {
|
|
|
602
635
|
return super.emit(eventName, ...args);
|
|
603
636
|
}
|
|
604
637
|
|
|
638
|
+
/**
|
|
639
|
+
* 所有历史类型统一派发 `change`(签名 `(step, stepType, id, isHistoryOp)`);
|
|
640
|
+
* 代码块 / 数据源额外派发文档约定的同构事件(签名 `(id, step, isHistoryOp)`)。
|
|
641
|
+
* `isHistoryOp` 仅在 `undo` / `redo` 时为 true,供业务侧跳过历史回放触发的副作用。
|
|
642
|
+
*/
|
|
643
|
+
private emitStepChange(step: BaseStepValue, stepType: HistoryStepType, id: Id, isHistoryOp = false): void {
|
|
644
|
+
this.emit('change', step, stepType, id, isHistoryOp);
|
|
645
|
+
if (stepType === 'codeBlock') {
|
|
646
|
+
this.emit('code-block-history-change', id, step as CodeBlockStepValue, isHistoryOp);
|
|
647
|
+
} else if (stepType === 'dataSource') {
|
|
648
|
+
this.emit('data-source-history-change', id, step as DataSourceStepValue, isHistoryOp);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
605
652
|
/**
|
|
606
653
|
* 取出指定历史类型的栈桶(`Record<id, UndoRedo>`);不存在时按需创建空桶,
|
|
607
654
|
* 从而支持通过 {@link registerStepType} 或首次 push 动态扩展历史类型。
|
package/src/type.ts
CHANGED
|
@@ -933,6 +933,7 @@ export interface BaseStepValue<T = unknown, U extends Record<string, any> = {}>
|
|
|
933
933
|
* 是否为「整体设置 root」(set root)产生的记录(由 {@link Editor.pushRootDiffHistory} 写入)。
|
|
934
934
|
* 用于「连续 set root 合并」:当某页栈最新一条已是 root 记录时,下一条 set root 会替换它而非新增,
|
|
935
935
|
* 避免源码反复保存 / 外部重设 DSL 时堆积多条 root 记录。
|
|
936
|
+
* 保存后的容量裁剪(见 historyService.markSaved)也不会删除这类记录。
|
|
936
937
|
*/
|
|
937
938
|
rootStep?: boolean;
|
|
938
939
|
/** 操作人 */
|
|
@@ -1383,13 +1384,19 @@ export interface EditorChangeEventHistoryMeta {
|
|
|
1383
1384
|
* 撤销 / 重做路径补发的事件恒为 true(撤销/重做本身不再入栈)。
|
|
1384
1385
|
*/
|
|
1385
1386
|
doNotPushHistory?: boolean;
|
|
1387
|
+
/**
|
|
1388
|
+
* 本次 DSL 变更是否由撤销 / 重做回放产生(缺省为 false)。
|
|
1389
|
+
* 业务侧监听 `change` 做埋点、加锁、自动保存等副作用时,可用它跳过历史回放触发的变更。
|
|
1390
|
+
* 仅由编辑器内部在回放链路设置,不通过 {@link HistoryOpOptions} 等外部入参传入。
|
|
1391
|
+
*/
|
|
1392
|
+
isHistoryOp?: boolean;
|
|
1386
1393
|
}
|
|
1387
1394
|
|
|
1388
1395
|
/**
|
|
1389
1396
|
* {@link EditorEvents.change} 的回调参数:以 `type` 区分操作类型,并携带对应的操作内容。
|
|
1390
1397
|
* `data` 为本次变更的节点列表,每项包含 node 及其所属的 page(可能为 null);
|
|
1391
1398
|
* `move-layer` 额外带层级偏移 `offset`,`drag-to` 额外带目标位置 `targetIndex` / `targetParent`;
|
|
1392
|
-
* 历史相关字段(historySource / doNotPushHistory)见 {@link EditorChangeEventHistoryMeta}。
|
|
1399
|
+
* 历史相关字段(historySource / doNotPushHistory / isHistoryOp)见 {@link EditorChangeEventHistoryMeta}。
|
|
1393
1400
|
*/
|
|
1394
1401
|
export type EditorChangeEvent =
|
|
1395
1402
|
| ({ type: 'add'; data: EditorChangeItem[] } & EditorChangeEventHistoryMeta)
|
|
@@ -1409,9 +1416,13 @@ export interface HistoryEvents {
|
|
|
1409
1416
|
state: BaseStepValue | StepValue | CodeBlockStepValue | DataSourceStepValue,
|
|
1410
1417
|
stepType: HistoryStepType,
|
|
1411
1418
|
id: Id,
|
|
1419
|
+
/** 本次变更是否由 `undo` / `redo` 触发;`push` / `replaceCurrentStep` 为 false */
|
|
1420
|
+
isHistoryOp?: boolean,
|
|
1412
1421
|
];
|
|
1413
|
-
|
|
1414
|
-
'
|
|
1422
|
+
/** 代码块专属事件;`isHistoryOp` 语义同 {@link HistoryEvents.change} 的第四个参数 */
|
|
1423
|
+
'code-block-history-change': [id: Id, state: CodeBlockStepValue, isHistoryOp: boolean];
|
|
1424
|
+
/** 数据源专属事件;`isHistoryOp` 语义同 {@link HistoryEvents.change} 的第四个参数 */
|
|
1425
|
+
'data-source-history-change': [id: Id, state: DataSourceStepValue, isHistoryOp: boolean];
|
|
1415
1426
|
'restore-from-indexed-db': [snapshot: PersistedHistoryState | null];
|
|
1416
1427
|
'save-to-indexed-db': [snapshot: PersistedHistoryState];
|
|
1417
1428
|
'mark-saved': [{ kind: HistoryStepType; id?: Id }];
|
|
@@ -1461,6 +1472,9 @@ export type AsyncMethodName = Writable<(typeof canUsePluginMethods)['async']>;
|
|
|
1461
1472
|
* - doNotPushHistory: 操作完成后是否不要将本次操作压入历史栈(撤销/重做记录),默认 false
|
|
1462
1473
|
* - historyDescription: 入栈时附带的人类可读描述,用于历史面板展示;不影响 undo/redo 行为,缺省时面板会自动生成描述
|
|
1463
1474
|
* - historySource: 操作途径,取值见 {@link HistoryOpSource}(画布 / 树面板 / 组件面板 / 配置面板 / 源码编辑器 / 右键菜单 / 工具栏 / 快捷键 / 回滚 / 接口 等),用于历史面板展示与埋点;不影响 undo/redo 行为
|
|
1475
|
+
*
|
|
1476
|
+
* 注意:`change` 事件上的 `isHistoryOp` 由编辑器在撤销 / 重做回放时内部设置,
|
|
1477
|
+
* 不是本配置的一部分;外部传入不会被读取,避免真实编辑被误标成历史回放。
|
|
1464
1478
|
*/
|
|
1465
1479
|
export interface HistoryOpOptions {
|
|
1466
1480
|
doNotPushHistory?: boolean;
|
|
@@ -1498,9 +1512,11 @@ export interface DslOpOptions extends HistoryOpOptions {
|
|
|
1498
1512
|
* 指定后不再按当前选中节点与上一次新增节点计算锚点,也不要求有选中节点;越界 / 非数字一律追加到末尾。
|
|
1499
1513
|
* 批量 add 时数字下标是本批节点的起始位置,按父容器分别累计偏移,保持传入顺序;'end' 逐个追加。
|
|
1500
1514
|
* 页面 / 页面片作用于 root.items,同样不再固定追加到末尾。人工添加不传,沿用锚点行为。
|
|
1515
|
+
* - doNotFixPosition: 跳过按画布尺寸修正节点位置(left / top),程序化 add 传入的设计坐标原样保留。
|
|
1501
1516
|
*/
|
|
1502
1517
|
export interface AddOpOptions extends DslOpOptions {
|
|
1503
1518
|
insertIndex?: number | 'end';
|
|
1519
|
+
doNotFixPosition?: boolean;
|
|
1504
1520
|
}
|
|
1505
1521
|
// #endregion AddOpOptions
|
|
1506
1522
|
|