mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01:00 
			
		
		
		
	Keep file tree view icons consistent with icon theme (#33921)
Fix #33914 before:  after:  --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -3,6 +3,7 @@ import ViewFileTreeItem from './ViewFileTreeItem.vue'; | ||||
| import {onMounted, ref} from 'vue'; | ||||
| import {pathEscapeSegments} from '../utils/url.ts'; | ||||
| import {GET} from '../modules/fetch.ts'; | ||||
| import {createElementFromHTML} from '../utils/dom.ts'; | ||||
|  | ||||
| const elRoot = ref<HTMLElement | null>(null); | ||||
|  | ||||
| @@ -18,6 +19,15 @@ const selectedItem = ref(''); | ||||
| async function loadChildren(treePath: string, subPath: string = '') { | ||||
|   const response = await GET(`${props.repoLink}/tree-view/${props.currentRefNameSubURL}/${pathEscapeSegments(treePath)}?sub_path=${encodeURIComponent(subPath)}`); | ||||
|   const json = await response.json(); | ||||
|   const poolSvgs = []; | ||||
|   for (const [svgId, svgContent] of Object.entries(json.renderedIconPool ?? {})) { | ||||
|     if (!document.querySelector(`.global-svg-icon-pool #${svgId}`)) poolSvgs.push(svgContent); | ||||
|   } | ||||
|   if (poolSvgs.length) { | ||||
|     const svgContainer = createElementFromHTML('<div class="global-svg-icon-pool tw-hidden"></div>'); | ||||
|     svgContainer.innerHTML = poolSvgs.join(''); | ||||
|     document.body.append(svgContainer); | ||||
|   } | ||||
|   return json.fileTreeNodes ?? null; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user