mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-77140 mod_lti: fix content item return for new TinyMCE versions
This commit is contained in:
parent
0780e87f06
commit
7e6f706717
2
mod/lti/amd/build/form-field.min.js
vendored
2
mod/lti/amd/build/form-field.min.js
vendored
@ -6,6 +6,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since 3.2
|
||||
*/
|
||||
define("mod_lti/form-field",["jquery"],(function($){var FormField=function(name,type,resetIfUndefined,defaultValue){this.name=name,this.id="id_"+this.name,this.selector="#"+this.id,this.type=type,this.resetIfUndefined=resetIfUndefined,this.defaultValue=defaultValue};return FormField.TYPES={TEXT:1,SELECT:2,CHECKBOX:3,EDITOR:4},FormField.prototype.setFieldValue=function(value){if(null===value){if(!this.resetIfUndefined)return;value=this.defaultValue}switch(this.type){case FormField.TYPES.CHECKBOX:value?$(this.selector).prop("checked",!0):$(this.selector).prop("checked",!1);break;case FormField.TYPES.EDITOR:if(void 0!==value.text){var attoEditor=$(this.selector+"editable");attoEditor.length?attoEditor.html(value.text):"undefined"!=typeof tinyMCE&&tinyMCE.execInstanceCommand(this.id,"mceInsertContent",!1,value.text),$(this.selector).val(value.text)}break;default:$(this.selector).val(value)}},FormField}));
|
||||
define("mod_lti/form-field",["jquery"],(function($){var FormField=function(name,type,resetIfUndefined,defaultValue){this.name=name,this.id="id_"+this.name,this.selector="#"+this.id,this.type=type,this.resetIfUndefined=resetIfUndefined,this.defaultValue=defaultValue};return FormField.TYPES={TEXT:1,SELECT:2,CHECKBOX:3,EDITOR:4},FormField.prototype.setFieldValue=function(value){if(null===value){if(!this.resetIfUndefined)return;value=this.defaultValue}switch(this.type){case FormField.TYPES.CHECKBOX:value?$(this.selector).prop("checked",!0):$(this.selector).prop("checked",!1);break;case FormField.TYPES.EDITOR:if(void 0!==value.text){var attoEditor=$(this.selector+"editable");attoEditor.length?attoEditor.html(value.text):"undefined"!=typeof tinyMCE&&("3"==tinyMCE.majorVersion?tinyMCE.execInstanceCommand(this.id,"mceInsertContent",!1,value.text):tinyMCE.get(this.id).setContent(value.text)),$(this.selector).val(value.text)}break;default:$(this.selector).val(value)}},FormField}));
|
||||
|
||||
//# sourceMappingURL=form-field.min.js.map
|
File diff suppressed because one or more lines are too long
@ -87,7 +87,13 @@ define(['jquery'],
|
||||
attoEditor.html(value.text);
|
||||
} else if (typeof tinyMCE !== 'undefined') {
|
||||
// If the editor is not Atto, try to fallback to TinyMCE.
|
||||
tinyMCE.execInstanceCommand(this.id, 'mceInsertContent', false, value.text);
|
||||
if (tinyMCE.majorVersion == "3") {
|
||||
// Tiny 3.
|
||||
tinyMCE.execInstanceCommand(this.id, 'mceInsertContent', false, value.text);
|
||||
} else {
|
||||
// Tiny 4+.
|
||||
tinyMCE.get(this.id).setContent(value.text);
|
||||
}
|
||||
}
|
||||
|
||||
// Set text to actual editor text area.
|
||||
|
Loading…
x
Reference in New Issue
Block a user