X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fplaceholder%2Fplugin.js;h=1d5df8c51f537fe2bf6e9eb325c125b6fbd3bbdc;hb=6e682412d5cc0dfaedb376482e585bf2989c6863;hp=5ea9b24323ffd33dd5c5bf7440d4a52c61b62ae2;hpb=9afde8772159bd3436f1f5b7862960307710ae5a;p=ckeditor.git diff --git a/_source/plugins/placeholder/plugin.js b/_source/plugins/placeholder/plugin.js index 5ea9b24..1d5df8c 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-2012, 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 : [ 'bg', 'cs', 'cy', 'da', 'de', 'el', 'en', 'eo', 'et', 'fa', 'fi', 'fr', 'he', 'hr', 'it', 'nb', 'nl', 'no', 'pl', 'pt-br', 'tr', 'ug', 'uk', 'vi', 'zh-cn' ], 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; } };