I am fairly new to CKEdtior and have just installed it on this website I'm working on, the version is 4.4.4
The editor itself loads into the page, but custom properties like language or uiColor aren't working, and with or without properties, I keep getting the error:
Uncaught TypeError: Cannot read property 'getEditor' of undefined
I know I'm doing something wrong, because it works in the samples. If it helps, the code is part of a Smarty template. I tried using an ID that doesn't have an underscore, and of course checking in different browsers—the error appears in IE, FF and Chrome.
Relevant bits of code:
<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>
I am fairly new to CKEdtior and have just installed it on this website I'm working on, the version is 4.4.4
The editor itself loads into the page, but custom properties like language or uiColor aren't working, and with or without properties, I keep getting the error:
Uncaught TypeError: Cannot read property 'getEditor' of undefined
I know I'm doing something wrong, because it works in the samples. If it helps, the code is part of a Smarty template. I tried using an ID that doesn't have an underscore, and of course checking in different browsers—the error appears in IE, FF and Chrome.
Relevant bits of code:
<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>
Share
Improve this question
edited Jul 15, 2017 at 18:23
Ynhockey
asked Aug 27, 2014 at 14:31
YnhockeyYnhockey
3,9325 gold badges36 silver badges54 bronze badges
3 Answers
Reset to default 16You cannot call CKEDITOR.replace()
before the place where the relevant <textarea>
is in the code. You can see this in the replace by code sample:
<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>
if you use class as param in CKEDITOR.replace( 'yourclass' ); it still replaces textarea to editor but generates the same error.
You can write a function named setTimeout()
.
Example:
setTimeout(function(){CKEDITOR.replace('id-textarea')},time);