Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
ckeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vanilla ckeditor-3.4b
[ckeditor.git]
/
_source
/
plugins
/
link
/
plugin.js
diff --git
a/_source/plugins/link/plugin.js
b/_source/plugins/link/plugin.js
index
c7f7adb
..
c8e145f
100644
(file)
--- a/
_source/plugins/link/plugin.js
+++ b/
_source/plugins/link/plugin.js
@@
-58,7
+58,7
@@
CKEDITOR.plugins.add( 'link',
* for this in Firefox. So we must detect the state by element paths.
\r
*/
\r
var command = editor.getCommand( 'unlink' ),
\r
* for this in Firefox. So we must detect the state by element paths.
\r
*/
\r
var command = editor.getCommand( 'unlink' ),
\r
- element = evt.data.path.lastElement.getAscendant( 'a', true );
\r
+ element = evt.data.path.lastElement && evt.data.path.lastElement.getAscendant( 'a', true );
\r
if ( element && element.getName() == 'a' && element.getAttribute( 'href' ) )
\r
command.setState( CKEDITOR.TRISTATE_OFF );
\r
else
\r
if ( element && element.getName() == 'a' && element.getAttribute( 'href' ) )
\r
command.setState( CKEDITOR.TRISTATE_OFF );
\r
else
\r
@@
-110,7
+110,7
@@
CKEDITOR.plugins.add( 'link',
{
\r
editor.contextMenu.addListener( function( element, selection )
\r
{
\r
{
\r
editor.contextMenu.addListener( function( element, selection )
\r
{
\r
- if ( !element )
\r
+ if ( !element || element.isReadOnly() )
\r
return null;
\r
\r
var isAnchor = ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' );
\r
return null;
\r
\r
var isAnchor = ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' );
\r
@@
-177,12
+177,14
@@
CKEDITOR.plugins.link =
getSelectedLink : function( editor )
\r
{
\r
var range;
\r
getSelectedLink : function( editor )
\r
{
\r
var range;
\r
- try { range = editor.getSelection().getRanges()[ 0 ]; }
\r
+ try
\r
+ {
\r
+ range = editor.getSelection().getRanges( true )[ 0 ];
\r
+ range.shrink( CKEDITOR.SHRINK_TEXT );
\r
+ var root = range.getCommonAncestor();
\r
+ return root.getAscendant( 'a', true );
\r
+ }
\r
catch( e ) { return null; }
\r
catch( e ) { return null; }
\r
-
\r
- range.shrink( CKEDITOR.SHRINK_TEXT );
\r
- var root = range.getCommonAncestor();
\r
- return root.getAscendant( 'a', true );
\r
}
\r
};
\r
\r
}
\r
};
\r
\r