##// END OF EJS Templates
Backport PR #5459: Fix interact animation page jump FF...
Backport PR #5459: Fix interact animation page jump FF Firefox doesn't render images immediately as the data is available. When animating the way that we animate, this causes the output area to collapse quickly before returning to its original size. When the output area collapses, FireFox scrolls upwards in attempt to compensate for the lost vertical content (so it looks like you are on the same spot in the page, with respect to the contents below the image's prior location). The solution is to resize the image output after the `img onload` event has fired. This PR: - Releases the `clear_output` height lock after the image has been loaded (instead of immediately or using a timeout). - Removes a `setTimeout` call in the `append_output` method. - `clear_output` in zmqshell no longer sends `\r` to the stream outputs. closes #5128

File last commit:

r13846:9d653c0c
r16229:ff1462d3
Show More
revealhelp.py
63 lines | 2.5 KiB | text/x-python | PythonLexer
"""Module that pre-processes the notebook for export via Reveal.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from .base import Preprocessor
from IPython.utils.traitlets import Unicode
#-----------------------------------------------------------------------------
# Classes and functions
#-----------------------------------------------------------------------------
class RevealHelpPreprocessor(Preprocessor):
url_prefix = Unicode('reveal.js', config=True,
help="""The URL prefix for reveal.js.
This can be a a relative URL for a local copy of reveal.js,
or point to a CDN.
For speaker notes to work, a local reveal.js prefix must be used.
"""
)
def preprocess(self, nb, resources):
"""
Called once to 'preprocess' contents of the notebook.
Parameters
----------
nb : NotebookNode
Notebook being converted
resources : dictionary
Additional resources used in the conversion process. Allows
preprocessors to pass variables into the Jinja engine.
"""
for worksheet in nb.worksheets:
for index, cell in enumerate(worksheet.cells):
#Make sure the cell has slideshow metadata.
cell.metadata.slide_type = cell.get('metadata', {}).get('slideshow', {}).get('slide_type', '-')
#Get the slide type. If type is start of subslide or slide,
#end the last subslide/slide.
if cell.metadata.slide_type in ['slide']:
worksheet.cells[index - 1].metadata.slide_helper = 'slide_end'
if cell.metadata.slide_type in ['subslide']:
worksheet.cells[index - 1].metadata.slide_helper = 'subslide_end'
if not isinstance(resources['reveal'], dict):
resources['reveal'] = {}
resources['reveal']['url_prefix'] = self.url_prefix
return nb, resources