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

This commit is contained in:
upstream-mirror
2026-09-16 05:09:45 +05:00
commit bcf6ef63ad
7118 changed files with 1236854 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
/**
* 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 { IDrawingParam, IOperation } from '@univerjs/core';
import { ArrangeTypeEnum, CommandType, ICommandService } from '@univerjs/core';
import { IDrawingManagerService } from '@univerjs/drawing';
export interface IDrawingArrangeOperationParams {
arrangeType: ArrangeTypeEnum;
drawings?: IDrawingParam[];
}
/**
* Set the layer of the drawing, including forward, backward, front, and back
*/
export const SetDrawingArrangeOperation: IOperation<IDrawingArrangeOperationParams> = {
id: 'drawing.operation.set-drawing-arrange',
type: CommandType.OPERATION,
handler: (accessor, params) => {
const drawingManagerService = accessor.get(IDrawingManagerService);
const { arrangeType } = params;
const drawings = params.drawings || drawingManagerService.getFocusDrawings();
const { unitId, subUnitId } = drawings[0];
const drawingIds = drawings.map((drawing) => drawing.drawingId);
drawingManagerService.featurePluginOrderUpdateNotification({ unitId, subUnitId, drawingIds, arrangeType });
return true;
},
};
export const SetDrawingArrangeFrontOperation: IOperation = {
id: 'drawing.operation.set-drawing-arrange-front',
type: CommandType.OPERATION,
handler: (accessor) => {
return accessor.get(ICommandService).syncExecuteCommand(SetDrawingArrangeOperation.id, { arrangeType: ArrangeTypeEnum.front });
},
};
export const SetDrawingArrangeForwardOperation: IOperation = {
id: 'drawing.operation.set-drawing-arrange-forward',
type: CommandType.OPERATION,
handler: (accessor) => {
return accessor.get(ICommandService).syncExecuteCommand(SetDrawingArrangeOperation.id, { arrangeType: ArrangeTypeEnum.forward });
},
};
export const SetDrawingArrangeBackOperation: IOperation = {
id: 'drawing.operation.set-drawing-arrange-back',
type: CommandType.OPERATION,
handler: (accessor) => {
return accessor.get(ICommandService).syncExecuteCommand(SetDrawingArrangeOperation.id, { arrangeType: ArrangeTypeEnum.back });
},
};
export const SetDrawingArrangeBackwardOperation: IOperation = {
id: 'drawing.operation.set-drawing-arrange-backward',
type: CommandType.OPERATION,
handler: (accessor) => {
return accessor.get(ICommandService).syncExecuteCommand(SetDrawingArrangeOperation.id, { arrangeType: ArrangeTypeEnum.backward });
},
};