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(facade): fix hyperlink update and remove command (#4287)
wpxp123456e60e45fa6e53
diff --git a/packages/sheets-hyper-link/src/commands/commands/remove-hyper-link.command.ts b/packages/sheets-hyper-link/src/commands/commands/remove-hyper-link.command.tsindex 4b4a96bd7f..ce11853cf7 100644--- a/packages/sheets-hyper-link/src/commands/commands/remove-hyper-link.command.ts+++ b/packages/sheets-hyper-link/src/commands/commands/remove-hyper-link.command.ts@@ -60,10 +60,10 @@ export const CancelHyperLinkCommand: ICommand<ICancelHyperLinkCommandParams> = {if (!doc?.documentModel) return false;const snapshot = Tools.deepClone(doc.documentModel!.getSnapshot());- const range = snapshot.body?.customRanges?.find((range) => range.rangeId === id);+ const range = snapshot.body?.customRanges?.find((range) => `${range.rangeId}_${range.startIndex}_${range.endIndex}` === id);if (!range) return false;- const textX = BuildTextUtils.customRange.delete(accessor, { documentDataModel: doc.documentModel, rangeId: id });+ const textX = BuildTextUtils.customRange.delete(accessor, { documentDataModel: doc.documentModel, rangeId: range.rangeId });if (!textX) return false;const newBody = TextX.apply(snapshot.body!, textX.serialize());diff --git a/packages/sheets-hyper-link/src/commands/commands/update-hyper-link.command.ts b/packages/sheets-hyper-link/src/commands/commands/update-hyper-link.command.tsindex fe9e6506ac..17503c6cf5 100644--- a/packages/sheets-hyper-link/src/commands/commands/update-hyper-link.command.ts+++ b/packages/sheets-hyper-link/src/commands/commands/update-hyper-link.command.ts@@ -63,7 +63,7 @@ export const UpdateHyperLinkCommand: ICommand<IUpdateHyperLinkCommandParams> = {if (!doc?.documentModel) return false;const snapshot = doc.documentModel.getSnapshot();- const range = snapshot.body?.customRanges?.find((range) => range.rangeId === id);+ const range = snapshot.body?.customRanges?.find((range) => `${range.rangeId}_${range.startIndex}_${range.endIndex}` === id);if (!range) return false;const newId = generateRandomId();