@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Retain keyboard cursor state across more inline edit operations in Differential

Summary:
Ref T12634. Fixes T8131. Currently, most edit operations (edit, reply, collapse, mark done) lose the keyboard cursor state.

Instead, bind the state more tighlty to the inline object itself (instead of the rows which happen to be in the document), and then do a bit of recalculation to try to keep it selected across edits.

Test Plan:
- Used "n" to select an inline.
- Clicked "Done" checkbox.
- Pressed "n".
- Went to the next inline (previously: lost position in document).
- Behavior is also better for: edit, reply, collapse/expand.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12634, T8131

Differential Revision: https://secure.phabricator.com/D17905

+52 -35
+24 -24
resources/celerity/map.php
··· 13 13 'core.pkg.js' => '8c5f913d', 14 14 'darkconsole.pkg.js' => '1f9a31bc', 15 15 'differential.pkg.css' => '58712637', 16 - 'differential.pkg.js' => '6ee9a850', 16 + 'differential.pkg.js' => '0bfd141c', 17 17 'diffusion.pkg.css' => 'b93d9b8c', 18 18 'diffusion.pkg.js' => '84c8f8fd', 19 19 'favicon.ico' => '30672e08', ··· 390 390 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173', 391 391 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 392 392 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 393 - 'rsrc/js/application/diff/DiffChangeset.js' => 'f7100923', 394 - 'rsrc/js/application/diff/DiffChangesetList.js' => 'e5c5e171', 395 - 'rsrc/js/application/diff/DiffInline.js' => '4bbefc49', 393 + 'rsrc/js/application/diff/DiffChangeset.js' => '145c34e2', 394 + 'rsrc/js/application/diff/DiffChangesetList.js' => 'ca3b6387', 395 + 'rsrc/js/application/diff/DiffInline.js' => 'b5b1f167', 396 396 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', 397 397 'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d', 398 398 'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76', ··· 781 781 'phabricator-darklog' => 'c8e1ffe3', 782 782 'phabricator-darkmessage' => 'c48cccdd', 783 783 'phabricator-dashboard-css' => 'fe5b1869', 784 - 'phabricator-diff-changeset' => 'f7100923', 785 - 'phabricator-diff-changeset-list' => 'e5c5e171', 786 - 'phabricator-diff-inline' => '4bbefc49', 784 + 'phabricator-diff-changeset' => '145c34e2', 785 + 'phabricator-diff-changeset-list' => 'ca3b6387', 786 + 'phabricator-diff-inline' => 'b5b1f167', 787 787 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 788 788 'phabricator-draggable-list' => 'bea6e7f4', 789 789 'phabricator-fatal-config-template-css' => '8f18fa41', ··· 999 999 'javelin-dom', 1000 1000 'javelin-typeahead-normalizer', 1001 1001 ), 1002 + '145c34e2' => array( 1003 + 'javelin-dom', 1004 + 'javelin-util', 1005 + 'javelin-stratcom', 1006 + 'javelin-install', 1007 + 'javelin-workflow', 1008 + 'javelin-router', 1009 + 'javelin-behavior-device', 1010 + 'javelin-vector', 1011 + 'phabricator-diff-inline', 1012 + ), 1002 1013 '1499a8cb' => array( 1003 1014 'javelin-behavior', 1004 1015 'javelin-stratcom', ··· 1258 1269 'javelin-dom', 1259 1270 'javelin-util', 1260 1271 'phabricator-shaped-request', 1261 - ), 1262 - '4bbefc49' => array( 1263 - 'javelin-dom', 1264 1272 ), 1265 1273 '4c193c96' => array( 1266 1274 'javelin-behavior', ··· 1834 1842 'javelin-dom', 1835 1843 'phabricator-draggable-list', 1836 1844 ), 1845 + 'b5b1f167' => array( 1846 + 'javelin-dom', 1847 + ), 1837 1848 'b5c256b8' => array( 1838 1849 'javelin-install', 1839 1850 'javelin-dom', ··· 1972 1983 'phabricator-title', 1973 1984 'phabricator-shaped-request', 1974 1985 'conpherence-thread-manager', 1986 + ), 1987 + 'ca3b6387' => array( 1988 + 'javelin-install', 1975 1989 ), 1976 1990 'ca3f91eb' => array( 1977 1991 'javelin-behavior', ··· 2137 2151 'javelin-workflow', 2138 2152 'javelin-magical-init', 2139 2153 ), 2140 - 'e5c5e171' => array( 2141 - 'javelin-install', 2142 - ), 2143 2154 'e9581f08' => array( 2144 2155 'javelin-behavior', 2145 2156 'javelin-stratcom', ··· 2187 2198 'javelin-dom', 2188 2199 'phuix-icon-view', 2189 2200 'phabricator-prefab', 2190 - ), 2191 - 'f7100923' => array( 2192 - 'javelin-dom', 2193 - 'javelin-util', 2194 - 'javelin-stratcom', 2195 - 'javelin-install', 2196 - 'javelin-workflow', 2197 - 'javelin-router', 2198 - 'javelin-behavior-device', 2199 - 'javelin-vector', 2200 - 'phabricator-diff-inline', 2201 2201 ), 2202 2202 'f7fc67ec' => array( 2203 2203 'javelin-install',
+2 -8
webroot/rsrc/js/application/diff/DiffChangeset.js
··· 369 369 for (var jj = 0; jj < block.items.length; jj++) { 370 370 var inline = this.getInlineForRow(block.items[jj]); 371 371 372 - // If this inline has been collapsed, don't select it with the 373 - // keyboard cursor. 374 - if (inline.isHidden()) { 375 - continue; 376 - } 377 - 378 372 items.push({ 379 373 type: block.type, 380 374 changeset: this, 381 - target: block.items[jj], 382 - inline: inline, 375 + target: inline, 376 + hidden: inline.isHidden(), 383 377 nodes: { 384 378 begin: block.items[jj], 385 379 end: block.items[jj]
+24 -3
webroot/rsrc/js/application/diff/DiffChangesetList.js
··· 206 206 207 207 if (cursor) { 208 208 if (cursor.type == 'comment') { 209 - var inline = cursor.inline; 209 + var inline = cursor.target; 210 210 if (inline.canReply()) { 211 211 this.setFocus(null); 212 212 ··· 225 225 226 226 if (cursor) { 227 227 if (cursor.type == 'comment') { 228 - var inline = cursor.inline; 228 + var inline = cursor.target; 229 229 if (inline.canEdit()) { 230 230 this.setFocus(null); 231 231 ··· 284 284 } 285 285 } 286 286 287 + // If the item is hidden, don't select it when iterating with jump 288 + // keys. It can still potentially be selected in other ways. 289 + if (items[cursor].hidden) { 290 + continue; 291 + } 292 + 287 293 // Otherwise, we've found a valid item to select. 288 294 break; 289 295 } ··· 328 334 329 335 this.setFocus(cursor.nodes.begin, cursor.nodes.end); 330 336 331 - if (scroll) { 337 + if (manager && scroll) { 332 338 manager.scrollTo(cursor.nodes.begin); 333 339 } 334 340 335 341 return this; 342 + }, 343 + 344 + redrawCursor: function() { 345 + // NOTE: This is setting the cursor to the current cursor. Usually, this 346 + // would have no effect. 347 + 348 + // However, if the old cursor pointed at an inline and the inline has 349 + // been edited so the rows have changed, this updates the cursor to point 350 + // at the new inline with the proper rows for the current state, and 351 + // redraws the reticle correctly. 352 + 353 + var state = this._getSelectionState(); 354 + if (state.cursor !== null) { 355 + this._setSelectionState(state.items[state.cursor]); 356 + } 336 357 }, 337 358 338 359 _getSelectableItems: function() {
+2
webroot/rsrc/js/application/diff/DiffInline.js
··· 519 519 // preview at the bottom of the page. 520 520 this.getChangeset().getChangesetList().redrawPreview(); 521 521 522 + this.getChangeset().getChangesetList().redrawCursor(); 523 + 522 524 // Emit a resize event so that UI elements like the keyboad focus 523 525 // reticle can redraw properly. 524 526 JX.Stratcom.invoke('resize');