slate-angular 20.2.0-next.3 → 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.
- package/fesm2022/slate-angular.mjs +1025 -288
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/index.d.ts +64 -31
- package/package.json +1 -1
- package/styles/index.scss +1 -0
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as slate_dom from 'slate-dom';
|
|
2
2
|
import { DOMEditor, DOMNode, DOMElement, DOMPoint, DOMRange, DOMStaticRange, DOMSelection, DOMText } from 'slate-dom';
|
|
3
3
|
import * as slate from 'slate';
|
|
4
|
-
import { Descendant, Range as Range$1, Node, Editor, NodeEntry, Point, Element as Element$1, Path, Text, LeafPosition, Ancestor, BaseRange } from 'slate';
|
|
4
|
+
import { Descendant, Range as Range$1, Node, Editor, NodeEntry, Point, Element as Element$1, Path, Text, LeafPosition, Ancestor, BaseRange, Selection as Selection$1 } from 'slate';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { Injector, ViewContainerRef, TemplateRef, OnInit, OnChanges, OnDestroy, AfterViewChecked, DoCheck, ElementRef, Renderer2, ChangeDetectorRef, NgZone, SimpleChanges } from '@angular/core';
|
|
7
7
|
import * as i1 from '@angular/common';
|
|
@@ -102,6 +102,8 @@ type OriginEvent = 'drag' | 'copy' | 'cut';
|
|
|
102
102
|
*/
|
|
103
103
|
interface AngularEditor extends CustomDOMEditor {
|
|
104
104
|
deleteCutData: () => void;
|
|
105
|
+
selectAll: () => void;
|
|
106
|
+
isVisible: (element: Element$1) => boolean;
|
|
105
107
|
onKeydown: (event: KeyboardEvent) => void;
|
|
106
108
|
onClick: (event: MouseEvent) => void;
|
|
107
109
|
injector: Injector;
|
|
@@ -147,6 +149,7 @@ declare const AngularEditor: {
|
|
|
147
149
|
focus: (editor: any, options?: {
|
|
148
150
|
retries: number;
|
|
149
151
|
}) => void;
|
|
152
|
+
isEnabledVirtualScroll(editor: AngularEditor): boolean;
|
|
150
153
|
isNodeInEditor(editor: CustomDOMEditor, node: Node): boolean;
|
|
151
154
|
isLeafInEditor(editor: CustomDOMEditor, leafNode: globalThis.Element): boolean;
|
|
152
155
|
isBlockHangingRight(editor: Editor): boolean;
|
|
@@ -308,22 +311,23 @@ declare class ListRender {
|
|
|
308
311
|
private viewTypes;
|
|
309
312
|
private differ;
|
|
310
313
|
initialized: boolean;
|
|
314
|
+
private preRenderingHTMLElement;
|
|
311
315
|
constructor(viewContext: SlateViewContext, viewContainerRef: ViewContainerRef, getOutletParent: () => HTMLElement, getOutletElement: () => HTMLElement | null);
|
|
312
|
-
initialize(children: Descendant[], parent: Ancestor, childrenContext: SlateChildrenContext): void;
|
|
313
|
-
update(children: Descendant[], parent: Ancestor, childrenContext: SlateChildrenContext): void;
|
|
316
|
+
initialize(children: Descendant[], parent: Ancestor, childrenContext: SlateChildrenContext, preRenderingCount?: number): void;
|
|
317
|
+
update(children: Descendant[], parent: Ancestor, childrenContext: SlateChildrenContext, preRenderingCount?: number): void;
|
|
314
318
|
destroy(): void;
|
|
315
319
|
}
|
|
316
320
|
|
|
317
321
|
interface SlateVirtualScrollConfig {
|
|
318
322
|
enabled?: boolean;
|
|
323
|
+
scrollContainer?: HTMLElement;
|
|
319
324
|
scrollTop: number;
|
|
320
325
|
viewportHeight: number;
|
|
321
|
-
|
|
322
|
-
bufferCount?: number;
|
|
326
|
+
viewportBoundingTop: number;
|
|
323
327
|
}
|
|
324
328
|
interface VirtualViewResult {
|
|
325
|
-
|
|
326
|
-
|
|
329
|
+
inViewportChildren: Element$1[];
|
|
330
|
+
inViewportIndics: number[];
|
|
327
331
|
top: number;
|
|
328
332
|
bottom: number;
|
|
329
333
|
heights: number[];
|
|
@@ -331,7 +335,6 @@ interface VirtualViewResult {
|
|
|
331
335
|
|
|
332
336
|
type SafeAny = any;
|
|
333
337
|
|
|
334
|
-
declare const JUST_NOW_UPDATED_VIRTUAL_VIEW: WeakMap<AngularEditor, boolean>;
|
|
335
338
|
declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewChecked, DoCheck {
|
|
336
339
|
elementRef: ElementRef;
|
|
337
340
|
renderer2: Renderer2;
|
|
@@ -387,13 +390,13 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
|
|
|
387
390
|
getOutletParent: () => any;
|
|
388
391
|
getOutletElement: () => HTMLElement;
|
|
389
392
|
listRender: ListRender;
|
|
390
|
-
private
|
|
391
|
-
private
|
|
392
|
-
private
|
|
393
|
-
private
|
|
394
|
-
private
|
|
395
|
-
private
|
|
396
|
-
private
|
|
393
|
+
private virtualScrollConfig;
|
|
394
|
+
private inViewportChildren;
|
|
395
|
+
private inViewportIndics;
|
|
396
|
+
private keyHeightMap;
|
|
397
|
+
private tryUpdateVirtualViewportAnimId;
|
|
398
|
+
private tryMeasureInViewportChildrenHeightsAnimId;
|
|
399
|
+
private editorResizeObserver?;
|
|
397
400
|
constructor(elementRef: ElementRef, renderer2: Renderer2, cdr: ChangeDetectorRef, ngZone: NgZone, injector: Injector);
|
|
398
401
|
ngOnInit(): void;
|
|
399
402
|
ngOnChanges(simpleChanges: SimpleChanges): void;
|
|
@@ -401,33 +404,35 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
|
|
|
401
404
|
registerOnTouched(fn: any): void;
|
|
402
405
|
writeValue(value: Element$1[]): void;
|
|
403
406
|
initialize(): void;
|
|
404
|
-
|
|
407
|
+
calculateVirtualScrollSelection(selection: Selection$1): slate.BaseRange;
|
|
408
|
+
toNativeSelection(autoScroll?: boolean): void;
|
|
405
409
|
onChange(): void;
|
|
406
410
|
ngAfterViewChecked(): void;
|
|
407
411
|
ngDoCheck(): void;
|
|
408
412
|
forceRender(): void;
|
|
409
413
|
render(): void;
|
|
414
|
+
updateListRenderAndRemeasureHeights(): void;
|
|
410
415
|
updateContext(): boolean;
|
|
411
416
|
initializeContext(): void;
|
|
412
417
|
initializeViewContext(): void;
|
|
413
418
|
composePlaceholderDecorate(editor: Editor): SlatePlaceholder[];
|
|
414
419
|
generateDecorations(): slate.BaseRange[];
|
|
415
|
-
private
|
|
420
|
+
private isEnabledVirtualScroll;
|
|
416
421
|
virtualScrollInitialized: boolean;
|
|
417
422
|
virtualTopHeightElement: HTMLElement;
|
|
418
423
|
virtualBottomHeightElement: HTMLElement;
|
|
419
424
|
virtualCenterOutlet: HTMLElement;
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
425
|
+
initializeVirtualScroll(): void;
|
|
426
|
+
setVirtualSpaceHeight(topHeight: number, bottomHeight?: number): void;
|
|
427
|
+
getActualVirtualTopHeight(): number;
|
|
428
|
+
handlePreRendering(): {
|
|
429
|
+
preRenderingCount: number;
|
|
430
|
+
childrenWithPreRendering: slate.BaseElement[];
|
|
431
|
+
};
|
|
432
|
+
private tryUpdateVirtualViewport;
|
|
433
|
+
private calculateVirtualViewport;
|
|
423
434
|
private applyVirtualView;
|
|
424
|
-
private
|
|
425
|
-
private getBlockHeight;
|
|
426
|
-
private buildAccumulatedHeight;
|
|
427
|
-
private getBufferBelowHeight;
|
|
428
|
-
private scheduleMeasureVisibleHeights;
|
|
429
|
-
private measureVisibleHeights;
|
|
430
|
-
private remeasureHeightByIndics;
|
|
435
|
+
private diffVirtualViewport;
|
|
431
436
|
private addEventListener;
|
|
432
437
|
private toSlateSelection;
|
|
433
438
|
private onDOMBeforeInput;
|
|
@@ -475,6 +480,7 @@ declare class LeavesRender {
|
|
|
475
480
|
initialize(context: SlateTextContext): void;
|
|
476
481
|
update(context: SlateTextContext): void;
|
|
477
482
|
private getLeaves;
|
|
483
|
+
destroy(): void;
|
|
478
484
|
}
|
|
479
485
|
|
|
480
486
|
declare abstract class BaseTextFlavour<T extends Text = Text> extends BaseFlavour<SlateTextContext<T>> {
|
|
@@ -502,9 +508,17 @@ declare const createText: (text: string) => {
|
|
|
502
508
|
nativeElement: HTMLSpanElement;
|
|
503
509
|
};
|
|
504
510
|
|
|
511
|
+
declare class SlateString {
|
|
512
|
+
context: SlateLeafContext;
|
|
513
|
+
viewContext: SlateViewContext;
|
|
514
|
+
ngOnInit(): void;
|
|
515
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SlateString, never>;
|
|
516
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SlateString, "span[slateString]", never, { "context": { "alias": "context"; "required": false; }; "viewContext": { "alias": "viewContext"; "required": false; }; }, {}, never, never, true, never>;
|
|
517
|
+
}
|
|
518
|
+
|
|
505
519
|
declare class SlateModule {
|
|
506
520
|
static ɵfac: i0.ɵɵFactoryDeclaration<SlateModule, never>;
|
|
507
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<SlateModule, never, [typeof i1.CommonModule, typeof SlateEditable, typeof SlateChildrenOutlet], [typeof SlateEditable, typeof SlateChildrenOutlet]>;
|
|
521
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SlateModule, never, [typeof i1.CommonModule, typeof SlateEditable, typeof SlateChildrenOutlet, typeof SlateString], [typeof SlateEditable, typeof SlateChildrenOutlet, typeof SlateString]>;
|
|
508
522
|
static ɵinj: i0.ɵɵInjectorDeclaration<SlateModule>;
|
|
509
523
|
}
|
|
510
524
|
|
|
@@ -613,6 +627,7 @@ declare class BaseLeafComponent extends BaseComponent<SlateLeafContext> implemen
|
|
|
613
627
|
isSlateLeaf: boolean;
|
|
614
628
|
get text(): Text;
|
|
615
629
|
get leaf(): Text;
|
|
630
|
+
getOutletParent: () => any;
|
|
616
631
|
ngOnInit(): void;
|
|
617
632
|
onContextChange(): void;
|
|
618
633
|
renderPlaceholder(): void;
|
|
@@ -682,6 +697,8 @@ declare const PLACEHOLDER_SYMBOL: string;
|
|
|
682
697
|
* Weak map for associating the html element with the component.
|
|
683
698
|
*/
|
|
684
699
|
declare const ELEMENT_TO_COMPONENT: WeakMap<Node, BaseElementComponent | BaseFlavour>;
|
|
700
|
+
declare const IS_ENABLED_VIRTUAL_SCROLL: WeakMap<Editor, boolean>;
|
|
701
|
+
declare const EDITOR_TO_VIRTUAL_SCROLL_SELECTION: WeakMap<slate.BaseEditor, slate.BaseRange>;
|
|
685
702
|
declare const EDITOR_TO_AFTER_VIEW_INIT_QUEUE: WeakMap<Editor, (() => void)[]>;
|
|
686
703
|
|
|
687
704
|
/**
|
|
@@ -732,9 +749,9 @@ declare const IS_QQBROWSER: boolean;
|
|
|
732
749
|
declare const IS_UC_MOBILE: boolean;
|
|
733
750
|
declare const IS_WECHATBROWSER: boolean;
|
|
734
751
|
declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
|
|
735
|
-
declare const
|
|
736
|
-
declare const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 40;
|
|
752
|
+
declare const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 30;
|
|
737
753
|
declare const SLATE_DEBUG_KEY = "__SLATE_DEBUG__";
|
|
754
|
+
declare const SLATE_DEBUG_KEY_SCROLL_TOP = "__SLATE_DEBUG_SCROLL_TOP__";
|
|
738
755
|
|
|
739
756
|
declare const shallowCompare: (obj1: {}, obj2: {}) => boolean;
|
|
740
757
|
/**
|
|
@@ -812,5 +829,21 @@ declare const getSelection: (root: Document | ShadowRoot) => Selection | null;
|
|
|
812
829
|
declare const getContentHeight: (element: Element) => number;
|
|
813
830
|
declare const getZeroTextNode: () => DOMText;
|
|
814
831
|
|
|
815
|
-
|
|
832
|
+
declare const isDebug: boolean;
|
|
833
|
+
declare const isDebugScrollTop: boolean;
|
|
834
|
+
declare const ELEMENT_KEY_TO_HEIGHTS: WeakMap<AngularEditor, Map<string, number>>;
|
|
835
|
+
declare const EDITOR_TO_BUSINESS_TOP: WeakMap<AngularEditor, number>;
|
|
836
|
+
declare const debugLog: (type: "log" | "warn", ...args: any[]) => void;
|
|
837
|
+
declare const measureHeightByElement: (editor: AngularEditor, element: Element$1) => number;
|
|
838
|
+
declare const measureHeightByIndics: (editor: AngularEditor, indics: number[], force?: boolean) => boolean;
|
|
839
|
+
declare const getBusinessTop: (editor: AngularEditor) => number;
|
|
840
|
+
declare const getRealHeightByElement: (editor: AngularEditor, element: Element$1, defaultHeight?: number) => number;
|
|
841
|
+
declare const buildHeightsAndAccumulatedHeights: (editor: AngularEditor) => {
|
|
842
|
+
heights: any[];
|
|
843
|
+
accumulatedHeights: any[];
|
|
844
|
+
};
|
|
845
|
+
declare const calculateVirtualTopHeight: (editor: AngularEditor, startIndex: number) => any;
|
|
846
|
+
declare const scrollToElement: (editor: AngularEditor, element: Element$1, scrollTo: (scrollTop: number) => void) => void;
|
|
847
|
+
|
|
848
|
+
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 };
|
|
816
849
|
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