1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-01-19 14:27:07 +01:00
slate/examples
2016-07-14 16:35:48 -07:00
..
2016-07-14 16:31:55 -07:00
2016-07-14 16:31:55 -07:00
2016-07-14 16:31:55 -07:00
2016-07-14 16:31:55 -07:00
2016-07-14 16:31:55 -07:00
2016-07-14 16:31:55 -07:00
2016-07-14 16:31:55 -07:00
2016-07-13 16:19:49 -07:00
2016-07-06 14:54:13 -07:00
2016-06-28 18:26:56 -07:00
2016-07-12 22:26:57 -07:00
2016-07-14 16:35:48 -07:00
2016-06-24 10:22:48 -07:00
2016-06-30 10:43:24 -07: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.
  • Auto-markdown — 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 menu — showing how a contextual hovering menu 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 decorators to dynamically mark text.

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 from npm.

make install

Which will also build the source. Then build the examples:

make examples

And then run the examples server:

make start

Now you can open up http://localhost:8080 in your browser and you'll see the examples site.

If you want to edit the source while running the examples and have those changes immediately reflected, you need to run two additional watching commands in your terminal:

make watch-dist
make watch-examples