mirror of
https://github.com/xevidos/codiad.git
synced 2024-09-21 10:21:32 +02:00
Reformatted Active, Fixed some formatting on Filemanager, Reformatted editor.
This commit is contained in:
parent
01d17f2698
commit
101f62a93d
@ -4,7 +4,6 @@
|
|||||||
* warranty under the MIT License. See [root]/license.txt for more.
|
* warranty under the MIT License. See [root]/license.txt for more.
|
||||||
* This information must remain intact.
|
* This information must remain intact.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
( function( global, $ ) {
|
( function( global, $ ) {
|
||||||
|
|
||||||
var EditSession = ace.require( 'ace/edit_session' )
|
var EditSession = ace.require( 'ace/edit_session' )
|
||||||
@ -59,7 +58,10 @@
|
|||||||
|
|
||||||
//}
|
//}
|
||||||
/* Notify listeners. */
|
/* Notify listeners. */
|
||||||
amplify.publish('active.onFileWillOpen', {path: path, content: content});
|
amplify.publish( 'active.onFileWillOpen', {
|
||||||
|
path: path,
|
||||||
|
content: content
|
||||||
|
});
|
||||||
|
|
||||||
if( focus === undefined ) {
|
if( focus === undefined ) {
|
||||||
focus = true;
|
focus = true;
|
||||||
@ -403,7 +405,10 @@
|
|||||||
let _this = this;
|
let _this = this;
|
||||||
codiad.editor.setSession( this.sessions[path] );
|
codiad.editor.setSession( this.sessions[path] );
|
||||||
this.history.push( path );
|
this.history.push( path );
|
||||||
$.get(this.controller, {'action':'focused', 'path':path}, function() {
|
$.get( this.controller, {
|
||||||
|
'action': 'focused',
|
||||||
|
'path': path
|
||||||
|
}, function() {
|
||||||
|
|
||||||
if( !( _this.positions[`${path}`] === undefined ) ) {
|
if( !( _this.positions[`${path}`] === undefined ) ) {
|
||||||
|
|
||||||
@ -448,8 +453,7 @@
|
|||||||
/* Show the dropdown menu if needed */
|
/* Show the dropdown menu if needed */
|
||||||
this.showTabDropdownMenu();
|
this.showTabDropdownMenu();
|
||||||
}
|
}
|
||||||
}
|
} else if( this.history.length > 0 ) {
|
||||||
else if(this.history.length > 0) {
|
|
||||||
var prevPath = this.history[this.history.length - 1];
|
var prevPath = this.history[this.history.length - 1];
|
||||||
var prevSession = this.sessions[prevPath];
|
var prevSession = this.sessions[prevPath];
|
||||||
if( $( '#dropdown-list-active-files' ).has( prevSession.tabThumb ).length > 0 ) {
|
if( $( '#dropdown-list-active-files' ).has( prevSession.tabThumb ).length > 0 ) {
|
||||||
@ -611,7 +615,9 @@
|
|||||||
|
|
||||||
/* Animate only if the tabThumb if a tab, not a dropdown item. */
|
/* Animate only if the tabThumb if a tab, not a dropdown item. */
|
||||||
if( session.tabThumb.hasClass( 'tab-item' ) ) {
|
if( session.tabThumb.hasClass( 'tab-item' ) ) {
|
||||||
session.tabThumb.css({'z-index': 1});
|
session.tabThumb.css( {
|
||||||
|
'z-index': 1
|
||||||
|
});
|
||||||
session.tabThumb.animate( {
|
session.tabThumb.animate( {
|
||||||
top: $( '#editor-top-bar' ).height() + 'px'
|
top: $( '#editor-top-bar' ).height() + 'px'
|
||||||
}, 300, function() {
|
}, 300, function() {
|
||||||
@ -714,7 +720,10 @@
|
|||||||
}
|
}
|
||||||
$.get( this.controller + '?action=rename&old_path=' + encodeURIComponent( oldPath ) + '&new_path=' + encodeURIComponent( newPath ), function() {
|
$.get( this.controller + '?action=rename&old_path=' + encodeURIComponent( oldPath ) + '&new_path=' + encodeURIComponent( newPath ), function() {
|
||||||
/* Notify listeners. */
|
/* Notify listeners. */
|
||||||
amplify.publish('active.onRename', {"oldPath": oldPath, "newPath": newPath});
|
amplify.publish( 'active.onRename', {
|
||||||
|
"oldPath": oldPath,
|
||||||
|
"newPath": newPath
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1010,8 +1019,7 @@
|
|||||||
data: {
|
data: {
|
||||||
positions: ( JSON.stringify( codiad.active.positions ) )
|
positions: ( JSON.stringify( codiad.active.positions ) )
|
||||||
},
|
},
|
||||||
success: function( data ) {
|
success: function( data ) {},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1097,16 +1105,16 @@
|
|||||||
|
|
||||||
createTabThumb: function( path ) {
|
createTabThumb: function( path ) {
|
||||||
split = this.splitDirectoryAndFileName( path );
|
split = this.splitDirectoryAndFileName( path );
|
||||||
return $('<li class="tab-item" data-path="' + path + '"><a class="label" title="' + path + '">'
|
return $( '<li class="tab-item" data-path="' + path + '"><a class="label" title="' + path + '">' +
|
||||||
+ split.directory + '<span class="file-name">' + split.fileName + '</span>'
|
split.directory + '<span class="file-name">' + split.fileName + '</span>' +
|
||||||
+ '</a><a class="close">x</a></li>');
|
'</a><a class="close">x</a></li>' );
|
||||||
},
|
},
|
||||||
|
|
||||||
createMenuItemThumb: function( path ) {
|
createMenuItemThumb: function( path ) {
|
||||||
split = this.splitDirectoryAndFileName( path );
|
split = this.splitDirectoryAndFileName( path );
|
||||||
return $('<li data-path="' + path + '"><a title="' + path + '"><span class="label"></span><div class="label">'
|
return $( '<li data-path="' + path + '"><a title="' + path + '"><span class="label"></span><div class="label">' +
|
||||||
+ split.directory + '<span class="file-name">' + split.fileName + '</span>'
|
split.directory + '<span class="file-name">' + split.fileName + '</span>' +
|
||||||
+ '</div></a></li>');
|
'</div></a></li>' );
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
* as-is and without warranty under the MIT License. See
|
* as-is and without warranty under the MIT License. See
|
||||||
* [root]/license.txt for more. This information must remain intact.
|
* [root]/license.txt for more. This information must remain intact.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
( function( global, $ ) {
|
( function( global, $ ) {
|
||||||
|
|
||||||
// Classes from Ace
|
// Classes from Ace
|
||||||
@ -46,10 +45,10 @@
|
|||||||
if( _this.splitType === 'horizontal' ) {
|
if( _this.splitType === 'horizontal' ) {
|
||||||
var w1, w2;
|
var w1, w2;
|
||||||
w1 = ui.position.left - separatorWidth / 2;
|
w1 = ui.position.left - separatorWidth / 2;
|
||||||
w2 = _this.root.width() - ui.position.left
|
w2 = _this.root.width() - ui.position.left -
|
||||||
- separatorWidth/2;
|
separatorWidth / 2;
|
||||||
_this.splitProp = w1 / _this.root.width();
|
_this.splitProp = w1 / _this.root.width();
|
||||||
_this.childElements[0]
|
_this.childElements[0
|
||||||
.width( w1 )
|
.width( w1 )
|
||||||
.trigger( 'h-resize', [true, true] );
|
.trigger( 'h-resize', [true, true] );
|
||||||
_this.childElements[1]
|
_this.childElements[1]
|
||||||
@ -60,8 +59,8 @@
|
|||||||
} else {
|
} else {
|
||||||
var h1, h2;
|
var h1, h2;
|
||||||
h1 = ui.position.top - separatorWidth / 2;
|
h1 = ui.position.top - separatorWidth / 2;
|
||||||
h2 = _this.root.width() - ui.position.top
|
h2 = _this.root.width() - ui.position.top -
|
||||||
- separatorWidth/2;
|
separatorWidth / 2;
|
||||||
_this.splitProp = h1 / _this.root.height();
|
_this.splitProp = h1 / _this.root.height();
|
||||||
_this.childElements[0]
|
_this.childElements[0]
|
||||||
.height( h1 )
|
.height( h1 )
|
||||||
@ -90,10 +89,10 @@
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if( _this.splitType === 'horizontal' ) {
|
if( _this.splitType === 'horizontal' ) {
|
||||||
var w1, w2;
|
var w1, w2;
|
||||||
w1 = _this.root.width() * _this.splitProp
|
w1 = _this.root.width() * _this.splitProp -
|
||||||
- separatorWidth / 2;
|
separatorWidth / 2;
|
||||||
w2 = _this.root.width() * (1 - _this.splitProp)
|
w2 = _this.root.width() * ( 1 - _this.splitProp ) -
|
||||||
- separatorWidth / 2;
|
separatorWidth / 2;
|
||||||
_this.childElements[0]
|
_this.childElements[0]
|
||||||
.width( w1 );
|
.width( w1 );
|
||||||
_this.childElements[1]
|
_this.childElements[1]
|
||||||
@ -132,10 +131,10 @@
|
|||||||
.height( h );
|
.height( h );
|
||||||
_this.splitter.height( h );
|
_this.splitter.height( h );
|
||||||
} else if( _this.splitType === 'vertical' ) {
|
} else if( _this.splitType === 'vertical' ) {
|
||||||
var h1 = _this.root.height() * _this.splitProp
|
var h1 = _this.root.height() * _this.splitProp -
|
||||||
- separatorWidth / 2;
|
separatorWidth / 2;
|
||||||
var h2 = _this.root.height() * (1 - _this.splitProp)
|
var h2 = _this.root.height() * ( 1 - _this.splitProp ) -
|
||||||
- separatorWidth / 2;
|
separatorWidth / 2;
|
||||||
_this.childElements[0]
|
_this.childElements[0]
|
||||||
.height( h1 );
|
.height( h1 );
|
||||||
_this.childElements[1]
|
_this.childElements[1]
|
||||||
@ -410,7 +409,9 @@
|
|||||||
|
|
||||||
addInstance: function( session, where ) {
|
addInstance: function( session, where ) {
|
||||||
var el = $( '<div class="editor">' );
|
var el = $( '<div class="editor">' );
|
||||||
var chType, chArr = [], sc = null, chIdx = null;
|
var chType, chArr = [],
|
||||||
|
sc = null,
|
||||||
|
chIdx = null;
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
if( this.instances.length == 0 ) {
|
if( this.instances.length == 0 ) {
|
||||||
@ -1282,10 +1283,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$( '#cursor-position' )
|
$( '#cursor-position' )
|
||||||
.html(i18n('Ln') + ': '
|
.html( i18n( 'Ln' ) + ': ' +
|
||||||
+ (i.getCursorPosition().row + 1)
|
( i.getCursorPosition().row + 1 ) +
|
||||||
+ ' · ' + i18n('Col') + ': '
|
' · ' + i18n( 'Col' ) + ': ' +
|
||||||
+ i.getCursorPosition().column
|
i.getCursorPosition().column
|
||||||
);
|
);
|
||||||
|
|
||||||
//Register the changecursor function so updates continue
|
//Register the changecursor function so updates continue
|
||||||
@ -1293,10 +1294,10 @@
|
|||||||
|
|
||||||
codiad.active.savePosition();
|
codiad.active.savePosition();
|
||||||
$( '#cursor-position' )
|
$( '#cursor-position' )
|
||||||
.html(i18n('Ln') + ': '
|
.html( i18n( 'Ln' ) + ': ' +
|
||||||
+ (i.getCursorPosition().row + 1)
|
( i.getCursorPosition().row + 1 ) +
|
||||||
+ ' · ' + i18n('Col') + ': '
|
' · ' + i18n( 'Col' ) + ': ' +
|
||||||
+ i.getCursorPosition().column
|
i.getCursorPosition().column
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -1549,7 +1550,9 @@
|
|||||||
|
|
||||||
paste: function() {
|
paste: function() {
|
||||||
|
|
||||||
navigator.clipboard.readText().then(text => {codiad.editor.getActive().insert( text )});
|
navigator.clipboard.readText().then( text => {
|
||||||
|
codiad.editor.getActive().insert( text )
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
openSort: function() {
|
openSort: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user