I've been facing a problem where, sometimes, Marklar doesn't loads in the page.
The init function int the amd module uses M.editor_marklar.
js_init_code is put in the page after the init call leading to a race condition: sometimes M.editor_marklar is defined, sometimes it isn't.
With this patch, M.editor_marklar is initialized just before the init function gets called.
Well spotted @juancs - and thanks for the patch! I'll try to reproduce this and debug a bit more. Maybe this is a good opportunity to actually modernise the whole JS loading to match the latest moodledev guidelines.
I've been facing a problem where, sometimes, Marklar doesn't loads in the page.
The init function int the amd module uses M.editor_marklar. js_init_code is put in the page after the init call leading to a race condition: sometimes M.editor_marklar is defined, sometimes it isn't.
With this patch, M.editor_marklar is initialized just before the init function gets called.