fix(drawing): fix the issue of cut and delete float image (#6215)

This commit is contained in:
wpxp123456
2025-11-28 20:46:29 +08:00
committed by GitHub
parent f8af8e1bc4
commit cc3be15180
3 changed files with 11 additions and 6 deletions
@@ -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;