lexgui 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/codeeditor.js +201 -51
- package/build/lexgui.css +14 -9
- package/build/lexgui.js +1 -1
- package/build/lexgui.module.js +1 -1
- package/changelog.md +7 -0
- package/examples/code_editor.html +7 -7
- package/package.json +1 -1
|
@@ -201,6 +201,9 @@ class CodeEditor {
|
|
|
201
201
|
static WORD_TYPE_METHOD = 0;
|
|
202
202
|
static WORD_TYPE_CLASS = 1;
|
|
203
203
|
|
|
204
|
+
static CODE_MAX_FONT_SIZE = 20;
|
|
205
|
+
static CODE_MIN_FONT_SIZE = 11;
|
|
206
|
+
|
|
204
207
|
/**
|
|
205
208
|
* @param {*} options
|
|
206
209
|
* skip_info, allow_add_scripts, name
|
|
@@ -413,8 +416,16 @@ class CodeEditor {
|
|
|
413
416
|
});
|
|
414
417
|
|
|
415
418
|
this.codeScroller.addEventListener( 'wheel', e => {
|
|
416
|
-
|
|
417
|
-
|
|
419
|
+
if( e.ctrlKey )
|
|
420
|
+
{
|
|
421
|
+
e.preventDefault();
|
|
422
|
+
( e.deltaY > 0.0 ? this._decreaseFontSize() : this._increaseFontSize() );
|
|
423
|
+
}
|
|
424
|
+
else
|
|
425
|
+
{
|
|
426
|
+
const dX = ( e.deltaY > 0.0 ? 10.0 : -10.0 ) * ( e.shiftKey ? 1.0 : 0.0 );
|
|
427
|
+
if( dX != 0.0 ) this.setScrollBarValue( 'horizontal', dX );
|
|
428
|
+
}
|
|
418
429
|
});
|
|
419
430
|
}
|
|
420
431
|
|
|
@@ -470,6 +481,28 @@ class CodeEditor {
|
|
|
470
481
|
this.tabs.area.attach( box );
|
|
471
482
|
}
|
|
472
483
|
|
|
484
|
+
// Add search LINE box
|
|
485
|
+
{
|
|
486
|
+
var box = document.createElement( 'div' );
|
|
487
|
+
box.className = "searchbox gotoline";
|
|
488
|
+
|
|
489
|
+
var searchPanel = new LX.Panel();
|
|
490
|
+
box.appendChild( searchPanel.root );
|
|
491
|
+
|
|
492
|
+
searchPanel.addText( null, "", ( value, event ) => {
|
|
493
|
+
input.value = ":" + value.replaceAll( ':', '' );
|
|
494
|
+
this.goToLine( input.value.slice( 1 ) );
|
|
495
|
+
}, { placeholder: "Go to line", trigger: "input" } );
|
|
496
|
+
|
|
497
|
+
let input = box.querySelector( 'input' );
|
|
498
|
+
input.addEventListener( 'keyup', e => {
|
|
499
|
+
if( e.key == 'Escape' ) this.hideSearchLineBox();
|
|
500
|
+
} );
|
|
501
|
+
|
|
502
|
+
this.searchlinebox = box;
|
|
503
|
+
this.tabs.area.attach( box );
|
|
504
|
+
}
|
|
505
|
+
|
|
473
506
|
// Add code-sizer
|
|
474
507
|
{
|
|
475
508
|
this.codeSizer = document.createElement( 'div' );
|
|
@@ -503,7 +536,6 @@ class CodeEditor {
|
|
|
503
536
|
this.lineHeight = 20;
|
|
504
537
|
this.defaultSingleLineCommentToken = '//';
|
|
505
538
|
this.defaultBlockCommentTokens = [ '/*', '*/' ];
|
|
506
|
-
this.charWidth = 7; //this._measureChar();
|
|
507
539
|
this._lastTime = null;
|
|
508
540
|
|
|
509
541
|
this.pairKeys = {
|
|
@@ -790,7 +822,7 @@ class CodeEditor {
|
|
|
790
822
|
return;
|
|
791
823
|
}
|
|
792
824
|
|
|
793
|
-
this._addUndoStep( cursor );
|
|
825
|
+
this._addUndoStep( cursor, true );
|
|
794
826
|
|
|
795
827
|
var _c0 = this.getCharAtPos( cursor, -1 );
|
|
796
828
|
var _c1 = this.getCharAtPos( cursor );
|
|
@@ -1018,7 +1050,7 @@ class CodeEditor {
|
|
|
1018
1050
|
if( options.allow_add_scripts ?? true )
|
|
1019
1051
|
this.addTab("+", false, "New File");
|
|
1020
1052
|
|
|
1021
|
-
this.addTab(options.name || "untitled", true, options.title);
|
|
1053
|
+
this.addTab( options.name || "untitled", true, options.title );
|
|
1022
1054
|
|
|
1023
1055
|
// Create inspector panel
|
|
1024
1056
|
let panel = this._createPanelInfo();
|
|
@@ -1036,14 +1068,15 @@ class CodeEditor {
|
|
|
1036
1068
|
);
|
|
1037
1069
|
|
|
1038
1070
|
// Add to the document.fonts (FontFaceSet)
|
|
1039
|
-
document.fonts.add(commitMono);
|
|
1071
|
+
document.fonts.add( commitMono );
|
|
1040
1072
|
|
|
1041
1073
|
// Load the font
|
|
1042
1074
|
commitMono.load();
|
|
1043
1075
|
|
|
1044
1076
|
// Wait until the fonts are all loaded
|
|
1045
1077
|
document.fonts.ready.then(() => {
|
|
1046
|
-
console.log("commitMono loaded")
|
|
1078
|
+
// console.log("commitMono loaded")
|
|
1079
|
+
this.charWidth = this._measureChar( "a", true );
|
|
1047
1080
|
});
|
|
1048
1081
|
}
|
|
1049
1082
|
|
|
@@ -1201,23 +1234,32 @@ class CodeEditor {
|
|
|
1201
1234
|
}
|
|
1202
1235
|
}
|
|
1203
1236
|
|
|
1204
|
-
_addUndoStep( cursor ) {
|
|
1237
|
+
_addUndoStep( cursor, force, deleteRedo = true ) {
|
|
1205
1238
|
|
|
1206
1239
|
const d = new Date();
|
|
1207
1240
|
const current = d.getTime();
|
|
1208
1241
|
|
|
1209
|
-
if( !
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
if( ( current - this._lastTime ) > 3000 ){
|
|
1213
|
-
this._lastTime = null;
|
|
1214
|
-
} else {
|
|
1215
|
-
// If time not enough, reset timer
|
|
1242
|
+
if( !force )
|
|
1243
|
+
{
|
|
1244
|
+
if( !this._lastTime ) {
|
|
1216
1245
|
this._lastTime = current;
|
|
1217
|
-
|
|
1246
|
+
} else {
|
|
1247
|
+
if( ( current - this._lastTime ) > 3000 ){
|
|
1248
|
+
this._lastTime = null;
|
|
1249
|
+
} else {
|
|
1250
|
+
// If time not enough, reset timer
|
|
1251
|
+
this._lastTime = current;
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1218
1254
|
}
|
|
1219
1255
|
}
|
|
1220
1256
|
|
|
1257
|
+
if( deleteRedo )
|
|
1258
|
+
{
|
|
1259
|
+
// Remove all redo steps
|
|
1260
|
+
this.code.redoSteps.length = 0;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1221
1263
|
var cursor = cursor ?? this.cursors.children[ 0 ];
|
|
1222
1264
|
|
|
1223
1265
|
this.code.undoSteps.push( {
|
|
@@ -1228,6 +1270,18 @@ class CodeEditor {
|
|
|
1228
1270
|
} );
|
|
1229
1271
|
}
|
|
1230
1272
|
|
|
1273
|
+
_addRedoStep( cursor ) {
|
|
1274
|
+
|
|
1275
|
+
var cursor = cursor ?? this.cursors.children[ 0 ];
|
|
1276
|
+
|
|
1277
|
+
this.code.redoSteps.push( {
|
|
1278
|
+
lines: LX.deepCopy( this.code.lines ),
|
|
1279
|
+
cursor: this.saveCursor( cursor ),
|
|
1280
|
+
line: cursor.line,
|
|
1281
|
+
position: cursor.position
|
|
1282
|
+
} );
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1231
1285
|
_changeLanguage( lang ) {
|
|
1232
1286
|
|
|
1233
1287
|
this.code.language = lang;
|
|
@@ -1385,6 +1439,7 @@ class CodeEditor {
|
|
|
1385
1439
|
code.language = "Plain Text";
|
|
1386
1440
|
code.cursorState = {};
|
|
1387
1441
|
code.undoSteps = [];
|
|
1442
|
+
code.redoSteps = [];
|
|
1388
1443
|
code.tabName = name;
|
|
1389
1444
|
code.title = title ?? name;
|
|
1390
1445
|
code.tokens = {};
|
|
@@ -1555,6 +1610,7 @@ class CodeEditor {
|
|
|
1555
1610
|
this.lastMouseDown = LX.getTime();
|
|
1556
1611
|
this.state.selectingText = true;
|
|
1557
1612
|
this.endSelection();
|
|
1613
|
+
this.processClick( e );
|
|
1558
1614
|
}
|
|
1559
1615
|
|
|
1560
1616
|
else if( e.type == 'mouseup' )
|
|
@@ -1618,9 +1674,8 @@ class CodeEditor {
|
|
|
1618
1674
|
|
|
1619
1675
|
_onMouseUp( e ) {
|
|
1620
1676
|
|
|
1621
|
-
if( (LX.getTime() - this.lastMouseDown) <
|
|
1677
|
+
if( (LX.getTime() - this.lastMouseDown) < 120 ) {
|
|
1622
1678
|
this.state.selectingText = false;
|
|
1623
|
-
this.processClick( e );
|
|
1624
1679
|
this.endSelection();
|
|
1625
1680
|
}
|
|
1626
1681
|
|
|
@@ -1847,6 +1902,7 @@ class CodeEditor {
|
|
|
1847
1902
|
return;
|
|
1848
1903
|
case 'd': // duplicate line
|
|
1849
1904
|
e.preventDefault();
|
|
1905
|
+
this.endSelection();
|
|
1850
1906
|
this.code.lines.splice( lidx, 0, this.code.lines[ lidx ] );
|
|
1851
1907
|
this.lineDown( cursor );
|
|
1852
1908
|
this.processLines();
|
|
@@ -1856,6 +1912,10 @@ class CodeEditor {
|
|
|
1856
1912
|
e.preventDefault();
|
|
1857
1913
|
this.showSearchBox();
|
|
1858
1914
|
return;
|
|
1915
|
+
case 'g': // find line
|
|
1916
|
+
e.preventDefault();
|
|
1917
|
+
this.showSearchLineBox();
|
|
1918
|
+
return;
|
|
1859
1919
|
case 's': // save
|
|
1860
1920
|
e.preventDefault();
|
|
1861
1921
|
this.onsave( this.getText() );
|
|
@@ -1867,13 +1927,31 @@ class CodeEditor {
|
|
|
1867
1927
|
this._cutContent();
|
|
1868
1928
|
this.hideAutoCompleteBox();
|
|
1869
1929
|
return;
|
|
1930
|
+
case 'y': // redo
|
|
1931
|
+
if(!this.code.redoSteps.length)
|
|
1932
|
+
return;
|
|
1933
|
+
this._addUndoStep( cursor, true, false);
|
|
1934
|
+
const redo_step = this.code.redoSteps.pop();
|
|
1935
|
+
this.code.lines = redo_step.lines;
|
|
1936
|
+
this.processLines();
|
|
1937
|
+
this.restoreCursor( cursor, redo_step.cursor );
|
|
1938
|
+
return;
|
|
1870
1939
|
case 'z': // undo
|
|
1871
1940
|
if(!this.code.undoSteps.length)
|
|
1872
1941
|
return;
|
|
1873
|
-
|
|
1874
|
-
this.code.
|
|
1942
|
+
this._addRedoStep( cursor );
|
|
1943
|
+
const undo_step = this.code.undoSteps.pop();
|
|
1944
|
+
this.code.lines = undo_step.lines;
|
|
1875
1945
|
this.processLines();
|
|
1876
|
-
this.restoreCursor( cursor,
|
|
1946
|
+
this.restoreCursor( cursor, undo_step.cursor );
|
|
1947
|
+
return;
|
|
1948
|
+
case '+': // increase size
|
|
1949
|
+
e.preventDefault();
|
|
1950
|
+
this._increaseFontSize();
|
|
1951
|
+
return;
|
|
1952
|
+
case '-': // decrease size
|
|
1953
|
+
e.preventDefault();
|
|
1954
|
+
this._decreaseFontSize();
|
|
1877
1955
|
return;
|
|
1878
1956
|
}
|
|
1879
1957
|
}
|
|
@@ -2037,7 +2115,7 @@ class CodeEditor {
|
|
|
2037
2115
|
let lidx = cursor.line;
|
|
2038
2116
|
let text_to_cut = "";
|
|
2039
2117
|
|
|
2040
|
-
this._addUndoStep( cursor );
|
|
2118
|
+
this._addUndoStep( cursor, true );
|
|
2041
2119
|
|
|
2042
2120
|
if( !this.selection ) {
|
|
2043
2121
|
text_to_cut = "\n" + this.code.lines[ cursor.line ];
|
|
@@ -2840,9 +2918,9 @@ class CodeEditor {
|
|
|
2840
2918
|
cursor.position = state.position ?? 0;
|
|
2841
2919
|
|
|
2842
2920
|
cursor._left = state.left ?? 0;
|
|
2843
|
-
cursor.style.left = "calc(" +
|
|
2921
|
+
cursor.style.left = "calc(" + cursor._left + "px + " + this.xPadding + ")";
|
|
2844
2922
|
cursor._top = state.top ?? 0;
|
|
2845
|
-
cursor.style.top = "calc(" +
|
|
2923
|
+
cursor.style.top = "calc(" + cursor._top + "px)";
|
|
2846
2924
|
}
|
|
2847
2925
|
|
|
2848
2926
|
resetCursorPos( flag, cursor ) {
|
|
@@ -2923,8 +3001,6 @@ class CodeEditor {
|
|
|
2923
3001
|
|
|
2924
3002
|
this.resizeScrollBars();
|
|
2925
3003
|
|
|
2926
|
-
// console.warn("Resize editor viewport");
|
|
2927
|
-
|
|
2928
3004
|
}, 10 );
|
|
2929
3005
|
}
|
|
2930
3006
|
|
|
@@ -3089,15 +3165,16 @@ class CodeEditor {
|
|
|
3089
3165
|
return [ word, from, to ];
|
|
3090
3166
|
}
|
|
3091
3167
|
|
|
3092
|
-
_measureChar( char = "a", get_bb = false ) {
|
|
3168
|
+
_measureChar( char = "a", use_floating = false, get_bb = false ) {
|
|
3093
3169
|
|
|
3094
|
-
var
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3170
|
+
var line = document.createElement( "pre" );
|
|
3171
|
+
var text = document.createElement( "span" );
|
|
3172
|
+
line.appendChild( text );
|
|
3173
|
+
text.innerText = char;
|
|
3174
|
+
this.code.appendChild( line );
|
|
3175
|
+
var rect = text.getBoundingClientRect();
|
|
3176
|
+
deleteElement( line );
|
|
3177
|
+
const bb = [ use_floating ? rect.width : Math.floor( rect.width ), use_floating ? rect.height : Math.floor( rect.height ) ];
|
|
3101
3178
|
return get_bb ? bb : bb[ 0 ];
|
|
3102
3179
|
}
|
|
3103
3180
|
|
|
@@ -3344,8 +3421,8 @@ class CodeEditor {
|
|
|
3344
3421
|
return;
|
|
3345
3422
|
|
|
3346
3423
|
let cursorData = new LX.vec2( this.position, this.line );
|
|
3347
|
-
let
|
|
3348
|
-
let
|
|
3424
|
+
let line = null;
|
|
3425
|
+
let char = -1;
|
|
3349
3426
|
|
|
3350
3427
|
if( this._lastResult )
|
|
3351
3428
|
{
|
|
@@ -3354,18 +3431,18 @@ class CodeEditor {
|
|
|
3354
3431
|
delete this._lastResult;
|
|
3355
3432
|
}
|
|
3356
3433
|
|
|
3357
|
-
const getIndex =
|
|
3358
|
-
return this.code.lines[
|
|
3434
|
+
const getIndex = l => {
|
|
3435
|
+
return this.code.lines[ l ].substr( l == cursorData.y ? cursorData.x : 0 ).indexOf( text );
|
|
3359
3436
|
};
|
|
3360
3437
|
|
|
3361
3438
|
if( reverse )
|
|
3362
3439
|
{
|
|
3363
3440
|
for( var j = cursorData.y; j >= 0; --j )
|
|
3364
3441
|
{
|
|
3365
|
-
|
|
3366
|
-
if(
|
|
3442
|
+
char = getIndex( j );
|
|
3443
|
+
if( char > -1 )
|
|
3367
3444
|
{
|
|
3368
|
-
|
|
3445
|
+
line = j;
|
|
3369
3446
|
break;
|
|
3370
3447
|
}
|
|
3371
3448
|
}
|
|
@@ -3374,30 +3451,36 @@ class CodeEditor {
|
|
|
3374
3451
|
{
|
|
3375
3452
|
for( var j = cursorData.y; j < this.code.lines.length; ++j )
|
|
3376
3453
|
{
|
|
3377
|
-
|
|
3378
|
-
if(
|
|
3454
|
+
char = getIndex( j );
|
|
3455
|
+
if( char > -1 )
|
|
3379
3456
|
{
|
|
3380
|
-
|
|
3457
|
+
line = j;
|
|
3381
3458
|
break;
|
|
3382
3459
|
}
|
|
3383
3460
|
}
|
|
3384
3461
|
}
|
|
3385
3462
|
|
|
3386
|
-
if(
|
|
3463
|
+
if( line == null)
|
|
3387
3464
|
{
|
|
3388
3465
|
alert("No results!")
|
|
3389
3466
|
return;
|
|
3390
3467
|
}
|
|
3391
3468
|
|
|
3469
|
+
/*
|
|
3470
|
+
Position idx is computed from last pos, which could be in same line,
|
|
3471
|
+
so we search in the substring (first_ocurrence, end). That's why we
|
|
3472
|
+
have to add the length of the substring (0, first_ocurrence)
|
|
3473
|
+
*/
|
|
3474
|
+
|
|
3475
|
+
char += ( line == cursorData.y ? cursorData.x : 0 );
|
|
3476
|
+
|
|
3392
3477
|
// Text found..
|
|
3393
3478
|
|
|
3394
3479
|
this._lastTextFound = text;
|
|
3395
3480
|
|
|
3396
|
-
// console.warn("FOUND!! --", text, "-- at", "[" + idx + ", " + j + "]")
|
|
3397
|
-
|
|
3398
3481
|
this.codeScroller.scrollTo(
|
|
3399
|
-
Math.max(
|
|
3400
|
-
Math.max(
|
|
3482
|
+
Math.max( char * this.charWidth - this.codeScroller.clientWidth ),
|
|
3483
|
+
Math.max( line - 10 ) * this.lineHeight
|
|
3401
3484
|
);
|
|
3402
3485
|
|
|
3403
3486
|
// Show elements
|
|
@@ -3405,14 +3488,41 @@ class CodeEditor {
|
|
|
3405
3488
|
|
|
3406
3489
|
// Create new selection instance
|
|
3407
3490
|
this.selection = new CodeSelection( this, 0, 0, "lexcodesearchresult" );
|
|
3408
|
-
this.selection.selectInline(
|
|
3491
|
+
this.selection.selectInline( char, line, this.measureString( text ) );
|
|
3409
3492
|
this._lastResult = {
|
|
3410
3493
|
'dom': this.selections.lastChild,
|
|
3411
|
-
'pos': new LX.vec2(
|
|
3494
|
+
'pos': new LX.vec2( char + text.length, line )
|
|
3412
3495
|
};
|
|
3413
3496
|
|
|
3414
3497
|
}
|
|
3415
3498
|
|
|
3499
|
+
showSearchLineBox() {
|
|
3500
|
+
|
|
3501
|
+
this.searchlinebox.classList.add( 'opened' );
|
|
3502
|
+
this.searchlineboxActive = true;
|
|
3503
|
+
|
|
3504
|
+
const input = this.searchlinebox.querySelector( 'input' );
|
|
3505
|
+
input.value = ":";
|
|
3506
|
+
input.focus();
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
hideSearchLineBox() {
|
|
3510
|
+
|
|
3511
|
+
if( this.searchlineboxActive )
|
|
3512
|
+
{
|
|
3513
|
+
this.searchlinebox.classList.remove( 'opened' );
|
|
3514
|
+
this.searchlineboxActive = false;
|
|
3515
|
+
}
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
goToLine( line ) {
|
|
3519
|
+
|
|
3520
|
+
if( !this.isNumber( line ) )
|
|
3521
|
+
return;
|
|
3522
|
+
|
|
3523
|
+
this.codeScroller.scrollTo( 0, Math.max( line - 15 ) * this.lineHeight );
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3416
3526
|
_updateDataInfoPanel( signal, value ) {
|
|
3417
3527
|
|
|
3418
3528
|
if( !this.skipCodeInfo )
|
|
@@ -3445,6 +3555,46 @@ class CodeEditor {
|
|
|
3445
3555
|
}
|
|
3446
3556
|
}
|
|
3447
3557
|
|
|
3558
|
+
_increaseFontSize() {
|
|
3559
|
+
|
|
3560
|
+
// Change font size
|
|
3561
|
+
|
|
3562
|
+
var r = document.querySelector( ':root' );
|
|
3563
|
+
var s = getComputedStyle( r );
|
|
3564
|
+
var pixels = parseInt( s.getPropertyValue( "--code-editor-font-size" ) );
|
|
3565
|
+
pixels = LX.UTILS.clamp( pixels + 1, CodeEditor.CODE_MIN_FONT_SIZE, CodeEditor.CODE_MAX_FONT_SIZE );
|
|
3566
|
+
r.style.setProperty( "--code-editor-font-size", pixels + "px" );
|
|
3567
|
+
this.charWidth = this._measureChar( "a", true );
|
|
3568
|
+
|
|
3569
|
+
// Change row size
|
|
3570
|
+
|
|
3571
|
+
var row_pixels = pixels + 6;
|
|
3572
|
+
r.style.setProperty( "--code-editor-row-height", row_pixels + "px" );
|
|
3573
|
+
this.lineHeight = row_pixels;
|
|
3574
|
+
|
|
3575
|
+
this.processLines(); // ... it's necessary?
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
_decreaseFontSize() {
|
|
3579
|
+
|
|
3580
|
+
// Change font size
|
|
3581
|
+
|
|
3582
|
+
var r = document.querySelector( ':root' );
|
|
3583
|
+
var s = getComputedStyle( r );
|
|
3584
|
+
var pixels = parseInt( s.getPropertyValue( "--code-editor-font-size" ) );
|
|
3585
|
+
pixels = LX.UTILS.clamp( pixels - 1, CodeEditor.CODE_MIN_FONT_SIZE, CodeEditor.CODE_MAX_FONT_SIZE );
|
|
3586
|
+
r.style.setProperty( "--code-editor-font-size", pixels + "px" );
|
|
3587
|
+
this.charWidth = this._measureChar( "a", true );
|
|
3588
|
+
|
|
3589
|
+
// Change row size
|
|
3590
|
+
|
|
3591
|
+
var row_pixels = pixels + 6;
|
|
3592
|
+
r.style.setProperty( "--code-editor-row-height", row_pixels + "px" );
|
|
3593
|
+
this.lineHeight = row_pixels;
|
|
3594
|
+
|
|
3595
|
+
this.processLines(); // ... it's necessary?
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3448
3598
|
_clearTmpVariables() {
|
|
3449
3599
|
|
|
3450
3600
|
delete this._currentLineString;
|
package/build/lexgui.css
CHANGED
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
--global-dark-background: #14161a;
|
|
19
19
|
--global-blur-background: #28292ba9;
|
|
20
20
|
--transition-time: 1000;
|
|
21
|
+
--code-editor-font-size: 14px;
|
|
22
|
+
--code-editor-row-height: 20px;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
/* Some global colors */
|
|
@@ -2819,7 +2821,7 @@ ul.lexassetscontent {
|
|
|
2819
2821
|
-webkit-font-smoothing: antialiased;
|
|
2820
2822
|
-moz-osx-font-smoothing: grayscale;
|
|
2821
2823
|
font-feature-settings: "ss04", "ss05";
|
|
2822
|
-
font-size:
|
|
2824
|
+
font-size: var(--code-editor-font-size);
|
|
2823
2825
|
padding-right: 6px;
|
|
2824
2826
|
position: relative;
|
|
2825
2827
|
}
|
|
@@ -2829,7 +2831,7 @@ ul.lexassetscontent {
|
|
|
2829
2831
|
-webkit-font-smoothing: antialiased;
|
|
2830
2832
|
-moz-osx-font-smoothing: grayscale;
|
|
2831
2833
|
font-feature-settings: "ss04", "ss05";
|
|
2832
|
-
font-size:
|
|
2834
|
+
font-size: var(--code-editor-font-size);
|
|
2833
2835
|
position: absolute;
|
|
2834
2836
|
top: 0;
|
|
2835
2837
|
left: 0;
|
|
@@ -2852,7 +2854,7 @@ ul.lexassetscontent {
|
|
|
2852
2854
|
position: relative;
|
|
2853
2855
|
overflow: visible;
|
|
2854
2856
|
-webkit-tap-highlight-color: transparent;
|
|
2855
|
-
height:
|
|
2857
|
+
height: var(--code-editor-row-height);
|
|
2856
2858
|
pointer-events: none;
|
|
2857
2859
|
}
|
|
2858
2860
|
|
|
@@ -2871,16 +2873,15 @@ ul.lexassetscontent {
|
|
|
2871
2873
|
-webkit-tap-highlight-color: transparent;
|
|
2872
2874
|
box-sizing: border-box;
|
|
2873
2875
|
display: inline-block;
|
|
2874
|
-
height: 16px;
|
|
2875
2876
|
}
|
|
2876
2877
|
|
|
2877
2878
|
pre .line-gutter {
|
|
2878
2879
|
color: #8a8b97;
|
|
2879
2880
|
width: 48px;
|
|
2880
|
-
height:
|
|
2881
|
-
font-size:
|
|
2881
|
+
height: var(--code-editor-row-height);
|
|
2882
|
+
font-size: var(--code-editor-font-size);
|
|
2882
2883
|
font-weight: 400;
|
|
2883
|
-
line-height:
|
|
2884
|
+
line-height: var(--code-editor-row-height);
|
|
2884
2885
|
text-align: center;
|
|
2885
2886
|
-webkit-user-select: none; /* Safari 3.1+ */
|
|
2886
2887
|
-moz-user-select: none; /* Firefox 2+ */
|
|
@@ -2919,12 +2920,12 @@ pre .line-gutter {
|
|
|
2919
2920
|
padding: 0;
|
|
2920
2921
|
border-right: none;
|
|
2921
2922
|
width: 0;
|
|
2923
|
+
height: var(--code-editor-row-height);
|
|
2922
2924
|
position: absolute;
|
|
2923
2925
|
border-left: 3px solid #fff !important;
|
|
2924
2926
|
z-index: 0 !important;
|
|
2925
2927
|
left: 0px;
|
|
2926
2928
|
top: 0px;
|
|
2927
|
-
height: 20px;
|
|
2928
2929
|
}
|
|
2929
2930
|
|
|
2930
2931
|
.lexcodescrollbar {
|
|
@@ -2987,7 +2988,7 @@ pre .line-gutter {
|
|
|
2987
2988
|
left: 0px;
|
|
2988
2989
|
top: 0px;
|
|
2989
2990
|
width: 100px;
|
|
2990
|
-
height:
|
|
2991
|
+
height: var(--code-editor-row-height);
|
|
2991
2992
|
background-color: var(--global-selected);
|
|
2992
2993
|
opacity: 0.4;
|
|
2993
2994
|
}
|
|
@@ -3012,6 +3013,10 @@ pre .line-gutter {
|
|
|
3012
3013
|
transition: transform 0.2s ease-in;
|
|
3013
3014
|
}
|
|
3014
3015
|
|
|
3016
|
+
.lexcodeeditor .searchbox.gotoline {
|
|
3017
|
+
width: 124px;
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3015
3020
|
.lexcodeeditor .searchbox.opened {
|
|
3016
3021
|
transform: translateY(0px);
|
|
3017
3022
|
}
|
package/build/lexgui.js
CHANGED
|
@@ -12,7 +12,7 @@ console.warn( 'Script "build/lexgui.js" is depracated and will be removed soon.
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
var LX = global.LX = {
|
|
15
|
-
version: "0.1.
|
|
15
|
+
version: "0.1.22",
|
|
16
16
|
ready: false,
|
|
17
17
|
components: [], // specific pre-build components
|
|
18
18
|
signals: {} // events and triggers
|
package/build/lexgui.module.js
CHANGED
package/changelog.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# lexgui.js changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.22
|
|
4
|
+
|
|
5
|
+
Added REDO using "Ctrl+Y".
|
|
6
|
+
Added FontSize customization. "Ctrl+PLUS", "Ctrl+MINUS" or "Ctrl+Wheel".
|
|
7
|
+
Added "Ctrl+G" to scroll to specific line.
|
|
8
|
+
General bug fixes.
|
|
9
|
+
|
|
3
10
|
## 0.1.21
|
|
4
11
|
|
|
5
12
|
Added "Ctrl+F" to find text in code tabs.
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
// init library and get main area
|
|
24
24
|
let area = LX.init();
|
|
25
25
|
|
|
26
|
-
const file_explorer =
|
|
26
|
+
const file_explorer = true;
|
|
27
27
|
|
|
28
28
|
if( !file_explorer )
|
|
29
29
|
{
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
editor.loadFile( "../data/js_sample.js" );
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
editor.loadFile( "../data/json_sample.json" );
|
|
57
|
+
editor.loadFile( "../data/css_sample.css" );
|
|
58
|
+
editor.loadFile( "../data/cpp_sample.cpp" );
|
|
59
|
+
editor.loadFile( "../data/xml_sample.xml" );
|
|
60
|
+
editor.loadFile( "../data/python_sample.py" );
|
|
61
|
+
editor.loadFile( "../data/rust_sample.rs" );
|
|
62
62
|
// editor.loadFile( "../localhost.bat" );
|
|
63
63
|
|
|
64
64
|
if( !file_explorer )
|