diff options
author | Tom Needham <needham.thomas@gmail.com> | 2011-10-21 21:22:06 +0100 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2011-10-21 21:22:06 +0100 |
commit | ba3d139de856de2e2a7c8f92f0dbf7bba3905bbd (patch) | |
tree | ecc4c309d2da5283b79f398e996366926fa3e9fe /apps/files_texteditor | |
parent | 9bde002c95e35c84c2c53ddbf5f3d196cff5812d (diff) | |
parent | c420001f2b28a619fe844d7366ae3984b38021e9 (diff) | |
download | nextcloud-server-ba3d139de856de2e2a7c8f92f0dbf7bba3905bbd.tar.gz nextcloud-server-ba3d139de856de2e2a7c8f92f0dbf7bba3905bbd.zip |
Merged from master and fixed issue with opening multiple editors
Diffstat (limited to 'apps/files_texteditor')
-rw-r--r-- | apps/files_texteditor/js/editor.js | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/apps/files_texteditor/js/editor.js b/apps/files_texteditor/js/editor.js index a2581d4143f..e3581a16a6d 100644 --- a/apps/files_texteditor/js/editor.js +++ b/apps/files_texteditor/js/editor.js @@ -63,27 +63,18 @@ function showControls(filename){ function bindControlEvents(){ $("#editor_save").live('click',function() { - if(editorIsShown()){ + if(is_editor_shown){ doFileSave(); } }); $('#editor_close').live('click',function() { - if(editorIsShown()){ + if(is_editor_shown){ hideFileEditor(); } }); } -function editorIsShown(){ - // Not working as intended. - if($('#editor').attr('editorshown')=='true'){ - return true; - } else { - return false; - } -} - function updateSessionFileHash(path){ $.get(OC.filePath('files_texteditor','ajax','loadfile.php'), { path: path }, @@ -94,7 +85,7 @@ function updateSessionFileHash(path){ }, "json");} function doFileSave(){ - if(editorIsShown()){ + if(is_editor_shown){ $('#editor_save').after('<img id="saving_icon" src="'+OC.filePath('core','img','loading.gif')+'"></img>'); var filecontents = window.aceEditor.getSession().getValue(); var dir = $('#editor').attr('data-dir'); @@ -154,13 +145,12 @@ function giveEditorFocus(){ }; function showFileEditor(dir,filename){ - if(!editorIsShown()){ + if(!is_editor_shown){ // Loads the file editor and display it. var data = $.ajax({ url: OC.filePath('files','ajax','download.php')+'?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent(dir), complete: function(data){ // Initialise the editor - $('#editor').attr('editorshown','true'); updateSessionFileHash(dir+'/'+filename); showControls(filename); $('table').fadeOut('slow', function() { @@ -180,6 +170,7 @@ function showFileEditor(dir,filename){ } // End ajax }); + is_editor_shown = true; } } @@ -201,11 +192,13 @@ function hideFileEditor(){ $('.actions,#file_access_panel').fadeIn('slow'); $('table').fadeIn('slow'); }); + is_editor_shown = false; } $(window).resize(function() { setEditorSize(); }); +var is_editor_shown = false; $(document).ready(function(){ if(typeof FileActions!=='undefined'){ @@ -226,6 +219,7 @@ $(document).ready(function(){ a.click(function(){ var file=text.split('/').pop(); var dir=text.substr(0,text.length-file.length-1); + // TODO this will only work in the files app. showFileEditor(dir,file); }); } |