diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-08-01 15:24:40 +0400 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-08-01 15:24:40 +0400 |
commit | f2b9796e92a5c64f115b6d6e6c3a3a1fb329e088 (patch) | |
tree | fc3a374fd5258e5ebeacaa5f4d01278536fab47f | |
parent | ab96d2d633e176717de69b09518a35bc94cd7329 (diff) |
focus editor on (re)open, hide notification correctly (fixes reusing editor), use on instead of live
-rw-r--r-- | js/editor.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/js/editor.js b/js/editor.js index 5b659a7..c3aa3ee 100644 --- a/js/editor.js +++ b/js/editor.js @@ -82,11 +82,11 @@ function showControls(dir, filename, writeable) { } function bindControlEvents() { - $("#editor_save").die('click', doFileSave).live('click', doFileSave); - $('#editor_close').die('click', hideFileEditor).live('click', hideFileEditor); - $('#editorsearchval').die('keyup', doSearch).live('keyup', doSearch); - $('#clearsearchbtn').die('click', resetSearch).live('click', resetSearch); - $('#nextsearchbtn').die('click', nextSearchResult).live('click', nextSearchResult); + $('#content').on('click', '#editor_save', doFileSave); + $('#content').on('click', '#editor_close', hideFileEditor); + $('#content').on('keyup', '#editorsearchval', doSearch); + $('#content').on('click', '#clearsearchbtn', resetSearch); + $('#content').on('click', '#nextsearchbtn', nextSearchResult); } // returns true or false if the editor is in view or not @@ -191,6 +191,9 @@ function showFileEditor(dir, filename) { if (!editorIsShown()) { is_editor_shown = true; // Delete any old editors + if ($('#notification').data('reopeneditor')) { + OC.Notification.hide(); + } $('#editor').remove(); // Loads the file editor and display it. $('#content').append('<div id="editor"></div>'); @@ -246,6 +249,7 @@ function showFileEditor(dir, filename) { doFileSave(); } }); + giveEditorFocus(); } else { // Failed to get the file. OC.dialogs.alert(result.data.message, t('files_texteditor', 'An error occurred!')); @@ -294,6 +298,7 @@ function reopenEditor() { OC.Breadcrumb.push($('#editor').attr('data-filename') + ' *', '#'); document.title = $('#editor').attr('data-filename') + ' * - ownCloud'; is_editor_shown = true; + giveEditorFocus(); } // resizes the editor window @@ -352,7 +357,7 @@ $(document).ready(function () { $('#notification').click(function () { if ($('#notification').data('reopeneditor')) { reopenEditor(); + OC.Notification.hide(); } - $('#notification').fadeOut(); }); }); |