mirror of
https://github.com/dream-num/univer.git
synced 2026-08-28 23:01:30 +08:00
fix(drawing): fix the issue of cut and delete float image (#6215)
This commit is contained in:
@@ -258,10 +258,6 @@ export class Transformer extends Disposable implements ITransformerConfig {
|
||||
}
|
||||
|
||||
clearSelectedObjects() {
|
||||
if (this._selectedObjectMap.size === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._selectedObjectMap.clear();
|
||||
this._cancelFocusSubscription?.unsubscribe();
|
||||
this._cancelFocusSubscription = null;
|
||||
|
||||
@@ -120,11 +120,17 @@ export class SheetsDrawingCopyPasteController extends Disposable {
|
||||
id: 'SHEET_IMAGE_UI_PLUGIN',
|
||||
|
||||
onBeforeCopy: (unitId, subUnitId, range, copyType) => {
|
||||
this._copyInfo = null;
|
||||
|
||||
const focusDrawings = this._focusedDrawings;
|
||||
if (focusDrawings.length > 0) {
|
||||
// handle single drawing copy
|
||||
const [drawing] = focusDrawings;
|
||||
|
||||
if (drawing.drawingType !== DrawingTypeEnum.DRAWING_IMAGE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (copyType === COPY_TYPE.CUT) {
|
||||
const params: IDeleteDrawingCommandParams = {
|
||||
unitId,
|
||||
@@ -228,6 +234,9 @@ export class SheetsDrawingCopyPasteController extends Disposable {
|
||||
|
||||
Object.keys(drawings).forEach((drawingId) => {
|
||||
const drawing = drawings[drawingId];
|
||||
if (drawing.drawingType !== DrawingTypeEnum.DRAWING_IMAGE) {
|
||||
return;
|
||||
}
|
||||
const { transform } = drawing;
|
||||
if ((drawing as ISheetDrawing).anchorType !== SheetDrawingAnchorType.Both) {
|
||||
return;
|
||||
|
||||
@@ -136,7 +136,7 @@ export interface ISheetClipboardService {
|
||||
rePasteWithPasteType(type: IPasteHookKeyType): boolean;
|
||||
disposePasteOptionsCache(): void;
|
||||
|
||||
generateCopyContent(workbookId: string, worksheetId: string, range: IRange): Nullable<ICopyContent>;
|
||||
generateCopyContent(workbookId: string, worksheetId: string, range: IRange, copyType?: COPY_TYPE): Nullable<ICopyContent>;
|
||||
copyContentCache(): CopyContentCache; // return the cache content for inner copy/cut/paste.
|
||||
addClipboardHook(hook: ISheetClipboardHook): IDisposable; // add a hook to the clipboard service
|
||||
getClipboardHooks(): ISheetClipboardHook[]; // get all hooks
|
||||
@@ -239,7 +239,7 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard
|
||||
const workbookId = workbook.getUnitId();
|
||||
const worksheetId = worksheet.getSheetId();
|
||||
|
||||
const copyContent = this.generateCopyContent(workbookId, worksheetId, selection.range);
|
||||
const copyContent = this.generateCopyContent(workbookId, worksheetId, selection.range, copyType);
|
||||
|
||||
if (!copyContent) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user