-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Plate types and APIs in slate-commons
- Loading branch information
Showing
60 changed files
with
226 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import { deselectEditor } from '@udecode/plate-common/react'; | ||
import type { SlateEditor } from '@udecode/plate'; | ||
|
||
export function blur(editor: SlateEditor): void { | ||
deselectEditor(editor); | ||
editor.tf.deselectDOM(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import { focusEditor } from '@udecode/plate-common/react'; | ||
import type { SlateEditor } from '@udecode/plate'; | ||
|
||
import { moveCursorToEndOfDocument } from './moveCursorToEndOfDocument'; | ||
|
||
export function focus(editor: SlateEditor): void { | ||
focusEditor(editor); | ||
editor.tf.focus(); | ||
moveCursorToEndOfDocument(editor); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import type { TNodeEntry } from '@udecode/plate-common'; | ||
import { getNodeEntry, type SlateEditor } from '@udecode/plate-common'; | ||
import { type NodeEntry, type SlateEditor } from '@udecode/plate'; | ||
|
||
import { isSelectionValid } from './isSelectionValid'; | ||
|
||
export function getCurrentNodeEntry(editor: SlateEditor): TNodeEntry | null { | ||
export function getCurrentNodeEntry(editor: SlateEditor): NodeEntry | null { | ||
if (!editor.selection || !isSelectionValid(editor)) { | ||
return null; | ||
} | ||
|
||
return getNodeEntry(editor, editor.selection, { depth: 1 }) ?? null; | ||
return editor.api.node(editor.selection, { depth: 1 }) ?? null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Path } from 'slate'; | ||
import type { Path, SlateEditor } from '@udecode/plate'; | ||
|
||
export function getNodePath( | ||
editor: SlateEditor, | ||
options: NonNullable<Parameters<typeof editor.nodes>[0]>, | ||
options: NonNullable<Parameters<typeof editor.api.nodes>[0]>, | ||
): Path | null { | ||
const [entry] = editor.nodes(options); | ||
const [entry] = editor.api.nodes(options); | ||
return entry ? entry[1] : null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import type { TNode } from '@udecode/plate-common'; | ||
import { isElement, type SlateEditor } from '@udecode/plate-common'; | ||
import type { Node } from 'slate'; | ||
import type { Node, SlateEditor } from '@udecode/plate'; | ||
import { ElementApi } from '@udecode/plate'; | ||
|
||
export function isBlock(editor: SlateEditor, node: Node | TNode): boolean { | ||
return isElement(node) && editor.isBlock(node); | ||
export function isBlock(editor: SlateEditor, node: Node): boolean { | ||
return ElementApi.isElement(node) && editor.api.isBlock(node); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.