Skip to content

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.

fix(doc): no need to refresh selection (#513)

Ran Luof62f3257eee5
diff --git a/packages/base-docs/src/controllers/text-selection.controller.ts b/packages/base-docs/src/controllers/text-selection.controller.ts
index e091b554f9..809f0d6512 100644
--- a/packages/base-docs/src/controllers/text-selection.controller.ts
+++ b/packages/base-docs/src/controllers/text-selection.controller.ts
@@ -210,7 +210,7 @@ export class TextSelectionController extends Disposable {
this._textSelectionRenderManager.changeRuntime(skeleton, scene);
- this._textSelectionManagerService.setCurrentSelection({
+ this._textSelectionManagerService.setCurrentSelectionNotRefresh({
pluginName: NORMAL_TEXT_SELECTION_PLUGIN_NAME,
unitId,
});
diff --git a/packages/base-docs/src/controllers/zoom.controller.ts b/packages/base-docs/src/controllers/zoom.controller.ts
index 63c1f0406a..86a162f8a9 100644
--- a/packages/base-docs/src/controllers/zoom.controller.ts
+++ b/packages/base-docs/src/controllers/zoom.controller.ts
@@ -131,7 +131,7 @@ export class ZoomController extends Disposable {
const zoomRatio = documentModel.zoomRatio || 1;
- this._updateViewZoom(zoomRatio);
+ this._updateViewZoom(zoomRatio, false);
})
)
);
@@ -159,7 +159,7 @@ export class ZoomController extends Disposable {
);
}
- private _updateViewZoom(zoomRatio: number) {
+ private _updateViewZoom(zoomRatio: number, needRefreshSelection = true) {
const docObject = this._getDocObject();
if (docObject == null) {
return;
@@ -169,7 +169,9 @@ export class ZoomController extends Disposable {
this._calculatePagePosition(docObject, zoomRatio);
- this._textSelectionManagerService.refreshSelection();
+ if (needRefreshSelection) {
+ this._textSelectionManagerService.refreshSelection();
+ }
docObject.scene.getTransformer()?.hideControl();
}