mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-01 05:16:10 +01:00
update benchmarks
This commit is contained in:
parent
695f83bd40
commit
014e37b319
33
benchmark/slate/changes/add-mark.js
Normal file
33
benchmark/slate/changes/add-mark.js
Normal file
@ -0,0 +1,33 @@
|
||||
/** @jsx h */
|
||||
/* eslint-disable react/jsx-key */
|
||||
|
||||
const h = require('../../helpers/h')
|
||||
|
||||
module.exports.default = function(change) {
|
||||
change.addMark('bold')
|
||||
}
|
||||
|
||||
const value = (
|
||||
<value>
|
||||
<document>
|
||||
{Array.from(Array(10)).map((v, i) => (
|
||||
<quote>
|
||||
<paragraph>
|
||||
<paragraph>
|
||||
This is editable {i == 0 ? <anchor /> : ''}rich{i == 0 ? (
|
||||
<focus />
|
||||
) : (
|
||||
''
|
||||
)}{' '}
|
||||
text, <i>much</i> better than a textarea!
|
||||
</paragraph>
|
||||
</paragraph>
|
||||
</quote>
|
||||
))}
|
||||
</document>
|
||||
</value>
|
||||
)
|
||||
|
||||
module.exports.input = function() {
|
||||
return value.change()
|
||||
}
|
@ -14,9 +14,9 @@ const value = (
|
||||
<quote>
|
||||
<paragraph>
|
||||
<paragraph>
|
||||
{i == 0 ? <cursor /> : ''}
|
||||
This is editable <b>rich</b> text, <i>much</i> better than a
|
||||
textarea!
|
||||
{i == 0 ? <cursor /> : ''}
|
||||
</paragraph>
|
||||
</paragraph>
|
||||
</quote>
|
||||
|
@ -3,30 +3,26 @@
|
||||
|
||||
const h = require('../../helpers/h')
|
||||
|
||||
module.exports.default = function({ change, block }) {
|
||||
change.insertNodeByKey(block.key, 0, <paragraph>Hello world</paragraph>)
|
||||
module.exports.default = function(change) {
|
||||
change.insertNodeByKey('a', 0, <paragraph>Hello world</paragraph>)
|
||||
}
|
||||
|
||||
const value = (
|
||||
<value>
|
||||
<document>
|
||||
{Array.from(Array(10)).map((v, i) => (
|
||||
<quote>
|
||||
<quote key="a">
|
||||
<paragraph>
|
||||
<paragraph>
|
||||
This is editable <b>rich</b> text, <i>much</i> better than a
|
||||
textarea!
|
||||
{i == 0 ? <cursor /> : ''}
|
||||
</paragraph>
|
||||
This is editable <b>rich</b> text, <i>much</i> better than a
|
||||
textarea!
|
||||
{i == 0 ? <cursor /> : ''}
|
||||
</paragraph>
|
||||
</quote>
|
||||
))}
|
||||
</document>
|
||||
</value>
|
||||
)
|
||||
const block = value.document.getBlocks().last()
|
||||
|
||||
module.exports.input = function() {
|
||||
const change = value.change()
|
||||
return { change, block }
|
||||
return value.change()
|
||||
}
|
||||
|
30
benchmark/slate/changes/set-blocks.js
Normal file
30
benchmark/slate/changes/set-blocks.js
Normal file
@ -0,0 +1,30 @@
|
||||
/** @jsx h */
|
||||
/* eslint-disable react/jsx-key */
|
||||
|
||||
const h = require('../../helpers/h')
|
||||
|
||||
module.exports.default = function(change) {
|
||||
change.setBlocks('quote')
|
||||
}
|
||||
|
||||
const value = (
|
||||
<value>
|
||||
<document>
|
||||
{Array.from(Array(10)).map((v, i) => (
|
||||
<quote>
|
||||
<paragraph>
|
||||
<paragraph>
|
||||
This is editable <b>rich</b> text, <i>much</i> better than a
|
||||
textarea!
|
||||
{i == 0 ? <cursor /> : ''}
|
||||
</paragraph>
|
||||
</paragraph>
|
||||
</quote>
|
||||
))}
|
||||
</document>
|
||||
</value>
|
||||
)
|
||||
|
||||
module.exports.input = function() {
|
||||
return value.change()
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user