@tmagic/editor 1.2.0-beta.18 → 1.2.0-beta.19

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.
@@ -6,7 +6,7 @@ import { HookType, NodeType } from '@tmagic/schema';
6
6
  import { Delete, Close, Edit, Plus, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, View, Link, Search, Files, CopyDocument, Coin, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, DocumentCopy, Top, Bottom } from '@element-plus/icons-vue';
7
7
  import { TMagicButton, TMagicTooltip, TMagicIcon, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, tMagicMessageBox, TMagicCard, TMagicInput, TMagicDialog, TMagicTree, TMagicCollapse, TMagicCollapseItem, getConfig as getConfig$1, TMagicTabs, TMagicPopover } from '@tmagic/design';
8
8
  import * as monaco from 'monaco-editor';
9
- import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS, ContainerHighlightType } from '@tmagic/stage';
9
+ import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
10
10
  import Gesto from 'gesto';
11
11
  import { isPop, getNodePath, isNumber, isPage, toLine, datetimeFormatter, removeClassNameByClassName } from '@tmagic/utils';
12
12
  import { EventEmitter } from 'events';
@@ -1160,6 +1160,7 @@ class History extends BaseService {
1160
1160
  this.state.pageSteps[this.state.pageId] = undoRedo;
1161
1161
  }
1162
1162
  this.setCanUndoRedo();
1163
+ this.emit("page-change", this.state.pageSteps[this.state.pageId]);
1163
1164
  }
1164
1165
  empty() {
1165
1166
  this.state.pageId = void 0;
@@ -1490,7 +1491,7 @@ class Props extends BaseService {
1490
1491
  this.setPropsValue(toLine(type), values[type]);
1491
1492
  });
1492
1493
  }
1493
- setPropsValue(type, value) {
1494
+ async setPropsValue(type, value) {
1494
1495
  this.state.propsValueMap[type] = value;
1495
1496
  }
1496
1497
  async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
@@ -2575,7 +2576,7 @@ const useStage = (stageOptions) => {
2575
2576
  stage.on("highlight", (el) => {
2576
2577
  editorService.highlight(el.id);
2577
2578
  });
2578
- stage.on("multiSelect", (els) => {
2579
+ stage.on("multi-select", (els) => {
2579
2580
  editorService.multiSelect(els.map((el) => el.id));
2580
2581
  });
2581
2582
  stage.on("update", (ev) => {
@@ -2595,7 +2596,7 @@ const useStage = (stageOptions) => {
2595
2596
  editorService.select(parent);
2596
2597
  editorService.get("stage").select(parent.id);
2597
2598
  });
2598
- stage.on("changeGuides", (e) => {
2599
+ stage.on("change-guides", (e) => {
2599
2600
  uiService.set("showGuides", true);
2600
2601
  if (!root.value || !page.value)
2601
2602
  return;
@@ -5472,6 +5473,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5472
5473
  runtime.updateRootConfig?.(cloneDeep(toRaw(root2)));
5473
5474
  }
5474
5475
  });
5476
+ watch(page, (page2) => {
5477
+ if (runtime && page2) {
5478
+ runtime.updatePageId?.(page2.id);
5479
+ nextTick(() => {
5480
+ stage?.select(page2.id);
5481
+ });
5482
+ }
5483
+ });
5475
5484
  const resizeObserver = new ResizeObserver((entries) => {
5476
5485
  for (const { contentRect } of entries) {
5477
5486
  services?.uiService.set("stageContainerRect", {
@@ -5693,10 +5702,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5693
5702
  }, [
5694
5703
  createVNode(_sfc_main$8),
5695
5704
  renderSlot(_ctx.$slots, "stage", {}, () => [
5696
- (openBlock(), createBlock(_sfc_main$2, {
5697
- key: unref(page)?.id,
5705
+ unref(page) ? (openBlock(), createBlock(_sfc_main$2, {
5706
+ key: 0,
5698
5707
  "stage-content-menu": __props.stageContentMenu
5699
- }, null, 8, ["stage-content-menu"]))
5708
+ }, null, 8, ["stage-content-menu"])) : createCommentVNode("", true)
5700
5709
  ]),
5701
5710
  renderSlot(_ctx.$slots, "workspace-content"),
5702
5711
  createVNode(_sfc_main$6, null, {
@@ -5755,6 +5764,10 @@ const _sfc_main = defineComponent({
5755
5764
  sidebar: {
5756
5765
  type: Object
5757
5766
  },
5767
+ menu: {
5768
+ type: Object,
5769
+ default: () => ({ left: [], right: [] })
5770
+ },
5758
5771
  layerContentMenu: {
5759
5772
  type: Array,
5760
5773
  default: () => []
@@ -5763,10 +5776,6 @@ const _sfc_main = defineComponent({
5763
5776
  type: Array,
5764
5777
  default: () => []
5765
5778
  },
5766
- menu: {
5767
- type: Object,
5768
- default: () => ({ left: [], right: [] })
5769
- },
5770
5779
  render: {
5771
5780
  type: Function
5772
5781
  },
@@ -5800,7 +5809,7 @@ const _sfc_main = defineComponent({
5800
5809
  },
5801
5810
  containerHighlightClassName: {
5802
5811
  type: String,
5803
- default: CONTAINER_HIGHLIGHT_CLASS
5812
+ default: CONTAINER_HIGHLIGHT_CLASS_NAME
5804
5813
  },
5805
5814
  containerHighlightDuration: {
5806
5815
  type: Number,