newfolder qol: click toast to copy path and open folder

toast
Kit Kasune 3 years ago
parent 17b680e7b2
commit a1152cd013
  1. 10
      scripts/contextmenu/newfolder.js

@ -8,6 +8,7 @@ const postModal = require('../modal/post');
const showError = require('../modal/common/error');
const clearModals = require('../modal/clearmodals');
const newToast = require('../toast/createtoast');
const refresh = require('../fileview/refresh');
module.exports = () => {
if (window.kade.modal) {return;}
@ -55,7 +56,14 @@ module.exports = () => {
fs.mkdirSync(path.join(window.kade.cpath, input.value));
lightRefresh();
modalOut.remove();
newToast("Folder created", [`Folder "${input.value}" created successfully`, `<em>${window.kade.cpath}\\${input.value}</em>`]);
newToast(
"Folder created", [`Folder "${input.value}" created successfully`, `<em>${window.kade.cpath}\\${input.value}</em>`], undefined, false, 5,
() => {
refresh(`${window.kade.cpath}\\${input.value}`);
require('electron').clipboard.writeText(`${window.kade.cpath}\\${input.value}`);
newToast("Copied!", "<em>The folder's path has been copied to your clipboard.</em>", "#19df46");
}
);
} catch {
newToast("Folder not Created", "An error caused that folder to not be created.", "#b24355", false, 5, () => {showError("Folder Creation", "There was an unknown error while trying to create that folder. It may be a permissions issue, or the host folder doesn't exist anymore.");});
clearModals();

Loading…
Cancel
Save