diff --git a/packages/editor-core/src/widgets/tip/utils.ts b/packages/editor-core/src/widgets/tip/utils.ts
index 8a833a991..20fff3a4b 100644
--- a/packages/editor-core/src/widgets/tip/utils.ts
+++ b/packages/editor-core/src/widgets/tip/utils.ts
@@ -64,8 +64,17 @@ function resolveDirection(popup: any, target: any, edge: any, bounds: any, prefe
return prefer;
}
-function resolvePrefer(prefer: any) {
+function resolvePrefer(prefer: any, targetRect: any, bounds: any) {
if (!prefer) {
+ if (targetRect.left - bounds.left < 10) {
+ return { dir: 'right' };
+ } else if (targetRect.top - bounds.top < 10) {
+ return { dir: 'bottom' };
+ } else if (bounds.bottom - targetRect.bottom < 10) {
+ return { dir: 'top' };
+ } else if (bounds.right - targetRect.right < 10) {
+ return { dir: 'left' };
+ }
return {};
}
const force = prefer[0] === '!';
@@ -105,7 +114,7 @@ export function resolvePosition(popup: any, target: any, arrow: any, bounds: any
width: popup.width,
};
- const prefers = resolvePrefer(prefer);
+ const prefers = resolvePrefer(prefer, target, bounds);
const edge = resolveEdge(popup, target, arrow, bounds);
diff --git a/packages/editor-core/src/widgets/title/index.tsx b/packages/editor-core/src/widgets/title/index.tsx
index 4b19bda72..daeba7df4 100644
--- a/packages/editor-core/src/widgets/title/index.tsx
+++ b/packages/editor-core/src/widgets/title/index.tsx
@@ -27,7 +27,7 @@ export class Title extends Component<{ title: TitleContent; className?: string;
typeof title.tip === 'object' && !(isValidElement(title.tip) || isI18nData(title.tip))
? title.tip
: { children: title.tip };
- tip = ;
+ tip = ;
}
}