| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 config = config || new UI.InplaceEditor.Config(function() {}, function() {})
; | 93 config = config || new UI.InplaceEditor.Config(function() {}, function() {})
; |
| 94 var editingContext = {element: element, config: config}; | 94 var editingContext = {element: element, config: config}; |
| 95 var committedCallback = config.commitHandler; | 95 var committedCallback = config.commitHandler; |
| 96 var cancelledCallback = config.cancelHandler; | 96 var cancelledCallback = config.cancelHandler; |
| 97 var pasteCallback = config.pasteHandler; | 97 var pasteCallback = config.pasteHandler; |
| 98 var context = config.context; | 98 var context = config.context; |
| 99 var isMultiline = config.multiline || false; | 99 var isMultiline = config.multiline || false; |
| 100 var moveDirection = ''; | 100 var moveDirection = ''; |
| 101 var self = this; | 101 var self = this; |
| 102 | 102 |
| 103 /** | |
| 104 * @param {!Event} e | |
| 105 */ | |
| 106 function consumeCopy(e) { | |
| 107 e.consume(); | |
| 108 } | |
| 109 | |
| 110 this.setUpEditor(editingContext); | 103 this.setUpEditor(editingContext); |
| 111 | 104 |
| 112 editingContext.oldText = isMultiline ? config.initialValue : this.editorCont
ent(editingContext); | 105 editingContext.oldText = isMultiline ? config.initialValue : this.editorCont
ent(editingContext); |
| 113 | 106 |
| 114 /** | 107 /** |
| 115 * @param {!Event=} e | 108 * @param {!Event=} e |
| 116 */ | 109 */ |
| 117 function blurEventListener(e) { | 110 function blurEventListener(e) { |
| 118 if (config.blurHandler && !config.blurHandler(element, e)) | 111 if (config.blurHandler && !config.blurHandler(element, e)) |
| 119 return; | 112 return; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 this.smartIndent = smartIndent; | 259 this.smartIndent = smartIndent; |
| 267 } | 260 } |
| 268 | 261 |
| 269 /** | 262 /** |
| 270 * @param {function(!Event):string} postKeydownFinishHandler | 263 * @param {function(!Event):string} postKeydownFinishHandler |
| 271 */ | 264 */ |
| 272 setPostKeydownFinishHandler(postKeydownFinishHandler) { | 265 setPostKeydownFinishHandler(postKeydownFinishHandler) { |
| 273 this.postKeydownFinishHandler = postKeydownFinishHandler; | 266 this.postKeydownFinishHandler = postKeydownFinishHandler; |
| 274 } | 267 } |
| 275 }; | 268 }; |
| OLD | NEW |