-
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.
- Loading branch information
Showing
46 changed files
with
140 additions
and
171 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,12 +1,12 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { NodeEntry } from 'slate'; | ||
import type { TNodeEntry} from '@udecode/plate-common'; | ||
import { getNodeEntry, type SlateEditor } from '@udecode/plate-common'; | ||
|
||
import { isSelectionValid } from './isSelectionValid'; | ||
|
||
export function getCurrentNodeEntry(editor: SlateEditor): NodeEntry | null { | ||
export function getCurrentNodeEntry(editor: SlateEditor): TNodeEntry | null { | ||
if (!editor.selection || !isSelectionValid(editor)) { | ||
return null; | ||
} | ||
|
||
return editor.node(editor.selection, { depth: 1 }); | ||
return getNodeEntry(editor, 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
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,7 @@ | ||
import type { TNode} from '@udecode/plate-common'; | ||
import { isElement, type SlateEditor } from '@udecode/plate-common'; | ||
import type { Node } from 'slate'; | ||
|
||
export function isBlock(editor: SlateEditor, node: Node): boolean { | ||
export function isBlock(editor: SlateEditor, node: Node | TNode): boolean { | ||
return isElement(node) && editor.isBlock(node); | ||
} |
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
import type { TNode} from '@udecode/plate-common'; | ||
import { isElement, type SlateEditor } from '@udecode/plate-common'; | ||
import type { Node } from 'slate'; | ||
|
||
export function isVoid(editor: SlateEditor, node: Node): boolean { | ||
export function isVoid(editor: SlateEditor, node: Node | TNode): boolean { | ||
return isElement(node) && editor.isVoid(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
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,8 +1,6 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { SlateEditor, TNode } from '@udecode/plate-common'; | ||
import { toDOMNode } from '@udecode/plate-common/react'; | ||
import type { Node } from 'slate'; | ||
|
||
export function toDomNode(editor: SlateEditor, node: Node): HTMLElement | null { | ||
// @ts-expect-error TODO: Fix this | ||
export function toDomNode(editor: SlateEditor, node: TNode): HTMLElement | null { | ||
return toDOMNode(editor, node) ?? 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
8 changes: 4 additions & 4 deletions
8
packages/slate-editor/src/extensions/paste-slate-content/lib/isFragment.ts
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,15 +1,15 @@ | ||
import { Node } from 'slate'; | ||
import { isNode, isNodeList, type TDescendant } from '@udecode/plate-common'; | ||
|
||
export type Fragment = Node[]; | ||
export type Fragment = TDescendant[]; | ||
|
||
/** | ||
* Checks recursively whether all members of the fragment are Nodes. | ||
* It does not validate schema/hierarchy. | ||
*/ | ||
export function isFragment(value: unknown): value is Fragment { | ||
if (!Node.isNodeList(value)) { | ||
if (!isNodeList(value)) { | ||
return false; | ||
} | ||
|
||
return value.length > 0 && value.every(Node.isNode); | ||
return value.length > 0 && value.every(isNode); | ||
} |
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
10 changes: 2 additions & 8 deletions
10
packages/slate-editor/src/lib/withResetFormattingOnBreak.ts
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
5 changes: 2 additions & 3 deletions
5
packages/slate-editor/src/modules/nodes-hierarchy/fixers/convertToParagraph.ts
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
5 changes: 2 additions & 3 deletions
5
packages/slate-editor/src/modules/nodes-hierarchy/fixers/insertParagraph.ts
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 type { NodeEntry } from 'slate'; | ||
import type { SlateEditor, TNodeEntry } from '@udecode/plate-common'; | ||
|
||
import { createParagraph } from '#extensions/paragraphs'; | ||
|
||
export function insertParagraph(editor: SlateEditor, [node, path]: NodeEntry) { | ||
export function insertParagraph(editor: SlateEditor, [node, path]: TNodeEntry) { | ||
editor.insertNodes([createParagraph()], { at: path, match: (n) => n === node }); | ||
return true; | ||
} |
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.