mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 19:01:54 +02:00
update docs, few fixes
This commit is contained in:
5
Makefile
5
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) \
|
||||
|
11
Readme.md
11
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!)
|
||||
|
||||
|
||||
<br/>
|
||||
@@ -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
|
||||
|
||||
|
@@ -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()
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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.
|
||||
*/
|
||||
|
@@ -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",
|
||||
|
Reference in New Issue
Block a user