You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo-release.js 1.0KB

1234567891011121314151617181920212223242526272829
  1. import attachTribute from './tribute.js';
  2. import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
  3. import {initSimpleMDEImagePaste} from './comp/ImagePaste.js';
  4. import {createCommentSimpleMDE} from './comp/CommentSimpleMDE.js';
  5. 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. $(`#attachment-${id}`).hide();
  11. });
  12. }
  13. export function initRepoReleaseEditor() {
  14. const $editor = $('.repository.new.release .content-editor');
  15. if ($editor.length === 0) {
  16. return false;
  17. }
  18. const $textarea = $editor.find('textarea');
  19. attachTribute($textarea.get(), {mentions: false, emoji: true});
  20. const $files = $editor.parent().find('.files');
  21. const $simplemde = createCommentSimpleMDE($textarea);
  22. initCompMarkupContentPreviewTab($editor);
  23. const dropzone = $editor.parent().find('.dropzone')[0];
  24. initSimpleMDEImagePaste($simplemde, dropzone, $files);
  25. }