mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Ensure that relative paths in edit preview work (#11143)
Fix #10131 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
		| @@ -64,10 +64,16 @@ function initEditPreviewTab($form) { | ||||
|     previewFileModes = $previewTab.data('preview-file-modes').split(','); | ||||
|     $previewTab.on('click', function () { | ||||
|       const $this = $(this); | ||||
|       let context = `{$this.data('context')}/`; | ||||
|       const treePathEl = $form.find('input#tree_path'); | ||||
|       if (treePathEl.length > 0) { | ||||
|         context += treePathEl.val(); | ||||
|       } | ||||
|       context = context.substring(0, context.lastIndexOf('/')); | ||||
|       $.post($this.data('url'), { | ||||
|         _csrf: csrf, | ||||
|         mode: 'gfm', | ||||
|         context: $this.data('context'), | ||||
|         context, | ||||
|         text: $form.find(`.tab.segment[data-tab="${$tabMenu.data('write')}"] textarea`).val() | ||||
|       }, (data) => { | ||||
|         const $previewPanel = $form.find(`.tab.segment[data-tab="${$tabMenu.data('preview')}"]`); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user