##// END OF EJS Templates
add raw cell toolbar preset
MinRK -
Show More
@@ -0,0 +1,60 b''
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2012 The IPython Development Team
3 //
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
7
8 //============================================================================
9 // CellToolbar Example
10 //============================================================================
11
12 (function(IPython) {
13 "use strict";
14
15 var CellToolbar = IPython.CellToolbar;
16 var raw_cell_preset = [];
17
18 var select_type = CellToolbar.utils.select_ui_generator([
19 ["None", "-"],
20 ["LaTeX", "text/latex"],
21 ["restructuredText", "text/restructuredtext"],
22 ["HTML", "text/html"],
23 ["markdown", "text/markdown"],
24 ["Python", "text/python"],
25 ["Custom", , "dialog"],
26
27 ],
28 // setter
29 function(cell, value) {
30 if (value === '-') {
31 delete cell.metadata.raw_mime;
32 } else if (value === 'dialog'){
33 // IPython.dialog.modal(
34 // "Set custom raw cell format",
35 //
36 // OK
37 // )
38 //
39 } else {
40 cell.metadata.raw_mime = value;
41 }
42 },
43 //getter
44 function(cell) {
45 return cell.metadata.raw_mime || "-";
46 },
47 // name
48 "Raw NBConvert Format",
49 // cell_types
50 ["raw"]
51 );
52
53 CellToolbar.register_callback('raw_cell.select', select_type);
54
55 raw_cell_preset.push('raw_cell.select');
56
57 CellToolbar.register_preset('Raw Cell Format', raw_cell_preset);
58 console.log('Raw Cell Format toolbar preset loaded.');
59
60 }(IPython)); No newline at end of file
@@ -125,7 +125,7 b' var IPython = (function (IPython) {'
125 // .addClass('ui-widget-content')
125 // .addClass('ui-widget-content')
126 .append($('<option/>').attr('value','code').text('Code'))
126 .append($('<option/>').attr('value','code').text('Code'))
127 .append($('<option/>').attr('value','markdown').text('Markdown'))
127 .append($('<option/>').attr('value','markdown').text('Markdown'))
128 .append($('<option/>').attr('value','raw').text('Raw Text'))
128 .append($('<option/>').attr('value','raw').text('Raw NBConvert'))
129 .append($('<option/>').attr('value','heading1').text('Heading 1'))
129 .append($('<option/>').attr('value','heading1').text('Heading 1'))
130 .append($('<option/>').attr('value','heading2').text('Heading 2'))
130 .append($('<option/>').attr('value','heading2').text('Heading 2'))
131 .append($('<option/>').attr('value','heading3').text('Heading 3'))
131 .append($('<option/>').attr('value','heading3').text('Heading 3'))
@@ -296,6 +296,7 b' class="notebook_app"'
296 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
296 <script src="{{ static_url("notebook/js/contexthint.js") }}" charset="utf-8"></script>
297
297
298 <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
298 <script src="{{ static_url("notebook/js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
299 <script src="{{ static_url("notebook/js/celltoolbarpresets/rawcell.js") }}" type="text/javascript" charset="utf-8"></script>
299 <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
300 <script src="{{ static_url("notebook/js/celltoolbarpresets/slideshow.js") }}" type="text/javascript" charset="utf-8"></script>
300
301
301 {% endblock %}
302 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now