diff --git a/Makefile b/Makefile index 09201cddf..ca2be86de 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ babel = $(bin)/babel browserify = $(bin)/browserify exorcist = $(bin)/exorcist eslint = $(bin)/eslint +http-server = $(bin)/http-server mocha = $(bin)/mocha mocha-phantomjs = $(bin)/mocha-phantomjs node = node @@ -53,6 +54,10 @@ lint: "lib/**/*.js" \ "examples/**/*.js" --ignore-pattern "build.js" +# Start the examples server. +start-examples: + @ $(http-server) ./examples + # Build the test source. test/support/build.js: $(shell find ./lib) ./test/browser.js @ $(browserify) \ diff --git a/Readme.md b/Readme.md index 54570981c..3c73f79dd 100644 --- a/Readme.md +++ b/Readme.md @@ -26,7 +26,9 @@ _Slate is currently in **beta**, while work is being done on: cross-browser supp 4. **Stateless and immutable.** By using React and Immutable.js, the Slate editor is built in a stateless fashion using immutable data structures, which leads to better performance, and also a much easier time writing plugins. -5. **Collaboration friendly.** The data model Slate uses—specifically how transforms are applied to the document—has been designed to allow for collaborative editing to be layered on top, so you won't need to rethink everything if you decide to make your editor collaborative. +5. **Intuitive transforms.** Slate's content is edited using "transforms", that are designed to be extremely intuitive to use, so that writing plugins and custom functionality is as simple as possible. + +6. **Collaboration friendly.** The data model Slate uses—specifically how transforms are applied to the document—has been designed to allow for collaborative editing to be layered on top, so you won't need to rethink everything if you decide to make your editor collaborative. (More work is required on this!)
@@ -52,16 +54,17 @@ 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/guides/installing-slate.md) guides and the [Core Concepts](./docs/concepts) to familiarize yourself with Slate's architecture and mental models. Once you've gotten familiar with those, you'll probably want to check out the full [API Reference](./docs/reference). -- [**Guides**](docs/guides/installing-slate.md) +- [**Guides**](docs/guides) - [Installing Slate](docs/guides/installing-slate.md) - [Adding Event Handlers](docs/guides/adding-event-handlers.md) - [Defining Custom Block Nodes](docs/guides/defining-custom-block-nodes.md) - [Applying Custom Formatting](docs/guides/applying-custom-formatting.md) - [Using Plugins](docs/guides/using-plugins.md) + - Saving to a Database -- [**Concepts**](docs/concepts.md) +- **Concepts** - Statelessness & Immutability - - [The Document Model](docs/getting-started.md#the-document-model) + - The Document Model - The Selection Model - Plugins diff --git a/examples/code-highlighting/index.js b/examples/code-highlighting/index.js index 165136d6a..f593c520d 100644 --- a/examples/code-highlighting/index.js +++ b/examples/code-highlighting/index.js @@ -92,11 +92,11 @@ class CodeHighlighting extends React.Component { } renderDecorations = (text, state, editor) => { - let characters = text.characters const { document } = state const block = document.getClosestBlock(text) - if (block.type != 'code') return characters + if (block.type != 'code') return text.characters + let characters = text.characters.asMutable() const string = text.text const grammar = Prism.languages.javascript const tokens = Prism.tokenize(string, grammar) @@ -122,7 +122,7 @@ class CodeHighlighting extends React.Component { offset = length } - return characters + return characters.asImmutable() } } diff --git a/examples/index.js b/examples/index.js index 6bd1b63ce..62dc27660 100644 --- a/examples/index.js +++ b/examples/index.js @@ -3,6 +3,13 @@ import React from 'react' import ReactDOM from 'react-dom' import { Router, Route, Link, IndexRedirect, hashHistory } from 'react-router' +/** + * Perf. + */ + +import Perf from 'react-addons-perf' +window.Perf = Perf + /** * Examples. */ diff --git a/package.json b/package.json index 20759022c..4f1cb06d5 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,12 @@ "eslint-plugin-import": "^1.10.2", "eslint-plugin-react": "^5.2.2", "exorcist": "^0.4.0", + "http-server": "^0.9.0", "mocha": "^2.5.3", "mocha-phantomjs": "^4.0.2", "prismjs": "^1.5.1", "react": "^15.2.0", + "react-addons-perf": "^15.2.1", "react-dom": "^15.1.0", "react-portal": "^2.2.0", "react-router": "^2.5.1",