CKEditor custom properties do not work and do not occur

I'm new to CKEdtior and just installed it on this website I'm working on, version 4.4.4

The editor itself is loaded onto the page, but custom properties, such as language or uiColor, do not work, and with or without properties, I continue to receive an error:

Uncaught TypeError: Cannot read property 'getEditor' of undefined 

I know that I am doing something wrong, because it works in samples. If this helps, the code is part of the Smarty template. I tried to use an identifier that has no underscore, and of course, validation in different browsers - the error appears in IE, FF and Chrome.

Corresponding code bits:

 <script type="text/javascript" src="ckeditor/ckeditor.js"></script> <script type="text/javascript"> {literal} CKEDITOR.replace( 'show_description', { language: 'he' }); {/literal} </script> 

 <textarea name="show_description" id="show_description" class="ckeditor"></textarea> 
+5
source share
3 answers

You cannot call CKEDITOR.replace() to where the corresponding <textarea> code is located. You can see this in replace by sample code :

 <textarea cols="80" id="editor1" name="editor1" rows="10">content</textarea> <script> // This call can be placed at any point after the // <textarea>, or inside a <head><script> in a // window.onload event handler. // Replace the <textarea id="editor"> with an CKEditor // instance, using default configurations. CKEDITOR.replace( 'editor1' ); </script> 
+16
source

if you use the class as a parameter in CKEDITOR.replace ('yourclass'); it still replaces textarea with an editor, but generates the same error.

+3
source

You can write a function called settimeout() .

Example:

 setTimeout(function(){CKEDITOR.replace('id-textarea')},time); 
-1
source

Source: https://habr.com/ru/post/1201236/


All Articles