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: min cursor height and move cursor (#2789)
Ran Luobeb91465435c
diff --git a/packages/docs/src/controllers/move-cursor.controller.ts b/packages/docs/src/controllers/move-cursor.controller.tsindex dfe0e6e336..14cdacc43f 100644--- a/packages/docs/src/controllers/move-cursor.controller.ts+++ b/packages/docs/src/controllers/move-cursor.controller.ts@@ -259,8 +259,8 @@ export class MoveCursorController extends Disposable {const newPos = this._getTopOrBottomPosition(skeleton,- direction === Direction.UP ? startNode : endNode,- direction === Direction.UP ? startNodePosition : endNodePosition,+ direction === Direction.UP ? startNode : (collapsed ? startNode : endNode),+ direction === Direction.UP ? startNodePosition : (collapsed ? startNodePosition : endNodePosition),direction === Direction.DOWN);diff --git a/packages/engine-render/src/components/docs/text-selection/text-range.ts b/packages/engine-render/src/components/docs/text-selection/text-range.tsindex d85e7c9f8b..8aaf14ffac 100644--- a/packages/engine-render/src/components/docs/text-selection/text-range.ts+++ b/packages/engine-render/src/components/docs/text-selection/text-range.ts@@ -417,7 +417,15 @@ export class TextRange {private _createOrUpdateAnchor(pointsGroup: IPoint[][], docsLeft: number, docsTop: number, glyph: Nullable<IDocumentSkeletonGlyph>) {const bounding = getAnchorBounding(pointsGroup);- const { left: boundingLeft, top: boundingTop, height } = bounding;+ const { left: boundingLeft } = bounding;+ let { top: boundingTop, height } = bounding;+ const MIN_CURSOR_HEIGHT = 14;++ if (height < MIN_CURSOR_HEIGHT) {+ boundingTop -= MIN_CURSOR_HEIGHT - height;+ height = MIN_CURSOR_HEIGHT;+ }+const ITALIC_DEGREE = 12;let left = boundingLeft + docsLeft;const top = boundingTop + docsTop;