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(sheets-ui): room slide does not need to be disabled
Wenzhao Hu45c60bfe50d9
diff --git a/packages/sheets-ui/src/views/count-bar/ZoomSlider.tsx b/packages/sheets-ui/src/views/count-bar/ZoomSlider.tsxindex 3da32c0c3c..fab79a8bca 100644--- a/packages/sheets-ui/src/views/count-bar/ZoomSlider.tsx+++ b/packages/sheets-ui/src/views/count-bar/ZoomSlider.tsx@@ -15,18 +15,13 @@*/import {- EDITOR_ACTIVATED,- FOCUSING_UNIVER_EDITOR,ICommandService,- IContextService,IUniverInstanceService,} from '@univerjs/core';-import { useObservable } from '@univerjs/ui';import { Slider } from '@univerjs/design';import { SetWorksheetActivateCommand } from '@univerjs/sheets';import { useDependency } from '@wendellhu/redi/react-bindings';-import React, { useEffect, useState } from 'react';-import { combineLatest, debounceTime, map } from 'rxjs';+import React, { useCallback, useEffect, useState } from 'react';import { SetZoomRatioCommand } from '../../commands/commands/set-zoom-ratio.command';import { SetZoomRatioOperation } from '../../commands/operations/set-zoom-ratio.operation';@@ -34,29 +29,16 @@ import { SHEET_ZOOM_RANGE } from '../../common/keys';const ZOOM_MAP = [50, 80, 100, 130, 150, 170, 200, 400];-const DISABLE_DEBOUNCE_TIME = 100;-export function ZoomSlider() {const commandService = useDependency(ICommandService);const univerInstanceService = useDependency(IUniverInstanceService);- const contextService = useDependency(IContextService);- const currentZoom = getCurrentZoom();- const [zoom, setZoom] = useState(currentZoom);- const sheetEditorFocused = useObservable(- () =>- combineLatest(- contextService.subscribeContextValue$(FOCUSING_UNIVER_EDITOR),- contextService.subscribeContextValue$(EDITOR_ACTIVATED)- ).pipe(- map(([editorFocus, editorActivated]) => editorFocus && !editorActivated),- debounceTime(DISABLE_DEBOUNCE_TIME)- ),- true,- false,- [FOCUSING_UNIVER_EDITOR]- );- const disabled = !sheetEditorFocused;+ const getCurrentZoom = useCallback(() => {+ const currentZoom = univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getZoomRatio() * 100 || 100;+ return Math.round(currentZoom);+ }, [univerInstanceService]);++ const [zoom, setZoom] = useState(() => getCurrentZoom());useEffect(() => {const disposable = commandService.onCommandExecuted((commandInfo) => {@@ -66,14 +48,7 @@ export function ZoomSlider() {}});return disposable.dispose;- }, [commandService]);-- function getCurrentZoom() {- const currentZoom =- univerInstanceService.getCurrentUniverSheetInstance().getActiveSheet().getZoomRatio() * 100 || 100;-- return Math.round(currentZoom);- }+ }, [commandService, getCurrentZoom]);function handleChange(value: number) {setZoom(value);@@ -94,7 +69,6 @@ export function ZoomSlider() {return (<Slider- disabled={disabled}min={SHEET_ZOOM_RANGE[0]}value={zoom}shortcuts={ZOOM_MAP}