mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 02:49:56 +02:00
Fixed mentions example (#2877)
This commit is contained in:
committed by
Ian Storm Taylor
parent
67e397100e
commit
5471343ae8
@@ -58,6 +58,18 @@ Commands.setAnnotation = (editor, annotation, newProperties) => {
|
||||
})
|
||||
}
|
||||
|
||||
Commands.setAnnotations = (editor, annotations = []) => {
|
||||
const { value } = editor
|
||||
const newProperties = Value.createProperties({ annotations })
|
||||
const prevProperties = pick(value, Object.keys(newProperties))
|
||||
|
||||
editor.applyOperation({
|
||||
type: 'set_value',
|
||||
properties: prevProperties,
|
||||
newProperties,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Export.
|
||||
*
|
||||
|
@@ -68,7 +68,7 @@ class Value extends Record(DEFAULTS) {
|
||||
if (isPlainObject(a)) {
|
||||
const p = {}
|
||||
if ('annotations' in a)
|
||||
p.annotations = Annotation.createList(a.annotations)
|
||||
p.annotations = Annotation.createMap(a.annotations)
|
||||
if ('data' in a) p.data = Data.create(a.data)
|
||||
return p
|
||||
}
|
||||
|
Reference in New Issue
Block a user