@tmagic/editor 1.2.0-beta.26 → 1.2.0-beta.27

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.
@@ -875,8 +875,12 @@
875
875
  });
876
876
  }
877
877
  removeAllPlugins() {
878
- this.pluginOptionsList = {};
879
- this.middleware = {};
878
+ Object.keys(this.pluginOptionsList).forEach((key) => {
879
+ this.pluginOptionsList[key] = [];
880
+ });
881
+ Object.keys(this.middleware).forEach((key) => {
882
+ this.middleware[key] = [];
883
+ });
880
884
  }
881
885
  async doTask() {
882
886
  this.doingTask = true;
@@ -3208,6 +3212,9 @@
3208
3212
  vue.onMounted(() => {
3209
3213
  emit("mounted", internalInstance);
3210
3214
  });
3215
+ vue.onUnmounted(() => {
3216
+ services?.propsService.off("props-configs-change", init);
3217
+ });
3211
3218
  vue.watchEffect(() => {
3212
3219
  if (configForm.value && stage.value) {
3213
3220
  configForm.value.formState.stage = stage.value;
@@ -4305,11 +4312,6 @@
4305
4312
  const spliceNodeKey = vue.ref();
4306
4313
  const filterText = vue.ref("");
4307
4314
  const defaultExpandedKeys = vue.computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
4308
- editorService?.on("remove", () => {
4309
- setTimeout(() => {
4310
- tree.value?.getNode(editorService.get("node").id)?.updateChildren();
4311
- }, 0);
4312
- });
4313
4315
  const select = async (data) => {
4314
4316
  if (!data.id) {
4315
4317
  throw new Error("\u6CA1\u6709id");
@@ -4446,8 +4448,14 @@
4446
4448
  tree.value?.$el.blur();
4447
4449
  isMultiSelectStatus.value = false;
4448
4450
  };
4451
+ const editorServiceRemoveHandler = () => {
4452
+ setTimeout(() => {
4453
+ tree.value?.getNode(editorService?.get("node").id)?.updateChildren();
4454
+ }, 0);
4455
+ };
4449
4456
  let keycon;
4450
4457
  vue.onMounted(() => {
4458
+ editorService?.on("remove", editorServiceRemoveHandler);
4451
4459
  keycon = new KeyController__default.default(tree.value?.$el);
4452
4460
  const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
4453
4461
  const ctrl = isMac ? "meta" : "ctrl";
@@ -4461,6 +4469,7 @@
4461
4469
  });
4462
4470
  vue.onUnmounted(() => {
4463
4471
  keycon.destroy();
4472
+ editorService?.off("remove", editorServiceRemoveHandler);
4464
4473
  });
4465
4474
  const clicked = vue.ref(false);
4466
4475
  const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
@@ -5910,7 +5919,7 @@
5910
5919
  },
5911
5920
  emits: ["props-panel-mounted", "update:modelValue"],
5912
5921
  setup(props, { emit }) {
5913
- editorService.on("root-change", (value, preValue) => {
5922
+ const rootChangeHandler = (value, preValue) => {
5914
5923
  const nodeId = editorService.get("node")?.id || props.defaultSelected;
5915
5924
  let node;
5916
5925
  if (nodeId) {
@@ -5928,7 +5937,8 @@
5928
5937
  if (vue.toRaw(value) !== vue.toRaw(preValue)) {
5929
5938
  emit("update:modelValue", value);
5930
5939
  }
5931
- });
5940
+ };
5941
+ editorService.on("root-change", rootChangeHandler);
5932
5942
  vue.watch(
5933
5943
  () => props.modelValue,
5934
5944
  (modelValue) => {
@@ -5996,6 +6006,7 @@
5996
6006
  uiService.resetState();
5997
6007
  componentListService.resetState();
5998
6008
  codeBlockService.resetState();
6009
+ editorService.off("root-change", rootChangeHandler);
5999
6010
  });
6000
6011
  const services = {
6001
6012
  componentListService,