edit/page: load ckeditor dependency from script include
[minimedit.git] / edit / page.js
index d1f16bf3c2b705d3323de6fb7963d010d5b0d440..ecf520453fb4ffffb6039895600d1725beb2f469 100644 (file)
@@ -1,3 +1,7 @@
+function editorsetup() {
+
+CKEDITOR.disableAutoInline = true;
+
 CKEDITOR.plugins.add('inlinesave', {
        init: function(editor) {
                editor.addCommand( 'inlinesave', {
@@ -153,11 +157,9 @@ CKEDITOR.on('instanceCreated', function (event) {
        };
 });
 
-       CKEDITOR.disableAutoInline = true;
-
-// add edit link to menu
 var pagebody = document.getElementsByClassName('static')[0];
 if (pagebody) {
+       // add edit link to menu
        var editlink = document.querySelector('a[href="#edit"]');
        if (editlink)
        editlink.onclick = function (e) {
@@ -182,3 +184,11 @@ if (pagebody) {
        }
 }
 
+}
+
+document.addEventListener('DOMContentLoaded', function (e) {
+       var editorinc = document.createElement('script');
+       editorinc.addEventListener('load', editorsetup);
+       editorinc.src = ckesrc;
+       document.getElementsByTagName('head')[0].appendChild(editorinc);
+});