Skip to content
Permalink
Browse files

Merge branch 't/9212'

  • Loading branch information...
Reinmar committed Oct 15, 2012
2 parents 2dd1b68 + 60bac57 commit 87395e68b058843f528a937ec46c6cc47579c71a
Showing with 19 additions and 10 deletions.
  1. +7 −3 core/selection.js
  2. +12 −7 plugins/link/plugin.js
@@ -955,12 +955,16 @@
// Range may start inside a non-editable element,
// replace the range start after it.
if ( range.startContainer.isReadOnly() ) {
var current = range.startContainer;
var current = range.startContainer,
isElement;

while ( current ) {
if ( current.is( 'body' ) || !current.isReadOnly() )
isElement = current.type == CKEDITOR.NODE_ELEMENT;

if ( ( isElement && current.is( 'body' ) ) || !current.isReadOnly() )
break;

if ( current.type == CKEDITOR.NODE_ELEMENT && current.getAttribute( 'contentEditable' ) == 'false' )
if ( isElement && current.getAttribute( 'contentEditable' ) == 'false' )
range.setStartAfter( current );

current = current.getParent();
@@ -208,6 +208,12 @@ CKEDITOR.plugins.add( 'link', {
}
});

/**
* Set of link plugin's helpers.
*
* @class
* @singleton
*/
CKEDITOR.plugins.link = {
/**
* Get the surrounding link element of current selection.
@@ -224,7 +230,6 @@ CKEDITOR.plugins.link = {
* [<a href="#"><b>li]nk</b></a>
*
* @since 3.2.1
* @member CKEDITOR.plugins.link
* @param {CKEDITOR.editor} editor
*/
getSelectedLink: function( editor ) {
@@ -234,8 +239,12 @@ CKEDITOR.plugins.link = {
return selectedElement;

var range = selection.getRanges( true )[ 0 ];
range.shrink( CKEDITOR.SHRINK_TEXT );
return editor.elementPath( range.getCommonAncestor() ).contains( 'a', 1 );

if ( range ) {
range.shrink( CKEDITOR.SHRINK_TEXT );
return editor.elementPath( range.getCommonAncestor() ).contains( 'a', 1 );
}
return null;
},

/**
@@ -244,7 +253,6 @@ CKEDITOR.plugins.link = {
*
* @readonly
* @property {Boolean}
* @member CKEDITOR.plugins.link
*/
fakeAnchor: CKEDITOR.env.opera || CKEDITOR.env.webkit,

@@ -253,7 +261,6 @@ CKEDITOR.plugins.link = {
*
* @readonly
* @property {Boolean}
* @member CKEDITOR.plugins.link
*/
synAnchorSelector: CKEDITOR.env.ie,

@@ -262,12 +269,10 @@ CKEDITOR.plugins.link = {
*
* @readonly
* @property {Boolean}
* @member CKEDITOR.plugins.link
*/
emptyAnchorFix: CKEDITOR.env.ie && CKEDITOR.env.version < 8,

/**
* @member CKEDITOR.plugins.link
* @param {CKEDITOR.editor} editor
* @param {CKEDITOR.dom.element} element
* @todo

0 comments on commit 87395e6

Please sign in to comment.
You can’t perform that action at this time.