aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/sshkey-helper.ts
blob: 860bc5b2944bfb49fa865c3cd452dcd210b49a22 (plain)
1
2
3
4
5
6
7
8
9
10
export function initSshKeyFormParser() {
  // Parse SSH Key
  document.querySelector<HTMLTextAreaElement>('#ssh-key-content')?.addEventListener('input', function () {
    const arrays = this.value.split(' ');
    const title = document.querySelector<HTMLInputElement>('#ssh-key-title');
    if (!title.value && arrays.length === 3 && arrays[2] !== '') {
      title.value = arrays[2];
    }
  });
}