reuse attrs for setNodeAttributes and resetNodeAttributes, fix #37
This commit is contained in:
@@ -12,6 +12,7 @@ export default (attributeNames: string[] = []): Command => ({ tr, state, dispatc
|
||||
|
||||
if (attribute && defaultValue !== undefined && dispatch) {
|
||||
tr.setNodeMarkup(pos, undefined, {
|
||||
...node.attrs,
|
||||
[name]: defaultValue,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@ export default (attributes: {}): Command => ({ tr, state, dispatch }) => {
|
||||
|
||||
state.doc.nodesBetween(from, to, (node, pos) => {
|
||||
if (!node.type.isText && dispatch) {
|
||||
tr.setNodeMarkup(pos, undefined, attributes)
|
||||
tr.setNodeMarkup(pos, undefined, {
|
||||
...node.attrs,
|
||||
...attributes,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user