slate-angular 20.2.0-next.9 → 20.2.1
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 +2035 -1483
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/index.d.ts +66 -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, childrenIndics?: number[]): void;
|
|
317
|
+
update(children: Descendant[], parent: Ancestor, childrenContext: SlateChildrenContext, preRenderingCount?: number, childrenIndics?: 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,37 @@ 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
|
+
private isSelectionInvisible;
|
|
409
|
+
toNativeSelection(autoScroll?: boolean): void;
|
|
406
410
|
onChange(): void;
|
|
407
411
|
ngAfterViewChecked(): void;
|
|
408
412
|
ngDoCheck(): void;
|
|
409
413
|
forceRender(): void;
|
|
410
414
|
render(): void;
|
|
415
|
+
updateListRenderAndRemeasureHeights(): void;
|
|
411
416
|
updateContext(): boolean;
|
|
412
417
|
initializeContext(): void;
|
|
413
418
|
initializeViewContext(): void;
|
|
414
419
|
composePlaceholderDecorate(editor: Editor): SlatePlaceholder[];
|
|
415
420
|
generateDecorations(): slate.BaseRange[];
|
|
416
|
-
private
|
|
417
|
-
private businessHeight;
|
|
421
|
+
private isEnabledVirtualScroll;
|
|
418
422
|
virtualScrollInitialized: boolean;
|
|
419
423
|
virtualTopHeightElement: HTMLElement;
|
|
420
424
|
virtualBottomHeightElement: HTMLElement;
|
|
421
425
|
virtualCenterOutlet: HTMLElement;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
426
|
+
initializeVirtualScroll(): void;
|
|
427
|
+
setVirtualSpaceHeight(topHeight: number, bottomHeight?: number): void;
|
|
428
|
+
getActualVirtualTopHeight(): number;
|
|
429
|
+
handlePreRendering(): {
|
|
430
|
+
preRenderingCount: number;
|
|
431
|
+
childrenWithPreRendering: slate.BaseElement[];
|
|
432
|
+
childrenWithPreRenderingIndics: number[];
|
|
433
|
+
};
|
|
434
|
+
private tryUpdateVirtualViewport;
|
|
435
|
+
private calculateVirtualViewport;
|
|
428
436
|
private applyVirtualView;
|
|
429
|
-
private
|
|
430
|
-
private getBlockHeight;
|
|
431
|
-
private buildAccumulatedHeight;
|
|
432
|
-
private scheduleMeasureVisibleHeights;
|
|
433
|
-
private measureVisibleHeights;
|
|
434
|
-
private remeasureHeightByIndics;
|
|
437
|
+
private diffVirtualViewport;
|
|
435
438
|
private addEventListener;
|
|
436
439
|
private toSlateSelection;
|
|
437
440
|
private onDOMBeforeInput;
|
|
@@ -479,6 +482,7 @@ declare class LeavesRender {
|
|
|
479
482
|
initialize(context: SlateTextContext): void;
|
|
480
483
|
update(context: SlateTextContext): void;
|
|
481
484
|
private getLeaves;
|
|
485
|
+
destroy(): void;
|
|
482
486
|
}
|
|
483
487
|
|
|
484
488
|
declare abstract class BaseTextFlavour<T extends Text = Text> extends BaseFlavour<SlateTextContext<T>> {
|
|
@@ -506,9 +510,17 @@ declare const createText: (text: string) => {
|
|
|
506
510
|
nativeElement: HTMLSpanElement;
|
|
507
511
|
};
|
|
508
512
|
|
|
513
|
+
declare class SlateString {
|
|
514
|
+
context: SlateLeafContext;
|
|
515
|
+
viewContext: SlateViewContext;
|
|
516
|
+
ngOnInit(): void;
|
|
517
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SlateString, never>;
|
|
518
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SlateString, "span[slateString]", never, { "context": { "alias": "context"; "required": false; }; "viewContext": { "alias": "viewContext"; "required": false; }; }, {}, never, never, true, never>;
|
|
519
|
+
}
|
|
520
|
+
|
|
509
521
|
declare class SlateModule {
|
|
510
522
|
static ɵfac: i0.ɵɵFactoryDeclaration<SlateModule, never>;
|
|
511
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<SlateModule, never, [typeof i1.CommonModule, typeof SlateEditable, typeof SlateChildrenOutlet], [typeof SlateEditable, typeof SlateChildrenOutlet]>;
|
|
523
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SlateModule, never, [typeof i1.CommonModule, typeof SlateEditable, typeof SlateChildrenOutlet, typeof SlateString], [typeof SlateEditable, typeof SlateChildrenOutlet, typeof SlateString]>;
|
|
512
524
|
static ɵinj: i0.ɵɵInjectorDeclaration<SlateModule>;
|
|
513
525
|
}
|
|
514
526
|
|
|
@@ -617,6 +629,7 @@ declare class BaseLeafComponent extends BaseComponent<SlateLeafContext> implemen
|
|
|
617
629
|
isSlateLeaf: boolean;
|
|
618
630
|
get text(): Text;
|
|
619
631
|
get leaf(): Text;
|
|
632
|
+
getOutletParent: () => any;
|
|
620
633
|
ngOnInit(): void;
|
|
621
634
|
onContextChange(): void;
|
|
622
635
|
renderPlaceholder(): void;
|
|
@@ -686,6 +699,8 @@ declare const PLACEHOLDER_SYMBOL: string;
|
|
|
686
699
|
* Weak map for associating the html element with the component.
|
|
687
700
|
*/
|
|
688
701
|
declare const ELEMENT_TO_COMPONENT: WeakMap<Node, BaseElementComponent | BaseFlavour>;
|
|
702
|
+
declare const IS_ENABLED_VIRTUAL_SCROLL: WeakMap<Editor, boolean>;
|
|
703
|
+
declare const EDITOR_TO_VIRTUAL_SCROLL_SELECTION: WeakMap<slate.BaseEditor, slate.BaseRange>;
|
|
689
704
|
declare const EDITOR_TO_AFTER_VIEW_INIT_QUEUE: WeakMap<Editor, (() => void)[]>;
|
|
690
705
|
|
|
691
706
|
/**
|
|
@@ -736,9 +751,9 @@ declare const IS_QQBROWSER: boolean;
|
|
|
736
751
|
declare const IS_UC_MOBILE: boolean;
|
|
737
752
|
declare const IS_WECHATBROWSER: boolean;
|
|
738
753
|
declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
|
|
739
|
-
declare const
|
|
740
|
-
declare const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 40;
|
|
754
|
+
declare const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 30;
|
|
741
755
|
declare const SLATE_DEBUG_KEY = "__SLATE_DEBUG__";
|
|
756
|
+
declare const SLATE_DEBUG_KEY_SCROLL_TOP = "__SLATE_DEBUG_SCROLL_TOP__";
|
|
742
757
|
|
|
743
758
|
declare const shallowCompare: (obj1: {}, obj2: {}) => boolean;
|
|
744
759
|
/**
|
|
@@ -816,5 +831,23 @@ declare const getSelection: (root: Document | ShadowRoot) => Selection | null;
|
|
|
816
831
|
declare const getContentHeight: (element: Element) => number;
|
|
817
832
|
declare const getZeroTextNode: () => DOMText;
|
|
818
833
|
|
|
819
|
-
|
|
834
|
+
declare const isDebug: boolean;
|
|
835
|
+
declare const isDebugScrollTop: boolean;
|
|
836
|
+
declare const ELEMENT_KEY_TO_HEIGHTS: WeakMap<AngularEditor, Map<string, number>>;
|
|
837
|
+
declare const EDITOR_TO_BUSINESS_TOP: WeakMap<AngularEditor, number>;
|
|
838
|
+
declare const EDITOR_TO_ROOT_NODE_WIDTH: WeakMap<AngularEditor, number>;
|
|
839
|
+
declare const debugLog: (type: "log" | "warn", ...args: any[]) => void;
|
|
840
|
+
declare const measureHeightByElement: (editor: AngularEditor, element: Element$1) => number;
|
|
841
|
+
declare const measureHeightByIndics: (editor: AngularEditor, indics: number[], force?: boolean) => boolean;
|
|
842
|
+
declare const getBusinessTop: (editor: AngularEditor) => number;
|
|
843
|
+
declare const getRealHeightByElement: (editor: AngularEditor, element: Element$1, defaultHeight?: number, isVisible?: boolean) => number;
|
|
844
|
+
declare const buildHeightsAndAccumulatedHeights: (editor: AngularEditor) => {
|
|
845
|
+
heights: any[];
|
|
846
|
+
accumulatedHeights: any[];
|
|
847
|
+
visibles: any[];
|
|
848
|
+
};
|
|
849
|
+
declare const calculateVirtualTopHeight: (editor: AngularEditor, startIndex: number) => any;
|
|
850
|
+
declare const scrollToElement: (editor: AngularEditor, element: Element$1, scrollTo: (scrollTop: number) => void) => void;
|
|
851
|
+
|
|
852
|
+
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
853
|
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