slate-angular 20.2.0-next.32 → 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.
@@ -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.left = '';
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
- rootNode.style.left = '0px';
2883
- rootNode.style.right = '0px';
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 {
@@ -2937,7 +2942,7 @@ class ListRender {
2937
2942
  const preRenderingElement = [...this.preRenderingHTMLElement];
2938
2943
  preRenderingElement.forEach((rootNodes, index) => {
2939
2944
  rootNodes.forEach(rootNode => {
2940
- setPreRenderingElementStyle(rootNode, true);
2945
+ setPreRenderingElementStyle(this.viewContext.editor, rootNode, true);
2941
2946
  });
2942
2947
  });
2943
2948
  this.preRenderingHTMLElement = [];
@@ -3043,7 +3048,7 @@ class ListRender {
3043
3048
  for (let i = 0; i < preRenderingCount; i++) {
3044
3049
  const rootNodes = [...getRootNodes(this.views[i], this.blockCards[i])];
3045
3050
  rootNodes.forEach(rootNode => {
3046
- setPreRenderingElementStyle(rootNode);
3051
+ setPreRenderingElementStyle(this.viewContext.editor, rootNode);
3047
3052
  });
3048
3053
  this.preRenderingHTMLElement.push(rootNodes);
3049
3054
  }
@@ -3664,13 +3669,18 @@ class SlateEditable {
3664
3669
  this.elementRef.nativeElement.appendChild(this.virtualTopHeightElement);
3665
3670
  this.elementRef.nativeElement.appendChild(this.virtualCenterOutlet);
3666
3671
  this.elementRef.nativeElement.appendChild(this.virtualBottomHeightElement);
3667
- let editorResizeObserverRectWidth = this.elementRef.nativeElement.getBoundingClientRect()?.width ?? 0;
3672
+ let editorResizeObserverRectWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
3673
+ EDITOR_TO_ROOT_NODE_WIDTH.set(this.editor, this.virtualTopHeightElement.getBoundingClientRect().width);
3668
3674
  this.editorResizeObserver = new ResizeObserver(entries => {
3669
3675
  if (entries.length > 0 && entries[0].contentRect.width !== editorResizeObserverRectWidth) {
3670
3676
  editorResizeObserverRectWidth = entries[0].contentRect.width;
3671
3677
  this.keyHeightMap.clear();
3672
3678
  const remeasureIndics = this.inViewportIndics;
3673
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
+ }
3674
3684
  }
3675
3685
  });
3676
3686
  this.editorResizeObserver.observe(this.elementRef.nativeElement);
@@ -5177,5 +5187,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
5177
5187
  * Generated bundle index. Do not edit.
5178
5188
  */
5179
5189
 
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 };
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 };
5181
5191
  //# sourceMappingURL=slate-angular.mjs.map