| 13 | import observe from '../helpers/selector-observer.js'; |
| 14 | |
| 15 | async function linkifyIcon(fileIcon: Element): Promise<void> { |
| 16 | const fileLink = $('.react-directory-filename-cell a', fileIcon.parentElement!); |
| 17 | |
| 18 | const url = new GitHubFileUrl(fileLink.href).assign({ |
| 19 | route: 'edit', |
| 20 | }); |
| 21 | |
| 22 | wrap(fileIcon, <a href={url.href} className="rgh-quick-file-edit" />); |
| 23 | fileIcon.after(<PencilIcon />); |
| 24 | } |
| 25 | |
| 26 | async function init(signal: AbortSignal): Promise<void | false> { |
| 27 | observe(directoryListingFileIcon, linkifyIcon, {signal}); |