@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.d.mts
CHANGED
|
@@ -1287,6 +1287,7 @@ interface IEditorOption {
|
|
|
1287
1287
|
historyMaxRecordCount?: number;
|
|
1288
1288
|
printPixelRatio?: number;
|
|
1289
1289
|
maskMargin?: IMargin;
|
|
1290
|
+
scrollPaddingLines?: number;
|
|
1290
1291
|
letterClass?: string[];
|
|
1291
1292
|
contextMenuDisableKeys?: string[];
|
|
1292
1293
|
shortcutDisableKeys?: string[];
|
|
@@ -1469,7 +1470,6 @@ type IDrawCursorOption = ICursorOption & {
|
|
|
1469
1470
|
hitLineStartIndex?: number;
|
|
1470
1471
|
};
|
|
1471
1472
|
interface IMoveCursorToVisibleOption {
|
|
1472
|
-
direction: MoveDirection;
|
|
1473
1473
|
cursorPosition: IElementPosition;
|
|
1474
1474
|
}
|
|
1475
1475
|
declare class Cursor {
|
package/dist/index.d.ts
CHANGED
|
@@ -1287,6 +1287,7 @@ interface IEditorOption {
|
|
|
1287
1287
|
historyMaxRecordCount?: number;
|
|
1288
1288
|
printPixelRatio?: number;
|
|
1289
1289
|
maskMargin?: IMargin;
|
|
1290
|
+
scrollPaddingLines?: number;
|
|
1290
1291
|
letterClass?: string[];
|
|
1291
1292
|
contextMenuDisableKeys?: string[];
|
|
1292
1293
|
shortcutDisableKeys?: string[];
|
|
@@ -1469,7 +1470,6 @@ type IDrawCursorOption = ICursorOption & {
|
|
|
1469
1470
|
hitLineStartIndex?: number;
|
|
1470
1471
|
};
|
|
1471
1472
|
interface IMoveCursorToVisibleOption {
|
|
1472
|
-
direction: MoveDirection;
|
|
1473
1473
|
cursorPosition: IElementPosition;
|
|
1474
1474
|
}
|
|
1475
1475
|
declare class Cursor {
|
package/dist/index.js
CHANGED
|
@@ -78,7 +78,7 @@ __export(index_exports, {
|
|
|
78
78
|
module.exports = __toCommonJS(index_exports);
|
|
79
79
|
|
|
80
80
|
// src/version.ts
|
|
81
|
-
var version = "0.3.
|
|
81
|
+
var version = "0.3.23";
|
|
82
82
|
|
|
83
83
|
// src/dataset/enum/Common.ts
|
|
84
84
|
var MaxHeightRatio = /* @__PURE__ */ ((MaxHeightRatio2) => {
|
|
@@ -4501,6 +4501,7 @@ function mergeOption(options = {}) {
|
|
|
4501
4501
|
wordBreak: "break-word" /* BREAK_WORD */,
|
|
4502
4502
|
printPixelRatio: 3,
|
|
4503
4503
|
maskMargin: [0, 0, 0, 0],
|
|
4504
|
+
scrollPaddingLines: 3,
|
|
4504
4505
|
letterClass: [LETTER_CLASS.ENGLISH],
|
|
4505
4506
|
contextMenuDisableKeys: [],
|
|
4506
4507
|
shortcutDisableKeys: [],
|
|
@@ -6489,7 +6490,10 @@ var Cursor = class {
|
|
|
6489
6490
|
const agentCursorDom = this.cursorAgent.getAgentCursorDom();
|
|
6490
6491
|
if (document.activeElement !== agentCursorDom) {
|
|
6491
6492
|
agentCursorDom.focus({ preventScroll: true });
|
|
6493
|
+
const scrollContainer = findScrollContainer(this.container);
|
|
6494
|
+
const { scrollLeft, scrollTop } = scrollContainer;
|
|
6492
6495
|
agentCursorDom.setSelectionRange(0, 0);
|
|
6496
|
+
scrollContainer.scroll(scrollLeft, scrollTop);
|
|
6493
6497
|
}
|
|
6494
6498
|
}
|
|
6495
6499
|
drawCursor(payload) {
|
|
@@ -6559,7 +6563,6 @@ var Cursor = class {
|
|
|
6559
6563
|
this.recoveryCursor();
|
|
6560
6564
|
return;
|
|
6561
6565
|
}
|
|
6562
|
-
const oldTop = this.cursorDom.style.top;
|
|
6563
6566
|
const isReadonly = this.draw.isReadonly();
|
|
6564
6567
|
this.cursorDom.style.width = `${width * scale}px`;
|
|
6565
6568
|
this.cursorDom.style.backgroundColor = color;
|
|
@@ -6573,10 +6576,7 @@ var Cursor = class {
|
|
|
6573
6576
|
this._clearBlinkTimeout();
|
|
6574
6577
|
}
|
|
6575
6578
|
nextTick2(() => {
|
|
6576
|
-
this.moveCursorToVisible({
|
|
6577
|
-
cursorPosition,
|
|
6578
|
-
direction: parseInt(oldTop) > cursorTop ? "top" /* UP */ : "down" /* DOWN */
|
|
6579
|
-
});
|
|
6579
|
+
this.moveCursorToVisible({ cursorPosition });
|
|
6580
6580
|
});
|
|
6581
6581
|
}
|
|
6582
6582
|
recoveryCursor() {
|
|
@@ -6584,41 +6584,44 @@ var Cursor = class {
|
|
|
6584
6584
|
this._clearBlinkTimeout();
|
|
6585
6585
|
}
|
|
6586
6586
|
moveCursorToVisible(payload) {
|
|
6587
|
-
const { cursorPosition
|
|
6588
|
-
if (!cursorPosition
|
|
6587
|
+
const { cursorPosition } = payload;
|
|
6588
|
+
if (!cursorPosition) return;
|
|
6589
6589
|
const {
|
|
6590
6590
|
pageNo,
|
|
6591
|
-
coordinate: { leftTop
|
|
6591
|
+
coordinate: { leftTop },
|
|
6592
|
+
ascent,
|
|
6593
|
+
metrics: { boundingBoxAscent, boundingBoxDescent }
|
|
6592
6594
|
} = cursorPosition;
|
|
6593
|
-
const
|
|
6594
|
-
const
|
|
6595
|
-
const
|
|
6596
|
-
const
|
|
6597
|
-
const cursorBottom = cursorTop + cursorPosition.metrics.boundingBoxAscent + cursorPosition.metrics.boundingBoxDescent;
|
|
6598
|
-
const y = isUp ? cursorTop + prePageY : cursorBottom + prePageY;
|
|
6595
|
+
const containerRect = this.container.getBoundingClientRect();
|
|
6596
|
+
const pageOffset = pageNo * (this.draw.getHeight() + this.draw.getPageGap());
|
|
6597
|
+
const cursorTopViewport = containerRect.top + pageOffset + leftTop[1] + ascent - boundingBoxAscent;
|
|
6598
|
+
const cursorBottomViewport = cursorTopViewport + boundingBoxAscent + boundingBoxDescent;
|
|
6599
6599
|
const scrollContainer = findScrollContainer(this.container);
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
right: 0,
|
|
6603
|
-
top: 0,
|
|
6604
|
-
bottom: 0
|
|
6605
|
-
};
|
|
6600
|
+
let visibleTop;
|
|
6601
|
+
let visibleBottom;
|
|
6606
6602
|
if (scrollContainer === document.documentElement) {
|
|
6607
|
-
|
|
6608
|
-
|
|
6603
|
+
visibleTop = 0;
|
|
6604
|
+
visibleBottom = window.innerHeight;
|
|
6609
6605
|
} else {
|
|
6610
|
-
const
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
if (
|
|
6620
|
-
|
|
6621
|
-
|
|
6606
|
+
const scrollRect = scrollContainer.getBoundingClientRect();
|
|
6607
|
+
visibleTop = scrollRect.top;
|
|
6608
|
+
visibleBottom = scrollRect.bottom;
|
|
6609
|
+
}
|
|
6610
|
+
if (cursorTopViewport >= visibleTop && cursorBottomViewport <= visibleBottom) {
|
|
6611
|
+
return;
|
|
6612
|
+
}
|
|
6613
|
+
const scrollPadding = (boundingBoxAscent + boundingBoxDescent) * this.options.scrollPaddingLines;
|
|
6614
|
+
const { scrollLeft, scrollTop } = scrollContainer;
|
|
6615
|
+
if (cursorTopViewport < visibleTop) {
|
|
6616
|
+
scrollContainer.scroll(
|
|
6617
|
+
scrollLeft,
|
|
6618
|
+
scrollTop - (visibleTop - cursorTopViewport) - scrollPadding
|
|
6619
|
+
);
|
|
6620
|
+
} else {
|
|
6621
|
+
scrollContainer.scroll(
|
|
6622
|
+
scrollLeft,
|
|
6623
|
+
scrollTop + (cursorBottomViewport - visibleBottom) + scrollPadding
|
|
6624
|
+
);
|
|
6622
6625
|
}
|
|
6623
6626
|
}
|
|
6624
6627
|
};
|
|
@@ -8590,8 +8593,7 @@ function updown(evt, host) {
|
|
|
8590
8593
|
});
|
|
8591
8594
|
if (!isCollapsed) {
|
|
8592
8595
|
draw.getCursor().moveCursorToVisible({
|
|
8593
|
-
cursorPosition: positionList[isUp ? anchorStartIndex : anchorEndIndex]
|
|
8594
|
-
direction: isUp ? "top" /* UP */ : "down" /* DOWN */
|
|
8596
|
+
cursorPosition: positionList[isUp ? anchorStartIndex : anchorEndIndex]
|
|
8595
8597
|
});
|
|
8596
8598
|
}
|
|
8597
8599
|
}
|