Releases: octet-stream/slate-to-react
Releases · octet-stream/slate-to-react
0.5.0
Add
- Add options to configure how
slate-to-react
will pick up or generate id property of each node:idKeyName
- the name of the id property on nodes;forceGenerateId
- Iftrue
, the id for key attribute will be always generated;idGenerator
- Custom implementation for ID generator.
Update
- Improvements for documentation.
All changes: v0.4.0...v0.5.0
0.4.0
Update
- Render props now use
Element
andText
nodes ownid
field when such field is present; Transform
type field now read-only both on type-level and in runtime.
Remove
- No longer used
CreateTransformProps
type is removed from public API
All changes: v0.3.1...v0.4.0
0.3.1
0.3.0 - Simplified API for matchers
Update
- Matchers API is simplified: No need to pass
LeafProps
orElementProps
. Predicates now should return node type itself:
Before v0.3.0:
import {createLeafNodeMatcher, createElementNodeMatcher} from "slate-to-react"
import type {Node, Replace, LeafProps, ElementProps} from "slate-to-react"
import type {Text} from "slate"
type Link = Replace<Node<"a">, {
children: Text[]
}>
export const isText = createLeafNodeMatcher<Text>(
(node): node is LeafProps<Text> => typeof node.leaf.text === "string"
)
export const isLink = createElementNodeMatcher<Link>(
(node): node is ElementProps<Link> => node.element.type === "a"
&& typeof node.element.url === "string"
)
Since v0.3.0:
import {createLeafNodeMatcher, createElementNodeMatcher} from "slate-to-react"
import type {Node, Replace} from "slate-to-react"
import type {Text} from "slate"
type Link = Replace<Node<"a">, {
children: Text[]
}>
export const isText = createLeafNodeMatcher<Text>(
(node): node is Text => typeof node.text === "string"
)
export const isLink = createElementNodeMatcher<Link>(
(node): node is Link => node.type === "a" && typeof node.url === "string"
)
Remove
ref
attribute fromElementProps
attributes, as it's unnecessary forslate-to-react
;LeafProps
andElementProps
no longer available for public usage, as they not necessary for matchers anymore.
All changes: v0.2.1...v0.3.0
0.2.1
Add
- Expose
ElementProps<T>
andLeafProps<T>
types from package's entry point; - Fixes for examples in documentation.
All changes: v0.2.0...v0.2.1
0.2.0 – Custom transforms!
Add
- Implement custom transforms support for
transformNodes
,SlateView
anduseSlateToReact
; - Add documentation for custom transforms;
- Expose
Replace<L, R>
type utility - Expose
NodeProps<T>
,LeafProps<T>
andElementProps<T>
types.
Updated
- Rename types:
Transform
->TransformImplementation
,CreateTransformResult
->Transform
,CreateLeafTransformResult
->LeafTransform
CreateElementTransformResult
->ElementTransform
Documentation can be found in readme.
All changes: v0.1.0...v0.2.0
Initial release!
Implemented minimal transform API, hook and component. For more details, read documentation.