-
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 #1627 from ckeditor/t/1451
Fixed: Context menu is incorrectly positioned when opened with Shift-F10
- Loading branch information
Showing
5 changed files
with
225 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* bender-tags: editor, bug */ | ||
/* bender-ckeditor-plugins: clipboard,contextmenu */ | ||
|
||
( function() { | ||
'use strict'; | ||
|
||
bender.editors = { | ||
classic: { | ||
name: 'classic' | ||
}, | ||
inline: { | ||
name: 'inline', | ||
creator: 'inline' | ||
} | ||
}; | ||
|
||
var tests = { | ||
'test opening context menu with keystroke': function( editor ) { | ||
var range = new CKEDITOR.dom.range( editor.document ), | ||
selectionRect, | ||
frame = CKEDITOR.document.getWindow().getFrame(); | ||
|
||
// Context menu uses frame height to calculate if it fits inside and bender dashboard puts tests in frame with 70px height. | ||
if ( frame ) { | ||
frame.setStyle( 'height', '500px' ); | ||
} | ||
|
||
range.setStart( editor.editable().getFirst(), 0 ); | ||
range.select(); | ||
|
||
selectionRect = range.getClientRects().pop(); | ||
|
||
var stub = sinon.stub( editor.contextMenu, 'open' ); | ||
|
||
editor.execCommand( 'contextMenu' ); | ||
|
||
assert.areSame( 1, stub.callCount ); | ||
assert.areSame( editor.document.getBody().getParent(), stub.args[ 0 ][ 0 ] ); | ||
assert.isNull( stub.args[ 0 ][ 1 ] ); | ||
assert.areSame( selectionRect.left, stub.args[ 0 ][ 2 ] ); | ||
assert.areSame( selectionRect.bottom, stub.args[ 0 ][ 3 ] ); | ||
|
||
stub.restore(); | ||
} | ||
}; | ||
|
||
|
||
bender.test( bender.tools.createTestsForEditors( CKEDITOR.tools.objectKeys( bender.editors ), tests ) ); | ||
|
||
} )(); |
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,133 @@ | ||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> | ||
<H1> Left to right editors:</H1> | ||
<textarea id="classic-ltr"> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore mag</p> | ||
<p>na aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo cons</p> | ||
<table border="1"> | ||
<thead> | ||
<tr> | ||
<th>Head</th> | ||
<th>Head</th> | ||
<th>Head</th> | ||
<th>Head</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
</tr> | ||
<tr> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</textarea> | ||
|
||
<div> | ||
<div id="inline-ltr" contenteditable="true"> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore mag</p> | ||
<p>na aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo cons</p> | ||
<table border="1"> | ||
<thead> | ||
<tr> | ||
<th>Head</th> | ||
<th>Head</th> | ||
<th>Head</th> | ||
<th>Head</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
</tr> | ||
<tr> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<H1> Right to left editors:</H1> | ||
<textarea id="classic-rtl"> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore mag</p> | ||
<p>na aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo cons</p> | ||
<table border="1"> | ||
<thead> | ||
<tr> | ||
<th>Head</th> | ||
<th>Head</th> | ||
<th>Head</th> | ||
<th>Head</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
</tr> | ||
<tr> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</textarea> | ||
|
||
<div> | ||
<div id="inline-rtl" dir="rtl" contenteditable="true"> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore mag</p> | ||
<p>na aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo cons</p> | ||
<table border="1"> | ||
<thead> | ||
<tr> | ||
<th>Head</th> | ||
<th>Head</th> | ||
<th>Head</th> | ||
<th>Head</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
</tr> | ||
<tr> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
<td>Cell</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> | ||
<script> | ||
CKEDITOR.replace( 'classic-ltr', { | ||
} ); | ||
CKEDITOR.inline( 'inline-ltr' ); | ||
CKEDITOR.replace( 'classic-rtl', { | ||
language: 'he' | ||
} ); | ||
CKEDITOR.inline( 'inline-rtl', { | ||
language: 'he' | ||
} ); | ||
</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,21 @@ | ||
@bender-tags: bug, 4.10.2, 1451 | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea,toolbar,contextmenu,clipboard,table,tableselection,floatingspace | ||
|
||
## For each editor: | ||
1. Scroll page so editor as at the top. | ||
1. Select some editor context with mouse or keyboard. | ||
1. Press `Shift + F10` to open context menu from keyboard. | ||
|
||
### Expected | ||
|
||
#### Left to right editors: | ||
- The panel shows itself on the right side of selection. | ||
|
||
#### Right to left editors: | ||
- The panel shows itself on the left side of selection. | ||
|
||
|
||
### Note: | ||
|
||
IE8: There is known bug [#549](https://github.com/ckeditor/ckeditor-dev/issues/549) with wrong context menu position in inline editors. |