fckplugin.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. FCKCommands.RegisterCommand(commandName, command)
  3. commandName - Command name, referenced by the Toolbar, etc...
  4. command - Command object (must provide an Execute() function).
  5. */
  6. // Register the related commands.
  7. FCKCommands.RegisterCommand(
  8. 'mimetex',
  9. new FCKDialogCommand(
  10. FCKLang['DlgMimeTeX'],
  11. FCKLang['DlgMimeTeX'],
  12. FCKConfig.PluginsPath + 'mimetex/mimetex.html', 800, 550));
  13. // Create the "mimeTeX" toolbar button.
  14. var oMimeTeXItem = new FCKToolbarButton('mimetex', FCKLang['DlgMimeTeX']);
  15. oMimeTeXItem.IconPath = FCKConfig.PluginsPath + 'mimetex/mimetex.gif' ;
  16. // 'mimetex' is the name used in the Toolbar config.
  17. FCKToolbarItems.RegisterItem( 'mimetex', oMimeTeXItem ) ;
  18. // Context menu support.
  19. FCK.ContextMenu.RegisterListener( {
  20. AddItems : function( menu, tag, tagName )
  21. {
  22. if ( tagName == 'IMG' && tag.getAttribute( 'src' ) && tag.getAttribute( 'src' ).toString().indexOf( '/cgi-bin/mimetex' ) >= 0 )
  23. {
  24. menu.AddSeparator() ;
  25. menu.AddItem( 'mimetex', FCKLang['DlgMimeTeX'], oMimeTeXItem.IconPath ) ;
  26. }
  27. }}
  28. );
  29. // Double-click support.
  30. FCK.RegisterDoubleClickHandler(
  31. function ( tag )
  32. {
  33. if ( tag.nodeName.IEquals( 'img' ) && tag.getAttribute( 'src' ) && tag.getAttribute( 'src' ).toString().indexOf( '/cgi-bin/mimetex' ) >= 0 )
  34. {
  35. FCKCommands.GetCommand( 'mimetex' ).Execute() ;
  36. }
  37. }, 'IMG'
  38. ) ;