PluginProbe
Wp-Insert / 1.2
Wp-Insert v1.2
trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.3.0 1.3.1 1.3.3 1.4 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 2.0 All 63 releases
wp-insert / fckeditor / _samples / _plugins / samples / fckplugin.js

fckplugin.js in Wp-Insert 1.2, at fckeditor/_samples/_plugins/samples/fckplugin.js

147 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*
2
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
5 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
6
7 *
8
9 * == BEGIN LICENSE ==
10
11 *
12
13 * Licensed under the terms of any of the following licenses at your
14
15 * choice:
16
17 *
18
19 * - GNU General Public License Version 2 or later (the "GPL")
20
21 * http://www.gnu.org/licenses/gpl.html
22
23 *
24
25 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
26
27 * http://www.gnu.org/licenses/lgpl.html
28
29 *
30
31 * - Mozilla Public License Version 1.1 or later (the "MPL")
32
33 * http://www.mozilla.org/MPL/MPL-1.1.html
34
35 *
36
37 * == END LICENSE ==
38
39 *
40
41 * This is a sample plugin definition file.
42
43 */
44
45
46
47 // Here we define our custom Style combo, with custom widths.
48
49 var oMyBigStyleCombo = new FCKToolbarStyleCombo() ;
50
51 oMyBigStyleCombo.FieldWidth = 250 ;
52
53 oMyBigStyleCombo.PanelWidth = 300 ;
54
55 FCKToolbarItems.RegisterItem( 'My_BigStyle', oMyBigStyleCombo ) ;
56
57
58
59
60
61 // ##### Defining a custom context menu entry.
62
63
64
65 // ## 1. Define the command to be executed when selecting the context menu item.
66
67 var oMyCMCommand = new Object() ;
68
69 oMyCMCommand.Name = 'OpenImage' ;
70
71
72
73 // This is the standard function used to execute the command (called when clicking in the context menu item).
74
75 oMyCMCommand.Execute = function()
76
77 {
78
79 // This command is called only when an image element is selected (IMG).
80
81 // Get image URL (src).
82
83 var sUrl = FCKSelection.GetSelectedElement().src ;
84
85
86
87 // Open the URL in a new window.
88
89 window.top.open( sUrl ) ;
90
91 }
92
93
94
95 // This is the standard function used to retrieve the command state (it could be disabled for some reason).
96
97 oMyCMCommand.GetState = function()
98
99 {
100
101 // Let's make it always enabled.
102
103 return FCK_TRISTATE_OFF ;
104
105 }
106
107
108
109 // ## 2. Register our custom command.
110
111 FCKCommands.RegisterCommand( 'OpenImage', oMyCMCommand ) ;
112
113
114
115 // ## 3. Define the context menu "listener".
116
117 var oMyContextMenuListener = new Object() ;
118
119
120
121 // This is the standard function called right before sowing the context menu.
122
123 oMyContextMenuListener.AddItems = function( contextMenu, tag, tagName )
124
125 {
126
127 // Let's show our custom option only for images.
128
129 if ( tagName == 'IMG' )
130
131 {
132
133 contextMenu.AddSeparator() ;
134
135 contextMenu.AddItem( 'OpenImage', 'Open image in a new window (Custom)' ) ;
136
137 }
138
139 }
140
141
142
143 // ## 4. Register our context menu listener.
144
145 FCK.ContextMenu.RegisterListener( oMyContextMenuListener ) ;
146
147