@zero-library/common 2.4.2 → 2.4.4
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.cjs.js +93 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.esm.js +93 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -359,10 +359,12 @@ type ToolbarItem = 'undo-redo' | 'heading' | 'list' | 'block' | 'format' | 'scri
|
|
|
359
359
|
* 分页功能配置接口
|
|
360
360
|
*/
|
|
361
361
|
interface PageNoConfig {
|
|
362
|
+
/** 当前页码,默认为1 */
|
|
363
|
+
pageNo?: number;
|
|
362
364
|
/** 是否启用分页功能,默认为false */
|
|
363
365
|
enabled: boolean;
|
|
364
366
|
/** 页面滚动回调 */
|
|
365
|
-
onScrollPage?: (
|
|
367
|
+
onScrollPage?: (pageNo: number) => void;
|
|
366
368
|
}
|
|
367
369
|
|
|
368
370
|
/**
|
|
@@ -2501,4 +2503,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
|
|
|
2501
2503
|
clear: () => void;
|
|
2502
2504
|
};
|
|
2503
2505
|
|
|
2504
|
-
export { type AnnotationConfig, type AnnotationType, _default$q as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, type CollectionConfig, type CollectionType, type ComponentMapType, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, _default$p as DocxPreview, type DocxPreviewProps, _default$o as FileIcon, type FileIconProps, _default$n as FilePreview, _default$m as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$e as MarkDrawing, type MarkDrawingProps, _default$f as MarkdownEditor, type MarkdownEditorProps, _default$l as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, _default$k as PdfImagePreview, type PdfImagePreviewProps, _default$j as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$d as RenderMarkdown, type RenderMarkdownProps, _default$c as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$b as UserAvatar, type UserAvatarProps, _default$i as VideoPlayer, type VideoPlayerProps, type WebSocketProps, type WebSocketType, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, _default$9 as useAsyncQueue, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$a as useIframeRelayBridge, _default$3 as useRefState, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };
|
|
2506
|
+
export { type AnnotationConfig, type AnnotationType, _default$q as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, type CollectionConfig, type CollectionType, type ComponentMapType, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, _default$p as DocxPreview, type DocxPreviewProps, _default$o as FileIcon, type FileIconProps, _default$n as FilePreview, _default$m as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$e as MarkDrawing, type MarkDrawingProps, _default$f as MarkdownEditor, type MarkdownEditorProps, _default$l as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, type PageNoConfig, _default$k as PdfImagePreview, type PdfImagePreviewProps, _default$j as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$d as RenderMarkdown, type RenderMarkdownProps, _default$c as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$b as UserAvatar, type UserAvatarProps, _default$i as VideoPlayer, type VideoPlayerProps, type WebSocketProps, type WebSocketType, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, _default$9 as useAsyncQueue, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$a as useIframeRelayBridge, _default$3 as useRefState, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };
|
package/dist/index.d.ts
CHANGED
|
@@ -359,10 +359,12 @@ type ToolbarItem = 'undo-redo' | 'heading' | 'list' | 'block' | 'format' | 'scri
|
|
|
359
359
|
* 分页功能配置接口
|
|
360
360
|
*/
|
|
361
361
|
interface PageNoConfig {
|
|
362
|
+
/** 当前页码,默认为1 */
|
|
363
|
+
pageNo?: number;
|
|
362
364
|
/** 是否启用分页功能,默认为false */
|
|
363
365
|
enabled: boolean;
|
|
364
366
|
/** 页面滚动回调 */
|
|
365
|
-
onScrollPage?: (
|
|
367
|
+
onScrollPage?: (pageNo: number) => void;
|
|
366
368
|
}
|
|
367
369
|
|
|
368
370
|
/**
|
|
@@ -2501,4 +2503,4 @@ declare function createTokenManager({ key, storage }: TokenManagerProps): {
|
|
|
2501
2503
|
clear: () => void;
|
|
2502
2504
|
};
|
|
2503
2505
|
|
|
2504
|
-
export { type AnnotationConfig, type AnnotationType, _default$q as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, type CollectionConfig, type CollectionType, type ComponentMapType, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, _default$p as DocxPreview, type DocxPreviewProps, _default$o as FileIcon, type FileIconProps, _default$n as FilePreview, _default$m as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$e as MarkDrawing, type MarkDrawingProps, _default$f as MarkdownEditor, type MarkdownEditorProps, _default$l as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, _default$k as PdfImagePreview, type PdfImagePreviewProps, _default$j as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$d as RenderMarkdown, type RenderMarkdownProps, _default$c as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$b as UserAvatar, type UserAvatarProps, _default$i as VideoPlayer, type VideoPlayerProps, type WebSocketProps, type WebSocketType, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, _default$9 as useAsyncQueue, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$a as useIframeRelayBridge, _default$3 as useRefState, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };
|
|
2506
|
+
export { type AnnotationConfig, type AnnotationType, _default$q as AudioPlayer, type AudioPlayerProps, BusinessCode, type CacheMessage, type CollectionConfig, type CollectionType, type ComponentMapType, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, _default$p as DocxPreview, type DocxPreviewProps, _default$o as FileIcon, type FileIconProps, _default$n as FilePreview, _default$m as FilePreviewDrawer, type FilePreviewDrawerProps, type FilePreviewProps, type FindTreeNodesOptions, type FormatSizeOptions, HttpStatus, _default$h as Iframe, type IframeProps, _default$g as LazyComponent, type LazyComponentProps, _default$e as MarkDrawing, type MarkDrawingProps, _default$f as MarkdownEditor, type MarkdownEditorProps, _default$l as MarkdownPreview, type MarkdownPreviewProps, MultiEmailValidator, type PageNoConfig, _default$k as PdfImagePreview, type PdfImagePreviewProps, _default$j as PdfPreview, type PdfPreviewProps, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, type RenderControl, _default$d as RenderMarkdown, type RenderMarkdownProps, _default$c as RenderWrapper, type RenderWrapperProps, type RequestConfig, type SecureManagerProps, type SetIntervalType, type SizeUnit, ThanNumLengthValidator, ThanNumValidator, type TokenManagerProps, _default$b as UserAvatar, type UserAvatarProps, _default$i as VideoPlayer, type VideoPlayerProps, type WebSocketProps, type WebSocketType, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, _default$9 as useAsyncQueue, _default$8 as useAutoRefresh, _default$7 as useCountDown, _default$6 as useCreateValtioContext, _default$5 as useDebounce, _default$4 as useDeepEffect, _default$a as useIframeRelayBridge, _default$3 as useRefState, _default$2 as useSyncInput, _default$1 as useThrottle, _default as useWebSocket };
|
package/dist/index.esm.js
CHANGED
|
@@ -2434,6 +2434,7 @@ var HorizontalRule = TiptapHorizontalRule.extend({
|
|
|
2434
2434
|
// src/components/MarkdownEditor/pageNo/constant.ts
|
|
2435
2435
|
var PAGE_NO_TAG = "page-no";
|
|
2436
2436
|
var PAGE_NO_KEY = "PageNo";
|
|
2437
|
+
var SCROLL_TOP_OFFSET = 80;
|
|
2437
2438
|
|
|
2438
2439
|
// src/components/MarkdownEditor/pageNo/pageNoMark.ts
|
|
2439
2440
|
var pageNoMark_default = Node$1.create({
|
|
@@ -2563,7 +2564,7 @@ var PageNoExtension = Extension.create({
|
|
|
2563
2564
|
pageNos.forEach((node) => {
|
|
2564
2565
|
const rect = node.getBoundingClientRect();
|
|
2565
2566
|
const top = rect.top - containerTop;
|
|
2566
|
-
if (Math.abs(top) <=
|
|
2567
|
+
if (Math.abs(top) <= SCROLL_TOP_OFFSET) {
|
|
2567
2568
|
closestNode = node;
|
|
2568
2569
|
closestTopDiff = 0;
|
|
2569
2570
|
} else if (top < 0 && top > closestTopDiff) {
|
|
@@ -3628,13 +3629,45 @@ function scrollEditorViewToPosInNextFrame(view, pos, options) {
|
|
|
3628
3629
|
const { align = "start", behavior = "auto", offset: offset3 = 0 } = options || {};
|
|
3629
3630
|
requestAnimationFrame(() => {
|
|
3630
3631
|
try {
|
|
3631
|
-
const result = view.domAtPos(pos);
|
|
3632
|
-
if (!result) return;
|
|
3633
|
-
const el = result.node.nodeType === Node.TEXT_NODE ? result.node.parentElement : result.node;
|
|
3634
|
-
if (!el) return;
|
|
3635
3632
|
const scrollParent = getScrollParent(view.dom);
|
|
3633
|
+
if (!scrollParent) return;
|
|
3636
3634
|
const parentRect = scrollParent.getBoundingClientRect();
|
|
3637
|
-
|
|
3635
|
+
if (!parentRect.height) return;
|
|
3636
|
+
let el = null;
|
|
3637
|
+
const nodeDom = view.nodeDOM?.(pos);
|
|
3638
|
+
if (nodeDom) {
|
|
3639
|
+
el = nodeDom.nodeType === Node.TEXT_NODE ? nodeDom.parentElement : nodeDom;
|
|
3640
|
+
}
|
|
3641
|
+
if (!el) {
|
|
3642
|
+
const result = view.domAtPos(pos);
|
|
3643
|
+
if (result) {
|
|
3644
|
+
if (result.node.nodeType === Node.TEXT_NODE) {
|
|
3645
|
+
el = result.node.parentElement;
|
|
3646
|
+
} else {
|
|
3647
|
+
const container = result.node;
|
|
3648
|
+
const nodeAtOffset = container.childNodes?.[result.offset];
|
|
3649
|
+
const nodeBeforeOffset = container.childNodes?.[result.offset - 1];
|
|
3650
|
+
if (nodeAtOffset?.nodeType === Node.ELEMENT_NODE) {
|
|
3651
|
+
el = nodeAtOffset;
|
|
3652
|
+
} else if (nodeBeforeOffset?.nodeType === Node.ELEMENT_NODE) {
|
|
3653
|
+
el = nodeBeforeOffset;
|
|
3654
|
+
} else {
|
|
3655
|
+
el = container;
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
let targetRect = null;
|
|
3661
|
+
if (el) {
|
|
3662
|
+
targetRect = el.getBoundingClientRect();
|
|
3663
|
+
} else {
|
|
3664
|
+
try {
|
|
3665
|
+
const coords = view.coordsAtPos(pos);
|
|
3666
|
+
targetRect = new DOMRect(coords.left, coords.top, coords.right - coords.left, coords.bottom - coords.top);
|
|
3667
|
+
} catch {
|
|
3668
|
+
return;
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3638
3671
|
let delta = 0;
|
|
3639
3672
|
if (align === "start") {
|
|
3640
3673
|
delta = targetRect.top - parentRect.top;
|
|
@@ -3643,8 +3676,10 @@ function scrollEditorViewToPosInNextFrame(view, pos, options) {
|
|
|
3643
3676
|
} else if (align === "end") {
|
|
3644
3677
|
delta = targetRect.bottom - parentRect.bottom;
|
|
3645
3678
|
}
|
|
3679
|
+
const maxTop = Math.max(0, scrollParent.scrollHeight - scrollParent.clientHeight);
|
|
3680
|
+
const nextTop = Math.max(0, Math.min(scrollParent.scrollTop + delta - offset3, maxTop));
|
|
3646
3681
|
scrollParent.scrollTo({
|
|
3647
|
-
top:
|
|
3682
|
+
top: nextTop,
|
|
3648
3683
|
behavior
|
|
3649
3684
|
});
|
|
3650
3685
|
} catch (e) {
|
|
@@ -8484,6 +8519,55 @@ var SearchAndReplace = Extension.create({
|
|
|
8484
8519
|
}
|
|
8485
8520
|
});
|
|
8486
8521
|
var searchAndReplace_default = SearchAndReplace;
|
|
8522
|
+
var usePageNo = (pageNoConfig) => {
|
|
8523
|
+
const [editor, setEditor] = useState(null);
|
|
8524
|
+
const lastScrollToPageNoRef = useRef(void 0);
|
|
8525
|
+
const setPageNoEditor = (newEditor) => {
|
|
8526
|
+
setEditor(newEditor);
|
|
8527
|
+
};
|
|
8528
|
+
const onPageChange = useDebounce_default((pageNo = 1) => {
|
|
8529
|
+
lastScrollToPageNoRef.current = pageNo;
|
|
8530
|
+
pageNoConfig?.onScrollPage?.(pageNo);
|
|
8531
|
+
}, 300);
|
|
8532
|
+
useEffect(() => {
|
|
8533
|
+
if (!editor) return;
|
|
8534
|
+
if (!pageNoConfig?.enabled) return;
|
|
8535
|
+
const targetPageNo = pageNoConfig?.pageNo;
|
|
8536
|
+
if (isNullOrUnDef(targetPageNo)) return;
|
|
8537
|
+
if (lastScrollToPageNoRef.current === targetPageNo) return;
|
|
8538
|
+
let rafId = 0;
|
|
8539
|
+
const targetPageNoStr = String(targetPageNo);
|
|
8540
|
+
const findTargetPos = () => {
|
|
8541
|
+
let foundPos = null;
|
|
8542
|
+
editor.state.doc.descendants((node, pos) => {
|
|
8543
|
+
if (!isNullOrUnDef(foundPos)) return false;
|
|
8544
|
+
if (node.type.name !== PAGE_NO_KEY) return true;
|
|
8545
|
+
if (String(node.attrs?.[PAGE_NO_TAG]) === targetPageNoStr) {
|
|
8546
|
+
foundPos = pos;
|
|
8547
|
+
return false;
|
|
8548
|
+
}
|
|
8549
|
+
return true;
|
|
8550
|
+
});
|
|
8551
|
+
return foundPos;
|
|
8552
|
+
};
|
|
8553
|
+
let tries = 0;
|
|
8554
|
+
const tryScroll = () => {
|
|
8555
|
+
const foundPos = findTargetPos();
|
|
8556
|
+
if (!isNullOrUnDef(foundPos)) {
|
|
8557
|
+
scrollEditorViewToPosInNextFrame(editor.view, foundPos, { align: "start", offset: SCROLL_TOP_OFFSET });
|
|
8558
|
+
return;
|
|
8559
|
+
}
|
|
8560
|
+
tries += 1;
|
|
8561
|
+
if (tries < 10) rafId = requestAnimationFrame(tryScroll);
|
|
8562
|
+
};
|
|
8563
|
+
rafId = requestAnimationFrame(tryScroll);
|
|
8564
|
+
return () => cancelAnimationFrame(rafId);
|
|
8565
|
+
}, [editor, pageNoConfig?.enabled, pageNoConfig?.pageNo]);
|
|
8566
|
+
return {
|
|
8567
|
+
setPageNoEditor,
|
|
8568
|
+
onPageChange
|
|
8569
|
+
};
|
|
8570
|
+
};
|
|
8487
8571
|
var MarkdownEditor_default = ({
|
|
8488
8572
|
value = ``,
|
|
8489
8573
|
onChange,
|
|
@@ -8500,9 +8584,7 @@ var MarkdownEditor_default = ({
|
|
|
8500
8584
|
}) => {
|
|
8501
8585
|
const isMobile = useIsBreakpoint();
|
|
8502
8586
|
const lastContentRef = useRef("");
|
|
8503
|
-
const onPageChange =
|
|
8504
|
-
pageNoConfig?.onScrollPage?.(pageIndex ?? 0);
|
|
8505
|
-
}, 300);
|
|
8587
|
+
const { setPageNoEditor, onPageChange } = usePageNo(pageNoConfig);
|
|
8506
8588
|
const {
|
|
8507
8589
|
setAnnotationEditor,
|
|
8508
8590
|
annotations,
|
|
@@ -8638,6 +8720,7 @@ var MarkdownEditor_default = ({
|
|
|
8638
8720
|
if (!editor) return;
|
|
8639
8721
|
setAnnotationEditor(editor);
|
|
8640
8722
|
setCollectionEditor(editor);
|
|
8723
|
+
setPageNoEditor(editor);
|
|
8641
8724
|
}, [editor]);
|
|
8642
8725
|
useEffect(() => {
|
|
8643
8726
|
if (!editor) return;
|