Skip to content

Commit 397c038

Browse files
Display toolbox initialization only once
1 parent e01249c commit 397c038

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Classes/Controller/ToolboxController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ public function imagemanipulationtool()
271271

272272
$this->view->assign('imageManipulation', true);
273273
$this->view->assign('parentContainer', $parentContainer);
274+
// activate it here as it is the most common used tool
275+
$this->view->assign('activateToolbox', true);
274276
}
275277

276278
/**

Resources/Private/Templates/Toolbox/Main.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,16 @@
189189
</f:if>
190190
</ul>
191191

192-
<script>
193-
window.addEventListener('tx-dlf-documentLoaded', (e) => {
194-
// Avoid instantiating dlfToolbox multiple times;
195-
// TODO(client-side): Rethink how it's done
196-
if (!window.tx_dlf_toolbox) {
197-
window.tx_dlf_toolbox = new dlfToolbox(e.detail.docController);
198-
}
199-
});
200-
</script>
192+
<f:if condition="{activateToolbox}">
193+
<f:then>
194+
<script>
195+
window.addEventListener('tx-dlf-documentLoaded', (e) => {
196+
if (!window.tx_dlf_toolbox) {
197+
window.tx_dlf_toolbox = new dlfToolbox(e.detail.docController);
198+
}
199+
});
200+
</script>
201+
</f:then>
202+
</f:if>
201203

202204
</html>

0 commit comments

Comments
 (0)