Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 1 | /** |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 2 | * Hint menu for Kalamar. |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 3 | * Based on menu object. |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 4 | * |
| 5 | * @author Nils Diewald |
| 6 | */ |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 7 | /* |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 8 | * TODO: Check for cnx/syn= |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 9 | * TODO: List can be shown when prefix is like 'base/s=pcorenlp/' |
| 10 | * TODO: Sometimes the drop-down box down vanish when list is shown |
| 11 | * TODO: Create should expect an input text field |
| 12 | * TODO: Embed only one single menu (not multiple) |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 13 | * By holding the current menu in _active |
| 14 | * TODO: show() should accept a context field (especially for no-context fields, |
| 15 | * like fragments) |
| 16 | * TODO: Improve context analyzer from hint! |
| 17 | * TODO: Marked annotations should be addable to "fragments" |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 18 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 19 | define([ |
| 20 | 'hint/input', |
| 21 | 'hint/menu', |
| 22 | 'hint/contextanalyzer', |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 23 | 'hint/alert', |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 24 | 'util' |
| 25 | ], function (inputClass, |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 26 | menuClass, |
| 27 | analyzerClass, |
| 28 | alertClass) { |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 29 | "use strict"; |
| 30 | |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 31 | /** |
| 32 | * @define {regex} Regular expression for context |
| 33 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 34 | KorAP.context = KorAP.context || |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 35 | "(?:^|[^-_a-zA-Z0-9])" + // Anchor |
| 36 | "((?:[-_a-zA-Z0-9]+?)\/" + // Foundry |
| 37 | "(?:" + |
| 38 | "(?:[-_a-zA-Z0-9]+?)=" + // Layer |
Akron | 113cc1a | 2016-01-22 21:17:57 +0100 | [diff] [blame] | 39 | "(?:"+ |
| 40 | "(?:[^:=\/ ]+?):|" + // Key |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 41 | "(?:[^-=\/ ]+?)-" + // Node |
Akron | 113cc1a | 2016-01-22 21:17:57 +0100 | [diff] [blame] | 42 | ")?" + |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 43 | ")?" + |
| 44 | ")$"; |
Akron | e91da78 | 2017-12-15 17:17:50 +0100 | [diff] [blame] | 45 | KorAP.annotationHelper = KorAP.annotationHelper || { "-" : [] }; |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 46 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 47 | /** |
| 48 | * Return keycode based on event |
| 49 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 50 | |
| 51 | // Initialize hint array |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * KorAP.Hint.create({ |
| 55 | * inputField : node, |
| 56 | * context : context regex |
| 57 | * }); |
| 58 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 59 | return { |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 60 | |
| 61 | // Some variables |
| 62 | // _firstTry : true, |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 63 | // active : false, |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 64 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 65 | /** |
| 66 | * Create new hint helper. |
| 67 | */ |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 68 | create : function (param) { |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 69 | return Object.create(this)._init(param); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 70 | }, |
| 71 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 72 | // Initialize hint helper |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 73 | _init : function (param) { |
| 74 | param = param || {}; |
| 75 | |
| 76 | // Holds all menus per prefix context |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 77 | this._menu = {}; |
| 78 | this._alert = alertClass.create(); |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 79 | this._active = null; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 80 | |
| 81 | // Get input field |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 82 | var qfield = param["inputField"] || document.getElementById("q-field"); |
| 83 | if (!qfield) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 84 | return null; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 85 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 86 | // Create input field |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 87 | this._inputField = inputClass.create(qfield); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 88 | |
| 89 | var inputFieldElement = this._inputField.element(); |
| 90 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 91 | var c = this._inputField.container(); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 92 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 93 | // create alert |
| 94 | c.appendChild(this._alert.element()); |
| 95 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 96 | var that = this; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 97 | |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 98 | this._inputField.container().addEventListener('click', function (e) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 99 | if (!this.classList.contains('active')) { |
| 100 | that.show(false); |
| 101 | }; |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 102 | }); |
| 103 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 104 | var _down = function (e) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 105 | var code = _codeFromEvent(e); |
| 106 | if (code === 40) { |
| 107 | this.show(false); |
| 108 | e.halt(); |
| 109 | }; |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 110 | }; |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 111 | |
Nils Diewald | 47f366b | 2015-04-15 20:06:35 +0000 | [diff] [blame] | 112 | // Move infobox |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 113 | inputFieldElement.addEventListener("keyup", this.update.bind(this)); |
| 114 | inputFieldElement.addEventListener("click", this.update.bind(this)); |
| 115 | |
| 116 | // Add event listener for key pressed down |
| 117 | inputFieldElement.addEventListener( |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 118 | "keydown", _down.bind(this), false |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 119 | ); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 120 | |
| 121 | // Set Analyzer for context |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 122 | this._analyzer = analyzerClass.create( |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 123 | param["context"] || KorAP.context |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 124 | ); |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 125 | return this; |
| 126 | }, |
| 127 | |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 128 | |
| 129 | /** |
| 130 | * Return the input field attached to the hint helper. |
| 131 | */ |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 132 | inputField : function () { |
| 133 | return this._inputField; |
| 134 | }, |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 135 | |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 136 | |
| 137 | /** |
| 138 | * Altert at a specific character position. |
| 139 | */ |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 140 | alert : function (charPos, msg) { |
| 141 | |
| 142 | if (arguments.length === 0) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 143 | return this._alert; |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 144 | |
| 145 | // Do not alert if already alerted! |
| 146 | if (this._alert.active) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 147 | return false; |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 148 | |
| 149 | // Move to the correct position |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 150 | this._inputField.moveto(charPos); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 151 | |
| 152 | // Set container to active (aka hide the hint helper button) |
| 153 | |
| 154 | this._alert.show(msg); |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 155 | this.active(this._alert); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 156 | return true; |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 157 | }, |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 158 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 159 | _unshowAlert : function () { |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 160 | this._alert.hide(); |
| 161 | this.active(null); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 162 | }, |
| 163 | |
| 164 | update : function () { |
| 165 | this._inputField.update(); |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 166 | if (this._alert.hide()) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 167 | this.active(null); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 168 | }, |
| 169 | |
| 170 | |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 171 | /** |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 172 | * Return hint menu and probably init based on an action |
| 173 | */ |
| 174 | menu : function (action) { |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 175 | if (this._menu[action] === undefined) { |
| 176 | |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 177 | // No matching hint menu |
Akron | e91da78 | 2017-12-15 17:17:50 +0100 | [diff] [blame] | 178 | if (KorAP.annotationHelper[action] === undefined) |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 179 | return; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 180 | |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 181 | // Create matching hint menu |
| 182 | this._menu[action] = menuClass.create( |
Akron | e91da78 | 2017-12-15 17:17:50 +0100 | [diff] [blame] | 183 | this, action, KorAP.annotationHelper[action] |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 184 | ); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 185 | }; |
| 186 | |
| 187 | // Return matching hint menu |
| 188 | return this._menu[action]; |
| 189 | }, |
| 190 | |
| 191 | /** |
| 192 | * Get the correct menu based on the context |
| 193 | */ |
| 194 | contextMenu : function (ifContext) { |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 195 | |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 196 | // Get context (aka left text) |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 197 | var context = this._inputField.context(); |
Akron | ee9ef4a | 2016-06-03 12:50:08 +0200 | [diff] [blame] | 198 | |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 199 | if (context === undefined || context.length === 0) { |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 200 | return ifContext ? undefined : this.menu("-"); |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 201 | }; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 202 | |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 203 | // Get context (aka left text matching regex) |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 204 | context = this._analyzer.test(context); |
Akron | ee9ef4a | 2016-06-03 12:50:08 +0200 | [diff] [blame] | 205 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 206 | if (context === undefined || context.length == 0) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 207 | return ifContext ? undefined : this.menu("-"); |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 208 | }; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 209 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 210 | return this.menu(context) || (ifContext ? undefined : this.menu('-')); |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 211 | }, |
| 212 | |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 213 | /** |
| 214 | * Activate a certain menu. |
| 215 | * If a menu is passed, the menu will be activated. |
| 216 | * If null is passed, the active menu will be deactivated. |
| 217 | * If nothing is passed, returns the active menu. |
| 218 | */ |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 219 | active : function (obj) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 220 | |
| 221 | // A menu or null was passed |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 222 | if (arguments.length === 1) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 223 | var c = this._inputField.container(); |
| 224 | |
| 225 | // Make the menu active |
| 226 | if (obj !== null) { |
| 227 | c.classList.add('active'); |
| 228 | this._active = obj; |
| 229 | } |
| 230 | |
| 231 | // Make the menu inactive |
| 232 | else { |
| 233 | c.classList.remove('active'); |
| 234 | this._active = null; |
| 235 | } |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 236 | }; |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 237 | |
| 238 | // Return |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 239 | return this._active; |
| 240 | }, |
| 241 | |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 242 | |
| 243 | /** |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 244 | * Show the menu. |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 245 | * Remove all old menus. |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 246 | * |
| 247 | * @param {boolean} Boolean value to indicate if context |
| 248 | * is necessary (true) or if the main context should |
| 249 | * be shown if context fails. |
| 250 | * |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 251 | */ |
| 252 | show : function (ifContext) { |
| 253 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 254 | // Remove the active object |
| 255 | this._unshow(); |
| 256 | |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 257 | // Get the menu |
| 258 | var menu; |
| 259 | if (menu = this.contextMenu(ifContext)) { |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 260 | this.active(menu); |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 261 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 262 | var c = this._inputField.container(); |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 263 | c.appendChild(menu.element()); |
| 264 | menu.show(); |
| 265 | menu.focus(); |
| 266 | // Focus on input field |
| 267 | // this.inputField.element.focus(); |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 268 | } |
| 269 | else { |
| 270 | this._inputField.element().focus(); |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 271 | }; |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 272 | }, |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 273 | |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 274 | // This will get the context of the field |
| 275 | getContext : function () {}, |
| 276 | |
Akron | 8eaeb2e | 2016-08-29 18:26:28 +0200 | [diff] [blame] | 277 | /** |
| 278 | * Deactivate the current menu and focus on the input field. |
| 279 | */ |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 280 | unshow_old : function () { |
Akron | 02360e4 | 2016-06-07 13:41:12 +0200 | [diff] [blame] | 281 | this.active(null); |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 282 | this.inputField().element().focus(); |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 283 | }, |
| 284 | |
| 285 | /** |
| 286 | * Deactivate the current menu and focus on the input field. |
| 287 | */ |
| 288 | unshow : function () { |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 289 | this._unshow(); |
| 290 | this._inputField.element().focus(); |
| 291 | }, |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 292 | |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 293 | |
| 294 | _unshow : function () { |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 295 | if (this.active() !== null) { |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 296 | // var act = this.active(); |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 297 | |
| 298 | // This does not work for alert currently! |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 299 | //if (act._type !== 'alert') { |
| 300 | if (!this._alert.active) { |
| 301 | var c = this._inputField.container(); |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 302 | c.removeChild(this._active.element()); |
Akron | 1a5a587 | 2016-09-05 20:17:14 +0200 | [diff] [blame] | 303 | } |
| 304 | else { |
| 305 | this._unshowAlert(); |
| 306 | }; |
| 307 | |
Akron | 65c7435 | 2016-09-02 17:23:39 +0200 | [diff] [blame] | 308 | // this._active.hide(); |
| 309 | this.active(null); |
| 310 | }; |
Nils Diewald | 19ccee9 | 2014-12-08 11:30:08 +0000 | [diff] [blame] | 311 | } |
| 312 | }; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 313 | }); |