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: fix contextmenu closes immediately when clicked (#610)

白熱08e5d647f2db
diff --git a/packages/base-ui/src/views/app.module.less b/packages/base-ui/src/views/app.module.less
index a02cc55ed7..9f6f7eb6df 100644
--- a/packages/base-ui/src/views/app.module.less
+++ b/packages/base-ui/src/views/app.module.less
@@ -5,6 +5,9 @@
height: 100%;
+ // TODO: @jikkai portal div doesn't have the same font-family as the rest of the layout
+ font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "noto sans", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
+
background-color: rgb(var(--bg-color));
-webkit-font-smoothing: antialiased;
diff --git a/packages/base-ui/src/views/components/context-menu/ContextMenu.tsx b/packages/base-ui/src/views/components/context-menu/ContextMenu.tsx
index 248a850fcd..5a1145e1d2 100644
--- a/packages/base-ui/src/views/components/context-menu/ContextMenu.tsx
+++ b/packages/base-ui/src/views/components/context-menu/ContextMenu.tsx
@@ -44,14 +44,16 @@ export function ContextMenu() {
return (
<Popup visible={visible} offset={offset}>
- <Menu
- menuType={[menuType]}
- onOptionSelect={(params) => {
- const { label: commandId, value } = params;
- commandService && commandService.executeCommand(commandId as string, { value });
- setVisible(false);
- }}
- />
+ <section onPointerDown={(e) => e.stopPropagation()}>
+ <Menu
+ menuType={[menuType]}
+ onOptionSelect={(params) => {
+ const { label: commandId, value } = params;
+ commandService && commandService.executeCommand(commandId as string, { value });
+ setVisible(false);
+ }}
+ />
+ </section>
</Popup>
);
}
diff --git a/packages/design/src/components/menu/index.module.less b/packages/design/src/components/menu/index.module.less
index 5b64595e5a..99ac071c9f 100644
--- a/packages/design/src/components/menu/index.module.less
+++ b/packages/design/src/components/menu/index.module.less
@@ -157,7 +157,7 @@
box-sizing: border-box;
width: 100%;
min-height: 28px;
- padding: var(--padding-xs) var(--padding-sm);
+ padding: var(--padding-xs);
}
.menu-submenu-arrow {