diff --git a/IPython/html/static/notebook/js/celltoolbar.js b/IPython/html/static/notebook/js/celltoolbar.js index 05a9cfc..f385fe3 100644 --- a/IPython/html/static/notebook/js/celltoolbar.js +++ b/IPython/html/static/notebook/js/celltoolbar.js @@ -4,7 +4,8 @@ define([ 'base/js/namespace', 'jquery', -], function(IPython, $) { + 'base/js/events' +], function(IPython, $, ipevents) { "use strict"; var CellToolbar = function (options) { @@ -18,7 +19,6 @@ define([ // notebook: Notebook instance CellToolbar._instances.push(this); this.notebook = options.notebook; - this.events = options.events; this.cell = options.cell; this.create_element(); this.rebuild(); @@ -175,13 +175,14 @@ define([ * CellToolbar.register_preset('foo.foo_preset1', ['foo.c1', 'foo.c2', 'foo.c5']) * CellToolbar.register_preset('foo.foo_preset2', ['foo.c4', 'foo.c5']) */ - CellToolbar.register_preset = function(name, preset_list, notebook, events) { + CellToolbar.register_preset = function(name, preset_list, notebook) { CellToolbar._presets[name] = preset_list; - events.trigger('preset_added.CellToolbar', {name: name}); + ipevents.trigger('preset_added.CellToolbar', {name: name}); // When "register_callback" is called by a custom extension, it may be executed after notebook is loaded. // In that case, activate the preset if needed. - if (notebook && notebook.metadata && notebook.metadata.celltoolbar === name) - CellToolbar.activate_preset(name, events); + if (notebook && notebook.metadata && notebook.metadata.celltoolbar === name){ + CellToolbar.activate_preset(name); + } }; @@ -214,7 +215,7 @@ define([ * * CellToolbar.activate_preset('foo.foo_preset1'); */ - CellToolbar.activate_preset = function(preset_name, events){ + CellToolbar.activate_preset = function(preset_name){ var preset = CellToolbar._presets[preset_name]; if(preset !== undefined){ @@ -222,9 +223,7 @@ define([ CellToolbar.rebuild_all(); } - if (events) { - events.trigger('preset_activated.CellToolbar', {name: preset_name}); - } + ipevents.trigger('preset_activated.CellToolbar', {name: preset_name}); }; diff --git a/IPython/html/static/notebook/js/celltoolbarpresets/default.js b/IPython/html/static/notebook/js/celltoolbarpresets/default.js index a44db5d..1423738 100644 --- a/IPython/html/static/notebook/js/celltoolbarpresets/default.js +++ b/IPython/html/static/notebook/js/celltoolbarpresets/default.js @@ -34,7 +34,7 @@ define([ button_container.append(button); }; - var register = function (notebook, events) { + var register = function (notebook) { CellToolbar.register_callback('default.rawedit', add_raw_edit_button); raw_edit = $.proxy(raw_edit, { notebook: notebook, @@ -44,7 +44,7 @@ define([ var example_preset = []; example_preset.push('default.rawedit'); - CellToolbar.register_preset('Edit Metadata', example_preset, notebook, events); + CellToolbar.register_preset('Edit Metadata', example_preset, notebook); console.log('Default extension for cell metadata editing loaded.'); }; return {'register': register}; diff --git a/IPython/html/static/notebook/js/celltoolbarpresets/example.js b/IPython/html/static/notebook/js/celltoolbarpresets/example.js index ebcc0ae..5f1a6da 100644 --- a/IPython/html/static/notebook/js/celltoolbarpresets/example.js +++ b/IPython/html/static/notebook/js/celltoolbarpresets/example.js @@ -137,11 +137,11 @@ define([ button_container.append(button); }; - var register = function (notebook, events) { + var register = function (notebook) { CellToolbar.register_callback('example.help',add_simple_dialog_button); example_preset.push('example.help'); - CellToolbar.register_preset('Example',example_preset, notebook, events); + CellToolbar.register_preset('Example',example_preset, notebook); console.log('Example extension for metadata editing loaded.'); }; return {'register': register}; diff --git a/IPython/html/static/notebook/js/celltoolbarpresets/rawcell.js b/IPython/html/static/notebook/js/celltoolbarpresets/rawcell.js index 8a3d04d..7a33ed2 100644 --- a/IPython/html/static/notebook/js/celltoolbarpresets/rawcell.js +++ b/IPython/html/static/notebook/js/celltoolbarpresets/rawcell.js @@ -74,11 +74,11 @@ define([ "Raw NBConvert Format" ); - var register = function (notebook, events) { + var register = function (notebook) { CellToolbar.register_callback('raw_cell.select', select_type, ['raw']); raw_cell_preset.push('raw_cell.select'); - CellToolbar.register_preset('Raw Cell Format', raw_cell_preset, notebook, events); + CellToolbar.register_preset('Raw Cell Format', raw_cell_preset, notebook); console.log('Raw Cell Format toolbar preset loaded.'); }; return {'register': register}; diff --git a/IPython/html/static/notebook/js/celltoolbarpresets/slideshow.js b/IPython/html/static/notebook/js/celltoolbarpresets/slideshow.js index 37f2a37..6b2b35e 100644 --- a/IPython/html/static/notebook/js/celltoolbarpresets/slideshow.js +++ b/IPython/html/static/notebook/js/celltoolbarpresets/slideshow.js @@ -35,11 +35,11 @@ define([ }, "Slide Type"); - var register = function (notebook, events) { + var register = function (notebook) { CellToolbar.register_callback('slideshow.select',select_type); slideshow_preset.push('slideshow.select'); - CellToolbar.register_preset('Slideshow',slideshow_preset, notebook, events); + CellToolbar.register_preset('Slideshow',slideshow_preset, notebook); console.log('Slideshow extension for metadata editing loaded.'); }; return {'register': register}; diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js index a40be91..e990f33 100644 --- a/IPython/html/static/notebook/js/codecell.js +++ b/IPython/html/static/notebook/js/codecell.js @@ -131,7 +131,6 @@ define([ var inner_cell = $('
').addClass('inner_cell'); this.celltoolbar = new celltoolbar.CellToolbar({ cell: this, - events: this.events, notebook: this.notebook}); inner_cell.append(this.celltoolbar.element); var input_area = $('
').addClass('input_area'); diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index 2fe02da..37d2eab 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -130,9 +130,9 @@ define([ }; // Trigger cell toolbar registration. - default_celltoolbar.register(this, options.events); - rawcell_celltoolbar.register(this, options.events); - slideshow_celltoolbar.register(this, options.events); + default_celltoolbar.register(this); + rawcell_celltoolbar.register(this); + slideshow_celltoolbar.register(this); }; /** @@ -2283,7 +2283,7 @@ define([ // load toolbar state if (this.metadata.celltoolbar) { celltoolbar.CellToolbar.global_show(); - celltoolbar.CellToolbar.activate_preset(this.metadata.celltoolbar, this.events); + celltoolbar.CellToolbar.activate_preset(this.metadata.celltoolbar); } else { celltoolbar.CellToolbar.global_hide(); } diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index b99455d..06ae374 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -78,7 +78,6 @@ define([ var inner_cell = $('
').addClass('inner_cell'); this.celltoolbar = new celltoolbar.CellToolbar({ cell: this, - events: this.events, notebook: this.notebook}); inner_cell.append(this.celltoolbar.element); var input_area = $('
').addClass('input_area');