Disable CKEditor 3 (Rich Text Editor) inside APEX

Von Tobias Arnhold 11.09.2011
If you want to disable the "Richt Text Editor" inside APEX and still show everything in the right HTML format. Just add this code snippet inside the "Page Footer Text":
<script>
/* HowtTo: http://cksource.com/forums/viewtopic.php?t=15659 */
$(document).ready( function() {
( function()
{
   var cancelEvent = function( evt )
      {
         evt.cancel();
      };

   CKEDITOR.editor.prototype.readOnly = function( isReadOnly )
   {
      /* Turn off contentEditable. */
      this.document.$.body.disabled = isReadOnly;
      CKEDITOR.env.ie ? this.document.$.body.contentEditable = !isReadOnly
      : this.document.$.designMode = isReadOnly ? "off" : "on";

      /* Prevent key handling. */
      this[ isReadOnly ? 'on' : 'removeListener' ]( 'key', cancelEvent, null, null, 0 );
      this[ isReadOnly ? 'on' : 'removeListener' ]( 'selectionChange', cancelEvent, null, null, 0 );

      /* Disable all commands in wysiwyg mode. */
      var command,
         commands = this._.commands,
         mode = this.mode;

      for ( var name in commands )
      {
         command = commands[ name ];
         isReadOnly ? command.disable() : command[ command.modes[ mode ] ? 'enable' : 'disable' ]();
         this[ isReadOnly ? 'on' : 'removeListener' ]( 'state', cancelEvent, null, null, 0 );
      }
   }
} )();
setTimeout ('CKEDITOR.instances.<YOUR_APEX_ITEM>.readOnly( true )',1000);
});
</script>
The result will look like this:

Post Tags: