Commit b3b2d9b3 authored by Benjamin Baer's avatar Benjamin Baer

Merge branch 'B7974-TinyMCEReadOnly' into 'master'

B7974 tiny mce read only

See merge request !215
parents d3d89e03 55f1aa37
Pipeline #2835 passed with stages
in 2 minutes and 33 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,25 @@ QfqNS.Helper = QfqNS.Helper || {};
$parentForm.trigger("change");
});
/* Remove ReadOnly Again - we have to implement tinymce differently
to make it easier to change such attributes */
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