Hello,
I'm trying to interact with the instance of my editor from an external script.
In order to do this, I first try to retrieve the instance by simply calling FCKeditorAPI.GetInstance method.
But when I try to execute the code, I get the following error from firebug:
FCKEditorAPI is not defined
My code:
1 <script>
2 var oFCKeditor = new FCKeditor('page_content');
3 oFCKeditor.BasePath = "/javascripts/FCKeditor/";
4 oFCKeditor.Config["CustomConfigurationsPath"] =
5 '<%= javascript_path "railsfck.js" %>';
6 oFCKeditor.ReplaceTextarea();
7 window.test_fun = function get_form_values() {
8 var oEditor = FCKEditorAPI.GetInstance('page_content');
9 var html = oEditor.GetHTML();
10 alert(html);
11 }
12 </script>
13 <%= link_to_remote 'Apply', :submit => 'editform', :update => 'content',:before
14 => "diff_launch();test_fun();" :url => {:action => 'process_edit'} %>
after have substituting line 4 with the following line of code
var oEditor = FCKEditorAPI.GetInstance('page_content');
I get the following error from firebug:
window.parent.InnerDialogLoaded is not a function
unescapeHTML: function() {..}
Does anyone know where is the problem?
Please note that I'm using ajax link_to_remote call.
Thanks you in Advance.
Indusha
I'm trying to interact with the instance of my editor from an external script.
In order to do this, I first try to retrieve the instance by simply calling FCKeditorAPI.GetInstance method.
But when I try to execute the code, I get the following error from firebug:
FCKEditorAPI is not defined
My code:
1 <script>
2 var oFCKeditor = new FCKeditor('page_content');
3 oFCKeditor.BasePath = "/javascripts/FCKeditor/";
4 oFCKeditor.Config["CustomConfigurationsPath"] =
5 '<%= javascript_path "railsfck.js" %>';
6 oFCKeditor.ReplaceTextarea();
7 window.test_fun = function get_form_values() {
8 var oEditor = FCKEditorAPI.GetInstance('page_content');
9 var html = oEditor.GetHTML();
10 alert(html);
11 }
12 </script>
13 <%= link_to_remote 'Apply', :submit => 'editform', :update => 'content',:before
14 => "diff_launch();test_fun();" :url => {:action => 'process_edit'} %>
after have substituting line 4 with the following line of code
var oEditor = FCKEditorAPI.GetInstance('page_content');
I get the following error from firebug:
window.parent.InnerDialogLoaded is not a function
unescapeHTML: function() {..}
Does anyone know where is the problem?
Please note that I'm using ajax link_to_remote call.
Thanks you in Advance.
Indusha
RE: retrieving an editor instance
You do try to get the editor instance after onload of it? See function FCKeditor_OnComplete, http://wiki.fckeditor.net/Developer%27s ... script_API .
RE: retrieving an editor instance
Yes I try it without success.
I integrate the FCKeditor in rails and now I'm trying to interact with the instance of the editor.
I use link_to_remote call, which returns a link to remote action that is called in background using XMLHttpRequest.
<%= link_to_remote 'Apply', :submit => 'editform',
:update => 'content',:before="diff_launch();test_fun();" :url => {:action =>
'process_edit'} %>
The function test_fun() is called after the editor loading phase is completed.
window.test_fun = function get_form_values() {
var oEditor = FCKEditorAPI.GetInstance('page_content');
var html = oEditor.GetHTML();
alert(html);
}