Skip to content

Commit 236e121

Browse files
Remove jQuery from SSH key form parser (go-gitea#29193)
- Switched to plain JavaScript - Tested the SSH key title functionality and it works as before # Demo using JavaScript without jQuery ![action](https://github.com/go-gitea/gitea/assets/20454870/4785c13d-8d30-448e-b74a-263935e2769f) --------- Signed-off-by: Yarden Shoham <[email protected]> Co-authored-by: silverwind <[email protected]>
1 parent c40ee6f commit 236e121

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

web_src/js/features/sshkey-helper.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import $ from 'jquery';
2-
31
export function initSshKeyFormParser() {
4-
// Parse SSH Key
5-
$('#ssh-key-content').on('change paste keyup', function () {
6-
const arrays = $(this).val().split(' ');
7-
const $title = $('#ssh-key-title');
8-
if ($title.val() === '' && arrays.length === 3 && arrays[2] !== '') {
9-
$title.val(arrays[2]);
2+
// Parse SSH Key
3+
document.getElementById('ssh-key-content')?.addEventListener('input', function () {
4+
const arrays = this.value.split(' ');
5+
const title = document.getElementById('ssh-key-title');
6+
if (!title.value && arrays.length === 3 && arrays[2] !== '') {
7+
title.value = arrays[2];
108
}
119
});
1210
}

0 commit comments

Comments
 (0)