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
chore: update permission init method (#4656)
ybzkyfe3098abf774
diff --git a/packages/sheets-ui/src/controllers/permission/sheet-permission-init-ui.controller.ts b/packages/sheets-ui/src/controllers/permission/sheet-permission-init-ui.controller.tsnew file mode 100644index 0000000000..d6b7b13b87--- /dev/null+++ b/packages/sheets-ui/src/controllers/permission/sheet-permission-init-ui.controller.ts@@ -0,0 +1,31 @@+/**+ * Copyright 2023-present DreamNum Co., Ltd.+ *+ * 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 { Disposable, Inject } from '@univerjs/core';+import { SheetPermissionInitController } from '@univerjs/sheets';++export class SheetPermissionInitUIController extends Disposable {+ constructor(+ @Inject(SheetPermissionInitController) private readonly _sheetPermissionInitController: SheetPermissionInitController+ ) {+ super();+ this._initPermission();+ }++ private _initPermission() {+ this._sheetPermissionInitController.initPermission();+ }+}diff --git a/packages/sheets-ui/src/plugin.ts b/packages/sheets-ui/src/plugin.tsindex 6187ac01d7..37ded7647a 100644--- a/packages/sheets-ui/src/plugin.ts+++ b/packages/sheets-ui/src/plugin.ts@@ -43,6 +43,7 @@ import { HoverRenderController } from './controllers/hover-render.controller';import { MarkSelectionRenderController } from './controllers/mark-selection.controller';import { MoveRangeRenderController } from './controllers/move-range.controller';import { SheetPermissionCheckUIController } from './controllers/permission/sheet-permission-check-ui.controller';+import { SheetPermissionInitUIController } from './controllers/permission/sheet-permission-init-ui.controller';import { SheetPermissionInterceptorCanvasRenderController } from './controllers/permission/sheet-permission-interceptor-canvas-render.controller';import { SheetPermissionInterceptorClipboardController } from './controllers/permission/sheet-permission-interceptor-clipboard.controller';import { SheetPermissionInterceptorFormulaRenderController } from './controllers/permission/sheet-permission-interceptor-formula-render.controller';@@ -154,6 +155,7 @@ export class UniverSheetsUIPlugin extends Plugin {// permission[SheetPermissionPanelModel],+ [SheetPermissionInitUIController],[SheetPermissionUserManagerService],[SheetPermissionInterceptorClipboardController],[SheetPermissionCheckUIController],@@ -161,7 +163,7 @@ export class UniverSheetsUIPlugin extends Plugin {] as Dependency[], this._config.override));touchDependencies(this._injector, [- [SheetPermissionPanelModel],+ [SheetPermissionInitUIController],]);}@@ -189,6 +191,7 @@ export class UniverSheetsUIPlugin extends Plugin {touchDependencies(this._injector, [[SheetPermissionRenderManagerController],+ [SheetPermissionPanelModel],[SheetClipboardController],[FormulaEditorController],[SheetsDefinedNameController],diff --git a/packages/sheets/src/controllers/permission/sheet-permission-init.controller.ts b/packages/sheets/src/controllers/permission/sheet-permission-init.controller.tsindex 1264026a70..31692e7c72 100644--- a/packages/sheets/src/controllers/permission/sheet-permission-init.controller.ts+++ b/packages/sheets/src/controllers/permission/sheet-permission-init.controller.ts@@ -48,6 +48,9 @@ export class SheetPermissionInitController extends Disposable {@Inject(RangeProtectionCache) private _rangeProtectionCache: RangeProtectionCache) {super();+ }++ public initPermission() {this._initRangePermissionFromSnapshot();this._initRangePermissionChange();this._initWorksheetPermissionFromSnapshot();