slate-angular 20.2.0-next.9 → 20.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.
- package/fesm2022/slate-angular.mjs +2205 -1701
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/index.d.ts +63 -33
- 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';
|
|
@@ -103,6 +103,7 @@ type OriginEvent = 'drag' | 'copy' | 'cut';
|
|
|
103
103
|
interface AngularEditor extends CustomDOMEditor {
|
|
104
104
|
deleteCutData: () => void;
|
|
105
105
|
selectAll: () => void;
|
|
106
|
+
isVisible: (element: Element$1) => boolean;
|
|
106
107
|
onKeydown: (event: KeyboardEvent) => void;
|
|
107
108
|
onClick: (event: MouseEvent) => void;
|
|
108
109
|
injector: Injector;
|
|
@@ -148,6 +149,7 @@ declare const AngularEditor: {
|
|
|
148
149
|
focus: (editor: any, options?: {
|
|
149
150
|
retries: number;
|
|
150
151
|
}) => void;
|
|
152
|
+
isEnabledVirtualScroll(editor: AngularEditor): boolean;
|
|
151
153
|
isNodeInEditor(editor: CustomDOMEditor, node: Node): boolean;
|
|
152
154
|
isLeafInEditor(editor: CustomDOMEditor, leafNode: globalThis.Element): boolean;
|
|
153
155
|
isBlockHangingRight(editor: Editor): boolean;
|
|
@@ -309,22 +311,23 @@ declare class ListRender {
|
|
|
309
311
|
private viewTypes;
|
|
310
312
|
private differ;
|
|
311
313
|
initialized: boolean;
|
|
314
|
+
private preRenderingHTMLElement;
|
|
312
315
|
constructor(viewContext: SlateViewContext, viewContainerRef: ViewContainerRef, getOutletParent: () => HTMLElement, getOutletElement: () => HTMLElement | null);
|
|
313
|
-
initialize(children: Descendant[], parent: Ancestor, childrenContext: SlateChildrenContext): void;
|
|
314
|
-
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;
|
|
315
318
|
destroy(): void;
|
|
316
319
|
}
|
|
317
320
|
|
|
318
321
|
interface SlateVirtualScrollConfig {
|
|
319
322
|
enabled?: boolean;
|
|
323
|
+
scrollContainer?: HTMLElement;
|
|
320
324
|
scrollTop: number;
|
|
321
325
|
viewportHeight: number;
|
|
322
|
-
|
|
323
|
-
bufferCount?: number;
|
|
326
|
+
viewportBoundingTop: number;
|
|
324
327
|
}
|
|
325
328
|
interface VirtualViewResult {
|
|
326
|
-
|
|
327
|
-
|
|
329
|
+
inViewportChildren: Element$1[];
|
|
330
|
+
inViewportIndics: number[];
|
|
328
331
|
top: number;
|
|
329
332
|
bottom: number;
|
|
330
333
|
heights: number[];
|
|
@@ -332,7 +335,6 @@ interface VirtualViewResult {
|
|
|
332
335
|
|
|
333
336
|
type SafeAny = any;
|
|
334
337
|
|
|
335
|
-
declare const JUST_NOW_UPDATED_VIRTUAL_VIEW: WeakMap<AngularEditor, boolean>;
|
|
336
338
|
declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewChecked, DoCheck {
|
|
337
339
|
elementRef: ElementRef;
|
|
338
340
|
renderer2: Renderer2;
|
|
@@ -388,12 +390,12 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
|
|
|
388
390
|
getOutletParent: () => any;
|
|
389
391
|
getOutletElement: () => HTMLElement;
|
|
390
392
|
listRender: ListRender;
|
|
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;
|
|
397
399
|
private editorResizeObserver?;
|
|
398
400
|
constructor(elementRef: ElementRef, renderer2: Renderer2, cdr: ChangeDetectorRef, ngZone: NgZone, injector: Injector);
|
|
399
401
|
ngOnInit(): void;
|
|
@@ -402,36 +404,35 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
|
|
|
402
404
|
registerOnTouched(fn: any): void;
|
|
403
405
|
writeValue(value: Element$1[]): void;
|
|
404
406
|
initialize(): void;
|
|
405
|
-
|
|
407
|
+
calculateVirtualScrollSelection(selection: Selection$1): slate.BaseRange;
|
|
408
|
+
toNativeSelection(autoScroll?: boolean): void;
|
|
406
409
|
onChange(): void;
|
|
407
410
|
ngAfterViewChecked(): void;
|
|
408
411
|
ngDoCheck(): void;
|
|
409
412
|
forceRender(): void;
|
|
410
413
|
render(): void;
|
|
414
|
+
updateListRenderAndRemeasureHeights(): void;
|
|
411
415
|
updateContext(): boolean;
|
|
412
416
|
initializeContext(): void;
|
|
413
417
|
initializeViewContext(): void;
|
|
414
418
|
composePlaceholderDecorate(editor: Editor): SlatePlaceholder[];
|
|
415
419
|
generateDecorations(): slate.BaseRange[];
|
|
416
|
-
private
|
|
417
|
-
private businessHeight;
|
|
420
|
+
private isEnabledVirtualScroll;
|
|
418
421
|
virtualScrollInitialized: boolean;
|
|
419
422
|
virtualTopHeightElement: HTMLElement;
|
|
420
423
|
virtualBottomHeightElement: HTMLElement;
|
|
421
424
|
virtualCenterOutlet: HTMLElement;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
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;
|
|
428
434
|
private applyVirtualView;
|
|
429
|
-
private
|
|
430
|
-
private getBlockHeight;
|
|
431
|
-
private buildAccumulatedHeight;
|
|
432
|
-
private scheduleMeasureVisibleHeights;
|
|
433
|
-
private measureVisibleHeights;
|
|
434
|
-
private remeasureHeightByIndics;
|
|
435
|
+
private diffVirtualViewport;
|
|
435
436
|
private addEventListener;
|
|
436
437
|
private toSlateSelection;
|
|
437
438
|
private onDOMBeforeInput;
|
|
@@ -479,6 +480,7 @@ declare class LeavesRender {
|
|
|
479
480
|
initialize(context: SlateTextContext): void;
|
|
480
481
|
update(context: SlateTextContext): void;
|
|
481
482
|
private getLeaves;
|
|
483
|
+
destroy(): void;
|
|
482
484
|
}
|
|
483
485
|
|
|
484
486
|
declare abstract class BaseTextFlavour<T extends Text = Text> extends BaseFlavour<SlateTextContext<T>> {
|
|
@@ -506,9 +508,17 @@ declare const createText: (text: string) => {
|
|
|
506
508
|
nativeElement: HTMLSpanElement;
|
|
507
509
|
};
|
|
508
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
|
+
|
|
509
519
|
declare class SlateModule {
|
|
510
520
|
static ɵfac: i0.ɵɵFactoryDeclaration<SlateModule, never>;
|
|
511
|
-
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]>;
|
|
512
522
|
static ɵinj: i0.ɵɵInjectorDeclaration<SlateModule>;
|
|
513
523
|
}
|
|
514
524
|
|
|
@@ -617,6 +627,7 @@ declare class BaseLeafComponent extends BaseComponent<SlateLeafContext> implemen
|
|
|
617
627
|
isSlateLeaf: boolean;
|
|
618
628
|
get text(): Text;
|
|
619
629
|
get leaf(): Text;
|
|
630
|
+
getOutletParent: () => any;
|
|
620
631
|
ngOnInit(): void;
|
|
621
632
|
onContextChange(): void;
|
|
622
633
|
renderPlaceholder(): void;
|
|
@@ -686,6 +697,8 @@ declare const PLACEHOLDER_SYMBOL: string;
|
|
|
686
697
|
* Weak map for associating the html element with the component.
|
|
687
698
|
*/
|
|
688
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>;
|
|
689
702
|
declare const EDITOR_TO_AFTER_VIEW_INIT_QUEUE: WeakMap<Editor, (() => void)[]>;
|
|
690
703
|
|
|
691
704
|
/**
|
|
@@ -736,9 +749,9 @@ declare const IS_QQBROWSER: boolean;
|
|
|
736
749
|
declare const IS_UC_MOBILE: boolean;
|
|
737
750
|
declare const IS_WECHATBROWSER: boolean;
|
|
738
751
|
declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
|
|
739
|
-
declare const
|
|
740
|
-
declare const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 40;
|
|
752
|
+
declare const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 30;
|
|
741
753
|
declare const SLATE_DEBUG_KEY = "__SLATE_DEBUG__";
|
|
754
|
+
declare const SLATE_DEBUG_KEY_SCROLL_TOP = "__SLATE_DEBUG_SCROLL_TOP__";
|
|
742
755
|
|
|
743
756
|
declare const shallowCompare: (obj1: {}, obj2: {}) => boolean;
|
|
744
757
|
/**
|
|
@@ -816,5 +829,22 @@ declare const getSelection: (root: Document | ShadowRoot) => Selection | null;
|
|
|
816
829
|
declare const getContentHeight: (element: Element) => number;
|
|
817
830
|
declare const getZeroTextNode: () => DOMText;
|
|
818
831
|
|
|
819
|
-
|
|
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 EDITOR_TO_ROOT_NODE_WIDTH: WeakMap<AngularEditor, number>;
|
|
837
|
+
declare const debugLog: (type: "log" | "warn", ...args: any[]) => void;
|
|
838
|
+
declare const measureHeightByElement: (editor: AngularEditor, element: Element$1) => number;
|
|
839
|
+
declare const measureHeightByIndics: (editor: AngularEditor, indics: number[], force?: boolean) => boolean;
|
|
840
|
+
declare const getBusinessTop: (editor: AngularEditor) => number;
|
|
841
|
+
declare const getRealHeightByElement: (editor: AngularEditor, element: Element$1, defaultHeight?: number) => number;
|
|
842
|
+
declare const buildHeightsAndAccumulatedHeights: (editor: AngularEditor) => {
|
|
843
|
+
heights: any[];
|
|
844
|
+
accumulatedHeights: any[];
|
|
845
|
+
};
|
|
846
|
+
declare const calculateVirtualTopHeight: (editor: AngularEditor, startIndex: number) => any;
|
|
847
|
+
declare const scrollToElement: (editor: AngularEditor, element: Element$1, scrollTo: (scrollTop: number) => void) => void;
|
|
848
|
+
|
|
849
|
+
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_ROOT_NODE_WIDTH, 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 };
|
|
820
850
|
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