Skip to content

Commit

Permalink
don't show toggle button when not in notebook/lab
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Aug 7, 2024
1 parent 96c5cf1 commit 8ae0c5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/plugin_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ For example:
plugin.open_in_tray()
plugin.show('popout')
Some plugins provide API hints directly in the UI. To enable these, toggle the ``<>`` button in the top of the plugin.
When running in a notebook, some plugins provide API hints directly in the UI. To enable these, toggle the ``<>`` button in the top of the plugin.
12 changes: 10 additions & 2 deletions jdaviz/components/tray_plugin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<div style="width: 32px">
<j-tooltip tipid='plugin-api-hints'>
<v-btn
v-if="api_hints_enabled !== undefined && config && plugin_key"
v-if="api_hints_enabled !== undefined && config && plugin_key && checkNotebookContext()"
id="api-hints-button"
icon
:class="api_hints_enabled ? 'api-hint' : null"
@click="() => {$emit('update:api_hints_enabled', !api_hints_enabled)}"
Expand Down Expand Up @@ -87,7 +88,14 @@ module.exports = {
setTimeout(() => {
this.sendPing(true)
}, 200) // ms
}
},
checkNotebookContext() {
// copied from app.vue
this.notebook_context = document.getElementById("ipython-main-app")
|| document.querySelector('.jp-LabShell')
|| document.querySelector(".lm-Widget#main"); /* Notebook 7 */
return false && this.notebook_context;
},
},
mounted() {
this.sendPing(true);
Expand Down

0 comments on commit 8ae0c5b

Please sign in to comment.