﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
10652	insertElement table into table range crashes page	Ben Duncan		"The browser/page crashes while inserting a table inside of another table if a selection spans outside of the table row.

'''To reproduce:'''
In a ckeditor instance with the table plugin, insert a table.  Then highlight multiple cells of the new table and click the toolbar button to insert a table again.  When you click ""ok"" in the internal table's dialog to insert it, the page crashes.

'''Browser and OS:''' This has been reported in a plethora of browsers in both Windows and OSX.  I personally confirmed it on Chrome (28.0.1500.72 m), Windows 7.

'''Test case:''' This can easily be reproduced in /samples/divreplace.html within the CKEditor samples.

'''Build Configuration:''' any build with the table plugin, including standard.

'''Possible Fix:'''
I've looked into some fixes for this.  Since an inserted table needs to go somewhere, and it can't span multiple table cells or rows anyway, I think it's appropriate to disable the table button in this situation.  For this I made the 'table' command context sensitive using the following code in \plugins\table\plugin.js (near line 17):

{{{
			lang = editor.lang.table;

		editor.addCommand( 'table', new CKEDITOR.dialogCommand( 'table', {
+			contextSensitive: 1,
+			refresh: function(editor, path) {
+				if ( editor.getSelection().getRanges()[0].getCommonAncestor().is( 'table', 'tbody', 'thead' ) )
+					this.setState( CKEDITOR.TRISTATE_DISABLED );
+				else
+					this.setState( CKEDITOR.TRISTATE_OFF );
+			},
			context: 'table',
			allowedContent: 'table{width,height}[align,border,cellpadding,cellspacing,summary];' +
				'caption tbody thead tfoot;' +
}}}"	Bug	closed	Normal		Core : Tables	4.0 Beta	duplicate		
