Skip to content

Commit

Permalink
Suppress keyboard shortcuts in notebook output (#6825)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored May 13, 2024
1 parent c7d5994 commit 419e649
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions panel/_templates/doc_nb_js.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
return
}
const py_version = docs[0].version.replace('rc', '-rc.').replace('.dev', '-dev.')
function embed_document(root) {
async function embed_document(root) {
var Bokeh = get_bokeh(root)
Bokeh.embed.embed_items_notebook(docs_json, render_items);
await Bokeh.embed.embed_items_notebook(docs_json, render_items);
for (const render_item of render_items) {
for (const root_id of render_item.root_ids) {
const id_el = document.getElementById(root_id)
if (id_el.children.length && (id_el.children[0].className === 'bk-root')) {
if (id_el.children.length && id_el.children[0].hasAttribute('data-root-id')) {
const root_el = id_el.children[0]
root_el.id = root_el.id + '-rendered'
for (const child of root_el.children) {
// Ensure JupyterLab does not capture keyboard shortcuts
// see: https://jupyterlab.readthedocs.io/en/4.1.x/extension/notebook.html#keyboard-interaction-model
child.setAttribute('data-lm-suppress-shortcuts', 'true')
}
}
}
}
Expand Down

0 comments on commit 419e649

Please sign in to comment.