editor: Handling backspace/delete on the text boundries
[fnpeditor.git] / src / editor / modules / documentHistory / documentHistory.js
index f595594..7bbf32f 100644 (file)
@@ -1,10 +1,9 @@
 define([
 'libs/jquery',
 'libs/underscore',
-'./restoreDialog',
 'libs/text!./templates/main.html',
 'libs/text!./templates/item.html'
-], function($, _, restoreDialog, mainTemplateSrc, itemTemplateSrc) {
+], function($, _, mainTemplateSrc, itemTemplateSrc) {
 
 'use strict';
     
@@ -17,21 +16,16 @@ return function(sandbox) {
     var itemViews = [];
     
     
-    dom.find('.btn.compare').click(function(e) {
+    dom.find('.btn.compare').click(function() {
         var selected = historyItems.getSelected();
         sandbox.publish('compare', selected[0], selected[1]);
     });
     
-    dom.find('.btn.restore').click(function(e) {
-        var dialog = restoreDialog.create();
-        dialog.on('restore', function(event) {
-            sandbox.publish('restoreVersion', {version: historyItems.getSelected()[0], description: event.data.description});
-            event.success();
-        });
-        dialog.show();
+    dom.find('.btn.restore').click(function() {
+        sandbox.publish('restoreVersion', historyItems.getSelected()[0]);
     });
     
-    dom.find('.btn.display').click(function(e) {
+    dom.find('.btn.display').click(function() {
         sandbox.publish('displayVersion', {version: historyItems.getSelected()[0]});
     });
         
@@ -47,8 +41,9 @@ return function(sandbox) {
     
     var toggleItemViews = function(toggle) {
         itemViews.forEach(function(view) {
-            if(!historyItems.isSelected(view.item))
+            if(!historyItems.isSelected(view.item)) {
                 view.toggle(toggle);
+            }
         });
     };
     
@@ -116,7 +111,7 @@ return function(sandbox) {
             this.dimItem();
         } else if(historyItems.select(this.item)) {
             this.highlightItem();
-        }            
+        }
     };
     ItemView.prototype.highlightItem = function() {
         this.dom.addClass('highlighted');