Permalink
Browse files

Merge pull request #873 from darkwing/launch-link-841427

fix bug 841427 - Allow 'Launch' link context item
  • Loading branch information...
2 parents ad1d34c + 9900cba commit 00edf7a5639a86befc11a6ce01fef8f99cf9e44c @groovecoder groovecoder committed Feb 19, 2013
Showing with 26 additions and 3 deletions.
  1. +25 −2 media/ckeditor/plugins/mdn-link/plugin.js
  2. +1 −1 media/ckeditor/skins/kuma/editor.css
@@ -25,6 +25,7 @@ CKEDITOR.plugins.add( 'mdn-link',
editor.addCommand( 'anchor', new CKEDITOR.dialogCommand( 'anchor' ) );
editor.addCommand( 'unlink', new CKEDITOR.unlinkCommand() );
editor.addCommand( 'removeAnchor', new CKEDITOR.removeAnchorCommand() );
+ editor.addCommand( 'launch', new CKEDITOR.launchCommand() );
editor.ui.addButton( 'Link',
{
label : editor.lang.link.toolbar,
@@ -147,6 +148,14 @@ CKEDITOR.plugins.add( 'mdn-link',
command : 'unlink',
group : 'link',
order : 5
+ },
+
+ launch :
+ {
+ label: gettext('Launch'),
+ command: 'launch',
+ group: 'link',
+ order: 6
}
});
}
@@ -160,18 +169,22 @@ CKEDITOR.plugins.add( 'mdn-link',
return null;
var anchor = CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, element );
-
if ( !anchor && !( anchor = CKEDITOR.plugins.link.getSelectedLink( editor ) ) )
return null;
var menu = {};
if ( anchor.getAttribute( 'href' ) && anchor.getChildCount() )
- menu = { link : CKEDITOR.TRISTATE_OFF, unlink : CKEDITOR.TRISTATE_OFF };
+ menu = {
+ link : CKEDITOR.TRISTATE_OFF,
+ unlink : CKEDITOR.TRISTATE_OFF
+ };
if ( anchor && anchor.hasAttribute( 'name' ) )
menu.anchor = menu.removeAnchor = CKEDITOR.TRISTATE_OFF;
+ menu.launch = CKEDITOR.TRISTATE_ON;
+
return menu;
});
}
@@ -315,6 +328,16 @@ CKEDITOR.plugins.link =
}
};
+CKEDITOR.launchCommand = function() {};
+CKEDITOR.launchCommand.prototype = {
+ exec: function(editor) {
+ var link = CKEDITOR.plugins.link.getSelectedLink(editor)
+ if(link && link.$) {
+ window.open(link.$.href);
+ }
+ }
+};
+
CKEDITOR.unlinkCommand = function(){};
CKEDITOR.unlinkCommand.prototype =
{

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 00edf7a

Please sign in to comment.