slate-angular 18.0.0-next.0 → 18.0.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/components/editable/editable.component.d.ts +1 -1
- package/components/string/default-string.component.d.ts +3 -6
- package/components/string/string.component.d.ts +3 -4
- package/esm2022/components/block-card/block-card.component.mjs +3 -3
- package/esm2022/components/children/children-outlet.component.mjs +3 -3
- package/esm2022/components/children/children.component.mjs +3 -3
- package/esm2022/components/editable/editable.component.mjs +3 -3
- package/esm2022/components/element/default-element.component.mjs +3 -3
- package/esm2022/components/element/element.component.mjs +5 -5
- package/esm2022/components/leaf/default-leaf.component.mjs +3 -3
- package/esm2022/components/leaves/leaves.component.mjs +3 -3
- package/esm2022/components/string/default-string.component.mjs +6 -11
- package/esm2022/components/string/string.component.mjs +10 -10
- package/esm2022/components/string/template.component.mjs +3 -3
- package/esm2022/components/text/default-text.component.mjs +3 -3
- package/esm2022/components/text/void-text.component.mjs +3 -3
- package/esm2022/module.mjs +4 -4
- package/esm2022/plugins/with-angular.mjs +3 -3
- package/esm2022/view/base.mjs +23 -23
- package/esm2022/view/container-item.mjs +10 -10
- package/esm2022/view/container.mjs +3 -3
- package/fesm2022/slate-angular.mjs +239 -244
- package/fesm2022/slate-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/plugins/angular-editor.d.ts +10 -10
- package/plugins/with-angular.d.ts +2 -1
- package/utils/clipboard/clipboard.d.ts +1 -1
- package/utils/clipboard/data-transfer.d.ts +4 -4
- package/utils/dom.d.ts +2 -2
- package/view/base.d.ts +6 -8
- package/view/container-item.d.ts +1 -2
- package/view/render/utils.d.ts +1 -1
package/package.json
CHANGED
|
@@ -118,7 +118,7 @@ export declare const AngularEditor: {
|
|
|
118
118
|
*/
|
|
119
119
|
toSlateNode<T extends boolean>(editor: AngularEditor, domNode: DOMNode, options?: {
|
|
120
120
|
suppressThrow: T;
|
|
121
|
-
}): T extends true ? Node : Node;
|
|
121
|
+
}): T extends true ? Node | null : Node;
|
|
122
122
|
/**
|
|
123
123
|
* Get the target range from a DOM `event`.
|
|
124
124
|
*/
|
|
@@ -129,22 +129,22 @@ export declare const AngularEditor: {
|
|
|
129
129
|
/**
|
|
130
130
|
* Find a Slate point from a DOM selection's `domNode` and `domOffset`.
|
|
131
131
|
*/
|
|
132
|
-
toSlatePoint<
|
|
132
|
+
toSlatePoint<T extends boolean>(editor: AngularEditor, domPoint: DOMPoint, options: {
|
|
133
133
|
exactMatch?: boolean;
|
|
134
|
-
suppressThrow:
|
|
135
|
-
}):
|
|
134
|
+
suppressThrow: T;
|
|
135
|
+
}): T extends true ? Point | null : Point;
|
|
136
136
|
/**
|
|
137
137
|
* Find a Slate range from a DOM range or selection.
|
|
138
138
|
*/
|
|
139
|
-
toSlateRange<
|
|
139
|
+
toSlateRange<T extends boolean>(editor: AngularEditor, domRange: DOMRange | DOMStaticRange | DOMSelection, options?: {
|
|
140
140
|
exactMatch?: boolean;
|
|
141
|
-
suppressThrow:
|
|
142
|
-
}):
|
|
141
|
+
suppressThrow: T;
|
|
142
|
+
}): T extends true ? Range | null : Range;
|
|
143
143
|
isLeafBlock(editor: AngularEditor, node: Node): boolean;
|
|
144
144
|
isBlockCardLeftCursor(editor: AngularEditor): boolean;
|
|
145
145
|
isBlockCardRightCursor(editor: AngularEditor): boolean;
|
|
146
146
|
getCardCursorNode(editor: AngularEditor, blockCardNode: Node, options: {
|
|
147
|
-
direction:
|
|
147
|
+
direction: "left" | "right" | "center";
|
|
148
148
|
}): ChildNode;
|
|
149
149
|
toSlateCardEntry(editor: AngularEditor, node: DOMNode): NodeEntry;
|
|
150
150
|
/**
|
|
@@ -154,7 +154,7 @@ export declare const AngularEditor: {
|
|
|
154
154
|
* @param options
|
|
155
155
|
*/
|
|
156
156
|
moveBlockCard(editor: AngularEditor, blockCardNode: Node, options: {
|
|
157
|
-
direction:
|
|
157
|
+
direction: "left" | "right";
|
|
158
158
|
}): void;
|
|
159
159
|
/**
|
|
160
160
|
* move slate selection to card-left or card-right
|
|
@@ -163,7 +163,7 @@ export declare const AngularEditor: {
|
|
|
163
163
|
* @param options
|
|
164
164
|
*/
|
|
165
165
|
moveBlockCardCursor(editor: AngularEditor, path: Path, options: {
|
|
166
|
-
direction:
|
|
166
|
+
direction: "left" | "right";
|
|
167
167
|
}): void;
|
|
168
168
|
hasRange(editor: AngularEditor, range: Range): boolean;
|
|
169
169
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { Editor } from 'slate';
|
|
1
2
|
import { AngularEditor } from './angular-editor';
|
|
2
|
-
export declare const withAngular: <T extends
|
|
3
|
+
export declare const withAngular: <T extends Editor>(editor: T, clipboardFormatKey?: string) => T & AngularEditor;
|
|
@@ -9,4 +9,4 @@ export declare const getClipboardData: (dataTransfer?: DataTransfer) => Promise<
|
|
|
9
9
|
* @param attach attach must be child element of wrapper which will be attached json data
|
|
10
10
|
* @returns void
|
|
11
11
|
*/
|
|
12
|
-
export declare const setClipboardData: (clipboardData: ClipboardData, wrapper: HTMLElement, attach: HTMLElement, dataTransfer?: Pick<DataTransfer,
|
|
12
|
+
export declare const setClipboardData: (clipboardData: ClipboardData, wrapper: HTMLElement, attach: HTMLElement, dataTransfer?: Pick<DataTransfer, "getData" | "setData">) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClipboardData } from '../../types/clipboard';
|
|
2
|
-
export declare const setDataTransferClipboard: (dataTransfer: Pick<DataTransfer,
|
|
3
|
-
export declare const setDataTransferClipboardText: (data: Pick<DataTransfer,
|
|
4
|
-
export declare const getDataTransferClipboard: (data: Pick<DataTransfer,
|
|
5
|
-
export declare const getDataTransferClipboardText: (data: Pick<DataTransfer,
|
|
2
|
+
export declare const setDataTransferClipboard: (dataTransfer: Pick<DataTransfer, "getData" | "setData"> | null, htmlText: string) => void;
|
|
3
|
+
export declare const setDataTransferClipboardText: (data: Pick<DataTransfer, "getData" | "setData"> | null, text: string) => void;
|
|
4
|
+
export declare const getDataTransferClipboard: (data: Pick<DataTransfer, "getData" | "setData"> | null) => ClipboardData;
|
|
5
|
+
export declare const getDataTransferClipboardText: (data: Pick<DataTransfer, "getData" | "setData"> | null) => ClipboardData;
|
package/utils/dom.d.ts
CHANGED
|
@@ -57,12 +57,12 @@ export declare const hasShadowRoot: () => boolean;
|
|
|
57
57
|
* Get the nearest editable child and index at `index` in a `parent`, preferring
|
|
58
58
|
* `direction`.
|
|
59
59
|
*/
|
|
60
|
-
export declare const getEditableChildAndIndex: (parent: DOMElement, index: number, direction:
|
|
60
|
+
export declare const getEditableChildAndIndex: (parent: DOMElement, index: number, direction: "forward" | "backward") => [DOMNode, number];
|
|
61
61
|
/**
|
|
62
62
|
* Get the nearest editable child at `index` in a `parent`, preferring
|
|
63
63
|
* `direction`.
|
|
64
64
|
*/
|
|
65
|
-
export declare const getEditableChild: (parent: DOMElement, index: number, direction:
|
|
65
|
+
export declare const getEditableChild: (parent: DOMElement, index: number, direction: "forward" | "backward") => DOMNode;
|
|
66
66
|
/**
|
|
67
67
|
* Get a plaintext representation of the content of a node, accounting for block
|
|
68
68
|
* elements which get a newline appended.
|
package/view/base.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ChangeDetectorRef, ElementRef, OnDestroy, OnInit, ViewContainerRef } from '@angular/core';
|
|
2
|
-
import { AngularEditor } from '../plugins/angular-editor';
|
|
3
|
-
import { SlateViewContext, SlateElementContext, SlateTextContext, SlateLeafContext } from './context';
|
|
4
2
|
import { Descendant, Element, Range, Text } from 'slate';
|
|
5
|
-
import { SlateChildrenContext } from './context';
|
|
6
|
-
import { ListRender } from './render/list-render';
|
|
7
|
-
import { LeavesRender } from './render/leaves-render';
|
|
8
3
|
import { SlateChildrenOutlet } from '../components/children/children-outlet.component';
|
|
4
|
+
import { AngularEditor } from '../plugins/angular-editor';
|
|
5
|
+
import { SlateChildrenContext, SlateElementContext, SlateLeafContext, SlateTextContext, SlateViewContext } from './context';
|
|
6
|
+
import { LeavesRender } from './render/leaves-render';
|
|
7
|
+
import { ListRender } from './render/list-render';
|
|
9
8
|
import * as i0 from "@angular/core";
|
|
10
9
|
/**
|
|
11
10
|
* base class for template
|
|
@@ -18,8 +17,6 @@ export interface BaseEmbeddedView<T, K extends AngularEditor = AngularEditor> {
|
|
|
18
17
|
* base class for custom element component or text component
|
|
19
18
|
*/
|
|
20
19
|
export declare abstract class BaseComponent<T = SlateTextContext | SlateLeafContext | SlateElementContext, K extends AngularEditor = AngularEditor> {
|
|
21
|
-
elementRef: ElementRef;
|
|
22
|
-
cdr: ChangeDetectorRef;
|
|
23
20
|
initialized: boolean;
|
|
24
21
|
protected _context: T;
|
|
25
22
|
set context(value: T);
|
|
@@ -27,7 +24,8 @@ export declare abstract class BaseComponent<T = SlateTextContext | SlateLeafCont
|
|
|
27
24
|
viewContext: SlateViewContext<K>;
|
|
28
25
|
get editor(): K;
|
|
29
26
|
get nativeElement(): HTMLElement;
|
|
30
|
-
|
|
27
|
+
elementRef: ElementRef<any>;
|
|
28
|
+
cdr: ChangeDetectorRef;
|
|
31
29
|
abstract onContextChange(): any;
|
|
32
30
|
static ɵfac: i0.ɵɵFactoryDeclaration<BaseComponent<any, any>, never>;
|
|
33
31
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseComponent<any, any>, never, never, { "context": { "alias": "context"; "required": false; }; "viewContext": { "alias": "viewContext"; "required": false; }; }, {}, never, never, false, never>;
|
package/view/container-item.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import * as i0 from "@angular/core";
|
|
|
10
10
|
* If the dynamically created component uses onpush mode, then it must call markForCheck when setting the context
|
|
11
11
|
*/
|
|
12
12
|
export declare abstract class ViewContainerItem<T = SlateElementContext | SlateTextContext | SlateLeafContext | SlateStringContext, K extends BaseComponent<T> = BaseComponent<T>> {
|
|
13
|
-
protected viewContainerRef: ViewContainerRef;
|
|
14
13
|
initialized: boolean;
|
|
15
14
|
embeddedViewRef: EmbeddedViewRef<BaseEmbeddedView<T>>;
|
|
16
15
|
embeddedViewContext: BaseEmbeddedView<T>;
|
|
@@ -20,7 +19,7 @@ export declare abstract class ViewContainerItem<T = SlateElementContext | SlateT
|
|
|
20
19
|
viewContext: SlateViewContext;
|
|
21
20
|
get rootNodes(): HTMLElement[];
|
|
22
21
|
getRootNodes(): HTMLElement[];
|
|
23
|
-
|
|
22
|
+
protected viewContainerRef: ViewContainerRef;
|
|
24
23
|
destroyView(): void;
|
|
25
24
|
abstract getContext(): T;
|
|
26
25
|
abstract getViewType(): ViewType;
|
package/view/render/utils.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ComponentRef, EmbeddedViewRef, ViewContainerRef } from '@angular/core';
|
|
|
3
3
|
import { ViewType } from '../../types/view';
|
|
4
4
|
import { SlateElementContext, SlateLeafContext, SlateTextContext, SlateViewContext } from '../context';
|
|
5
5
|
import { SlateBlockCard } from '../../components/block-card/block-card.component';
|
|
6
|
-
export declare function createEmbeddedViewOrComponent(viewType: ViewType, context: any, viewContext: SlateViewContext, viewContainerRef: ViewContainerRef):
|
|
6
|
+
export declare function createEmbeddedViewOrComponent(viewType: ViewType, context: any, viewContext: SlateViewContext, viewContainerRef: ViewContainerRef): EmbeddedViewRef<any> | ComponentRef<any>;
|
|
7
7
|
export declare function updateContext(view: EmbeddedViewRef<any> | ComponentRef<any>, newContext: SlateElementContext | SlateTextContext | SlateLeafContext, viewContext: SlateViewContext): void;
|
|
8
8
|
export declare function mount(views: (EmbeddedViewRef<any> | ComponentRef<any>)[], blockCards: (ComponentRef<SlateBlockCard> | null)[] | null, outletParent: HTMLElement, outletElement: HTMLElement | null): void;
|
|
9
9
|
export declare function getRootNodes(ref: EmbeddedViewRef<any> | ComponentRef<any>, blockCard?: ComponentRef<SlateBlockCard>): HTMLElement[];
|