From 76f6c29b4c6a8068e85ca7137ba5cbcb9bd8a365 Mon Sep 17 00:00:00 2001 From: zw Date: Sat, 21 Sep 2024 14:07:05 +0800 Subject: [PATCH 1/4] fix: clipboard --- .../src/commands/commands/clipboard.inner.command.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts b/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts index 909cf55bcdb..d42bd93cb55 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 = { const commandService = accessor.get(ICommandService); const docSelectionManagerService = accessor.get(DocSelectionManagerService); const univerInstanceService = accessor.get(IUniverInstanceService); - const selections = docSelectionManagerService.getCurrentTextRanges(); + const _selections = docSelectionManagerService.getCurrentTextRanges(); const { body, tableSource, drawings } = doc; - if (!Array.isArray(selections) || selections.length === 0 || body == null) { + if (!Array.isArray(_selections) || _selections.length === 0 || body == null) { return false; } @@ -100,7 +100,7 @@ export const InnerPasteCommand: ICommand = { if (docDataModel == null || originBody == null) { return false; } - + const selections = _selections.map((range) => BuildTextUtils.selection.getInsertSelection(range, originBody)); const unitId = docDataModel.getUnitId(); const doMutation: IMutationInfo = { From f65092c33539ccdf28e88c4e22e1b3c94816bb92 Mon Sep 17 00:00:00 2001 From: zw Date: Sat, 21 Sep 2024 14:33:09 +0800 Subject: [PATCH 2/4] fix: save doc --- .../editor/editing.render-controller.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts b/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts index 73f96a97889..cf070178893 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) { From ea2535974734b064bbf6068544873c8b4c3a086d Mon Sep 17 00:00:00 2001 From: zw Date: Sat, 21 Sep 2024 15:01:38 +0800 Subject: [PATCH 3/4] feat: update --- .../src/commands/operations/set-zoom-ratio.operation.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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.ts index ecde6e9fe55..a63cc19bd89 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 = { 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); }, }; From a350669f6ae39a8c76d1d59810df87f3d2ea50e5 Mon Sep 17 00:00:00 2001 From: zw Date: Sat, 21 Sep 2024 17:00:48 +0800 Subject: [PATCH 4/4] feat: update --- .../src/commands/commands/clipboard.inner.command.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts b/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts index 2852d3d9d50..80f60c6b6af 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 = { 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 = { if (docDataModel == null || originBody == null) { return false; } - const selections = _selections.map((range) => BuildTextUtils.selection.getInsertSelection(range, originBody)); + const selections = originSelections.map((range) => BuildTextUtils.selection.getInsertSelection(range, originBody)); const unitId = docDataModel.getUnitId(); const doMutation: IMutationInfo = {