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.1KB

1234567891011121314151617181920212223242526272829303132
  1. import $ from 'jquery';
  2. import {attachTribute} from './tribute.js';
  3. import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
  4. import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
  5. import {createCommentEasyMDE} from './comp/EasyMDE.js';
  6. import {hideElem} from '../utils/dom.js';
  7. export function initRepoRelease() {
  8. $(document).on('click', '.remove-rel-attach', function() {
  9. const uuid = $(this).data('uuid');
  10. const id = $(this).data('id');
  11. $(`input[name='attachment-del-${uuid}']`).attr('value', true);
  12. hideElem($(`#attachment-${id}`));
  13. });
  14. }
  15. export function initRepoReleaseEditor() {
  16. const $editor = $('.repository.new.release .content-editor');
  17. if ($editor.length === 0) {
  18. return;
  19. }
  20. (async () => {
  21. const $textarea = $editor.find('textarea');
  22. await attachTribute($textarea.get(), {mentions: true, emoji: true});
  23. const easyMDE = await createCommentEasyMDE($textarea);
  24. initCompMarkupContentPreviewTab($editor);
  25. const $dropzone = $editor.parent().find('.dropzone');
  26. initEasyMDEImagePaste(easyMDE, $dropzone);
  27. })();
  28. }