@windoc/core 0.3.22 → 0.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +39 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var version = "0.3.
|
|
2
|
+
var version = "0.3.23";
|
|
3
3
|
|
|
4
4
|
// src/dataset/enum/Common.ts
|
|
5
5
|
var MaxHeightRatio = /* @__PURE__ */ ((MaxHeightRatio2) => {
|
|
@@ -4422,6 +4422,7 @@ function mergeOption(options = {}) {
|
|
|
4422
4422
|
wordBreak: "break-word" /* BREAK_WORD */,
|
|
4423
4423
|
printPixelRatio: 3,
|
|
4424
4424
|
maskMargin: [0, 0, 0, 0],
|
|
4425
|
+
scrollPaddingLines: 3,
|
|
4425
4426
|
letterClass: [LETTER_CLASS.ENGLISH],
|
|
4426
4427
|
contextMenuDisableKeys: [],
|
|
4427
4428
|
shortcutDisableKeys: [],
|
|
@@ -6410,7 +6411,10 @@ var Cursor = class {
|
|
|
6410
6411
|
const agentCursorDom = this.cursorAgent.getAgentCursorDom();
|
|
6411
6412
|
if (document.activeElement !== agentCursorDom) {
|
|
6412
6413
|
agentCursorDom.focus({ preventScroll: true });
|
|
6414
|
+
const scrollContainer = findScrollContainer(this.container);
|
|
6415
|
+
const { scrollLeft, scrollTop } = scrollContainer;
|
|
6413
6416
|
agentCursorDom.setSelectionRange(0, 0);
|
|
6417
|
+
scrollContainer.scroll(scrollLeft, scrollTop);
|
|
6414
6418
|
}
|
|
6415
6419
|
}
|
|
6416
6420
|
drawCursor(payload) {
|
|
@@ -6480,7 +6484,6 @@ var Cursor = class {
|
|
|
6480
6484
|
this.recoveryCursor();
|
|
6481
6485
|
return;
|
|
6482
6486
|
}
|
|
6483
|
-
const oldTop = this.cursorDom.style.top;
|
|
6484
6487
|
const isReadonly = this.draw.isReadonly();
|
|
6485
6488
|
this.cursorDom.style.width = `${width * scale}px`;
|
|
6486
6489
|
this.cursorDom.style.backgroundColor = color;
|
|
@@ -6494,10 +6497,7 @@ var Cursor = class {
|
|
|
6494
6497
|
this._clearBlinkTimeout();
|
|
6495
6498
|
}
|
|
6496
6499
|
nextTick2(() => {
|
|
6497
|
-
this.moveCursorToVisible({
|
|
6498
|
-
cursorPosition,
|
|
6499
|
-
direction: parseInt(oldTop) > cursorTop ? "top" /* UP */ : "down" /* DOWN */
|
|
6500
|
-
});
|
|
6500
|
+
this.moveCursorToVisible({ cursorPosition });
|
|
6501
6501
|
});
|
|
6502
6502
|
}
|
|
6503
6503
|
recoveryCursor() {
|
|
@@ -6505,41 +6505,44 @@ var Cursor = class {
|
|
|
6505
6505
|
this._clearBlinkTimeout();
|
|
6506
6506
|
}
|
|
6507
6507
|
moveCursorToVisible(payload) {
|
|
6508
|
-
const { cursorPosition
|
|
6509
|
-
if (!cursorPosition
|
|
6508
|
+
const { cursorPosition } = payload;
|
|
6509
|
+
if (!cursorPosition) return;
|
|
6510
6510
|
const {
|
|
6511
6511
|
pageNo,
|
|
6512
|
-
coordinate: { leftTop
|
|
6512
|
+
coordinate: { leftTop },
|
|
6513
|
+
ascent,
|
|
6514
|
+
metrics: { boundingBoxAscent, boundingBoxDescent }
|
|
6513
6515
|
} = cursorPosition;
|
|
6514
|
-
const
|
|
6515
|
-
const
|
|
6516
|
-
const
|
|
6517
|
-
const
|
|
6518
|
-
const cursorBottom = cursorTop + cursorPosition.metrics.boundingBoxAscent + cursorPosition.metrics.boundingBoxDescent;
|
|
6519
|
-
const y = isUp ? cursorTop + prePageY : cursorBottom + prePageY;
|
|
6516
|
+
const containerRect = this.container.getBoundingClientRect();
|
|
6517
|
+
const pageOffset = pageNo * (this.draw.getHeight() + this.draw.getPageGap());
|
|
6518
|
+
const cursorTopViewport = containerRect.top + pageOffset + leftTop[1] + ascent - boundingBoxAscent;
|
|
6519
|
+
const cursorBottomViewport = cursorTopViewport + boundingBoxAscent + boundingBoxDescent;
|
|
6520
6520
|
const scrollContainer = findScrollContainer(this.container);
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
right: 0,
|
|
6524
|
-
top: 0,
|
|
6525
|
-
bottom: 0
|
|
6526
|
-
};
|
|
6521
|
+
let visibleTop;
|
|
6522
|
+
let visibleBottom;
|
|
6527
6523
|
if (scrollContainer === document.documentElement) {
|
|
6528
|
-
|
|
6529
|
-
|
|
6524
|
+
visibleTop = 0;
|
|
6525
|
+
visibleBottom = window.innerHeight;
|
|
6530
6526
|
} else {
|
|
6531
|
-
const
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
if (
|
|
6541
|
-
|
|
6542
|
-
|
|
6527
|
+
const scrollRect = scrollContainer.getBoundingClientRect();
|
|
6528
|
+
visibleTop = scrollRect.top;
|
|
6529
|
+
visibleBottom = scrollRect.bottom;
|
|
6530
|
+
}
|
|
6531
|
+
if (cursorTopViewport >= visibleTop && cursorBottomViewport <= visibleBottom) {
|
|
6532
|
+
return;
|
|
6533
|
+
}
|
|
6534
|
+
const scrollPadding = (boundingBoxAscent + boundingBoxDescent) * this.options.scrollPaddingLines;
|
|
6535
|
+
const { scrollLeft, scrollTop } = scrollContainer;
|
|
6536
|
+
if (cursorTopViewport < visibleTop) {
|
|
6537
|
+
scrollContainer.scroll(
|
|
6538
|
+
scrollLeft,
|
|
6539
|
+
scrollTop - (visibleTop - cursorTopViewport) - scrollPadding
|
|
6540
|
+
);
|
|
6541
|
+
} else {
|
|
6542
|
+
scrollContainer.scroll(
|
|
6543
|
+
scrollLeft,
|
|
6544
|
+
scrollTop + (cursorBottomViewport - visibleBottom) + scrollPadding
|
|
6545
|
+
);
|
|
6543
6546
|
}
|
|
6544
6547
|
}
|
|
6545
6548
|
};
|
|
@@ -8511,8 +8514,7 @@ function updown(evt, host) {
|
|
|
8511
8514
|
});
|
|
8512
8515
|
if (!isCollapsed) {
|
|
8513
8516
|
draw.getCursor().moveCursorToVisible({
|
|
8514
|
-
cursorPosition: positionList[isUp ? anchorStartIndex : anchorEndIndex]
|
|
8515
|
-
direction: isUp ? "top" /* UP */ : "down" /* DOWN */
|
|
8517
|
+
cursorPosition: positionList[isUp ? anchorStartIndex : anchorEndIndex]
|
|
8516
8518
|
});
|
|
8517
8519
|
}
|
|
8518
8520
|
}
|