[ Index ] |
|
Code source de FCKeditor 2.4 |
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 * File Name: fckplugin.js 22 * This is a sample plugin definition file. 23 * 24 * File Authors: 25 * Frederico Caldeira Knabben (www.fckeditor.net) 26 */ 27 28 // Here we define our custom Style combo, with custom widths. 29 var oMyBigStyleCombo = new FCKToolbarStyleCombo() ; 30 oMyBigStyleCombo.FieldWidth = 250 ; 31 oMyBigStyleCombo.PanelWidth = 300 ; 32 FCKToolbarItems.RegisterItem( 'My_BigStyle', oMyBigStyleCombo ) ; 33 34 35 // ##### Defining a custom context menu entry. 36 37 // ## 1. Define the command to be executed when selecting the context menu item. 38 var oMyCMCommand = new Object() ; 39 oMyCMCommand.Name = 'OpenImage' ; 40 41 // This is the standard function used to execute the command (called when clicking in the context menu item). 42 oMyCMCommand.Execute = function() 43 { 44 // This command is called only when an image element is selected (IMG). 45 // Get image URL (src). 46 var sUrl = FCKSelection.GetSelectedElement().src ; 47 48 // Open the URL in a new window. 49 window.top.open( sUrl ) ; 50 } 51 52 // This is the standard function used to retrieve the command state (it could be disabled for some reason). 53 oMyCMCommand.GetState = function() 54 { 55 // Let's make it always enabled. 56 return FCK_TRISTATE_OFF ; 57 } 58 59 // ## 2. Register our custom command. 60 FCKCommands.RegisterCommand( 'OpenImage', oMyCMCommand ) ; 61 62 // ## 3. Define the context menu "listener". 63 var oMyContextMenuListener = new Object() ; 64 65 // This is the standard function called right before sowing the context menu. 66 oMyContextMenuListener.AddItems = function( contextMenu, tag, tagName ) 67 { 68 // Let's show our custom option only for images. 69 if ( tagName == 'IMG' ) 70 { 71 contextMenu.AddSeparator() ; 72 contextMenu.AddItem( 'OpenImage', 'Open image in a new window (Custom)' ) ; 73 } 74 } 75 76 // ## 4. Register our context menu listener. 77 FCK.ContextMenu.RegisterListener( oMyContextMenuListener ) ;
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:28:05 2007 | par Balluche grâce à PHPXref 0.7 |