Skip to content

Commit

Permalink
Codeit 3.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
benhatsor authored Aug 13, 2023
2 parents 995329d + 412231b commit 1ab8302
Show file tree
Hide file tree
Showing 22 changed files with 2,783 additions and 1,014 deletions.
9 changes: 2 additions & 7 deletions bottomfloat.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,8 @@ function checkBottomFloat() {

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

// if passed threshold
if ((lastScrollTop - st) > 20) {

// show bottom float
bottomWrapper.classList.remove('hidden');

}
// show bottom float
bottomWrapper.classList.remove('hidden');

}

Expand Down
9 changes: 4 additions & 5 deletions dark-theme.css → editor-theme.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
* Syntax highlighting
* Colors based on Base16 Ocean Dark
*/

body:not(.mobile) ::-webkit-scrollbar {
Expand Down Expand Up @@ -246,15 +245,15 @@ cd-el {
}


.token.brace.brace-active {
cd-el .token.brace.brace-active {
position: relative;
background: rgb(166 195 212 / 12%);
border-radius: 2.5px 2.5px 0 0;
box-shadow: 0 1px 0 0 rgb(166 195 212 / 12%);
}

.token.brace.brace-active::before,
.token.brace.brace-active::after {
cd-el .token.brace.brace-active::before,
cd-el .token.brace.brace-active::after {
content: '';
bottom: -2.5px;
left: 0;
Expand All @@ -267,7 +266,7 @@ cd-el {
pointer-events: none;
}

.token.brace.brace-active::after {
cd-el .token.brace.brace-active::after {
left: 50%;
transform: rotateZ(-25deg);
}
Expand Down
71 changes: 46 additions & 25 deletions filebrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ sidebarToggle.addEventListener('click', () => {


// render sidebar
// call this function when logged in to git
// call this function when signed in to git
// to render sidebar
async function renderSidebarHTML(pageNum = 1) {

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


// if not logged into git
// if not signed into git
// and navigated to Repositories page
if (gitToken == '' && repo == '') {

// stop loading
stopLoading();

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

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


// if switched directory while loading, return
// through cde.run links the branch can change (from no branch to the default branch),
// so don't take it into account
if (user !== treeLoc[0] ||
repoName !== treeLoc[1].split(':')[0] ||
contents !== treeLoc[2]) {

return;

}


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

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


// if not logged in
// if not signed in
if (gitToken == '') {

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

await openGitHubLogin();
await openGitHubSignIn();

// hide dialog
hideDialog();

}, 'Hmm... the repo you\'re\nlooking for can\'t be found.\nTry logging in.', 'Login', true);
}, 'Hmm... the repo you\'re\nlooking for can\'t be found.\nTry signing in.', 'Sign in', true);

// if chosen to log in, return
// if chosen to sign in, return
if (dialogResp == true) return;

} else { // if logged in
} else { // if signed in

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

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

// if failed to get items,
// show login screen
// show sign-in screen

// stop loading
stopLoading();

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

sidebar.classList.add('intro');

Expand Down Expand Up @@ -1132,17 +1144,17 @@ function pushFileWithCommitMessageHTML(fileEl) {

async function checkPushDialogs() {

// if not logged in to git
// if not signed in to git
if (gitToken == '') {

showDialog(async () => {

await openGitHubLogin();
await openGitHubSignIn();

// hide dialog
hideDialog();

}, 'Login to save this file.', 'Login');
}, 'Sign in to push this file.', 'Sign in');

return 'return';

Expand Down Expand Up @@ -1291,7 +1303,7 @@ async function checkPushDialogs() {
}

const dialogResult = await showDialog(forkRepo,
'Fork this repository\nto save your changes.',
'Fork this repository\nto push your changes.',
'Fork');

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

showDialog(async () => {

await openGitHubLogin();
await openGitHubSignIn();

// hide dialog
hideDialog();
Expand Down Expand Up @@ -2328,7 +2340,7 @@ function createNewRepoInHTML() {

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

focusCursorToEnd(repoName);
focusCaretToEnd(repoName);

});

Expand Down Expand Up @@ -2490,10 +2502,12 @@ function createNewRepoInHTML() {
} else {

// if already adding a new repo, focus it

const newRepo = fileWrapper.querySelector('.item.focused'),
newRepoName = newRepo.querySelector('.name');

const newRepoName = fileWrapper.querySelector('.item.focused .name');

focusCursorToEnd(newRepoName);
selectAllCaret(newRepoName);
newRepo.scrollIntoViewIfNeeded();

}

Expand Down Expand Up @@ -2856,10 +2870,12 @@ function createNewFileInHTML() {
} else {

// if already adding a new file, focus it

const newFile = fileWrapper.querySelector('.item.focused'),
newFileName = newFile.querySelector('.name');

const newFileName = fileWrapper.querySelector('.item.focused .name');

focusCursorToEnd(newFileName);
selectAllCaret(newFileName);
newFile.scrollIntoViewIfNeeded();

}

Expand Down Expand Up @@ -3523,6 +3539,11 @@ function setupEditor() {

}

} else {

// show unsupported language message
showMessage('You can format HTML, JS, CSS, JSON,\nand SVG.', 5000);

}

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

// show format select message
showMessage('Try selecting some text first.', 4100);
showMessage('Try selecting some code to format.', 4500);

// bump counter
shownMessages.formatSelect++;
Expand Down Expand Up @@ -3609,7 +3630,7 @@ function updateLineNumbersHTML() {

function setupSidebar() {

// if not logged into git
// if not signed into git
// and navigated to Repositories page
if (gitToken == '' && treeLoc[1] == '') {

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

});

} else { // if logged into git
} else { // if signed into git

// render sidebar
renderSidebarHTML();
Expand Down
Loading

0 comments on commit 1ab8302

Please sign in to comment.