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): paste link on link (#3518)
zhangw9fcd45b728df
diff --git a/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts b/packages/docs-ui/src/commands/commands/clipboard.inner.command.tsindex a63c99efdb..80f60c6b6a 100644--- a/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts+++ b/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts@@ -89,9 +89,9 @@ export const InnerPasteCommand: ICommand<IInnerPasteCommandParams> = {const commandService = accessor.get(ICommandService);const docSelectionManagerService = accessor.get(DocSelectionManagerService);const univerInstanceService = accessor.get(IUniverInstanceService);- const selections = docSelectionManagerService.getTextRanges();+ const originSelections = docSelectionManagerService.getTextRanges();const { body, tableSource, drawings } = doc;- if (!Array.isArray(selections) || selections.length === 0 || body == null) {+ if (!Array.isArray(originSelections) || originSelections.length === 0 || body == null) {return false;}@@ -100,7 +100,7 @@ export const InnerPasteCommand: ICommand<IInnerPasteCommandParams> = {if (docDataModel == null || originBody == null) {return false;}-+ const selections = originSelections.map((range) => BuildTextUtils.selection.getInsertSelection(range, originBody));const unitId = docDataModel.getUnitId();const doMutation: IMutationInfo<IRichTextEditingMutationParams> = {diff --git a/packages/sheets-ui/src/commands/operations/set-zoom-ratio.operation.ts b/packages/sheets-ui/src/commands/operations/set-zoom-ratio.operation.tsindex ecde6e9fe5..a63cc19bd8 100644--- a/packages/sheets-ui/src/commands/operations/set-zoom-ratio.operation.ts+++ b/packages/sheets-ui/src/commands/operations/set-zoom-ratio.operation.ts@@ -14,10 +14,11 @@* limitations under the License.*/-import type { IOperation } from '@univerjs/core';import { CommandType } from '@univerjs/core';import { IRenderManagerService } from '@univerjs/engine-render';+import type { IOperation } from '@univerjs/core';import { SheetsZoomRenderController } from '../../controllers/render-controllers/zoom.render-controller';+import { IEditorBridgeService } from '../../services/editor-bridge.service';export interface ISetZoomRatioOperationParams {zoomRatio: number;@@ -31,8 +32,11 @@ export const SetZoomRatioOperation: IOperation<ISetZoomRatioOperationParams> = {handler: (accessor, params: ISetZoomRatioOperationParams) => {const renderManagerService = accessor.get(IRenderManagerService);const renderUnit = renderManagerService.getRenderById(params.unitId);-+ const editorBridgeService = accessor.get(IEditorBridgeService);if (!renderUnit) return false;+ const state = editorBridgeService.isVisible();+ if (state.unitId === params.unitId && state.visible) return false;+return renderUnit.with(SheetsZoomRenderController).updateZoom(params.subUnitId, params.zoomRatio);},};diff --git a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts b/packages/sheets-ui/src/controllers/editor/editing.render-controller.tsindex 113307ae85..3374fa5698 100644--- a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts+++ b/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts@@ -1096,13 +1096,6 @@ export function getCellDataByInput(cellData.si = null;cellData.p = null;cellData.t = CellValueType.FORCE_STRING;- } else if (numfmt.parseDate(newDataStream) || numfmt.parseNumber(newDataStream) || numfmt.parseTime(newDataStream)) {- // If it can be converted to a number and is not forced to be a string, then the style should keep prev style.- cellData.v = newDataStream;- cellData.f = null;- cellData.si = null;- cellData.p = null;- cellData.t = CellValueType.NUMBER;} else if (isRichText(body)) {if (body.dataStream === '\r\n') {cellData.v = '';@@ -1115,6 +1108,13 @@ export function getCellDataByInput(cellData.f = null;cellData.si = null;}+ } else if (numfmt.parseDate(newDataStream) || numfmt.parseNumber(newDataStream) || numfmt.parseTime(newDataStream)) {+ // If it can be converted to a number and is not forced to be a string, then the style should keep prev style.+ cellData.v = newDataStream;+ cellData.f = null;+ cellData.si = null;+ cellData.p = null;+ cellData.t = CellValueType.NUMBER;} else {// If the data is empty, the data is set to null.if ((newDataStream === cellData.v || (newDataStream === '' && cellData.v == null)) && cellData.p == null) {diff --git a/packages/sheets/src/commands/operations/selection.operation.ts b/packages/sheets/src/commands/operations/selection.operation.tsindex 993b4bd735..c87f6f1fbc 100644--- a/packages/sheets/src/commands/operations/selection.operation.ts+++ b/packages/sheets/src/commands/operations/selection.operation.ts@@ -14,11 +14,11 @@* limitations under the License.*/-import type { IOperation } from '@univerjs/core';import { CommandType } from '@univerjs/core';+import type { IOperation } from '@univerjs/core';-import type { ISelectionWithStyle } from '../../basics/selection';import { getSelectionsService } from '../utils/selection-command-util';+import type { ISelectionWithStyle } from '../../basics/selection';import type { SelectionMoveType } from '../../services/selections/selection-manager.service';export interface ISetSelectionsOperationParams {