Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tableresize throws an error when hovering over table with only header rows #417

Closed
f1ames opened this issue May 31, 2017 · 2 comments
Closed
Assignees
Labels
status:confirmed An issue confirmed by the development team. type:bug A bug.
Milestone

Comments

@f1ames
Copy link
Contributor

f1ames commented May 31, 2017

What type of issue would you like to report?

Bug

Check if the issue is already reported

https://dev.ckeditor.com/ticket/17066

Provide detailed reproduction steps (if any)

  1. Set editor config to:
config.plugins =
	'table,' +
	'tableresize,' +
	'tableselection,' +
	'toolbar,' +
	'wysiwygarea';
  1. Set editor content to:
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<thead>
	<tr>
		<th scope="col">1</th>
		<th scope="col">2</th>
	</tr>
	</thead>
	<tbody>
	<tr>
		<td>3</td>
		<td>4</td>
	</tr>
	</tbody>
</table>

<p>Foobar</p>
  1. Switch to WYSIWYG mode.
  2. Select part of the table (including header) and copy.
  3. Paste somewhere else.
  4. Hover over pasted table.

Expected result

It is possible to resize a table (especially column by dragging inner border). No exception is thrown.

Actual result

Exception is thrown. It is not possible to resize the table.

Other details

  • Browser: Chrome, FF, IE
  • OS: OS X
  • CKEditor version: 4.7.0
  • Installed CKEditor plugins: See step 1 in repro steps
@f1ames f1ames self-assigned this May 31, 2017
@f1ames f1ames added status:confirmed An issue confirmed by the development team. type:bug A bug. labels May 31, 2017
@f1ames f1ames added this to the 4.7.1 milestone May 31, 2017
@f1ames
Copy link
Contributor Author

f1ames commented May 31, 2017

It seems the cause of the issue is somewhere else. Copying selection like

[<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<thead>
		<tr>
			<th scope="col">1</th>
			<th scope="col">2</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>3</td>
			<td>4</td>
		</tr>
	</tbody>
</table>]

<p>Foobar</p>

produces new table with html like:

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<thead>
		<tr>
			<th scope="col">1</th>
			<th scope="col">2</th>
		</tr>
		<tr>
			<td>3</td>
			<td>4</td>
		</tr>
	</thead>
</table>

It works like this only with tableselection plugin enabled.

@f1ames
Copy link
Contributor Author

f1ames commented May 31, 2017

There is related issue #422. However, it is possible to reproduce the issue without tableselection plugin.

Reproduction steps

  1. Set editor config to:
config.plugins =
	'table,' +
	'tableresize,' +
	'toolbar,' +
	'wysiwygarea';
  1. Set editor content to (use setData):
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<thead>
		<tr>
			<th scope="col">1</th>
			<th scope="col">2</th>
		</tr>
	</thead>
</table>

<p>Foobar</p>
  1. Hover over table.

Notice: When table with one row which is header is inserted via table plugin dialog, the empty tbody element is inserted. When such table is inserted via setData, as initial content or pasted - the empty tbody is not present.
Tableresize plugin assumes there is always tbody element which is not a valid assumption.

@f1ames f1ames changed the title Tableresize throws an error when hovering over copied table with Tableselection. Tableresize throws an error when hovering over table with only header rows. May 31, 2017
@mlewand mlewand changed the title Tableresize throws an error when hovering over table with only header rows. Tableresize throws an error when hovering over table with only header rows May 31, 2017
Comandeer added a commit that referenced this issue Jun 8, 2017
Tableresize plugin should check if table body exists.

Fixes #417.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:confirmed An issue confirmed by the development team. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

1 participant