1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-23 16:55:23 +01:00
Sunny Hirai a72958e6c3
Improved Types (#4119)
* Experimental release to see if CustomTypes holds up through a publish

* Add experimental release script

* Fix lint

* v0.60.5-alpha.0

* Allow null properties in setNodes

* v0.60.6-alpha.0

* Revert null properties on Transforms.setNodes

* v0.60.7-alpha.0

* Update examples to use custom Element and Text with discriminated unions

* Add documentation for using TypeScript improvements

* Be explicit about typescript version in package.json

* Force lerna bootstrap to fix build issues on CI and fix a few type examples

* Add slate devDependencies with * back

* v0.60.7

* Switch to a non prerelease version to fix lerna not linking in root

* Add documentation for not using prerelease versions and on how to create experimental releases

* Try removing lerna bootstrap and see if it works
2021-03-11 11:48:31 -08:00
..
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00
2021-03-11 11:48:31 -08:00

Examples

This directory contains a set of examples that give you an idea for how you might use Slate to implement your own editor. Take a look around!

  • Plain text — showing the most basic case: a glorified <textarea>.
  • Rich text — showing the features you'd expect from a basic editor.
  • Forced Layout - showing how to use constraints to enforce a document structure.
  • Markdown Shortcuts — showing how to add key handlers for Markdown-like shortcuts.
  • Links — showing how wrap text in inline nodes with associated data.
  • Images — showing how to use void (text-less) nodes to add images.
  • Hovering toolbar — showing how a hovering toolbar can be implemented.
  • Tables — showing how to nest blocks to render more advanced components.
  • Paste HTML — showing how to use an HTML serializer to handle pasted HTML.
  • Code Highlighting — showing how to use decorations to dynamically format text.
  • ...and more!

If you have an idea for an example that shows a common use case, pull request it!

Running the Examples

To get the examples running on your machine, you need to have the Slate repository cloned to your computer. After that, you need to cd into the directory where you cloned it, and install the dependencies with yarn and build the monorepo:

yarn install
yarn build

Then start the watcher and examples server:

yarn start

Now you can open up http://localhost:3000 in your browser and you'll see the examples site. Any changes you make to the source code will be immediately reflected when you refresh the page. You can open the examples URL quickly with:

yarn open