SoFunction
Updated on 2025-04-12

Introduction to FCKEDITOR related functions

Get an instance of FCK
FCKeditor API is a global object registered after FCKeditor is loaded. Using it, we can complete various operations on the editor.
Obtain an FCK editor instance on the current page:
var Editor = ('InstanceName');
Obtain an FCK editor instance from the pop-up window of the FCK editor:
var Editor = ().FCK;
Get FCK editor examples of other subframes from the subframes of the framework page:
var Editor = ('InstanceName');
Get the FCK editor instance of the parent window from the page pop-up window:
var Editor = ('InstanceName');
FCK Get Focus
Get the focus in FCK:

FCK Get Focus:
();// Get focus
Get and set the content of FCK
Get the contents of the FCK editor:
(formatted); // formatted is: true|false, indicating whether to be removed in HTML format.
Set the contents of the FCK editor:
("content", false); // The second parameter is: true|false, whether to set its content in the form of what you see, that is, what you get.
Insert content into the FCK editor:
("html"); // "html" is HTML text
Check if the FCK editor content has changed:
();
Copy the codeThe code is as follows:

// Get HTML content in the editor
function getEditorHTMLContents(EditorName) {
var oEditor = (EditorName);
return((true));
}

// Get the Chinese content of the editor
function getEditorTextContents(EditorName) {
var oEditor = (EditorName);
return();
}

// Set content in the editor
function SetEditorContents(EditorName, ContentStr) {
var oEditor = (EditorName) ;
(ContentStr) ;
}


FCK event handling

FCK defines events such as OnComplete, OnBlur and OnFocus, so that the corresponding processing can be completed using the event's handling function.

FCK adds event handling function: ( EventName, function)

Code
// FCKeditor method to process after loading
function FCKeditor_OnComplete( editorInstance )
{
( 'OnBlur' , FCKeditor_OnBlur ) ;
( 'OnFocus', FCKeditor_OnFocus ) ;
}

function FCKeditor_OnBlur( editorInstance )
{
//Lost focus Collapse toolbar
() ;
}

function FCKeditor_OnFocus( editorInstance )
{

() ;
}