mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-20 06:01:24 +02:00
fix benchmarks
This commit is contained in:
@@ -42,7 +42,9 @@ const decorations = texts.flatMap((t, index) => {
|
|||||||
key: t.key,
|
key: t.key,
|
||||||
offset: 1,
|
offset: 1,
|
||||||
},
|
},
|
||||||
marks: [{ type: 'underline' }],
|
mark: {
|
||||||
|
type: 'underline',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@@ -106,6 +106,15 @@ class Decoration extends Record(DEFAULTS) {
|
|||||||
|
|
||||||
static fromJSON(object) {
|
static fromJSON(object) {
|
||||||
const { anchor, focus, mark } = object
|
const { anchor, focus, mark } = object
|
||||||
|
|
||||||
|
if (!mark) {
|
||||||
|
throw new Error(
|
||||||
|
`Decorations must be created with a \`mark\`, but you passed: ${JSON.stringify(
|
||||||
|
object
|
||||||
|
)}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const decoration = new Decoration({
|
const decoration = new Decoration({
|
||||||
anchor: Point.fromJSON(anchor || {}),
|
anchor: Point.fromJSON(anchor || {}),
|
||||||
focus: Point.fromJSON(focus || {}),
|
focus: Point.fromJSON(focus || {}),
|
||||||
|
Reference in New Issue
Block a user