@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.
@@ -858,8 +858,12 @@ class BaseService extends EventEmitter {
858
858
  });
859
859
  }
860
860
  removeAllPlugins() {
861
- this.pluginOptionsList = {};
862
- this.middleware = {};
861
+ Object.keys(this.pluginOptionsList).forEach((key) => {
862
+ this.pluginOptionsList[key] = [];
863
+ });
864
+ Object.keys(this.middleware).forEach((key) => {
865
+ this.middleware[key] = [];
866
+ });
863
867
  }
864
868
  async doTask() {
865
869
  this.doingTask = true;
@@ -3191,6 +3195,9 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3191
3195
  onMounted(() => {
3192
3196
  emit("mounted", internalInstance);
3193
3197
  });
3198
+ onUnmounted(() => {
3199
+ services?.propsService.off("props-configs-change", init);
3200
+ });
3194
3201
  watchEffect(() => {
3195
3202
  if (configForm.value && stage.value) {
3196
3203
  configForm.value.formState.stage = stage.value;
@@ -4288,11 +4295,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4288
4295
  const spliceNodeKey = ref();
4289
4296
  const filterText = ref("");
4290
4297
  const defaultExpandedKeys = computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
4291
- editorService?.on("remove", () => {
4292
- setTimeout(() => {
4293
- tree.value?.getNode(editorService.get("node").id)?.updateChildren();
4294
- }, 0);
4295
- });
4296
4298
  const select = async (data) => {
4297
4299
  if (!data.id) {
4298
4300
  throw new Error("\u6CA1\u6709id");
@@ -4429,8 +4431,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4429
4431
  tree.value?.$el.blur();
4430
4432
  isMultiSelectStatus.value = false;
4431
4433
  };
4434
+ const editorServiceRemoveHandler = () => {
4435
+ setTimeout(() => {
4436
+ tree.value?.getNode(editorService?.get("node").id)?.updateChildren();
4437
+ }, 0);
4438
+ };
4432
4439
  let keycon;
4433
4440
  onMounted(() => {
4441
+ editorService?.on("remove", editorServiceRemoveHandler);
4434
4442
  keycon = new KeyController(tree.value?.$el);
4435
4443
  const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
4436
4444
  const ctrl = isMac ? "meta" : "ctrl";
@@ -4444,6 +4452,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4444
4452
  });
4445
4453
  onUnmounted(() => {
4446
4454
  keycon.destroy();
4455
+ editorService?.off("remove", editorServiceRemoveHandler);
4447
4456
  });
4448
4457
  const clicked = ref(false);
4449
4458
  const highlightNode = computed(() => editorService?.get("highlightNode"));
@@ -5893,7 +5902,7 @@ const _sfc_main = defineComponent({
5893
5902
  },
5894
5903
  emits: ["props-panel-mounted", "update:modelValue"],
5895
5904
  setup(props, { emit }) {
5896
- editorService.on("root-change", (value, preValue) => {
5905
+ const rootChangeHandler = (value, preValue) => {
5897
5906
  const nodeId = editorService.get("node")?.id || props.defaultSelected;
5898
5907
  let node;
5899
5908
  if (nodeId) {
@@ -5911,7 +5920,8 @@ const _sfc_main = defineComponent({
5911
5920
  if (toRaw(value) !== toRaw(preValue)) {
5912
5921
  emit("update:modelValue", value);
5913
5922
  }
5914
- });
5923
+ };
5924
+ editorService.on("root-change", rootChangeHandler);
5915
5925
  watch(
5916
5926
  () => props.modelValue,
5917
5927
  (modelValue) => {
@@ -5979,6 +5989,7 @@ const _sfc_main = defineComponent({
5979
5989
  uiService.resetState();
5980
5990
  componentListService.resetState();
5981
5991
  codeBlockService.resetState();
5992
+ editorService.off("root-change", rootChangeHandler);
5982
5993
  });
5983
5994
  const services = {
5984
5995
  componentListService,