slate-angular 21.1.0 → 21.2.0

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.
@@ -2269,6 +2269,25 @@ class BlockCardRef {
2269
2269
  }
2270
2270
  }
2271
2271
 
2272
+ function hasBeforeContextChange(value) {
2273
+ if (value.beforeContextChange) {
2274
+ return true;
2275
+ }
2276
+ return false;
2277
+ }
2278
+ function hasAfterContextChange(value) {
2279
+ if (value.afterContextChange) {
2280
+ return true;
2281
+ }
2282
+ return false;
2283
+ }
2284
+ function hasBeforeDomMove(value) {
2285
+ if (value.instance?.beforeDomMove) {
2286
+ return true;
2287
+ }
2288
+ return false;
2289
+ }
2290
+
2272
2291
  function createEmbeddedViewOrComponentOrFlavour(viewType, context, viewContext, viewContainerRef) {
2273
2292
  if (isFlavourType(viewType)) {
2274
2293
  const flavourRef = new FlavourRef();
@@ -2360,6 +2379,9 @@ function getRootNodes(ref, blockCard) {
2360
2379
  }
2361
2380
  function mountOnItemChange(index, item, views, blockCards, outletParent, firstRootNode, viewContext) {
2362
2381
  const view = views[index];
2382
+ if (hasBeforeDomMove(view)) {
2383
+ view.instance.beforeDomMove('move');
2384
+ }
2363
2385
  let rootNodes = getRootNodes(view);
2364
2386
  if (blockCards) {
2365
2387
  const isBlockCard = viewContext.editor.isBlockCard(item);
@@ -2390,19 +2412,6 @@ function mountOnItemChange(index, item, views, blockCards, outletParent, firstRo
2390
2412
  }
2391
2413
  }
2392
2414
 
2393
- function hasBeforeContextChange(value) {
2394
- if (value.beforeContextChange) {
2395
- return true;
2396
- }
2397
- return false;
2398
- }
2399
- function hasAfterContextChange(value) {
2400
- if (value.afterContextChange) {
2401
- return true;
2402
- }
2403
- return false;
2404
- }
2405
-
2406
2415
  class BaseFlavour {
2407
2416
  constructor() {
2408
2417
  this.initialized = false;
@@ -3062,8 +3071,9 @@ class ListRender {
3062
3071
  const preRenderingElement = [...this.preRenderingHTMLElement];
3063
3072
  let previousRootNode = this.virtualTopHeightElement;
3064
3073
  preRenderingElement.forEach((rootNodes, index) => {
3065
- // const slateElement = this.children[index];
3066
- // if (slateElement && children.indexOf(slateElement) >= 0) {
3074
+ if (hasBeforeDomMove(this.views[index])) {
3075
+ this.views[index].instance.beforeDomMove('virtual-scroll');
3076
+ }
3067
3077
  rootNodes.forEach(rootNode => {
3068
3078
  setPreRenderingElementStyle(this.viewContext.editor, rootNode, true);
3069
3079
  previousRootNode.insertAdjacentElement('afterend', rootNode);
@@ -3072,16 +3082,6 @@ class ListRender {
3072
3082
  if (isDebug) {
3073
3083
  debugLog('log', 'preRenderingHTMLElement index: ', this.viewContext.editor.children.indexOf(this.children[index]), 'is clear true');
3074
3084
  }
3075
- // } else {
3076
- // if (isDebug) {
3077
- // debugLog(
3078
- // 'log',
3079
- // 'preRenderingHTMLElement index: ',
3080
- // this.viewContext.editor.children.indexOf(this.children[index]),
3081
- // 'do not clear since it would be removed soon'
3082
- // );
3083
- // }
3084
- // }
3085
3085
  });
3086
3086
  this.preRenderingHTMLElement = [];
3087
3087
  }
@@ -5533,5 +5533,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
5533
5533
  * Generated bundle index. Do not edit.
5534
5534
  */
5535
5535
 
5536
- 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_IS_FROM_SCROLL_TO, EDITOR_TO_ROOT_NODE_WIDTH, EDITOR_TO_VIEWPORT_HEIGHT, EDITOR_TO_VIRTUAL_SCROLL_CONFIG, 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_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, SLATE_DEBUG_KEY_UPDATE, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, VIRTUAL_BOTTOM_HEIGHT_CLASS_NAME, VIRTUAL_CENTER_OUTLET_CLASS_NAME, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VIRTUAL_TOP_HEIGHT_CLASS_NAME, VoidTextFlavour, blobAsString, buildHTMLText, buildHeightsAndAccumulatedHeights, cacheHeightByElement, calcBusinessTop, calcHeightByElement, calculateAccumulatedTopHeight, check, clearMinHeightByElement, completeTable, createClipboardData, createText, createThrottleRAF, debugLog, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getBusinessTop, getCachedHeightByElement, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getScrollContainer, getSelection, getSlateFragmentAttribute, getViewportHeight, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDebug, isDebugScrollTop, isDebugUpdate, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isSelectionInsideVoid, isTemplateRef, isValid, isValidNumber, measureHeightByIndics, normalize, roundTo, scrollToElement, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setMinHeightByElement, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
5536
+ 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_IS_FROM_SCROLL_TO, EDITOR_TO_ROOT_NODE_WIDTH, EDITOR_TO_VIEWPORT_HEIGHT, EDITOR_TO_VIRTUAL_SCROLL_CONFIG, 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_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, SLATE_DEBUG_KEY_UPDATE, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, VIRTUAL_BOTTOM_HEIGHT_CLASS_NAME, VIRTUAL_CENTER_OUTLET_CLASS_NAME, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VIRTUAL_TOP_HEIGHT_CLASS_NAME, VoidTextFlavour, blobAsString, buildHTMLText, buildHeightsAndAccumulatedHeights, cacheHeightByElement, calcBusinessTop, calcHeightByElement, calculateAccumulatedTopHeight, check, clearMinHeightByElement, completeTable, createClipboardData, createText, createThrottleRAF, debugLog, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getBusinessTop, getCachedHeightByElement, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getScrollContainer, getSelection, getSlateFragmentAttribute, getViewportHeight, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBeforeDomMove, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDebug, isDebugScrollTop, isDebugUpdate, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isSelectionInsideVoid, isTemplateRef, isValid, isValidNumber, measureHeightByIndics, normalize, roundTo, scrollToElement, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setMinHeightByElement, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
5537
5537
  //# sourceMappingURL=slate-angular.mjs.map