Skip to content

Commit

Permalink
Display toolbox initialization only once
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrycze-volk committed Apr 4, 2023
1 parent ac49ee1 commit 494abfa
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Resources/Private/Plugins/Kitodo/Templates/Toolbox/Main.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,16 @@
</f:then>
</f:if>

<script>
window.addEventListener('tx-dlf-documentLoaded', (e) => {
// Avoid instantiating dlfToolbox multiple times;
// TODO: Rethink how it's done
if (!window.tx_dlf_toolbox) {
window.tx_dlf_toolbox = new dlfToolbox(e.detail.docController);
}
});
</script>
<f:if condition="{activateToolbox}">
<f:then>
<script>
window.addEventListener('tx-dlf-documentLoaded', (e) => {
if (!window.tx_dlf_toolbox) {
window.tx_dlf_toolbox = new dlfToolbox(e.detail.docController);
}
});
</script>
</f:then>
</f:if>

</html>

0 comments on commit 494abfa

Please sign in to comment.