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: fix facade API not implemented (#4259)
Wenzhao Hud0d264fa8ca4
diff --git a/packages/network/src/plugin.ts b/packages/network/src/plugin.tsindex 102bf3daf9..cb2f1321de 100644--- a/packages/network/src/plugin.ts+++ b/packages/network/src/plugin.ts@@ -19,8 +19,14 @@ import { Inject, Injector, mergeOverrideWithDependencies, Plugin, registerDependimport { HTTPService } from './services/http/http.service';import { IHTTPImplementation } from './services/http/implementations/implementation';import { XHRHTTPImplementation } from './services/http/implementations/xhr';+import { FetchHTTPImplementation } from './services/http/implementations/fetch';export interface IUniverNetworkPluginConfig {+ /**+ * Use fetch instead of XMLHttpRequest. By default, Univer will use fetch on Node.js and XMLHttpRequest in browser.+ */+ useFetchImpl?: boolean;+/*** Build in dependencies that can be overridden:*@@ -44,9 +50,15 @@ export class UniverNetworkPlugin extends Plugin {}override onStarting(): void {+ const impl = this._config?.useFetchImpl+ ? FetchHTTPImplementation+ : typeof window !== 'undefined'+ ? XHRHTTPImplementation+ : FetchHTTPImplementation;+registerDependencies(this._injector, mergeOverrideWithDependencies([[HTTPService],- [IHTTPImplementation, { useClass: XHRHTTPImplementation }],+ [IHTTPImplementation, { useClass: impl }],], this._config?.override));}}diff --git a/packages/network/src/services/web-socket/web-socket.service.ts b/packages/network/src/services/web-socket/web-socket.service.tsindex d14a6e559c..644309001b 100644--- a/packages/network/src/services/web-socket/web-socket.service.ts+++ b/packages/network/src/services/web-socket/web-socket.service.ts@@ -24,7 +24,7 @@ export type SocketBodyType = string | ArrayBufferLike | Blob | ArrayBufferView;/*** This service is responsible for establishing bidi-directional connection to a remote server.*/-export const ISocketService = createIdentifier<ISocketService>('univer.socket');+export const ISocketService = createIdentifier<ISocketService>('univer.network.socket.service');export interface ISocketService {createSocket(url: string): Nullable<ISocket>;}diff --git a/packages/sheets/src/facade/f-univer.ts b/packages/sheets/src/facade/f-univer.tsindex 003227bc94..9e9e9e5b30 100644--- a/packages/sheets/src/facade/f-univer.ts+++ b/packages/sheets/src/facade/f-univer.ts@@ -48,7 +48,7 @@ export interface IFUniverSheetsMixin {getPermission(): FPermission;}-export class FUniverSheetsMixin extends FUniver {+export class FUniverSheetsMixin extends FUniver implements IFUniverSheetsMixin {override createUniverSheet(data: Partial<IWorkbookData>): FWorkbook {const instanceService = this._injector.get(IUniverInstanceService);const workbook = instanceService.createUnit<IWorkbookData, Workbook>(UniverInstanceType.UNIVER_SHEET, data);@@ -64,6 +64,15 @@ export class FUniverSheetsMixin extends FUniver {return this._injector.createInstance(FWorkbook, workbook);}+ override getUniverSheet(id: string): FWorkbook | null {+ const workbook = this._univerInstanceService.getUnit<Workbook>(id, UniverInstanceType.UNIVER_SHEET);+ if (!workbook) {+ return null;+ }++ return this._injector.createInstance(FWorkbook, workbook);+ }+override getPermission(): FPermission {return this._injector.createInstance(FPermission);}