From e3b28d84d168cbd5fc93d8cb3850c30ef5dbaeb3 Mon Sep 17 00:00:00 2001 From: john4650-hub Date: Sat, 16 Sep 2023 10:52:53 +0300 Subject: [PATCH] Added file path to recently opened files incase both of the file have the same names. Fix: Removed repeated addition of already open file to recently opened file. --- .github/workflows/build.yml | 2 +- routines.sh | 5 +++-- www/js/components/main_FileEntry.js | 22 ++++++++++++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb2245a..a07cbf5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,7 +66,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.TK }} with: tag_name: ${{ github.run_number }} - release_name: ${{ github.event.repository.name }} v4.0.6 + release_name: ${{ github.event.repository.name }} v5.0.1 - name: upload Release Apk id: upload_release_assets diff --git a/routines.sh b/routines.sh index bc28deb..82999b4 100644 --- a/routines.sh +++ b/routines.sh @@ -1,5 +1,6 @@ git add . -git commit -m "fixed file not highlighting in recent -y opened and improved ui for recently opened" +git commit -m " +Added file path to recently opened files incase both of the file have the same names. +Fix: Removed repeated addition of already open file to recently opened file." git push diff --git a/www/js/components/main_FileEntry.js b/www/js/components/main_FileEntry.js index b13dcbd..83789aa 100644 --- a/www/js/components/main_FileEntry.js +++ b/www/js/components/main_FileEntry.js @@ -73,7 +73,7 @@ export async function onDeviceReady() { }) if (checkValidity == undefined) { workWithFile(fileTruePath); - addRecentlyOpenedFile(filename,fileTruePath,FILE_EXTENSIONS[extension]) + addRecentlyOpenedFile(filename, fileTruePath, FILE_EXTENSIONS[extension]) window.aceEditor.session.setMode(`ace/mode/${FILE_EXTENSIONS[extension]}`) } else { @@ -110,15 +110,25 @@ export async function onDeviceReady() { }, () => { console.log('failed to save file'); }); } - function addRecentlyOpenedFile(name,url,ext) { + function addRecentlyOpenedFile(name, url, ext) { let openedFile = makeElm('li') - insertAttr(['class=list-group-item bg-transparent'], openedFile) + let fPath = makeElm('p') + insertAttr(['class=fs-6 fw-light fst-italic'], fPath) + fPath.innerText = url + openedFile.appendChild(fPath) + insertAttr(['class=list-group-item bg-transparent border-bottom border-dark'], openedFile) openedFile.innerText = name - openedFile.addEventListener('click', function() { workWithFile(url) + openedFile.addEventListener('click', function() { + workWithFile(url) window.aceEditor.session.setMode(`ace/mode/${ext}`) }) - - recentFilesTab.appendChild(openedFile) + document.querySelectorAll('#recent_file li p').forEach((i) => { + if (i.innerText == url) { + //do nothing + } else { + recentFilesTab.appendChild(openedFile) + } + }) } }, () => { console.log('failed to load file system'); }); } \ No newline at end of file