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(docs-ui): quick insert menu not show in table cell (#4993)
ZhangWei065dc827dabf
diff --git a/packages/docs-quick-insert-ui/src/services/doc-quick-insert-popup.service.ts b/packages/docs-quick-insert-ui/src/services/doc-quick-insert-popup.service.tsindex 1c5e25a54a..774fe3bf64 100644--- a/packages/docs-quick-insert-ui/src/services/doc-quick-insert-popup.service.ts+++ b/packages/docs-quick-insert-ui/src/services/doc-quick-insert-popup.service.ts@@ -197,14 +197,14 @@ export class DocQuickInsertPopupService extends Disposable {showPopup(options: { popup: IDocPopup; index: number; unitId: string }) {const { popup, index, unitId } = options;-this.closePopup();const currentDoc = this._univerInstanceService.getUnit<DocumentDataModel>(unitId);const paragraph = currentDoc?.getBody()?.paragraphs?.find((p) => p.startIndex > index);if (!paragraph) {return;}- const paragraphBound = this.getDocEventManagerService(unitId)?.paragraphBounds.get(paragraph.startIndex);+ const docEventManagerService = this.getDocEventManagerService(unitId);+ const paragraphBound = docEventManagerService?.findParagraphBoundByIndex(paragraph.startIndex);if (!paragraphBound) {return;}diff --git a/packages/docs-ui/src/services/doc-event-manager.service.ts b/packages/docs-ui/src/services/doc-event-manager.service.tsindex a4a532b9e6..7ecd8b3260 100644--- a/packages/docs-ui/src/services/doc-event-manager.service.ts+++ b/packages/docs-ui/src/services/doc-event-manager.service.ts@@ -733,4 +733,15 @@ export class DocEventManagerService extends Disposable implements IRenderModulethis._buildParagraphBounds();return this._paragraphBounds;}++ findParagraphBoundByIndex(index: number) {+ this._buildParagraphBounds();+ const paragraph = this._paragraphBounds.get(index);+ if (paragraph) {+ return paragraph;+ }++ const tableParagraph = Array.from(this._tableParagraphBounds.values()).flat().find((bound) => bound.startIndex === index);+ return tableParagraph;+ }}