mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-76734-master' of https://github.com/andrewnicols/moodle
This commit is contained in:
commit
0adda8c66b
2
lib/editor/tiny/amd/build/editor.min.js
vendored
2
lib/editor/tiny/amd/build/editor.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -21,6 +21,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
import jQuery from 'jquery';
|
||||
import Pending from 'core/pending';
|
||||
import {getDefaultConfiguration} from './defaults';
|
||||
import {getTinyMCE, baseUrl} from './loader';
|
||||
@ -382,6 +383,16 @@ export const setupForTarget = async(target, options = {}) => {
|
||||
instanceMap.delete(target.targetElm);
|
||||
});
|
||||
|
||||
// If the editor is part of a form, also listen to the jQuery submit event.
|
||||
// The jQuery submit event will not trigger the native submit event, and therefore the content will not be saved.
|
||||
// We cannot rely on listening to the bubbled submit event on the document because other events on child nodes may
|
||||
// consume the data before it is saved.
|
||||
if (target.form) {
|
||||
jQuery(target.form).on('submit', () => {
|
||||
editor.save();
|
||||
});
|
||||
}
|
||||
|
||||
pendingPromise.resolve();
|
||||
return editor;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user