| 1 | /*! |
| 2 | * VisualEditor UserInterface WindowManager class. |
| 3 | * |
| 4 | * @copyright See AUTHORS.txt |
| 5 | */ |
| 6 | |
| 7 | /** |
| 8 | * Window manager. |
| 9 | * |
| 10 | * @class |
| 11 | * @extends OO.ui.WindowManager |
| 12 | * |
| 13 | * @constructor |
| 14 | * @param {Object} [config] Configuration options |
| 15 | * @param {ve.ui.Overlay} [config.overlay] Overlay to use for menus |
| 16 | */ |
| 17 | ve.ui.WindowManager = function VeUiWindowManager( config ) { |
| 18 | // Configuration initialization |
| 19 | config = config || {}; |
| 20 | |
| 21 | // Parent constructor |
| 22 | ve.ui.WindowManager.super.call( this, config ); |
| 23 | |
| 24 | // Properties |
| 25 | this.overlay = config.overlay || null; |
| 26 | |
| 27 | // The following classes are used here: |
| 28 | // * ve-ui-dir-block-ltr |
| 29 | // * ve-ui-dir-block-rtl |
| 30 | this.$element.addClass( 've-ui-dir-block-' + this.getDir() ); |
| 31 | }; |
| 32 | |
| 33 | /* Inheritance */ |
| 34 | |
| 35 | OO.inheritClass( ve.ui.WindowManager, OO.ui.WindowManager ); |
| 36 | |
| 37 | /* Methods */ |
| 38 | |
| 39 | /** |
| 40 | * Get directionality. |
| 41 | * |
| 42 | * @return {string} UI directionality |
| 43 | */ |
| 44 | ve.ui.WindowManager.prototype.getDir = function () { |
| 45 | return $( document.body ).css( 'direction' ); |
| 46 | }; |
| 47 | |
| 48 | /** |
| 49 | * Get overlay for menus. |
| 50 | * |
| 51 | * @return {ve.ui.Overlay|null} Menu overlay, null if none was configured |
| 52 | */ |
| 53 | ve.ui.WindowManager.prototype.getOverlay = function () { |
| 54 | return this.overlay; |
| 55 | }; |