slate-angular 20.2.0-next.0 → 20.2.0-next.2

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/index.d.ts CHANGED
@@ -318,8 +318,20 @@ interface SlateVirtualScrollConfig {
318
318
  enabled?: boolean;
319
319
  scrollTop: number;
320
320
  viewportHeight: number;
321
+ blockHeight?: number;
321
322
  bufferCount?: number;
322
323
  }
324
+ interface VirtualViewResult {
325
+ renderedChildren: Element$1[];
326
+ visibleIndexes: Set<number>;
327
+ top: number;
328
+ bottom: number;
329
+ heights: number[];
330
+ }
331
+
332
+ type SafeAny = any;
333
+
334
+ declare const JUST_NOW_UPDATED_VIRTUAL_VIEW: WeakMap<AngularEditor, boolean>;
323
335
  declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewChecked, DoCheck {
324
336
  elementRef: ElementRef;
325
337
  renderer2: Renderer2;
@@ -349,8 +361,6 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
349
361
  readonly: boolean;
350
362
  placeholder: string;
351
363
  set virtualScroll(config: SlateVirtualScrollConfig);
352
- virtualTopPadding: number;
353
- virtualBottomPadding: number;
354
364
  beforeInput: (event: Event) => void;
355
365
  blur: (event: Event) => void;
356
366
  click: (event: MouseEvent) => void;
@@ -375,6 +385,7 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
375
385
  get hasBeforeInputSupport(): boolean;
376
386
  viewContainerRef: ViewContainerRef;
377
387
  getOutletParent: () => any;
388
+ getOutletElement: () => HTMLElement;
378
389
  listRender: ListRender;
379
390
  private virtualConfig;
380
391
  private renderedChildren;
@@ -402,12 +413,21 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
402
413
  composePlaceholderDecorate(editor: Editor): SlatePlaceholder[];
403
414
  generateDecorations(): slate.BaseRange[];
404
415
  private shouldUseVirtual;
416
+ virtualScrollInitialized: boolean;
417
+ virtualTopHeightElement: HTMLElement;
418
+ virtualBottomHeightElement: HTMLElement;
419
+ virtualCenterOutlet: HTMLElement;
420
+ initializeVirtualScrolling(): void;
421
+ changeVirtualHeight(topHeight: number, bottomHeight: number): void;
405
422
  private refreshVirtualView;
423
+ private applyVirtualView;
424
+ private diffVirtualView;
406
425
  private getBlockHeight;
407
426
  private buildAccumulatedHeight;
408
427
  private getBufferBelowHeight;
409
428
  private scheduleMeasureVisibleHeights;
410
429
  private measureVisibleHeights;
430
+ private measureHeightByIndexes;
411
431
  private addEventListener;
412
432
  private toSlateSelection;
413
433
  private onDOMBeforeInput;
@@ -710,6 +730,7 @@ declare const IS_WECHATBROWSER: boolean;
710
730
  declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
711
731
  declare const VIRTUAL_SCROLL_DEFAULT_BUFFER_COUNT = 3;
712
732
  declare const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 40;
733
+ declare const SLATE_DEBUG_KEY = "__SLATE_DEBUG__";
713
734
 
714
735
  declare const shallowCompare: (obj1: {}, obj2: {}) => boolean;
715
736
  /**
@@ -787,7 +808,5 @@ declare const getSelection: (root: Document | ShadowRoot) => Selection | null;
787
808
  declare const getContentHeight: (element: Element) => number;
788
809
  declare const getZeroTextNode: () => DOMText;
789
810
 
790
- type SafeAny = any;
791
-
792
- export { AngularEditor, BaseComponent, BaseElementComponent, BaseElementFlavour, BaseFlavour, BaseLeafComponent, BaseLeafFlavour, BaseTextComponent, BaseTextFlavour, BlockCardRef, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, 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, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VIRTUAL_SCROLL_DEFAULT_BUFFER_COUNT, VoidTextFlavour, blobAsString, buildHTMLText, check, completeTable, createClipboardData, createText, createThrottleRAF, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getSelection, getSlateFragmentAttribute, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isTemplateRef, isValid, normalize, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
793
- export type { AfterContextChange, BaseEmbeddedView, BeforeContextChange, ClipboardData, ComponentType, OriginEvent, SafeAny, SlateChildrenContext, SlateElementAttributes, SlateElementContext, SlateError, SlateLeafContext, SlatePlaceholder, SlateStringContext, SlateTextContext, SlateViewContext, SlateVirtualScrollConfig, ThrottleRAF, ViewType };
811
+ export { AngularEditor, BaseComponent, BaseElementComponent, BaseElementFlavour, BaseFlavour, BaseLeafComponent, BaseLeafFlavour, BaseTextComponent, BaseTextFlavour, BlockCardRef, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, 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, JUST_NOW_UPDATED_VIRTUAL_VIEW, PLACEHOLDER_SYMBOL, SLATE_BLOCK_CARD_CLASS_NAME, SLATE_DEBUG_KEY, SlateBlockCard, SlateChildrenOutlet, SlateEditable, SlateErrorCode, SlateFragmentAttributeKey, SlateModule, VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT, VIRTUAL_SCROLL_DEFAULT_BUFFER_COUNT, VoidTextFlavour, blobAsString, buildHTMLText, check, completeTable, createClipboardData, createText, createThrottleRAF, defaultScrollSelectionIntoView, fallbackCopyText, getBlockCardByNativeElement, getCardTargetAttribute, getClipboardData, getClipboardFromHTMLText, getContentHeight, getDataTransferClipboard, getDataTransferClipboardText, getNavigatorClipboard, getPlainText, getSelection, getSlateFragmentAttribute, getZeroTextNode, hasAfterContextChange, hasBeforeContextChange, hasBlockCard, hasBlockCardWithNode, hotkeys, isCardCenterByTargetAttr, isCardLeft, isCardLeftByTargetAttr, isCardRightByTargetAttr, isClipboardFile, isClipboardReadSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isComponentType, isDOMText, isDecoratorRangeListEqual, isFlavourType, isInvalidTable, isTemplateRef, isValid, normalize, setClipboardData, setDataTransferClipboard, setDataTransferClipboardText, setNavigatorClipboard, shallowCompare, stripHtml, withAngular };
812
+ export type { AfterContextChange, BaseEmbeddedView, BeforeContextChange, ClipboardData, ComponentType, OriginEvent, SafeAny, SlateChildrenContext, SlateElementAttributes, SlateElementContext, SlateError, SlateLeafContext, SlatePlaceholder, SlateStringContext, SlateTextContext, SlateViewContext, SlateVirtualScrollConfig, ThrottleRAF, ViewType, VirtualViewResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slate-angular",
3
- "version": "20.2.0-next.0",
3
+ "version": "20.2.0-next.2",
4
4
  "description": "Angular view layer for Slate",
5
5
  "author": "pubuzhixing <pubuzhixing@gmail.com>",
6
6
  "homepage": "https://github.com/worktile/slate-angular#readme",
package/styles/index.scss CHANGED
@@ -4,19 +4,6 @@
4
4
  outline: none;
5
5
  padding: 0 32px;
6
6
  white-space: break-spaces;
7
- &::before,
8
- &::after {
9
- content: '';
10
- display: block;
11
- pointer-events: none;
12
- height: 0;
13
- }
14
- &::before {
15
- height: var(--virtual-top-padding, 0px);
16
- }
17
- &::after {
18
- height: var(--virtual-bottom-padding, 0px);
19
- }
20
7
  & [contenteditable='true'] {
21
8
  outline: none;
22
9
  }