mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-12 10:14:02 +02:00
Prevent history mutation during initialization (#1329)
* fix history on init * fix setValue save logic * update comment
This commit is contained in:
committed by
Ian Storm Taylor
parent
d0172eac17
commit
e29caf46ec
@@ -109,9 +109,10 @@ function BeforePlugin() {
|
||||
|
||||
// If the value's schema isn't the editor's schema, update it. This can
|
||||
// happen on the initialization of the editor, or if the schema changes.
|
||||
// This change isn't save into history since only schema is updated.
|
||||
if (value.schema != editor.schema) {
|
||||
change
|
||||
.setValue({ schema: editor.schema })
|
||||
.setValue({ schema: editor.schema }, { save: false })
|
||||
.normalize()
|
||||
}
|
||||
|
||||
|
@@ -14,9 +14,10 @@ const Changes = {}
|
||||
*
|
||||
* @param {Change} change
|
||||
* @param {Object|Value} properties
|
||||
* @param {Object} options
|
||||
*/
|
||||
|
||||
Changes.setValue = (change, properties) => {
|
||||
Changes.setValue = (change, properties, options = {}) => {
|
||||
properties = Value.createProperties(properties)
|
||||
const { value } = change
|
||||
|
||||
@@ -24,7 +25,7 @@ Changes.setValue = (change, properties) => {
|
||||
type: 'set_value',
|
||||
properties,
|
||||
value,
|
||||
})
|
||||
}, options)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user