fckplugin.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Licensed under the terms of the GNU Lesser General Public License:
  3. * http://www.opensource.org/licenses/lgpl-license.php
  4. *
  5. * File Name: fckplugin.js
  6. * Plugin to add some HTML, a single snippet; a choice from multiple snippets; or manually entered HTML
  7. *
  8. * File Authors:
  9. * Paul Moers (http://www.saulmade.nl/FCKeditor/FCKPlugins.php)
  10. */
  11. // insertHtmlObject constructor
  12. var insertHtmlToolbarCommand = function()
  13. {
  14. }
  15. // register the command
  16. FCKCommands.RegisterCommand('insertHtml', new insertHtmlToolbarCommand());
  17. // create the toolbar button
  18. var insertHtmlButton = new FCKToolbarButton('insertHtml', FCKConfig.insertHtml_buttonTooltip || FCKLang.inserHTML_buttonTooltip);
  19. insertHtmlButton.IconPath = FCKPlugins.Items['insertHtml'].Path + 'images/toolbarIcon_default.gif'; // or pick any other in folder 'images'
  20. FCKToolbarItems.RegisterItem('insertHtml', insertHtmlButton);
  21. // manage the plugins' button behavior
  22. insertHtmlToolbarCommand.prototype.GetState = function()
  23. {
  24. return FCK_TRISTATE_OFF;
  25. }
  26. // insertHtml's button click function
  27. insertHtmlToolbarCommand.prototype.Execute = function()
  28. {
  29. if (FCKConfig.insertHtml_showDialog || !FCKConfig.insertHtml_snippets || (FCKConfig.insertHtml_snippets && !FCKConfig.insertHtml_snippets.length))
  30. {
  31. var dialog = new FCKDialogCommand('insertHtml', FCKLang.insertHtml_dialogTitle, FCKPlugins.Items['insertHtml'].Path + 'insertHtml.html', FCKConfig.insertHtml_dialogWidth || 475, FCKConfig.insertHtml_dialogHeight || 475);
  32. dialog.Execute();
  33. }
  34. else
  35. {
  36. FCK.InsertHtml(FCKConfig.insertHtml_snippet);
  37. FCK.EditorWindow.parent.FCKUndo.SaveUndoStep();
  38. }
  39. }