MDL-61189 editor_tinymce: save data before submitting
authorSimey Lameze <simey@moodle.com>
Tue, 22 May 2018 05:48:17 +0000 (13:48 +0800)
committerJake Dallimore <jake@moodle.com>
Wed, 23 May 2018 02:48:27 +0000 (10:48 +0800)
lib/editor/tinymce/module.js

index d3118ef..b7b7904 100644 (file)
@@ -80,6 +80,16 @@ M.editor_tinymce.init_editor = function(Y, editorid, options) {
             });
         };
     }
+
+    // Retain any setup which is already defined.
+    options.originalSetupFunction = options.setup || function(){};
+    options.setup = function(editor) {
+        options.originalSetupFunction();
+        editor.onChange.add(function(ed) {
+            ed.save();
+        });
+    };
+
     tinyMCE.init(options);
 
     var item = document.getElementById(editorid+'_filemanager');