snapshot of https://github.com/dream-num/univer.git (dev, 2026-09-16; blobs > 131072B omitted)
Some checks failed
📦 Build / build (push) Has been cancelled
🧪 CI Test / test shard (1/4) (push) Has been cancelled
🧪 CI Test / test shard (2/4) (push) Has been cancelled
🧪 CI Test / test shard (3/4) (push) Has been cancelled
🧪 CI Test / test shard (4/4) (push) Has been cancelled
🧪 CI Test / test (push) Has been cancelled
🧪 CI Test / eslint (push) Has been cancelled
🧪 CI Test / typecheck (push) Has been cancelled
🔫 Sync to Pro / dispatch-sync (push) Has been cancelled
🔮 Sync Mirror / sync (push) Has been cancelled
Some checks failed
📦 Build / build (push) Has been cancelled
🧪 CI Test / test shard (1/4) (push) Has been cancelled
🧪 CI Test / test shard (2/4) (push) Has been cancelled
🧪 CI Test / test shard (3/4) (push) Has been cancelled
🧪 CI Test / test shard (4/4) (push) Has been cancelled
🧪 CI Test / test (push) Has been cancelled
🧪 CI Test / eslint (push) Has been cancelled
🧪 CI Test / typecheck (push) Has been cancelled
🔫 Sync to Pro / dispatch-sync (push) Has been cancelled
🔮 Sync Mirror / sync (push) Has been cancelled
This commit is contained in:
152
packages/sheets-drawing-ui/src/mobile-plugin.ts
Normal file
152
packages/sheets-drawing-ui/src/mobile-plugin.ts
Normal file
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* 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 type { Dependency } from '@univerjs/core';
|
||||
import type { IUniverSheetsDrawingUIConfig } from './config/config';
|
||||
import {
|
||||
DependentOn,
|
||||
IConfigService,
|
||||
Inject,
|
||||
Injector,
|
||||
merge,
|
||||
mergeOverrideWithDependencies,
|
||||
Plugin,
|
||||
registerDependencies,
|
||||
touchDependencies,
|
||||
UniverInstanceType,
|
||||
} from '@univerjs/core';
|
||||
import { UniverDocsDrawingPlugin } from '@univerjs/docs-drawing';
|
||||
import { UniverDrawingPlugin } from '@univerjs/drawing';
|
||||
import { UniverDrawingMobileUIPlugin } from '@univerjs/drawing-ui';
|
||||
import { IRenderManagerService, UniverRenderEnginePlugin } from '@univerjs/engine-render';
|
||||
import { UniverSheetsPlugin } from '@univerjs/sheets';
|
||||
import { UniverSheetsDrawingPlugin } from '@univerjs/sheets-drawing';
|
||||
import { UniverSheetsMobileUIPlugin } from '@univerjs/sheets-ui';
|
||||
import { UniverMobileUIPlugin } from '@univerjs/ui';
|
||||
import pkg from '../package.json';
|
||||
import { defaultPluginConfig, SHEETS_DRAWING_UI_PLUGIN_CONFIG_KEY } from './config/config';
|
||||
import { DrawingContextMenuController } from './controllers/drawing-context-menu.controller';
|
||||
import { MobileComponentsController } from './controllers/mobile/components.controller';
|
||||
import { SheetCellImageHoverRenderController } from './controllers/render-controllers/sheet-celll-image-hover.render-controller';
|
||||
import { SheetsDrawingRenderController } from './controllers/render-controllers/sheet-drawing.render-controller';
|
||||
import { SheetCellImageAutofillController } from './controllers/sheet-cell-image-autofill.controller';
|
||||
import { SheetCellImageCopyPasteController } from './controllers/sheet-cell-image-copy-paste.controller';
|
||||
import { SheetCellImageController } from './controllers/sheet-cell-image.controller';
|
||||
import { SheetDrawingActiveRenderController } from './controllers/sheet-drawing-active-render.controller';
|
||||
import { SheetsDrawingCopyPasteController } from './controllers/sheet-drawing-copy-paste.controller';
|
||||
import { SheetsDrawingGroupCopyPasteController } from './controllers/sheet-drawing-group-copy-paste.controller';
|
||||
import { SheetDrawingPermissionController } from './controllers/sheet-drawing-permission.controller';
|
||||
import { SheetDrawingPrintingController } from './controllers/sheet-drawing-printing.controller';
|
||||
import { SheetDrawingUpdateController } from './controllers/sheet-drawing-update.controller';
|
||||
import { SheetDrawingUIController } from './controllers/ui.controller';
|
||||
import { touchSheetsDrawingFloatingHostCapabilityWhenReady } from './embed/floating-host';
|
||||
import { MobileDrawingPopupMenuController } from './menu/mobile-drawing-popup-menu.controller';
|
||||
import { BatchSaveImagesService, IBatchSaveImagesService } from './services/batch-save-images.service';
|
||||
import { SheetCanvasFloatDomManagerService } from './services/canvas-float-dom-manager.service';
|
||||
import { DrawingContextMenuService, IDrawingContextMenuService } from './services/drawing-context-menu.service';
|
||||
import { SheetDrawingHitTestService } from './services/sheet-drawing-hit-test.service';
|
||||
|
||||
@DependentOn(
|
||||
UniverDrawingPlugin,
|
||||
UniverRenderEnginePlugin,
|
||||
UniverDocsDrawingPlugin,
|
||||
UniverSheetsPlugin,
|
||||
UniverSheetsDrawingPlugin,
|
||||
UniverDrawingMobileUIPlugin,
|
||||
UniverSheetsMobileUIPlugin,
|
||||
UniverMobileUIPlugin
|
||||
)
|
||||
export class UniverSheetsDrawingMobileUIPlugin extends Plugin {
|
||||
static override type = UniverInstanceType.UNIVER_SHEET;
|
||||
static override pluginName = 'SHEET_IMAGE_UI_PLUGIN';
|
||||
static override packageName = pkg.name;
|
||||
static override version = pkg.version;
|
||||
|
||||
constructor(
|
||||
private readonly _config: Partial<IUniverSheetsDrawingUIConfig> = defaultPluginConfig,
|
||||
@Inject(Injector) protected readonly _injector: Injector,
|
||||
@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,
|
||||
@IConfigService private readonly _configService: IConfigService
|
||||
) {
|
||||
super();
|
||||
|
||||
const { menu, ...rest } = merge({}, defaultPluginConfig, this._config);
|
||||
if (menu) {
|
||||
this._configService.setConfig('menu', menu, { merge: true });
|
||||
}
|
||||
this._configService.setConfig(SHEETS_DRAWING_UI_PLUGIN_CONFIG_KEY, rest);
|
||||
}
|
||||
|
||||
override onStarting(): void {
|
||||
const dependencies = [
|
||||
[MobileComponentsController],
|
||||
[SheetCanvasFloatDomManagerService],
|
||||
[SheetDrawingHitTestService],
|
||||
[SheetDrawingUIController],
|
||||
[MobileDrawingPopupMenuController],
|
||||
[SheetDrawingPrintingController],
|
||||
[SheetDrawingPermissionController],
|
||||
[SheetsDrawingCopyPasteController],
|
||||
[SheetsDrawingGroupCopyPasteController],
|
||||
[SheetCellImageController],
|
||||
[SheetCellImageAutofillController],
|
||||
[SheetCellImageCopyPasteController],
|
||||
[IBatchSaveImagesService, { useClass: BatchSaveImagesService }],
|
||||
[IDrawingContextMenuService, { useClass: DrawingContextMenuService }],
|
||||
[DrawingContextMenuController],
|
||||
] as Dependency[];
|
||||
|
||||
registerDependencies(this._injector, mergeOverrideWithDependencies(dependencies, this._config.overrides));
|
||||
touchSheetsDrawingFloatingHostCapabilityWhenReady(this._injector);
|
||||
this._injector.get(MobileComponentsController);
|
||||
}
|
||||
|
||||
override onReady(): void {
|
||||
touchDependencies(this._injector, [
|
||||
[SheetsDrawingCopyPasteController],
|
||||
[SheetCellImageCopyPasteController],
|
||||
[SheetsDrawingGroupCopyPasteController],
|
||||
]);
|
||||
}
|
||||
|
||||
override onRendered(): void {
|
||||
this._registerRenderModules();
|
||||
|
||||
touchDependencies(this._injector, [
|
||||
[SheetDrawingPermissionController],
|
||||
[SheetDrawingPrintingController],
|
||||
[SheetDrawingUIController],
|
||||
[SheetCellImageController],
|
||||
[SheetCellImageAutofillController],
|
||||
]);
|
||||
}
|
||||
|
||||
override onSteady(): void {
|
||||
this._injector.get(MobileDrawingPopupMenuController);
|
||||
this._injector.get(DrawingContextMenuController);
|
||||
}
|
||||
|
||||
private _registerRenderModules(): void {
|
||||
([
|
||||
[SheetDrawingUpdateController],
|
||||
[SheetDrawingActiveRenderController],
|
||||
[SheetsDrawingRenderController],
|
||||
[SheetCellImageHoverRenderController],
|
||||
] as Dependency[]).forEach((module) => {
|
||||
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, module));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user