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(uniui): fix formula editor (#5090)

Wenzhao Hu05b07f46c037
diff --git a/packages-experimental/uni-sheets-ui/src/views/uni-sheet-bar/UniSheetBar.tsx b/packages-experimental/uni-sheets-ui/src/views/uni-sheet-bar/UniSheetBar.tsx
index cc1c14bdda..d13325f316 100644
--- a/packages-experimental/uni-sheets-ui/src/views/uni-sheet-bar/UniSheetBar.tsx
+++ b/packages-experimental/uni-sheets-ui/src/views/uni-sheet-bar/UniSheetBar.tsx
@@ -17,7 +17,7 @@
import type { ICommandInfo } from '@univerjs/core';
import type { IBaseSheetBarProps } from '@univerjs/sheets-ui';
import { ICommandService } from '@univerjs/core';
-import { Tooltip } from '@univerjs/design';
+import { clsx, Tooltip } from '@univerjs/design';
import { IncreaseSingle } from '@univerjs/icons';
import { InsertSheetCommand, InsertSheetMutation, RemoveSheetMutation, SetTabColorMutation, SetWorksheetActiveOperation, SetWorksheetHideMutation, SetWorksheetNameMutation, SetWorksheetOrderMutation } from '@univerjs/sheets';
import { useActiveWorkbook } from '@univerjs/sheets-ui';
@@ -27,18 +27,10 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
export function UniSheetBar() {
const [sheetList, setSheetList] = useState<IBaseSheetBarProps[]>([]);
const [activeKey, setActiveKey] = useState('');
- const [barHeight, setBarHeight] = useState(0);
const workbook = useActiveWorkbook()!;
const commandService = useDependency(ICommandService);
const sheetBarRef = useRef<HTMLDivElement>(null);
- useEffect(() => {
- const sheetBar = sheetBarRef.current;
- if (sheetBar) {
- setBarHeight(sheetBar.clientHeight - 38);
- }
- }, []);
-
const updateSheetItems = useCallback(() => {
const currentSubUnitId = workbook.getActiveSheet()?.getSheetId() || '';
setActiveKey(currentSubUnitId);
@@ -102,15 +94,16 @@ export function UniSheetBar() {
return (
<div className="univer-flex univer-h-full univer-select-none univer-flex-col univer-justify-between" ref={sheetBarRef}>
- <div className="univer-overflow-y-auto univer-scrollbar-thin" style={{ height: `${barHeight}px` }}>
+ <div className="univer-overflow-y-auto univer-scrollbar-thin">
<div className="univer-flex univer-flex-col univer-gap-1 univer-text-sm univer-font-medium">
{sheetList.map((item, index) => (
<div
key={index}
- className={`
- "univer-flex univer-h-8 univer-items-center univer-px-1 univer-py-0 univer-rounded-lg"
- ${activeKey === item.sheetId ? 'univer-text-teal-500' : ''}
- `}
+ className={clsx(`
+ univer-flex univer-h-8 univer-cursor-pointer univer-items-center univer-rounded-lg
+ univer-px-1 univer-py-0
+ hover:univer-bg-gray-100
+ `, activeKey === item.sheetId ? 'univer-text-primary-500' : '')}
onClick={() => handleSheetActiveChange(item.sheetId)}
>
<Tooltip showIfEllipsis title={item.label} placement="right">
diff --git a/packages-experimental/uniui/src/views/outline/Outline.tsx b/packages-experimental/uniui/src/views/outline/Outline.tsx
index 679c2e0d3a..97cbcdadf1 100644
--- a/packages-experimental/uniui/src/views/outline/Outline.tsx
+++ b/packages-experimental/uniui/src/views/outline/Outline.tsx
@@ -24,9 +24,7 @@ export enum UniUIPart {
export function Outline() {
const outlineComponent = useComponentsOfPart(UniUIPart.OUTLINE);
return (
- <div>
- <ComponentContainer key="outline" components={outlineComponent} />
- </div>
+ <ComponentContainer key="outline" components={outlineComponent} />
);
}
diff --git a/packages-experimental/uniui/src/views/uni-controls/UniControls.tsx b/packages-experimental/uniui/src/views/uni-controls/UniControls.tsx
index e12297ee1a..27d2f6392d 100644
--- a/packages-experimental/uniui/src/views/uni-controls/UniControls.tsx
+++ b/packages-experimental/uniui/src/views/uni-controls/UniControls.tsx
@@ -15,7 +15,7 @@
*/
import type { IProjectNode } from '../../services/unit-grid/unit-grid.service';
-import { clsx, Dropdown, Tooltip } from '@univerjs/design';
+import { Button, clsx, Dropdown, Tooltip } from '@univerjs/design';
import { CheckMarkSingle, FullscreenSingle, IncreaseSingle, ZoomReduceSingle } from '@univerjs/icons';
import { ISidebarService, useDependency } from '@univerjs/ui';
import { useReactFlow } from '@xyflow/react';
@@ -27,17 +27,14 @@ export const UniControlButton = (props: { tooltips: string; children?: React.Rea
const { children, onClick, style, tooltips } = props;
return (
<Tooltip title={tooltips}>
- <div
- className={`
- univer-box-border univer-flex univer-h-8 univer-w-8 univer-items-center univer-justify-center
- univer-rounded-lg univer-p-1.5
- hover:univer-bg-gray-800
- `}
+ <Button
+ variant="text"
+ className="univer-p-1.5"
onClick={onClick}
style={style}
>
{children}
- </div>
+ </Button>
</Tooltip>
);
diff --git a/packages-experimental/uniui/src/views/uni-sidebar/UniSidebar.tsx b/packages-experimental/uniui/src/views/uni-sidebar/UniSidebar.tsx
index 5370a8cddc..d502951f97 100644
--- a/packages-experimental/uniui/src/views/uni-sidebar/UniSidebar.tsx
+++ b/packages-experimental/uniui/src/views/uni-sidebar/UniSidebar.tsx
@@ -100,24 +100,27 @@ export function UniSidebar(props: IUniSidebarProps) {
sidebarService.sidebarOptions$.next(options);
options?.onClose?.();
}
+
+ const visible = options?.visible ?? false;
return (
<aside
className={clsx(`
- univer-pointer-events-auto univer-fixed univer-bottom-3 univer-z-20 univer-box-border univer-translate-x-0
+ univer-pointer-events-auto univer-fixed univer-bottom-3 univer-top-12 univer-z-20 univer-box-border
univer-overflow-hidden univer-rounded-lg univer-border univer-border-solid univer-border-gray-200
univer-shadow-lg univer-transition-all
- `, position === 'left' && 'univer-left-3 univer-top-12 univer-w-[180px]', position === 'left' && options?.visible && `
- univer-translate-x-0
- `, position === 'left' && options?.visible === false && '-univer-translate-x-4', position === 'right' && `
- univer-min-w-[280px] univer-max-w[400px] univer-right-3 univer-translate-x-4
- `, options?.visible && 'univer-translate-x-0')}
+ `, {
+ 'univer-left-3 univer-w-[180px]': position === 'left',
+ 'univer-right-3 univer-min-w-[280px] univer-max-w-[400px]': position === 'right',
+ 'univer-translate-x-[calc(-100%-12px)]': position === 'left' && !visible,
+ 'univer-translate-x-[calc(100%+12px)]': position === 'right' && !visible,
+ })}
style={{ width }}
>
<section
className={`
- univer-m-auto univer-box-border univer-grid univer-h-0 univer-min-h-full univer-w-full
- univer-overflow-hidden univer-overflow-y-auto univer-grid-rows-auto univer-bg-white
- univer-scrollbar-thin univer-scrollbar-gutter-auto univer-scrollbar-track-slate-700
+ univer-m-auto univer-box-border univer-flex univer-h-0 univer-min-h-full univer-w-full univer-flex-col
+ univer-overflow-hidden univer-overflow-y-auto univer-bg-white univer-scrollbar-thin
+ univer-scrollbar-gutter-auto univer-scrollbar-track-slate-700
`}
ref={scrollRef}
>
@@ -125,8 +128,8 @@ export function UniSidebar(props: IUniSidebarProps) {
<header
className={`
univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-h-[44px]
- univer-content-between univer-items-center univer-bg-black univer-p-4 univer-pb-0
- univer-text-lg univer-font-medium
+ univer-flex-shrink-0 univer-flex-grow-0 univer-content-between univer-items-center
+ univer-justify-between univer-p-4 univer-pb-0 univer-text-lg univer-font-medium
`}
>
{options?.header}
@@ -138,10 +141,7 @@ export function UniSidebar(props: IUniSidebarProps) {
)}
<section
- className={`
- univer-box-border univer-p-2
- *:univer-h-full
- `}
+ className="univer-box-border univer-flex-grow univer-p-2"
>
{options?.children}
</section>
diff --git a/packages-experimental/uniui/src/views/uni-toolbar/UniFormulaBar.tsx b/packages-experimental/uniui/src/views/uni-toolbar/UniFormulaBar.tsx
index ee1a3ef716..f9853bab24 100644
--- a/packages-experimental/uniui/src/views/uni-toolbar/UniFormulaBar.tsx
+++ b/packages-experimental/uniui/src/views/uni-toolbar/UniFormulaBar.tsx
@@ -14,15 +14,32 @@
* limitations under the License.
*/
-import type { Nullable, Workbook } from '@univerjs/core';
-import { BooleanNumber, DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DocumentFlavor, HorizontalAlign, ICommandService, IPermissionService, IUniverInstanceService, Rectangle, ThemeService, UniverInstanceType, VerticalAlign, WrapStrategy } from '@univerjs/core';
-import { clsx } from '@univerjs/design';
+import type { Workbook } from '@univerjs/core';
+import {
+ DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,
+ FOCUSING_FX_BAR_EDITOR,
+ ICommandService,
+ IContextService,
+ IPermissionService,
+ IUniverInstanceService,
+ Rectangle,
+ UniverInstanceType,
+} from '@univerjs/core';
+import { Button, clsx } from '@univerjs/design';
import { DeviceInputEventType } from '@univerjs/engine-render';
import { CheckMarkSingle, CloseSingle, FxSingle } from '@univerjs/icons';
-import { RangeProtectionPermissionEditPoint, RangeProtectionRuleModel, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, WorksheetProtectionRuleModel, WorksheetSetCellValuePermission } from '@univerjs/sheets';
-import { IEditorBridgeService, IFormulaEditorManagerService, SetCellEditVisibleOperation, useActiveWorkbook } from '@univerjs/sheets-ui';
-import { KeyCode, useDependency, useObservable } from '@univerjs/ui';
-import React, { useCallback, useLayoutEffect, useState } from 'react';
+import {
+ RangeProtectionPermissionEditPoint,
+ RangeProtectionRuleModel,
+ SheetsSelectionsService,
+ WorkbookEditablePermission,
+ WorksheetEditPermission,
+ WorksheetProtectionRuleModel,
+ WorksheetSetCellValuePermission,
+} from '@univerjs/sheets';
+import { EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, IEditorBridgeService, IFormulaEditorManagerService, SetCellEditVisibleOperation, useActiveWorkbook, useKeyEventConfig } from '@univerjs/sheets-ui';
+import { ComponentManager, KeyCode, useDependency, useObservable } from '@univerjs/ui';
+import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
import { EMPTY, merge, switchMap } from 'rxjs';
export const UniFormulaBar = () => {
@@ -48,8 +65,9 @@ export const UniFormulaBar = () => {
<>
<div
className={clsx(`
- univer-flex univer-items-center univer-gap-2 univer-rounded-md univer-px-3 univer-py-1.5
- univer-text-sm univer-text-primary-600
+ univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded-md
+ univer-border-primary-400 univer-bg-primary-300 univer-px-3 univer-py-1.5 univer-text-sm
+ univer-text-primary-600
`, {
'univer-opacity-30': !focusedId,
})}
@@ -60,15 +78,16 @@ export const UniFormulaBar = () => {
Write formula
</span>
</div>
- {visible && (
- <div
- className={`
- univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-h-full univer-w-full univer-bg-white
- `}
- >
- <FormulaBar />
- </div>
- )}
+ <div
+ className={clsx(`
+ univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-h-full univer-w-full univer-bg-white
+ dark:univer-bg-dark
+ `, {
+ 'univer-hidden': !visible,
+ })}
+ >
+ <FormulaBar />
+ </div>
</>
);
};
@@ -78,16 +97,22 @@ export const UniFormulaBar = () => {
export function FormulaBar() {
const formulaEditorManagerService = useDependency(IFormulaEditorManagerService);
const editorBridgeService = useDependency(IEditorBridgeService);
- const themeService = useDependency(ThemeService);
- const progressBarColor = themeService.getCurrentTheme().primaryColor;
+ const componentManager = useDependency(ComponentManager);
const commandService = useDependency(ICommandService);
- const [disable, setDisable] = useState<boolean>(false);
- const univerInstanceService = useDependency(IUniverInstanceService);
const selectionManager = useDependency(SheetsSelectionsService);
const worksheetProtectionRuleModel = useDependency(WorksheetProtectionRuleModel);
const rangeProtectionRuleModel = useDependency(RangeProtectionRuleModel);
const permissionService = useDependency(IPermissionService);
+ const contextService = useDependency(IContextService);
+
+ const [disable, setDisable] = useState<boolean>(false);
+ const univerInstanceService = useDependency(IUniverInstanceService);
+ const FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);
const currentWorkbook = useActiveWorkbook();
+ const isFocusFxBar = contextService.getContextValue(FOCUSING_FX_BAR_EDITOR);
+ const editState = useObservable(editorBridgeService.currentEditCellState$);
+ const isRefSelecting = useRef<0 | 1 | 2>(0);
+ const keyCodeConfig = useKeyEventConfig(isRefSelecting, editState?.unitId ?? '');
function getPermissionIds(unitId: string, subUnitId: string): string[] {
return [
@@ -139,49 +164,6 @@ export function FormulaBar() {
};
}, []);
- const INITIAL_SNAPSHOT = {
- id: DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,
- body: {
- dataStream: `${DEFAULT_EMPTY_DOCUMENT_VALUE}`,
- textRuns: [],
- paragraphs: [
- {
- startIndex: 0,
- },
- ],
- },
- documentStyle: {
- pageSize: {
- width: Number.POSITIVE_INFINITY,
- height: Number.POSITIVE_INFINITY,
- },
- documentFlavor: DocumentFlavor.UNSPECIFIED,
- marginTop: 5,
- marginBottom: 5,
- marginRight: 0,
- marginLeft: 0,
- paragraphLineGapDefault: 0,
- renderConfig: {
- horizontalAlign: HorizontalAlign.UNSPECIFIED,
- verticalAlign: VerticalAlign.TOP,
- centerAngle: 0,
- vertexAngle: 0,
- wrapStrategy: WrapStrategy.WRAP,
- isRenderStyle: BooleanNumber.FALSE,
- },
- },
- };
-
- function resizeCallBack(editor: Nullable<HTMLDivElement>) {
- if (editor == null) {
- return;
- }
-
- const editorRect = editor.getBoundingClientRect();
-
- formulaEditorManagerService.setPosition(editorRect);
- }
-
// Handle click the "×" button.
function handleCloseBtnClick() {
const visibleState = editorBridgeService.isVisible();
@@ -207,47 +189,49 @@ export function FormulaBar() {
}
}
- function handlerFxBtnClick() {
- formulaEditorManagerService.handleFxBtnClick(true);
- }
-
return (
<div
className={`
- univer-relative univer-box-border univer-flex univer-items-center unvier-gap-2 univer-h-full univer-p-2
+ univer-box-border univer-flex univer-h-full univer-w-full univer-items-center univer-gap-2 univer-p-2
`}
>
- {/* <TextEditor
- id={DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY}
- isSheetEditor
- resizeCallBack={resizeCallBack}
- cancelDefaultResizeListener
- onContextMenu={(e) => e.preventDefault()}
- className={clsx(styles.uniFormulaInput, styles.formulaContent)}
- snapshot={INITIAL_SNAPSHOT}
- isSingle
- /> */}
- <div className={clsx('univer-py-1.5', { 'univer-cursor-not-allowed univer-text-gray-200': disable })}>
- <span
- className={`
- univer-flex univer-items-center univer-justify-center univer-rounded univer-p-1 univer-text-lg
- univer-text-red-600
- `}
- onClick={handleCloseBtnClick}
- >
+ <div className={clsx('univer-flex univer-univer-grow-0 univer-shrink-0 univer-px-1.5', { 'univer-cursor-not-allowed univer-text-gray-200': disable })}>
+ <Button size="small" variant="text" className="univer-text-red-600" onClick={handleCloseBtnClick}>
<CloseSingle />
- </span>
-
- <span
- className={`
- univer-flex univer-items-center univer-justify-center univer-rounded univer-p-1 univer-text-lg
- univer-text-green-600
- `}
- onClick={handleConfirmBtnClick}
- >
+ </Button>
+ <Button size="small" variant="text" className="univer-text-green-600" onClick={handleConfirmBtnClick}>
<CheckMarkSingle />
- </span>
+ </Button>
</div>
+ {FormulaEditor && (
+ <FormulaEditor
+ className="univer-h-full univer-shrink univer-grow"
+ disableSelectionOnClick
+ editorId={DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY}
+ initValue=""
+ onChange={() => { }}
+ isFocus={isFocusFxBar}
+ unitId={editState?.unitId}
+ subUnitId={editState?.sheetId}
+ autofocus={false}
+ isSupportAcrossSheet
+ resetSelectionOnBlur={false}
+ isSingle={false}
+ keyboardEventConfig={keyCodeConfig}
+ onFormulaSelectingChange={(isSelecting: 0 | 1 | 2, isFocusing: boolean) => {
+ isRefSelecting.current = isSelecting;
+ if (!isFocusing) return;
+ if (isSelecting) {
+ editorBridgeService.enableForceKeepVisible();
+ } else {
+ editorBridgeService.disableForceKeepVisible();
+ }
+ }}
+ autoScrollbar={false}
+ disableContextMenu={false}
+ />
+ )}
+
</div>
);
}
diff --git a/packages/sheets-formula-ui/src/views/formula-editor/index.tsx b/packages/sheets-formula-ui/src/views/formula-editor/index.tsx
index 218902f362..40ad9d99a7 100644
--- a/packages/sheets-formula-ui/src/views/formula-editor/index.tsx
+++ b/packages/sheets-formula-ui/src/views/formula-editor/index.tsx
@@ -47,6 +47,7 @@ export interface IFormulaEditorProps {
unitId: string;
subUnitId: string;
initValue: `=${string}`;
+ autofocus?: boolean;
onChange: (text: string) => void;
errorText?: string | ReactNode;
onVerify?: (res: boolean, result: string) => void;
@@ -58,7 +59,7 @@ export interface IFormulaEditorProps {
editorId?: string;
moveCursor?: boolean;
onFormulaSelectingChange?: (isSelecting: FormulaSelectingType, isFocusing: boolean) => void;
- keyboradEventConfig?: IKeyboardEventConfig;
+ keyboardEventConfig?: IKeyboardEventConfig;
onMoveInEditor?: (keyCode: KeyCode, metaKey?: MetaKeys) => void;
resetSelectionOnBlur?: boolean;
isSingle?: boolean;
@@ -93,12 +94,13 @@ export const FormulaEditor = forwardRef((props: IFormulaEditorProps, ref: Ref<IF
editorId: propEditorId,
moveCursor = true,
onFormulaSelectingChange: propOnFormulaSelectingChange,
- keyboradEventConfig,
+ keyboardEventConfig,
onMoveInEditor,
resetSelectionOnBlur = true,
autoScrollbar = true,
isSingle = true,
disableSelectionOnClick = false,
+ autofocus = true,
disableContextMenu,
style,
} = props;
@@ -205,13 +207,13 @@ export const FormulaEditor = forwardRef((props: IFormulaEditorProps, ref: Ref<IF
onFormulaSelectingChange(isSelecting, docSelectionRenderService?.isFocusing ?? true);
}, [onFormulaSelectingChange, isSelecting]);
- useKeyboardEvent(isFocus, keyboradEventConfig, editor);
+ useKeyboardEvent(isFocus, keyboardEventConfig, editor);
useLayoutEffect(() => {
let dispose: IDisposable;
if (formulaEditorContainerRef.current) {
dispose = editorService.register({
- autofocus: true,
+ autofocus,
editorUnitId: editorId,
initialSnapshot: {
id: editorId,
diff --git a/packages/sheets-ui/src/index.ts b/packages/sheets-ui/src/index.ts
index a17133dd93..18ddbe6f84 100644
--- a/packages/sheets-ui/src/index.ts
+++ b/packages/sheets-ui/src/index.ts
@@ -95,6 +95,7 @@ export { FormatPainterStatus, IFormatPainterService } from './services/format-pa
export type { IFormatPainterBeforeApplyHookParams, IFormatPainterHook } from './services/format-painter/format-painter.service';
export { SELECTION_SHAPE_DEPTH } from './services/selection/const';
export { type IBaseSheetBarProps } from './views/sheet-bar/sheet-bar-tabs/SheetBarItem';
+export { useKeyEventConfig } from './views/editor-container';
export { type IDropdownParam, ISheetCellDropdownManagerService, SheetCellDropdownManagerService } from './services/cell-dropdown-manager.service';
export { FormulaBar } from './views/formula-bar/FormulaBar';
export { type IPermissionDetailUserPartProps } from './views/permission/panel-detail/PermissionDetailUserPart';
diff --git a/packages/sheets-ui/src/services/editor-bridge.service.ts b/packages/sheets-ui/src/services/editor-bridge.service.ts
index e62d12687f..a57d64186a 100644
--- a/packages/sheets-ui/src/services/editor-bridge.service.ts
+++ b/packages/sheets-ui/src/services/editor-bridge.service.ts
@@ -16,7 +16,6 @@
import type { IDisposable, IPosition, ISelectionCell, Nullable, Workbook } from '@univerjs/core';
import type { Engine, IDocumentLayoutObject, Scene } from '@univerjs/engine-render';
-import type { SheetsSelectionsService } from '@univerjs/sheets';
import type { KeyCode } from '@univerjs/ui';
import type { Observable } from 'rxjs';
import {
@@ -36,7 +35,7 @@ import {
} from '@univerjs/core';
import { getCanvasOffsetByEngine, IEditorService } from '@univerjs/docs-ui';
import { convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, DeviceInputEventType, IRenderManagerService } from '@univerjs/engine-render';
-import { BEFORE_CELL_EDIT, IRefSelectionsService, SheetInterceptorService } from '@univerjs/sheets';
+import { BEFORE_CELL_EDIT, SheetInterceptorService } from '@univerjs/sheets';
import { BehaviorSubject, map, switchMap } from 'rxjs';
import { ISheetSelectionRenderService } from './selection/base-selection-render.service';
import { attachPrimaryWithCoord } from './selection/util';
@@ -151,7 +150,6 @@ export class EditorBridgeService extends Disposable implements IEditorBridgeServ
@Inject(ThemeService) private readonly _themeService: ThemeService,
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
@IEditorService private readonly _editorService: IEditorService,
- @IRefSelectionsService private readonly _refSelectionsService: SheetsSelectionsService,
@IContextService private readonly _contextService: IContextService
) {
super();
@@ -201,7 +199,7 @@ export class EditorBridgeService extends Disposable implements IEditorBridgeServ
if (!skeleton) return;
if (!this._currentEditCellState) return;
- const { primary, unitId, sheetId, scene, engine } = currentEditCell;
+ const { primary, scene, engine } = currentEditCell;
const primaryWithCoord = attachPrimaryWithCoord(skeleton, primary);
if (primaryWithCoord == null) {
return;
diff --git a/packages/sheets-ui/src/views/editor-container/EditorContainer.tsx b/packages/sheets-ui/src/views/editor-container/EditorContainer.tsx
index e5d3fa6845..0c61c4a827 100644
--- a/packages/sheets-ui/src/views/editor-container/EditorContainer.tsx
+++ b/packages/sheets-ui/src/views/editor-container/EditorContainer.tsx
@@ -155,7 +155,7 @@ export const EditorContainer: React.FC<ICellIEditorProps> = () => {
isFocus={visible?.visible}
unitId={editState?.unitId}
subUnitId={editState?.sheetId}
- keyboradEventConfig={keyCodeConfig}
+ keyboardEventConfig={keyCodeConfig}
onMoveInEditor={onMoveInEditor}
isSupportAcrossSheet
resetSelectionOnBlur={false}
diff --git a/packages/sheets-ui/src/views/editor-container/index.ts b/packages/sheets-ui/src/views/editor-container/index.ts
index cbaf66f2e3..925a29cac2 100644
--- a/packages/sheets-ui/src/views/editor-container/index.ts
+++ b/packages/sheets-ui/src/views/editor-container/index.ts
@@ -15,3 +15,4 @@
*/
export * from './EditorContainer';
+export { useKeyEventConfig } from './hooks';
diff --git a/packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx b/packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx
index 10e1fc32c4..82d6a8c939 100644
--- a/packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx
+++ b/packages/sheets-ui/src/views/formula-bar/FormulaBar.tsx
@@ -308,7 +308,7 @@ export function FormulaBar(props: IProps) {
isSupportAcrossSheet
resetSelectionOnBlur={false}
isSingle={false}
- keyboradEventConfig={keyCodeConfig}
+ keyboardEventConfig={keyCodeConfig}
onFormulaSelectingChange={(isSelecting: 0 | 1 | 2, isFocusing: boolean) => {
isRefSelecting.current = isSelecting;
if (!isFocusing) return;