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

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
@@ -102,6 +102,7 @@ type OriginEvent = 'drag' | 'copy' | 'cut';
102
102
  */
103
103
  interface AngularEditor extends CustomDOMEditor {
104
104
  deleteCutData: () => void;
105
+ selectAll: () => void;
105
106
  onKeydown: (event: KeyboardEvent) => void;
106
107
  onClick: (event: MouseEvent) => void;
107
108
  injector: Injector;
@@ -318,8 +319,21 @@ interface SlateVirtualScrollConfig {
318
319
  enabled?: boolean;
319
320
  scrollTop: number;
320
321
  viewportHeight: number;
322
+ blockHeight?: number;
321
323
  bufferCount?: number;
322
324
  }
325
+ interface VirtualViewResult {
326
+ renderedChildren: Element$1[];
327
+ visibleIndexes: Set<number>;
328
+ top: number;
329
+ bottom: number;
330
+ heights: number[];
331
+ }
332
+
333
+ type SafeAny = any;
334
+
335
+ declare const JUST_NOW_UPDATED_VIRTUAL_VIEW: WeakMap<AngularEditor, boolean>;
336
+ declare const ELEMENT_KEY_TO_HEIGHTS: WeakMap<AngularEditor, Map<string, number>>;
323
337
  declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewChecked, DoCheck {
324
338
  elementRef: ElementRef;
325
339
  renderer2: Renderer2;
@@ -349,8 +363,6 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
349
363
  readonly: boolean;
350
364
  placeholder: string;
351
365
  set virtualScroll(config: SlateVirtualScrollConfig);
352
- virtualTopPadding: number;
353
- virtualBottomPadding: number;
354
366
  beforeInput: (event: Event) => void;
355
367
  blur: (event: Event) => void;
356
368
  click: (event: MouseEvent) => void;
@@ -375,14 +387,15 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
375
387
  get hasBeforeInputSupport(): boolean;
376
388
  viewContainerRef: ViewContainerRef;
377
389
  getOutletParent: () => any;
390
+ getOutletElement: () => HTMLElement;
378
391
  listRender: ListRender;
379
392
  private virtualConfig;
380
393
  private renderedChildren;
381
394
  private virtualVisibleIndexes;
382
395
  private measuredHeights;
383
- private measurePending;
384
396
  private refreshVirtualViewAnimId;
385
397
  private measureVisibleHeightsAnimId;
398
+ private editorResizeObserver?;
386
399
  constructor(elementRef: ElementRef, renderer2: Renderer2, cdr: ChangeDetectorRef, ngZone: NgZone, injector: Injector);
387
400
  ngOnInit(): void;
388
401
  ngOnChanges(simpleChanges: SimpleChanges): void;
@@ -402,12 +415,24 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
402
415
  composePlaceholderDecorate(editor: Editor): SlatePlaceholder[];
403
416
  generateDecorations(): slate.BaseRange[];
404
417
  private shouldUseVirtual;
418
+ private businessHeight;
419
+ virtualScrollInitialized: boolean;
420
+ virtualTopHeightElement: HTMLElement;
421
+ virtualBottomHeightElement: HTMLElement;
422
+ virtualCenterOutlet: HTMLElement;
423
+ private debugOverlay?;
424
+ initializeVirtualScrolling(): void;
425
+ changeVirtualHeight(topHeight: number, bottomHeight: number): void;
426
+ private debugLog;
427
+ private doVirtualScroll;
405
428
  private refreshVirtualView;
429
+ private applyVirtualView;
430
+ private diffVirtualView;
406
431
  private getBlockHeight;
407
432
  private buildAccumulatedHeight;
408
- private getBufferBelowHeight;
409
433
  private scheduleMeasureVisibleHeights;
410
434
  private measureVisibleHeights;
435
+ private remeasureHeightByIndics;
411
436
  private addEventListener;
412
437
  private toSlateSelection;
413
438
  private onDOMBeforeInput;
@@ -561,7 +586,9 @@ declare class BaseElementComponent<T extends Element$1 = Element$1, K extends An
561
586
  onContextChange(): void;
562
587
  updateChildrenView(): void;
563
588
  getChildrenContext(): SlateChildrenContext;
564
- getRealHeight(): Promise<number>;
589
+ stableHeight: null | number;
590
+ isStableHeight(): boolean;
591
+ getRealHeight(): number | Promise<number>;
565
592
  static ɵfac: i0.ɵɵFactoryDeclaration<BaseElementComponent<any, any>, never>;
566
593
  static ɵdir: i0.ɵɵDirectiveDeclaration<BaseElementComponent<any, any>, never, never, {}, {}, never, never, true, never>;
567
594
  }
@@ -621,7 +648,9 @@ declare abstract class BaseElementFlavour<T extends Element$1 = Element$1, K ext
621
648
  onContextChange(): void;
622
649
  updateChildrenView(): void;
623
650
  getChildrenContext(): SlateChildrenContext;
624
- getRealHeight(): Promise<number>;
651
+ stableHeight: null | number;
652
+ isStableHeight(): boolean;
653
+ getRealHeight(): number | Promise<number>;
625
654
  abstract render(): void;
626
655
  abstract rerender(): void;
627
656
  }
@@ -710,6 +739,7 @@ declare const IS_WECHATBROWSER: boolean;
710
739
  declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
711
740
  declare const VIRTUAL_SCROLL_DEFAULT_BUFFER_COUNT = 3;
712
741
  declare const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 40;
742
+ declare const SLATE_DEBUG_KEY = "__SLATE_DEBUG__";
713
743
 
714
744
  declare const shallowCompare: (obj1: {}, obj2: {}) => boolean;
715
745
  /**
@@ -787,7 +817,5 @@ declare const getSelection: (root: Document | ShadowRoot) => Selection | null;
787
817
  declare const getContentHeight: (element: Element) => number;
788
818
  declare const getZeroTextNode: () => DOMText;
789
819
 
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 };
820
+ export { AngularEditor, BaseComponent, BaseElementComponent, BaseElementFlavour, BaseFlavour, BaseLeafComponent, BaseLeafFlavour, BaseTextComponent, BaseTextFlavour, BlockCardRef, DEFAULT_ELEMENT_HEIGHT, DefaultTextFlavour, EDITOR_TO_AFTER_VIEW_INIT_QUEUE, 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, 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 };
821
+ 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.10",
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
  }