fix: hide importers section if none is defined

This commit is contained in:
David Larlet 2024-06-14 17:21:09 -04:00
parent ceab5090a7
commit a3afadb677
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD

View file

@ -12,14 +12,16 @@ const TEMPLATE = `
<input type="file" multiple autofocus onchange /> <input type="file" multiple autofocus onchange />
<input type="url" placeholder="${translate('Provide an URL here')}" onchange /> <input type="url" placeholder="${translate('Provide an URL here')}" onchange />
<textarea onchange placeholder="${translate('Paste your data here')}"></textarea> <textarea onchange placeholder="${translate('Paste your data here')}"></textarea>
<div class="importers"> <div class="importers" hidden>
<h4>${translate('Import helpers:')}</h4> <h4>${translate('Import helpers:')}</h4>
<ul class="grid-container"> <ul class="grid-container">
</ul> </ul>
</div> </div>
</fieldset> </fieldset>
<fieldset class="formbox"> <fieldset class="formbox">
<legend class="counter" data-help="importFormats">${translate('Choose the format')}</legend> <legend class="counter" data-help="importFormats">${translate(
'Choose the format'
)}</legend>
<select name="format" onchange></select> <select name="format" onchange></select>
</fieldset> </fieldset>
<fieldset id="destination" class="formbox"> <fieldset id="destination" class="formbox">
@ -147,7 +149,7 @@ export default class Importer {
for (const plugin of this.IMPORTERS.sort((a, b) => (a.id > b.id ? 1 : -1))) { for (const plugin of this.IMPORTERS.sort((a, b) => (a.id > b.id ? 1 : -1))) {
L.DomUtil.createButton( L.DomUtil.createButton(
plugin.id, plugin.id,
DomUtil.element({tagName: 'li', parent}), DomUtil.element({ tagName: 'li', parent }),
plugin.name, plugin.name,
() => plugin.open(this) () => plugin.open(this)
) )