mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Make sure requirejs can't be set more than once.
This commit is contained in:
parent
8c8c95ceca
commit
467ae32b05
@ -8,8 +8,19 @@
|
||||
* This module handles the global loading of those tools.
|
||||
*/
|
||||
module.exports = new Promise(function(resolve, reject) {
|
||||
if (window.hasOwnProperty('jquery')) {
|
||||
resolve();
|
||||
}
|
||||
|
||||
requirejs(['jquery'], function($) {
|
||||
window.$ = window.jQuery = $;
|
||||
var jQueryProperty = {
|
||||
get: function() {
|
||||
return $;
|
||||
},
|
||||
configurable: false
|
||||
};
|
||||
Object.defineProperty(window, '$', jQueryProperty);
|
||||
Object.defineProperty(window, 'jQuery', jQueryProperty);
|
||||
console.log('jQuery loaded and available in global namespace');
|
||||
|
||||
requirejs(['jqueryui', 'bootstrap'], function() {
|
||||
@ -19,7 +30,7 @@ module.exports = new Promise(function(resolve, reject) {
|
||||
reject(new Error('bootstrap not injected into jQuery prototype'));
|
||||
}
|
||||
|
||||
if ($.prototype.draggable) {
|
||||
if ($.prototype.draggable && $.prototype.resizable) {
|
||||
console.log('jQueryUI loaded and injected into jQuery\'s namespace');
|
||||
} else {
|
||||
reject(new Error('jQueryUI not injected into jQuery prototype'));
|
||||
@ -43,7 +54,13 @@ module.exports = new Promise(function(resolve, reject) {
|
||||
'notebook/js/codemirror-ipython',
|
||||
'notebook/js/codemirror-ipythongfm'
|
||||
], function(CodeMirror) {
|
||||
window.CodeMirror = CodeMirror;
|
||||
var codeMirrorProperty = {
|
||||
get: function() {
|
||||
return CodeMirror;
|
||||
},
|
||||
configurable: false
|
||||
};
|
||||
Object.defineProperty(window, 'CodeMirror', codeMirrorProperty);
|
||||
console.log('CodeMirror loaded and available in global namespace');
|
||||
|
||||
resolve();
|
||||
|
@ -4,8 +4,7 @@
|
||||
"use strict";
|
||||
|
||||
var QH = require("notebook/js/quickhelp");
|
||||
var $ = require("jquery");
|
||||
|
||||
|
||||
/**
|
||||
* Humanize the action name to be consumed by user.
|
||||
* internaly the actions anem are of the form
|
||||
|
@ -12,7 +12,8 @@
|
||||
"clean": "npm run clean:js && npm run clean:css",
|
||||
"clean:css": "rimraf notebook/static/style/ipython.min.css && rimraf notebook/static/style/style.min.css",
|
||||
"clean:js": "rimraf notebook/static/auth/js && rimraf notebook/static/base/js && rimraf notebook/static/edit/js && rimraf notebook/static/notebook/js && rimraf notebook/static/terminal/js && rimraf notebook/static/tree/js && rimraf notebook/static/services",
|
||||
"postinstall": "npm run bower",
|
||||
"uninstall": "npm run clean && rimraf notebook/static/components && rimraf node_modules",
|
||||
"postinstall": "npm run bower && npm run build",
|
||||
"bower": "bower install --allow-root --config.interactive=false",
|
||||
"build": "concurrent \"npm run build:css\" \"npm run build:js\"",
|
||||
"build:css": "concurrent \"npm run build:css:ipython\" \"npm run build:css:style\"",
|
||||
@ -30,10 +31,8 @@
|
||||
"devDependencies": {
|
||||
"aliasify": "^1.7.2",
|
||||
"amd-wrap-legacy": "^0.2.0",
|
||||
"backbone": "~1.2",
|
||||
"bower": "*",
|
||||
"browserify": "^11.0.1",
|
||||
"codemirror": "~5.5",
|
||||
"concurrently": "^0.1.1",
|
||||
"glob": "^5.0.14",
|
||||
"less": "~2",
|
||||
|
Loading…
Reference in New Issue
Block a user