문제

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