1/*
2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
4 *
5 * == BEGIN LICENSE ==
6 *
7 * Licensed under the terms of any of the following licenses at your
8 * choice:
9 *
10 *  - GNU General Public License Version 2 or later (the "GPL")
11 *    http://www.gnu.org/licenses/gpl.html
12 *
13 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14 *    http://www.gnu.org/licenses/lgpl.html
15 *
16 *  - Mozilla Public License Version 1.1 or later (the "MPL")
17 *    http://www.mozilla.org/MPL/MPL-1.1.html
18 *
19 * == END LICENSE ==
20 *
21 * This is a sample plugin definition file.
22 */
23
24// Here we define our custom Style combo, with custom widths.
25var oMyBigStyleCombo = new FCKToolbarStyleCombo() ;
26oMyBigStyleCombo.FieldWidth = 250 ;
27oMyBigStyleCombo.PanelWidth = 300 ;
28FCKToolbarItems.RegisterItem( 'My_BigStyle', oMyBigStyleCombo ) ;
29
30
31// ##### Defining a custom context menu entry.
32
33// ## 1. Define the command to be executed when selecting the context menu item.
34var oMyCMCommand = new Object() ;
35oMyCMCommand.Name = 'OpenImage' ;
36
37// This is the standard function used to execute the command (called when clicking in the context menu item).
38oMyCMCommand.Execute = function()
39{
40	// This command is called only when an image element is selected (IMG).
41	// Get image URL (src).
42	var sUrl = FCKSelection.GetSelectedElement().src ;
43
44	// Open the URL in a new window.
45	window.top.open( sUrl ) ;
46}
47
48// This is the standard function used to retrieve the command state (it could be disabled for some reason).
49oMyCMCommand.GetState = function()
50{
51	// Let's make it always enabled.
52	return FCK_TRISTATE_OFF ;
53}
54
55// ## 2. Register our custom command.
56FCKCommands.RegisterCommand( 'OpenImage', oMyCMCommand ) ;
57
58// ## 3. Define the context menu "listener".
59var oMyContextMenuListener = new Object() ;
60
61// This is the standard function called right before sowing the context menu.
62oMyContextMenuListener.AddItems = function( contextMenu, tag, tagName )
63{
64	// Let's show our custom option only for images.
65	if ( tagName == 'IMG' )
66	{
67		contextMenu.AddSeparator() ;
68		contextMenu.AddItem( 'OpenImage', 'Open image in a new window (Custom)' ) ;
69	}
70}
71
72// ## 4. Register our context menu listener.
73FCK.ContextMenu.RegisterListener( oMyContextMenuListener ) ;