Commit 7597ed01 authored by Benjamin Baer's avatar Benjamin Baer

solves #7974

parent f2d3e009
Pipeline #2833 passed with stages
in 2 minutes and 43 seconds
......@@ -28,6 +28,7 @@ QfqNS.Helper = QfqNS.Helper || {};
* @function
*/
var tinyMce = function () {
if (typeof tinymce === 'undefined') {
//QfqNS.log.error("tinymce not loaded, cannot initialize Qfq tinymce.");
return;
......@@ -36,6 +37,7 @@ QfqNS.Helper = QfqNS.Helper || {};
$(".qfq-tinymce").each(
function () {
var config = {};
var myEditor = {};
var $this = $(this);
var tinyMCEId = $this.attr('id');
if (!tinyMCEId) {
......@@ -55,6 +57,7 @@ QfqNS.Helper = QfqNS.Helper || {};
config.selector = "#" + QfqNS.escapeJqueryIdSelector(tinyMCEId);
config.setup = function (editor) {
myEditor = editor;
editor.on('Change', function (e) {
// Ensure the associated form is notified of changes in editor.
QfqNS.Log.debug('Editor was changed');
......@@ -63,9 +66,23 @@ QfqNS.Helper = QfqNS.Helper || {};
$parentForm.trigger("change");
});
var me = editor;
var $parent = $(config.selector);
$parent.parent('div').mouseenter(function(e) {
if($parent.is('[readonly="readonly"]')) {
me.setMode("readonly");
} else {
me.setMode("design");
}
});
};
tinymce.init(config);
if($(this).is('[readonly]')) {
myEditor.setMode("readonly");
}
}
);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment