Take creating a simple hyperlink as an example. You can use the directory of the placeholder plugin that already exists as the basic skeleton.
1. Name the plugin name as: "InsertLink". , and create a directory with the same name, and create a Lang directory in the InsertLink directory, and there is at least one file in the lang directory. The file must have at least international information about buttons and dialog titles, such as:
= 'Insert/Edit Link' ; //Title of the button
= 'Link Properties' ; //Title of the dialog box
2: Pictures, add image files in the InsertLink folder, it is best to name the image file with the same name as the plugin name. The size of the picture is 20*21 and is transparent.
3:javascript:
Add files to the InsertLink directory.
Register related commands:
The method to register a command is (command name, dialog command)
The format of the dialog command is created: new FCKDialogCommand (command name, dialog title, url path, width, height)
( 'InsertLink', new FCKDialogCommand( 'InsertLink', ,
['InsertLink'].Path + 'fck_InsertLink.html', 340, 200 ) ) ;
// Create toolbar button new FCKToolbarButton(button name, button title);
var oInsertLinkItem = new FCKToolbarButton( 'InsertLink', ) ;
= ['InsertLink'].Path + '' ;
( 'InsertLink', oInsertLinkItem ) ;
//Create an object for all InsertLink operations
var FCKInsertLink = new Object() ;
//Insert a hyperlink on the current selection
// This added method will be called when the ok button is clicked on the pop-up window.
// This method will receive the value passed from the dialog box.
= function( linkname, caption )
{
if((0,4) != "http" && (0,4) != "HTTP")
linkname = "http://"+linkname ;
("<a href='"+linkname+"'>"+caption+"</a>") ;
}
4:html
Add the requested file in the InsertLink directory.
Template code for requesting file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Link Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script language="javascript">
var oEditor = () ;
var FCK = ;
var FCKLang = ;
var FCKInsertLink = ;
= function ()
{
LoadSelected() ; //see function below
( true ) ;
}
//There are two ways to get the currently selected element from the editor:
//1. Can be used for selection of elements such as image.
//var eSelected = () ;
//2. Due to the internal text element
var eSelected = ( 'A' )
if ( eSelected )
( eSelected ) ;
//If the super leveling is selected, then the properties of the hyperlink are displayed
function LoadSelected()
{
if ( !eSelected )
return ;
= ;
= ;
//Code suitable for the first choice operation:
// if ( == 'IMG' ) {
// -- code for setting dialog values -- }
// else
// eSelected == null ; //this will replace the current selection if not the right type
}
//The operation that occurs when clicking the ok button
function Ok()
{
if ( ('txtHref'). > 0 )
( , ) ;
return true ;
}
</script>
</head>
<body scroll="no" style="OVERFLOW: hidden">
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" align="center" border="0">
<tr>
<td>
Type the URL for the link<br>
<input type="text"><br>
Type the caption for the link<br>
<input type="text">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<!-- End Code -->
5: Edit the file, add the following code, and register the plug-in.
( 'InsertLink', 'en' ) ;
//Define the command name in the toolbar collection.
["Default"] = [ , ['InsertLink']
1. Name the plugin name as: "InsertLink". , and create a directory with the same name, and create a Lang directory in the InsertLink directory, and there is at least one file in the lang directory. The file must have at least international information about buttons and dialog titles, such as:
= 'Insert/Edit Link' ; //Title of the button
= 'Link Properties' ; //Title of the dialog box
2: Pictures, add image files in the InsertLink folder, it is best to name the image file with the same name as the plugin name. The size of the picture is 20*21 and is transparent.
3:javascript:
Add files to the InsertLink directory.
Register related commands:
The method to register a command is (command name, dialog command)
The format of the dialog command is created: new FCKDialogCommand (command name, dialog title, url path, width, height)
( 'InsertLink', new FCKDialogCommand( 'InsertLink', ,
['InsertLink'].Path + 'fck_InsertLink.html', 340, 200 ) ) ;
// Create toolbar button new FCKToolbarButton(button name, button title);
var oInsertLinkItem = new FCKToolbarButton( 'InsertLink', ) ;
= ['InsertLink'].Path + '' ;
( 'InsertLink', oInsertLinkItem ) ;
//Create an object for all InsertLink operations
var FCKInsertLink = new Object() ;
//Insert a hyperlink on the current selection
// This added method will be called when the ok button is clicked on the pop-up window.
// This method will receive the value passed from the dialog box.
= function( linkname, caption )
{
if((0,4) != "http" && (0,4) != "HTTP")
linkname = "http://"+linkname ;
("<a href='"+linkname+"'>"+caption+"</a>") ;
}
4:html
Add the requested file in the InsertLink directory.
Template code for requesting file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Link Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script language="javascript">
var oEditor = () ;
var FCK = ;
var FCKLang = ;
var FCKInsertLink = ;
= function ()
{
LoadSelected() ; //see function below
( true ) ;
}
//There are two ways to get the currently selected element from the editor:
//1. Can be used for selection of elements such as image.
//var eSelected = () ;
//2. Due to the internal text element
var eSelected = ( 'A' )
if ( eSelected )
( eSelected ) ;
//If the super leveling is selected, then the properties of the hyperlink are displayed
function LoadSelected()
{
if ( !eSelected )
return ;
= ;
= ;
//Code suitable for the first choice operation:
// if ( == 'IMG' ) {
// -- code for setting dialog values -- }
// else
// eSelected == null ; //this will replace the current selection if not the right type
}
//The operation that occurs when clicking the ok button
function Ok()
{
if ( ('txtHref'). > 0 )
( , ) ;
return true ;
}
</script>
</head>
<body scroll="no" style="OVERFLOW: hidden">
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" align="center" border="0">
<tr>
<td>
Type the URL for the link<br>
<input type="text"><br>
Type the caption for the link<br>
<input type="text">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<!-- End Code -->
5: Edit the file, add the following code, and register the plug-in.
( 'InsertLink', 'en' ) ;
//Define the command name in the toolbar collection.
["Default"] = [ , ['InsertLink']