Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix editor.text & editor.codemirror for various focused fields to dis…
Browse files Browse the repository at this point in the history
…able key bindings. Fix #462
  • Loading branch information
cdujeu committed Feb 18, 2014
1 parent e6194c7 commit 6675811
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
18 changes: 13 additions & 5 deletions core/src/plugins/editor.codemirror/class.CodeMirrorEditor.js
Expand Up @@ -67,14 +67,17 @@ Class.create("CodeMirrorEditor", AbstractEditor, {
}
return false;
}.bind(this));

this.element.down('#goto_line').observe('keypress', function(event){

var gotoLine = this.element.down('#goto_line');
gotoLine.observe('keypress', function(event){
if(event.keyCode == Event.KEY_RETURN && this.codeMirror){
this.codeMirror.jumpToLine(parseInt(event.target.value));
}
}.bind(this) );

this.element.down('#text_search').observe('keypress', function(event){

var textSearch = this.element.down('#text_search');

textSearch.observe('keypress', function(event){
if(event.keyCode == Event.KEY_RETURN && this.codeMirror){
var cursor;
if(this.currentSearch && this.currentSearch == event.target.value && this.currentCursor){
Expand All @@ -92,7 +95,12 @@ Class.create("CodeMirrorEditor", AbstractEditor, {
}
}
}.bind(this) );


textSearch.observe("focus", function(){ajaxplorer.disableAllKeyBindings()});
textSearch.observe("blur", function(){ajaxplorer.enableAllKeyBindings()});
gotoLine.observe("focus", function(){ajaxplorer.disableAllKeyBindings()});
gotoLine.observe("blur", function(){ajaxplorer.enableAllKeyBindings()});

// Remove python rule, if any
$$('link[href="plugins/editor.codemirror/css/linenumbers-py.css"]').invoke('remove');

Expand Down
6 changes: 6 additions & 0 deletions core/src/plugins/editor.text/class.TextEditor.js
Expand Up @@ -63,6 +63,12 @@ Class.create("TextEditor", AbstractEditor, {
this.element.observeOnce("editor:close", function(){
//ajaxplorer.fireNodeRefresh(nodeOrNodes);
});
this.textarea.observe("focus", function(){
ajaxplorer.disableAllKeyBindings()
});
this.textarea.observe("blur", function(){
ajaxplorer.enableAllKeyBindings()
});
},

loadFileContent : function(fileName){
Expand Down

0 comments on commit 6675811

Please sign in to comment.