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(editor): short key error (#1679)
Univer7afaff0f54f0
diff --git a/packages/core/src/services/context/context.ts b/packages/core/src/services/context/context.tsindex e2c53bf29a..cc087bed61 100644--- a/packages/core/src/services/context/context.ts+++ b/packages/core/src/services/context/context.ts@@ -27,4 +27,5 @@ export const FOCUSING_FORMULA_EDITOR = 'FOCUSING_FORMULA_EDITOR';export const FOCUSING_UNIVER_EDITOR = 'FOCUSING_UNIVER_EDITOR';-export const FOCUSING_UNIVER_EDITOR_SINGLE_MODE = 'FOCUSING_UNIVER_EDITOR_SINGLE_MODE';+export const FOCUSING_EDITOR_STANDALONE = 'FOCUSING_EDITOR_INPUT_FORMULA';+export const FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE = 'FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE';diff --git a/packages/docs-ui/src/shortcuts/utils.ts b/packages/docs-ui/src/shortcuts/utils.tsindex 5f467553fb..141050b628 100644--- a/packages/docs-ui/src/shortcuts/utils.ts+++ b/packages/docs-ui/src/shortcuts/utils.ts@@ -15,12 +15,12 @@*/import type { IContextService } from '@univerjs/core';-import { FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_SINGLE_MODE } from '@univerjs/core';+import { FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE } from '@univerjs/core';export function whenDocAndEditorFocused(contextService: IContextService): boolean {return contextService.getContextValue(FOCUSING_DOC) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR);}export function whenDocAndEditorFocusedWithBreakLine(contextService: IContextService): boolean {- return contextService.getContextValue(FOCUSING_DOC) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && !contextService.getContextValue(FOCUSING_UNIVER_EDITOR_SINGLE_MODE);+ return contextService.getContextValue(FOCUSING_DOC) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && !contextService.getContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE);}diff --git a/packages/sheets-formula/src/controllers/utils/utils.ts b/packages/sheets-formula/src/controllers/utils/utils.tsindex f5191c6b4e..16173cb841 100644--- a/packages/sheets-formula/src/controllers/utils/utils.ts+++ b/packages/sheets-formula/src/controllers/utils/utils.ts@@ -15,12 +15,12 @@*/import type { IContextService } from '@univerjs/core';-import { FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_SINGLE_MODE } from '@univerjs/core';+import { FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE } from '@univerjs/core';export function whenEditorStandalone(contextService: IContextService) {return (contextService.getContextValue(FOCUSING_DOC) &&contextService.getContextValue(FOCUSING_UNIVER_EDITOR) &&- contextService.getContextValue(FOCUSING_UNIVER_EDITOR_SINGLE_MODE)+ contextService.getContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE));}diff --git a/packages/sheets-ui/src/controllers/shortcuts/utils.ts b/packages/sheets-ui/src/controllers/shortcuts/utils.tsindex aef02cda0e..4b86c60ef1 100644--- a/packages/sheets-ui/src/controllers/shortcuts/utils.ts+++ b/packages/sheets-ui/src/controllers/shortcuts/utils.ts@@ -18,6 +18,7 @@ import type { IContextService } from '@univerjs/core';import {EDITOR_ACTIVATED,FOCUSING_EDITOR_INPUT_FORMULA,+ FOCUSING_EDITOR_STANDALONE,FOCUSING_FORMULA_EDITOR,FOCUSING_SHEET,FOCUSING_UNIVER_EDITOR,@@ -93,6 +94,7 @@ export function whenEditorDidNotInputFormulaActivated(contextService: IContextSecontextService.getContextValue(FOCUSING_SHEET) &&contextService.getContextValue(FOCUSING_UNIVER_EDITOR) &&contextService.getContextValue(EDITOR_ACTIVATED) &&- !contextService.getContextValue(FOCUSING_EDITOR_INPUT_FORMULA)+ !contextService.getContextValue(FOCUSING_EDITOR_INPUT_FORMULA) &&+ !contextService.getContextValue(FOCUSING_EDITOR_STANDALONE));}diff --git a/packages/ui/src/services/editor/editor.service.ts b/packages/ui/src/services/editor/editor.service.tsindex e61d64ce66..2c56fc4543 100644--- a/packages/ui/src/services/editor/editor.service.ts+++ b/packages/ui/src/services/editor/editor.service.ts@@ -15,7 +15,7 @@*/import type { DocumentDataModel, IDocumentBody, IDocumentData, IDocumentStyle, IPosition, Nullable } from '@univerjs/core';-import { DEFAULT_EMPTY_DOCUMENT_VALUE, Disposable, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_UNIVER_EDITOR_SINGLE_MODE, HorizontalAlign, IContextService, IUniverInstanceService, toDisposable, VerticalAlign } from '@univerjs/core';+import { DEFAULT_EMPTY_DOCUMENT_VALUE, Disposable, EDITOR_ACTIVATED, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, HorizontalAlign, IContextService, IUniverInstanceService, toDisposable, VerticalAlign } from '@univerjs/core';import type { IDisposable } from '@wendellhu/redi';import { createIdentifier, Inject } from '@wendellhu/redi';import type { Observable } from 'rxjs';@@ -383,6 +383,9 @@ export class EditorService extends Disposable implements IEditorService, IDisposreturn;}+ this._contextService.setContextValue(EDITOR_ACTIVATED, false);+ this._contextService.setContextValue(FOCUSING_EDITOR_STANDALONE, false);+this.changeSpreadsheetFocusState(false);this.blur();@@ -404,7 +407,10 @@ export class EditorService extends Disposable implements IEditorService, IDisposeditor.setFocus(true);- this._contextService.setContextValue(FOCUSING_UNIVER_EDITOR_SINGLE_MODE, editor.isSingle());+ this._contextService.setContextValue(EDITOR_ACTIVATED, true);+ this._contextService.setContextValue(FOCUSING_EDITOR_STANDALONE, true);++ this._contextService.setContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, editor.isSingle());if (!this._spreadsheetFocusState) {this.singleSelection(editor.isSingleChoice());