IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
33 | 33 | { |
34 | 34 | addTarget : function( element, nativeContextMenuOnCtrl ) |
35 | 35 | { |
| 36 | var doc = element instanceof CKEDITOR.dom.document ? element : |
| 37 | element.getDocument(); |
| 38 | |
36 | 39 | // Opera doesn't support 'contextmenu' event, we have duo approaches employed here: |
37 | 40 | // 1. Inherit the 'button override' hack we introduced in v2 (#4530), while this require the Opera browser |
38 | 41 | // option 'Allow script to detect context menu/right click events' to be always turned on. |
… |
… |
|
84 | 87 | } ); |
85 | 88 | } |
86 | 89 | |
| 90 | // Special handling for context menu opened on body margins. |
| 91 | if ( CKEDITOR.env.ie && element.equals( doc ) ) |
| 92 | { |
| 93 | function contextMenuBodyMargin( fn ) { |
| 94 | return function( evt ) { |
| 95 | evt = evt.data; |
| 96 | if ( evt.$.button == 2 && evt.getTarget().equals( htmlEl ) ) { |
| 97 | fn(); |
| 98 | } |
| 99 | }; |
| 100 | } |
| 101 | |
| 102 | var htmlEl = doc.getDocumentElement(); |
| 103 | |
| 104 | htmlEl.on( 'mouseup', contextMenuBodyMargin( function() |
| 105 | { |
| 106 | // We must clear any existing locked selection before-hand, |
| 107 | // e.g. an opened float panel. |
| 108 | doc.getSelection().unlock(); |
| 109 | } ), null, null, -1 ); |
| 110 | |
| 111 | htmlEl.on( 'mouseup', contextMenuBodyMargin( function() |
| 112 | { |
| 113 | // Lock the selection right before native event destroy the |
| 114 | // selection. |
| 115 | doc.getSelection().lock(); |
| 116 | } ), null, null, 9999 ); |
| 117 | } |
| 118 | |
87 | 119 | element.on( 'contextmenu', function( event ) |
88 | 120 | { |
89 | 121 | var domEvent = event.data; |
… |
… |
|
104 | 136 | |
105 | 137 | CKEDITOR.tools.setTimeout( function() |
106 | 138 | { |
| 139 | // Restore properly the locked selection, for IE. |
| 140 | var sel = doc.getSelection(); |
| 141 | sel.isLocked && sel.unlock( 1 ); |
| 142 | |
107 | 143 | this.open( offsetParent, null, offsetX, offsetY ); |
108 | 144 | |
109 | 145 | // IE needs a short while to allow selection change before opening menu. (#7908) |