1075 |
ddelon |
1 |
/*
|
|
|
2 |
* FCKeditor - The text editor for internet
|
|
|
3 |
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
|
|
4 |
*
|
|
|
5 |
* Licensed under the terms of the GNU Lesser General Public License:
|
|
|
6 |
* http://www.opensource.org/licenses/lgpl-license.php
|
|
|
7 |
*
|
|
|
8 |
* For further information visit:
|
|
|
9 |
* http://www.fckeditor.net/
|
|
|
10 |
*
|
|
|
11 |
* "Support Open Source software. What about a donation today?"
|
|
|
12 |
*
|
|
|
13 |
* File Name: fckcommands.js
|
|
|
14 |
* Define all commands available in the editor.
|
|
|
15 |
*
|
|
|
16 |
* File Authors:
|
|
|
17 |
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
|
|
18 |
*/
|
|
|
19 |
|
|
|
20 |
var FCKCommands = FCK.Commands = new Object() ;
|
|
|
21 |
FCKCommands.LoadedCommands = new Object() ;
|
|
|
22 |
|
|
|
23 |
FCKCommands.RegisterCommand = function( commandName, command )
|
|
|
24 |
{
|
|
|
25 |
this.LoadedCommands[ commandName ] = command ;
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
FCKCommands.GetCommand = function( commandName )
|
|
|
29 |
{
|
|
|
30 |
var oCommand = FCKCommands.LoadedCommands[ commandName ] ;
|
|
|
31 |
|
|
|
32 |
if ( oCommand )
|
|
|
33 |
return oCommand ;
|
|
|
34 |
|
|
|
35 |
switch ( commandName )
|
|
|
36 |
{
|
|
|
37 |
case 'DocProps' : oCommand = new FCKDialogCommand( 'DocProps' , FCKLang.DocProps , 'dialog/fck_docprops.html' , 400, 390, FCKCommands.GetFullPageState ) ; break ;
|
|
|
38 |
case 'Templates' : oCommand = new FCKDialogCommand( 'Templates' , FCKLang.DlgTemplatesTitle , 'dialog/fck_template.html' , 380, 450 ) ; break ;
|
|
|
39 |
case 'Link' : oCommand = new FCKDialogCommand( 'Link' , FCKLang.DlgLnkWindowTitle , 'dialog/fck_link.html' , 400, 330, FCK.GetNamedCommandState, 'CreateLink' ) ; break ;
|
|
|
40 |
case 'Unlink' : oCommand = new FCKUnlinkCommand() ; break ;
|
|
|
41 |
case 'Anchor' : oCommand = new FCKDialogCommand( 'Anchor' , FCKLang.DlgAnchorTitle , 'dialog/fck_anchor.html' , 370, 170 ) ; break ;
|
|
|
42 |
case 'BulletedList' : oCommand = new FCKDialogCommand( 'BulletedList', FCKLang.BulletedListProp , 'dialog/fck_listprop.html' , 370, 170 ) ; break ;
|
|
|
43 |
case 'NumberedList' : oCommand = new FCKDialogCommand( 'NumberedList', FCKLang.NumberedListProp , 'dialog/fck_listprop.html' , 370, 170 ) ; break ;
|
|
|
44 |
case 'About' : oCommand = new FCKDialogCommand( 'About' , FCKLang.About , 'dialog/fck_about.html' , 400, 330 ) ; break ;
|
|
|
45 |
|
|
|
46 |
case 'Find' : oCommand = new FCKDialogCommand( 'Find' , FCKLang.DlgFindTitle , 'dialog/fck_find.html' , 340, 170 ) ; break ;
|
|
|
47 |
case 'Replace' : oCommand = new FCKDialogCommand( 'Replace' , FCKLang.DlgReplaceTitle , 'dialog/fck_replace.html' , 340, 200 ) ; break ;
|
|
|
48 |
|
|
|
49 |
case 'Image' : oCommand = new FCKDialogCommand( 'Image' , FCKLang.DlgImgTitle , 'dialog/fck_image.html' , 450, 400 ) ; break ;
|
|
|
50 |
case 'Flash' : oCommand = new FCKDialogCommand( 'Flash' , FCKLang.DlgFlashTitle , 'dialog/fck_flash.html' , 450, 400 ) ; break ;
|
|
|
51 |
case 'SpecialChar' : oCommand = new FCKDialogCommand( 'SpecialChar', FCKLang.DlgSpecialCharTitle , 'dialog/fck_specialchar.html' , 400, 320 ) ; break ;
|
|
|
52 |
case 'Smiley' : oCommand = new FCKDialogCommand( 'Smiley' , FCKLang.DlgSmileyTitle , 'dialog/fck_smiley.html' , FCKConfig.SmileyWindowWidth, FCKConfig.SmileyWindowHeight ) ; break ;
|
|
|
53 |
case 'Table' : oCommand = new FCKDialogCommand( 'Table' , FCKLang.DlgTableTitle , 'dialog/fck_table.html' , 450, 250 ) ; break ;
|
|
|
54 |
case 'TableProp' : oCommand = new FCKDialogCommand( 'Table' , FCKLang.DlgTableTitle , 'dialog/fck_table.html?Parent', 400, 250 ) ; break ;
|
|
|
55 |
case 'TableCellProp': oCommand = new FCKDialogCommand( 'TableCell' , FCKLang.DlgCellTitle , 'dialog/fck_tablecell.html' , 550, 250 ) ; break ;
|
|
|
56 |
case 'UniversalKey' : oCommand = new FCKDialogCommand( 'UniversalKey', FCKLang.UniversalKeyboard , 'dialog/fck_universalkey.html', 415, 300 ) ; break ;
|
|
|
57 |
|
|
|
58 |
case 'Style' : oCommand = new FCKStyleCommand() ; break ;
|
|
|
59 |
|
|
|
60 |
case 'FontName' : oCommand = new FCKFontNameCommand() ; break ;
|
|
|
61 |
case 'FontSize' : oCommand = new FCKFontSizeCommand() ; break ;
|
|
|
62 |
case 'FontFormat' : oCommand = new FCKFormatBlockCommand() ; break ;
|
|
|
63 |
|
|
|
64 |
case 'Source' : oCommand = new FCKSourceCommand() ; break ;
|
|
|
65 |
case 'Preview' : oCommand = new FCKPreviewCommand() ; break ;
|
|
|
66 |
case 'Save' : oCommand = new FCKSaveCommand() ; break ;
|
|
|
67 |
case 'NewPage' : oCommand = new FCKNewPageCommand() ; break ;
|
|
|
68 |
case 'PageBreak' : oCommand = new FCKPageBreakCommand() ; break ;
|
|
|
69 |
|
|
|
70 |
case 'TextColor' : oCommand = new FCKTextColorCommand('ForeColor') ; break ;
|
|
|
71 |
case 'BGColor' : oCommand = new FCKTextColorCommand('BackColor') ; break ;
|
|
|
72 |
|
|
|
73 |
case 'PasteText' : oCommand = new FCKPastePlainTextCommand() ; break ;
|
|
|
74 |
case 'PasteWord' : oCommand = new FCKPasteWordCommand() ; break ;
|
|
|
75 |
|
|
|
76 |
case 'TableInsertRow' : oCommand = new FCKTableCommand('TableInsertRow') ; break ;
|
|
|
77 |
case 'TableDeleteRows' : oCommand = new FCKTableCommand('TableDeleteRows') ; break ;
|
|
|
78 |
case 'TableInsertColumn' : oCommand = new FCKTableCommand('TableInsertColumn') ; break ;
|
|
|
79 |
case 'TableDeleteColumns' : oCommand = new FCKTableCommand('TableDeleteColumns') ; break ;
|
|
|
80 |
case 'TableInsertCell' : oCommand = new FCKTableCommand('TableInsertCell') ; break ;
|
|
|
81 |
case 'TableDeleteCells' : oCommand = new FCKTableCommand('TableDeleteCells') ; break ;
|
|
|
82 |
case 'TableMergeCells' : oCommand = new FCKTableCommand('TableMergeCells') ; break ;
|
|
|
83 |
case 'TableSplitCell' : oCommand = new FCKTableCommand('TableSplitCell') ; break ;
|
|
|
84 |
case 'TableDelete' : oCommand = new FCKTableCommand('TableDelete') ; break ;
|
|
|
85 |
|
|
|
86 |
case 'Form' : oCommand = new FCKDialogCommand( 'Form' , FCKLang.Form , 'dialog/fck_form.html' , 380, 230 ) ; break ;
|
|
|
87 |
case 'Checkbox' : oCommand = new FCKDialogCommand( 'Checkbox' , FCKLang.Checkbox , 'dialog/fck_checkbox.html' , 380, 230 ) ; break ;
|
|
|
88 |
case 'Radio' : oCommand = new FCKDialogCommand( 'Radio' , FCKLang.RadioButton , 'dialog/fck_radiobutton.html' , 380, 230 ) ; break ;
|
|
|
89 |
case 'TextField' : oCommand = new FCKDialogCommand( 'TextField' , FCKLang.TextField , 'dialog/fck_textfield.html' , 380, 230 ) ; break ;
|
|
|
90 |
case 'Textarea' : oCommand = new FCKDialogCommand( 'Textarea' , FCKLang.Textarea , 'dialog/fck_textarea.html' , 380, 230 ) ; break ;
|
|
|
91 |
case 'HiddenField' : oCommand = new FCKDialogCommand( 'HiddenField', FCKLang.HiddenField , 'dialog/fck_hiddenfield.html' , 380, 230 ) ; break ;
|
|
|
92 |
case 'Button' : oCommand = new FCKDialogCommand( 'Button' , FCKLang.Button , 'dialog/fck_button.html' , 380, 230 ) ; break ;
|
|
|
93 |
case 'Select' : oCommand = new FCKDialogCommand( 'Select' , FCKLang.SelectionField, 'dialog/fck_select.html' , 400, 380 ) ; break ;
|
|
|
94 |
case 'ImageButton' : oCommand = new FCKDialogCommand( 'ImageButton', FCKLang.ImageButton , 'dialog/fck_image.html?ImageButton', 450, 400 ) ; break ;
|
|
|
95 |
|
|
|
96 |
case 'SpellCheck' : oCommand = new FCKSpellCheckCommand() ; break ;
|
|
|
97 |
case 'FitWindow' : oCommand = new FCKFitWindow() ; break ;
|
|
|
98 |
|
|
|
99 |
case 'Undo' : oCommand = new FCKUndoCommand() ; break ;
|
|
|
100 |
case 'Redo' : oCommand = new FCKRedoCommand() ; break ;
|
|
|
101 |
|
|
|
102 |
// Generic Undefined command (usually used when a command is under development).
|
|
|
103 |
case 'Undefined' : oCommand = new FCKUndefinedCommand() ; break ;
|
|
|
104 |
|
|
|
105 |
// By default we assume that it is a named command.
|
|
|
106 |
default:
|
|
|
107 |
if ( FCKRegexLib.NamedCommands.test( commandName ) )
|
|
|
108 |
oCommand = new FCKNamedCommand( commandName ) ;
|
|
|
109 |
else
|
|
|
110 |
{
|
|
|
111 |
alert( FCKLang.UnknownCommand.replace( /%1/g, commandName ) ) ;
|
|
|
112 |
return null ;
|
|
|
113 |
}
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
FCKCommands.LoadedCommands[ commandName ] = oCommand ;
|
|
|
117 |
|
|
|
118 |
return oCommand ;
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
// Gets the state of the "Document Properties" button. It must be enabled only
|
|
|
122 |
// when "Full Page" editing is available.
|
|
|
123 |
FCKCommands.GetFullPageState = function()
|
|
|
124 |
{
|
|
|
125 |
return FCKConfig.FullPage ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ;
|
|
|
126 |
}
|