Sha256: 577989b35c8f6a9770dc3c3aee163b523bca1c06d13a0ffd16623971f7404ed9

Contents?: true

Size: 1.88 KB

Versions: 4

Compression:

Stored size: 1.88 KB

Contents

/*
 * Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.html or http://ckeditor.com/license
 */

(function()
{
	function placeholderDialog( editor, isEdit )
	{

		var lang = editor.lang.placeholder,
			generalLabel = editor.lang.common.generalTab;
		return {
			title : lang.title,
			minWidth : 300,
			minHeight : 80,
			contents :
			[
				{
					id : 'info',
					label : generalLabel,
					title : generalLabel,
					elements :
					[
						{
							id : 'text',
							type : 'text',
							style : 'width: 100%;',
							label : lang.text,
							'default' : '',
							required : true,
							validate : CKEDITOR.dialog.validate.notEmpty( lang.textMissing ),
							setup : function( element )
							{
								if ( isEdit )
									this.setValue( element.getText().slice( 2, -2 ) );
							},
							commit : function( element )
							{
								var text = '[[' + this.getValue() + ']]';
								// The placeholder must be recreated.
								CKEDITOR.plugins.placeholder.createPlaceholder( editor, element, text );
							}
						}
					]
				}
			],
			onShow : function()
			{
				if ( isEdit )
				{
					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();
					this._element = node;
				}

				this.setupContent( this._element );
			},
			onOk : function()
			{
				this.commitContent( this._element );
				delete this._element;
			}
		};
	}

	CKEDITOR.dialog.add( 'createplaceholder', function( editor )
		{
			return placeholderDialog( editor );
		});
	CKEDITOR.dialog.add( 'editplaceholder', function( editor )
		{
			return placeholderDialog( editor, 1 );
		});
} )();

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
dust-ckeditor-3.5.0 lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/placeholder/dialogs/placeholder.js
hifi-ckeditor-3.5.2 lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/placeholder/dialogs/placeholder.js
hifi-ckeditor-3.5.1 lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/placeholder/dialogs/placeholder.js
ckeditor-3.5.0 lib/generators/ckeditor/base/templates/ckeditor/_source/plugins/placeholder/dialogs/placeholder.js