From d941a6c071d11fdf08535b450270fbbc0b656637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20K=C3=B6ssel?= Date: Tue, 19 Sep 2017 13:07:02 +0200 Subject: [PATCH 1/2] Never widen notebook, if cfg.widenNotebook is unchecked Inserts dynamically some margin if the TOC sidebar needs more space also when not widened. --- .../nbextensions/toc2/toc2.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js b/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js index 62c6cd4..0ad8c6e 100644 --- a/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js +++ b/src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js @@ -155,11 +155,19 @@ } function setNotebookWidth(cfg, st) { - //cfg.widenNotebook = true; if (cfg.sideBar) { if ($('#toc-wrapper').is(':visible')) { - $('#notebook-container').css('margin-left', $('#toc-wrapper').width() + 30) - $('#notebook-container').css('width', $('#notebook').width() - $('#toc-wrapper').width() - 30) + if (cfg.widenNotebook) { + $('#notebook-container').css('margin-left', $('#toc-wrapper').width() + 30) + $('#notebook-container').css('width', $('#notebook').width() - $('#toc-wrapper').width() - 30) + } else { + var space_needed = $('#toc-wrapper').width() + 30 + + $('#notebook-container').width() - $('#notebook').width(); + if (space_needed > 0) { + $('#notebook-container').css('margin-left', $('#toc-wrapper').width() + 30) + $('#notebook-container').css('width', $('#notebook-container').width() - space_needed) + } + } } else { if (cfg.widenNotebook) { $('#notebook-container').css('margin-left', 30); From aaaf81b96bae143ce4830a544c350ad368732991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20K=C3=B6ssel?= Date: Fri, 22 Sep 2017 13:59:12 +0200 Subject: [PATCH 2/2] Add to CHANGELOG --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3856e0e..b60132b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,11 +24,15 @@ which makes it much easier to fill in each release's changelog :) New features and bugfixes: - `toc2` - * [#1084](https://github.com/ipython-contrib/pulls/1084) + * [#1084](https://github.com/ipython-contrib/jupyter_contrib_nbextensions/pull/1084) [@jfbercher](https://github.com/jfbercher) fix for [#1083](https://github.com/ipython-contrib/issue/1083): Revert full url in links to relative to the current page. + * [#1091](https://github.com/ipython-contrib/jupyter_contrib_nbextensions/pull/1091) + [@fkoessel](https://github.com/fkoessel) + Notebook is not widened if sidebar is displayed and `cfg.widenNotebook` is + unchecked. 0.3.1