(New page: == FCKeditor JavaScript API == FCKeditor offers a complete JavaScript API so you can interact with it once the editor is loaded and running. Once loaded, the editor registers a global ob...) |
|||
Line 5: | Line 5: | ||
Once loaded, the editor registers a global object called '''FCKeditorAPI'''. This object offers the entry point to interact with any editor instance placed in a page (you can have more than one). | Once loaded, the editor registers a global object called '''FCKeditorAPI'''. This object offers the entry point to interact with any editor instance placed in a page (you can have more than one). | ||
− | '''NOTE''' The '''FCKeditorAPI''' object will not be available during the page load. You need to wait for the editor to be loaded to use it. If you need to interact with the editor right after is has been loaded, use the "FCKeditor_OnComplete" function (see "Events"). | + | '''NOTE''': The '''FCKeditorAPI''' object will not be available during the page load. You need to wait for the editor to be loaded to use it. If you need to interact with the editor right after is has been loaded, use the "FCKeditor_OnComplete" function (see "Events"). |
+ | |||
+ | == Retrieving an Editor Instance == | ||
+ | |||
+ | * '''From out of an external script''' <br><br>When placing the editor in the page, you give it an "instance name". To retrieve it, you must simply call the '''FCKeditorAPI.GetInstance''' method. | ||
+ | Example: | ||
+ | <pre> | ||
+ | var oEditor = FCKeditorAPI.GetInstance('InstanceName') ; | ||
+ | </pre> | ||
+ | * '''From out of a dialog of the editor'''<br><br>Call the '''InnerDialogLoaded''' to get the FCKObject. | ||
+ | <pre> | ||
+ | var oEditor = window.parent.InnerDialogLoaded().FCK ; | ||
+ | </pre> | ||
+ | |||
+ | Both methods return the main FCKeditor object that gives the necessary bridge to interact with it. These are the most useful properties and methods of this object: |
Revision as of 12:40, 18 January 2008
FCKeditor JavaScript API
FCKeditor offers a complete JavaScript API so you can interact with it once the editor is loaded and running.
Once loaded, the editor registers a global object called FCKeditorAPI. This object offers the entry point to interact with any editor instance placed in a page (you can have more than one).
NOTE: The FCKeditorAPI object will not be available during the page load. You need to wait for the editor to be loaded to use it. If you need to interact with the editor right after is has been loaded, use the "FCKeditor_OnComplete" function (see "Events").
Retrieving an Editor Instance
- From out of an external script
When placing the editor in the page, you give it an "instance name". To retrieve it, you must simply call the FCKeditorAPI.GetInstance method.
Example:
var oEditor = FCKeditorAPI.GetInstance('InstanceName') ;
- From out of a dialog of the editor
Call the InnerDialogLoaded to get the FCKObject.
var oEditor = window.parent.InnerDialogLoaded().FCK ;
Both methods return the main FCKeditor object that gives the necessary bridge to interact with it. These are the most useful properties and methods of this object: