From dae23d5bd227b347023989a696fe0b1c4812c923 Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Wed, 6 Jul 2016 15:13:15 -0700 Subject: [PATCH] update readme, fix tables example --- Readme.md | 12 ++++++++---- examples/tables/index.js | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Readme.md b/Readme.md index 54d6d2f13..bac2fb759 100644 --- a/Readme.md +++ b/Readme.md @@ -36,8 +36,11 @@ To get a sense for how you might use Slate, check out a few of the examples: - [**Rich text**](examples/rich-text) — showing the features you'd expect from a basic editor. - [**Auto-markdown**](examples/auto-markdown) — showing how to add key handlers for Markdown-like shortcuts. - [**Links**](examples/links) — showing how wrap text in inline nodes with associated data. +- [**Images**](examples/images) — showing how to use void (text-less) nodes to add images. - [**Hovering menu**](examples/hovering-menu) — showing how a contextual hovering menu can be implemented. - [**Tables**](examples/tables) — showing how to nest blocks to render more advanced components. +- [**Paste HTML**](examples/paste-html) — showing how to use an HTML serializer to handle pasted HTML. +- [**Code Highlighting**](examples/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! @@ -47,11 +50,12 @@ If you have an idea for an example that shows a common use case, pull request it If you're using Slate for the first time, check out the [Getting Started](docs/getting-started.md) guide to familiarize yourself with Slate's architecture and mental models. After that, you'll probably just want the [API Reference](docs/reference.md). - [**Getting Started**](docs/getting-started.md) -- [**Core Concepts**](docs/concepts.md) - - [Stateless & Immutability](docs/getting-started.md#stateless-immutability) +- **Core Concepts** + - Statelessness & Immutability - [The Document Model](docs/getting-started.md#the-document-model) - - Selections -- [**API Reference**](docs/reference.md) + - The Selection Model + - Writing Plugins +- **API Reference** - Plugins - Components - Editor diff --git a/examples/tables/index.js b/examples/tables/index.js index 501662724..0c16a2e33 100644 --- a/examples/tables/index.js +++ b/examples/tables/index.js @@ -83,7 +83,7 @@ class Tables extends React.Component { */ onKeyDown(e, state) { - if (state.startNode.type != 'table-cell') return + if (state.startBlock.type != 'table-cell') return const key = keycode(e.which) switch (key) { @@ -116,7 +116,7 @@ class Tables extends React.Component { */ onDelete(e, state) { - if (state.endOffset != state.startNode.length) return + if (state.endOffset != state.startText.length) return e.preventDefault() return state }