a simple web player for subsonic tinysub.devins.page
subsonic navidrome javascript
9
fork

Configure Feed

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

feat: implement keybinds to undo/redo

the undo bind loads the last snapshot from undo-stack and applies state.
the redo does exactly the same from the redo-stack.

Signed-off-by: oppiliappan <me@oppi.li>

authored by

oppiliappan and committed by
Tangled
38447d33 99b4e72b

+25 -1
+5 -1
src/index.html
··· 222 222 ><span>remove selected</span> <kbd>Menu, Shift+F10, `</kbd 223 223 ><span>context menu</span><kbd>Ctrl+A</kbd><span>select all</span 224 224 ><kbd>Shift + ↑ / ↓</kbd><span>extend selection</span> 225 - <kbd>Esc</kbd><span>clear selection</span> 225 + <kbd>Esc</kbd><span>clear selection</span> <kbd>Ctrl+Z</kbd 226 + ><span>undo last queue change</span> <kbd>Ctrl+Y</kbd 227 + ><span>redo queue change</span> 226 228 </div> 227 229 </div> 228 230 </div> ··· 328 330 <script src="js/ui.js"></script> 329 331 <script src="js/state.js"></script> 330 332 <script src="js/api.js"></script> 333 + <script src="js/stack.js"></script> 334 + <script src="js/history.js"></script> 331 335 <script src="js/queue-virtualscroll.js"></script> 332 336 <script src="js/queue.js"></script> 333 337 <script src="js/library-selection.js"></script>
+20
src/js/input.js
··· 454 454 } 455 455 break; 456 456 } 457 + 458 + case "KeyZ": { 459 + // undo: Ctrl+Z 460 + if (e.ctrlKey || e.metaKey) { 461 + e.preventDefault(); 462 + const snapshot = history.undo(snapshotQueue()); 463 + restoreQueue(snapshot); 464 + } 465 + break; 466 + } 467 + 468 + case "KeyY": { 469 + // redo: Ctrl+Y 470 + if (e.ctrlKey || e.metaKey) { 471 + e.preventDefault(); 472 + const snapshot = history.redo(snapshotQueue()); 473 + restoreQueue(snapshot); 474 + } 475 + break; 476 + } 457 477 } 458 478 }); 459 479 }