Incompatibility when importing javascript module

Incompatibility when importing javascript module

by Alberto Marin -
Number of replies: 0

Hi there,

I am working in a plugin that shows a modal_form with a tinymce editor in it, and it works fine, but when I import a JavaScript module using requirejs following the steps in this guide: Guide to adding third party jQuery for AMD - MoodleDocs, the new modules works fine but the tinymce I previously inserted within the modal_form stops working and I get en error 403 saying that module codemirror-lazy.js cant be found.

All the other librarys related to tinymce load fine but no codemirror-lazy.js. This is a file located in lib/editor/tiny/plugins/html/amd/src/codemirror-lazy.js. And the setup of my files to load the javascript libraries I need are like it follows:

config.js:

define([],function(){
  require.config({
    baseUrl: ".",
    name: "app",
    paths: { xlsx: "js/xlsx.full.min" },

    shim: { 'xlsx': {exports: 'xlsx'},
  }  }) });

xlsx.js

define(['plugintype_pluginname/config', 'xlsx'], function(unused,xlsx) {
    return xlsx;
 });

loadModules.js

define(['plugintype_pluginname/xlsx'], function (xlsx) {
    var wwwroot = M.cfg.wwwroot;
        function initManage() {
        }
        return {
            init: function () {
                initManage();
            }
        };
    });

and I finally I load the AMD Javascript module in my index.php:

$PAGE->requires->js_call_amd('plugintype_pluginname/loadModules', 'init');

So.... I much appreciate any help  with this issue.

Has anyone ever had this problem? It seems to be such a kind of conflict loading javascript libraries. 

Thank you in advance

Average of ratings: -