slate-angular 20.2.0-next.30 → 20.2.0-next.31

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.
@@ -2926,6 +2926,7 @@ class ListRender {
2926
2926
  rootNodes.forEach(rootNode => {
2927
2927
  rootNode.style.position = '';
2928
2928
  rootNode.style.top = '';
2929
+ rootNode.style.width = '';
2929
2930
  });
2930
2931
  });
2931
2932
  this.preRenderingHTMLElement = [];
@@ -3033,6 +3034,7 @@ class ListRender {
3033
3034
  rootNodes.forEach(rootNode => {
3034
3035
  rootNode.style.top = '-100%';
3035
3036
  rootNode.style.position = 'absolute';
3037
+ rootNode.style.width = '100%';
3036
3038
  });
3037
3039
  this.preRenderingHTMLElement.push(rootNodes);
3038
3040
  }
@@ -3318,7 +3320,7 @@ class SlateEditable {
3318
3320
  this.applyVirtualView(virtualView);
3319
3321
  const childrenForRender = virtualView.inViewportChildren;
3320
3322
  if (isDebug) {
3321
- debugLog('log', 'writeValue calculate: ', virtualView.visibleIndexes, 'initialized: ', this.listRender.initialized);
3323
+ debugLog('log', 'writeValue calculate: ', virtualView.inViewportIndics, 'initialized: ', this.listRender.initialized);
3322
3324
  }
3323
3325
  if (!this.listRender.initialized) {
3324
3326
  this.listRender.initialize(childrenForRender, this.editor, this.context);
@@ -3763,7 +3765,7 @@ class SlateEditable {
3763
3765
  if (!children.length || !this.isEnabledVirtualScroll()) {
3764
3766
  return {
3765
3767
  inViewportChildren: children,
3766
- visibleIndexes: [],
3768
+ inViewportIndics: [],
3767
3769
  top: 0,
3768
3770
  bottom: 0,
3769
3771
  heights: []
@@ -3774,7 +3776,7 @@ class SlateEditable {
3774
3776
  if (!viewportHeight) {
3775
3777
  return {
3776
3778
  inViewportChildren: [],
3777
- visibleIndexes: [],
3779
+ inViewportIndics: [],
3778
3780
  top: 0,
3779
3781
  bottom: 0,
3780
3782
  heights: []
@@ -3801,32 +3803,32 @@ class SlateEditable {
3801
3803
  const limitedScrollTop = Math.min(adjustedScrollTop, maxScrollTop);
3802
3804
  const viewBottom = limitedScrollTop + viewportHeight;
3803
3805
  let accumulatedOffset = 0;
3804
- let visibleStartIndex = -1;
3806
+ let inViewportStartIndex = -1;
3805
3807
  const visible = [];
3806
- const visibleIndexes = [];
3808
+ const inViewportIndics = [];
3807
3809
  for (let i = 0; i < elementLength && accumulatedOffset < viewBottom; i++) {
3808
3810
  const currentHeight = heights[i];
3809
3811
  const nextOffset = accumulatedOffset + currentHeight;
3810
3812
  // 可视区域有交集,加入渲染
3811
3813
  if (nextOffset > limitedScrollTop && accumulatedOffset < viewBottom) {
3812
- if (visibleStartIndex === -1)
3813
- visibleStartIndex = i; // 第一个相交起始位置
3814
+ if (inViewportStartIndex === -1)
3815
+ inViewportStartIndex = i; // 第一个相交起始位置
3814
3816
  visible.push(children[i]);
3815
- visibleIndexes.push(i);
3817
+ inViewportIndics.push(i);
3816
3818
  }
3817
3819
  accumulatedOffset = nextOffset;
3818
3820
  }
3819
- if (visibleStartIndex === -1 && elementLength) {
3820
- visibleStartIndex = elementLength - 1;
3821
- visible.push(children[visibleStartIndex]);
3822
- visibleIndexes.push(visibleStartIndex);
3821
+ if (inViewportStartIndex === -1 && elementLength) {
3822
+ inViewportStartIndex = elementLength - 1;
3823
+ visible.push(children[inViewportStartIndex]);
3824
+ inViewportIndics.push(inViewportStartIndex);
3823
3825
  }
3824
- const visibleEndIndex = visibleStartIndex === -1 ? elementLength - 1 : (visibleIndexes[visibleIndexes.length - 1] ?? visibleStartIndex);
3825
- const top = visibleStartIndex === -1 ? 0 : accumulatedHeights[visibleStartIndex];
3826
- const bottom = totalHeight - accumulatedHeights[visibleEndIndex + 1];
3826
+ const inViewportEndIndex = inViewportStartIndex === -1 ? elementLength - 1 : (inViewportIndics[inViewportIndics.length - 1] ?? inViewportStartIndex);
3827
+ const top = inViewportStartIndex === -1 ? 0 : accumulatedHeights[inViewportStartIndex];
3828
+ const bottom = totalHeight - accumulatedHeights[inViewportEndIndex + 1];
3827
3829
  return {
3828
3830
  inViewportChildren: visible.length ? visible : children,
3829
- visibleIndexes,
3831
+ inViewportIndics,
3830
3832
  top,
3831
3833
  bottom,
3832
3834
  heights,
@@ -3836,12 +3838,12 @@ class SlateEditable {
3836
3838
  applyVirtualView(virtualView) {
3837
3839
  this.inViewportChildren = virtualView.inViewportChildren;
3838
3840
  this.setVirtualSpaceHeight(virtualView.top, virtualView.bottom);
3839
- this.inViewportIndics = virtualView.visibleIndexes;
3841
+ this.inViewportIndics = virtualView.inViewportIndics;
3840
3842
  }
3841
3843
  diffVirtualViewport(virtualView, stage = 'first') {
3842
3844
  if (!this.inViewportChildren.length) {
3843
3845
  if (isDebug) {
3844
- debugLog('log', 'diffVirtualViewport', stage, 'empty inViewportChildren', virtualView.visibleIndexes);
3846
+ debugLog('log', 'diffVirtualViewport', stage, 'empty inViewportChildren', virtualView.inViewportIndics);
3845
3847
  }
3846
3848
  return {
3847
3849
  isDifferent: true,
@@ -3850,7 +3852,7 @@ class SlateEditable {
3850
3852
  };
3851
3853
  }
3852
3854
  const oldIndexesInViewport = [...this.inViewportIndics];
3853
- const newIndexesInViewport = [...virtualView.visibleIndexes];
3855
+ const newIndexesInViewport = [...virtualView.inViewportIndics];
3854
3856
  const firstNewIndex = newIndexesInViewport[0];
3855
3857
  const lastNewIndex = newIndexesInViewport[newIndexesInViewport.length - 1];
3856
3858
  const firstOldIndex = oldIndexesInViewport[0];