Skip to content

Commit c2f8bf5

Browse files
committed
[requirejs] don't use simplified commonjs wrapper
it's slower & relies on parsing toString :O see jupyter/notebook#155 ipython-contrib/jupyter_contrib_nbextensions#1165 for details
1 parent 455095e commit c2f8bf5

File tree

1 file changed

+21
-12
lines changed
  • src/jupyter_highlight_selected_word/static/highlight_selected_word

1 file changed

+21
-12
lines changed

src/jupyter_highlight_selected_word/static/highlight_selected_word/main.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,29 @@
55
* codemirror/addon/search/match-highlighter.js
66
*/
77

8-
define(function (require, exports, module) {
9-
'use strict';
10-
11-
var $ = require('jquery');
12-
var Jupyter = require('base/js/namespace');
13-
var Cell = require('notebook/js/cell').Cell;
14-
var CodeCell = require('notebook/js/codecell').CodeCell;
15-
16-
var CodeMirror = require('codemirror/lib/codemirror');
17-
8+
define([
9+
'require',
10+
'jquery',
11+
'base/js/namespace',
12+
'notebook/js/cell',
13+
'notebook/js/codecell',
14+
'codemirror/lib/codemirror',
1815
// The mark-selection addon is need to ensure that the highlighting styles
1916
// are *not* applied to the actual selection, as otherwise it can become
2017
// difficult to see which is selected vs just highlighted.
21-
require('codemirror/addon/selection/mark-selection');
18+
'codemirror/addon/selection/mark-selection'
19+
], function (
20+
requirejs,
21+
$,
22+
Jupyter,
23+
cell,
24+
codecell,
25+
CodeMirror
26+
) {
27+
'use strict';
28+
29+
var Cell = cell.Cell;
30+
var CodeCell = codecell.CodeCell;
2231

2332
var mod_name = 'highlight_selected_word';
2433
var log_prefix = '[' + mod_name + ']';
@@ -373,7 +382,7 @@ define(function (require, exports, module) {
373382
id: 'highlight_selected_word_css',
374383
rel: 'stylesheet',
375384
type: 'text/css',
376-
href: require.toUrl('./main.css')
385+
href: requirejs.toUrl('./main.css')
377386
})
378387
.appendTo('head');
379388

0 commit comments

Comments
 (0)