Skip to content

Releases: octet-stream/slate-to-react

0.5.0

12 Mar 12:27

Choose a tag to compare

0.5.0 Pre-release
Pre-release

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 - If true, 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

10 Mar 23:47

Choose a tag to compare

0.4.0 Pre-release
Pre-release

Update

  • Render props now use Element and Text nodes own id 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

10 Mar 00:50

Choose a tag to compare

0.3.1 Pre-release
Pre-release

Update

  • Fix repository link in package.json

All changes: v0.3.0...v0.3.1

0.3.0 - Simplified API for matchers

10 Mar 00:45

Choose a tag to compare

Pre-release

Update

  • Matchers API is simplified: No need to pass LeafProps or ElementProps. 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 from ElementProps attributes, as it's unnecessary for slate-to-react;
  • LeafProps and ElementProps no longer available for public usage, as they not necessary for matchers anymore.

All changes: v0.2.1...v0.3.0

0.2.1

08 Mar 20:25

Choose a tag to compare

0.2.1 Pre-release
Pre-release

Add

  • Expose ElementProps<T> and LeafProps<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!

08 Mar 19:57

Choose a tag to compare

Pre-release

Add

  • Implement custom transforms support for transformNodes, SlateView and useSlateToReact;
  • Add documentation for custom transforms;
  • Expose Replace<L, R> type utility
  • Expose NodeProps<T>, LeafProps<T> and ElementProps<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!

06 Mar 23:10

Choose a tag to compare

Initial release! Pre-release
Pre-release

Implemented minimal transform API, hook and component. For more details, read documentation.