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.

feat: add network plugin (#3782)

Wenzhao Hu3e3e7958f925
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index dac8441ac9..d9602a7b7b 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -61,3 +61,6 @@ packages/sheets-zen-editor @Jocs
# business - slides
packages/slides @jikkai
packages/slides-ui @jikkai
+
+# collaboration
+**/mutations/** @yuhongz
diff --git a/e2e/visual-comparison/sheets/sheets-gridlines.spec.ts-snapshots/sheets-no-gridlines-ci-chromium-linux.png b/e2e/visual-comparison/sheets/sheets-gridlines.spec.ts-snapshots/sheets-no-gridlines-ci-chromium-linux.png
index 9c1489493f..913df1d462 100644
Binary files a/e2e/visual-comparison/sheets/sheets-gridlines.spec.ts-snapshots/sheets-no-gridlines-ci-chromium-linux.png and b/e2e/visual-comparison/sheets/sheets-gridlines.spec.ts-snapshots/sheets-no-gridlines-ci-chromium-linux.png differ
diff --git a/e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts-snapshots/demo-sheet-ci-chromium-linux.png b/e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts-snapshots/demo-sheet-ci-chromium-linux.png
index 41875f2f7d..fb33ebc7ea 100644
Binary files a/e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts-snapshots/demo-sheet-ci-chromium-linux.png and b/e2e/visual-comparison/sheets/sheets-visual-comparison.spec.ts-snapshots/demo-sheet-ci-chromium-linux.png differ
diff --git a/packages/network/src/index.ts b/packages/network/src/index.ts
index 166f4fb41c..1a9bb9e646 100644
--- a/packages/network/src/index.ts
+++ b/packages/network/src/index.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+export { UniverNetworkPlugin } from './plugin';
export { HTTPHeaders } from './services/http/headers';
export { HTTPService } from './services/http/http.service';
export { IHTTPImplementation } from './services/http/implementations/implementation';
diff --git a/packages/network/src/plugin.ts b/packages/network/src/plugin.ts
new file mode 100644
index 0000000000..650c642ce9
--- /dev/null
+++ b/packages/network/src/plugin.ts
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Inject, Injector, Plugin, registerDependencies } from '@univerjs/core';
+import { HTTPService } from './services/http/http.service';
+import { IHTTPImplementation } from './services/http/implementations/implementation';
+import { XHRHTTPImplementation } from './services/http/implementations/xhr';
+
+/**
+ * This plugin add network services to the Univer instance.
+ */
+export class UniverNetworkPlugin extends Plugin {
+ static override pluginName = 'UNIVER_NETWORK_PLUGIN';
+
+ constructor(
+ @Inject(Injector) protected readonly _injector: Injector
+ ) {
+ super();
+ }
+
+ override onStarting(): void {
+ registerDependencies(this._injector, [
+ [HTTPService],
+ [IHTTPImplementation, { useClass: XHRHTTPImplementation }],
+ ]);
+ }
+}
diff --git a/packages/sheets-ui/src/index.ts b/packages/sheets-ui/src/index.ts
index 29f2e411c8..e73ddaab5b 100644
--- a/packages/sheets-ui/src/index.ts
+++ b/packages/sheets-ui/src/index.ts
@@ -97,6 +97,7 @@ export { SheetPrintInterceptorService } from './services/print-interceptor.servi
export { UniverSheetsMobileUIPlugin } from './mobile-plugin';
export { MobileSheetBar } from './views/mobile/sheet-bar/MobileSheetBar';
export { SheetPermissionInitController } from './controllers/permission/sheet-permission-init.controller';
+export { type IUniverSheetsUIConfig } from './controllers/config.schema';
export { FormatPainterStatus, IFormatPainterService } from './services/format-painter/format-painter.service';
export type { IFormatPainterBeforeApplyHookParams, IFormatPainterHook } from './services/format-painter/format-painter.service';
diff --git a/packages/sheets/src/index.ts b/packages/sheets/src/index.ts
index 1d3b5f229c..6762d9bad3 100644
--- a/packages/sheets/src/index.ts
+++ b/packages/sheets/src/index.ts
@@ -44,6 +44,7 @@ export {
transformCellDataToSelectionData,
} from './basics/selection';
export { createTopMatrixFromMatrix, createTopMatrixFromRanges, findAllRectangle, rangeMerge, RangeMergeUtil } from './basics/rangeMerge';
+export { type IUniverSheetsConfig } from './controllers/config.schema';
export { MAX_CELL_PER_SHEET_KEY } from './controllers/config/config';
export { BorderStyleManagerService, type IBorderInfo } from './services/border-style-manager.service';
export * from './services/permission/permission-point';