Index: trunk/extensions/VisualEditor/modules/es/es.Surface.css |
— | — | @@ -85,6 +85,22 @@ |
86 | 86 | padding: 0.33em 0; |
87 | 87 | } |
88 | 88 | |
| 89 | +.es-contextView-position-above .es-contextView-menu { |
| 90 | + bottom: 7px; |
| 91 | +} |
| 92 | + |
| 93 | +.es-contextView-position-below .es-contextView-menu { |
| 94 | + top: 8px; |
| 95 | +} |
| 96 | + |
| 97 | +.es-contextView-position-left .es-contextView-menu { |
| 98 | + left: 0; |
| 99 | +} |
| 100 | + |
| 101 | +.es-contextView-position-right .es-contextView-menu { |
| 102 | + right: 0; |
| 103 | +} |
| 104 | + |
89 | 105 | .es-contextView-menuItem { |
90 | 106 | padding: 0.33em 1em; |
91 | 107 | cursor: pointer; |
— | — | @@ -137,14 +153,6 @@ |
138 | 154 | background-color: #b3d6f6; |
139 | 155 | } |
140 | 156 | |
141 | | -.es-contextView-position-above .es-contextView-menu { |
142 | | - bottom: 7px; |
143 | | -} |
144 | | - |
145 | | -.es-contextView-position-below .es-contextView-menu { |
146 | | - top: 8px; |
147 | | -} |
148 | | - |
149 | 157 | .es-contentView { |
150 | 158 | position: relative; |
151 | 159 | z-index: 1; |
Index: trunk/extensions/VisualEditor/modules/es/views/es.ContextView.js |
— | — | @@ -37,7 +37,10 @@ |
38 | 38 | /* Methods */ |
39 | 39 | |
40 | 40 | es.ContextView.prototype.set = function() { |
41 | | - this.$.removeClass( 'es-contextView-position-below es-contextView-position-above' ); |
| 41 | + this.$.removeClass( |
| 42 | + 'es-contextView-position-below es-contextView-position-above ' + |
| 43 | + 'es-contextView-position-left es-contextView-position-right' |
| 44 | + ); |
42 | 45 | var selection = this.surfaceView.getModel().getSelection(), |
43 | 46 | position, |
44 | 47 | offset, |
— | — | @@ -60,6 +63,11 @@ |
61 | 64 | } |
62 | 65 | } |
63 | 66 | if ( position ) { |
| 67 | + if ( position.left + this.$menu.width() < $( 'body' ).width() ) { |
| 68 | + this.$.addClass( 'es-contextView-position-left' ); |
| 69 | + } else { |
| 70 | + this.$.addClass( 'es-contextView-position-right' ); |
| 71 | + } |
64 | 72 | this.$.css( { 'left': position.left, 'top': position.top } ); |
65 | 73 | this.$icon.fadeIn( 'fast' ); |
66 | 74 | } |
Index: trunk/extensions/VisualEditor/modules/es/views/es.ContentView.js |
— | — | @@ -246,12 +246,14 @@ |
247 | 247 | 'width': contentWidth - fromPosition.left, |
248 | 248 | 'height': fromPosition.bottom - fromPosition.top |
249 | 249 | } ).show(); |
250 | | - this.$rangeEnd.css( { |
251 | | - 'top': toPosition.top, |
252 | | - 'left': 0, |
253 | | - 'width': toPosition.left, |
254 | | - 'height': toPosition.bottom - toPosition.top |
255 | | - } ).show(); |
| 250 | + if ( toPosition.left ) { |
| 251 | + this.$rangeEnd.css( { |
| 252 | + 'top': toPosition.top, |
| 253 | + 'left': 0, |
| 254 | + 'width': toPosition.left, |
| 255 | + 'height': toPosition.bottom - toPosition.top |
| 256 | + } ).show(); |
| 257 | + } |
256 | 258 | if ( fromLineIndex + 1 < toLineIndex ) { |
257 | 259 | this.$rangeFill.css( { |
258 | 260 | 'top': fromPosition.bottom, |