Ticket #7911: 7911.patch

File 7911.patch, 2.6 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/lang/en.js

     
    201201                menu            : 'Edit Anchor',
    202202                title           : 'Anchor Properties',
    203203                name            : 'Anchor Name',
    204                 errorName       : 'Please type the anchor name'
     204                errorName       : 'Please type the anchor name',
     205                remove          : 'Remove Anchor'
    205206        },
    206207
    207208        // List style dialog
  • _source/plugins/link/plugin.js

     
    1111                editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link' ) );
    1212                editor.addCommand( 'anchor', new CKEDITOR.dialogCommand( 'anchor' ) );
    1313                editor.addCommand( 'unlink', new CKEDITOR.unlinkCommand() );
     14                editor.addCommand( 'removeAnchor', new CKEDITOR.removeAnchorCommand() );
    1415                editor.ui.addButton( 'Link',
    1516                        {
    1617                                label : editor.lang.link.toolbar,
     
    108109                                        {
    109110                                                label : editor.lang.anchor.menu,
    110111                                                command : 'anchor',
    111                                                 group : 'anchor'
     112                                                group : 'anchor',
     113                                                order : 1
    112114                                        },
    113115
     116                                        removeAnchor :
     117                                        {
     118                                                label : editor.lang.anchor.remove,
     119                                                command : 'removeAnchor',
     120                                                group : 'anchor',
     121                                                order : 5
     122                                        },
     123
    114124                                        link :
    115125                                        {
    116126                                                label : editor.lang.link.menu,
     
    148158                                                menu = { link : CKEDITOR.TRISTATE_OFF, unlink : CKEDITOR.TRISTATE_OFF };
    149159
    150160                                        if ( anchor && anchor.hasAttribute( 'name' ) )
    151                                                 menu.anchor = CKEDITOR.TRISTATE_OFF;
     161                                                menu = CKEDITOR.tools.extend( menu, { anchor : CKEDITOR.TRISTATE_OFF, removeAnchor : CKEDITOR.TRISTATE_OFF } );
    152162
    153163                                        return menu;
    154164                                });
     
    329339        startDisabled : true
    330340};
    331341
     342CKEDITOR.removeAnchorCommand = function(){};
     343CKEDITOR.removeAnchorCommand.prototype =
     344{
     345        /** @ignore */
     346        exec : function( editor )
     347        {
     348                var sel = editor.getSelection(),
     349                        bms = sel.createBookmarks(),
     350                        anchor;
     351                if ( sel && ( anchor = sel.getSelectedElement() ) && CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, anchor ) )
     352                        anchor.remove();
     353                else
     354                {
     355                        if ( ( anchor = CKEDITOR.plugins.link.getSelectedLink( editor ) ) )
     356                        {
     357                                if ( anchor.hasAttribute( 'href' ) )
     358                                {
     359                                        anchor.removeAttributes( { name:1, 'data-cke-saved-name':1 } );
     360                                        anchor.removeClass( 'cke_anchor' );
     361                                }
     362                                else
     363                                        anchor.remove( 1 );
     364                        }
     365                }
     366                sel.selectBookmarks( bms );
     367        }
     368};
     369
    332370CKEDITOR.tools.extend( CKEDITOR.config,
    333371{
    334372        linkShowAdvancedTab : true,
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy