Modules: Protect against loading modules twice

Bug: T189029
Change-Id: Ie0dff9c1dfa8e3a0927f2915a9a237dff739289a
This commit is contained in:
Derk-Jan Hartman 2018-11-14 21:01:22 +01:00 committed by TheDJ
parent db6c6f636b
commit 0161e37e6e

View file

@ -274,7 +274,10 @@
}
}
// Activate the module on this context
if ( 'fn' in $.wikiEditor.modules[ module ] && 'create' in $.wikiEditor.modules[ module ].fn ) {
if ( 'fn' in $.wikiEditor.modules[ module ] &&
'create' in $.wikiEditor.modules[ module ].fn &&
typeof context.modules[ module ] === 'undefined'
) {
// Add a place for the module to put it's own stuff
context.modules[ module ] = {};
// Tell the module to create itself on the context