+ toggleGrid: function(toggle) {\r
+ sandbox.getModule('documentCanvas').toggleGrid(toggle);\r
+ },\r
+ newNodeRequested: function(wlxmlTag, wlxmlClass) {\r
+ if(window.getSelection().isCollapsed) {\r
+ sandbox.getModule('documentCanvas').insertNewNode(wlxmlTag, wlxmlClass);\r
+ } else {\r
+ sandbox.getModule('documentCanvas').wrapSelectionWithNewNode(wlxmlTag, wlxmlClass);\r
+ }\r
+ }\r
+ };\r
+ \r
+ eventHandlers.nodeBreadCrumbs = {\r
+ ready: function() {\r
+ views.visualEditing.setView('statusBar', sandbox.getModule('nodeBreadCrumbs').getView());\r
+ },\r
+ nodeHighlighted: function(wlxmlNode) {\r
+ commands.highlightDocumentNode(wlxmlNode, 'nodeBreadCrumbs');\r
+ },\r
+ nodeDimmed: function(wlxmlNode) {\r
+ commands.dimDocumentNode(wlxmlNode, 'nodeBreadCrumbs');\r
+ },\r
+ nodeSelected: function(wlxmlNode) {\r
+ commands.selectNode(wlxmlNode);\r
+ } \r
+ }\r
+ \r
+ eventHandlers.documentHistory = {\r
+ ready: function() {\r
+ sandbox.getModule('documentHistory').addHistory(sandbox.getModule('data').getHistory());\r
+ views.diffLayout.setView('left', sandbox.getModule('documentHistory').getView());\r
+ },\r
+ compare: function(ver1, ver2) {\r
+ sandbox.getModule('data').fetchDiff(ver1, ver2);\r
+ },\r
+ restoreVersion: function(event) {\r
+ sandbox.getModule('data').restoreVersion(event);\r
+ },\r
+ displayVersion: function(event) {\r
+ window.open('/' + gettext('editor') + '/' + sandbox.getModule('data').getDocumentId() + '?version=' + event.version, _.uniqueId());\r
+ }\r
+ }\r
+ \r
+ eventHandlers.diffViewer = {\r
+ ready: function() {\r
+ views.diffLayout.setView('right', sandbox.getModule('diffViewer').getView());\r