X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/d5f4c1bb0dc3a9ff8845d209c75d00cc733b3360..5028701711e4a1ee85e88f5ff7f1caf911dad8e5:/src/wlxml/extensions/metadata/metadata.js diff --git a/src/wlxml/extensions/metadata/metadata.js b/src/wlxml/extensions/metadata/metadata.js index b19cd52..899306d 100644 --- a/src/wlxml/extensions/metadata/metadata.js +++ b/src/wlxml/extensions/metadata/metadata.js @@ -17,6 +17,9 @@ _.extend(Row.prototype, { ChangeProperty: smartxmlTransformations.createContextTransformation({ impl: function(t, rowIndex, propName, value) { var row = this.getMetadata().at(rowIndex); + if(row.getValue() === value) { + return; + } t.rowIndex = rowIndex; t.propName = propName; t.oldValue = row[propName]; @@ -85,8 +88,10 @@ _.extend(Metadata.prototype, { this.triggerChangeEvent('metadataRemoved', {row: t.row}); }, undo: function(t) { - var metadata = this.getMetadata(); - metadata._rows.splice(t.rowIdx, 0, new Row(t.row.getKey(), t.row.getValue(), metadata)); + var metadata = this.getMetadata(), + row = new Row(t.row.getKey(), t.row.getValue(), metadata); + metadata._rows.splice(t.rowIdx, 0, row); + this.triggerChangeEvent('metadataAdded', {row: row}); } }),