Read-only "HTML text" mode
Q:
How can I make the source mode of Editor ("HTML text") read only?
A:
Put the following code into your page:
<script type="text/JavaScript">
function afterEditorActivated(editor) {
// find TEXTAREA used for 'HTML text' mode
var textarea = editor._iframe.nextSibling.nextSibling;
textarea.readOnly = true; // make it 'read only'
}
// on Editor loaded
function EditorOnLoad(editor) {
if (!editor.__savedActivate) {
// save original Editor's activate method
editor.__savedActivate = editor.activate;
// redefine Editor's activate method
editor.activate = function(par) {
this.isActivated = false;
this.__savedActivate(par);
this.__checkActivation();
};
// be sure that Editor is activated
editor.__checkActivation = function() {
if (this.isActivated) {
afterEditorActivated(this); // when activated
} else {
var editor = this; // wait a bit
setTimeout(function() { editor.__checkActivation(); }, 200);
}
};
}
afterEditorActivated(editor);
}
</script>
|