Page MenuHomeIn-Portal Phabricator

fckplugin.js
No OneTemporary

File Metadata

Created
Sun, Mar 9, 9:47 PM

fckplugin.js

var document_icon = FCKPlugins.Items['document'].Path + '/images/document.gif';
FCKToolbarItems.RegisterItem( 'Document', new FCKToolbarButton( 'Document' , FCKLang.InsertDocumentBtn, FCKLang.InsertDocumentBtn, null, false, true, document_icon) ) ;
FCKCommands.RegisterCommand( 'Document', new FCKDialogCommand( 'Document', FCKLang.DocumentDlgTitle, FCKPlugins.Items['document'].Path + 'document.html', 550, 330 ) ) ;
FCK.ContextMenu.RegisterListener( {
AddItems : function( menu, tag, tagName )
{
var bInsideLink = ( tagName == 'A' || FCKSelection.HasAncestorNode( 'A' ) ) ;
if ( bInsideLink || FCK.GetNamedCommandState( 'Unlink' ) != FCK_TRISTATE_DISABLED )
{
// Go up to the anchor to test its properties
var oLink = FCKSelection.MoveToAncestorNode( 'A' ) ;
var bIsAnchor = ( oLink && oLink.name.length > 0 && oLink.href.length == 0 ) ;
// If it isn't a link then don't add the Link context menu
if ( bIsAnchor )
return ;
menu.AddSeparator() ;
if ( bInsideLink ) {
var id = oLink.getAttribute( 'id' , 2 );
if (id && id.match(/^Doc_+/))
{
menu.AddItem( 'Document', FCKLang.InsertDocumentBtn, document_icon );
}
}
}
}
}) ;

Event Timeline