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
fix(ui): fix generate facade should execute before hook (#4689)
ybzkyd4373091c2ac
diff --git a/packages/sheets-ui/src/facade/f-range.ts b/packages/sheets-ui/src/facade/f-range.tsindex afc2b3735f..55e69f8a0a 100644--- a/packages/sheets-ui/src/facade/f-range.ts+++ b/packages/sheets-ui/src/facade/f-range.ts@@ -225,7 +225,8 @@ class FRangeSheetsUIMixin extends FRange implements IFRangeSheetsUIMixin {}override generateHTML(): string {- const copyContent = this._injector.get(ISheetClipboardService).generateCopyContent(+ const clipboardService = this._injector.get(ISheetClipboardService);+ const copyContent = clipboardService.generateCopyContent(this._workbook.getUnitId(),this._worksheet.getSheetId(),this._rangediff --git a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts b/packages/sheets-ui/src/services/clipboard/clipboard.service.tsindex 78f30b96bb..d7a5b48507 100644--- a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts+++ b/packages/sheets-ui/src/services/clipboard/clipboard.service.ts@@ -208,8 +208,11 @@ export class SheetClipboardService extends Disposable implements ISheetClipboardreturn this._copyContentCache;}- generateCopyContent(workbookId: string, worksheetId: string, range: IRange): Nullable<ICopyContent> {+ generateCopyContent(workbookId: string, worksheetId: string, range: IRange, copyType: COPY_TYPE = COPY_TYPE.COPY): Nullable<ICopyContent> {+ const hooks = this._clipboardHooks;+ hooks.forEach((h) => h.onBeforeCopy?.(workbookId, worksheetId, range, copyType));const copyContent = this._generateCopyContent(workbookId, worksheetId, range, this._clipboardHooks);+ hooks.forEach((h) => h.onAfterCopy?.());return copyContent;}@@ -225,13 +228,10 @@ export class SheetClipboardService extends Disposable implements ISheetClipboardif (!worksheet) {return false;}- const hooks = this._clipboardHooks;const workbookId = workbook.getUnitId();const worksheetId = worksheet.getSheetId();- hooks.forEach((h) => h.onBeforeCopy?.(workbookId, worksheetId, selection.range, copyType));const copyContent = this.generateCopyContent(workbookId, worksheetId, selection.range);- hooks.forEach((h) => h.onAfterCopy?.());if (!copyContent) {return false;