Skip to content

Commit f03ab10

Browse files
committed
feat: passing path to Editor for better customizability
1 parent 48c1a13 commit f03ab10

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

docs/pages/how-to/data-types.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ For advanced use cases, you can provide `PreComponent` and `PostComponent` to re
3737
#### `Editor`
3838

3939
To enable editing for a data type, you need to provide `serialize` and `deserialize` functions to convert the value to and from a string representation. You can then use the `Editor` component to provide a custom editor for the stringified value. When the user edits the value, it will be parsed using `deserialize`, and the result will be passed to the `onChange` callback.
40-
40+
- `props.path` - The path to the value.
4141
- `props.value` - The value to edit.
4242
- `props.setValue` - A function that can be used to update the value.
4343
- `props.abortEditing` - A function that can be used to abort editing.

src/components/DataKeyPair.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ export const DataKeyPair: FC<DataKeyPairProps> = (props) => {
391391
(editing && editable)
392392
? (Editor && (
393393
<Editor
394+
path={path}
394395
value={tempValue}
395396
setValue={setTempValue}
396397
abortEditing={abortEditing}

src/type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export interface DataItemProps<ValueType = unknown> {
6363
}
6464

6565
export type EditorProps<ValueType = unknown> = {
66+
path: Path
6667
value: ValueType
6768
setValue: Dispatch<ValueType>
6869
abortEditing: () => void

0 commit comments

Comments
 (0)