slate-angular 20.2.0-next.31 → 20.2.0-next.33
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/fesm2022/slate-angular.mjs +27 -8
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1453,6 +1453,7 @@ const isDebug = localStorage.getItem(SLATE_DEBUG_KEY) === 'true';
|
|
|
1453
1453
|
const isDebugScrollTop = localStorage.getItem(SLATE_DEBUG_KEY_SCROLL_TOP) === 'true';
|
|
1454
1454
|
const ELEMENT_KEY_TO_HEIGHTS = new WeakMap();
|
|
1455
1455
|
const EDITOR_TO_BUSINESS_TOP = new WeakMap();
|
|
1456
|
+
const EDITOR_TO_ROOT_NODE_WIDTH = new WeakMap();
|
|
1456
1457
|
const debugLog = (type, ...args) => {
|
|
1457
1458
|
const doc = document;
|
|
1458
1459
|
VirtualScrollDebugOverlay.log(doc, type, ...args);
|
|
@@ -2870,6 +2871,23 @@ const createText = (text) => {
|
|
|
2870
2871
|
return { nativeElement };
|
|
2871
2872
|
};
|
|
2872
2873
|
|
|
2874
|
+
const setPreRenderingElementStyle = (editor, rootNode, isClear = false) => {
|
|
2875
|
+
if (isClear) {
|
|
2876
|
+
rootNode.style.top = '';
|
|
2877
|
+
rootNode.style.width = '';
|
|
2878
|
+
rootNode.style.position = '';
|
|
2879
|
+
return;
|
|
2880
|
+
}
|
|
2881
|
+
const preRenderingWidth = EDITOR_TO_ROOT_NODE_WIDTH.get(editor) ?? 0;
|
|
2882
|
+
rootNode.style.top = '-100%';
|
|
2883
|
+
if (preRenderingWidth) {
|
|
2884
|
+
rootNode.style.width = `${preRenderingWidth}px`;
|
|
2885
|
+
}
|
|
2886
|
+
else {
|
|
2887
|
+
rootNode.style.width = '100%';
|
|
2888
|
+
}
|
|
2889
|
+
rootNode.style.position = 'absolute';
|
|
2890
|
+
};
|
|
2873
2891
|
class ListRender {
|
|
2874
2892
|
constructor(viewContext, viewContainerRef, getOutletParent, getOutletElement) {
|
|
2875
2893
|
this.viewContext = viewContext;
|
|
@@ -2924,9 +2942,7 @@ class ListRender {
|
|
|
2924
2942
|
const preRenderingElement = [...this.preRenderingHTMLElement];
|
|
2925
2943
|
preRenderingElement.forEach((rootNodes, index) => {
|
|
2926
2944
|
rootNodes.forEach(rootNode => {
|
|
2927
|
-
|
|
2928
|
-
rootNode.style.top = '';
|
|
2929
|
-
rootNode.style.width = '';
|
|
2945
|
+
setPreRenderingElementStyle(this.viewContext.editor, rootNode, true);
|
|
2930
2946
|
});
|
|
2931
2947
|
});
|
|
2932
2948
|
this.preRenderingHTMLElement = [];
|
|
@@ -3032,9 +3048,7 @@ class ListRender {
|
|
|
3032
3048
|
for (let i = 0; i < preRenderingCount; i++) {
|
|
3033
3049
|
const rootNodes = [...getRootNodes(this.views[i], this.blockCards[i])];
|
|
3034
3050
|
rootNodes.forEach(rootNode => {
|
|
3035
|
-
|
|
3036
|
-
rootNode.style.position = 'absolute';
|
|
3037
|
-
rootNode.style.width = '100%';
|
|
3051
|
+
setPreRenderingElementStyle(this.viewContext.editor, rootNode);
|
|
3038
3052
|
});
|
|
3039
3053
|
this.preRenderingHTMLElement.push(rootNodes);
|
|
3040
3054
|
}
|
|
@@ -3655,13 +3669,18 @@ class SlateEditable {
|
|
|
3655
3669
|
this.elementRef.nativeElement.appendChild(this.virtualTopHeightElement);
|
|
3656
3670
|
this.elementRef.nativeElement.appendChild(this.virtualCenterOutlet);
|
|
3657
3671
|
this.elementRef.nativeElement.appendChild(this.virtualBottomHeightElement);
|
|
3658
|
-
let editorResizeObserverRectWidth = this.elementRef.nativeElement.getBoundingClientRect()
|
|
3672
|
+
let editorResizeObserverRectWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
|
|
3673
|
+
EDITOR_TO_ROOT_NODE_WIDTH.set(this.editor, this.virtualTopHeightElement.getBoundingClientRect().width);
|
|
3659
3674
|
this.editorResizeObserver = new ResizeObserver(entries => {
|
|
3660
3675
|
if (entries.length > 0 && entries[0].contentRect.width !== editorResizeObserverRectWidth) {
|
|
3661
3676
|
editorResizeObserverRectWidth = entries[0].contentRect.width;
|
|
3662
3677
|
this.keyHeightMap.clear();
|
|
3663
3678
|
const remeasureIndics = this.inViewportIndics;
|
|
3664
3679
|
measureHeightByIndics(this.editor, remeasureIndics, true);
|
|
3680
|
+
EDITOR_TO_ROOT_NODE_WIDTH.set(this.editor, this.virtualTopHeightElement.getBoundingClientRect().width);
|
|
3681
|
+
if (isDebug) {
|
|
3682
|
+
debugLog('log', 'editorResizeObserverRectWidth: ', editorResizeObserverRectWidth, 'EDITOR_TO_ROOT_NODE_WIDTH: ', EDITOR_TO_ROOT_NODE_WIDTH.get(this.editor));
|
|
3683
|
+
}
|
|
3665
3684
|
}
|
|
3666
3685
|
});
|
|
3667
3686
|
this.editorResizeObserver.observe(this.elementRef.nativeElement);
|
|
@@ -5168,5 +5187,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
5168
5187
|
* Generated bundle index. Do not edit.
|
|
5169
5188
|
*/
|
|
5170
5189
|
|
|
5171
|
-
export { AngularEditor, BaseComponent, BaseElementComponent, BaseElementFlavour, BaseFlavour, BaseLeafComponent, BaseLeafFlavour, BaseTextComponent, BaseTextFlavour, BlockCardRef, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, EDITOR_TO_BUSINESS_TOP, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, ELEMENT_KEY_TO_HEIGHTS, ELEMENT_TO_COMPONENT, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, FlavourRef, HAS_BEFORE_INPUT_SUPPORT, IS_ANDROID, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_ENABLED_VIRTUAL_SCROLL, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_IOS, IS_QQBROWSER, IS_SAFARI, IS_UC_MOBILE, IS_WECHATBROWSER, PLACEHOLDER_SYMBOL, SLATE_BLOCK_CARD_CLASS_NAME, SLATE_DEBUG_KEY, SLATE_DEBUG_KEY_SCROLL_TOP, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, SlateString, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VoidTextFlavour, blobAsString, buildHTMLText, buildHeightsAndAccumulatedHeights, calculateVirtualTopHeight, check, completeTable, createClipboardData, createText, createThrottleRAF, debugLog, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getBusinessTop, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getRealHeightByElement, getSelection, getSlateFragmentAttribute, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDebug, isDebugScrollTop, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isTemplateRef, isValid, measureHeightByElement, measureHeightByIndics, normalize, scrollToElement, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
|
|
5190
|
+
export { AngularEditor, BaseComponent, BaseElementComponent, BaseElementFlavour, BaseFlavour, BaseLeafComponent, BaseLeafFlavour, BaseTextComponent, BaseTextFlavour, BlockCardRef, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, EDITOR_TO_BUSINESS_TOP, EDITOR_TO_ROOT_NODE_WIDTH, EDITOR_TO_VIRTUAL_SCROLL_SELECTION, ELEMENT_KEY_TO_HEIGHTS, ELEMENT_TO_COMPONENT, FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, FlavourRef, HAS_BEFORE_INPUT_SUPPORT, IS_ANDROID, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_EDGE_LEGACY, IS_ENABLED_VIRTUAL_SCROLL, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_IOS, IS_QQBROWSER, IS_SAFARI, IS_UC_MOBILE, IS_WECHATBROWSER, PLACEHOLDER_SYMBOL, SLATE_BLOCK_CARD_CLASS_NAME, SLATE_DEBUG_KEY, SLATE_DEBUG_KEY_SCROLL_TOP, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, SlateString, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VoidTextFlavour, blobAsString, buildHTMLText, buildHeightsAndAccumulatedHeights, calculateVirtualTopHeight, check, completeTable, createClipboardData, createText, createThrottleRAF, debugLog, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getBusinessTop, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getRealHeightByElement, getSelection, getSlateFragmentAttribute, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDebug, isDebugScrollTop, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isTemplateRef, isValid, measureHeightByElement, measureHeightByIndics, normalize, scrollToElement, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
|
|
5172
5191
|
//# sourceMappingURL=slate-angular.mjs.map
|