1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

Merge branch 'more-benchmarks' into schema-normalize

This commit is contained in:
Soreine
2016-10-28 12:34:27 +02:00
3 changed files with 57 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
module.exports = {
setup(state) {
// Move cursor
return state.transform()
.collapseToStartOf({ key: '_cursor_' })
.moveForward(10) // Move inside the text
.apply()
},
run(state) {
return state.transform().insertText('a').apply()
}
}

View File

@@ -0,0 +1,41 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
ranges:
- text: 'This is editable '
- text: 'rich'
marks:
- type: bold
- text: ' text, '
- text: 'much'
marks:
- type: italic
- text: ' better than a '
- text: '<textarea>'
marks:
- type: code
- text: '!'
- kind: block
key: _cursor_
type: paragraph
nodes:
- kind: text
ranges:
- text: 'Since it''s rich text, you can do things like turn a selection of text '
- text: 'bold'
marks:
- type: bold
- text: ', or add a semantically rendered block quote in the middle of the page,
like this:'
- kind: block
type: block-quote
nodes:
- kind: text
text: 'A wise quote.'
- kind: block
type: paragraph
nodes:
- kind: text
text: 'Try it out for yourself!'

View File

@@ -29,7 +29,7 @@ const DEFAULT_BENCHMARK = {
const BENCHMARK_OPTIONS = { const BENCHMARK_OPTIONS = {
// To ensure a better accuracy, force a minimum number of samples // To ensure a better accuracy, force a minimum number of samples
minSamples: 50 // default 10 minSamples: 80 // default 10
} }
// Because BenchmarkJS does not support scoped variables well, use // Because BenchmarkJS does not support scoped variables well, use
@@ -210,7 +210,7 @@ function exists(filepath) {
function save(results, path) { function save(results, path) {
path = resolve(process.cwd(), path) path = resolve(process.cwd(), path)
fs.writeFileSync(path, JSON.stringify(results)) fs.writeFileSync(path, JSON.stringify(results, null, 2))
} }
function serializeResult(event) { function serializeResult(event) {