| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 this._shortcuts = {}; | 60 this._shortcuts = {}; |
| 61 this.element.addEventListener('keydown', this._handleKeyDown.bind(this), fal
se); | 61 this.element.addEventListener('keydown', this._handleKeyDown.bind(this), fal
se); |
| 62 | 62 |
| 63 this._sourcePosition = new UI.ToolbarText(); | 63 this._sourcePosition = new UI.ToolbarText(); |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * @type {?UI.SearchableView} | 66 * @type {?UI.SearchableView} |
| 67 */ | 67 */ |
| 68 this._searchableView = null; | 68 this._searchableView = null; |
| 69 this._editable = false; | 69 this._editable = false; |
| 70 this._textEditor.setReadOnly(true); |
| 70 } | 71 } |
| 71 | 72 |
| 72 /** | 73 /** |
| 73 * @param {boolean} editable | 74 * @param {boolean} editable |
| 75 * @protected |
| 74 */ | 76 */ |
| 75 setEditable(editable) { | 77 setEditable(editable) { |
| 76 this._editable = editable; | 78 this._editable = editable; |
| 77 this._textEditor.setReadOnly(editable); | 79 this._textEditor.setReadOnly(!editable); |
| 78 } | 80 } |
| 79 | 81 |
| 80 /** | 82 /** |
| 81 * @param {number} key | 83 * @param {number} key |
| 82 * @param {function():boolean} handler | 84 * @param {function():boolean} handler |
| 83 */ | 85 */ |
| 84 addShortcut(key, handler) { | 86 addShortcut(key, handler) { |
| 85 this._shortcuts[key] = handler; | 87 this._shortcuts[key] = handler; |
| 86 } | 88 } |
| 87 | 89 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 } | 574 } |
| 573 } | 575 } |
| 574 | 576 |
| 575 _handleKeyDown(e) { | 577 _handleKeyDown(e) { |
| 576 var shortcutKey = UI.KeyboardShortcut.makeKeyFromEvent(e); | 578 var shortcutKey = UI.KeyboardShortcut.makeKeyFromEvent(e); |
| 577 var handler = this._shortcuts[shortcutKey]; | 579 var handler = this._shortcuts[shortcutKey]; |
| 578 if (handler && handler()) | 580 if (handler && handler()) |
| 579 e.consume(true); | 581 e.consume(true); |
| 580 } | 582 } |
| 581 }; | 583 }; |
| OLD | NEW |