##// END OF EJS Templates
Merge pull request #2333 from Carreau/metaui...
Brian E. Granger -
r9086:57b04505 merge
parent child Browse files
Show More
@@ -0,0 +1,53 b''
1 /*Css for the metadata edit area*/
2
3 .celltoolbar{
4 border:thin solid #DDD;
5 margin-left:81px;
6 border-bottom:none;
7 background : #EEE;
8 border-top-right-radius: 3px;
9 border-top-left-radius: 3px;
10 display:none;
11 }
12
13 .code_cell .celltoolbar{
14 margin-left:81px;
15 }
16
17 .text_cell .celltoolbar{
18 margin-left:0px;
19 }
20
21 .celltoolbar-on div.input_area , .celltoolbar-on div.text_cell_input{
22 border-top-right-radius: 0px;
23 border-top-left-radius: 0px;
24 }
25
26 .celltoolbar-on .celltoolbar {
27 display:block;
28 }
29
30 .celltoolbar ui-button {
31 border :none;
32 }
33
34 .button_container {
35 float:right;
36 }
37
38 .button_container .ui-state-default, .button_container .ui-state-hover, .button_container .ui-state-hover span{
39 border-radius : 0 0 0 0;
40 border : none;
41 }
42
43 .celltoolbar select {
44 margin:10px;
45 margin-top:0px;
46 margin-bottom:0px;
47 }
48
49 .celltoolbar input[type=checkbox] {
50 margin-bottom:1px;
51
52 }
53
@@ -0,0 +1,358 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
10 //============================================================================
11
12
13 /**
14 * A Module to control the per-cell toolbar.
15 * @module IPython
16 * @namespace IPython
17 * @submodule CellToolbar
18 */
19 var IPython = (function (IPython) {
20 "use strict";
21
22
23 /**
24 * @constructor
25 * @class CellToolbar
26 * @param {The cell to attach the metadata UI to} cell
27 */
28 var CellToolbar = function (cell) {
29 CellToolbar._instances.push(this);
30 this.inner_element = $('<div/>');
31 this.cell = cell;
32 this.element = $('<div/>').addClass('celltoolbar')
33 .append(this.inner_element)
34 this.rebuild();
35 return this;
36 };
37
38 CellToolbar.dropdown_preset_element = $('<select/>')
39 .addClass('ui-widget ui-widget-content')
40 .attr('id', 'celltoolbar_selector')
41 .append($('<option/>').attr('value', '').text('None'))
42
43 CellToolbar.dropdown_preset_element.change(function(){
44 var val = CellToolbar.dropdown_preset_element.val()
45 if(val ==''){
46 $('body').removeClass('celltoolbar-on')
47 } else {
48 $('body').addClass('celltoolbar-on')
49 CellToolbar.activate_preset(val)
50 }
51 })
52
53
54
55 /**
56 * Class variable that should contain a dict of all availlable callback
57 * we need to think of wether or not we allow nested namespace
58 * @property _callback_dict
59 * @private
60 * @static
61 * @type Dict
62 */
63 CellToolbar._callback_dict = {};
64
65 /**
66 * Class variable that should contain the reverse order list of the button
67 * to add to the toolbar of each cell
68 * @property _ui_controls_list
69 * @private
70 * @static
71 * @type List
72 */
73 CellToolbar._ui_controls_list = [];
74
75 /**
76 * Class variable that should contains the CellToolbar instances for each
77 * cell of the notebook
78 *
79 * @private
80 * @property _instances
81 * @static
82 * @type List
83 */
84 CellToolbar._instances =[]
85
86 /**
87 * keep a list of all the availlabel presets for the toolbar
88 * @private
89 * @property _presets
90 * @static
91 * @type Dict
92 */
93 CellToolbar._presets ={}
94
95 // this is by design not a prototype.
96 /**
97 * Register a callback to create an UI element in a cell toolbar.
98 * @method register_callback
99 * @param name {String} name to use to refer to the callback. It is advised to use a prefix with the name
100 * for easier sorting and avoid collision
101 * @param callback {function(div, cell)} callback that will be called to generate the ui element
102 *
103 *
104 * The callback will receive the following element :
105 *
106 * * a div in which to add element.
107 * * the cell it is responsible from
108 *
109 * @example
110 *
111 * Example that create callback for a button that toggle between `true` and `false` label,
112 * with the metadata under the key 'foo' to reflect the status of the button.
113 *
114 * // first param reference to a DOM div
115 * // second param reference to the cell.
116 * var toggle = function(div, cell) {
117 * var button_container = $(div)
118 *
119 * // let's create a button that show the current value of the metadata
120 * var button = $('<div/>').button({label:String(cell.metadata.foo)});
121 *
122 * // On click, change the metadata value and update the button label
123 * button.click(function(){
124 * var v = cell.metadata.foo;
125 * cell.metadata.foo = !v;
126 * button.button("option", "label", String(!v));
127 * })
128 *
129 * // add the button to the DOM div.
130 * button_container.append(button);
131 * }
132 *
133 * // now we register the callback under the name `foo` to give the
134 * // user the ability to use it later
135 * CellToolbar.register_callback('foo', toggle);
136 */
137 CellToolbar.register_callback = function(name, callback){
138 // Overwrite if it already exists.
139 CellToolbar._callback_dict[name] = callback;
140 };
141
142 /**
143 * Register a preset of UI element in a cell toolbar.
144 * Not supported Yet.
145 * @method register_preset
146 * @param name {String} name to use to refer to the preset. It is advised to use a prefix with the name
147 * for easier sorting and avoid collision
148 * @param preset_list {List of String} reverse order of the button in the toolbar. Each String of the list
149 * should correspond to a name of a registerd callback.
150 *
151 * @private
152 * @example
153 *
154 * CellToolbar.register_callback('foo.c1', function(div, cell){...});
155 * CellToolbar.register_callback('foo.c2', function(div, cell){...});
156 * CellToolbar.register_callback('foo.c3', function(div, cell){...});
157 * CellToolbar.register_callback('foo.c4', function(div, cell){...});
158 * CellToolbar.register_callback('foo.c5', function(div, cell){...});
159 *
160 * CellToolbar.register_preset('foo.foo_preset1', ['foo.c1', 'foo.c2', 'foo.c5'])
161 * CellToolbar.register_preset('foo.foo_preset2', ['foo.c4', 'foo.c5'])
162 */
163 CellToolbar.register_preset = function(name, preset_list){
164 CellToolbar._presets[name] = preset_list
165 CellToolbar.dropdown_preset_element.append(
166 $('<option/>').attr('value', name).text(name)
167 )
168 }
169 /**
170 * Activate an UI preset from `register_preset`
171 *
172 * This does not update the selection UI.
173 *
174 * @method activate_preset
175 * @param preset_name {String} string corresponding to the preset name
176 *
177 * @static
178 * @private
179 * @example
180 *
181 * CellToolbar.activate_preset('foo.foo_preset1');
182 */
183 CellToolbar.activate_preset= function(preset_name){
184 var preset = CellToolbar._presets[preset_name];
185
186 if(preset != undefined){
187 CellToolbar._ui_controls_list = preset;
188 CellToolbar.rebuild_all();
189 }
190 }
191
192
193 // this is by design not a prototype.
194 /**
195 * This should be called on the class and not on a instance as it will trigger
196 * rebuild of all the instances.
197 * @method rebuild_all
198 * @static
199 *
200 */
201 CellToolbar.rebuild_all = function(){
202 for(var i in CellToolbar._instances){
203 CellToolbar._instances[i].rebuild();
204 }
205 }
206
207 /**
208 * Rebuild all the button on the toolbar to update it's state.
209 * @method rebuild
210 */
211 CellToolbar.prototype.rebuild = function(){
212 // strip evrything from the div
213 // which is probabli metainner.
214 // or this.element.
215 this.inner_element.empty();
216
217 var cdict = CellToolbar._callback_dict;
218 var preset = CellToolbar._ui_controls_list;
219 // Yes we iterate on the class varaible, not the instance one.
220 for ( var index in CellToolbar._ui_controls_list){
221 var local_div = $('<div/>').addClass('button_container');
222 // Note,
223 // do this the other way, wrap in try/catch and don't append if any errors.
224 this.inner_element.append(local_div)
225 cdict[preset[index]](local_div, this.cell)
226 }
227
228 }
229
230
231 /**
232 */
233 CellToolbar.utils = {};
234
235 /**
236 * A utility function to generate bindings between a checkbox and cell/metadata
237 * @method utils.checkbox_ui_generator
238 * @static
239 *
240 * @param name {string} Label in front of the checkbox
241 * @param setter {function( cell, newValue )}
242 * A setter method to set the newValue
243 * @param getter {function( cell )}
244 * A getter methods which return the current value.
245 *
246 * @return callback {function( div, cell )} Callback to be passed to `register_callback`
247 *
248 * @example
249 *
250 * An exmple that bind the subkey `slideshow.isSectionStart` to a checkbox with a `New Slide` label
251 *
252 * var newSlide = CellToolbar.utils.checkbox_ui_generator('New Slide',
253 * // setter
254 * function(cell, value){
255 * // we check that the slideshow namespace exist and create it if needed
256 * if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
257 * // set the value
258 * cell.metadata.slideshow.isSectionStart = value
259 * },
260 * //geter
261 * function(cell){ var ns = cell.metadata.slideshow;
262 * // if the slideshow namespace does not exist return `undefined`
263 * // (will be interpreted as `false` by checkbox) otherwise
264 * // return the value
265 * return (ns == undefined)? undefined: ns.isSectionStart
266 * }
267 * );
268 *
269 * CellToolbar.register_callback('newSlide', newSlide);
270 *
271 */
272 CellToolbar.utils.checkbox_ui_generator = function(name, setter, getter){
273 return function(div, cell) {
274 var button_container = $(div)
275
276 var chkb = $('<input/>').attr('type', 'checkbox');
277 var lbl = $('<label/>').append($('<span/>').text(name).css('font-size', '77%'));
278 lbl.append(chkb);
279 chkb.attr("checked", getter(cell));
280
281 chkb.click(function(){
282 var v = getter(cell);
283 setter(cell, !v);
284 chkb.attr("checked", !v);
285 })
286 button_container.append($('<div/>').append(lbl));
287
288 }
289 }
290
291 /**
292 * A utility function to generate bindings between a dropdown list cell
293 * @method utils.select_ui_generator
294 * @static
295 *
296 * @param list_list {list of sublist} List of sublist of metadata value and name in the dropdown list.
297 * subslit shoud contain 2 element each, first a string that woul be displayed in the dropdown list,
298 * and second the corresponding value to be passed to setter/return by getter.
299 * @param setter {function( cell, newValue )}
300 * A setter method to set the newValue
301 * @param getter {function( cell )}
302 * A getter methods which return the current value of the metadata.
303 * @param [label=""] {String} optionnal label for the dropdown menu
304 *
305 * @return callback {function( div, cell )} Callback to be passed to `register_callback`
306 *
307 * @example
308 *
309 * var select_type = CellToolbar.utils.select_ui_generator([
310 * ["<None>" , undefined ],
311 * ["Header Slide" , "header_slide" ],
312 * ["Slide" , "slide" ],
313 * ["Fragment" , "fragment" ],
314 * ["Skip" , "skip" ],
315 * ],
316 * // setter
317 * function(cell, value){
318 * // we check that the slideshow namespace exist and create it if needed
319 * if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
320 * // set the value
321 * cell.metadata.slideshow.slide_type = value
322 * },
323 * //geter
324 * function(cell){ var ns = cell.metadata.slideshow;
325 * // if the slideshow namespace does not exist return `undefined`
326 * // (will be interpreted as `false` by checkbox) otherwise
327 * // return the value
328 * return (ns == undefined)? undefined: ns.slide_type
329 * }
330 * CellToolbar.register_callback('slideshow.select', select_type);
331 *
332 */
333 CellToolbar.utils.select_ui_generator = function(list_list, setter, getter, label){
334 label= label? label: "";
335 return function(div, cell) {
336 var button_container = $(div)
337 var lbl = $("<label/>").append($('<span/>').text(label).css('font-size', '77%'));
338 var select = $('<select/>');
339 for(var itemn in list_list){
340 var opt = $('<option/>');
341 opt.attr('value', list_list[itemn][1])
342 opt.text(list_list[itemn][0])
343 select.append(opt);
344 }
345 select.val(getter(cell));
346 select.change(function(){
347 setter(cell, select.val());
348 });
349 button_container.append($('<div/>').append(lbl).append(select));
350
351 }
352 };
353
354
355 IPython.CellToolbar = CellToolbar;
356
357 return IPython;
358 }(IPython));
@@ -0,0 +1,94 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 Default
10 //============================================================================
11
12 /**
13 * Example Use for the CellToolbar library
14 */
15 // IIFE without asignement, we don't modifiy the IPython namespace
16 (function (IPython) {
17 "use strict";
18
19 var CellToolbar = IPython.CellToolbar;
20
21 var raw_edit = function(cell){
22
23 var md = cell.metadata
24 var error_div = $('<div/>').css('color','red')
25
26 var textarea = $('<textarea/>')
27 .attr('rows','13')
28 .attr('cols','75')
29 .attr('name','metadata')
30 .text(JSON.stringify(md, null,4)||'');
31 var dialogform = $('<div/>').attr('title','Edit the metadata')
32 .append(
33 $('<form/>').append(
34 $('<fieldset/>').append(
35 $('<label/>')
36 .attr('for','metadata')
37 .text("Manually edit the JSON below to manipulate the metadata for this cell. This assumes you know what you are doing and won't complain if it breaks your notebook. We also recommend putting your metadata attributes in an appropriately named sub-structure, so they don't conflict with those of others.")
38 )
39 .append(error_div)
40 .append($('<br/>'))
41 .append(
42 textarea
43 )
44 )
45 );
46 var editor = CodeMirror.fromTextArea(textarea[0], {
47 lineNumbers: true,
48 matchBrackets: true,
49 });
50 $(dialogform).dialog({
51 autoOpen: true,
52 height: 300,
53 width: 650,
54 modal: true,
55 buttons: {
56 "Ok": function() {
57 //validate json and set it
58 try {
59 var json = JSON.parse(editor.getValue());
60 cell.metadata = json;
61 $( this ).dialog( "close" );
62 }
63 catch(e)
64 {
65 error_div.text('Warning, invalid json, not saved');
66 }
67 },
68 Cancel: function() {
69 $( this ).dialog( "close" );
70 }
71 },
72 close: function() {
73 //cleanup on close
74 $(this).remove();
75 }
76 });
77 editor.refresh();
78 }
79
80 var add_raw_edit_button = function(div, cell) {
81 var button_container = div
82 var button = $('<div/>').button({label:'Raw Edit'})
83 .click(function(){raw_edit(cell); return false;})
84 button_container.append(button);
85 }
86
87 CellToolbar.register_callback('default.rawedit',add_raw_edit_button);
88 var example_preset = []
89 example_preset.push('default.rawedit');
90
91 CellToolbar.register_preset('Default',example_preset);
92 console.log('Default extension for metadata editting loaded.');
93
94 }(IPython));
@@ -0,0 +1,154 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 /**
13 * Example Use for the CellToolbar library
14 * add the following to your custom.js to load
15 * Celltoolbar UI for slideshow
16 *
17 * ```
18 * $.getScript('/static/js/celltoolbarpresets/example.js');
19 * ```
20 */
21 // IIFE without asignement, we don't modifiy the IPython namespace
22 (function (IPython) {
23 "use strict";
24
25 var CellToolbar = IPython.CellToolbar;
26
27 var example_preset = [];
28
29 var simple_button = function(div, cell) {
30 var button_container = $(div);
31 var button = $('<div/>').button({icons:{primary:'ui-icon-locked'}});
32 var fun = function(value){
33 try{
34 if(value){
35 cell.code_mirror.setOption('readOnly','nocursor')
36 button.button('option','icons',{primary:'ui-icon-locked'})
37 } else {
38 cell.code_mirror.setOption('readOnly',false)
39 button.button('option','icons',{primary:'ui-icon-unlocked'})
40 }
41 } catch(e){}
42
43 }
44 fun(cell.metadata.ro)
45 button.click(function(){
46 var v = cell.metadata.ro;
47 var locked = !v;
48 cell.metadata.ro = locked;
49 fun(locked)
50 })
51 .css('height','16px')
52 .css('width','35px');
53 button_container.append(button);
54 }
55
56 CellToolbar.register_callback('example.lock',simple_button);
57 example_preset.push('example.lock');
58
59 var toggle_test = function(div, cell) {
60 var button_container = $(div)
61 var button = $('<div/>')
62 .button({label:String(cell.metadata.foo)}).
63 css('width','65px');
64 button.click(function(){
65 var v = cell.metadata.foo;
66 cell.metadata.foo = !v;
67 button.button("option","label",String(!v));
68 })
69 button_container.append(button);
70 }
71
72 CellToolbar.register_callback('example.toggle',toggle_test);
73 example_preset.push('example.toggle');
74
75 var checkbox_test = CellToolbar.utils.checkbox_ui_generator('Yes/No',
76 // setter
77 function(cell, value){
78 // we check that the slideshow namespace exist and create it if needed
79 if (cell.metadata.yn_test == undefined){cell.metadata.yn_test = {}}
80 // set the value
81 cell.metadata.yn_test.value = value
82 },
83 //geter
84 function(cell){ var ns = cell.metadata.yn_test;
85 // if the slideshow namespace does not exist return `undefined`
86 // (will be interpreted as `false` by checkbox) otherwise
87 // return the value
88 return (ns == undefined)? undefined: ns.value
89 }
90 );
91
92
93 CellToolbar.register_callback('example.checkbox',checkbox_test);
94 example_preset.push('example.checkbox');
95
96 var select_test = CellToolbar.utils.select_ui_generator([
97 ["-" ,undefined ],
98 ["Header Slide" ,"header_slide" ],
99 ["Slide" ,"slide" ],
100 ["Fragment" ,"fragment" ],
101 ["Skip" ,"skip" ],
102 ],
103 // setter
104 function(cell,value){
105 // we check that the slideshow namespace exist and create it if needed
106 if (cell.metadata.test == undefined){cell.metadata.test = {}}
107 // set the value
108 cell.metadata.test.slide_type = value
109 },
110 //geter
111 function(cell){ var ns = cell.metadata.test;
112 // if the slideshow namespace does not exist return `undefined`
113 // (will be interpreted as `false` by checkbox) otherwise
114 // return the value
115 return (ns == undefined)? undefined: ns.slide_type
116 });
117
118 CellToolbar.register_callback('example.select',select_test);
119 example_preset.push('example.select');
120
121 var simple_dialog = function(title,text){
122 var dlg = $('<div/>').attr('title',title)
123 .append($('<p/>').text(text))
124 $(dlg).dialog({
125 autoOpen: true,
126 height: 300,
127 width: 650,
128 modal: true,
129 close: function() {
130 //cleanup on close
131 $(this).remove();
132 }
133 });
134 }
135
136 var add_simple_dialog_button = function(div, cell) {
137 var help_text = ["This is the Metadata editting UI.",
138 "It heavily rely on plugin to work ",
139 "and is still under developpement. You shouldn't wait too long before",
140 " seeing some customisable buttons in those toolbar."
141 ].join('\n')
142 var button_container = $(div)
143 var button = $('<div/>').button({label:'?'})
144 .click(function(){simple_dialog('help',help_text); return false;})
145 button_container.append(button);
146 }
147
148 CellToolbar.register_callback('example.help',add_simple_dialog_button)
149 example_preset.push('example.help')
150
151 CellToolbar.register_preset('Example',example_preset);
152 console.log('Example extension for metadata editting loaded.');
153
154 }(IPython));
@@ -29,6 +29,7 b' span#notebook_name {'
29 font-size: 146.5%;
29 font-size: 146.5%;
30 }
30 }
31
31
32
32 .ui-menubar-item .ui-button .ui-button-text {
33 .ui-menubar-item .ui-button .ui-button-text {
33 padding: 0.4em 1.0em;
34 padding: 0.4em 1.0em;
34 font-size: 100%;
35 font-size: 100%;
@@ -80,8 +81,11 b' span#notebook_name {'
80 padding: 3px 15px;
81 padding: 3px 15px;
81 }
82 }
82
83
83 #cell_type {
84 #maintoolbar > select, #maintoolbar label {
84 font-size: 85%;
85 font-size: 85%;
86 margin-left:0.3em;
87 margin-right:0.3em;
88
85 }
89 }
86
90
87
91
@@ -50,7 +50,9 b' var IPython = (function (IPython) {'
50 * and will be called by Base Class constructor.
50 * and will be called by Base Class constructor.
51 * @method create_element
51 * @method create_element
52 */
52 */
53 Cell.prototype.create_element = function () {};
53 Cell.prototype.create_element = function () {
54 this.celltoolbar = new IPython.CellToolbar(this);
55 };
54
56
55
57
56 /**
58 /**
@@ -163,6 +165,7 b' var IPython = (function (IPython) {'
163 if (data.metadata !== undefined) {
165 if (data.metadata !== undefined) {
164 this.metadata = data.metadata;
166 this.metadata = data.metadata;
165 }
167 }
168 this.celltoolbar.rebuild();
166 };
169 };
167
170
168
171
@@ -58,7 +58,10 b' var IPython = (function (IPython) {'
58
58
59 /** @method create_element */
59 /** @method create_element */
60 CodeCell.prototype.create_element = function () {
60 CodeCell.prototype.create_element = function () {
61 IPython.Cell.prototype.create_element.apply(this, arguments);
62
61 var cell = $('<div></div>').addClass('cell border-box-sizing code_cell vbox');
63 var cell = $('<div></div>').addClass('cell border-box-sizing code_cell vbox');
64 cell.append(this.celltoolbar.element);
62 cell.attr('tabindex','2');
65 cell.attr('tabindex','2');
63 var input = $('<div></div>').addClass('input hbox');
66 var input = $('<div></div>').addClass('input hbox');
64 input.append($('<div/>').addClass('prompt input_prompt'));
67 input.append($('<div/>').addClass('prompt input_prompt'));
@@ -28,6 +28,18 b''
28 * ]);
28 * ]);
29 * });
29 * });
30 *
30 *
31 * Example :
32 *
33 * Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
34 * to load custom script into the notebook.
35 *
36 * // to load the metadata ui extension example.
37 * $.getScript('/static/js/celltoolbarpresets/example.js');
38 * // or
39 * // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
40 * $.getScript('/static/js/celltoolbarpresets/slideshow.js');
41 *
42 *
31 * @module IPython
43 * @module IPython
32 * @namespace IPython
44 * @namespace IPython
33 * @class customjs
45 * @class customjs
@@ -17,6 +17,9 b' var IPython = (function (IPython) {'
17 this.construct();
17 this.construct();
18 this.add_drop_down_list();
18 this.add_drop_down_list();
19 this.bind_events();
19 this.bind_events();
20 $(this.selector)
21 .append($('<label/>').text('Cell Toolbar:'))
22 .append(IPython.CellToolbar.dropdown_preset_element)
20 };
23 };
21
24
22 MainToolBar.prototype = new IPython.ToolBar();
25 MainToolBar.prototype = new IPython.ToolBar();
@@ -115,8 +118,6 b' var IPython = (function (IPython) {'
115 }
118 }
116 }
119 }
117 ],'run_int');
120 ],'run_int');
118
119
120 };
121 };
121
122
122 MainToolBar.prototype.add_drop_down_list = function () {
123 MainToolBar.prototype.add_drop_down_list = function () {
@@ -42,7 +42,9 b' var IPython = (function (IPython) {'
42 * @private
42 * @private
43 */
43 */
44 TextCell.prototype.create_element = function () {
44 TextCell.prototype.create_element = function () {
45 var cell = $("<div>").addClass('cell text_cell border-box-sizing');
45 IPython.Cell.prototype.create_element.apply(this, arguments);
46 var cell = $("<div>").addClass('cell text_cell border-box-sizing vbox');
47 cell.append(this.celltoolbar.element);
46 cell.attr('tabindex','2');
48 cell.attr('tabindex','2');
47 var input_area = $('<div/>').addClass('text_cell_input border-box-sizing');
49 var input_area = $('<div/>').addClass('text_cell_input border-box-sizing');
48 this.code_mirror = CodeMirror(input_area.get(0), {
50 this.code_mirror = CodeMirror(input_area.get(0), {
@@ -36,7 +36,7 b' var IPython = (function (IPython) {'
36 *
36 *
37 * @example
37 * @example
38 *
38 *
39 * IPython.toolbar.add_button_group([
39 * IPython.toolbar.add_buttons_group([
40 * {
40 * {
41 * label:'my button',
41 * label:'my button',
42 * icon:'ui-icon-disk',
42 * icon:'ui-icon-disk',
@@ -17,6 +17,7 b' window.mathjax_url = "{{mathjax_url}}";'
17 <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/>
17 <link rel="stylesheet" href="{{ static_url("prettify/prettify.css") }}"/>
18
18
19 <link rel="stylesheet" href="{{ static_url("css/notebook.css") }}" type="text/css" />
19 <link rel="stylesheet" href="{{ static_url("css/notebook.css") }}" type="text/css" />
20 <link rel="stylesheet" href="{{ static_url("css/celltoolbar.css") }}" type="text/css" />
20 <link rel="stylesheet" href="{{ static_url("css/tooltip.css") }}" type="text/css" />
21 <link rel="stylesheet" href="{{ static_url("css/tooltip.css") }}" type="text/css" />
21 <link rel="stylesheet" href="{{ static_url("css/renderedhtml.css") }}" type="text/css" />
22 <link rel="stylesheet" href="{{ static_url("css/renderedhtml.css") }}" type="text/css" />
22
23
@@ -203,6 +204,7 b' data-notebook-id={{notebook_id}}'
203 <script src="{{ static_url("js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
204 <script src="{{ static_url("js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script>
204 <script src="{{ static_url("js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
205 <script src="{{ static_url("js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script>
205 <script src="{{ static_url("js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
206 <script src="{{ static_url("js/cell.js") }}" type="text/javascript" charset="utf-8"></script>
207 <script src="{{ static_url("js/celltoolbar.js") }}" type="text/javascript" charset="utf-8"></script>
206 <script src="{{ static_url("js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
208 <script src="{{ static_url("js/codecell.js") }}" type="text/javascript" charset="utf-8"></script>
207 <script src="{{ static_url("js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
209 <script src="{{ static_url("js/completer.js") }}" type="text/javascript" charset="utf-8"></script>
208 <script src="{{ static_url("js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
210 <script src="{{ static_url("js/textcell.js") }}" type="text/javascript" charset="utf-8"></script>
@@ -221,7 +223,7 b' data-notebook-id={{notebook_id}}'
221 <script src="{{ static_url("js/notebookmain.js") }}" type="text/javascript" charset="utf-8"></script>
223 <script src="{{ static_url("js/notebookmain.js") }}" type="text/javascript" charset="utf-8"></script>
222
224
223 <script src="{{ static_url("js/contexthint.js") }}" charset="utf-8"></script>
225 <script src="{{ static_url("js/contexthint.js") }}" charset="utf-8"></script>
224 {% endblock %}
225
226
226
227 <script src="{{ static_url("js/celltoolbarpresets/default.js") }}" type="text/javascript" charset="utf-8"></script>
227
228
229 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now