|
1 | | -import $ from 'jquery'; |
2 | 1 | import {hideElem, showElem} from '../utils/dom.js'; |
3 | 2 | import {initComboMarkdownEditor} from './comp/ComboMarkdownEditor.js'; |
4 | 3 |
|
5 | 4 | export function initRepoRelease() { |
6 | | - $(document).on('click', '.remove-rel-attach', function() { |
7 | | - const uuid = $(this).data('uuid'); |
8 | | - const id = $(this).data('id'); |
9 | | - $(`input[name='attachment-del-${uuid}']`).attr('value', true); |
10 | | - hideElem($(`#attachment-${id}`)); |
| 5 | + document.addEventListener('click', (e) => { |
| 6 | + if (e.target.matches('.remove-rel-attach')) { |
| 7 | + const uuid = e.target.getAttribute('data-uuid'); |
| 8 | + const id = e.target.getAttribute('data-id'); |
| 9 | + document.querySelector(`input[name='attachment-del-${uuid}']`).value = 'true'; |
| 10 | + hideElem(`#attachment-${id}`); |
| 11 | + } |
11 | 12 | }); |
12 | 13 | } |
13 | 14 |
|
14 | 15 | export function initRepoReleaseNew() { |
15 | | - const $repoReleaseNew = $('.repository.new.release'); |
16 | | - if (!$repoReleaseNew.length) return; |
| 16 | + if (!document.querySelector('.repository.new.release')) return; |
17 | 17 |
|
18 | 18 | initTagNameEditor(); |
19 | 19 | initRepoReleaseEditor(); |
@@ -45,9 +45,9 @@ function initTagNameEditor() { |
45 | 45 | } |
46 | 46 |
|
47 | 47 | function initRepoReleaseEditor() { |
48 | | - const $editor = $('.repository.new.release .combo-markdown-editor'); |
49 | | - if ($editor.length === 0) { |
| 48 | + const editor = document.querySelector('.repository.new.release .combo-markdown-editor'); |
| 49 | + if (!editor) { |
50 | 50 | return; |
51 | 51 | } |
52 | | - const _promise = initComboMarkdownEditor($editor); |
| 52 | + initComboMarkdownEditor(editor); |
53 | 53 | } |
0 commit comments