Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(find-replace): fix dialog issues (#1590)

Wenzhao Hu2390086f5753
diff --git a/packages/design/src/components/dialog/Dialog.tsx b/packages/design/src/components/dialog/Dialog.tsx
index d91cc9f817..78debcb17b 100644
--- a/packages/design/src/components/dialog/Dialog.tsx
+++ b/packages/design/src/components/dialog/Dialog.tsx
@@ -152,6 +152,7 @@ export function Dialog(props: IDialogProps) {
if (!targetRect) {
return;
}
+
setBounds({
left: -targetRect.left + uiData.x,
right: clientWidth - (targetRect.right - uiData.x),
diff --git a/packages/design/src/components/dialog/index.module.less b/packages/design/src/components/dialog/index.module.less
index e983207d1b..a0cc1a3717 100644
--- a/packages/design/src/components/dialog/index.module.less
+++ b/packages/design/src/components/dialog/index.module.less
@@ -8,8 +8,7 @@
z-index: 1050;
inset: 0;
- overflow: auto;
-
+ overflow: hidden;
outline: 0;
-webkit-overflow-scrolling: touch;
diff --git a/packages/find-replace/src/controllers/find-replace.controller.ts b/packages/find-replace/src/controllers/find-replace.controller.ts
index 6a37baed92..230c973f83 100644
--- a/packages/find-replace/src/controllers/find-replace.controller.ts
+++ b/packages/find-replace/src/controllers/find-replace.controller.ts
@@ -57,7 +57,7 @@ const FIND_REPLACE_DIALOG_ID = 'DESKTOP_FIND_REPLACE_DIALOG';
const FIND_REPLACE_PANEL_WIDTH = 350;
const FIND_REPLACE_PANEL_RIGHT_PADDING = 20;
-const FIND_REPLACE_PANEL_TOP_PADDING = 0;
+const FIND_REPLACE_PANEL_TOP_PADDING = -90;
@OnLifecycle(LifecycleStages.Rendered, FindReplaceController)
export class FindReplaceController extends RxDisposable {
@@ -136,6 +136,7 @@ export class FindReplaceController extends RxDisposable {
children: { label: 'FindReplaceDialog' },
destroyOnClose: true,
defaultPosition: getFindReplaceDialogDefaultPosition(),
+ preservePositionOnDestroy: true,
onClose: () => this.closePanel(),
});
}
@@ -150,7 +151,7 @@ export class FindReplaceController extends RxDisposable {
function getFindReplaceDialogDefaultPosition(): { x: number; y: number } {
const { innerWidth } = window;
- const x = innerWidth - FIND_REPLACE_PANEL_WIDTH - FIND_REPLACE_PANEL_RIGHT_PADDING;
+ const x = (innerWidth - FIND_REPLACE_PANEL_WIDTH) / 2 - FIND_REPLACE_PANEL_RIGHT_PADDING;
const y = FIND_REPLACE_PANEL_TOP_PADDING;
return { x, y };
diff --git a/packages/ui/src/views/components/dialog-part/DialogPart.tsx b/packages/ui/src/views/components/dialog-part/DialogPart.tsx
index 86ae4af320..e0f16884d2 100644
--- a/packages/ui/src/views/components/dialog-part/DialogPart.tsx
+++ b/packages/ui/src/views/components/dialog-part/DialogPart.tsx
@@ -37,7 +37,7 @@ export function DialogPart() {
return () => {
subscription.unsubscribe();
};
- }, []);
+ }, [dialogService]);
const attrs = dialogOptions.map((options) => {
const { children, title, closeIcon, footer, ...restProps } = options;