Commit 7597ed01 authored by bbaer's avatar bbaer
Browse files

solves #7974

parent f2d3e009
Pipeline #2833 passed with stages
in 2 minutes and 43 seconds
...@@ -28,6 +28,7 @@ QfqNS.Helper = QfqNS.Helper || {}; ...@@ -28,6 +28,7 @@ QfqNS.Helper = QfqNS.Helper || {};
* @function * @function
*/ */
var tinyMce = function () { var tinyMce = function () {
if (typeof tinymce === 'undefined') { if (typeof tinymce === 'undefined') {
//QfqNS.log.error("tinymce not loaded, cannot initialize Qfq tinymce."); //QfqNS.log.error("tinymce not loaded, cannot initialize Qfq tinymce.");
return; return;
...@@ -36,6 +37,7 @@ QfqNS.Helper = QfqNS.Helper || {}; ...@@ -36,6 +37,7 @@ QfqNS.Helper = QfqNS.Helper || {};
$(".qfq-tinymce").each( $(".qfq-tinymce").each(
function () { function () {
var config = {}; var config = {};
var myEditor = {};
var $this = $(this); var $this = $(this);
var tinyMCEId = $this.attr('id'); var tinyMCEId = $this.attr('id');
if (!tinyMCEId) { if (!tinyMCEId) {
...@@ -55,6 +57,7 @@ QfqNS.Helper = QfqNS.Helper || {}; ...@@ -55,6 +57,7 @@ QfqNS.Helper = QfqNS.Helper || {};
config.selector = "#" + QfqNS.escapeJqueryIdSelector(tinyMCEId); config.selector = "#" + QfqNS.escapeJqueryIdSelector(tinyMCEId);
config.setup = function (editor) { config.setup = function (editor) {
myEditor = editor;
editor.on('Change', function (e) { editor.on('Change', function (e) {
// Ensure the associated form is notified of changes in editor. // Ensure the associated form is notified of changes in editor.
QfqNS.Log.debug('Editor was changed'); QfqNS.Log.debug('Editor was changed');
...@@ -63,9 +66,23 @@ QfqNS.Helper = QfqNS.Helper || {}; ...@@ -63,9 +66,23 @@ QfqNS.Helper = QfqNS.Helper || {};
$parentForm.trigger("change"); $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); 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