Hide new template directory entry after creating and allow setting existing directories
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
0111381529
commit
2d46971199
|
@ -119,6 +119,11 @@
|
|||
|
||||
var lastPos;
|
||||
var checkInput = function () {
|
||||
// Special handling for the setup template directory
|
||||
if ($target.attr('data-action') === 'template-init') {
|
||||
return true;
|
||||
}
|
||||
|
||||
var filename = $input.val();
|
||||
try {
|
||||
if (!Files.isFileNameValid(filename)) {
|
||||
|
@ -198,7 +203,21 @@
|
|||
iconClass: actionSpec.iconClass,
|
||||
fileType: actionSpec.fileType,
|
||||
actionHandler: actionSpec.actionHandler,
|
||||
});
|
||||
checkFilename: actionSpec.checkFilename
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a menu item from the "New" file menu
|
||||
* @param {string} actionId
|
||||
*/
|
||||
removeMenuEntry: function(actionId) {
|
||||
var index = this._menuItems.findIndex(function (actionSpec) {
|
||||
return actionSpec.id === actionId;
|
||||
});
|
||||
if (index > -1) {
|
||||
this._menuItems.splice(index, 1);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -82,6 +82,7 @@ window.addEventListener('DOMContentLoaded', function() {
|
|||
fileType: 'file',
|
||||
actionHandler(name) {
|
||||
initTemplatesFolder(name)
|
||||
menu.removeMenuEntry('template-init')
|
||||
},
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue