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
refactor: add Apis to IME service (#1366)
Ran Luo0cd5fdfd0cd4
diff --git a/packages/docs/src/services/ime-input-manager.service.ts b/packages/docs/src/services/ime-input-manager.service.tsindex a72ad3e23f..fc309344fc 100644--- a/packages/docs/src/services/ime-input-manager.service.ts+++ b/packages/docs/src/services/ime-input-manager.service.ts@@ -21,6 +21,11 @@ import type { IDisposable } from '@wendellhu/redi';import type { IRichTextEditingMutationParams } from '../commands/mutations/core-editing.mutation';+interface ICacheParams {+ undoCache: IRichTextEditingMutationParams[];+ redoCache: IRichTextEditingMutationParams[];+}+// Used to record all intermediate states when typing with IME,// and then output the entire undo and redo operations.export class IMEInputManagerService implements IDisposable {@@ -33,6 +38,22 @@ export class IMEInputManagerService implements IDisposable {this._redoMutationParamsCache = [];}+ getUndoRedoMutationParamsCache() {+ return {+ undoCache: this._undoMutationParamsCache,+ redoCache: this._redoMutationParamsCache,+ };+ }++ setUndoRedoMutationParamsCache({ undoCache = [], redoCache = [] }: ICacheParams) {+ this._undoMutationParamsCache = undoCache;+ this._redoMutationParamsCache = redoCache;+ }++ getActiveRange(): Nullable<ITextRangeWithStyle> {+ return this._previousActiveRange;+ }+setActiveRange(range: Nullable<ITextRangeWithStyle>) {this._previousActiveRange = range;}