|
185 | 185 | nb_inner.css(inner_css);
|
186 | 186 | }
|
187 | 187 |
|
| 188 | + var saveTocPosition = function () { |
| 189 | + setMd('toc_position', $('#toc-wrapper').css(['left', 'top', 'height', 'width'])); |
| 190 | + }; |
| 191 | + |
188 | 192 | var makeUnmakeMinimized = function (cfg, animate) {
|
189 | 193 | var open = cfg.sideBar || cfg.toc_section_display;
|
190 | 194 | var new_css, wrap = $('#toc-wrapper');
|
|
281 | 285 | makeUnmakeSidebar(cfg, was_minimized);
|
282 | 286 | }
|
283 | 287 | }, //end of drag function
|
284 |
| - stop: function(event, ui) { // on save, store toc position |
285 |
| - if (liveNotebook) { |
286 |
| - IPython.notebook.metadata.toc['toc_position'] = { |
287 |
| - 'left': $('#toc-wrapper').css('left'), |
288 |
| - 'top': $('#toc-wrapper').css('top'), |
289 |
| - 'width': $('#toc-wrapper').css('width'), |
290 |
| - 'height': $('#toc-wrapper').css('height'), |
291 |
| - 'right': $('#toc-wrapper').css('right') |
292 |
| - }; |
293 |
| - IPython.notebook.set_dirty(); |
294 |
| - } |
295 |
| - // Ensure position is fixed (again) |
296 |
| - $('#toc-wrapper').css('position', 'fixed'); |
297 |
| - }, |
| 288 | + stop: saveTocPosition, |
298 | 289 | containment: 'parent',
|
299 | 290 | snap: 'body, #site',
|
300 | 291 | snapTolerance: 20,
|
|
312 | 303 | makeUnmakeMinimized(cfg);
|
313 | 304 | }
|
314 | 305 | },
|
315 |
| - stop: function(event, ui) { // on save, store toc position |
316 |
| - if (liveNotebook) { |
317 |
| - IPython.notebook.metadata.toc['toc_position'] = { |
318 |
| - 'left': $('#toc-wrapper').css('left'), |
319 |
| - 'top': $('#toc-wrapper').css('top'), |
320 |
| - 'height': $('#toc-wrapper').css('height'), |
321 |
| - 'width': $('#toc-wrapper').css('width'), |
322 |
| - 'right': $('#toc-wrapper').css('right') |
323 |
| - }; |
324 |
| - $('#toc').css('height', $('#toc-wrapper').height() - $('#toc-header').height()) |
325 |
| - IPython.notebook.set_dirty(); |
326 |
| - } |
327 |
| - }, |
| 306 | + stop: saveTocPosition, |
328 | 307 | containment: 'parent',
|
329 | 308 | minHeight: 100,
|
330 | 309 | minWidth: 165,
|
331 |
| - }) |
| 310 | + }); |
332 | 311 |
|
333 | 312 | // On header/menu/toolbar resize, resize the toc itself
|
334 | 313 | $(window).on('resize', callbackPageResize);
|
|
602 | 581 | var wrap = $("#toc-wrapper");
|
603 | 582 | var show = wrap.is(':hidden');
|
604 | 583 | wrap.toggle(show);
|
605 |
| - setMd('toc_window_display', show); |
| 584 | + cfg['toc_window_display'] = setMd('toc_window_display', show); |
606 | 585 | setNotebookWidth(cfg);
|
607 | 586 | table_of_contents(cfg);
|
608 | 587 | };
|
|
0 commit comments