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(docs-link-ui): link text error (#3620)

zhangw1e1522c08a07
diff --git a/packages/core/src/docs/data-model/text-x/build-utils/selection.ts b/packages/core/src/docs/data-model/text-x/build-utils/selection.ts
index e2e8dd9315..27f5da4037 100644
--- a/packages/core/src/docs/data-model/text-x/build-utils/selection.ts
+++ b/packages/core/src/docs/data-model/text-x/build-utils/selection.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import { DeleteDirection } from '../../../../types/enum';
-import { DataStreamTreeTokenType } from '../../types';
-import { TextXActionType } from '../action-types';
-import { isCustomRangeSplitSymbol, isIntersecting, shouldDeleteCustomRange } from './custom-range';
import type { Nullable } from '../../../../shared';
import type { ITextRange } from '../../../../sheets/typedef';
import type { IDocumentBody } from '../../../../types/interfaces';
import type { IDeleteAction, IRetainAction } from '../action-types';
+import { DeleteDirection } from '../../../../types/enum';
+import { DataStreamTreeTokenType } from '../../types';
+import { TextXActionType } from '../action-types';
+import { isCustomRangeSplitSymbol, isIntersecting, shouldDeleteCustomRange } from './custom-range';
export function makeSelection(startOffset: number, endOffset?: number): ITextRange {
if (typeof endOffset === 'undefined') {
@@ -247,14 +247,15 @@ export function getRetainAndDeleteFromReplace(
return;
}
+ // only retain when the custom-range was intersecting with but not fully contained in the text-range.
if (range.startIndex - memoryCursor >= textStart &&
- range.startIndex - memoryCursor <= textEnd &&
- range.endIndex - memoryCursor > textEnd) {
+ range.startIndex - memoryCursor < textEnd &&
+ range.endIndex - memoryCursor >= textEnd) {
retainPoints.add(range.startIndex);
}
if (range.endIndex - memoryCursor >= textStart &&
- range.endIndex - memoryCursor <= textEnd &&
- range.startIndex < textStart) {
+ range.endIndex - memoryCursor < textEnd &&
+ range.startIndex - memoryCursor < textStart) {
retainPoints.add(range.endIndex);
}
});