mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-28 17:39:57 +02:00
update benchmarks
This commit is contained in:
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>
|
<quote>
|
||||||
<paragraph>
|
<paragraph>
|
||||||
<paragraph>
|
<paragraph>
|
||||||
|
{i == 0 ? <cursor /> : ''}
|
||||||
This is editable <b>rich</b> text, <i>much</i> better than a
|
This is editable <b>rich</b> text, <i>much</i> better than a
|
||||||
textarea!
|
textarea!
|
||||||
{i == 0 ? <cursor /> : ''}
|
|
||||||
</paragraph>
|
</paragraph>
|
||||||
</paragraph>
|
</paragraph>
|
||||||
</quote>
|
</quote>
|
||||||
|
@@ -3,30 +3,26 @@
|
|||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
|
||||||
module.exports.default = function({ change, block }) {
|
module.exports.default = function(change) {
|
||||||
change.insertNodeByKey(block.key, 0, <paragraph>Hello world</paragraph>)
|
change.insertNodeByKey('a', 0, <paragraph>Hello world</paragraph>)
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = (
|
const value = (
|
||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map((v, i) => (
|
{Array.from(Array(10)).map((v, i) => (
|
||||||
<quote>
|
<quote key="a">
|
||||||
<paragraph>
|
<paragraph>
|
||||||
<paragraph>
|
This is editable <b>rich</b> text, <i>much</i> better than a
|
||||||
This is editable <b>rich</b> text, <i>much</i> better than a
|
textarea!
|
||||||
textarea!
|
{i == 0 ? <cursor /> : ''}
|
||||||
{i == 0 ? <cursor /> : ''}
|
|
||||||
</paragraph>
|
|
||||||
</paragraph>
|
</paragraph>
|
||||||
</quote>
|
</quote>
|
||||||
))}
|
))}
|
||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
const block = value.document.getBlocks().last()
|
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
const change = value.change()
|
return value.change()
|
||||||
return { change, block }
|
|
||||||
}
|
}
|
||||||
|
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()
|
||||||
|
}
|
Reference in New Issue
Block a user