Changeset 276616 in webkit
- Timestamp:
- Apr 26, 2021, 2:54:22 PM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Models/AuditTestBase.js (modified) (1 diff)
-
UserInterface/Models/AuditTestCase.js (modified) (1 diff)
-
UserInterface/Views/AuditTestCaseContentView.js (modified) (3 diffs)
-
UserInterface/Views/AuditTestContentView.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r276603 r276616 1 2021-04-26 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Audit Tab: Edits are not committed when leaving edit mode unless you first click into another text field 4 https://bugs.webkit.org/show_bug.cgi?id=224318 5 <rdar://problem/76382755> 6 7 Reviewed by Devin Rousso. 8 9 Save test and setup code when pressing "Done" button. Don't rely on the blur event because it doesn't fire on 10 the focused element when it's removed from the DOM. 11 12 * UserInterface/Models/AuditTestBase.js: 13 (WI.AuditTestBase.prototype.set setup): 14 * UserInterface/Models/AuditTestCase.js: 15 (WI.AuditTestCase.prototype.set test): 16 Allow setting `test` and `setup` after editing is finished. 17 18 * UserInterface/Views/AuditTestCaseContentView.js: 19 (WI.AuditTestCaseContentView.prototype.layout): 20 (WI.AuditTestCaseContentView.prototype.saveEditedData): 21 * UserInterface/Views/AuditTestContentView.js: 22 (WI.AuditTestContentView.prototype.detached): 23 Saving test on `detached` saves it when selecting a different test in the navigation sidebar. 24 25 (WI.AuditTestContentView.prototype.saveEditedData): 26 (WI.AuditTestContentView.prototype._createSetupEditor): 27 (WI.AuditTestContentView.prototype._handleEditingChanged): 28 (WI.AuditTestContentView): 29 1 30 2021-04-26 Devin Rousso <drousso@apple.com> 2 31 -
trunk/Source/WebInspectorUI/UserInterface/Models/AuditTestBase.js
r266317 r276616 122 122 { 123 123 console.assert(this.editable); 124 console.assert(WI.auditManager.editing);125 124 console.assert(typeof setup === "string", setup); 126 125 -
trunk/Source/WebInspectorUI/UserInterface/Models/AuditTestCase.js
r266317 r276616 101 101 { 102 102 console.assert(this.editable); 103 console.assert(WI.auditManager.editing);104 103 console.assert(typeof test === "string", test); 105 104 -
trunk/Source/WebInspectorUI/UserInterface/Views/AuditTestCaseContentView.js
r269359 r276616 82 82 // Give the rest of the view a chance to load. 83 83 setTimeout(() => { 84 lettestCodeMirror = WI.CodeMirrorEditor.create(testEditorElement, {84 this._testCodeMirror = WI.CodeMirrorEditor.create(testEditorElement, { 85 85 autoCloseBrackets: true, 86 86 lineNumbers: true, … … 92 92 value: this.representedObject.test, 93 93 }); 94 95 if (this.representedObject.editable) {96 testCodeMirror.on("blur", (event) => {97 this.representedObject.test = testCodeMirror.getValue().trim();98 });99 }100 94 }); 101 95 return; … … 328 322 } 329 323 324 saveEditedData() 325 { 326 super.saveEditedData(); 327 328 this.representedObject.test = this._testCodeMirror.getValue().trim(); 329 } 330 330 331 showRunningPlaceholder() 331 332 { -
trunk/Source/WebInspectorUI/UserInterface/Views/AuditTestContentView.js
r273900 r276616 288 288 289 289 WI.auditManager.removeEventListener(WI.AuditManager.Event.EditingChanged, this._handleEditingChanged, this); 290 if (this.representedObject.editable && WI.auditManager.editing) 291 this.saveEditedData(); 290 292 } 291 293 … … 311 313 312 314 this._placeholderElement = placeholderElement; 315 } 316 317 saveEditedData() 318 { 319 console.assert(this.representedObject.editable, this.representedObject); 320 this.representedObject.setup = this._setupCodeMirror.getValue().trim(); 313 321 } 314 322 … … 495 503 // Give the rest of the view a chance to load. 496 504 setTimeout(() => { 497 letsetupCodeMirror = WI.CodeMirrorEditor.create(setupEditorElement, {505 this._setupCodeMirror = WI.CodeMirrorEditor.create(setupEditorElement, { 498 506 autoCloseBrackets: true, 499 507 lineNumbers: true, … … 505 513 value: this.representedObject.setup, 506 514 }); 507 508 if (this.representedObject.editable) {509 setupCodeMirror.on("blur", (event) => {510 this.representedObject.setup = setupCodeMirror.getValue().trim();511 });512 }513 515 }); 514 516 … … 579 581 this.needsLayout(); 580 582 583 // We only need to save changes when editing is done. No need to save it after entering the editing mode. 584 if (!WI.auditManager.editing && this.representedObject.editable) 585 this.saveEditedData(); 586 581 587 this._updateExportNavigationItems(); 582 588 }
Note:
See TracChangeset
for help on using the changeset viewer.