| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 UI.InplaceEditor = class { | 7 UI.InplaceEditor = class { |
| 8 /** | 8 /** |
| 9 * @param {!Element} element | 9 * @param {!Element} element |
| 10 * @param {!UI.InplaceEditor.Config=} config | 10 * @param {!UI.InplaceEditor.Config=} config |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 function handleEditingResult(result, event) { | 160 function handleEditingResult(result, event) { |
| 161 if (result === 'commit') { | 161 if (result === 'commit') { |
| 162 editingCommitted.call(element); | 162 editingCommitted.call(element); |
| 163 event.consume(true); | 163 event.consume(true); |
| 164 } else if (result === 'cancel') { | 164 } else if (result === 'cancel') { |
| 165 editingCancelled.call(element); | 165 editingCancelled.call(element); |
| 166 event.consume(true); | 166 event.consume(true); |
| 167 } else if (result && result.startsWith('move-')) { | 167 } else if (result && result.startsWith('move-')) { |
| 168 moveDirection = result.substring(5); | 168 moveDirection = result.substring(5); |
| 169 if (event.key !== 'Tab') | 169 if (event.key === 'Tab') |
| 170 blurEventListener(); | 170 event.consume(true); |
| 171 blurEventListener(); |
| 171 } | 172 } |
| 172 } | 173 } |
| 173 | 174 |
| 174 /** | 175 /** |
| 175 * @param {!Event} event | 176 * @param {!Event} event |
| 176 */ | 177 */ |
| 177 function pasteEventListener(event) { | 178 function pasteEventListener(event) { |
| 178 var result = pasteCallback(event); | 179 var result = pasteCallback(event); |
| 179 handleEditingResult(result, event); | 180 handleEditingResult(result, event); |
| 180 } | 181 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 this.smartIndent = smartIndent; | 260 this.smartIndent = smartIndent; |
| 260 } | 261 } |
| 261 | 262 |
| 262 /** | 263 /** |
| 263 * @param {function(!Event):string} postKeydownFinishHandler | 264 * @param {function(!Event):string} postKeydownFinishHandler |
| 264 */ | 265 */ |
| 265 setPostKeydownFinishHandler(postKeydownFinishHandler) { | 266 setPostKeydownFinishHandler(postKeydownFinishHandler) { |
| 266 this.postKeydownFinishHandler = postKeydownFinishHandler; | 267 this.postKeydownFinishHandler = postKeydownFinishHandler; |
| 267 } | 268 } |
| 268 }; | 269 }; |
| OLD | NEW |