-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Folder icons #7
Comments
Hello, yes it is possible to use icons in folders but unfortunately I was unable to create a code that works and maintains performance but I intend to add it. |
This will be a priority for this plugin, if anyone wants to help implement this, feel free |
Nice to hear that it's possible to add icons on folders too.
oh, so can you try to add a feature where you can show a sample icon for the folders ? that would be great. Can you add a list of necessary file icons for this plugin, I'm willing to contribute in the both file and folder icons for now. |
I was thinking about that, the plugin is very easy to add icons, you just need to know how to use regex |
Try to override |
@bajrangCoder Did you manage to make it work? On mine it worked but not the correct way, just in the file browser on the main screen, besides being buggy. const regex = {
file: {
git: /\.gitignore$/i, // file
},
dir: {
git: /\.git$/i, // folder
}
};
function getType($type, $name) {
return Object.keys(regex[$type]).find((x) => regex[$type][x].test($name));
};
helpers.sortDir = (list, fileBrowser, mode = 'both') => {
const dir = [];
const file = [];
const sortByName = fileBrowser.sortByName;
const showHiddenFile = fileBrowser.showHiddenFiles;
list.forEach((item) => {
let hidden;
item.name = item.name || path.basename(item.url || '');
hidden = item.name[0] === '.';
if (typeof item.isDirectory !== 'boolean') {
if (this.isDir(item.type)) item.isDirectory = true;
}
if (!item.type) item.type = item.isDirectory ? 'dir': 'file';
const _type = getType(item.type, item.name);
if (item.isDirectory) {
item.icon = `folder_type_${_type}`;
} else {
item.icon = `file_type_${_type}`;
}
if (!item.url) item.url = item.url || item.uri;
if ((hidden && showHiddenFile) || !hidden) {
if (item.isDirectory) {
dir.push(item);
} else if (item.isFile) {
file.push(item);
}
}
});
if (sortByName) {
dir.sort(compare);
file.sort(compare);
}
return dir.concat(file);
function compare(a, b) {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1: 1;
}
}; |
I haven't tried yet but I will gonna try . |
Did you have any success? "-" |
A |
Mine is the same way, I can't think of a solution, have you tried something else too? I think it's better to wait for a response from @deadlyjack |
I have researched alot there is no way to add , but there is very difficult approach, like from css target the sidebar folder element with is data-name attribute and then modify its .icon.folder class with different for different folder element |
I showed you a previous code that worked using setinterval (the only way I could) using pure javascript: deadlyjack/Acode#779 (reply in thread) I tried using the dom click event but without success async check() {
const list = document.querySelectorAll(".tile");
list.forEach((e) => {
const name = e.getAttribute("data-name");
const type = e.getAttribute("data-type");
const _type = Object.keys(regex).find((x) => regex[x].test(name));
console.log(_type);
if (type === "dir") (e.querySelector(".icon").classList.add(`.folder_type_${_type}`));
}); |
Doing this resulted me to another bug in file browser. I see there is no other competition for us (except "Acode icons" by legend sabbir), so I'll making a pull request lately next week after solving that bug. I'm actually contributing to this repo, bcoz it is open source. Hence other developers can see our code and create their own plugin. I have a request too, can you please remove that "buy me a coffee" or "support me" buttons from this plugin description... |
Okay :( no one offers me a coffee, thank you for your contribution, until you complete this I won't touch the code, so your pull request won't suffer any more |
@Mirza-Glitch Were you able to resolve the bug? |
Yes i was able to resolve the bug, and the code is fully finished. I'll be making a pull request today, Or maybe I'll do it within few minutes 😉 |
Added all the necessary folder icons and file icons !! Little bit of unnecessary explanation here 😁 The Acode material icon plugin code is provided as open-source to help anyone who's looking to create Acode file icons plugin ! 🥳 |
Can you implement folder icons too ? If yes, then I can help you provide all the necessary folder icons and also contribute in file icons as well.
The text was updated successfully, but these errors were encountered: