mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-03-03 12:39:04 +01:00
* Fix bolded text in input-tester initial value * Fix crash on Input Tester example with certain input events If an Input event with inputType "insertReplacementText" is received, the example crashes because "event.dataTransfer.get is not a function" The correct API is `getData()`, not `get()`. Ref: https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/getData * Revert "Fix bolded text in input-tester initial value" This reverts commit 82e1213be39a9f19c837ff3d28c4c025035d595b. * Revert "Revert "Fix bolded text in input-tester initial value"" This reverts commit b5a0a2440f388f741222574974cf5fd2ff454a91.
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 schema rules to enforce document structure
- 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 decorations to dynamically mark 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:8080
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