usfm-editor
Version:
A WYSIWYG editor component for USFM
167 lines (166 loc) • 9.21 kB
TypeScript
import { Editor, Path, Node } from "slate";
import { IdentificationHeaders } from "../../UsfmEditor";
export declare const MyTransforms: {
mergeSelectedBlockAndSetToInlineContainer: typeof mergeSelectedBlockAndSetToInlineContainer;
replaceNodes: typeof replaceNodes;
replaceText: typeof replaceText;
setIdentification: typeof setIdentification;
selectDOMNodeStart: (editor: import("slate-react").ReactEditor, domNode: globalThis.Node) => void;
selectNextSiblingNonEmptyText: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor) => void;
moveToStartOfFirstLeaf: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, path: Path, options?: {
edge: "anchor" | "focus";
} | undefined) => void;
moveToEndOfLastLeaf: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, path: Path, options?: {
edge: "anchor" | "focus";
} | undefined) => void;
joinWithPreviousVerse: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, path: Path) => void;
unjoinVerses: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, path: Path) => void;
removeVerseAndConcatenateContentsWithPrevious: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, path: Path) => void;
addVerse: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, path: Path) => void;
transform: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, op: import("slate").Operation) => void;
insertNodes: <T extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, nodes: Node | Node[], options?: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T> | undefined;
mode?: "highest" | "lowest" | undefined;
hanging?: boolean | undefined;
select?: boolean | undefined;
voids?: boolean | undefined;
} | undefined) => void;
liftNodes: <T_1 extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, options?: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T_1> | undefined;
mode?: "highest" | "lowest" | "all" | undefined;
voids?: boolean | undefined;
} | undefined) => void;
mergeNodes: <T_2 extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, options?: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T_2> | undefined;
mode?: "highest" | "lowest" | undefined;
hanging?: boolean | undefined;
voids?: boolean | undefined;
} | undefined) => void;
moveNodes: <T_3 extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, options: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T_3> | undefined;
mode?: "highest" | "lowest" | "all" | undefined;
to: Path;
voids?: boolean | undefined;
}) => void;
removeNodes: <T_4 extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, options?: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T_4> | undefined;
mode?: "highest" | "lowest" | undefined;
hanging?: boolean | undefined;
voids?: boolean | undefined;
} | undefined) => void;
setNodes: <T_5 extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, props: Partial<Node>, options?: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T_5> | undefined;
mode?: "highest" | "lowest" | "all" | undefined;
hanging?: boolean | undefined;
split?: boolean | undefined;
voids?: boolean | undefined;
} | undefined) => void;
splitNodes: <T_6 extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, options?: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T_6> | undefined;
/**
* Replaces the nodes at the given path with the desired nodes.
* Uses Editor.withoutNormalizing.
*
* @param editor Slate editor
* @param path Slate path of nodes to replace
* @param nodes The node or nodes that will replace the nodes at "path".
* The type of "nodes" matches the type required by Slate's
* Transforms.insertNodes.
*/
mode?: "highest" | "lowest" | undefined;
always?: boolean | undefined;
height?: number | undefined;
voids?: boolean | undefined;
} | undefined) => void;
unsetNodes: <T_7 extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, props: string | string[], options?: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T_7> | undefined;
mode?: "highest" | "lowest" | "all" | undefined;
split?: boolean | undefined;
voids?: boolean | undefined;
} | undefined) => void;
unwrapNodes: <T_8 extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, options?: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T_8> | undefined;
mode?: "highest" | "lowest" | "all" | undefined;
split?: boolean | undefined;
voids?: boolean | undefined;
} | undefined) => void;
wrapNodes: <T_9 extends Node>(editor: import("slate").BaseEditor & import("slate-react").ReactEditor, element: import("slate").BaseElement & {
type: string;
}, options?: {
at?: import("slate").Location | undefined;
match?: import("slate").NodeMatch<T_9> | undefined;
mode?: "highest" | "lowest" | "all" | undefined;
split?: boolean | undefined;
voids?: boolean | undefined;
} | undefined) => void;
collapse: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, options?: {
edge?: "anchor" | "focus" | "end" | "start" | undefined;
} | undefined) => void;
deselect: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor) => void;
move: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, options?: {
distance?: number | undefined;
unit?: "line" | "character" | "offset" | "word" | undefined;
reverse?: boolean | undefined;
edge?: "anchor" | "focus" | "end" | "start" | undefined;
} | undefined) => void;
select: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, target: import("slate").Location) => void;
setPoint: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, props: Partial<import("slate").BasePoint>, options?: {
edge?: "anchor" | "focus" | "end" | "start" | undefined;
} | undefined) => void;
setSelection: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, props: Partial<import("slate").BaseRange>) => void;
delete: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, options?: {
at?: import("slate").Location | undefined;
distance?: number | undefined;
unit?: "line" | "character" | "word" | "block" | undefined;
reverse?: boolean | undefined;
hanging?: boolean | undefined;
voids?: boolean | undefined;
} | undefined) => void;
insertFragment: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, fragment: Node[], options?: {
at?: import("slate").Location | undefined;
hanging?: boolean | undefined;
voids?: boolean | undefined;
} | undefined) => void;
insertText: (editor: import("slate").BaseEditor & import("slate-react").ReactEditor, text: string, options?: {
at?: import("slate").Location | undefined;
voids?: boolean | undefined;
} | undefined) => void;
};
declare type Mode = "next" | "previous";
/**
* Merges the selected block with the next or previous block,
* then sets the resulting block to an inline container type.
*/
declare function mergeSelectedBlockAndSetToInlineContainer(editor: Editor, options: {
mode?: Mode;
}): void;
/**
* Replaces the nodes at the given path with the desired nodes.
* Uses Editor.withoutNormalizing.
*
* @param editor Slate editor
* @param path Slate path of nodes to replace
* @param nodes The node or nodes that will replace the nodes at "path".
* The type of "nodes" matches the type required by Slate's
* Transforms.insertNodes.
*/
declare function replaceNodes(editor: Editor, path: Path, nodes: Node | Node[]): void;
declare function replaceText(editor: Editor, path: Path, newText: string): void;
/**
* Sets the identification headers, stored in the "headers" node of
* the editor's children (at path [0].)
*
* @param {Editor} editor
* @param {Object} identification - Json specifying the identification headers
*/
declare function setIdentification(editor: Editor, identification: IdentificationHeaders): void;
export {};