Skip to content

Commit

Permalink
Add hotkey for scroll to highlighed syl text
Browse files Browse the repository at this point in the history
  • Loading branch information
yinanazhou committed Jul 1, 2023
1 parent 914c506 commit c8fce66
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/SquareEdit/Contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,14 @@ export const hotkeysModal = `
</div>
<div class="hotkey-entry-description">Hide Glyph</div>
</div>
<div class="hotkey-entry-container">
<div class="hotkey-container">
<div class="hotkey-entry">Shift</div>
<div>+</div>
<div class="hotkey-entry">T</div>
</div>
<div class="hotkey-entry-description">Scroll To Syllable Text</div>
</div>
</div>
<!-- "Edit" hotkeys -->
Expand Down Expand Up @@ -501,10 +509,10 @@ export const hotkeysModal = `
</div>
<div class="hotkey-entry-container">
<div class="hotkey-container">
<div class="hotkey-entry">1/2/3/4</div>
<div class="hotkey-entry">1/2/3/4/5/6</div>
</div>
<div class="hotkey-entry-description">
Select by Syllable/Neume/Neume Component/Staff
Select by Syllable/Neume/Neume Component/Staff/Layer Element/BBox
</div>
</div>
<div class="hotkey-entry-container">
Expand Down
9 changes: 9 additions & 0 deletions src/TextEditMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ export default class TextEditMode implements TextEditInterface {
span.removeEventListener('click', selectSylText);
span.addEventListener('click', selectSylText);
});

document.addEventListener('keydown', (event) => {
if (event.shiftKey && event.key === 'T') {
const selectedSylText = document.querySelector('.text-select');
if (selectedSylText) {
selectedSylText.scrollIntoView({ behavior: 'smooth' });
}
}
});
}


Expand Down

0 comments on commit c8fce66

Please sign in to comment.