diff --git a/IPython/html/static/notebook/js/celltoolbarpresets/rawcell.js b/IPython/html/static/notebook/js/celltoolbarpresets/rawcell.js new file mode 100644 index 0000000..74e2dac --- /dev/null +++ b/IPython/html/static/notebook/js/celltoolbarpresets/rawcell.js @@ -0,0 +1,60 @@ +//---------------------------------------------------------------------------- +// Copyright (C) 2012 The IPython Development Team +// +// Distributed under the terms of the BSD License. The full license is in +// the file COPYING, distributed as part of this software. +//---------------------------------------------------------------------------- + +//============================================================================ +// CellToolbar Example +//============================================================================ + +(function(IPython) { + "use strict"; + + var CellToolbar = IPython.CellToolbar; + var raw_cell_preset = []; + + var select_type = CellToolbar.utils.select_ui_generator([ + ["None", "-"], + ["LaTeX", "text/latex"], + ["restructuredText", "text/restructuredtext"], + ["HTML", "text/html"], + ["markdown", "text/markdown"], + ["Python", "text/python"], + ["Custom", , "dialog"], + + ], + // setter + function(cell, value) { + if (value === '-') { + delete cell.metadata.raw_mime; + } else if (value === 'dialog'){ + // IPython.dialog.modal( + // "Set custom raw cell format", + // + // OK + // ) + // + } else { + cell.metadata.raw_mime = value; + } + }, + //getter + function(cell) { + return cell.metadata.raw_mime || "-"; + }, + // name + "Raw NBConvert Format", + // cell_types + ["raw"] + ); + + CellToolbar.register_callback('raw_cell.select', select_type); + + raw_cell_preset.push('raw_cell.select'); + + CellToolbar.register_preset('Raw Cell Format', raw_cell_preset); + console.log('Raw Cell Format toolbar preset loaded.'); + +}(IPython)); \ No newline at end of file diff --git a/IPython/html/static/notebook/js/maintoolbar.js b/IPython/html/static/notebook/js/maintoolbar.js index b266229..3145a8b 100644 --- a/IPython/html/static/notebook/js/maintoolbar.js +++ b/IPython/html/static/notebook/js/maintoolbar.js @@ -125,7 +125,7 @@ var IPython = (function (IPython) { // .addClass('ui-widget-content') .append($('