Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Dec 25, 2024
1 parent 392d0f7 commit f34e353
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion apps/www/content/docs/en/editor-methods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,21 @@ You can also use `editor.isFallback` to check if the editor is a fallback instan

## API Methods

### findPath

Find the path of a node. Default is `findNodePath` (traversal). Overridden by `withPlate` to use `ReactEditor.findPath` (memo).

```ts
const path = editor.findPath(node);
```

### getApi

Retrieve the typed API for the editor:

```ts
const api = editor.getApi(TablePlugin);
api.api.create.cell(); // Type-safe API method
api.api.create.tableCell(); // Type-safe API method
```

### getTransforms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useExcalidrawElement = ({
scrollToContent,
},
// onChange: (elements: readonly ExcalidrawElementType[], state: AppState) => {
// const path = findNodePath(editor, element);
// const path = editor.findPath(element);

// FIXME: setNodes triggers render loop as onChange is triggered on rerender
// in the meantime, the prop can be used to save the data outside slate
Expand Down

0 comments on commit f34e353

Please sign in to comment.