##// END OF EJS Templates
setting an option to null sets the default in CodeMirror...
setting an option to null sets the default in CodeMirror matching the unset behavior in config

File last commit:

r17454:806bf0f9
r19311:9c060bc5
Show More
slideshow.js
46 lines | 1.7 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Fixed cell toolbars
r17217 // Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087
Jonathan Frederic
Fixed cell toolbars
r17217 define([
'jquery',
'notebook/js/celltoolbar',
], function($, celltoolbar) {
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 "use strict";
Jonathan Frederic
Fixed cell toolbars
r17217
var CellToolbar = celltoolbar.CellToolbar;
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 var slideshow_preset = [];
var select_type = CellToolbar.utils.select_ui_generator([
Matthias BUSSONNIER
fixes #4039....
r12649 ["-" ,"-" ],
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 ["Slide" ,"slide" ],
Matthias BUSSONNIER
Change Slide denomination...
r9088 ["Sub-Slide" ,"subslide" ],
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 ["Fragment" ,"fragment" ],
["Skip" ,"skip" ],
Matthias BUSSONNIER
Change Slide denomination...
r9088 ["Notes" ,"notes" ],
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 ],
// setter
function(cell, value){
// we check that the slideshow namespace exist and create it if needed
Jonathan Frederic
Fixed cell toolbars
r17217 if (cell.metadata.slideshow === undefined){cell.metadata.slideshow = {};}
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 // set the value
Jonathan Frederic
Fixed cell toolbars
r17217 cell.metadata.slideshow.slide_type = value;
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 },
//geter
function(cell){ var ns = cell.metadata.slideshow;
// if the slideshow namespace does not exist return `undefined`
// (will be interpreted as `false` by checkbox) otherwise
// return the value
Jonathan Frederic
Fixed cell toolbars
r17217 return (ns === undefined)? undefined: ns.slide_type;
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087 },
"Slide Type");
Matthias BUSSONNIER
Use global event for celltoolbar
r17454 var register = function (notebook) {
Jonathan Frederic
Fixed cell toolbars
r17217 CellToolbar.register_callback('slideshow.select',select_type);
slideshow_preset.push('slideshow.select');
Matthias BUSSONNIER
add slideshow extension/preset for celltoolbar
r9087
Matthias BUSSONNIER
Use global event for celltoolbar
r17454 CellToolbar.register_preset('Slideshow',slideshow_preset, notebook);
Jonathan Frederic
Fixed cell toolbars
r17217 console.log('Slideshow extension for metadata editing loaded.');
};
return {'register': register};
});