@tmagic/editor 1.8.0-beta.7 → 1.8.0-manmanyu.10
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 +15 -5
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +11 -7
- package/dist/es/components/ContentMenu.vue_vue_type_script_setup_true_lang.js +12 -5
- package/dist/es/components/FloatingBox.vue_vue_type_script_setup_true_lang.js +11 -6
- package/dist/es/components/Icon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Resizer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ScrollBar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ScrollViewer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SearchInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/SplitView.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Tree.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/TreeNode.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +69 -44
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +6 -2
- package/dist/es/fields/CondOpSelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +11 -8
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/es/fields/DataSourceInput.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +5 -2
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DisplayConds.vue_vue_type_script_setup_true_lang.js +9 -3
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +102 -65
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/PageFragmentSelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/StyleSetter/Index.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/es/fields/StyleSetter/components/BackgroundPosition.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/fields/StyleSetter/components/Box.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/icons/align-items/Center.js +31 -0
- package/dist/es/fields/StyleSetter/icons/align-items/FlexEnd.js +31 -0
- package/dist/es/fields/StyleSetter/icons/align-items/FlexStart.js +31 -0
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceAround.js +50 -0
- package/dist/es/fields/StyleSetter/icons/align-items/SpaceBetween.js +50 -0
- package/dist/es/fields/StyleSetter/icons/background-repeat/NoRepeat.js +7 -7
- package/dist/es/fields/StyleSetter/icons/background-repeat/Repeat.js +6 -3
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatX.js +29 -6
- package/dist/es/fields/StyleSetter/icons/background-repeat/RepeatY.js +32 -6
- package/dist/es/fields/StyleSetter/icons/display/Block.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Flex.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/Inline.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/InlineBlock.js +1 -1
- package/dist/es/fields/StyleSetter/icons/display/None.js +1 -1
- package/dist/es/fields/StyleSetter/icons/flex-direction/Column.js +11 -3
- package/dist/es/fields/StyleSetter/icons/flex-direction/ColumnReverse.js +11 -3
- package/dist/es/fields/StyleSetter/icons/flex-direction/Row.js +11 -3
- package/dist/es/fields/StyleSetter/icons/flex-direction/RowReverse.js +11 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/Center.js +17 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexEnd.js +19 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/FlexStart.js +19 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceAround.js +37 -3
- package/dist/es/fields/StyleSetter/icons/justify-content/SpaceBetween.js +33 -3
- package/dist/es/fields/StyleSetter/icons/text-align/Center.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Left.js +1 -1
- package/dist/es/fields/StyleSetter/icons/text-align/Right.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Background.vue_vue_type_script_setup_true_lang.js +12 -7
- package/dist/es/fields/StyleSetter/pro/Border.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Font.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/es/fields/StyleSetter/pro/Layout.vue_vue_type_script_setup_true_lang.js +83 -47
- package/dist/es/fields/StyleSetter/pro/Position.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/StyleSetter/pro/Transform.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/icons/CenterIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/CodeIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/icons/DatasourceIcon.js +17 -0
- package/dist/es/icons/FolderMinusIcon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/index.js +6 -4
- package/dist/es/layouts/AddPageBox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +15 -11
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/NavMenuColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/Bucket.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/BucketTab.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +39 -27
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +6 -2
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +159 -302
- package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/PageTab.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/composables.js +23 -55
- package/dist/es/layouts/history-list/useHistoryList.js +56 -0
- package/dist/es/layouts/history-list/useHistoryRevert.js +304 -0
- package/dist/es/layouts/page-bar/AddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageBar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageBarScrollContainer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/PageList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/page-bar/Search.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/props-panel/FormPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +11 -2
- package/dist/es/layouts/sidebar/ComponentListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/code-block/CodeBlockList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/code-block/CodeBlockListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceAddButton.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/layouts/sidebar/data-source/DataSourceList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerNodeTool.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/layer/LayerPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/Breadcrumb.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/Workspace.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/workspace/viewer/ViewerMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/services/codeBlock.js +32 -28
- package/dist/es/services/dataSource.js +43 -34
- package/dist/es/services/editor.js +31 -26
- package/dist/es/services/history.js +268 -384
- package/dist/es/style.css +306 -37
- package/dist/es/utils/const.js +1 -1
- package/dist/es/utils/dep/worker.js +1 -1
- package/dist/es/utils/history.js +35 -47
- package/dist/es/utils/props.js +48 -29
- package/dist/style.css +306 -37
- package/dist/themes/magic-admin.css +2805 -0
- package/dist/tmagic-editor.umd.cjs +6855 -5579
- package/package.json +8 -8
- package/src/Editor.vue +13 -1
- package/src/components/CompareForm.vue +14 -6
- package/src/components/ContentMenu.vue +10 -2
- package/src/components/FloatingBox.vue +13 -2
- package/src/editorProps.ts +9 -0
- package/src/fields/CodeSelect.vue +51 -40
- package/src/fields/CodeSelectCol.vue +1 -0
- package/src/fields/DataSourceFieldSelect/Index.vue +14 -5
- package/src/fields/DisplayConds.vue +4 -1
- package/src/fields/EventSelect.vue +58 -32
- package/src/fields/StyleSetter/Index.vue +1 -4
- package/src/fields/StyleSetter/components/Border.vue +1 -1
- package/src/fields/StyleSetter/icons/align-items/Center.vue +19 -0
- package/src/fields/StyleSetter/icons/align-items/FlexEnd.vue +19 -0
- package/src/fields/StyleSetter/icons/align-items/FlexStart.vue +19 -0
- package/src/fields/StyleSetter/icons/align-items/SpaceAround.vue +34 -0
- package/src/fields/StyleSetter/icons/align-items/SpaceBetween.vue +34 -0
- package/src/fields/StyleSetter/icons/align-items/index copy.ts +5 -0
- package/src/fields/StyleSetter/icons/align-items/index.ts +5 -0
- package/src/fields/StyleSetter/icons/background-repeat/NoRepeat.vue +20 -4
- package/src/fields/StyleSetter/icons/background-repeat/Repeat.vue +10 -28
- package/src/fields/StyleSetter/icons/background-repeat/RepeatX.vue +4 -5
- package/src/fields/StyleSetter/icons/background-repeat/RepeatY.vue +4 -5
- package/src/fields/StyleSetter/icons/flex-direction/Column.vue +4 -3
- package/src/fields/StyleSetter/icons/flex-direction/ColumnReverse.vue +4 -3
- package/src/fields/StyleSetter/icons/flex-direction/Row.vue +4 -3
- package/src/fields/StyleSetter/icons/flex-direction/RowReverse.vue +4 -3
- package/src/fields/StyleSetter/icons/justify-content/Center.vue +5 -2
- package/src/fields/StyleSetter/icons/justify-content/FlexEnd.vue +15 -2
- package/src/fields/StyleSetter/icons/justify-content/FlexStart.vue +15 -2
- package/src/fields/StyleSetter/icons/justify-content/SpaceAround.vue +28 -3
- package/src/fields/StyleSetter/icons/justify-content/SpaceBetween.vue +28 -2
- package/src/fields/StyleSetter/pro/Background.vue +11 -5
- package/src/fields/StyleSetter/pro/Font.vue +3 -3
- package/src/fields/StyleSetter/pro/Layout.vue +105 -28
- package/src/fields/UISelect.vue +1 -1
- package/src/icons/DatasourceIcon.vue +7 -0
- package/src/index.ts +2 -0
- package/src/layouts/Framework.vue +7 -1
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/history-list/GroupRow.vue +10 -0
- package/src/layouts/history-list/HistoryDiffDialog.vue +6 -1
- package/src/layouts/history-list/HistoryListPanel.vue +53 -250
- package/src/layouts/history-list/PageTab.vue +4 -4
- package/src/layouts/history-list/composables.ts +52 -90
- package/src/layouts/history-list/useHistoryList.ts +60 -0
- package/src/layouts/history-list/useHistoryRevert.ts +400 -0
- package/src/layouts/props-panel/PropsPanel.vue +19 -1
- package/src/services/codeBlock.ts +30 -29
- package/src/services/dataSource.ts +37 -37
- package/src/services/editor.ts +32 -29
- package/src/services/history.ts +340 -430
- package/src/theme/code-block.scss +37 -0
- package/src/theme/common/var.scss +1 -1
- package/src/theme/component-list-panel.scss +2 -2
- package/src/theme/data-source-field.scss +4 -0
- package/src/theme/display-conds.scss +11 -0
- package/src/theme/event.scss +55 -1
- package/src/theme/history-list-panel.scss +23 -9
- package/src/theme/props-panel.scss +2 -1
- package/src/theme/style-setter/border.scss +14 -5
- package/src/theme/theme.scss +1 -0
- package/src/theme/themes/magic-admin/index.scss +124 -0
- package/src/type.ts +174 -92
- package/src/utils/const.ts +2 -1
- package/src/utils/history.ts +52 -67
- package/src/utils/props.ts +30 -9
- package/types/index.d.ts +471 -287
package/dist/es/layouts/sidebar/data-source/DataSourceList.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -8,7 +8,7 @@ import { DepTargetType } from "@tmagic/core";
|
|
|
8
8
|
import { computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, renderSlot, toDisplayString, unref, withCtx, withModifiers } from "vue";
|
|
9
9
|
import { Close, Edit, View } from "@element-plus/icons-vue";
|
|
10
10
|
//#region packages/editor/src/layouts/sidebar/data-source/DataSourceList.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
-
var DataSourceList_vue_vue_type_script_setup_true_lang_default =
|
|
11
|
+
var DataSourceList_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
12
12
|
name: "MEditorDataSourceList",
|
|
13
13
|
__name: "DataSourceList",
|
|
14
14
|
props: {
|
|
@@ -11,7 +11,7 @@ import { Fragment, Teleport, computed, createBlock, createCommentVNode, createEl
|
|
|
11
11
|
import { mergeWith } from "lodash-es";
|
|
12
12
|
//#region packages/editor/src/layouts/sidebar/data-source/DataSourceListPanel.vue?vue&type=script&setup=true&lang.ts
|
|
13
13
|
var _hoisted_1 = { class: "search-wrapper" };
|
|
14
|
-
var DataSourceListPanel_vue_vue_type_script_setup_true_lang_default =
|
|
14
|
+
var DataSourceListPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
15
15
|
name: "MEditorDataSourceListPanel",
|
|
16
16
|
__name: "DataSourceListPanel",
|
|
17
17
|
props: {
|
|
@@ -6,7 +6,7 @@ import { isPage, isPageFragment } from "@tmagic/utils";
|
|
|
6
6
|
import { computed, createBlock, defineComponent, markRaw, openBlock, useTemplateRef } from "vue";
|
|
7
7
|
import { Files, Plus } from "@element-plus/icons-vue";
|
|
8
8
|
//#region packages/editor/src/layouts/sidebar/layer/LayerMenu.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var LayerMenu_vue_vue_type_script_setup_true_lang_default =
|
|
9
|
+
var LayerMenu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
10
10
|
name: "MEditorLayerMenu",
|
|
11
11
|
__name: "LayerMenu",
|
|
12
12
|
props: {
|
|
@@ -3,7 +3,7 @@ import { TMagicButton } from "@tmagic/design";
|
|
|
3
3
|
import { createBlock, createCommentVNode, defineComponent, openBlock, unref, withModifiers } from "vue";
|
|
4
4
|
import { Hide, View } from "@element-plus/icons-vue";
|
|
5
5
|
//#region packages/editor/src/layouts/sidebar/layer/LayerNodeTool.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var LayerNodeTool_vue_vue_type_script_setup_true_lang_default =
|
|
6
|
+
var LayerNodeTool_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
7
7
|
__name: "LayerNodeTool",
|
|
8
8
|
props: { data: {} },
|
|
9
9
|
setup(__props) {
|
|
@@ -11,7 +11,7 @@ import { useNodeStatus } from "./use-node-status.js";
|
|
|
11
11
|
import { TMagicScrollbar } from "@tmagic/design";
|
|
12
12
|
import { Teleport, computed, createBlock, createCommentVNode, createVNode, defineComponent, openBlock, renderSlot, unref, useTemplateRef, withCtx } from "vue";
|
|
13
13
|
//#region packages/editor/src/layouts/sidebar/layer/LayerPanel.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
-
var LayerPanel_vue_vue_type_script_setup_true_lang_default =
|
|
14
|
+
var LayerPanel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
15
15
|
name: "MEditorLayerPanel",
|
|
16
16
|
__name: "LayerPanel",
|
|
17
17
|
props: {
|
|
@@ -12,7 +12,7 @@ var _hoisted_2 = {
|
|
|
12
12
|
class: "m-editor-breadcrumb-separator"
|
|
13
13
|
};
|
|
14
14
|
var COLLAPSE_RATIO = .8;
|
|
15
|
-
var Breadcrumb_vue_vue_type_script_setup_true_lang_default =
|
|
15
|
+
var Breadcrumb_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
16
16
|
name: "MEditorBreadcrumb",
|
|
17
17
|
__name: "Breadcrumb",
|
|
18
18
|
setup(__props) {
|
|
@@ -4,7 +4,7 @@ import Breadcrumb_default from "./Breadcrumb.js";
|
|
|
4
4
|
import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, inject, openBlock, renderSlot, unref, withCtx } from "vue";
|
|
5
5
|
//#region packages/editor/src/layouts/workspace/Workspace.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var _hoisted_1 = { class: "m-editor-workspace" };
|
|
7
|
-
var Workspace_vue_vue_type_script_setup_true_lang_default =
|
|
7
|
+
var Workspace_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
8
8
|
name: "MEditorWorkspace",
|
|
9
9
|
__name: "Workspace",
|
|
10
10
|
props: {
|
package/dist/es/layouts/workspace/viewer/NodeListMenu.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -7,7 +7,7 @@ import { TMagicTooltip } from "@tmagic/design";
|
|
|
7
7
|
import { getIdFromEl } from "@tmagic/utils";
|
|
8
8
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, nextTick, openBlock, ref, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
9
9
|
//#region packages/editor/src/layouts/workspace/viewer/NodeListMenu.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var NodeListMenu_vue_vue_type_script_setup_true_lang_default =
|
|
10
|
+
var NodeListMenu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
11
11
|
__name: "NodeListMenu",
|
|
12
12
|
setup(__props) {
|
|
13
13
|
const services = useServices();
|
|
@@ -11,7 +11,7 @@ import { getOffset } from "@tmagic/stage";
|
|
|
11
11
|
import { calcValueByFontsize, getIdFromEl } from "@tmagic/utils";
|
|
12
12
|
import { Teleport, computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, markRaw, nextTick, normalizeStyle, onBeforeUnmount, onMounted, openBlock, renderSlot, resolveDirective, useTemplateRef, watch, watchEffect, withCtx, withDirectives } from "vue";
|
|
13
13
|
//#region packages/editor/src/layouts/workspace/viewer/Stage.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
-
var Stage_vue_vue_type_script_setup_true_lang_default =
|
|
14
|
+
var Stage_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
15
15
|
name: "MEditorStage",
|
|
16
16
|
__name: "Stage",
|
|
17
17
|
props: {
|
package/dist/es/layouts/workspace/viewer/StageOverlay.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -8,7 +8,7 @@ var _hoisted_1 = {
|
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "m-editor-stage-overlay"
|
|
10
10
|
};
|
|
11
|
-
var StageOverlay_vue_vue_type_script_setup_true_lang_default =
|
|
11
|
+
var StageOverlay_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
12
12
|
__name: "StageOverlay",
|
|
13
13
|
setup(__props) {
|
|
14
14
|
const { stageOverlayService, editorService, uiService } = useServices();
|
|
@@ -8,7 +8,7 @@ import { NodeType } from "@tmagic/core";
|
|
|
8
8
|
import { computed, createBlock, defineComponent, markRaw, openBlock, ref, useTemplateRef, watch } from "vue";
|
|
9
9
|
import { Bottom, Top } from "@element-plus/icons-vue";
|
|
10
10
|
//#region packages/editor/src/layouts/workspace/viewer/ViewerMenu.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
-
var ViewerMenu_vue_vue_type_script_setup_true_lang_default =
|
|
11
|
+
var ViewerMenu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
12
12
|
name: "MEditorViewerMenu",
|
|
13
13
|
__name: "ViewerMenu",
|
|
14
14
|
props: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CODE_DRAFT_STORAGE_KEY } from "../type.js";
|
|
2
2
|
import BaseService from "./BaseService.js";
|
|
3
3
|
import { getEditorConfig } from "../utils/config.js";
|
|
4
|
-
import { describeRevertStep, getLastPushedHistoryIds } from "../utils/history.js";
|
|
4
|
+
import { createStackStep, describeRevertStep, getLastPushedHistoryIds } from "../utils/history.js";
|
|
5
5
|
import history_default from "./history.js";
|
|
6
6
|
import storage_default, { Protocol } from "./storage.js";
|
|
7
7
|
import { COPY_CODE_STORAGE_KEY } from "../utils/editor.js";
|
|
@@ -121,13 +121,16 @@ var CodeBlock = class extends BaseService {
|
|
|
121
121
|
...codeConfigProcessed
|
|
122
122
|
};
|
|
123
123
|
const newContent = cloneDeep$1(codeDsl[id]);
|
|
124
|
-
if (!doNotPushHistory)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
if (!doNotPushHistory) {
|
|
125
|
+
const step = createStackStep(id, {
|
|
126
|
+
oldValue: oldContent,
|
|
127
|
+
newValue: newContent,
|
|
128
|
+
changeRecords,
|
|
129
|
+
historyDescription,
|
|
130
|
+
source: historySource
|
|
131
|
+
});
|
|
132
|
+
this.lastPushedHistoryId = (step ? history_default.push("codeBlock", step, id) : null)?.uuid ?? null;
|
|
133
|
+
}
|
|
131
134
|
this.emit("addOrUpdate", id, codeDsl[id]);
|
|
132
135
|
}
|
|
133
136
|
/**
|
|
@@ -212,15 +215,16 @@ var CodeBlock = class extends BaseService {
|
|
|
212
215
|
if (!currentDsl) return;
|
|
213
216
|
this.lastDeletedHistoryIds = [];
|
|
214
217
|
codeIds.forEach((id) => {
|
|
215
|
-
const
|
|
218
|
+
const oldValue = currentDsl[id] ? cloneDeep$1(currentDsl[id]) : null;
|
|
216
219
|
delete currentDsl[id];
|
|
217
|
-
if (
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
if (oldValue && !doNotPushHistory) {
|
|
221
|
+
const step = createStackStep(id, {
|
|
222
|
+
oldValue,
|
|
223
|
+
newValue: null,
|
|
221
224
|
historyDescription,
|
|
222
225
|
source: historySource
|
|
223
|
-
})
|
|
226
|
+
});
|
|
227
|
+
const uuid = step ? history_default.push("codeBlock", step, id)?.uuid : void 0;
|
|
224
228
|
if (uuid) this.lastDeletedHistoryIds.push(uuid);
|
|
225
229
|
}
|
|
226
230
|
this.emit("remove", id);
|
|
@@ -281,7 +285,7 @@ var CodeBlock = class extends BaseService {
|
|
|
281
285
|
* @returns 撤销的 step;栈不存在或已无可撤销时返回 null
|
|
282
286
|
*/
|
|
283
287
|
async undo(id) {
|
|
284
|
-
const step = history_default.
|
|
288
|
+
const step = history_default.undo("codeBlock", id);
|
|
285
289
|
if (!step) return null;
|
|
286
290
|
await this.applyHistoryStep(step, true);
|
|
287
291
|
return step;
|
|
@@ -292,18 +296,18 @@ var CodeBlock = class extends BaseService {
|
|
|
292
296
|
* @returns 重做的 step;栈不存在或已无可重做时返回 null
|
|
293
297
|
*/
|
|
294
298
|
async redo(id) {
|
|
295
|
-
const step = history_default.
|
|
299
|
+
const step = history_default.redo("codeBlock", id);
|
|
296
300
|
if (!step) return null;
|
|
297
301
|
await this.applyHistoryStep(step, false);
|
|
298
302
|
return step;
|
|
299
303
|
}
|
|
300
304
|
/** 是否可对指定代码块撤销。 */
|
|
301
305
|
canUndo(id) {
|
|
302
|
-
return history_default.
|
|
306
|
+
return history_default.canUndo("codeBlock", id);
|
|
303
307
|
}
|
|
304
308
|
/** 是否可对指定代码块重做。 */
|
|
305
309
|
canRedo(id) {
|
|
306
|
-
return history_default.
|
|
310
|
+
return history_default.canRedo("codeBlock", id);
|
|
307
311
|
}
|
|
308
312
|
/**
|
|
309
313
|
* 跳转指定代码块的历史栈到目标游标。语义同 editor.gotoPageStep。
|
|
@@ -313,7 +317,7 @@ var CodeBlock = class extends BaseService {
|
|
|
313
317
|
* @returns 实际移动到的最终游标位置
|
|
314
318
|
*/
|
|
315
319
|
async goto(id, targetCursor) {
|
|
316
|
-
let cursor = history_default.
|
|
320
|
+
let cursor = history_default.getCursor("codeBlock", id);
|
|
317
321
|
const target = Math.max(0, targetCursor);
|
|
318
322
|
while (cursor > target) {
|
|
319
323
|
if (!await this.undo(id)) break;
|
|
@@ -336,11 +340,11 @@ var CodeBlock = class extends BaseService {
|
|
|
336
340
|
* @returns 反向后产生的新 step;目标不存在 / 未应用时返回 null
|
|
337
341
|
*/
|
|
338
342
|
async revert(id, index) {
|
|
339
|
-
const entry = history_default.
|
|
343
|
+
const entry = history_default.getStepList("codeBlock", id)[index];
|
|
340
344
|
if (!entry?.applied) return null;
|
|
341
345
|
const { oldSchema, newSchema, changeRecords } = entry.step.diff?.[0] ?? {};
|
|
342
346
|
if (oldSchema && newSchema && !changeRecords?.length) return null;
|
|
343
|
-
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.id, entry.step.diff?.[0], (s) => s.name)}`;
|
|
347
|
+
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.data.id, entry.step.diff?.[0], (s) => s.name)}`;
|
|
344
348
|
return await this.applyRevertStep(entry.step, description);
|
|
345
349
|
}
|
|
346
350
|
/**
|
|
@@ -353,7 +357,7 @@ var CodeBlock = class extends BaseService {
|
|
|
353
357
|
async revertById(uuids) {
|
|
354
358
|
const results = [];
|
|
355
359
|
for (const uuid of uuids) {
|
|
356
|
-
const location = history_default.
|
|
360
|
+
const location = history_default.findStepLocationByUuid("codeBlock", uuid);
|
|
357
361
|
results.push(location ? await this.revert(location.id, location.index) : null);
|
|
358
362
|
}
|
|
359
363
|
return results;
|
|
@@ -423,21 +427,21 @@ var CodeBlock = class extends BaseService {
|
|
|
423
427
|
* 差异仅在于通过公开的 setCodeDslByIdSync / deleteCodeDslByIds 触发 push。
|
|
424
428
|
*/
|
|
425
429
|
async applyRevertStep(step, historyDescription) {
|
|
426
|
-
const { id } = step;
|
|
430
|
+
const { id } = step.data;
|
|
427
431
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
428
432
|
if (!oldSchema && newSchema) {
|
|
429
433
|
await this.deleteCodeDslByIds([id], {
|
|
430
434
|
historyDescription,
|
|
431
435
|
historySource: "rollback"
|
|
432
436
|
});
|
|
433
|
-
return history_default.
|
|
437
|
+
return history_default.getStepList("codeBlock", id).slice(-1)[0]?.step ?? null;
|
|
434
438
|
}
|
|
435
439
|
if (oldSchema && !newSchema) {
|
|
436
440
|
this.setCodeDslByIdSync(id, cloneDeep$1(oldSchema), true, {
|
|
437
441
|
historyDescription,
|
|
438
442
|
historySource: "rollback"
|
|
439
443
|
});
|
|
440
|
-
return history_default.
|
|
444
|
+
return history_default.getStepList("codeBlock", id).slice(-1)[0]?.step ?? null;
|
|
441
445
|
}
|
|
442
446
|
if (!oldSchema || !newSchema) return null;
|
|
443
447
|
if (changeRecords?.length) {
|
|
@@ -458,13 +462,13 @@ var CodeBlock = class extends BaseService {
|
|
|
458
462
|
historyDescription,
|
|
459
463
|
historySource: "rollback"
|
|
460
464
|
});
|
|
461
|
-
return history_default.
|
|
465
|
+
return history_default.getStepList("codeBlock", id).slice(-1)[0]?.step ?? null;
|
|
462
466
|
}
|
|
463
467
|
this.setCodeDslByIdSync(id, cloneDeep$1(oldSchema), true, {
|
|
464
468
|
historyDescription,
|
|
465
469
|
historySource: "rollback"
|
|
466
470
|
});
|
|
467
|
-
return history_default.
|
|
471
|
+
return history_default.getStepList("codeBlock", id).slice(-1)[0]?.step ?? null;
|
|
468
472
|
}
|
|
469
473
|
/**
|
|
470
474
|
* 把一条历史 step 应用到当前代码块服务上。
|
|
@@ -481,7 +485,7 @@ var CodeBlock = class extends BaseService {
|
|
|
481
485
|
* @param reverse true=撤销,false=重做
|
|
482
486
|
*/
|
|
483
487
|
async applyHistoryStep(step, reverse) {
|
|
484
|
-
const { id } = step;
|
|
488
|
+
const { id } = step.data;
|
|
485
489
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
486
490
|
if (!oldSchema && newSchema) {
|
|
487
491
|
if (reverse) await this.deleteCodeDslByIds([id], { doNotPushHistory: true });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseService from "./BaseService.js";
|
|
2
|
-
import { describeRevertStep, getLastPushedHistoryIds } from "../utils/history.js";
|
|
2
|
+
import { createStackStep, describeRevertStep, getLastPushedHistoryIds } from "../utils/history.js";
|
|
3
3
|
import history_default from "./history.js";
|
|
4
4
|
import storage_default, { Protocol } from "./storage.js";
|
|
5
5
|
import { COPY_DS_STORAGE_KEY } from "../utils/editor.js";
|
|
@@ -92,12 +92,15 @@ var DataSource = class extends BaseService {
|
|
|
92
92
|
id: config.id && !this.getDataSourceById(config.id) ? config.id : this.createId()
|
|
93
93
|
};
|
|
94
94
|
this.get("dataSources").push(newConfig);
|
|
95
|
-
if (!doNotPushHistory)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
if (!doNotPushHistory) {
|
|
96
|
+
const step = createStackStep(newConfig.id, {
|
|
97
|
+
oldValue: null,
|
|
98
|
+
newValue: newConfig,
|
|
99
|
+
historyDescription,
|
|
100
|
+
source: historySource
|
|
101
|
+
});
|
|
102
|
+
this.lastPushedHistoryId = (step ? history_default.push("dataSource", step, newConfig.id) : null)?.uuid ?? null;
|
|
103
|
+
}
|
|
101
104
|
this.emit("add", newConfig);
|
|
102
105
|
return newConfig;
|
|
103
106
|
}
|
|
@@ -115,13 +118,16 @@ var DataSource = class extends BaseService {
|
|
|
115
118
|
const oldConfig = dataSources[index];
|
|
116
119
|
const newConfig = cloneDeep$1(config);
|
|
117
120
|
dataSources[index] = newConfig;
|
|
118
|
-
if (!doNotPushHistory)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
if (!doNotPushHistory) {
|
|
122
|
+
const step = createStackStep(newConfig.id, {
|
|
123
|
+
oldValue: oldConfig ? cloneDeep$1(oldConfig) : null,
|
|
124
|
+
newValue: newConfig,
|
|
125
|
+
changeRecords,
|
|
126
|
+
historyDescription,
|
|
127
|
+
source: historySource
|
|
128
|
+
});
|
|
129
|
+
this.lastPushedHistoryId = (step ? history_default.push("dataSource", step, newConfig.id) : null)?.uuid ?? null;
|
|
130
|
+
}
|
|
125
131
|
this.emit("update", newConfig, {
|
|
126
132
|
oldConfig,
|
|
127
133
|
changeRecords
|
|
@@ -140,12 +146,15 @@ var DataSource = class extends BaseService {
|
|
|
140
146
|
const index = dataSources.findIndex((ds) => ds.id === id);
|
|
141
147
|
const oldConfig = index !== -1 ? dataSources[index] : null;
|
|
142
148
|
dataSources.splice(index, 1);
|
|
143
|
-
if (oldConfig && !doNotPushHistory)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
if (oldConfig && !doNotPushHistory) {
|
|
150
|
+
const step = createStackStep(id, {
|
|
151
|
+
oldValue: cloneDeep$1(oldConfig),
|
|
152
|
+
newValue: null,
|
|
153
|
+
historyDescription,
|
|
154
|
+
source: historySource
|
|
155
|
+
});
|
|
156
|
+
this.lastPushedHistoryId = (step ? history_default.push("dataSource", step, id) : null)?.uuid ?? null;
|
|
157
|
+
}
|
|
149
158
|
this.emit("remove", id);
|
|
150
159
|
}
|
|
151
160
|
/**
|
|
@@ -191,7 +200,7 @@ var DataSource = class extends BaseService {
|
|
|
191
200
|
* @returns 撤销的 step;栈不存在或已无可撤销时返回 null
|
|
192
201
|
*/
|
|
193
202
|
undo(id) {
|
|
194
|
-
const step = history_default.
|
|
203
|
+
const step = history_default.undo("dataSource", id);
|
|
195
204
|
if (!step) return null;
|
|
196
205
|
this.applyHistoryStep(step, true);
|
|
197
206
|
return step;
|
|
@@ -202,18 +211,18 @@ var DataSource = class extends BaseService {
|
|
|
202
211
|
* @returns 重做的 step;栈不存在或已无可重做时返回 null
|
|
203
212
|
*/
|
|
204
213
|
redo(id) {
|
|
205
|
-
const step = history_default.
|
|
214
|
+
const step = history_default.redo("dataSource", id);
|
|
206
215
|
if (!step) return null;
|
|
207
216
|
this.applyHistoryStep(step, false);
|
|
208
217
|
return step;
|
|
209
218
|
}
|
|
210
219
|
/** 是否可对指定数据源撤销。 */
|
|
211
220
|
canUndo(id) {
|
|
212
|
-
return history_default.
|
|
221
|
+
return history_default.canUndo("dataSource", id);
|
|
213
222
|
}
|
|
214
223
|
/** 是否可对指定数据源重做。 */
|
|
215
224
|
canRedo(id) {
|
|
216
|
-
return history_default.
|
|
225
|
+
return history_default.canRedo("dataSource", id);
|
|
217
226
|
}
|
|
218
227
|
/**
|
|
219
228
|
* 跳转指定数据源的历史栈到目标游标。语义同 editor.gotoPageStep。
|
|
@@ -223,7 +232,7 @@ var DataSource = class extends BaseService {
|
|
|
223
232
|
* @returns 实际移动到的最终游标位置
|
|
224
233
|
*/
|
|
225
234
|
goto(id, targetCursor) {
|
|
226
|
-
let cursor = history_default.
|
|
235
|
+
let cursor = history_default.getCursor("dataSource", id);
|
|
227
236
|
const target = Math.max(0, targetCursor);
|
|
228
237
|
while (cursor > target) {
|
|
229
238
|
if (!this.undo(id)) break;
|
|
@@ -246,11 +255,11 @@ var DataSource = class extends BaseService {
|
|
|
246
255
|
* @returns 反向后产生的新 step;目标不存在 / 未应用时返回 null
|
|
247
256
|
*/
|
|
248
257
|
revert(id, index) {
|
|
249
|
-
const entry = history_default.
|
|
258
|
+
const entry = history_default.getStepList("dataSource", id)[index];
|
|
250
259
|
if (!entry?.applied) return null;
|
|
251
260
|
const { oldSchema, newSchema, changeRecords } = entry.step.diff?.[0] ?? {};
|
|
252
261
|
if (oldSchema && newSchema && !changeRecords?.length) return null;
|
|
253
|
-
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.id, entry.step.diff?.[0], (s) => s.title)}`;
|
|
262
|
+
const description = `回滚 #${index + 1}: ${describeRevertStep(entry.step.data.id, entry.step.diff?.[0], (s) => s.title)}`;
|
|
254
263
|
return this.applyRevertStep(entry.step, description);
|
|
255
264
|
}
|
|
256
265
|
/**
|
|
@@ -262,7 +271,7 @@ var DataSource = class extends BaseService {
|
|
|
262
271
|
*/
|
|
263
272
|
revertById(uuids) {
|
|
264
273
|
return uuids.map((uuid) => {
|
|
265
|
-
const location = history_default.
|
|
274
|
+
const location = history_default.findStepLocationByUuid("dataSource", uuid);
|
|
266
275
|
if (!location) return null;
|
|
267
276
|
return this.revert(location.id, location.index);
|
|
268
277
|
});
|
|
@@ -325,21 +334,21 @@ var DataSource = class extends BaseService {
|
|
|
325
334
|
* 同构,差异仅在于走对应的公共 add / update / remove 而不是带 doNotPushHistory 的版本。
|
|
326
335
|
*/
|
|
327
336
|
applyRevertStep(step, historyDescription) {
|
|
328
|
-
const { id } = step;
|
|
337
|
+
const { id } = step.data;
|
|
329
338
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
330
339
|
if (!oldSchema && newSchema) {
|
|
331
340
|
this.remove(`${id}`, {
|
|
332
341
|
historyDescription,
|
|
333
342
|
historySource: "rollback"
|
|
334
343
|
});
|
|
335
|
-
return history_default.
|
|
344
|
+
return history_default.getStepList("dataSource", id).slice(-1)[0]?.step ?? null;
|
|
336
345
|
}
|
|
337
346
|
if (oldSchema && !newSchema) {
|
|
338
347
|
this.add(cloneDeep$1(oldSchema), {
|
|
339
348
|
historyDescription,
|
|
340
349
|
historySource: "rollback"
|
|
341
350
|
});
|
|
342
|
-
return history_default.
|
|
351
|
+
return history_default.getStepList("dataSource", id).slice(-1)[0]?.step ?? null;
|
|
343
352
|
}
|
|
344
353
|
if (!oldSchema || !newSchema) return null;
|
|
345
354
|
if (changeRecords?.length) {
|
|
@@ -360,13 +369,13 @@ var DataSource = class extends BaseService {
|
|
|
360
369
|
historyDescription,
|
|
361
370
|
historySource: "rollback"
|
|
362
371
|
});
|
|
363
|
-
return history_default.
|
|
372
|
+
return history_default.getStepList("dataSource", id).slice(-1)[0]?.step ?? null;
|
|
364
373
|
}
|
|
365
374
|
this.update(cloneDeep$1(oldSchema), {
|
|
366
375
|
historyDescription,
|
|
367
376
|
historySource: "rollback"
|
|
368
377
|
});
|
|
369
|
-
return history_default.
|
|
378
|
+
return history_default.getStepList("dataSource", id).slice(-1)[0]?.step ?? null;
|
|
370
379
|
}
|
|
371
380
|
/**
|
|
372
381
|
* 把一条历史 step 应用到当前数据源服务上。
|
|
@@ -383,7 +392,7 @@ var DataSource = class extends BaseService {
|
|
|
383
392
|
* @param reverse true=撤销,false=重做
|
|
384
393
|
*/
|
|
385
394
|
applyHistoryStep(step, reverse) {
|
|
386
|
-
const { id } = step;
|
|
395
|
+
const { id } = step.data;
|
|
387
396
|
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
388
397
|
if (!oldSchema && newSchema) {
|
|
389
398
|
if (reverse) this.remove(`${id}`, { doNotPushHistory: true });
|
|
@@ -74,7 +74,7 @@ var Editor = class extends BaseService {
|
|
|
74
74
|
this.state.stageLoading = this.state.pageLength !== 0;
|
|
75
75
|
if (preValue && !isEmpty(preValue)) this.pushRootDiffHistory(preValue, app, options.historySource);
|
|
76
76
|
else app.items?.forEach((pageNode) => {
|
|
77
|
-
if (pageNode?.id !== void 0 && !history_default.
|
|
77
|
+
if (pageNode?.id !== void 0 && !history_default.getMarker("page", pageNode.id)) history_default.setMarker("page", pageNode.id, {
|
|
78
78
|
name: pageNode.name,
|
|
79
79
|
source: options.historySource
|
|
80
80
|
});
|
|
@@ -176,8 +176,6 @@ var Editor = class extends BaseService {
|
|
|
176
176
|
this.set("nodes", node ? [node] : []);
|
|
177
177
|
this.set("page", page);
|
|
178
178
|
this.set("parent", parent);
|
|
179
|
-
if (page) history_default.changePage(toRaw(page));
|
|
180
|
-
else history_default.resetState();
|
|
181
179
|
if (node?.id) this.get("stage")?.renderer?.runtime?.getApp?.()?.page?.emit("editor:select", {
|
|
182
180
|
node,
|
|
183
181
|
page,
|
|
@@ -368,10 +366,7 @@ var Editor = class extends BaseService {
|
|
|
368
366
|
if (pages[0]) {
|
|
369
367
|
await this.select(pages[0]);
|
|
370
368
|
stage?.select(pages[0].id);
|
|
371
|
-
} else
|
|
372
|
-
this.selectRoot();
|
|
373
|
-
history_default.resetPage();
|
|
374
|
-
}
|
|
369
|
+
} else this.selectRoot();
|
|
375
370
|
};
|
|
376
371
|
const rootItems = root.items || [];
|
|
377
372
|
if (isPage(node)) {
|
|
@@ -875,7 +870,9 @@ var Editor = class extends BaseService {
|
|
|
875
870
|
* @returns 被撤销的操作
|
|
876
871
|
*/
|
|
877
872
|
async undo() {
|
|
878
|
-
const
|
|
873
|
+
const pageId = this.get("page")?.id;
|
|
874
|
+
if (pageId === void 0) return null;
|
|
875
|
+
const value = history_default.undo("page", pageId);
|
|
879
876
|
if (value) await this.applyHistoryOp(value, true);
|
|
880
877
|
return value;
|
|
881
878
|
}
|
|
@@ -884,7 +881,9 @@ var Editor = class extends BaseService {
|
|
|
884
881
|
* @returns 被恢复的操作
|
|
885
882
|
*/
|
|
886
883
|
async redo() {
|
|
887
|
-
const
|
|
884
|
+
const pageId = this.get("page")?.id;
|
|
885
|
+
if (pageId === void 0) return null;
|
|
886
|
+
const value = history_default.redo("page", pageId);
|
|
888
887
|
if (value) await this.applyHistoryOp(value, false);
|
|
889
888
|
return value;
|
|
890
889
|
}
|
|
@@ -905,7 +904,7 @@ var Editor = class extends BaseService {
|
|
|
905
904
|
* @returns 反向后产生的新 step;目标不存在 / 未应用 / 反向失败时返回 null
|
|
906
905
|
*/
|
|
907
906
|
async revertPageStep(index) {
|
|
908
|
-
const entry = history_default.
|
|
907
|
+
const entry = history_default.getStepList("page", this.get("page")?.id)[index];
|
|
909
908
|
if (!entry?.applied) return null;
|
|
910
909
|
const { step } = entry;
|
|
911
910
|
if (step.opType === "initial") return null;
|
|
@@ -915,7 +914,7 @@ var Editor = class extends BaseService {
|
|
|
915
914
|
if (!items.length || !items.every((item) => item.changeRecords?.length)) return null;
|
|
916
915
|
}
|
|
917
916
|
let revertedStep = null;
|
|
918
|
-
const captureRevert = (s) => {
|
|
917
|
+
const captureRevert = (_pageId, s) => {
|
|
919
918
|
revertedStep = s;
|
|
920
919
|
};
|
|
921
920
|
history_default.once("change", captureRevert);
|
|
@@ -985,9 +984,10 @@ var Editor = class extends BaseService {
|
|
|
985
984
|
*/
|
|
986
985
|
async revertPageStepById(uuids) {
|
|
987
986
|
const results = [];
|
|
987
|
+
const pageId = this.get("page")?.id;
|
|
988
988
|
for (const uuid of uuids) {
|
|
989
|
-
const
|
|
990
|
-
results.push(
|
|
989
|
+
const location = history_default.findStepLocationByUuid("page", uuid, pageId);
|
|
990
|
+
results.push(!location ? null : await this.revertPageStep(location.index));
|
|
991
991
|
}
|
|
992
992
|
return results;
|
|
993
993
|
}
|
|
@@ -1001,8 +1001,9 @@ var Editor = class extends BaseService {
|
|
|
1001
1001
|
* @returns 实际移动到的最终游标位置
|
|
1002
1002
|
*/
|
|
1003
1003
|
async gotoPageStep(targetCursor) {
|
|
1004
|
-
|
|
1005
|
-
|
|
1004
|
+
const pageId = this.get("page")?.id;
|
|
1005
|
+
let cursor = history_default.getCursor("page", pageId);
|
|
1006
|
+
const { length } = history_default.getStepList("page", pageId);
|
|
1006
1007
|
const target = Math.max(0, Math.min(targetCursor, length));
|
|
1007
1008
|
while (cursor > target) {
|
|
1008
1009
|
if (!await this.undo()) break;
|
|
@@ -1117,30 +1118,34 @@ var Editor = class extends BaseService {
|
|
|
1117
1118
|
id: page.id
|
|
1118
1119
|
},
|
|
1119
1120
|
opType,
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1121
|
+
extra: {
|
|
1122
|
+
selectedBefore: [],
|
|
1123
|
+
selectedAfter: [],
|
|
1124
|
+
modifiedNodeIds: /* @__PURE__ */ new Map()
|
|
1125
|
+
},
|
|
1123
1126
|
diff: [diffItem],
|
|
1124
1127
|
rootStep: true
|
|
1125
1128
|
};
|
|
1126
1129
|
if (source) step.source = source;
|
|
1127
1130
|
const top = history_default.getCurrentPageStep(page.id);
|
|
1128
|
-
if (top?.rootStep && top.source === source) history_default.
|
|
1129
|
-
else history_default.push(step, page.id);
|
|
1131
|
+
if (top?.rootStep && top.source === source) history_default.replaceCurrentStep("page", step, page.id);
|
|
1132
|
+
else history_default.push("page", step, page.id);
|
|
1130
1133
|
}
|
|
1131
1134
|
pushOpHistory(opType, { diff, pageData, historyDescription, source }) {
|
|
1132
1135
|
const step = {
|
|
1133
1136
|
uuid: guid(),
|
|
1134
1137
|
data: pageData,
|
|
1135
1138
|
opType,
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
+
extra: {
|
|
1140
|
+
selectedBefore: this.selectionBeforeOp ?? [],
|
|
1141
|
+
selectedAfter: this.get("nodes").map((n) => n.id),
|
|
1142
|
+
modifiedNodeIds: new Map(this.get("modifiedNodeIds"))
|
|
1143
|
+
},
|
|
1139
1144
|
diff
|
|
1140
1145
|
};
|
|
1141
1146
|
if (historyDescription) step.historyDescription = historyDescription;
|
|
1142
1147
|
if (source) step.source = source;
|
|
1143
|
-
const historyId = history_default.push(step, pageData.id) ? step.uuid : null;
|
|
1148
|
+
const historyId = history_default.push("page", step, pageData.id) ? step.uuid : null;
|
|
1144
1149
|
this.lastPushedHistoryId = historyId;
|
|
1145
1150
|
this.selectionBeforeOp = null;
|
|
1146
1151
|
return historyId;
|
|
@@ -1241,10 +1246,10 @@ var Editor = class extends BaseService {
|
|
|
1241
1246
|
break;
|
|
1242
1247
|
}
|
|
1243
1248
|
}
|
|
1244
|
-
this.set("modifiedNodeIds", step.modifiedNodeIds);
|
|
1249
|
+
this.set("modifiedNodeIds", step.extra?.modifiedNodeIds ?? /* @__PURE__ */ new Map());
|
|
1245
1250
|
const page = toRaw(this.get("page"));
|
|
1246
1251
|
if (page) {
|
|
1247
|
-
const selectIds = reverse ? step.selectedBefore : step.selectedAfter;
|
|
1252
|
+
const selectIds = (reverse ? step.extra?.selectedBefore : step.extra?.selectedAfter) ?? [];
|
|
1248
1253
|
setTimeout(() => {
|
|
1249
1254
|
if (!selectIds.length) return;
|
|
1250
1255
|
if (selectIds.length > 1) {
|