From 1e1726f3e285cf314f68b343b1141d8f91ceffd1 Mon Sep 17 00:00:00 2001 From: xevidos Date: Tue, 22 Jan 2019 14:21:20 -0500 Subject: [PATCH] Fixed issue where context menu showed incorrect slides, Fixed accidental closing of context menu, Fixed update message not showing. --- components/filemanager/context_menu.json | 2 +- components/filemanager/init.js | 43 +++++++++++++++--------- components/update/class.update.php | 4 +-- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/components/filemanager/context_menu.json b/components/filemanager/context_menu.json index fcfe032..7bd5be9 100755 --- a/components/filemanager/context_menu.json +++ b/components/filemanager/context_menu.json @@ -110,7 +110,7 @@ { "title": "Break", "icon": null, - "applies-to" : "both no-external", + "applies-to" : "directory-only", "onclick": null }, { diff --git a/components/filemanager/init.js b/components/filemanager/init.js index 62935c6..872db44 100755 --- a/components/filemanager/init.js +++ b/components/filemanager/init.js @@ -152,29 +152,20 @@ contextMenuShow: function(e, path, type, name) { var _this = this; - + + $('#context-menu a, #context-menu hr').hide(); // Selective options switch (type) { case 'directory': - $('#context-menu .directory-only, #context-menu .non-root') - .show(); - $('#context-menu .file-only, #context-menu .root-only') - .hide(); + $('#context-menu .directory-only, #context-menu .non-root, #context-menu .both').show(); break; case 'file': - $('#context-menu .directory-only, #context-menu .root-only') - .hide(); - $('#context-menu .file-only,#context-menu .non-root') - .show(); + $('#context-menu .file-only, #context-menu .non-root, #context-menu .both').show(); break; case 'root': - $('#context-menu .directory-only, #context-menu .root-only') - .show(); - $('#context-menu .non-root, #context-menu .file-only') - .hide(); + $('#context-menu .directory-only, #context-menu .root-only').show(); break; case 'editor': - $('#context-menu a, #context-menu hr').hide(); $('#context-menu .editor-only').show(); break; } @@ -216,7 +207,12 @@ // Hide menu $('#file-manager, #editor-region') .on('mouseover', function() { - _this.contextMenuHide(); + + /** + * make sure that the user has moved their mouse far enough + * away from the context menu to warrant a close. + */ + $('#file-manager, #editor-region').on( 'mousemove', codiad.filemanager.contextCheckMouse ); }); /* Notify listeners. */ amplify.publish('context-menu.onShow', {e: e, path: path, type: type}); @@ -226,7 +222,22 @@ _this.contextMenuHide(); }); }, - + + contextCheckMouse: function( e ) { + + let offset = $('#context-menu').offset(); + let bottom = offset.top + $('#context-menu').outerHeight( true ) + 10; + let left = offset.left - 10; + let right = offset.left + $('#context-menu').outerWidth( true ) + 10; + let top = offset.top - 10; + console.log( e ); + if( ( e.clientX > right || e.clientX < left ) || ( e.clientY > bottom || e.clientY < top ) ) { + + $('#file-manager, #editor-region').off( 'mousemove', codiad.filemanager.contextCheckMouse ); + codiad.filemanager.contextMenuHide(); + } + }, + contextMenuHide: function() { $('#context-menu') .fadeOut(200); diff --git a/components/update/class.update.php b/components/update/class.update.php index aa2a7b2..7088190 100755 --- a/components/update/class.update.php +++ b/components/update/class.update.php @@ -12,7 +12,7 @@ class Update { // CONSTANTS ////////////////////////////////////////////////////////////////// - CONST VERSION = "v.2.9.3.3"; + CONST VERSION = "v.2.9.3.4"; ////////////////////////////////////////////////////////////////// // PROPERTIES @@ -148,7 +148,7 @@ class Update { //echo var_dump( $response ); //return "[".formatJSEND("success", array("currentversion"=>$local[0]['version'],"remoteversion"=>$latest,"message"=>$message,"archive"=>$archive,"nightly"=>$nightly,"name"=>$local[0]['name']))."]"; - return "[".formatJSEND("success", array("currentversion"=>$current_version,"remoteversion"=>$response["name"],"message"=>$response["release"]["description"],"archive"=>$archive,"nightly"=>$nightly,"name"=>$response["commit"]["author_name"]))."]"; + return "[".formatJSEND("success", array("currentversion"=>$current_version,"remoteversion"=>$response["name"],"message"=>$response["message"],"archive"=>$archive,"nightly"=>$nightly,"name"=>$response["commit"]["author_name"]))."]"; } function CheckProtocol() {