mirror of
https://github.com/xevidos/codiad.git
synced 2024-11-10 21:26:35 +01:00
Re added openInBrowser as preview, Fixed non patch save content, Fixed display context menu on editor
This commit is contained in:
parent
1a47ed2b98
commit
806dbec3b7
@ -537,14 +537,14 @@
|
||||
} else {
|
||||
|
||||
console.log( "calling save while failed diff", path, newContent, alerts );
|
||||
codiad.filemanager.save_file( path, newContent, alerts )
|
||||
codiad.filemanager.save_file( path, {content: newContent}, alerts )
|
||||
.then( handleSuccess );
|
||||
}
|
||||
}, this );
|
||||
} else {
|
||||
|
||||
console.log( "calling save without mtime and untainted", path, newContent, alerts );
|
||||
codiad.filemanager.save_file( path, newContent, alerts )
|
||||
codiad.filemanager.save_file( path, {content: newContent}, alerts )
|
||||
.then( handleSuccess );
|
||||
}
|
||||
},
|
||||
|
@ -297,7 +297,7 @@
|
||||
|
||||
let path = codiad.active.getPath();
|
||||
$( e.target ).attr( 'data-path', path );
|
||||
codiad.filemanager.contextMenuShow( e, path, 'editor', 'editor' );
|
||||
codiad.filemanager.display_context_menu( e, path, 'editor', 'editor' );
|
||||
$( this ).addClass( 'context-menu-active' );
|
||||
}
|
||||
});
|
||||
|
@ -606,7 +606,7 @@ class Filemanager extends Common {
|
||||
// OPEN IN BROWSER (Return URL)
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
public function openinbrowser( $path ) {
|
||||
public function preview( $path ) {
|
||||
|
||||
$protocol = ( ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] != 'off' ) || $_SERVER['SERVER_PORT'] == 443 ) ? "https://" : "http://";
|
||||
$domainName = $_SERVER['HTTP_HOST'];
|
||||
|
@ -229,9 +229,9 @@ switch( $action ) {
|
||||
$response = $Filemanager->open( $path );
|
||||
break;
|
||||
|
||||
case 'open_in_browser':
|
||||
case 'preview':
|
||||
|
||||
$response = $Filemanager->openinbrowser( $path );
|
||||
$response = $Filemanager->preview( $path );
|
||||
break;
|
||||
|
||||
case 'rename':
|
||||
|
@ -1346,7 +1346,36 @@
|
||||
|
||||
preview: function( path ) {
|
||||
|
||||
let _this = this;
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: _this.controller + '?action=preview&path=' + encodeURIComponent( path ),
|
||||
success: function( data ) {
|
||||
|
||||
console.log( data );
|
||||
let r = JSON.parse( data );
|
||||
|
||||
if( r.status === "success" ) {
|
||||
|
||||
_this.preview = window.open( r.data, '_newtab' );
|
||||
|
||||
let editor = codiad.editor.getActive();
|
||||
|
||||
if( _this.auto_reload && editor !== null ) {
|
||||
|
||||
editor.addEventListener( "change", _this.refresh_preview );
|
||||
}
|
||||
} else {
|
||||
|
||||
codiad.message.error( i18n( r.message ) );
|
||||
}
|
||||
},
|
||||
error: function( data ) {
|
||||
|
||||
codiad.message.error( i18n( r.message ) );
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
rescan: function( path ) {
|
||||
|
Loading…
Reference in New Issue
Block a user