Skip to content

Commit

Permalink
fix(editor): 事件中选择联动组件无法再组件树中选择
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Dec 6, 2024
1 parent 271c4b0 commit 0f0133c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/editor/src/fields/EventSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const eventNameConfig = computed(() => {
if (pageFragment) {
events = [
{
label: pageFragment.name || '迭代器容器',
label: pageFragment.name || '页面片容器',
value: pageFragment.id,
children: events,
},
Expand Down
9 changes: 6 additions & 3 deletions packages/editor/src/fields/UISelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { computed, inject, ref } from 'vue';
import { Close, Delete } from '@element-plus/icons-vue';
import { throttle } from 'lodash-es';
import type { Id } from '@tmagic/core';
import type { Id, MNode } from '@tmagic/core';
import { TMagicButton, TMagicTooltip } from '@tmagic/design';
import type { FieldProps, FormItem, FormState } from '@tmagic/form';
import { getIdFromEl } from '@tmagic/utils';
Expand All @@ -72,8 +72,11 @@ const cancelHandler = () => {
globalThis.document.removeEventListener(UI_SELECT_MODE_EVENT_NAME, clickHandler as EventListener);
};
const clickHandler = ({ detail }: Event & { detail: HTMLElement }) => {
const id = getIdFromEl()(detail);
const clickHandler = ({ detail }: Event & { detail: HTMLElement | MNode }) => {
let { id } = detail;
if (detail.nodeType) {
id = getIdFromEl()(detail as HTMLElement) || id;
}
if (id) {
props.model[props.name] = id;
emit('change', id);
Expand Down

0 comments on commit 0f0133c

Please sign in to comment.