@ -11,10 +11,13 @@ const clearModals = require('../modal/clearmodals');
module . exports = ( ) => {
module . exports = ( ) => {
if ( window . kade . modal ) { console . log ( 'hboonk' ) ; return ; }
if ( window . kade . modal ) { console . log ( 'hboonk' ) ; return ; }
preModal ( 'new-folder-modal-container' ) ;
preModal ( 'new-folder-modal-container' ) ;
let modalOut = document . createElement ( 'div' ) ;
modalOut . className = 'modal' ;
modalOut . id = 'new-folder-modal-container' ;
document . body . appendChild ( modalOut ) ;
let modal = document . createElement ( 'div' ) ;
let modal = document . createElement ( 'div' ) ;
modal . className = 'modal' ;
modal . className = 'modal-wrapper' ;
modal . id = 'new-folder-modal-container' ;
modalOut . appendChild ( modal ) ;
document . body . appendChild ( modal ) ;
let title = document . createElement ( 'h2' ) ;
let title = document . createElement ( 'h2' ) ;
title . innerHTML = 'New Folder' ;
title . innerHTML = 'New Folder' ;
modal . appendChild ( title ) ;
modal . appendChild ( title ) ;
@ -50,8 +53,8 @@ module.exports = () => {
}
}
fs . mkdirSync ( path . join ( window . kade . cpath , input . value ) ) ;
fs . mkdirSync ( path . join ( window . kade . cpath , input . value ) ) ;
lightRefresh ( ) ;
lightRefresh ( ) ;
modal . remove ( ) ;
modalOut . remove ( ) ;
postModal ( modal . id ) ;
postModal ( modalOut . id ) ;
} catch {
} catch {
clearModals ( ) ;
clearModals ( ) ;
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." ) ;
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." ) ;
@ -62,8 +65,19 @@ module.exports = () => {
let msm = new mousetrap ( modal ) ;
let msm = new mousetrap ( modal ) ;
msm . bind ( 'esc' , ( ) => {
msm . bind ( 'esc' , ( ) => {
lightRefresh ( ) ;
lightRefresh ( ) ;
modal . remove ( ) ;
modalOut . remove ( ) ;
postModal ( modal . id ) ;
postModal ( modalOut . id ) ;
} ) ;
} ) ;
msm . bind ( 'enter' , ( ) => { conf . click ( ) ; } ) ;
msm . bind ( 'enter' , ( ) => { conf . click ( ) ; } ) ;
let close = document . createElement ( 'a' ) ;
close . className = 'close-button' ;
close . onclick = ( ) => {
lightRefresh ( ) ;
modalOut . remove ( ) ;
postModal ( modalOut . id ) ;
} ;
let closeWrap = document . createElement ( 'div' ) ;
closeWrap . className = 'close-button-wrapper' ;
modal . appendChild ( closeWrap ) ;
closeWrap . appendChild ( close ) ;
}
}