X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fplaceholder%2Fplugin.js;h=503f08acf4cf6e4af02bd52f68ef7110d7f65766;hb=4e90e78dc97789709ee7404359a5517540c27553;hp=5ea9b24323ffd33dd5c5bf7440d4a52c61b62ae2;hpb=9afde8772159bd3436f1f5b7862960307710ae5a;p=ckeditor.git diff --git a/_source/plugins/placeholder/plugin.js b/_source/plugins/placeholder/plugin.js index 5ea9b24..503f08a 100644 --- a/_source/plugins/placeholder/plugin.js +++ b/_source/plugins/placeholder/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -14,7 +14,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license CKEDITOR.plugins.add( 'placeholder', { requires : [ 'dialog' ], - lang : [ 'en' ], + lang : [ 'en', 'he' ], init : function( editor ) { var lang = editor.lang.placeholder; @@ -58,8 +58,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.on( 'doubleclick', function( evt ) { - var element = evt.data.element; - if ( element.data( 'cke-placeholder' ) ) + if ( CKEDITOR.plugins.placeholder.getSelectedPlaceHoder( editor ) ) evt.data.dialog = 'editplaceholder'; }); @@ -156,5 +155,17 @@ CKEDITOR.plugins.placeholder = } else editor.insertElement( element ); + + return null; + }, + + getSelectedPlaceHoder : function( editor ) + { + var range = editor.getSelection().getRanges()[ 0 ]; + range.shrink( CKEDITOR.SHRINK_TEXT ); + var node = range.startContainer; + while( node && !( node.type == CKEDITOR.NODE_ELEMENT && node.data( 'cke-placeholder' ) ) ) + node = node.getParent(); + return node; } };