##// END OF EJS Templates
refactor to improve cell switching in edit mode...
refactor to improve cell switching in edit mode This code was repeated in both CodeCell and TextCell, both of which are extensions of Cell, so this just unifies the logic in Cell. TextCell had logic here to check if the cell was rendered or not, but I don't believe it is possible to end up triggering such a code path. (Should that be required, I can always just add back these methods to TextCell, performing the .rendered==True check, and calling the Cell prior to this, code mirror at_top would only return true on if the cursor was at the first character of the top line. Now, pressing up arrow on any character on the top line will take you to the cell above. The same applies for the bottom line. Pressing down arrow would only go to the next cell if the cursor was at a location *after* the last character (something that is only possible to achieve in vim mode if the last line is empty, for example). Now, down arrow on any character of the last line will go to the next cell.

File last commit:

r15672:8a560994
r15754:d60e793e
Show More
basic.tpl
189 lines | 4.3 KiB | application/vnd.groove-tool-template | SmartyLexer
{%- extends 'display_priority.tpl' -%}
{% block codecell %}
<div class="cell border-box-sizing code_cell">
{{ super() }}
</div>
{%- endblock codecell %}
{% block input_group -%}
<div class="input">
{{ super() }}
</div>
{% endblock input_group %}
{% block output_group %}
<div class="output_wrapper">
<div class="output">
{{ super() }}
</div>
</div>
{% endblock output_group %}
{% block in_prompt -%}
<div class="prompt input_prompt">
In&nbsp;[{{ cell.prompt_number }}]:
</div>
{%- endblock in_prompt %}
{% block empty_in_prompt -%}
<div class="prompt input_prompt">
</div>
{%- endblock empty_in_prompt %}
{#
output_prompt doesn't do anything in HTML,
because there is a prompt div in each output area (see output block)
#}
{% block output_prompt %}
{% endblock output_prompt %}
{% block input %}
<div class="input_area box-flex1">
{{ cell.input | highlight2html(language=resources.get('language'), metadata=cell.metadata) }}
</div>
{%- endblock input %}
{% block output %}
<div class="output_area">
{%- if output.output_type == 'pyout' -%}
<div class="prompt output_prompt">
Out[{{ cell.prompt_number }}]:
{%- else -%}
<div class="prompt">
{%- endif -%}
</div>
{{ super() }}
</div>
{% endblock output %}
{% block markdowncell scoped %}
<div class="cell border-box-sizing text_cell">
<div class="input">
{{ self.empty_in_prompt() }}
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
{{ cell.source | markdown2html | strip_files_prefix }}
</div>
</div>
</div>
</div>
{%- endblock markdowncell %}
{% block headingcell scoped %}
<div class="cell border-box-sizing text_cell">
<div class="input">
{{ self.empty_in_prompt() }}
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
{{ ("#" * cell.level + cell.source) | replace('\n', ' ') | markdown2html | strip_files_prefix | add_anchor }}
</div>
</div>
</div>
</div>
{% endblock headingcell %}
{% block unknowncell scoped %}
unknown type {{ cell.type }}
{% endblock unknowncell %}
{% block pyout -%}
<div class="box-flex1 output_subarea output_pyout">
{% block data_priority scoped %}
{{ super() }}
{% endblock %}
</div>
{%- endblock pyout %}
{% block stream_stdout -%}
<div class="box-flex1 output_subarea output_stream output_stdout">
<pre>
{{ output.text | ansi2html }}
</pre>
</div>
{%- endblock stream_stdout %}
{% block stream_stderr -%}
<div class="box-flex1 output_subarea output_stream output_stderr">
<pre>
{{ output.text | ansi2html }}
</pre>
</div>
{%- endblock stream_stderr %}
{% block data_svg -%}
{%- if output.svg_filename %}
<img src="{{output.svg_filename | posix_path}}"
{%- else %}
{{ output.svg }}
{%- endif %}
{%- endblock data_svg %}
{% block data_html -%}
<div class="output_html rendered_html">
{{ output.html }}
</div>
{%- endblock data_html %}
{% block data_png %}
{%- if output.png_filename %}
<img src="{{output.png_filename | posix_path}}"
{%- else %}
<img src="data:image/png;base64,{{ output.png }}"
{%- endif %}
{%- if 'metadata' in output and 'width' in output.metadata.get('png', {}) %}
width={{output.metadata['png']['width']}}
{%- endif %}
{%- if 'metadata' in output and 'height' in output.metadata.get('png', {}) %}
height={{output.metadata['png']['height']}}
{%- endif %}
>
{%- endblock data_png %}
{% block data_jpg %}
{%- if output.jpeg_filename %}
<img src="{{output.jpeg_filename | posix_path}}"
{%- else %}
<img src="data:image/jpeg;base64,{{ output.jpeg }}"
{%- endif %}
{%- if 'metadata' in output and 'width' in output.metadata.get('jpeg', {}) %}
width={{output.metadata['jpeg']['width']}}
{%- endif %}
{%- if 'metadata' in output and 'height' in output.metadata.get('jpeg', {}) %}
height={{output.metadata['jpeg']['height']}}
{%- endif %}
>
{%- endblock data_jpg %}
{% block data_latex %}
{{ output.latex }}
{%- endblock data_latex %}
{% block pyerr -%}
<div class="box-flex1 output_subarea output_pyerr">
<pre>{{ super() }}</pre>
</div>
{%- endblock pyerr %}
{%- block traceback_line %}
{{ line | ansi2html }}
{%- endblock traceback_line %}
{%- block data_text %}
<pre>
{{ output.text | ansi2html }}
</pre>
{%- endblock -%}
{%- block data_javascript %}
<script type="text/javascript">
{{ output.javascript }}
</script>
{%- endblock -%}
{%- block display_data scoped -%}
<div class="box-flex1 output_subarea output_display_data">
{{ super() }}
</div>
{%- endblock display_data -%}