-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixed: [tableselection] table contents can be removed in a readonly mode #1527
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0ae4edb
Fixed readonly mode.
jacekbogdanski f74ff2f
Added tests.
jacekbogdanski 21af9f0
Changelog entry.
jacekbogdanski 4b38933
Test fix.
jacekbogdanski c8449c3
Refactoring.
jacekbogdanski 540ba3c
Added references to the issue and updated changelog.
jacekbogdanski 03cde58
Rebase fixes.
jacekbogdanski c33cb35
Refactoring.
jacekbogdanski 0397248
Style fix.
jacekbogdanski b69d0f1
Moved changelog entry.
jacekbogdanski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<div id="editor1"> | ||
<table border="1"> | ||
<tr> | ||
<td>Cell 1.1.1</td> | ||
<td>Cell 1.1.2</td> | ||
<td>Cell 1.1.3</td> | ||
<td>Cell 1.1.4</td> | ||
</tr> | ||
<tr> | ||
<td>Cell 1.2.1</td> | ||
<td>Cell 1.2.2</td> | ||
<td>Cell 1.2.3</td> | ||
<td>Cell 1.2.4</td> | ||
</tr> | ||
<tr> | ||
<td>Cell 1.3.1</td> | ||
<td>Cell 1.3.2</td> | ||
<td>Cell 1.3.3</td> | ||
<td>Cell 1.3.4</td> | ||
</tr> | ||
</table> | ||
</div> | ||
|
||
<script> | ||
if ( bender.tools.env.mobile || CKEDITOR.env.ie && CKEDITOR.env.version < 11 ) { | ||
bender.ignore(); | ||
} | ||
|
||
CKEDITOR.replace( 'editor1', { | ||
readOnly : true | ||
} ); | ||
</script> |
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-ui: collapsed | ||
@bender-tags: 1489, 4.10.2, bug | ||
@bender-ckeditor-plugins: wysiwygarea, toolbar, tableselection | ||
|
||
1. Focus the editor. | ||
1. Select the first row in a table. | ||
1. Press `backspace` key. | ||
1. Repeat 1-3 with `delete` key. | ||
1. Repeat 1-3 with `a`, `k` keys (random key validation). | ||
|
||
## Expected | ||
|
||
Selected row didn't change. | ||
|
||
## Unexpected | ||
|
||
Selected row has been deleted. |
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 |
---|---|---|
|
@@ -172,6 +172,30 @@ | |
|
||
assert.areSame( ranges, editor.getSelection().getRanges(), 'Selected ranges should be unchanged' ); | ||
} ); | ||
}, | ||
|
||
// (#1489) | ||
'test random keys are not removing readonly selection': function( editor ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test is failing in IE11. |
||
var selection = editor.getSelection(), | ||
editable = editor.editable(), | ||
table = CKEDITOR.document.getById( 'simpleTable' ).getHtml(); | ||
|
||
editor.setReadOnly( true ); | ||
|
||
bender.tools.setHtmlWithSelection( editor, table ); | ||
|
||
var row = editor.editable().findOne( 'tr' ); | ||
selection.selectElement( row ); | ||
|
||
editable.fire( 'keydown', new CKEDITOR.dom.event( { keyCode: 8 } ) ); // backspace | ||
editable.fire( 'keydown', new CKEDITOR.dom.event( { keyCode: 46 } ) ); // delete | ||
|
||
editable.fire( 'keypress', new CKEDITOR.dom.event( { keyCode: 65, charCode: 65 } ) ); // `a` | ||
editable.fire( 'keypress', new CKEDITOR.dom.event( { keyCode: 93, charCode: 93 } ) ); // `t` | ||
|
||
editor.setReadOnly( false ); | ||
|
||
assert.areSame( bender.tools.compatHtml( table ), editor.getData(), 'Editor data' ); | ||
} | ||
}; | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please adjust comment and add reference to the issue.