@@ -45,7 +45,7 @@ sidebarToggle.addEventListener('click', () => {
45
45
46
46
47
47
// render sidebar
48
- // call this function when logged in to git
48
+ // call this function when signed in to git
49
49
// to render sidebar
50
50
async function renderSidebarHTML ( pageNum = 1 ) {
51
51
@@ -60,14 +60,14 @@ async function renderSidebarHTML(pageNum = 1) {
60
60
const [ repoName , branch ] = repo . split ( ':' ) ;
61
61
62
62
63
- // if not logged into git
63
+ // if not signed into git
64
64
// and navigated to Repositories page
65
65
if ( gitToken == '' && repo == '' ) {
66
66
67
67
// stop loading
68
68
stopLoading ( ) ;
69
69
70
- // show login screen
70
+ // show sign-in screen
71
71
sidebar . classList . add ( 'intro' ) ;
72
72
73
73
return ;
@@ -225,6 +225,18 @@ async function renderSidebarHTML(pageNum = 1) {
225
225
// get items in current tree from git
226
226
resp = await git . getItems ( treeLoc , pageNum ) ;
227
227
228
+
229
+ // if switched directory while loading, return
230
+ // through cde.run links the branch can change (from no branch to the default branch),
231
+ // so don't take it into account
232
+ if ( user !== treeLoc [ 0 ] ||
233
+ repoName !== treeLoc [ 1 ] . split ( ':' ) [ 0 ] ||
234
+ contents !== treeLoc [ 2 ] ) {
235
+
236
+ return ;
237
+
238
+ }
239
+
228
240
229
241
if ( resp . message && resp . message == 'Not Found' ) {
230
242
@@ -246,22 +258,22 @@ async function renderSidebarHTML(pageNum = 1) {
246
258
}
247
259
248
260
249
- // if not logged in
261
+ // if not signed in
250
262
if ( gitToken == '' ) {
251
263
252
264
const dialogResp = await showDialog ( async ( ) => {
253
265
254
- await openGitHubLogin ( ) ;
266
+ await openGitHubSignIn ( ) ;
255
267
256
268
// hide dialog
257
269
hideDialog ( ) ;
258
270
259
- } , 'Hmm... the repo you\'re\nlooking for can\'t be found.\nTry logging in.' , 'Login ' , true ) ;
271
+ } , 'Hmm... the repo you\'re\nlooking for can\'t be found.\nTry signing in.' , 'Sign in ' , true ) ;
260
272
261
- // if chosen to log in, return
273
+ // if chosen to sign in, return
262
274
if ( dialogResp == true ) return ;
263
275
264
- } else { // if logged in
276
+ } else { // if signed in
265
277
266
278
await showDialog ( hideDialog , 'Hmm... the repo you\'re\nlooking for can\'t be found.' , 'OK' , true ) ;
267
279
@@ -382,12 +394,12 @@ async function renderSidebarHTML(pageNum = 1) {
382
394
if ( resp . message && resp . message == 'Bad credentials' ) {
383
395
384
396
// if failed to get items,
385
- // show login screen
397
+ // show sign-in screen
386
398
387
399
// stop loading
388
400
stopLoading ( ) ;
389
401
390
- showMessage ( 'Your Git login expired.' , 4000 ) ;
402
+ showMessage ( 'Your sign-in token expired.' , 4000 ) ;
391
403
392
404
sidebar . classList . add ( 'intro' ) ;
393
405
@@ -1132,17 +1144,17 @@ function pushFileWithCommitMessageHTML(fileEl) {
1132
1144
1133
1145
async function checkPushDialogs ( ) {
1134
1146
1135
- // if not logged in to git
1147
+ // if not signed in to git
1136
1148
if ( gitToken == '' ) {
1137
1149
1138
1150
showDialog ( async ( ) => {
1139
1151
1140
- await openGitHubLogin ( ) ;
1152
+ await openGitHubSignIn ( ) ;
1141
1153
1142
1154
// hide dialog
1143
1155
hideDialog ( ) ;
1144
1156
1145
- } , 'Login to save this file.' , 'Login ' ) ;
1157
+ } , 'Sign in to push this file.' , 'Sign in ' ) ;
1146
1158
1147
1159
return 'return' ;
1148
1160
@@ -1291,7 +1303,7 @@ async function checkPushDialogs() {
1291
1303
}
1292
1304
1293
1305
const dialogResult = await showDialog ( forkRepo ,
1294
- 'Fork this repository\nto save your changes.' ,
1306
+ 'Fork this repository\nto push your changes.' ,
1295
1307
'Fork' ) ;
1296
1308
1297
1309
if ( dialogResult === false ) return 'return' ;
@@ -1305,7 +1317,7 @@ async function checkPushDialogs() {
1305
1317
1306
1318
showDialog ( async ( ) => {
1307
1319
1308
- await openGitHubLogin ( ) ;
1320
+ await openGitHubSignIn ( ) ;
1309
1321
1310
1322
// hide dialog
1311
1323
hideDialog ( ) ;
@@ -2328,7 +2340,7 @@ function createNewRepoInHTML() {
2328
2340
2329
2341
const repoName = repoEl . querySelector ( '.name' ) ;
2330
2342
2331
- focusCursorToEnd ( repoName ) ;
2343
+ focusCaretToEnd ( repoName ) ;
2332
2344
2333
2345
} ) ;
2334
2346
@@ -2490,10 +2502,12 @@ function createNewRepoInHTML() {
2490
2502
} else {
2491
2503
2492
2504
// if already adding a new repo, focus it
2505
+
2506
+ const newRepo = fileWrapper . querySelector ( '.item.focused' ) ,
2507
+ newRepoName = newRepo . querySelector ( '.name' ) ;
2493
2508
2494
- const newRepoName = fileWrapper . querySelector ( '.item.focused .name' ) ;
2495
-
2496
- focusCursorToEnd ( newRepoName ) ;
2509
+ selectAllCaret ( newRepoName ) ;
2510
+ newRepo . scrollIntoViewIfNeeded ( ) ;
2497
2511
2498
2512
}
2499
2513
@@ -2856,10 +2870,12 @@ function createNewFileInHTML() {
2856
2870
} else {
2857
2871
2858
2872
// if already adding a new file, focus it
2873
+
2874
+ const newFile = fileWrapper . querySelector ( '.item.focused' ) ,
2875
+ newFileName = newFile . querySelector ( '.name' ) ;
2859
2876
2860
- const newFileName = fileWrapper . querySelector ( '.item.focused .name' ) ;
2861
-
2862
- focusCursorToEnd ( newFileName ) ;
2877
+ selectAllCaret ( newFileName ) ;
2878
+ newFile . scrollIntoViewIfNeeded ( ) ;
2863
2879
2864
2880
}
2865
2881
@@ -3523,6 +3539,11 @@ function setupEditor() {
3523
3539
3524
3540
}
3525
3541
3542
+ } else {
3543
+
3544
+ // show unsupported language message
3545
+ showMessage ( 'You can format HTML, JS, CSS, JSON,\nand SVG.' , 5000 ) ;
3546
+
3526
3547
}
3527
3548
3528
3549
} else {
@@ -3533,7 +3554,7 @@ function setupEditor() {
3533
3554
if ( shownMessages . formatSelect < 2 ) {
3534
3555
3535
3556
// show format select message
3536
- showMessage ( 'Try selecting some text first .' , 4100 ) ;
3557
+ showMessage ( 'Try selecting some code to format .' , 4500 ) ;
3537
3558
3538
3559
// bump counter
3539
3560
shownMessages . formatSelect ++ ;
@@ -3609,7 +3630,7 @@ function updateLineNumbersHTML() {
3609
3630
3610
3631
function setupSidebar ( ) {
3611
3632
3612
- // if not logged into git
3633
+ // if not signed into git
3613
3634
// and navigated to Repositories page
3614
3635
if ( gitToken == '' && treeLoc [ 1 ] == '' ) {
3615
3636
@@ -3629,7 +3650,7 @@ function setupSidebar() {
3629
3650
3630
3651
} ) ;
3631
3652
3632
- } else { // if logged into git
3653
+ } else { // if signed into git
3633
3654
3634
3655
// render sidebar
3635
3656
renderSidebarHTML ( ) ;
0 commit comments