Skip to content

Commit

Permalink
Merge pull request #950 from jcb91/collapsible_headings
Browse files Browse the repository at this point in the history
[collapsible_headings] notebook 5.x uses cell position:relative already
  • Loading branch information
jcb91 authored Apr 9, 2017
2 parents d25e7d4 + 51258cd commit 63d2445
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Type: IPython Notebook Extension
Compatibility: 4.x
Type: Jupyter Notebook Extension
Compatibility: 4.x, 5.x
Name: Collapsible Headings
Main: main.js
Description: "Allows notebook to have collapsible sections, separated by headings"
Expand Down Expand Up @@ -71,7 +71,7 @@ Parameters:
input_type: hotkey
default: shift-a
- name: collapsible_headings.shortcuts.insert_below
description: Command-mode shortcut to insert a heading cellbelow the selected cell's section
description: Command-mode shortcut to insert a heading cell below the selected cell's section
input_type: hotkey
default: shift-b
- name: collapsible_headings.select_reveals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,21 @@ define(['jquery', 'require'], function ($, require) {
* Return a promise which resolves when the Tooltip class methods have
* been appropriately patched.
*
* We patch method Tooltip._show to make sure tooltip still ends up in the
* correct place. We temporarily override the cell's position:relative rule
* while the tooltip position is calculated & the animation queued, before
* removing the override again.
* For notebook 4.x, cells had css position:static, and changing them to
* relative to get heading brackets working broke the tooltip position
* calculation. In order to fix this, we patch the 4.x Tooltip._show
* method to temporarily reapply position:static while the tooltip
* position is calculated & the animation queued, before revertign to the
* css-appled position:relative.
* For notebook 5.x, cells are already position:relative, so the patch is
* unecessary.
*
* @return {Promise}
*/
function patch_Tooltip () {
if (Number(Jupyter.version[0]) >= 5) {
return Promise.resolve();
}
return new Promise(function (resolve, reject) {
require(['notebook/js/tooltip'], function on_success (tooltip) {
console.debug(log_prefix, 'patching Tooltip.prototype');
Expand Down

0 comments on commit 63d2445

Please sign in to comment.