From: Aleksander Ɓukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Date: Mon, 27 Jan 2014 10:51:39 +0000 (+0100)
Subject: smartxml: transaction wrapper
X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/e4c946c8c760c8f1d9c2c1a7abfafedafaca21e3?ds=inline

smartxml: transaction wrapper
---

diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js
index d87ec54..d085742 100644
--- a/src/smartxml/smartxml.js
+++ b/src/smartxml/smartxml.js
@@ -574,6 +574,12 @@ $.extend(Document.prototype, Backbone.Events, {
         }
     },
 
+    transaction: function(callback, context) {
+        this.startTransaction();
+        callback.call(context);
+        this.endTransaction();
+    },
+
     getNodeByPath: function(path) {
         var toret = this.root;
         path.forEach(function(idx) {