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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(sheets): 1. right click cell edit 2. formula open
Dushusira465be75e030
diff --git a/packages/base-sheets/src/Controller/CellEditorController.ts b/packages/base-sheets/src/Controller/CellEditorController.tsindex a04f619ab3..5a866c5f94 100644--- a/packages/base-sheets/src/Controller/CellEditorController.ts+++ b/packages/base-sheets/src/Controller/CellEditorController.ts@@ -87,7 +87,10 @@ export class CellEditorController {const main = this._plugin.getMainComponent();main.onDblclickObserver.add((evt: IPointerEvent | IMouseEvent) => {- this.enterEditMode();+ // Prevent left + right double click+ if (evt.button !== 2) {+ this.enterEditMode();+ }});main.onPointerDownObserver.add((evt: IPointerEvent | IMouseEvent) => {this.exitEditMode();diff --git a/packages/base-sheets/src/Controller/ToolBarController.ts b/packages/base-sheets/src/Controller/ToolBarController.tsindex c3a912c283..f7672c5617 100644--- a/packages/base-sheets/src/Controller/ToolBarController.ts+++ b/packages/base-sheets/src/Controller/ToolBarController.ts@@ -62,14 +62,14 @@ export class ToolBarController {const verticalAlign = range.getVerticalAlignment();const rotation = range.getTextRotation();- console.log('cellMatrix:', cellMatrix);- console.log('fontSize:', fontSize);- console.log('horizontalAlign:', horizontalAlign);- console.log('fontName:', fontName);- console.log('verticalAlign:', verticalAlign);- console.log('fontItalic:', fontItalic);- console.log('fontWeight:', fontWeight);- console.log('strikeThrough:', strikeThrough);+ // console.log('cellMatrix:', cellMatrix);+ // console.log('fontSize:', fontSize);+ // console.log('horizontalAlign:', horizontalAlign);+ // console.log('fontName:', fontName);+ // console.log('verticalAlign:', verticalAlign);+ // console.log('fontItalic:', fontItalic);+ // console.log('fontWeight:', fontWeight);+ // console.log('strikeThrough:', strikeThrough);const textRotateModeItem = this._toolList.find((item) => item.name === 'textRotateMode');const fontSizeItem = this._toolList.find((item) => item.name === 'fontSize');diff --git a/packages/base-sheets/src/main.tsx b/packages/base-sheets/src/main.tsxindex e435e1ffe4..248736f916 100644--- a/packages/base-sheets/src/main.tsx+++ b/packages/base-sheets/src/main.tsx@@ -3,6 +3,7 @@ import { RenderEngine } from '@univer/base-render';import { UniverComponentSheet } from '@univer/style-universheet';import { NumfmtPlugin } from '@univer/sheets-plugin-numfmt';import { DEFAULT_WORKBOOK_DATA, DEFAULT_WORKBOOK_DATA_DOWN } from '@univer/common-plugin-data';+import { DEFAULT_FORMULA_DATA, FormulaPlugin } from '@univer/sheets-plugin-formula';import { SheetPlugin } from './SheetPlugin';const uiDefaultConfigUp = {@@ -98,7 +99,7 @@ let sheetPlugin = new SheetPlugin(uiDefaultConfigUp);univerSheetUp.installPlugin(sheetPlugin);univerSheetUp.installPlugin(new NumfmtPlugin());-// FormulaPlugin.create(DEFAULT_FORMULA_DATA).installTo(univerSheetUp);+FormulaPlugin.create(DEFAULT_FORMULA_DATA).installTo(univerSheetUp);(window as any).sheetPlugin = sheetPlugin;diff --git a/packages/sheets-plugin-formula/src/Basic/Register/FormulaActionExtension.ts b/packages/sheets-plugin-formula/src/Basic/Register/FormulaActionExtension.tsindex 1fec4a8cef..7a6eac955c 100644--- a/packages/sheets-plugin-formula/src/Basic/Register/FormulaActionExtension.ts+++ b/packages/sheets-plugin-formula/src/Basic/Register/FormulaActionExtension.ts@@ -30,7 +30,7 @@ export class FormulaActionExtension extends BaseActionExtension<ISetRangeDataActconst workBook = this._plugin.getContext().getWorkBook();let cellValue = this.actionData.cellValue;- if(Tools.isEmptyObject(formulaData)) return+ if (Tools.isEmptyObject(formulaData)) return;const cellData = new ObjectMatrix(formulaData[unitId][sheetId]);