Index: plugins/dcCKEditor/_post_config.php
===================================================================
--- plugins/dcCKEditor/_post_config.php	(revision 3362)
+++ plugins/dcCKEditor/_post_config.php	(revision 3367)
@@ -12,5 +12,7 @@
 
 if (!defined('DC_CONTEXT_ADMIN')) { return; }
+
 header('Content-type: text/javascript');
+
 if (!empty($_GET['context'])) {
 	$context = $_GET['context'];
@@ -18,8 +20,11 @@
 	$context = '';
 }
+
 $__extraPlugins = new ArrayObject();
 $core->callBehavior('ckeditorExtraPlugins',$__extraPlugins,$context);
 $extraPlugins = $__extraPlugins->getArrayCopy();
-?>
+
+?>
+
 (function($) {
 	$.toolbarPopup = function toolbarPopup(url) {
@@ -59,5 +64,5 @@
 		return $.active_editor;
 	}
-	chainHandler(window, 'onbeforeunload', function(e) {
+	chainHandler(window,'onbeforeunload',function(e) {
 		if (e == undefined && window.event) {
 			e = window.event;
@@ -65,5 +70,5 @@
 
 		var editor = CKEDITOR.instances[$.getEditorName()];
-		if (editor!==undefined && !confirmClosePage.formSubmit && editor.checkDirty()) {
+		if (editor !== undefined && !confirmClosePage.formSubmit && editor.checkDirty()) {
 			e.returnValue = confirmClosePage.prompt;
 			return confirmClosePage.prompt;
@@ -79,16 +84,18 @@
 
 	CKEDITOR.timestamp = '';
-<?php if (!isset($dcckeditor_disable_native_spellchecker) || $dcckeditor_disable_native_spellchecker):?>
+
+<?php if (!isset($dcckeditor_disable_native_spellchecker) || $dcckeditor_disable_native_spellchecker): ?>
 	CKEDITOR.config.disableNativeSpellChecker = true;
-<?php else:?>
+<?php else: ?>
 	CKEDITOR.config.disableNativeSpellChecker = false;
-<?php endif;?>
+<?php endif; ?>
+
 	CKEDITOR.config.skin = 'dotclear,'+dotclear.dcckeditor_plugin_url+'/js/ckeditor-skins/dotclear/';
 	CKEDITOR.config.baseHref = dotclear.base_url;
-	CKEDITOR.config.height = '<?php echo $core->auth->getOption('edit_size') * 14;?>px';
-
-<?php if (!empty($dcckeditor_cancollapse_button)):?>
+	CKEDITOR.config.height = '<?php echo $core->auth->getOption('edit_size') * 14; ?>px';
+
+<?php if (!empty($dcckeditor_cancollapse_button)): ?>
 	CKEDITOR.config.toolbarCanCollapse = true;
-<?php endif;?>
+<?php endif; ?>
 
 	CKEDITOR.plugins.addExternal('entrylink',dotclear.dcckeditor_plugin_url+'/js/ckeditor-plugins/entrylink/');
@@ -96,43 +103,48 @@
 	CKEDITOR.plugins.addExternal('media',dotclear.dcckeditor_plugin_url+'/js/ckeditor-plugins/media/');
 	CKEDITOR.plugins.addExternal('img',dotclear.dcckeditor_plugin_url+'/js/ckeditor-plugins/img/');
-	<?php if (!empty($dcckeditor_textcolor_button) || !empty($dcckeditor_background_textcolor_button)):?>
+
+<?php if (!empty($dcckeditor_textcolor_button) || !empty($dcckeditor_background_textcolor_button)): ?>
 	// button add "More Colors..." can be added if colordialog plugin is enabled
 	CKEDITOR.config.colorButton_enableMore = true;
-	<?php endif;?>
-
-<?php if (!empty($extraPlugins) && count($extraPlugins)>0) {
-	foreach ($extraPlugins as $plugin) {
-		printf("\tCKEDITOR.plugins.addExternal('%s','%s');\n", $plugin['name'], $plugin['url']);
-	}
-}
-?>
-	if (dotclear.ckeditor_context===undefined || dotclear.ckeditor_tags_context[dotclear.ckeditor_context]===undefined) {
+<?php endif; ?>
+
+<?php
+	if (!empty($extraPlugins) && count($extraPlugins) > 0) {
+		foreach ($extraPlugins as $plugin) {
+			printf("\tCKEDITOR.plugins.addExternal('%s','%s');\n",$plugin['name'],$plugin['url']);
+		}
+	}
+?>
+	if (dotclear.ckeditor_context === undefined || dotclear.ckeditor_tags_context[dotclear.ckeditor_context] === undefined) {
 		return;
 	}
 	$(dotclear.ckeditor_tags_context[dotclear.ckeditor_context].join(',')).ckeditor({
+
 <?php
-$defautExtraPlugins = 'entrylink,dclink,media,justify,colorbutton,format,img';
-if (!empty($extraPlugins) && count($extraPlugins)>0) {
-	foreach ($extraPlugins as $plugin) {
-		$defautExtraPlugins .= ','. $plugin['name'];
-	}
-}
-?>
-		extraPlugins: '<?php echo $defautExtraPlugins;?>',
+	$defautExtraPlugins = 'entrylink,dclink,media,justify,colorbutton,format,img';
+	if (!empty($extraPlugins) && count($extraPlugins)>0) {
+		foreach ($extraPlugins as $plugin) {
+			$defautExtraPlugins .= ','. $plugin['name'];
+		}
+	}
+?>
+		extraPlugins: '<?php echo $defautExtraPlugins; ?>',
 
 		keystrokes: [
 			[ CKEDITOR.CTRL + (CKEDITOR.env.mac ? CKEDITOR.ALT : CKEDITOR.SHIFT) +
-				dotclear.msg.link_accesskey.toUpperCase().charCodeAt(0), 'dcLinkCommand' ],    // Ctrl+Alt+l
+				dotclear.msg.link_accesskey.toUpperCase().charCodeAt(0),'dcLinkCommand' ],    // Ctrl+Alt+l
 			[ CKEDITOR.CTRL + (CKEDITOR.env.mac ? CKEDITOR.ALT : CKEDITOR.SHIFT) +
-				dotclear.msg.img_select_accesskey.toUpperCase().charCodeAt(0), 'mediaCommand' ],    // Ctrl+Alt+m
+				dotclear.msg.img_select_accesskey.toUpperCase().charCodeAt(0),'mediaCommand' ],    // Ctrl+Alt+m
 		],
 
-		<?php if (!empty($dcckeditor_format_select)):?>
+<?php if (!empty($dcckeditor_format_select)): ?>
 		// format tags
-<?php if (!empty($dcckeditor_format_tags)):?>
-		format_tags: '<?php echo $dcckeditor_format_tags;?>',
-<?php else:?>
+
+	<?php if (!empty($dcckeditor_format_tags)): ?>
+		format_tags: '<?php echo $dcckeditor_format_tags; ?>',
+	<?php else: ?>
 		format_tags: 'p;h1;h2;h3;h4;h5;h6;pre;address',
-<?php endif;?>
+	<?php endif; ?>
+
 		// following definition are needed to be specialized
 		format_p: { element: 'p' },
@@ -145,5 +157,5 @@
 		format_pre: { element: 'pre' },
 		format_address: { element: 'address' },
-		<?php endif;?>
+<?php endif; ?>
 
 		entities: false,
@@ -154,33 +166,40 @@
 				name: 'basicstyles',
 				items: [
-<?php if (!empty($dcckeditor_format_select)):?>
+
+<?php if (!empty($dcckeditor_format_select)): ?>
 					'Format',
 <?php endif;?>
+
 					'Bold','Italic','Underline','Strike','Subscript','Superscript','Code','Blockquote',
 
-<?php if (!empty($dcckeditor_list_buttons)):?>
-					'NumberedList', 'BulletedList',
-<?php endif;?>
+<?php if (!empty($dcckeditor_list_buttons)): ?>
+					'NumberedList','BulletedList',
+<?php endif; ?>
+
 					'RemoveFormat'
 				]
 			},
-<?php if (!empty($dcckeditor_clipboard_buttons)):?>
+
+<?php if (!empty($dcckeditor_clipboard_buttons)): ?>
 			{
 				name: 'clipoard',
 				items: ['Cut','Copy','Paste','PasteText','PasteFromWord']
 			},
-<?php endif;?>
-<?php if (!empty($dcckeditor_alignment_buttons)):?>
+<?php endif; ?>
+
+<?php if (!empty($dcckeditor_alignment_buttons)): ?>
 			{
 				name: 'paragraph',
-				items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']
-			},
-<?php endif;?>
-<?php if (!empty($dcckeditor_table_button)):?>
+				items: ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']
+			},
+<?php endif; ?>
+
+<?php if (!empty($dcckeditor_table_button)): ?>
 			{
 				name: 'table',
 				items: ['Table']
 			},
-<?php endif;?>
+<?php endif; ?>
+
 			{
 				name: 'custom',
@@ -188,10 +207,12 @@
 					'EntryLink','dcLink','Media','img','-',
 					'Source'
-<?php if (!empty($dcckeditor_textcolor_button)):?>
+
+<?php if (!empty($dcckeditor_textcolor_button)): ?>
 					,'TextColor'
-<?php endif;?>
-<?php if (!empty($dcckeditor_background_textcolor_button)):?>
+<?php endif; ?>
+
+<?php if (!empty($dcckeditor_background_textcolor_button)): ?>
 					,'BGColor'
-<?php endif;?>
+<?php endif; ?>
 				]
 			},
@@ -202,19 +223,37 @@
 				]
 			},
-			<?php // add extra buttons comming from dotclear plugins
-			if (!empty($extraPlugins) && count($extraPlugins)>0) {
-				$extraPlugins_str = "{name: 'extra', items: [%s]},\n";
-				$extra_icons = '';
-				foreach ($extraPlugins as $plugin) {
-					$extra_icons .= sprintf("'%s',", $plugin['button']);
-				}
-				printf($extraPlugins_str, $extra_icons);
+
+<?php // add extra buttons comming from dotclear plugins
+	if (!empty($extraPlugins) && count($extraPlugins)>0) {
+		$extraPlugins_str = "{name: 'extra', items: [%s]},\n";
+		$extra_icons = '';
+		foreach ($extraPlugins as $plugin) {
+			$extra_icons .= sprintf("'%s',",$plugin['button']);
+		}
+		printf($extraPlugins_str,$extra_icons);
+	}
+?>
+		]
+	});
+
+	CKEDITOR.on('instanceLoaded',function(e) {
+
+		// Retrieve textarea element of the instance, then its line-height (in px) and rows values,
+		// then apply line-height * rows (min = 6) to the inner height of the instance.
+
+		var ta = document.getElementById(e.editor.name);
+		if (ta !== undefined) {
+			var ta_rows = ta.rows;
+			var ta_line_height = parseFloat(window.getComputedStyle(ta,null).getPropertyValue('line-height'));
+			if (ta_rows > 0 && ta_line_height > 0) {
+				var ta_height = String(Math.max(ta_rows,6) * ta_line_height);
+				e.editor.resize('100%',ta_height,true);
 			}
-			?>
-		]
-	});
-
-	CKEDITOR.on('instanceReady', function(e) {
-		if ($('label[for="post_excerpt"] a img').attr('src')==dotclear.img_minus_src) {
+		}
+	});
+
+	CKEDITOR.on('instanceReady',function(e) {
+
+		if ($('label[for="post_excerpt"] a img').attr('src') == dotclear.img_minus_src) {
 			$('#cke_post_excerpt').removeClass('hide');
 		} else {
@@ -229,5 +268,5 @@
 	// @TODO: find a better way to retrieve active editor
 	for (var id in CKEDITOR.instances) {
-		CKEDITOR.instances[id].on('focus', function(e) {
+		CKEDITOR.instances[id].on('focus',function(e) {
 			$.active_editor = e.editor.name;
 		});
