@udecode/slate
Advanced tools
Comparing version 36.0.6 to 37.0.0
import { UnknownObject, Simplify, UnionToIntersection, Modify } from '@udecode/utils'; | ||
import * as slate from 'slate'; | ||
import { Path, Location, Range, Selection, Span, Editor, Point, EditorLevelsOptions, NodeAncestorsOptions, NodeChildrenOptions, NodeDescendantsOptions, NodeElementsOptions, NodeLevelsOptions, NodeTextsOptions, NodeNodesOptions, EditorNextOptions, EditorUnhangRangeOptions, EditorNodesOptions, EditorNodeOptions, EditorParentOptions, EditorPathOptions, EditorPointOptions, EditorAfterOptions, EditorBeforeOptions, EditorPositionsOptions, EditorPreviousOptions, EditorVoidOptions, EditorNormalizeOptions, Transforms } from 'slate'; | ||
import { HistoryEditor } from 'slate-history'; | ||
import { EditorPathRefOptions, EditorPointRefOptions, EditorRangeRefOptions, EditorDirectedDeletionOptions, EditorFragmentDeletionOptions, EditorAboveOptions, EditorStringOptions, EditorLeafOptions } from 'slate/dist/interfaces/editor'; | ||
import * as slate_dist_interfaces_path from 'slate/dist/interfaces/path'; | ||
import { HistoryEditor } from 'slate-history'; | ||
import { SelectionCollapseOptions, SelectionMoveOptions, SelectionSetPointOptions } from 'slate/dist/interfaces/transforms/selection'; | ||
@@ -18,4 +18,2 @@ import { TextDeleteOptions, TextInsertFragmentOptions, TextInsertTextOptions } from 'slate/dist/interfaces/transforms/text'; | ||
} & UnknownObject; | ||
/** Text node of an editor. */ | ||
type EText<V extends Value> = TextOf<TEditor<V>>; | ||
/** A utility type to get all the text node types from a root node type. */ | ||
@@ -25,8 +23,5 @@ type TextOf<N extends TNode> = TEditor extends N ? TText : TElement extends N ? TText : N extends TEditor ? TextOf<N['children'][number]> : N extends TElement ? Extract<N['children'][number], TText> | TextOf<N['children'][number]> : N extends TText ? N : never; | ||
type MarksOf<N extends TNode> = Simplify<UnionToIntersection<TNodeProps<TextOf<N>>>>; | ||
type EMarks<V extends Value> = MarksOf<TEditor<V>>; | ||
type MarkKeysOf<N extends TNode> = {} extends MarksOf<N> ? unknown : keyof MarksOf<N>; | ||
type TNode = TEditor | TElement | TText; | ||
/** Node of an editor. */ | ||
type ENode<V extends Value> = NodeOf<TEditor<V>>; | ||
/** A utility type to get all the node types from a root node type. */ | ||
@@ -48,6 +43,4 @@ type NodeOf<N extends TNode> = ElementOf<N> | N | TextOf<N>; | ||
} & UnknownObject; | ||
/** Element of an editor. */ | ||
type EElement<V extends Value> = ElementOf<TEditor<V>>; | ||
/** Element or text of an editor. Differs from EDescendant<V>. */ | ||
type EElementOrText<V extends Value> = EElement<V> | EText<V>; | ||
/** Element or text of an editor. */ | ||
type ElementOrTextOf<E extends TEditor> = ElementOf<E> | TextOf<E>; | ||
/** | ||
@@ -66,4 +59,2 @@ * `ElementEntry` objects refer to an `Element` and the `Path` where it can be | ||
type TDescendant = TElement | TText; | ||
/** Descendant of an editor. */ | ||
type EDescendant<V extends Value> = DescendantOf<TEditor<V>>; | ||
/** A utility type to get all the descendant node types from a root node type. */ | ||
@@ -167,4 +158,2 @@ type DescendantOf<N extends TNode> = N extends TEditor ? ElementOf<N> | TextOf<N> : N extends TElement ? ElementOf<N['children'][number]> | TextOf<N> : never; | ||
type TAncestor = TEditor | TElement; | ||
/** Ancestor of an editor. */ | ||
type EAncestor<V extends Value> = AncestorOf<TEditor<V>>; | ||
/** A utility type to get all the ancestor node types from a root node type. */ | ||
@@ -180,22 +169,19 @@ type AncestorOf<N extends TNode> = TEditor extends N ? TEditor | TElement : TElement extends N ? TElement : N extends TEditor ? ElementOf<N['children'][number]> | N | N['children'][number] : N extends TElement ? ElementOf<N> | N : never; | ||
/** Node entry from an editor. */ | ||
type ENodeEntry<V extends Value> = TNodeEntry<ENode<V>>; | ||
type NodeEntryOf<E extends TEditor> = TNodeEntry<NodeOf<E>>; | ||
/** Element entry from a node. */ | ||
type TElementEntry<N extends TNode = TNode> = TNodeEntry<ElementOf<N>>; | ||
/** Element entry from an editor. */ | ||
/** Element entry of a value. */ | ||
type EElementEntry<V extends Value> = TNodeEntry<EElement<V>>; | ||
type ElementEntryOf<E extends TEditor> = TNodeEntry<ElementOf<E>>; | ||
/** Text node entry from a node. */ | ||
type TTextEntry<N extends TNode = TNode> = TNodeEntry<TextOf<N>>; | ||
/** Text node entry from an editor. */ | ||
/** Text node entry of a value. */ | ||
type ETextEntry<V extends Value> = TNodeEntry<EText<V>>; | ||
type TextEntryOf<E extends TEditor> = TNodeEntry<TextOf<E>>; | ||
/** Ancestor entry from a node. */ | ||
type TAncestorEntry<N extends TNode = TNode> = TNodeEntry<AncestorOf<N>>; | ||
/** Ancestor entry from an editor. */ | ||
type EAncestorEntry<V extends Value> = TAncestorEntry<TEditor<V>>; | ||
type AncestorEntryOf<E extends TEditor> = TAncestorEntry<E>; | ||
/** Descendant entry from a node. */ | ||
type TDescendantEntry<N extends TNode = TNode> = TNodeEntry<DescendantOf<N>>; | ||
/** Descendant entry from an editor. */ | ||
/** Descendant entry of a value. */ | ||
type EDescendantEntry<V extends Value> = TNodeEntry<EDescendant<V>>; | ||
type DescendantEntryOf<E extends TEditor> = TNodeEntry<DescendantOf<E>>; | ||
/** Child node entry from a node. */ | ||
@@ -207,7 +193,17 @@ type TNodeChildEntry<N extends TNode = TNode> = TNodeEntry<ChildOf<N>>; | ||
type ValueOf<E extends TEditor> = E['children']; | ||
type TEditor<V extends Value = Value> = Modify<Editor, { | ||
type TEditor<V extends Value = Value> = { | ||
hasEditableTarget: (editor: TEditor<V>, target: EventTarget | null) => target is Node; | ||
hasRange: (editor: TEditor<V>, range: Range) => boolean; | ||
hasSelectableTarget: (editor: TEditor<V>, target: EventTarget | null) => boolean; | ||
hasTarget: (editor: TEditor<V>, target: EventTarget | null) => target is Node; | ||
insertData: (data: DataTransfer) => void; | ||
insertFragmentData: (data: DataTransfer) => boolean; | ||
insertTextData: (data: DataTransfer) => boolean; | ||
isTargetInsideNonReadonlyVoid: (editor: TEditor<V>, target: EventTarget | null) => boolean; | ||
setFragmentData: (data: DataTransfer, originEvent?: 'copy' | 'cut' | 'drag') => void; | ||
} & Modify<Editor, { | ||
apply: <N extends TDescendant>(operation: TOperation<N>) => void; | ||
children: V; | ||
getDirtyPaths: <N extends TDescendant>(operation: TOperation<N>) => Path[]; | ||
getFragment: <N extends TDescendant>() => N[]; | ||
getFragment: () => TDescendant[]; | ||
id: any; | ||
@@ -224,19 +220,3 @@ insertFragment: <N extends TDescendant>(fragment: N[]) => void; | ||
operations: TOperation[]; | ||
}> & UnknownObject; | ||
/** | ||
* Get editor with typed methods and operations. Note that it can't be used as a | ||
* parameter of type TEditor. | ||
*/ | ||
declare const getTEditor: <V extends Value, E extends TEditor<V> = TEditor<V>>(editor: E) => Modify<E, { | ||
apply: (operation: TOperation<EElementOrText<V>>) => void; | ||
getFragment: () => EElementOrText<V>[]; | ||
insertFragment: (fragment: EElementOrText<V>[]) => void; | ||
insertNode: (node: EElementOrText<V> | EElementOrText<V>[]) => void; | ||
isInline: (element: EElement<V>) => boolean; | ||
isVoid: (element: EElement<V>) => boolean; | ||
normalizeNode: (entry: TNodeEntry<ENode<V>>, options?: { | ||
operation?: TOperation; | ||
}) => void; | ||
operations: TOperation<EElementOrText<V>>[]; | ||
}>; | ||
}> & Pick<HistoryEditor, 'history' | 'redo' | 'undo' | 'writeHistory'> & UnknownObject; | ||
@@ -251,3 +231,3 @@ declare const createTEditor: <V extends Value>() => TEditor<V>; | ||
*/ | ||
declare const addMark: <V extends Value>(editor: TEditor<V>, key: string, value: any) => void; | ||
declare const addMark: (editor: TEditor, key: string, value: any) => void; | ||
@@ -258,3 +238,3 @@ /** | ||
*/ | ||
declare const createPathRef: <V extends Value>(editor: TEditor<V>, at: Path, options?: EditorPathRefOptions) => slate.PathRef; | ||
declare const createPathRef: (editor: TEditor, at: Path, options?: EditorPathRefOptions) => slate.PathRef; | ||
@@ -265,3 +245,3 @@ /** | ||
*/ | ||
declare const createPointRef: <V extends Value>(editor: TEditor<V>, point: Point, options?: EditorPointRefOptions) => slate.PointRef; | ||
declare const createPointRef: (editor: TEditor, point: Point, options?: EditorPointRefOptions) => slate.PointRef; | ||
@@ -272,14 +252,14 @@ /** | ||
*/ | ||
declare const createRangeRef: <V extends Value>(editor: TEditor<V>, range: Range, options?: EditorRangeRefOptions) => slate.RangeRef; | ||
declare const createRangeRef: (editor: TEditor, range: Range, options?: EditorRangeRefOptions) => slate.RangeRef; | ||
/** Delete content in the editor backward from the current selection. */ | ||
declare const deleteBackward: <V extends Value>(editor: TEditor<V>, options?: EditorDirectedDeletionOptions) => void; | ||
declare const deleteBackward: (editor: TEditor, options?: EditorDirectedDeletionOptions) => void; | ||
/** Delete content in the editor forward from the current selection. */ | ||
declare const deleteForward: <V extends Value>(editor: TEditor<V>, options?: EditorDirectedDeletionOptions) => void; | ||
declare const deleteForward: (editor: TEditor, options?: EditorDirectedDeletionOptions) => void; | ||
/** Delete the content in the current selection. */ | ||
declare const deleteFragment: <V extends Value>(editor: TEditor<V>, options?: EditorFragmentDeletionOptions) => void; | ||
declare const deleteFragment: (editor: TEditor, options?: EditorFragmentDeletionOptions) => void; | ||
declare const deleteMerge: <V extends Value>(editor: TEditor<V>, options?: { | ||
declare const deleteMerge: (editor: TEditor, options?: { | ||
at?: Location; | ||
@@ -311,15 +291,15 @@ distance?: number; | ||
*/ | ||
declare const getQueryOptions: <V extends Value>(editor: TEditor<V>, options?: any) => any; | ||
declare const getQueryOptions: <E extends TEditor>(editor: E, options?: any) => any; | ||
type ENodeMatch<N extends TNode> = Predicate<N>; | ||
interface ENodeMatchOptions<V extends Value = Value> { | ||
interface ENodeMatchOptions<E extends TEditor = TEditor> { | ||
block?: boolean; | ||
match?: ENodeMatch<ENode<V>>; | ||
match?: ENodeMatch<NodeOf<E>>; | ||
} | ||
type GetAboveNodeOptions<V extends Value = Value> = Modify<NonNullable<EditorAboveOptions<TAncestor>>, ENodeMatchOptions<V>>; | ||
type GetAboveNodeOptions<E extends TEditor = TEditor> = Modify<NonNullable<EditorAboveOptions<TAncestor>>, ENodeMatchOptions<E>>; | ||
/** Get the ancestor above a location in the document. */ | ||
declare const getAboveNode: <N extends EAncestor<V>, V extends Value = Value>(editor: TEditor<V>, options?: GetAboveNodeOptions<V>) => TNodeEntry<N> | undefined; | ||
declare const getAboveNode: <N extends AncestorOf<E>, E extends TEditor = TEditor>(editor: E, options?: GetAboveNodeOptions<E>) => TNodeEntry<N> | undefined; | ||
/** Get the start and end points of a location. */ | ||
declare const getEdgePoints: <V extends Value>(editor: TEditor<V>, at: Location) => [slate.BasePoint, slate.BasePoint]; | ||
declare const getEdgePoints: (editor: TEditor, at: Location) => [slate.BasePoint, slate.BasePoint]; | ||
@@ -332,27 +312,27 @@ /** | ||
*/ | ||
declare const getEditorString: <V extends Value>(editor: TEditor<V>, at: Location | null | undefined, options?: EditorStringOptions) => string; | ||
declare const getEditorString: (editor: TEditor, at: Location | null | undefined, options?: EditorStringOptions) => string; | ||
/** Get the end point of a location. */ | ||
declare const getEndPoint: <V extends Value>(editor: TEditor<V>, at: Location) => slate.BasePoint; | ||
declare const getEndPoint: (editor: TEditor, at: Location) => slate.BasePoint; | ||
/** Get the first node at a location. */ | ||
declare const getFirstNode: <V extends Value>(editor: TEditor<V>, at: Location) => ENodeEntry<V>; | ||
declare const getFirstNode: <E extends TEditor>(editor: E, at: Location) => NodeEntryOf<E>; | ||
/** Get the fragment at a location. */ | ||
declare const getFragment: <V extends Value>(editor: TEditor<V>, at: Location) => EElementOrText<V>[]; | ||
declare const getFragment: <E extends TEditor>(editor: E, at: Location) => ElementOrTextOf<E>[]; | ||
/** Get the last node at a location. */ | ||
declare const getLastNode: <V extends Value>(editor: TEditor<V>, at: Location) => ENodeEntry<V>; | ||
declare const getLastNode: <E extends TEditor>(editor: E, at: Location) => NodeEntryOf<E>; | ||
/** Get the leaf text node at a location. */ | ||
declare const getLeafNode: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorLeafOptions) => ETextEntry<V>; | ||
declare const getLeafNode: <E extends TEditor>(editor: E, at: Location, options?: EditorLeafOptions) => TextEntryOf<E>; | ||
type GetLevelsOptions<V extends Value = Value> = Modify<NonNullable<EditorLevelsOptions<TNode>>, { | ||
match?: TNodeMatch<ENode<V>>; | ||
type GetLevelsOptions<E extends TEditor = TEditor> = Modify<NonNullable<EditorLevelsOptions<TNode>>, { | ||
match?: TNodeMatch<NodeOf<E>>; | ||
}>; | ||
/** Iterate through all of the levels at a location. */ | ||
declare const getLevels: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, options?: GetLevelsOptions<V>) => Generator<TNodeEntry<N>, void, undefined>; | ||
declare const getLevels: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, options?: GetLevelsOptions<E>) => Generator<TNodeEntry<N>, void, undefined>; | ||
/** Get the marks that would be added to text at the current selection. */ | ||
declare const getMarks: <V extends Value>(editor: TEditor<V>) => EMarks<V> | null; | ||
declare const getMarks: <E extends TEditor>(editor: E) => MarksOf<E> | null; | ||
@@ -471,7 +451,7 @@ /** Get an entry for the common ancesetor node of two paths. */ | ||
type GetNextNodeOptions<V extends Value = Value> = Modify<NonNullable<EditorNextOptions<TDescendant>>, { | ||
match?: TNodeMatch<ENode<V>>; | ||
type GetNextNodeOptions<E extends TEditor = TEditor> = Modify<NonNullable<EditorNextOptions<TDescendant>>, { | ||
match?: TNodeMatch<NodeOf<E>>; | ||
}>; | ||
/** Get the matching node in the branch of the document after a location. */ | ||
declare const getNextNode: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, options?: GetNextNodeOptions<V>) => TNodeEntry<N> | undefined; | ||
declare const getNextNode: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, options?: GetNextNodeOptions<E>) => TNodeEntry<N> | undefined; | ||
@@ -487,31 +467,31 @@ type UnhangRangeOptions = { | ||
*/ | ||
declare const unhangRange: <V extends Value, R extends Path | slate.BasePoint | slate.BaseRange | Span | null | undefined>(editor: TEditor<V>, range: R, options?: UnhangRangeOptions) => R; | ||
declare const unhangRange: <E extends TEditor, R extends Path | slate.BasePoint | slate.BaseRange | Span | null | undefined>(editor: E, range: R, options?: UnhangRangeOptions) => R; | ||
type GetNodeEntriesOptions<V extends Value = Value> = Modify<NonNullable<EditorNodesOptions<TNode>>, ENodeMatchOptions<V>> & UnhangRangeOptions; | ||
type GetNodeEntriesOptions<E extends TEditor = TEditor> = Modify<NonNullable<EditorNodesOptions<TNode>>, ENodeMatchOptions<E>> & UnhangRangeOptions; | ||
/** Iterate through all of the nodes in the Editor. */ | ||
declare const getNodeEntries: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, options?: GetNodeEntriesOptions<V>) => Generator<TNodeEntry<N>, void, undefined>; | ||
declare const getNodeEntries: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, options?: GetNodeEntriesOptions<E>) => Generator<TNodeEntry<N>, void, undefined>; | ||
/** Get the node at a location. */ | ||
declare const getNodeEntry: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, at: Location, options?: EditorNodeOptions) => TNodeEntry<N> | undefined; | ||
declare const getNodeEntry: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, at: Location, options?: EditorNodeOptions) => TNodeEntry<N> | undefined; | ||
/** Get the parent node of a location. Returns undefined if there is no parent. */ | ||
declare const getParentNode: <N extends EAncestor<V>, V extends Value = Value>(editor: TEditor<V>, at: Location, options?: EditorParentOptions) => TNodeEntry<N> | undefined; | ||
declare const getParentNode: <N extends AncestorOf<E>, E extends TEditor = TEditor>(editor: E, at: Location, options?: EditorParentOptions) => TNodeEntry<N> | undefined; | ||
/** Get the path of a location. */ | ||
declare const getPath: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorPathOptions) => slate.Path; | ||
declare const getPath: (editor: TEditor, at: Location, options?: EditorPathOptions) => slate.Path; | ||
/** Get the set of currently tracked path refs of the editor. */ | ||
declare const getPathRefs: <V extends Value>(editor: TEditor<V>) => Set<slate.PathRef>; | ||
declare const getPathRefs: (editor: TEditor) => Set<slate.PathRef>; | ||
/** Get the start or end point of a location. */ | ||
declare const getPoint: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorPointOptions) => slate.BasePoint; | ||
declare const getPoint: (editor: TEditor, at: Location, options?: EditorPointOptions) => slate.BasePoint; | ||
/** Get the point after a location. */ | ||
declare const getPointAfter: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorAfterOptions) => slate.BasePoint | undefined; | ||
declare const getPointAfter: (editor: TEditor, at: Location, options?: EditorAfterOptions) => slate.BasePoint | undefined; | ||
/** Get the point before a location. */ | ||
declare const getPointBefore: <V extends Value>(editor: TEditor<V>, at: Location, options?: EditorBeforeOptions) => slate.BasePoint | undefined; | ||
declare const getPointBefore: (editor: TEditor, at: Location, options?: EditorBeforeOptions) => slate.BasePoint | undefined; | ||
/** Get the set of currently tracked point refs of the editor. */ | ||
declare const getPointRefs: <V extends Value>(editor: TEditor<V>) => Set<slate.PointRef>; | ||
declare const getPointRefs: (editor: TEditor) => Set<slate.PointRef>; | ||
@@ -530,30 +510,30 @@ /** | ||
*/ | ||
declare const getPositions: <V extends Value>(editor: TEditor<V>, options?: EditorPositionsOptions) => Generator<slate.BasePoint, void, undefined>; | ||
declare const getPositions: (editor: TEditor, options?: EditorPositionsOptions) => Generator<slate.BasePoint, void, undefined>; | ||
type GetPreviousNodeOptions<V extends Value = Value> = Modify<NonNullable<EditorPreviousOptions<TNode>>, { | ||
match?: TNodeMatch<ENode<V>>; | ||
type GetPreviousNodeOptions<E extends TEditor = TEditor> = Modify<NonNullable<EditorPreviousOptions<TNode>>, { | ||
match?: TNodeMatch<NodeOf<E>>; | ||
}>; | ||
/** Get the matching node in the branch of the document before a location. */ | ||
declare const getPreviousNode: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, options?: GetPreviousNodeOptions<V>) => TNodeEntry<N> | undefined; | ||
declare const getPreviousNode: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, options?: GetPreviousNodeOptions<E>) => TNodeEntry<N> | undefined; | ||
/** Get a range of a location. */ | ||
declare const getRange: <V extends Value>(editor: TEditor<V>, at: Location, to?: Location) => slate.BaseRange; | ||
declare const getRange: (editor: TEditor, at: Location, to?: Location) => slate.BaseRange; | ||
/** Get the set of currently tracked range refs of the editor. */ | ||
declare const getRangeRefs: <V extends Value>(editor: TEditor<V>) => Set<slate.RangeRef>; | ||
declare const getRangeRefs: (editor: TEditor) => Set<slate.RangeRef>; | ||
/** Get the start point of a location. */ | ||
declare const getStartPoint: <V extends Value>(editor: TEditor<V>, at: Location) => slate.BasePoint; | ||
declare const getStartPoint: (editor: TEditor, at: Location) => slate.BasePoint; | ||
/** Match a void node in the current branch of the editor. */ | ||
declare const getVoidNode: <N extends EElement<V>, V extends Value = Value>(editor: TEditor<V>, options?: EditorVoidOptions) => TNodeEntry<N> | undefined; | ||
declare const getVoidNode: <N extends ElementOf<E>, E extends TEditor = TEditor>(editor: E, options?: EditorVoidOptions) => TNodeEntry<N> | undefined; | ||
/** Check if a node has block children. */ | ||
declare const hasBlocks: <V extends Value>(editor: TEditor<V>, element: TElement) => boolean; | ||
declare const hasBlocks: (editor: TEditor, element: TElement) => boolean; | ||
/** Check if a node has inline and text children. */ | ||
declare const hasInlines: <V extends Value>(editor: TEditor<V>, element: TElement) => boolean; | ||
declare const hasInlines: (editor: TEditor, element: TElement) => boolean; | ||
/** Check if a node has text children. */ | ||
declare const hasTexts: <V extends Value>(editor: TEditor<V>, element: TElement) => boolean; | ||
declare const hasTexts: (editor: TEditor, element: TElement) => boolean; | ||
@@ -565,3 +545,3 @@ /** | ||
*/ | ||
declare const insertBreak: <V extends Value>(editor: TEditor<V>) => void; | ||
declare const insertBreak: (editor: TEditor) => void; | ||
@@ -573,9 +553,9 @@ /** | ||
*/ | ||
declare const insertNode: <V extends Value>(editor: TEditor<V>, node: EElementOrText<V> | EElementOrText<V>[]) => void; | ||
declare const insertNode: <E extends TEditor>(editor: E, node: ElementOrTextOf<E> | ElementOrTextOf<E>[]) => void; | ||
/** Check if a value is a block `Element` object. */ | ||
declare const isBlock: <V extends Value>(editor: TEditor<V>, value: any) => boolean; | ||
declare const isBlock: (editor: TEditor, value: any) => boolean; | ||
/** Check if a point is an edge of a location. */ | ||
declare const isEdgePoint: <V extends Value>(editor: TEditor<V>, point: Point, at: Location) => boolean; | ||
declare const isEdgePoint: (editor: TEditor, point: Point, at: Location) => boolean; | ||
@@ -586,6 +566,6 @@ /** Check if a value is an `Editor` object. */ | ||
/** Check if the editor is currently normalizing after each operation. */ | ||
declare const isEditorNormalizing: <V extends Value>(editor: TEditor<V>) => boolean; | ||
declare const isEditorNormalizing: (editor: TEditor) => boolean; | ||
/** Check if an element is empty, accounting for void nodes. */ | ||
declare const isElementEmpty: <V extends Value>(editor: TEditor<V>, element: EElement<V>) => boolean; | ||
declare const isElementEmpty: (editor: TEditor, element: TElement) => boolean; | ||
@@ -596,9 +576,9 @@ /** | ||
*/ | ||
declare const isEndPoint: <V extends Value>(editor: TEditor<V>, point: Point | null | undefined, at: Location) => boolean; | ||
declare const isEndPoint: (editor: TEditor, point: Point | null | undefined, at: Location) => boolean; | ||
/** Check if a value is an inline `Element` object. */ | ||
declare const isInline: <V extends Value>(editor: TEditor<V>, value: any) => boolean; | ||
declare const isInline: (editor: TEditor, value: any) => boolean; | ||
/** Check if a value is a markable void `Element` object. */ | ||
declare const isMarkableVoid: <V extends Value>(editor: TEditor<V>, value: any) => boolean; | ||
declare const isMarkableVoid: (editor: TEditor, value: any) => boolean; | ||
@@ -609,9 +589,9 @@ /** | ||
*/ | ||
declare const isStartPoint: <V extends Value>(editor: TEditor<V>, point: Point | null | undefined, at: Location) => boolean; | ||
declare const isStartPoint: (editor: TEditor, point: Point | null | undefined, at: Location) => boolean; | ||
/** Check if a value is a void `Element` object. */ | ||
declare const isVoid: <V extends Value>(editor: TEditor<V>, value: any) => boolean; | ||
declare const isVoid: (editor: TEditor, value: any) => boolean; | ||
/** Normalize any dirty objects in the editor. */ | ||
declare const normalizeEditor: <V extends Value>(editor: TEditor<V>, options?: EditorNormalizeOptions) => void; | ||
declare const normalizeEditor: (editor: TEditor, options?: EditorNormalizeOptions) => void; | ||
@@ -625,3 +605,3 @@ /** | ||
*/ | ||
declare const removeEditorMark: <V extends Value>(editor: TEditor<V>, key: string) => void; | ||
declare const removeEditorMark: (editor: TEditor, key: string) => void; | ||
@@ -633,3 +613,3 @@ /** | ||
*/ | ||
declare const withoutNormalizing: <V extends Value>(editor: TEditor<V>, fn: () => boolean | void) => boolean; | ||
declare const withoutNormalizing: (editor: TEditor, fn: () => boolean | void) => boolean; | ||
@@ -650,18 +630,16 @@ /** | ||
type THistoryEditor<V extends Value = Value> = Pick<HistoryEditor, 'history' | 'redo' | 'undo' | 'writeHistory'> & TEditor<V>; | ||
/** {@link HistoryEditor.isHistoryEditor} */ | ||
declare const isHistoryEditor: (value: any) => value is THistoryEditor; | ||
declare const isHistoryEditor: (value: any) => value is TEditor; | ||
/** {@link HistoryEditor.isMerging} */ | ||
declare const isHistoryMerging: <V extends Value>(editor: THistoryEditor<V>) => boolean | undefined; | ||
declare const isHistoryMerging: (editor: TEditor) => boolean | undefined; | ||
/** {@link HistoryEditor.isSaving} */ | ||
declare const isHistorySaving: <V extends Value>(editor: THistoryEditor<V>) => boolean | undefined; | ||
declare const isHistorySaving: (editor: TEditor) => boolean | undefined; | ||
/** {@link HistoryEditor.withoutMerging} */ | ||
declare const withoutMergingHistory: <V extends Value>(editor: THistoryEditor<V>, fn: () => void) => void; | ||
declare const withoutMergingHistory: (editor: TEditor, fn: () => void) => void; | ||
/** {@link HistoryEditor.withoutSaving} */ | ||
declare const withoutSavingHistory: <V extends Value>(editor: THistoryEditor<V>, fn: () => void) => void; | ||
declare const withoutSavingHistory: (editor: TEditor, fn: () => void) => void; | ||
@@ -692,15 +670,15 @@ /** See {@link Range.isCollapsed}. Return false if `range` is not defined. */ | ||
/** Collapse the selection. */ | ||
declare const collapseSelection: <V extends Value>(editor: TEditor<V>, options?: SelectionCollapseOptions) => void; | ||
declare const collapseSelection: (editor: TEditor, options?: SelectionCollapseOptions) => void; | ||
/** Delete content in the editor. */ | ||
declare const deleteText: <V extends Value>(editor: TEditor<V>, options?: TextDeleteOptions) => void; | ||
declare const deleteText: (editor: TEditor, options?: TextDeleteOptions) => void; | ||
/** Unset the selection. */ | ||
declare const deselect: <V extends Value>(editor: TEditor<V>) => void; | ||
declare const deselect: (editor: TEditor) => void; | ||
/** Insert a fragment at a specific location in the editor. */ | ||
declare const insertFragment: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, fragment: N[], options?: TextInsertFragmentOptions) => void; | ||
declare const insertFragment: <N extends ElementOrTextOf<E>, E extends TEditor = TEditor>(editor: E, fragment: N[], options?: TextInsertFragmentOptions) => void; | ||
interface NodeMatchOption<V extends Value> { | ||
match?: TNodeMatch<ENode<V>>; | ||
interface NodeMatchOption<E extends TEditor> { | ||
match?: TNodeMatch<NodeOf<E>>; | ||
} | ||
@@ -723,3 +701,3 @@ | ||
/** Query the editor state. */ | ||
interface QueryEditorOptions<V extends Value = Value, E extends TEditor<V> = TEditor<V>> extends Pick<QueryNodeOptions, 'allow' | 'exclude'> { | ||
interface QueryEditorOptions<E extends TEditor = TEditor> extends Pick<QueryNodeOptions, 'allow' | 'exclude'> { | ||
/** Location from where to lookup the node types (bottom-up) */ | ||
@@ -735,3 +713,3 @@ at?: Location; | ||
type InsertNodesOptions<V extends Value = Value> = { | ||
type InsertNodesOptions<E extends TEditor = TEditor> = { | ||
/** | ||
@@ -748,10 +726,10 @@ * Insert the nodes after the currect block. Does not apply if the removeEmpty | ||
removeEmpty?: QueryNodeOptions | boolean; | ||
} & Modify<NonNullable<Parameters<typeof Transforms.insertNodes>[2]>, NodeMatchOption<V>>; | ||
} & Modify<NonNullable<Parameters<typeof Transforms.insertNodes>[2]>, NodeMatchOption<E>>; | ||
/** Insert nodes at a specific location in the Editor. */ | ||
declare const insertNodes: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, nodes: N | N[], { nextBlock, removeEmpty, ...options }?: InsertNodesOptions<V>) => void; | ||
declare const insertNodes: <N extends ElementOrTextOf<E>, E extends TEditor = TEditor>(editor: E, nodes: N | N[], { nextBlock, removeEmpty, ...options }?: InsertNodesOptions<E>) => void; | ||
/** Insert a string of text in the Editor. */ | ||
declare const insertText: <V extends Value>(editor: TEditor<V>, text: string, options?: TextInsertTextOptions) => void; | ||
declare const insertText: (editor: TEditor, text: string, options?: TextInsertTextOptions) => void; | ||
type LiftNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.liftNodes>[1]>, NodeMatchOption<V>>; | ||
type LiftNodesOptions<E extends TEditor = TEditor> = Modify<NonNullable<Parameters<typeof Transforms.liftNodes>[1]>, NodeMatchOption<E>>; | ||
/** | ||
@@ -761,5 +739,5 @@ * Lift nodes at a specific location upwards in the document tree, splitting | ||
*/ | ||
declare const liftNodes: <V extends Value>(editor: TEditor<V>, options?: LiftNodesOptions<V>) => void; | ||
declare const liftNodes: <E extends TEditor>(editor: E, options?: LiftNodesOptions<E>) => void; | ||
type MergeNodesOptions<V extends Value = Value> = { | ||
type MergeNodesOptions<E extends TEditor = TEditor> = { | ||
/** | ||
@@ -769,3 +747,3 @@ * Default: if the node isn't already the next sibling of the previous node, | ||
*/ | ||
mergeNode?: (editor: TEditor<V>, options: { | ||
mergeNode?: (editor: E, options: { | ||
at: Path; | ||
@@ -778,6 +756,6 @@ to: Path; | ||
*/ | ||
removeEmptyAncestor?: (editor: TEditor<V>, options: { | ||
removeEmptyAncestor?: (editor: E, options: { | ||
at: Path; | ||
}) => void; | ||
} & Modify<NonNullable<Parameters<typeof Transforms.mergeNodes>[1]>, NodeMatchOption<V>>; | ||
} & Modify<NonNullable<Parameters<typeof Transforms.mergeNodes>[1]>, NodeMatchOption<E>>; | ||
/** | ||
@@ -787,37 +765,37 @@ * Merge a node at a location with the previous node of the same depth, removing | ||
*/ | ||
declare const mergeNodes: <V extends Value>(editor: TEditor<V>, options?: MergeNodesOptions<V>) => void; | ||
declare const mergeNodes: <E extends TEditor>(editor: E, options?: MergeNodesOptions<E>) => void; | ||
type MoveNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.moveNodes>[1]>, NodeMatchOption<V>>; | ||
type MoveNodesOptions<E extends TEditor = TEditor> = Modify<NonNullable<Parameters<typeof Transforms.moveNodes>[1]>, NodeMatchOption<E>>; | ||
/** Move the nodes at a location to a new location. */ | ||
declare const moveNodes: <V extends Value>(editor: TEditor<V>, options?: MoveNodesOptions<V>) => void; | ||
declare const moveNodes: <E extends TEditor>(editor: E, options?: MoveNodesOptions<E>) => void; | ||
/** Move the selection's point forward or backward. */ | ||
declare const moveSelection: <V extends Value>(editor: TEditor<V>, options?: SelectionMoveOptions) => void; | ||
declare const moveSelection: (editor: TEditor, options?: SelectionMoveOptions) => void; | ||
type RemoveNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.removeNodes>[1]>, NodeMatchOption<V>>; | ||
type RemoveNodesOptions<E extends TEditor = TEditor> = Modify<NonNullable<Parameters<typeof Transforms.removeNodes>[1]>, NodeMatchOption<E>>; | ||
/** Remove the nodes at a specific location in the document. */ | ||
declare const removeNodes: <V extends Value>(editor: TEditor<V>, options?: RemoveNodesOptions<V>) => void; | ||
declare const removeNodes: <E extends TEditor>(editor: E, options?: RemoveNodesOptions<E>) => void; | ||
/** Set the selection to a new value. */ | ||
declare const select: <V extends Value>(editor: TEditor<V>, target: Location) => void; | ||
declare const select: (editor: TEditor, target: Location) => void; | ||
type SetNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.setNodes>[2]>, NodeMatchOption<V>>; | ||
type SetNodesOptions<E extends TEditor = TEditor> = Modify<NonNullable<Parameters<typeof Transforms.setNodes>[2]>, NodeMatchOption<E>>; | ||
/** Set new properties on the nodes at a location. */ | ||
declare const setNodes: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, props: Partial<TNodeProps<N>>, options?: SetNodesOptions<V>) => void; | ||
declare const setNodes: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, props: Partial<TNodeProps<N>>, options?: SetNodesOptions<E>) => void; | ||
/** Set new properties on one of the selection's points. */ | ||
declare const setPoint: <V extends Value>(editor: TEditor<V>, props: Partial<Point>, options?: SelectionSetPointOptions) => void; | ||
declare const setPoint: (editor: TEditor, props: Partial<Point>, options?: SelectionSetPointOptions) => void; | ||
/** Set new properties on the selection. */ | ||
declare const setSelection: <V extends Value>(editor: TEditor<V>, props: Partial<Range>) => void; | ||
declare const setSelection: (editor: TEditor, props: Partial<Range>) => void; | ||
type SplitNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.splitNodes>[1]>, NodeMatchOption<V>>; | ||
type SplitNodesOptions<E extends TEditor = TEditor> = Modify<NonNullable<Parameters<typeof Transforms.splitNodes>[1]>, NodeMatchOption<E>>; | ||
/** Split the nodes at a specific location. */ | ||
declare const splitNodes: <V extends Value>(editor: TEditor<V>, options?: SplitNodesOptions<V>) => void; | ||
declare const splitNodes: <E extends TEditor>(editor: E, options?: SplitNodesOptions<E>) => void; | ||
type UnsetNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.unsetNodes>[2]>, NodeMatchOption<V>>; | ||
type UnsetNodesOptions<E extends TEditor = TEditor> = Modify<NonNullable<Parameters<typeof Transforms.unsetNodes>[2]>, NodeMatchOption<E>>; | ||
/** Unset properties on the nodes at a location. */ | ||
declare const unsetNodes: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, props: (keyof TNodeProps<N>)[] | keyof TNodeProps<N>, options?: UnsetNodesOptions<V>) => void; | ||
declare const unsetNodes: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, props: (keyof TNodeProps<N>)[] | keyof TNodeProps<N>, options?: UnsetNodesOptions<E>) => void; | ||
type UnwrapNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.unwrapNodes>[1]>, ENodeMatchOptions<V>>; | ||
type UnwrapNodesOptions<E extends TEditor = TEditor> = Modify<NonNullable<Parameters<typeof Transforms.unwrapNodes>[1]>, ENodeMatchOptions<E>>; | ||
/** | ||
@@ -827,5 +805,5 @@ * Unwrap the nodes at a location from a parent node, splitting the parent if | ||
*/ | ||
declare const unwrapNodes: <V extends Value>(editor: TEditor<V>, options?: UnwrapNodesOptions<V>) => void; | ||
declare const unwrapNodes: <E extends TEditor>(editor: E, options?: UnwrapNodesOptions<E>) => void; | ||
type WrapNodesOptions<V extends Value = Value> = Modify<NonNullable<Parameters<typeof Transforms.wrapNodes>[2]>, NodeMatchOption<V>>; | ||
type WrapNodesOptions<E extends TEditor = TEditor> = Modify<NonNullable<Parameters<typeof Transforms.wrapNodes>[2]>, NodeMatchOption<E>>; | ||
/** | ||
@@ -835,7 +813,7 @@ * Wrap the nodes at a location in a new container node, splitting the edges of | ||
*/ | ||
declare const wrapNodes: <N extends EElement<V>, V extends Value = Value>(editor: TEditor<V>, element: N, options?: WrapNodesOptions<V>) => void; | ||
declare const wrapNodes: <N extends ElementOf<E>, E extends TEditor = TEditor>(editor: E, element: N, options?: WrapNodesOptions<E>) => void; | ||
type FindNodeOptions<V extends Value = Value> = GetNodeEntriesOptions<V>; | ||
type FindNodeOptions<E extends TEditor = TEditor> = GetNodeEntriesOptions<E>; | ||
/** Find node matching the condition. */ | ||
declare const findNode: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, options?: FindNodeOptions<V>) => TNodeEntry<N> | undefined; | ||
declare const findNode: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, options?: FindNodeOptions<E>) => TNodeEntry<N> | undefined; | ||
@@ -846,13 +824,13 @@ /** | ||
*/ | ||
declare const someNode: <N extends ENode<V>, V extends Value = Value>(editor: TEditor<V>, options: FindNodeOptions<V>) => boolean; | ||
declare const someNode: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, options: FindNodeOptions<E>) => boolean; | ||
/** Add marks to each node of a range. */ | ||
declare const addRangeMarks: <V extends Value>(editor: TEditor<V>, props: any, { at, }?: { | ||
declare const addRangeMarks: (editor: TEditor, props: any, { at, }?: { | ||
at?: Location | null | undefined; | ||
}) => void; | ||
declare const setElements: <V extends Value>(editor: TEditor<V>, props: Partial<TNodeProps<TElement>>, options?: SetNodesOptions) => void; | ||
declare const setElements: (editor: TEditor, props: Partial<TNodeProps<TElement>>, options?: SetNodesOptions) => void; | ||
/** Unhang the range of length 1 so both edges are in the same text node. */ | ||
declare const unhangCharacterRange: <V extends Value>(editor: TEditor<V>, at: Range) => { | ||
declare const unhangCharacterRange: (editor: TEditor, at: Range) => { | ||
anchor: slate.BasePoint; | ||
@@ -865,2 +843,2 @@ focus: slate.BasePoint; | ||
export { type AncestorOf, type ChildOf, type DescendantOf, type EAncestor, type EAncestorEntry, type EDescendant, type EDescendantEntry, type EElement, type EElementEntry, type EElementOrText, type EMarks, type ENode, type ENodeEntry, type ENodeMatch, type ENodeMatchOptions, type EText, type ETextEntry, type ElementOf, type FindNodeOptions, type GetAboveNodeOptions, type GetLevelsOptions, type GetNextNodeOptions, type GetNodeEntriesOptions, type GetPreviousNodeOptions, type InsertNodesOptions, type LiftNodesOptions, type MarkKeysOf, type MarksOf, type MergeNodesOptions, type MoveNodesOptions, type NodeMatchOption, type NodeOf, type Predicate, type PredicateFn, type PredicateObj, type QueryEditorOptions, type QueryNodeOptions, type RemoveNodesOptions, type SetNodesOptions, type SplitNodesOptions, type TAncestor, type TAncestorEntry, type TDescendant, type TDescendantEntry, type TEditor, type TElement, type TElementEntry, type THistoryEditor, type TInsertNodeOperation, type TInsertTextOperation, type TLocation, type TMergeNodeOperation, type TMoveNodeOperation, type TNode, type TNodeChildEntry, type TNodeEntry, type TNodeMatch, type TNodeOperation, type TNodeProps, type TOperation, type TPath, type TRange, type TRemoveNodeOperation, type TRemoveTextOperation, type TSelection, type TSelectionOperation, type TSetNodeOperation, type TSetSelectionOperation, type TSpan, type TSplitNodeOperation, type TText, type TTextEntry, type TTextOperation, type TextOf, type UnhangRangeOptions, type UnsetNodesOptions, type UnwrapNodesOptions, type Value, type ValueOf, type WrapNodesOptions, addMark, addRangeMarks, collapseSelection, createPathRef, createPointRef, createRangeRef, createTEditor, deleteBackward, deleteForward, deleteFragment, deleteMerge, deleteText, deselect, elementMatches, findNode, getAboveNode, getCommonNode, getEdgePoints, getEditorString, getEndPoint, getFirstNode, getFragment, getLastNode, getLeafNode, getLevels, getMarks, getNextNode, getNode, getNodeAncestor, getNodeAncestors, getNodeChild, getNodeChildren, getNodeDescendant, getNodeDescendants, getNodeElements, getNodeEntries, getNodeEntry, getNodeFirstNode, getNodeFragment, getNodeLastNode, getNodeLeaf, getNodeLevels, getNodeParent, getNodeProps, getNodeString, getNodeTexts, getNodes, getParentNode, getPath, getPathRefs, getPoint, getPointAfter, getPointBefore, getPointRefs, getPositions, getPreviousNode, getQueryOptions, getRange, getRangeRefs, getStartPoint, getTEditor, getVoidNode, hasBlocks, hasInlines, hasNode, hasSingleChild, hasTexts, insertBreak, insertFragment, insertNode, insertNodes, insertText, isAncestor, isBlock, isCollapsed, isDescendant, isEdgePoint, isEditor, isEditorNormalizing, isElement, isElementEmpty, isElementList, isEndPoint, isExpanded, isHistoryEditor, isHistoryMerging, isHistorySaving, isInline, isMarkableVoid, isNode, isNodeList, isStartPoint, isText, isTextList, isVoid, liftNodes, match, mergeNodes, moveNodes, moveSelection, nodeMatches, normalizeEditor, queryNode, removeEditorMark, removeNodes, select, setElements, setNodes, setPoint, setSelection, someNode, splitNodes, textEquals, textMatches, unhangCharacterRange, unhangRange, unsetNodes, unwrapNodes, withoutMergingHistory, withoutNormalizing, withoutSavingHistory, wrapNodes }; | ||
export { type AncestorEntryOf, type AncestorOf, type ChildOf, type DescendantEntryOf, type DescendantOf, type ENodeMatch, type ENodeMatchOptions, type ElementEntryOf, type ElementOf, type ElementOrTextOf, type FindNodeOptions, type GetAboveNodeOptions, type GetLevelsOptions, type GetNextNodeOptions, type GetNodeEntriesOptions, type GetPreviousNodeOptions, type InsertNodesOptions, type LiftNodesOptions, type MarkKeysOf, type MarksOf, type MergeNodesOptions, type MoveNodesOptions, type NodeEntryOf, type NodeMatchOption, type NodeOf, type Predicate, type PredicateFn, type PredicateObj, type QueryEditorOptions, type QueryNodeOptions, type RemoveNodesOptions, type SetNodesOptions, type SplitNodesOptions, type TAncestor, type TAncestorEntry, type TDescendant, type TDescendantEntry, type TEditor, type TElement, type TElementEntry, type TInsertNodeOperation, type TInsertTextOperation, type TLocation, type TMergeNodeOperation, type TMoveNodeOperation, type TNode, type TNodeChildEntry, type TNodeEntry, type TNodeMatch, type TNodeOperation, type TNodeProps, type TOperation, type TPath, type TRange, type TRemoveNodeOperation, type TRemoveTextOperation, type TSelection, type TSelectionOperation, type TSetNodeOperation, type TSetSelectionOperation, type TSpan, type TSplitNodeOperation, type TText, type TTextEntry, type TTextOperation, type TextEntryOf, type TextOf, type UnhangRangeOptions, type UnsetNodesOptions, type UnwrapNodesOptions, type Value, type ValueOf, type WrapNodesOptions, addMark, addRangeMarks, collapseSelection, createPathRef, createPointRef, createRangeRef, createTEditor, deleteBackward, deleteForward, deleteFragment, deleteMerge, deleteText, deselect, elementMatches, findNode, getAboveNode, getCommonNode, getEdgePoints, getEditorString, getEndPoint, getFirstNode, getFragment, getLastNode, getLeafNode, getLevels, getMarks, getNextNode, getNode, getNodeAncestor, getNodeAncestors, getNodeChild, getNodeChildren, getNodeDescendant, getNodeDescendants, getNodeElements, getNodeEntries, getNodeEntry, getNodeFirstNode, getNodeFragment, getNodeLastNode, getNodeLeaf, getNodeLevels, getNodeParent, getNodeProps, getNodeString, getNodeTexts, getNodes, getParentNode, getPath, getPathRefs, getPoint, getPointAfter, getPointBefore, getPointRefs, getPositions, getPreviousNode, getQueryOptions, getRange, getRangeRefs, getStartPoint, getVoidNode, hasBlocks, hasInlines, hasNode, hasSingleChild, hasTexts, insertBreak, insertFragment, insertNode, insertNodes, insertText, isAncestor, isBlock, isCollapsed, isDescendant, isEdgePoint, isEditor, isEditorNormalizing, isElement, isElementEmpty, isElementList, isEndPoint, isExpanded, isHistoryEditor, isHistoryMerging, isHistorySaving, isInline, isMarkableVoid, isNode, isNodeList, isStartPoint, isText, isTextList, isVoid, liftNodes, match, mergeNodes, moveNodes, moveSelection, nodeMatches, normalizeEditor, queryNode, removeEditorMark, removeNodes, select, setElements, setNodes, setPoint, setSelection, someNode, splitNodes, textEquals, textMatches, unhangCharacterRange, unhangRange, unsetNodes, unwrapNodes, withoutMergingHistory, withoutNormalizing, withoutSavingHistory, wrapNodes }; |
@@ -112,3 +112,2 @@ "use strict"; | ||
getStartPoint: () => getStartPoint, | ||
getTEditor: () => getTEditor, | ||
getVoidNode: () => getVoidNode, | ||
@@ -180,7 +179,29 @@ hasBlocks: () => hasBlocks, | ||
var import_slate = require("slate"); | ||
var createTEditor = () => (0, import_slate.createEditor)(); | ||
var noop = (name, returnValue) => () => { | ||
console.warn( | ||
`[OVERRIDE_MISSING] The method editor.${name}() has not been implemented or overridden. This may cause unexpected behavior. Please ensure that all required editor methods are properly defined.` | ||
); | ||
return returnValue; | ||
}; | ||
var createTEditor = () => { | ||
const editor = (0, import_slate.createEditor)(); | ||
editor.hasEditableTarget = noop("hasEditableTarget", false); | ||
editor.hasRange = noop("hasRange", false); | ||
editor.hasSelectableTarget = noop("hasSelectableTarget", false); | ||
editor.hasTarget = noop("hasTarget", false); | ||
editor.insertData = noop("insertData"); | ||
editor.insertFragmentData = noop("insertFragmentData"); | ||
editor.insertTextData = noop("insertTextData", false); | ||
editor.isTargetInsideNonReadonlyVoid = noop( | ||
"isTargetInsideNonReadonlyVoid", | ||
false | ||
); | ||
editor.setFragmentData = noop("setFragmentData"); | ||
editor.history = { redos: [], undos: [] }; | ||
editor.undo = noop("undo"); | ||
editor.redo = noop("redo"); | ||
editor.writeHistory = noop("writeHistory"); | ||
return editor; | ||
}; | ||
// src/interfaces/editor/TEditor.ts | ||
var getTEditor = (editor) => editor; | ||
// src/interfaces/editor/addMark.ts | ||
@@ -1187,3 +1208,2 @@ var import_slate2 = require("slate"); | ||
getStartPoint, | ||
getTEditor, | ||
getVoidNode, | ||
@@ -1190,0 +1210,0 @@ hasBlocks, |
{ | ||
"name": "@udecode/slate", | ||
"version": "36.0.6", | ||
"version": "37.0.0", | ||
"description": "Slate extension", | ||
"license": "MIT", | ||
"keywords": [ | ||
"slate" | ||
], | ||
"homepage": "https://platejs.org", | ||
"bugs": { | ||
"url": "https://github.com/udecode/plate/issues" | ||
}, | ||
"repository": { | ||
@@ -12,12 +17,4 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/udecode/plate/issues" | ||
}, | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"exports": { | ||
@@ -31,6 +28,12 @@ ".": { | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"scripts": { | ||
"brl": "yarn p:brl", | ||
"build": "yarn p:build", | ||
"build:watch": "yarn p:build:watch", | ||
"brl": "yarn p:brl", | ||
"clean": "yarn p:clean", | ||
@@ -44,11 +47,8 @@ "lint": "yarn p:lint", | ||
"dependencies": { | ||
"@udecode/utils": "31.0.0" | ||
"@udecode/utils": "37.0.0" | ||
}, | ||
"peerDependencies": { | ||
"slate": ">=0.94.0", | ||
"slate": ">=0.103.0", | ||
"slate-history": ">=0.93.0" | ||
}, | ||
"keywords": [ | ||
"slate" | ||
], | ||
"publishConfig": { | ||
@@ -55,0 +55,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2838
356050
+ Added@udecode/utils@37.0.0(transitive)
- Removed@udecode/utils@31.0.0(transitive)
Updated@udecode/utils@37.0.0