Move data-global-keyboard-shortcut from <input> to <kbd> elements so the
shortcut hint itself declares the shortcut key. The generic handler in
observer.ts now manages everything: focusing the sibling input on shortcut
key press, toggling kbd visibility on focus/blur, and clearing+blurring
on Escape.
This removes the element-specific initRepoCodeSearchShortcut function and
Vue v-show logic in favor of a fully decoupled approach. Any input can now
gain keyboard shortcut support by placing a sibling
<kbd data-global-keyboard-shortcut="key"> element.
Adds a devtest page at /devtest/keyboard-shortcut for manual testing.
- Use `target.isContentEditable` instead of `[contenteditable="true"]` selector
to properly detect all contenteditable elements
- Use `CSS.escape()` for keyboard shortcut key to handle special characters
- Rename scoped CSS class to `.repo-file-search-shortcut-hint` to avoid
conflict with global `.repo-search-shortcut-hint` styles
Instead of having JavaScript code guess which elements exist on a page,
elements now declare their keyboard shortcuts via data-global-keyboard-shortcut
attribute. This makes it easier to add new shortcuts and follows Gitea's
existing patterns for data-global-init and data-global-click.
Add GitHub-like keyboard shortcuts for repository navigation:
- Press 'T' to focus the "Go to file" search input
- Press 'S' to focus the "Search code" input
- Press 'Escape' to blur focused search inputs
Both search inputs display a keyboard hint (kbd element) showing
the available shortcut. The hint hides when the input is focused
or has a value.
Includes unit tests and e2e tests for the new functionality.
Fixes #36532
Refined the Enter key trigger logic in the repository filter to prevent
actions during IME composition.
By checking the e.isComposing property, the filter now correctly
distinguishes between "confirming an IME candidate" and "submitting the
search." This prevents premature search triggers when users press Enter
to select Chinese/Japanese characters.
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
A big step towards enabling strict mode in Typescript.
There was definitely a good share of potential bugs while refactoring
this. When in doubt, I opted to keep the potentially broken behaviour.
Notably, the `DOMEvent` type is gone, it was broken and we're better of
with type assertions on `e.target`.
---------
Signed-off-by: silverwind <me@silverwind.io>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
/claim #35898Resolves#35898
### Summary of key changes:
1. Add file name search/Go to file functionality to repo button row.
2. Add backend functionality to delete directory
3. Add context menu for directories with functionality to copy path & delete a directory
4. Move Add/Upload file dropdown to right for parity with Github UI
5. Add tree view to the edit/upload UI
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>