slate-angular 20.2.0-next.7 → 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 +1040 -281
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/index.d.ts +64 -30
- 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,13 @@ 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;
|
|
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
|
|
416
|
-
private businessHeight;
|
|
420
|
+
private isEnabledVirtualScroll;
|
|
417
421
|
virtualScrollInitialized: boolean;
|
|
418
422
|
virtualTopHeightElement: HTMLElement;
|
|
419
423
|
virtualBottomHeightElement: HTMLElement;
|
|
420
424
|
virtualCenterOutlet: HTMLElement;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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;
|
|
424
434
|
private applyVirtualView;
|
|
425
|
-
private
|
|
426
|
-
private getBlockHeight;
|
|
427
|
-
private buildAccumulatedHeight;
|
|
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,22 @@ 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 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 };
|
|
816
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