diff --git a/benchmark/helpers/h.js b/benchmark/helpers/h.js index 7413eb04d..e84420cb2 100644 --- a/benchmark/helpers/h.js +++ b/benchmark/helpers/h.js @@ -16,6 +16,12 @@ const h = createHyperscript({ list: 'list', item: 'item', image: 'image', + table: 'table', + tbody: 'tbody', + tr: 'tr', + td: 'td', + thead: 'thead', + th: 'th', }, inlines: { link: 'link', diff --git a/benchmark/slate/changes/insert-fragment-deep-with-problems.js b/benchmark/slate/changes/insert-fragment-deep-with-problems.js new file mode 100644 index 000000000..fe2097b28 --- /dev/null +++ b/benchmark/slate/changes/insert-fragment-deep-with-problems.js @@ -0,0 +1,67 @@ +/** @jsx h */ +/* eslint-disable react/jsx-key */ + +const h = require('../../helpers/h') +const { Editor } = require('slate') + +const fragment = ( + + + + + + + + + + + {Array.from(10).map(n => ( + + + + + ))} + +
+ Column 1 + + Column 2 + + Column 3 +
+ Plain text + + + Bolded text + + +
+ + + Plain text + + + + + + +
+) + +module.exports.default = function(editor) { + editor.insertFragment(fragment) +} + +const value = ( + + + + Some initial text. + + + +) + +module.exports.input = function() { + return new Editor({ value }) +} diff --git a/benchmark/slate/changes/insert-fragment-large.js b/benchmark/slate/changes/insert-fragment-large.js new file mode 100644 index 000000000..b6c8c3312 --- /dev/null +++ b/benchmark/slate/changes/insert-fragment-large.js @@ -0,0 +1,36 @@ +/** @jsx h */ +/* eslint-disable react/jsx-key */ + +const h = require('../../helpers/h') +const { Editor } = require('slate') + +const fragment = ( + + {Array.from(Array(100)).map((v, i) => ( + + + This is editable rich text, much better than a textarea! + {i == 0 ? : ''} + + + ))} + +) + +module.exports.default = function(editor) { + editor.insertFragment(fragment) +} + +const value = ( + + + + Some initial text. + + + +) + +module.exports.input = function() { + return new Editor({ value }) +} diff --git a/benchmark/slate/changes/insert-fragment.js b/benchmark/slate/changes/insert-fragment.js new file mode 100644 index 000000000..3258bde95 --- /dev/null +++ b/benchmark/slate/changes/insert-fragment.js @@ -0,0 +1,36 @@ +/** @jsx h */ +/* eslint-disable react/jsx-key */ + +const h = require('../../helpers/h') +const { Editor } = require('slate') + +const fragment = ( + + {Array.from(Array(10)).map((v, i) => ( + + + This is editable rich text, much better than a textarea! + {i == 0 ? : ''} + + + ))} + +) + +module.exports.default = function(editor) { + editor.insertFragment(fragment) +} + +const value = ( + + + + Some initial text. + + + +) + +module.exports.input = function() { + return new Editor({ value }) +} diff --git a/benchmark/slate/changes/insert-node-by-key.js b/benchmark/slate/changes/insert-node-by-key.js index 07fb3665c..c0cf1bcdb 100644 --- a/benchmark/slate/changes/insert-node-by-key.js +++ b/benchmark/slate/changes/insert-node-by-key.js @@ -8,9 +8,9 @@ module.exports.default = function(editor) { editor .insertNodeByKey('a0', 0, Hello world) .insertNodeByKey('a1', 1, Hello world) - .insertNodeByKey('a2', 2, Hello world) - .insertNodeByKey('a3', 3, Hello world) - .insertNodeByKey('a4', 4, Hello world) + .insertNodeByKey('a2', 0, Hello world) + .insertNodeByKey('a3', 1, Hello world) + .insertNodeByKey('a4', 0, Hello world) } const value = ( diff --git a/benchmark/slate/changes/normalize-with-problems.js b/benchmark/slate/changes/normalize-with-problems.js new file mode 100644 index 000000000..30b13cb1d --- /dev/null +++ b/benchmark/slate/changes/normalize-with-problems.js @@ -0,0 +1,36 @@ +/** @jsx h */ +/* eslint-disable react/jsx-key */ + +const h = require('../../helpers/h') +const { Editor } = require('slate') + +module.exports.default = function(editor) { + editor.normalize().normalize() +} + +const value = ( + + + {Array.from(Array(10)).map((v, i) => ( + + + + link text + + + + + link text + more text after + + + + + ))} + + +) + +module.exports.input = function() { + return new Editor({ value }, { normalize: false }) +} diff --git a/packages/slate-plain-serializer/test/helpers/h.js b/packages/slate-plain-serializer/test/helpers/h.js index b23cd7df4..2e7c3388e 100644 --- a/packages/slate-plain-serializer/test/helpers/h.js +++ b/packages/slate-plain-serializer/test/helpers/h.js @@ -13,6 +13,12 @@ const h = createHyperscript({ quote: 'quote', code: 'code', image: 'image', + table: 'table', + tbody: 'tbody', + tr: 'tr', + td: 'td', + thead: 'thead', + th: 'th', }, inlines: { link: 'link',