Merge branch 'development' into 'master'

Fixed issue where context menu showed incorrect slides, Fixed accidental...

See merge request xevidos/codiad!25
This commit is contained in:
Isaac Brown 2019-01-22 14:22:14 -05:00
commit e97b893c4c
3 changed files with 30 additions and 19 deletions

View file

@ -110,7 +110,7 @@
{ {
"title": "Break", "title": "Break",
"icon": null, "icon": null,
"applies-to" : "both no-external", "applies-to" : "directory-only",
"onclick": null "onclick": null
}, },
{ {

View file

@ -153,28 +153,19 @@
contextMenuShow: function(e, path, type, name) { contextMenuShow: function(e, path, type, name) {
var _this = this; var _this = this;
$('#context-menu a, #context-menu hr').hide();
// Selective options // Selective options
switch (type) { switch (type) {
case 'directory': case 'directory':
$('#context-menu .directory-only, #context-menu .non-root') $('#context-menu .directory-only, #context-menu .non-root, #context-menu .both').show();
.show();
$('#context-menu .file-only, #context-menu .root-only')
.hide();
break; break;
case 'file': case 'file':
$('#context-menu .directory-only, #context-menu .root-only') $('#context-menu .file-only, #context-menu .non-root, #context-menu .both').show();
.hide();
$('#context-menu .file-only,#context-menu .non-root')
.show();
break; break;
case 'root': case 'root':
$('#context-menu .directory-only, #context-menu .root-only') $('#context-menu .directory-only, #context-menu .root-only').show();
.show();
$('#context-menu .non-root, #context-menu .file-only')
.hide();
break; break;
case 'editor': case 'editor':
$('#context-menu a, #context-menu hr').hide();
$('#context-menu .editor-only').show(); $('#context-menu .editor-only').show();
break; break;
} }
@ -216,7 +207,12 @@
// Hide menu // Hide menu
$('#file-manager, #editor-region') $('#file-manager, #editor-region')
.on('mouseover', function() { .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. */ /* Notify listeners. */
amplify.publish('context-menu.onShow', {e: e, path: path, type: type}); amplify.publish('context-menu.onShow', {e: e, path: path, type: type});
@ -227,6 +223,21 @@
}); });
}, },
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() { contextMenuHide: function() {
$('#context-menu') $('#context-menu')
.fadeOut(200); .fadeOut(200);

View file

@ -12,7 +12,7 @@ class Update {
// CONSTANTS // CONSTANTS
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
CONST VERSION = "v.2.9.3.3"; CONST VERSION = "v.2.9.3.4";
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// PROPERTIES // PROPERTIES
@ -148,7 +148,7 @@ class Update {
//echo var_dump( $response ); //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"=>$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() { function CheckProtocol() {