slate-angular 20.2.0-next.32 → 20.2.0-next.34
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 +35 -11
- 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,17 +2871,21 @@ const createText = (text) => {
|
|
|
2870
2871
|
return { nativeElement };
|
|
2871
2872
|
};
|
|
2872
2873
|
|
|
2873
|
-
const setPreRenderingElementStyle = (rootNode, isClear = false) => {
|
|
2874
|
+
const setPreRenderingElementStyle = (editor, rootNode, isClear = false) => {
|
|
2874
2875
|
if (isClear) {
|
|
2875
2876
|
rootNode.style.top = '';
|
|
2876
|
-
rootNode.style.
|
|
2877
|
-
rootNode.style.right = '';
|
|
2877
|
+
rootNode.style.width = '';
|
|
2878
2878
|
rootNode.style.position = '';
|
|
2879
2879
|
return;
|
|
2880
2880
|
}
|
|
2881
|
+
const preRenderingWidth = EDITOR_TO_ROOT_NODE_WIDTH.get(editor) ?? 0;
|
|
2881
2882
|
rootNode.style.top = '-100%';
|
|
2882
|
-
|
|
2883
|
-
|
|
2883
|
+
if (preRenderingWidth) {
|
|
2884
|
+
rootNode.style.width = `${preRenderingWidth}px`;
|
|
2885
|
+
}
|
|
2886
|
+
else {
|
|
2887
|
+
rootNode.style.width = '100%';
|
|
2888
|
+
}
|
|
2884
2889
|
rootNode.style.position = 'absolute';
|
|
2885
2890
|
};
|
|
2886
2891
|
class ListRender {
|
|
@@ -2936,9 +2941,20 @@ class ListRender {
|
|
|
2936
2941
|
if (this.preRenderingHTMLElement.length > 0) {
|
|
2937
2942
|
const preRenderingElement = [...this.preRenderingHTMLElement];
|
|
2938
2943
|
preRenderingElement.forEach((rootNodes, index) => {
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2944
|
+
const slateElement = this.children[index];
|
|
2945
|
+
if (slateElement && children.indexOf(slateElement) >= 0) {
|
|
2946
|
+
rootNodes.forEach(rootNode => {
|
|
2947
|
+
setPreRenderingElementStyle(this.viewContext.editor, rootNode, true);
|
|
2948
|
+
});
|
|
2949
|
+
if (isDebug) {
|
|
2950
|
+
debugLog('log', 'preRenderingHTMLElement index: ', this.viewContext.editor.children.indexOf(this.children[index]), 'is clear true');
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
else {
|
|
2954
|
+
if (isDebug) {
|
|
2955
|
+
debugLog('log', 'preRenderingHTMLElement index: ', this.viewContext.editor.children.indexOf(this.children[index]), 'do not clear since it would be removed soon');
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2942
2958
|
});
|
|
2943
2959
|
this.preRenderingHTMLElement = [];
|
|
2944
2960
|
}
|
|
@@ -3043,9 +3059,12 @@ class ListRender {
|
|
|
3043
3059
|
for (let i = 0; i < preRenderingCount; i++) {
|
|
3044
3060
|
const rootNodes = [...getRootNodes(this.views[i], this.blockCards[i])];
|
|
3045
3061
|
rootNodes.forEach(rootNode => {
|
|
3046
|
-
setPreRenderingElementStyle(rootNode);
|
|
3062
|
+
setPreRenderingElementStyle(this.viewContext.editor, rootNode);
|
|
3047
3063
|
});
|
|
3048
3064
|
this.preRenderingHTMLElement.push(rootNodes);
|
|
3065
|
+
if (isDebug) {
|
|
3066
|
+
debugLog('log', 'preRenderingHTMLElement index: ', this.viewContext.editor.children.indexOf(children[i]));
|
|
3067
|
+
}
|
|
3049
3068
|
}
|
|
3050
3069
|
}
|
|
3051
3070
|
}
|
|
@@ -3664,13 +3683,18 @@ class SlateEditable {
|
|
|
3664
3683
|
this.elementRef.nativeElement.appendChild(this.virtualTopHeightElement);
|
|
3665
3684
|
this.elementRef.nativeElement.appendChild(this.virtualCenterOutlet);
|
|
3666
3685
|
this.elementRef.nativeElement.appendChild(this.virtualBottomHeightElement);
|
|
3667
|
-
let editorResizeObserverRectWidth = this.elementRef.nativeElement.getBoundingClientRect()
|
|
3686
|
+
let editorResizeObserverRectWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
|
|
3687
|
+
EDITOR_TO_ROOT_NODE_WIDTH.set(this.editor, this.virtualTopHeightElement.getBoundingClientRect().width);
|
|
3668
3688
|
this.editorResizeObserver = new ResizeObserver(entries => {
|
|
3669
3689
|
if (entries.length > 0 && entries[0].contentRect.width !== editorResizeObserverRectWidth) {
|
|
3670
3690
|
editorResizeObserverRectWidth = entries[0].contentRect.width;
|
|
3671
3691
|
this.keyHeightMap.clear();
|
|
3672
3692
|
const remeasureIndics = this.inViewportIndics;
|
|
3673
3693
|
measureHeightByIndics(this.editor, remeasureIndics, true);
|
|
3694
|
+
EDITOR_TO_ROOT_NODE_WIDTH.set(this.editor, this.virtualTopHeightElement.getBoundingClientRect().width);
|
|
3695
|
+
if (isDebug) {
|
|
3696
|
+
debugLog('log', 'editorResizeObserverRectWidth: ', editorResizeObserverRectWidth, 'EDITOR_TO_ROOT_NODE_WIDTH: ', EDITOR_TO_ROOT_NODE_WIDTH.get(this.editor));
|
|
3697
|
+
}
|
|
3674
3698
|
}
|
|
3675
3699
|
});
|
|
3676
3700
|
this.editorResizeObserver.observe(this.elementRef.nativeElement);
|
|
@@ -5177,5 +5201,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
5177
5201
|
* Generated bundle index. Do not edit.
|
|
5178
5202
|
*/
|
|
5179
5203
|
|
|
5180
|
-
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 };
|
|
5204
|
+
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 };
|
|
5181
5205
|
//# sourceMappingURL=slate-angular.mjs.map
|