Skip to content

Commit 1ab8302

Browse files
authored
Codeit 3.4.6
2 parents 995329d + 412231b commit 1ab8302

22 files changed

+2783
-1014
lines changed

bottomfloat.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,8 @@ function checkBottomFloat() {
180180

181181
} else if (document.activeElement !== cd) { // if scrolled up
182182

183-
// if passed threshold
184-
if ((lastScrollTop - st) > 20) {
185-
186-
// show bottom float
187-
bottomWrapper.classList.remove('hidden');
188-
189-
}
183+
// show bottom float
184+
bottomWrapper.classList.remove('hidden');
190185

191186
}
192187

dark-theme.css renamed to editor-theme.css

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
22
* Syntax highlighting
3-
* Colors based on Base16 Ocean Dark
43
*/
54

65
body:not(.mobile) ::-webkit-scrollbar {
@@ -246,15 +245,15 @@ cd-el {
246245
}
247246

248247

249-
.token.brace.brace-active {
248+
cd-el .token.brace.brace-active {
250249
position: relative;
251250
background: rgb(166 195 212 / 12%);
252251
border-radius: 2.5px 2.5px 0 0;
253252
box-shadow: 0 1px 0 0 rgb(166 195 212 / 12%);
254253
}
255254

256-
.token.brace.brace-active::before,
257-
.token.brace.brace-active::after {
255+
cd-el .token.brace.brace-active::before,
256+
cd-el .token.brace.brace-active::after {
258257
content: '';
259258
bottom: -2.5px;
260259
left: 0;
@@ -267,7 +266,7 @@ cd-el {
267266
pointer-events: none;
268267
}
269268

270-
.token.brace.brace-active::after {
269+
cd-el .token.brace.brace-active::after {
271270
left: 50%;
272271
transform: rotateZ(-25deg);
273272
}

filebrowser.js

+46-25
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ sidebarToggle.addEventListener('click', () => {
4545

4646

4747
// render sidebar
48-
// call this function when logged in to git
48+
// call this function when signed in to git
4949
// to render sidebar
5050
async function renderSidebarHTML(pageNum = 1) {
5151

@@ -60,14 +60,14 @@ async function renderSidebarHTML(pageNum = 1) {
6060
const [repoName, branch] = repo.split(':');
6161

6262

63-
// if not logged into git
63+
// if not signed into git
6464
// and navigated to Repositories page
6565
if (gitToken == '' && repo == '') {
6666

6767
// stop loading
6868
stopLoading();
6969

70-
// show login screen
70+
// show sign-in screen
7171
sidebar.classList.add('intro');
7272

7373
return;
@@ -225,6 +225,18 @@ async function renderSidebarHTML(pageNum = 1) {
225225
// get items in current tree from git
226226
resp = await git.getItems(treeLoc, pageNum);
227227

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+
228240

229241
if (resp.message && resp.message == 'Not Found') {
230242

@@ -246,22 +258,22 @@ async function renderSidebarHTML(pageNum = 1) {
246258
}
247259

248260

249-
// if not logged in
261+
// if not signed in
250262
if (gitToken == '') {
251263

252264
const dialogResp = await showDialog(async () => {
253265

254-
await openGitHubLogin();
266+
await openGitHubSignIn();
255267

256268
// hide dialog
257269
hideDialog();
258270

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);
260272

261-
// if chosen to log in, return
273+
// if chosen to sign in, return
262274
if (dialogResp == true) return;
263275

264-
} else { // if logged in
276+
} else { // if signed in
265277

266278
await showDialog(hideDialog, 'Hmm... the repo you\'re\nlooking for can\'t be found.', 'OK', true);
267279

@@ -382,12 +394,12 @@ async function renderSidebarHTML(pageNum = 1) {
382394
if (resp.message && resp.message == 'Bad credentials') {
383395

384396
// if failed to get items,
385-
// show login screen
397+
// show sign-in screen
386398

387399
// stop loading
388400
stopLoading();
389401

390-
showMessage('Your Git login expired.', 4000);
402+
showMessage('Your sign-in token expired.', 4000);
391403

392404
sidebar.classList.add('intro');
393405

@@ -1132,17 +1144,17 @@ function pushFileWithCommitMessageHTML(fileEl) {
11321144

11331145
async function checkPushDialogs() {
11341146

1135-
// if not logged in to git
1147+
// if not signed in to git
11361148
if (gitToken == '') {
11371149

11381150
showDialog(async () => {
11391151

1140-
await openGitHubLogin();
1152+
await openGitHubSignIn();
11411153

11421154
// hide dialog
11431155
hideDialog();
11441156

1145-
}, 'Login to save this file.', 'Login');
1157+
}, 'Sign in to push this file.', 'Sign in');
11461158

11471159
return 'return';
11481160

@@ -1291,7 +1303,7 @@ async function checkPushDialogs() {
12911303
}
12921304

12931305
const dialogResult = await showDialog(forkRepo,
1294-
'Fork this repository\nto save your changes.',
1306+
'Fork this repository\nto push your changes.',
12951307
'Fork');
12961308

12971309
if (dialogResult === false) return 'return';
@@ -1305,7 +1317,7 @@ async function checkPushDialogs() {
13051317

13061318
showDialog(async () => {
13071319

1308-
await openGitHubLogin();
1320+
await openGitHubSignIn();
13091321

13101322
// hide dialog
13111323
hideDialog();
@@ -2328,7 +2340,7 @@ function createNewRepoInHTML() {
23282340

23292341
const repoName = repoEl.querySelector('.name');
23302342

2331-
focusCursorToEnd(repoName);
2343+
focusCaretToEnd(repoName);
23322344

23332345
});
23342346

@@ -2490,10 +2502,12 @@ function createNewRepoInHTML() {
24902502
} else {
24912503

24922504
// if already adding a new repo, focus it
2505+
2506+
const newRepo = fileWrapper.querySelector('.item.focused'),
2507+
newRepoName = newRepo.querySelector('.name');
24932508

2494-
const newRepoName = fileWrapper.querySelector('.item.focused .name');
2495-
2496-
focusCursorToEnd(newRepoName);
2509+
selectAllCaret(newRepoName);
2510+
newRepo.scrollIntoViewIfNeeded();
24972511

24982512
}
24992513

@@ -2856,10 +2870,12 @@ function createNewFileInHTML() {
28562870
} else {
28572871

28582872
// if already adding a new file, focus it
2873+
2874+
const newFile = fileWrapper.querySelector('.item.focused'),
2875+
newFileName = newFile.querySelector('.name');
28592876

2860-
const newFileName = fileWrapper.querySelector('.item.focused .name');
2861-
2862-
focusCursorToEnd(newFileName);
2877+
selectAllCaret(newFileName);
2878+
newFile.scrollIntoViewIfNeeded();
28632879

28642880
}
28652881

@@ -3523,6 +3539,11 @@ function setupEditor() {
35233539

35243540
}
35253541

3542+
} else {
3543+
3544+
// show unsupported language message
3545+
showMessage('You can format HTML, JS, CSS, JSON,\nand SVG.', 5000);
3546+
35263547
}
35273548

35283549
} else {
@@ -3533,7 +3554,7 @@ function setupEditor() {
35333554
if (shownMessages.formatSelect < 2) {
35343555

35353556
// show format select message
3536-
showMessage('Try selecting some text first.', 4100);
3557+
showMessage('Try selecting some code to format.', 4500);
35373558

35383559
// bump counter
35393560
shownMessages.formatSelect++;
@@ -3609,7 +3630,7 @@ function updateLineNumbersHTML() {
36093630

36103631
function setupSidebar() {
36113632

3612-
// if not logged into git
3633+
// if not signed into git
36133634
// and navigated to Repositories page
36143635
if (gitToken == '' && treeLoc[1] == '') {
36153636

@@ -3629,7 +3650,7 @@ function setupSidebar() {
36293650

36303651
});
36313652

3632-
} else { // if logged into git
3653+
} else { // if signed into git
36333654

36343655
// render sidebar
36353656
renderSidebarHTML();

0 commit comments

Comments
 (0)