-
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.
Remove 'slate' imports from the main codebase
- Loading branch information
Showing
52 changed files
with
147 additions
and
162 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import type { Descendant, NodeEntry, Path } from 'slate'; | ||
import { Node } from 'slate'; | ||
import { type Descendant, type Node, NodeApi, type NodeEntry, type Path } from '@udecode/plate'; | ||
|
||
export function findDescendants<N extends Node>( | ||
node: N, | ||
match: (descendant: Descendant, path: Path) => boolean, | ||
): NodeEntry[] { | ||
const descendants = Array.from(Node.descendants(node)); | ||
const descendants = Array.from(NodeApi.descendants(node)); | ||
return descendants.filter(([element, path]) => match(element, path)); | ||
} |
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
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
2 changes: 1 addition & 1 deletion
2
packages/slate-editor/src/extensions/inline-links/lib/autolinkPlaintext.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/extensions/placeholders/lib/removePlaceholder.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
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
2 changes: 1 addition & 1 deletion
2
packages/slate-editor/src/extensions/tables/components/elements/TableCellElement.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/slate-editor/src/extensions/tables/components/elements/TableElement.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/slate-editor/src/extensions/tables/components/elements/TableRowElement.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/slate-editor/src/extensions/user-mentions/components/UserMentionsDropdown.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/slate-editor/src/extensions/variables/components/VariablesDropdown.tsx
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
2 changes: 1 addition & 1 deletion
2
...or/src/modules/editor/plugins/withDeserializeHtml/createDeserialize/createDeserializer.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
2 changes: 1 addition & 1 deletion
2
...odules/editor/plugins/withDeserializeHtml/createDeserialize/createElementsDeserializer.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
2 changes: 1 addition & 1 deletion
2
...rc/modules/editor/plugins/withDeserializeHtml/createDeserialize/createTextDeserializer.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
2 changes: 1 addition & 1 deletion
2
...-editor/src/modules/editor/plugins/withDeserializeHtml/deserializeHtml/deserializeHtml.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
6 changes: 2 additions & 4 deletions
6
packages/slate-editor/src/modules/nodes-hierarchy/fixers/insertTextNode.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,8 +1,6 @@ | ||
import { Transforms } from 'slate'; | ||
import type { NodeEntry } from 'slate'; | ||
import type { Editor } from 'slate'; | ||
import { type Editor, type NodeEntry } from '@udecode/plate'; | ||
|
||
export function insertTextNode(editor: Editor, [node, path]: NodeEntry) { | ||
Transforms.insertNodes(editor, [{ text: '' }], { at: path, match: (n) => n === node }); | ||
editor.tf.insertNodes([{ text: '' }], { at: path, match: (n) => n === node }); | ||
return true; | ||
} |
11 changes: 5 additions & 6 deletions
11
packages/slate-editor/src/modules/nodes-hierarchy/fixers/removeNode.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,21 +1,20 @@ | ||
import { Editor, Element, Path, Transforms } from 'slate'; | ||
import type { NodeEntry } from 'slate'; | ||
import { type Editor, ElementApi, type NodeEntry, PathApi } from '@udecode/plate'; | ||
|
||
export function removeNode(editor: Editor, [, path]: NodeEntry) { | ||
const targetPath = Path.parent(path); | ||
const ancestor = Editor.above(editor, { at: targetPath }); | ||
const targetPath = PathApi.parent(path); | ||
const ancestor = editor.api.above({ at: targetPath }); | ||
|
||
if (!ancestor) { | ||
return false; | ||
} | ||
|
||
const [ancestorNode] = ancestor; | ||
|
||
if (!Element.isElement(ancestorNode)) { | ||
if (!ElementApi.isElement(ancestorNode)) { | ||
return false; | ||
} | ||
|
||
Transforms.removeNodes(editor, { at: targetPath, voids: true }); | ||
editor.tf.removeNodes({ at: targetPath, voids: true }); | ||
|
||
return true; | ||
} |
Oops, something went wrong.