-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1104 from ckeditor/t/1027
Widget has now correct selection behaviour inside tables
- Loading branch information
Showing
12 changed files
with
316 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tests/plugins/tableselection/integrations/image2/manual/deselectwidget.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<label>Lena's path: <input style="border:2px solid black" type="text" value="%BASE_PATH%_assets/lena.jpg" readonly></label> | ||
<textarea id="editor"> | ||
<table border="1" cellpadding="1" cellspacing="1" style="width:500px"> | ||
<tbody> | ||
<tr> | ||
<td>Text</td> | ||
<td>Test</td> | ||
</tr> | ||
<tr> | ||
<td><img alt="Lena" src="%BASE_PATH%_assets/lena.jpg" style="height:150px; width:150px" /></td> | ||
<td> </td> | ||
</tr> | ||
<tr> | ||
<td> </td> | ||
<td> </td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<p> </p> | ||
|
||
</textarea> | ||
<script> | ||
CKEDITOR.replace( 'editor', { | ||
extraPlugins: 'image2', | ||
on: { | ||
pluginsLoaded: function() { | ||
if ( !CKEDITOR.plugins.tableselection.isSupportedEnvironment ) { | ||
bender.ignore(); | ||
} | ||
} | ||
} | ||
} ); | ||
</script> |
15 changes: 15 additions & 0 deletions
15
tests/plugins/tableselection/integrations/image2/manual/deselectwidget.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@bender-tags: 1027, 4.8.0, widget, bug | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: undo,clipboard,basicstyles,toolbar,wysiwygarea,widget,table,tableselection,resize,image2 | ||
|
||
1. Click on the image of Lena. | ||
1. Click into another cell and start to: _(Do not click outside of the table!)_ | ||
* type something | ||
* add new image (path to lena's image is above editor) | ||
|
||
**Expected:** | ||
* You can freely type and edit text. | ||
* You can add new images. | ||
* Image dosen't persist the selection. | ||
|
||
**Unexpected:** You can't do things listed in 'expected'. Selection remain on image all the time. |
29 changes: 29 additions & 0 deletions
29
tests/plugins/widget/integration/table/_helpers/testwidgets.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
CKEDITOR.plugins.add( 'inlineWidget', { | ||
requires: 'widget', | ||
init: function( editor ) { | ||
editor.widgets.add( 'test1', { | ||
button: 'Create Inline Widget', | ||
template: '<strong class="inline-widget" style="background-color:#C0392B;padding:5px;">Very strong text.</strong>', | ||
requiredContent: 'strong(inline-widget)', | ||
allowedContent: 'strong(!inline-widget){*}', | ||
upcast: function( element ) { | ||
return element.name === 'strong' && element.hasClass( 'inline-widget' ); | ||
} | ||
} ); | ||
} | ||
} ); | ||
|
||
CKEDITOR.plugins.add( 'blockWidget', { | ||
requires: 'widget', | ||
init: function( editor ) { | ||
editor.widgets.add( 'test2', { | ||
button: 'Create Block Widget', | ||
template: '<div class="block-widget" style="background-color:#F4D03F;padding:5px;">Some text in div.</div>', | ||
requiredContent: 'div(block-widget)', | ||
allowedContent: 'div(!block-widget){*}', | ||
upcast: function( element ) { | ||
return element.name === 'div' && element.hasClass( 'block-widget' ); | ||
} | ||
} ); | ||
} | ||
} ); |
77 changes: 77 additions & 0 deletions
77
tests/plugins/widget/integration/table/manual/widgetintable.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<textarea id="classic" > | ||
<table border="1" cellspacing="1" cellpadding="1" style="width:500px"> | ||
<tbody> | ||
<tr> | ||
<td><strong style="background-color:#C0392B; padding:5px" class="inline-widget">Very strong text.</strong></td> | ||
<td>Some text</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<table border="1" cellspacing="1" cellpadding="1" style="width:200px"> | ||
<tbody> | ||
<tr> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td><div style="background-color:#F4D03F;padding:5px;" class="block-widget">Some text in div.</div><p> </p></td> | ||
<td>Nested Table</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
<td>Some text</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p> </p> | ||
</textarea> | ||
|
||
<div id="divarea"> | ||
<table border="1" cellspacing="1" cellpadding="1" style="width:500px"> | ||
<tbody> | ||
<tr> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td><div style="background-color:#F4D03F;padding:5px;" class="block-widget">Some text in div.</div><p> </p></td> | ||
<td>Some text</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<table border="1" cellspacing="1" cellpadding="1" style="width:200px"> | ||
<tbody> | ||
<tr> | ||
<td><strong style="background-color:#C0392B; padding:5px" class="inline-widget">Very strong text.</strong></td> | ||
<td>Nested Table</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
<td>Some text</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p> </p> | ||
</div> | ||
|
||
<script> | ||
CKEDITOR.replace( 'classic', { | ||
extraPlugins: 'inlineWidget,blockWidget', | ||
removePlugins: 'tableselection', | ||
} ); | ||
|
||
CKEDITOR.replace( 'divarea', { | ||
removePlugins: 'tableselection', | ||
extraPlugins: 'divarea,inlineWidget,blockWidget' | ||
} ); | ||
</script> |
17 changes: 17 additions & 0 deletions
17
tests/plugins/widget/integration/table/manual/widgetintable.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@bender-tags: 1027, 4.8.0, widget, bug | ||
@bender-ui: collapsed | ||
@bender-include: ../_helpers/testwidgets.js | ||
@bender-ckeditor-plugins: undo,clipboard,basicstyles,toolbar,wysiwygarea,widget,table,resize | ||
|
||
---- | ||
|
||
1. Try to add new widget in table (buttons without icon in toolbar). | ||
1. Click on the widgets in table. | ||
1. Try to select some text **in table**. | ||
1. Perform some operation on selected text (change, append new text, apply some style, etc.). | ||
|
||
_Perform above steps for all widgets, inner and outer table, and both editors._ | ||
|
||
**Expected:** Widget is deselect when focus is changed to text in table and text selection is visible. You are able to perform operations on selected text. | ||
|
||
**Unexpected:** Widget preserve focus even tough some text in table is selected. You cannot modify selected text in such case. |
82 changes: 82 additions & 0 deletions
82
tests/plugins/widget/integration/table/manual/widgetintablewithtableselection.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<textarea id="classic" > | ||
<table border="1" cellspacing="1" cellpadding="1" style="width:500px"> | ||
<tbody> | ||
<tr> | ||
<td><strong style="background-color:#C0392B; padding:5px" class="inline-widget">Very strong text.</strong></td> | ||
<td>Some text</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<table border="1" cellspacing="1" cellpadding="1" style="width:200px"> | ||
<tbody> | ||
<tr> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td><div style="background-color:#F4D03F;padding:5px;" class="block-widget">Some text in div.</div><p> </p></td> | ||
<td>Nested Table</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
<td>Some text</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p> </p> | ||
</textarea> | ||
|
||
<div id="divarea"> | ||
<table border="1" cellspacing="1" cellpadding="1" style="width:500px"> | ||
<tbody> | ||
<tr> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
<tr> | ||
<td><div style="background-color:#F4D03F;padding:5px;" class="block-widget">Some text in div.</div><p> </p></td> | ||
<td>Some text</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<table border="1" cellspacing="1" cellpadding="1" style="width:200px"> | ||
<tbody> | ||
<tr> | ||
<td><strong style="background-color:#C0392B; padding:5px" class="inline-widget">Very strong text.</strong></td> | ||
<td>Nested Table</td> | ||
</tr> | ||
<tr> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
<td>Some text</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<p> </p> | ||
</div> | ||
|
||
<script> | ||
CKEDITOR.replace( 'classic', { | ||
extraPlugins: 'inlineWidget,blockWidget', | ||
on: { | ||
pluginsLoaded: function() { | ||
if ( !CKEDITOR.plugins.tableselection.isSupportedEnvironment ) { | ||
bender.ignore(); | ||
} | ||
} | ||
} | ||
} ); | ||
|
||
CKEDITOR.replace( 'divarea', { | ||
extraPlugins: 'divarea,inlineWidget,blockWidget' | ||
} ); | ||
</script> |
17 changes: 17 additions & 0 deletions
17
tests/plugins/widget/integration/table/manual/widgetintablewithtableselection.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@bender-tags: 1027, 4.8.0, widget, bug | ||
@bender-ui: collapsed | ||
@bender-include: ../_helpers/testwidgets.js | ||
@bender-ckeditor-plugins: undo,clipboard,basicstyles,toolbar,wysiwygarea,widget,table,resize,tableselection | ||
|
||
---- | ||
|
||
1. Try to add new widget in table (buttons without icon in toolbar). | ||
1. Click on the widgets in table. | ||
1. Try to select some text **in table**. | ||
1. Perform some operation on selected text (change, append new text, apply some style, etc.). | ||
|
||
_Perform above steps for all widgets, inner and outer table, and both editors._ | ||
|
||
**Expected:** Widget is deselect when focus is changed to text in table and text selection is visible. You are able to perform operations on selected text. | ||
|
||
**Unexpected:** Widget preserve focus even tough some text in table is selected. You cannot modify selected text in such case. |
Oops, something went wrong.