* Re-attach events when switching between menu

This commit is contained in:
Bryan Ashby 2015-07-09 16:28:44 -06:00
parent eea09dd3b3
commit 52288a6162
2 changed files with 15 additions and 8 deletions

View File

@ -1052,7 +1052,7 @@ MultiLineEditTextView.prototype.setText = function(text) {
//this.textLines = [ { text : '' } ]; //this.textLines = [ { text : '' } ];
//this.insertRawText(''); //this.insertRawText('');
//text = "Tab:\r\n\tA\tB\tC\tD\tE\tF\tG\r\n reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally long word!!!"; //text = "Tab:\r\n\tA\tB\tC\tD\tE\tF\tG\r\n reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally long word!!!";
text = require('fs').readFileSync('/home/nuskooler/Downloads/test_text.txt', { encoding : 'utf-8'}); text = require('fs').readFileSync('/home/bashby/Downloads/test_text.txt', { encoding : 'utf-8'});
this.insertRawText(text);//, 0, 0); this.insertRawText(text);//, 0, 0);
this.cursorEndOfDocument(); this.cursorEndOfDocument();

View File

@ -231,19 +231,25 @@ function FullScreenEditorModule(options) {
} }
}; };
this.observeEditEvents = function() {
var bodyView = self.getBodyView();
bodyView.on('edit position', function cursorPosUpdate(pos) {
self.updateEditModePosition(pos);
});
bodyView.on('text edit mode', function textEditMode(mode) {
self.updateTextEditMode(mode);
});
};
this.menuMethods = { this.menuMethods = {
headerSubmit : function(formData, extraArgs) { headerSubmit : function(formData, extraArgs) {
self.viewControllers.header.setFocus(false); self.viewControllers.header.setFocus(false);
self.viewControllers.body.switchFocus(1); self.viewControllers.body.switchFocus(1);
self.getBodyView().on('edit position', function cursorPosUpdate(pos) { self.observeEditEvents();
self.updateEditModePosition(pos);
});
self.getBodyView().on('text edit mode', function textEditMode(mode) {
self.updateTextEditMode(mode);
});
}, },
editModeEscPressed : function(formData, extraArgs) { editModeEscPressed : function(formData, extraArgs) {
console.log('editorModeBefore=' + self.editorMode) console.log('editorModeBefore=' + self.editorMode)
@ -261,6 +267,7 @@ function FullScreenEditorModule(options) {
self.viewControllers.footerEditMenu.setFocus(false); self.viewControllers.footerEditMenu.setFocus(false);
} }
self.viewControllers.body.switchFocus(1); self.viewControllers.body.switchFocus(1);
self.observeEditEvents();
break; break;
case 'editMenu' : case 'editMenu' :