I am using Joomla! 1.5.26 and JCE 2.2.0.

I need to change the status of the JCE (disable/enable) using javascript. If disabled, then the editor is in readonly mode and the background is set to opacity 1.

When a user clicks on the edit/save button, the JCE should be enabled/disabled.

I found this links: http://www.tinymce.com/tryit/read_only_mode.php

I also found how I can disable the content (cross-browsers):

tinymce.get('editorID').getBody().setAttribute('contenteditable', 'false');

However, this code doesn't work:

J('#editorID').css({opacity:1});
tinymce.get('editorID').getDoc().designMode = 'Off';

How can I change the JCE background opacity from javascript?

Will it be possible to set the readonly mode by javascript?

有帮助吗?

解决方案

To apply this setting correctly you have to insert the real tinymce id you can get a console using tinymce.activeEditor.id.

So you may use

var editor_id = tinymce.activeEditor.id;
tinymce.get(editor_id).getBody().setAttribute('contenteditable', 'false');
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top