mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Add attachment support for code review comments (#29220)
Fixes #27960, #24411, #12183 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		@@ -5,6 +5,7 @@ import {hideElem, showElem, toggleElem} from '../utils/dom.js';
 | 
			
		||||
import {setFileFolding} from './file-fold.js';
 | 
			
		||||
import {getComboMarkdownEditor, initComboMarkdownEditor} from './comp/ComboMarkdownEditor.js';
 | 
			
		||||
import {toAbsoluteUrl} from '../utils.js';
 | 
			
		||||
import {initDropzone} from './common-global.js';
 | 
			
		||||
 | 
			
		||||
const {appSubUrl, csrfToken} = window.config;
 | 
			
		||||
 | 
			
		||||
@@ -382,6 +383,11 @@ export async function handleReply($el) {
 | 
			
		||||
  const $textarea = form.find('textarea');
 | 
			
		||||
  let editor = getComboMarkdownEditor($textarea);
 | 
			
		||||
  if (!editor) {
 | 
			
		||||
    // FIXME: the initialization of the dropzone is not consistent.
 | 
			
		||||
    // When the page is loaded, the dropzone is initialized by initGlobalDropzone, but the editor is not initialized.
 | 
			
		||||
    // When the form is submitted and partially reload, none of them is initialized.
 | 
			
		||||
    const dropzone = form.find('.dropzone')[0];
 | 
			
		||||
    if (!dropzone.dropzone) initDropzone(dropzone);
 | 
			
		||||
    editor = await initComboMarkdownEditor(form.find('.combo-markdown-editor'));
 | 
			
		||||
  }
 | 
			
		||||
  editor.focus();
 | 
			
		||||
@@ -511,6 +517,7 @@ export function initRepoPullRequestReview() {
 | 
			
		||||
      td.find("input[name='side']").val(side === 'left' ? 'previous' : 'proposed');
 | 
			
		||||
      td.find("input[name='path']").val(path);
 | 
			
		||||
 | 
			
		||||
      initDropzone(td.find('.dropzone')[0]);
 | 
			
		||||
      const editor = await initComboMarkdownEditor(td.find('.combo-markdown-editor'));
 | 
			
		||||
      editor.focus();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user