hello !
I searched in the documentation and didnt find anything related to this question. How to make CKEditor readonly at runtime (or even better, right when calling 'replace') ?
The following works for one part :
but the problem is that even though I can't type to the editor any more, some keystrokes like TAB or simple mouse clicks generate newlines and sometimes JS errors.
Is there a command or a call to put the editor in complete readonly mode ?
Thanks
I searched in the documentation and didnt find anything related to this question. How to make CKEditor readonly at runtime (or even better, right when calling 'replace') ?
The following works for one part :
editorInstance.document.$.body.disabled = true; editorInstance.document.$.body.contentEditable = false; editorInstance.document.$.designMode="off"
but the problem is that even though I can't type to the editor any more, some keystrokes like TAB or simple mouse clicks generate newlines and sometimes JS errors.
Is there a command or a call to put the editor in complete readonly mode ?
Thanks
Re: How to make CKEditor readonly ?
What would a read only instance of CKeditor provide over a regular readonly textarea?
Re: How to make CKEditor readonly ?
Re: How to make CKEditor readonly ?
The reason is to have the same code on the page, and being able to put the editor in readonly mode in runtime (maybe in load time) depending on specific external events in order to prevent concurrent modification of the same rich text content by different users, for example.
And btw Eggbert, the editor already uses an iframe. Removing the iframe's design mode works ok, but there appears to be other CKEditor specific stuff that still keeps modifying the iframe contents and sometimes throw errors in IE ...
Re: How to make CKEditor readonly ?
Is it possible to disable the Save function to prevent content being saved?
Re: How to make CKEditor readonly ?
Re: How to make CKEditor readonly ?
Here I hope I could provide a temporary workaround for it:
Re: How to make CKEditor readonly ?
I think there already is one: http://dev.fckeditor.net/ticket/1376
Re: How to make CKEditor readonly ?
Thanks !
Re: How to make CKEditor readonly ?
I tried the above solution, but received an error of:
"Object doesn't support this property or method".
Re: How to make CKEditor readonly ?
I hope this could help.
David Ayala
Developer @GT
Re: How to make CKEditor readonly ?
Hi, thanks for the bug reporting
I've fixed the code in previous post.
Re: How to make CKEditor readonly ?
I just downloaded the last version of CKEditor in order to be able to create a read-only CKEditor but when I tried to call I get the following message:
"TypeError: CKEDITOR.instances.my_editor.readOnly is not a function".
And when I check at runtime, this function is not defined on the object...
Could you tell me what should I do in order to get the function available?
Thanks in advance
Re: How to make CKEditor readonly ?
Re: How to make CKEditor readonly ?
I've added the code given a few post before into the CKEDITOR file and the method is now available BUT it doesn't work... The editor is still modifiable...
Any idea?
Re: How to make CKEditor readonly ?
// Prevent key handling.
this[ isReadOnly ? 'on' : 'removeListener' ]( 'key', cancelEvent, null, null, 0 );
this[ isReadOnly ? 'on' : 'removeListener' ]( 'selectionChange', cancelEvent, null, null, 0 );
any ideas?
adico
Re: How to make CKEditor readonly ?
I cannot make the 3.0 readonly
, any update for this ticket?
Re: How to make CKEditor readonly ?
Re: How to make CKEditor readonly ?
I've tried putting in ckeditor.js, but got the following error from browser
"this.document.$" is null or not an object
And a side question, what the $ represents? I don't quite understand the code
Re: How to make CKEditor readonly ?
Re: How to make CKEditor readonly ?
P.S use when posting code
Re: How to make CKEditor readonly ?
Re: How to make CKEditor readonly ?
Can anyone please guide me how/where to implement this code?
I have my ckeditor in my aspx(.net) page
Re: How to make CKEditor readonly ?
Related tickets:
http://dev.fckeditor.net/ticket/1376
http://dev.fckeditor.net/ticket/3944
Re: How to make CKEditor readonly ?
<textarea id=editor1 />
$("#cke_editor1").hide();
works like a charm
Re: How to make CKEditor readonly ?
Re: How to make CKEditor readonly ?
This is nice solution but I get this.toolbox.toolbars is undefined error. Can you help with this?
Perhaps the problem is with the location of this code. Nobody defines the position of this code. Would you clarify this?
Please help
Chris
Re: How to make CKEditor readonly ?
and on the html head import
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="myeditor.js"></script>
<script type="text/javascript">
document.onload = function(){
initEditor("<%=[Content]%>", "<%=[Mode]%>", "<%=[Width]%>", "<%=[Height]%>");
}
</script>
Re: How to make CKEditor readonly ?
i have user your code in my application for readOnly. Everything goes fine but only if i have once instancs of CKeditor. If I have two or more instance in the same page, the toolbars change state correctly but is impossible to write in the editors.
The problem seems to be here:
Some idea?
Thank you
Re: How to make CKEditor readonly ?
window.onload = function () {
CKEDITOR.on("instanceReady", function (ev) {
var bodyelement = ev.editor.document.$.body;
bodyelement.setAttribute("contenteditable", false);
});
CKEDITOR.replace('editor1');
};
</script>
Re: How to make CKEditor readonly ?
Sometimes, for functionality, I agree that the editor is not active until either a case ... because a checkbox is not activated, because a user does not have permission, etc..
Lo que te quiero decir, es que muchas veces, por funcionalidad, el cliente te impone unas pautas o directrices que casi que son de diseño, en el que te piden que no dejes activos ciertos campos de un formulario para evitar que se meta más basura de la cuenta, y el desactivar el editor es tan válido como desactivar una caja de texto por la razón X, bien sea porque se debería activar al activarse un checkbox, porque el usuario no tenga permisos de escritura, o por motivos más complejos como el que sucede en mi caso. Aun así es una propuesta interesante y no estaría demás que estuviera en una futura versión mejora del ckeditor. Mientras sean mejoras...
Make a read-only editor is not so farfetched. It is an interesting case, but whoever does not happen to you is no reason for rejecting a proposal.
-----------------
Me acabo de dar cuenta que eres español, Alfonso
Where should I put that code exactly? I guess the first code in the file ckeditor.js, but the second code?