mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Replace ajax with fetch, improve image diff (#27267)
1. Dropzone attachment removal, pretty simple replacement 2. Image diff: The previous code fetched every image twice, once via `img[src]` and once via `$.ajax`. Now it's only fetched once and a second time only when necessary. The image diff code was partially rewritten. --------- Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
		@@ -11,7 +11,7 @@ import {htmlEscape} from 'escape-goat';
 | 
			
		||||
import {showTemporaryTooltip} from '../modules/tippy.js';
 | 
			
		||||
import {confirmModal} from './comp/ConfirmModal.js';
 | 
			
		||||
import {showErrorToast} from '../modules/toast.js';
 | 
			
		||||
import {request} from '../modules/fetch.js';
 | 
			
		||||
import {request, POST} from '../modules/fetch.js';
 | 
			
		||||
 | 
			
		||||
const {appUrl, appSubUrl, csrfToken, i18n} = window.config;
 | 
			
		||||
 | 
			
		||||
@@ -243,9 +243,8 @@ export function initGlobalDropzone() {
 | 
			
		||||
        this.on('removedfile', (file) => {
 | 
			
		||||
          $(`#${file.uuid}`).remove();
 | 
			
		||||
          if ($dropzone.data('remove-url')) {
 | 
			
		||||
            $.post($dropzone.data('remove-url'), {
 | 
			
		||||
              file: file.uuid,
 | 
			
		||||
              _csrf: csrfToken,
 | 
			
		||||
            POST($dropzone.data('remove-url'), {
 | 
			
		||||
              data: new URLSearchParams({file: file.uuid}),
 | 
			
		||||
            });
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user