smartxml: fix - merge newly adjacent text nodes on middle element node moved
[fnpeditor.git] / src / editor / modules / rng / rng.js
index e15c94b..dba2d2f 100644 (file)
@@ -97,21 +97,22 @@ return function(sandbox) {
     
     eventHandlers.data = {
         ready: function(usingDraft, draftTimestamp) {
     
     eventHandlers.data = {
         ready: function(usingDraft, draftTimestamp) {
+            wlxmlDocument = sandbox.getModule('data').getDocument();
+
             views.mainLayout.setView('mainView', views.mainTabs.getAsView());
             
             views.mainLayout.setView('mainView', views.mainTabs.getAsView());
             
-            documentSummary.init(sandbox.getConfig().documentSummaryView);
-            documentSummary.render(sandbox.getModule('data').getDocumentProperties());
+            documentSummary.init(sandbox.getConfig().documentSummaryView, wlxmlDocument);
+            documentSummary.render();
             documentSummary.setDraftField(usingDraft ? (draftTimestamp || '???') : '-');
             views.currentNodePaneLayout.appendView(documentSummary.dom);
 
             sandbox.getModule('mainBar').setCommandEnabled('drop-draft', usingDraft);
             sandbox.getModule('mainBar').setCommandEnabled('save', usingDraft);
 
             documentSummary.setDraftField(usingDraft ? (draftTimestamp || '???') : '-');
             views.currentNodePaneLayout.appendView(documentSummary.dom);
 
             sandbox.getModule('mainBar').setCommandEnabled('drop-draft', usingDraft);
             sandbox.getModule('mainBar').setCommandEnabled('save', usingDraft);
 
-            _.each(['sourceEditor', 'documentCanvas', 'documentToolbar', 'metadataEditor', 'nodeBreadCrumbs', 'mainBar', 'indicator', 'documentHistory', 'diffViewer'], function(moduleName) {
+            _.each(['sourceEditor', 'documentCanvas', 'documentToolbar', 'metadataEditor', 'nodeBreadCrumbs', 'mainBar', 'indicator', 'documentHistory', 'diffViewer', 'statusBar'], function(moduleName) {
                 sandbox.getModule(moduleName).start();
             });
             
                 sandbox.getModule(moduleName).start();
             });
             
-            wlxmlDocument = sandbox.getModule('data').getDocument();
             documentIsDirty = false;
             wlxmlDocument.on('change', function() {
                 documentIsDirty = true;
             documentIsDirty = false;
             wlxmlDocument.on('change', function() {
                 documentIsDirty = true;
@@ -144,8 +145,6 @@ return function(sandbox) {
             
             sandbox.getModule('indicator').clearMessage({message: msg[what]});
             if(status === 'success' && what === 'remote') {
             
             sandbox.getModule('indicator').clearMessage({message: msg[what]});
             if(status === 'success' && what === 'remote') {
-                sandbox.getModule('mainBar').setVersion(data.version);
-                documentSummary.render(data);
                 documentSummary.setDraftField('-');
                 sandbox.getModule('mainBar').setCommandEnabled('drop-draft', false);
                 sandbox.getModule('mainBar').setCommandEnabled('save', false);
                 documentSummary.setDraftField('-');
                 sandbox.getModule('mainBar').setCommandEnabled('drop-draft', false);
                 sandbox.getModule('mainBar').setCommandEnabled('save', false);
@@ -169,13 +168,11 @@ return function(sandbox) {
         documentReverted: function(version) {
             documentIsDirty = false;
             sandbox.getModule('indicator').clearMessage({message:'Wersja ' + version + ' przywrócona'});
         documentReverted: function(version) {
             documentIsDirty = false;
             sandbox.getModule('indicator').clearMessage({message:'Wersja ' + version + ' przywrócona'});
-            sandbox.getModule('mainBar').setVersion(version);
         }
     };
     
     eventHandlers.mainBar = {
         ready: function() {
         }
     };
     
     eventHandlers.mainBar = {
         ready: function() {
-            sandbox.getModule('mainBar').setVersion(sandbox.getModule('data').getDocumentProperties().version);
             views.mainLayout.setView('topPanel', sandbox.getModule('mainBar').getView());
         },
         'cmd.save': function() {
             views.mainLayout.setView('topPanel', sandbox.getModule('mainBar').getView());
         },
         'cmd.save': function() {
@@ -294,6 +291,21 @@ return function(sandbox) {
         }
     };
 
         }
     };
 
+    eventHandlers.statusBar = {
+        ready: function() {
+            views.mainLayout.setView('bottomPanel', sandbox.getModule('statusBar').getView());
+        }
+    };
+
+    eventHandlers.__all__ = {
+        actionHovered: function(action) {
+            sandbox.getModule('statusBar').showAction(action);
+        },
+        actionOff: function() {
+            sandbox.getModule('statusBar').clearAction();
+        }
+    };
+
     window.addEventListener('beforeunload', function(event) {
         var txt = gettext('Do you really want to exit?');
         if(documentIsDirty) {
     window.addEventListener('beforeunload', function(event) {
         var txt = gettext('Do you really want to exit?');
         if(documentIsDirty) {
@@ -319,10 +331,16 @@ return function(sandbox) {
             if(eventHandlers[moduleName] && eventHandlers[moduleName][eventName]) {
                 logger.debug('Handling event ' + eventRepr);
                 eventHandlers[moduleName][eventName].apply(eventHandlers, args);
             if(eventHandlers[moduleName] && eventHandlers[moduleName][eventName]) {
                 logger.debug('Handling event ' + eventRepr);
                 eventHandlers[moduleName][eventName].apply(eventHandlers, args);
-            } else {
-                logger.warning('No event handler for ' + eventRepr);
+                return;
+            }
+
+            if(eventHandlers.__all__[eventName]) {
+                logger.debug('Handling event ' + eventRepr);
+                eventHandlers.__all__[eventName].apply(eventHandlers.__all__, args);
+                return;
             }
 
             }
 
+            logger.warning('No event handler for ' + eventRepr);
         }
     };
 };
         }
     };
 };