slate-angular 20.1.0 → 20.2.0-next.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 +189 -16
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/index.d.ts +31 -3
- package/package.json +1 -1
- package/styles/index.scss +14 -1
package/index.d.ts
CHANGED
|
@@ -314,6 +314,12 @@ declare class ListRender {
|
|
|
314
314
|
destroy(): void;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
interface SlateVirtualScrollConfig {
|
|
318
|
+
enabled?: boolean;
|
|
319
|
+
scrollTop: number;
|
|
320
|
+
viewportHeight: number;
|
|
321
|
+
bufferCount?: number;
|
|
322
|
+
}
|
|
317
323
|
declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewChecked, DoCheck {
|
|
318
324
|
elementRef: ElementRef;
|
|
319
325
|
renderer2: Renderer2;
|
|
@@ -342,6 +348,9 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
|
|
|
342
348
|
trackBy: (node: Element$1) => any;
|
|
343
349
|
readonly: boolean;
|
|
344
350
|
placeholder: string;
|
|
351
|
+
set virtualScroll(config: SlateVirtualScrollConfig);
|
|
352
|
+
virtualTopPadding: number;
|
|
353
|
+
virtualBottomPadding: number;
|
|
345
354
|
beforeInput: (event: Event) => void;
|
|
346
355
|
blur: (event: Event) => void;
|
|
347
356
|
click: (event: MouseEvent) => void;
|
|
@@ -367,6 +376,13 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
|
|
|
367
376
|
viewContainerRef: ViewContainerRef;
|
|
368
377
|
getOutletParent: () => any;
|
|
369
378
|
listRender: ListRender;
|
|
379
|
+
private virtualConfig;
|
|
380
|
+
private renderedChildren;
|
|
381
|
+
private virtualVisibleIndexes;
|
|
382
|
+
private measuredHeights;
|
|
383
|
+
private measurePending;
|
|
384
|
+
private refreshVirtualViewAnimId;
|
|
385
|
+
private measureVisibleHeightsAnimId;
|
|
370
386
|
constructor(elementRef: ElementRef, renderer2: Renderer2, cdr: ChangeDetectorRef, ngZone: NgZone, injector: Injector);
|
|
371
387
|
ngOnInit(): void;
|
|
372
388
|
ngOnChanges(simpleChanges: SimpleChanges): void;
|
|
@@ -385,6 +401,13 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
|
|
|
385
401
|
initializeViewContext(): void;
|
|
386
402
|
composePlaceholderDecorate(editor: Editor): SlatePlaceholder[];
|
|
387
403
|
generateDecorations(): slate.BaseRange[];
|
|
404
|
+
private shouldUseVirtual;
|
|
405
|
+
private refreshVirtualView;
|
|
406
|
+
private getBlockHeight;
|
|
407
|
+
private buildAccumulatedHeight;
|
|
408
|
+
private getBufferBelowHeight;
|
|
409
|
+
private scheduleMeasureVisibleHeights;
|
|
410
|
+
private measureVisibleHeights;
|
|
388
411
|
private addEventListener;
|
|
389
412
|
private toSlateSelection;
|
|
390
413
|
private onDOMBeforeInput;
|
|
@@ -406,7 +429,7 @@ declare class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewCh
|
|
|
406
429
|
private isDOMEventHandled;
|
|
407
430
|
ngOnDestroy(): void;
|
|
408
431
|
static ɵfac: i0.ɵɵFactoryDeclaration<SlateEditable, never>;
|
|
409
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SlateEditable, "slate-editable", never, { "editor": { "alias": "editor"; "required": false; }; "renderElement": { "alias": "renderElement"; "required": false; }; "renderLeaf": { "alias": "renderLeaf"; "required": false; }; "renderText": { "alias": "renderText"; "required": false; }; "decorate": { "alias": "decorate"; "required": false; }; "placeholderDecorate": { "alias": "placeholderDecorate"; "required": false; }; "scrollSelectionIntoView": { "alias": "scrollSelectionIntoView"; "required": false; }; "isStrictDecorate": { "alias": "isStrictDecorate"; "required": false; }; "trackBy": { "alias": "trackBy"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "beforeInput": { "alias": "beforeInput"; "required": false; }; "blur": { "alias": "blur"; "required": false; }; "click": { "alias": "click"; "required": false; }; "compositionEnd": { "alias": "compositionEnd"; "required": false; }; "compositionUpdate": { "alias": "compositionUpdate"; "required": false; }; "compositionStart": { "alias": "compositionStart"; "required": false; }; "copy": { "alias": "copy"; "required": false; }; "cut": { "alias": "cut"; "required": false; }; "dragOver": { "alias": "dragOver"; "required": false; }; "dragStart": { "alias": "dragStart"; "required": false; }; "dragEnd": { "alias": "dragEnd"; "required": false; }; "drop": { "alias": "drop"; "required": false; }; "focus": { "alias": "focus"; "required": false; }; "keydown": { "alias": "keydown"; "required": false; }; "paste": { "alias": "paste"; "required": false; }; "spellCheck": { "alias": "spellCheck"; "required": false; }; "autoCorrect": { "alias": "autoCorrect"; "required": false; }; "autoCapitalize": { "alias": "autoCapitalize"; "required": false; }; }, {}, never, never, true, never>;
|
|
432
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SlateEditable, "slate-editable", never, { "editor": { "alias": "editor"; "required": false; }; "renderElement": { "alias": "renderElement"; "required": false; }; "renderLeaf": { "alias": "renderLeaf"; "required": false; }; "renderText": { "alias": "renderText"; "required": false; }; "decorate": { "alias": "decorate"; "required": false; }; "placeholderDecorate": { "alias": "placeholderDecorate"; "required": false; }; "scrollSelectionIntoView": { "alias": "scrollSelectionIntoView"; "required": false; }; "isStrictDecorate": { "alias": "isStrictDecorate"; "required": false; }; "trackBy": { "alias": "trackBy"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "virtualScroll": { "alias": "virtualScroll"; "required": false; }; "beforeInput": { "alias": "beforeInput"; "required": false; }; "blur": { "alias": "blur"; "required": false; }; "click": { "alias": "click"; "required": false; }; "compositionEnd": { "alias": "compositionEnd"; "required": false; }; "compositionUpdate": { "alias": "compositionUpdate"; "required": false; }; "compositionStart": { "alias": "compositionStart"; "required": false; }; "copy": { "alias": "copy"; "required": false; }; "cut": { "alias": "cut"; "required": false; }; "dragOver": { "alias": "dragOver"; "required": false; }; "dragStart": { "alias": "dragStart"; "required": false; }; "dragEnd": { "alias": "dragEnd"; "required": false; }; "drop": { "alias": "drop"; "required": false; }; "focus": { "alias": "focus"; "required": false; }; "keydown": { "alias": "keydown"; "required": false; }; "paste": { "alias": "paste"; "required": false; }; "spellCheck": { "alias": "spellCheck"; "required": false; }; "autoCorrect": { "alias": "autoCorrect"; "required": false; }; "autoCapitalize": { "alias": "autoCapitalize"; "required": false; }; }, {}, never, never, true, never>;
|
|
410
433
|
}
|
|
411
434
|
declare const defaultScrollSelectionIntoView: (editor: AngularEditor, domRange: DOMRange) => void;
|
|
412
435
|
|
|
@@ -538,6 +561,7 @@ declare class BaseElementComponent<T extends Element$1 = Element$1, K extends An
|
|
|
538
561
|
onContextChange(): void;
|
|
539
562
|
updateChildrenView(): void;
|
|
540
563
|
getChildrenContext(): SlateChildrenContext;
|
|
564
|
+
getRealHeight(): Promise<number>;
|
|
541
565
|
static ɵfac: i0.ɵɵFactoryDeclaration<BaseElementComponent<any, any>, never>;
|
|
542
566
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseElementComponent<any, any>, never, never, {}, {}, never, never, true, never>;
|
|
543
567
|
}
|
|
@@ -577,6 +601,7 @@ declare class BaseLeafComponent extends BaseComponent<SlateLeafContext> implemen
|
|
|
577
601
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseLeafComponent, never, never, {}, {}, never, never, true, never>;
|
|
578
602
|
}
|
|
579
603
|
|
|
604
|
+
declare const DEFAULT_ELEMENT_HEIGHT = 24;
|
|
580
605
|
declare abstract class BaseElementFlavour<T extends Element$1 = Element$1, K extends AngularEditor = AngularEditor> extends BaseFlavour<SlateElementContext<T>, K> {
|
|
581
606
|
childrenContext: SlateChildrenContext;
|
|
582
607
|
get element(): T;
|
|
@@ -596,6 +621,7 @@ declare abstract class BaseElementFlavour<T extends Element$1 = Element$1, K ext
|
|
|
596
621
|
onContextChange(): void;
|
|
597
622
|
updateChildrenView(): void;
|
|
598
623
|
getChildrenContext(): SlateChildrenContext;
|
|
624
|
+
getRealHeight(): Promise<number>;
|
|
599
625
|
abstract render(): void;
|
|
600
626
|
abstract rerender(): void;
|
|
601
627
|
}
|
|
@@ -682,6 +708,8 @@ declare const IS_QQBROWSER: boolean;
|
|
|
682
708
|
declare const IS_UC_MOBILE: boolean;
|
|
683
709
|
declare const IS_WECHATBROWSER: boolean;
|
|
684
710
|
declare const HAS_BEFORE_INPUT_SUPPORT: boolean;
|
|
711
|
+
declare const VIRTUAL_SCROLL_DEFAULT_BUFFER_COUNT = 3;
|
|
712
|
+
declare const VIRTUAL_SCROLL_DEFAULT_BLOCK_HEIGHT = 40;
|
|
685
713
|
|
|
686
714
|
declare const shallowCompare: (obj1: {}, obj2: {}) => boolean;
|
|
687
715
|
/**
|
|
@@ -761,5 +789,5 @@ declare const getZeroTextNode: () => DOMText;
|
|
|
761
789
|
|
|
762
790
|
type SafeAny = any;
|
|
763
791
|
|
|
764
|
-
export { AngularEditor, BaseComponent, BaseElementComponent, BaseElementFlavour, BaseFlavour, BaseLeafComponent, BaseLeafFlavour, BaseTextComponent, BaseTextFlavour, BlockCardRef, 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, 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 };
|
|
765
|
-
export type { AfterContextChange, BaseEmbeddedView, BeforeContextChange, ClipboardData, ComponentType, OriginEvent, SafeAny, SlateChildrenContext, SlateElementAttributes, SlateElementContext, SlateError, SlateLeafContext, SlatePlaceholder, SlateStringContext, SlateTextContext, SlateViewContext, ThrottleRAF, ViewType };
|
|
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 };
|
package/package.json
CHANGED
package/styles/index.scss
CHANGED
|
@@ -2,8 +2,21 @@
|
|
|
2
2
|
.slate-editable-container {
|
|
3
3
|
display: block;
|
|
4
4
|
outline: none;
|
|
5
|
-
padding: 32px;
|
|
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
|
+
}
|
|
7
20
|
& [contenteditable='true'] {
|
|
8
21
|
outline: none;
|
|
9
22
|
}
|