Im trying to use the CodeMirror js library in another module and something strange happens.
I load all the js files like in the toplevelview:
$this->provideJsFile('vendor/codemirror/codemirror.js');
$this->provideJsFile('vendor/codemirror/mode/yaml.js');
$this->provideJsFile('vendor/codemirror/addon/dialog/dialog.js');
$this->provideJsFile('vendor/codemirror/addon/search/searchcursor.js');
$this->provideJsFile('vendor/codemirror/addon/search/search.js');
$this->provideJsFile('vendor/codemirror/addon/search/matchesonscrollbar.js');
$this->provideJsFile('vendor/codemirror/addon/search/jump-to-line.js');
$this->provideJsFile('vendor/codemirror/addon/fold/foldcode.js');
$this->provideJsFile('vendor/codemirror/addon/fold/foldgutter.js');
$this->provideJsFile('vendor/codemirror/addon/fold/indent-fold.js');
after that I load other markups:
$this->provideJsFile('vendor/codemirror/mode/markdown.js');
$this->provideJsFile('vendor/codemirror/mode/xml.js');
$this->provideJsFile('vendor/codemirror/mode/meta.js');
$this->provideJsFile('vendor/codemirror/mode/htmlmixed.js');
$this->provideJsFile('vendor/codemirror/mode/css.js');
$this->provideJsFile('vendor/codemirror/mode/javascript.js');
and css:
$this->provideCssFile('vendor/codemirror/codemirror.css');
$this->provideCssFile('vendor/codemirror/addon/dialog/dialog.css');
$this->provideCssFile('vendor/codemirror/addon/search/matchesonscrollbar.css');
$this->provideCssFile('vendor/codemirror/addon/fold/foldgutter.css');
-
If the toplevelview module is enabled the CodeMirror.modes contains only the yaml markdown from the toplevelview (toplevelview has only yaml markup)
-
If I disable the toplevelview module my markups (markdown.js) work as expected.
-
If I load markdown.js without codemirror.js, even if codemirror.js gets loaded by toplevelview, the browser tells me that CodeMirror is not defined.
One workaround is putting the markdown.js and xml.js content in the rendered
function of the module.js but that looks pretty dirty.
How can I achieve a coexistance of two identical javascript libraries?
Thanks in advance and
Best Regards
Nicolas