mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Backport #34409 by @silverwind - Merge the CSS for the two expanders (text-expander-element and tribute.js) into one file - Fix overflow issues - Remove min-width - Various other tweaks like borders, colors, padding, gaps. text-expander: <img width="645" alt="Screenshot 2025-05-09 at 02 21 24" src="https://github.com/user-attachments/assets/33276dc4-38e8-45e1-8216-2a4baa9bc039" /> tribute: <img width="624" alt="Screenshot 2025-05-09 at 02 21 37" src="https://github.com/user-attachments/assets/91fbcd1a-9bfc-40fd-93f0-a05b4bd4c98d" /> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -100,67 +100,3 @@ | |||||||
|   border-bottom: 1px solid var(--color-secondary); |   border-bottom: 1px solid var(--color-secondary); | ||||||
|   padding-bottom: 1rem; |   padding-bottom: 1rem; | ||||||
| } | } | ||||||
|  |  | ||||||
| text-expander { |  | ||||||
|   display: block; |  | ||||||
|   position: relative; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions { |  | ||||||
|   position: absolute; |  | ||||||
|   min-width: 180px; |  | ||||||
|   padding: 0; |  | ||||||
|   margin-top: 24px; |  | ||||||
|   list-style: none; |  | ||||||
|   background: var(--color-box-body); |  | ||||||
|   border-radius: var(--border-radius); |  | ||||||
|   border: 1px solid var(--color-secondary); |  | ||||||
|   box-shadow: 0 .5rem 1rem var(--color-shadow); |  | ||||||
|   z-index: 100; /* needs to be > 20 to be on top of dropzone's .dz-details */ |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions li { |  | ||||||
|   display: flex; |  | ||||||
|   align-items: center; |  | ||||||
|   cursor: pointer; |  | ||||||
|   padding: 4px 8px; |  | ||||||
|   font-weight: var(--font-weight-medium); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions li + li { |  | ||||||
|   border-top: 1px solid var(--color-secondary-alpha-40); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions li:first-child { |  | ||||||
|   border-radius: var(--border-radius) var(--border-radius) 0 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions li:last-child { |  | ||||||
|   border-radius: 0 0 var(--border-radius) var(--border-radius); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions li:only-child { |  | ||||||
|   border-radius: var(--border-radius); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions li:hover { |  | ||||||
|   background: var(--color-hover); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions .fullname { |  | ||||||
|   font-weight: var(--font-weight-normal); |  | ||||||
|   margin-left: 4px; |  | ||||||
|   color: var(--color-text-light-1); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions li[aria-selected="true"], |  | ||||||
| text-expander .suggestions li[aria-selected="true"] span { |  | ||||||
|   background: var(--color-primary); |  | ||||||
|   color: var(--color-primary-contrast); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| text-expander .suggestions img { |  | ||||||
|   width: 24px; |  | ||||||
|   height: 24px; |  | ||||||
|   margin-right: 8px; |  | ||||||
| } |  | ||||||
|   | |||||||
							
								
								
									
										96
									
								
								web_src/css/features/expander.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								web_src/css/features/expander.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,96 @@ | |||||||
|  | text-expander .suggestions, | ||||||
|  | .tribute-container { | ||||||
|  |   position: absolute; | ||||||
|  |   max-height: min(300px, 95vh); | ||||||
|  |   max-width: min(500px, 95vw); | ||||||
|  |   overflow-x: hidden; | ||||||
|  |   overflow-y: auto; | ||||||
|  |   white-space: nowrap; | ||||||
|  |   background: var(--color-menu); | ||||||
|  |   box-shadow: 0 6px 18px var(--color-shadow); | ||||||
|  |   border-radius: var(--border-radius); | ||||||
|  |   border: 1px solid var(--color-secondary); | ||||||
|  |   z-index: 100; /* needs to be > 20 to be on top of dropzone's .dz-details */ | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander { | ||||||
|  |   display: block; | ||||||
|  |   position: relative; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions { | ||||||
|  |   padding: 0; | ||||||
|  |   margin-top: 24px; | ||||||
|  |   list-style: none; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions li, | ||||||
|  | .tribute-item { | ||||||
|  |   display: flex; | ||||||
|  |   align-items: center; | ||||||
|  |   cursor: pointer; | ||||||
|  |   gap: 6px; | ||||||
|  |   font-weight: var(--font-weight-medium); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions li, | ||||||
|  | .tribute-container li { | ||||||
|  |   padding: 3px 6px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions li + li, | ||||||
|  | .tribute-container li + li { | ||||||
|  |   border-top: 1px solid var(--color-secondary); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions li:first-child { | ||||||
|  |   border-radius: var(--border-radius) var(--border-radius) 0 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions li:last-child { | ||||||
|  |   border-radius: 0 0 var(--border-radius) var(--border-radius); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions li:only-child { | ||||||
|  |   border-radius: var(--border-radius); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions .fullname, | ||||||
|  | .tribute-container li .fullname { | ||||||
|  |   font-weight: var(--font-weight-normal); | ||||||
|  |   color: var(--color-text-light-1); | ||||||
|  |   overflow: hidden; | ||||||
|  |   text-overflow: ellipsis; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions li:hover, | ||||||
|  | text-expander .suggestions li:hover *, | ||||||
|  | text-expander .suggestions li[aria-selected="true"], | ||||||
|  | text-expander .suggestions li[aria-selected="true"] *, | ||||||
|  | .tribute-container li.highlight, | ||||||
|  | .tribute-container li.highlight * { | ||||||
|  |   background: var(--color-primary); | ||||||
|  |   color: var(--color-primary-contrast); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | text-expander .suggestions img, | ||||||
|  | .tribute-item img { | ||||||
|  |   width: 21px; | ||||||
|  |   height: 21px; | ||||||
|  |   object-fit: contain; | ||||||
|  |   aspect-ratio: 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tribute-container { | ||||||
|  |   display: block; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tribute-container ul { | ||||||
|  |   margin: 0; | ||||||
|  |   padding: 0; | ||||||
|  |   list-style: none; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tribute-container li.no-match { | ||||||
|  |   cursor: default; | ||||||
|  | } | ||||||
| @@ -1,32 +0,0 @@ | |||||||
| @import "tributejs/dist/tribute.css"; |  | ||||||
|  |  | ||||||
| .tribute-container { |  | ||||||
|   box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.25); |  | ||||||
|   border-radius: var(--border-radius); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .tribute-container ul { |  | ||||||
|   margin-top: 0 !important; |  | ||||||
|   background: var(--color-body) !important; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .tribute-container li { |  | ||||||
|   padding: 3px 0.5rem !important; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .tribute-container li span.fullname { |  | ||||||
|   font-weight: var(--font-weight-normal); |  | ||||||
|   font-size: 0.8rem; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .tribute-container li.highlight, |  | ||||||
| .tribute-container li:hover { |  | ||||||
|   background: var(--color-primary) !important; |  | ||||||
|   color: var(--color-primary-contrast) !important; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .tribute-item { |  | ||||||
|   display: flex; |  | ||||||
|   align-items: center; |  | ||||||
|   gap: 6px; |  | ||||||
| } |  | ||||||
| @@ -39,7 +39,7 @@ | |||||||
| @import "./features/imagediff.css"; | @import "./features/imagediff.css"; | ||||||
| @import "./features/codeeditor.css"; | @import "./features/codeeditor.css"; | ||||||
| @import "./features/projects.css"; | @import "./features/projects.css"; | ||||||
| @import "./features/tribute.css"; | @import "./features/expander.css"; | ||||||
| @import "./features/cropper.css"; | @import "./features/cropper.css"; | ||||||
| @import "./features/console.css"; | @import "./features/console.css"; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -97,6 +97,7 @@ export function initTextExpander(expander: TextExpanderElement) { | |||||||
|         li.append(img); |         li.append(img); | ||||||
|  |  | ||||||
|         const nameSpan = document.createElement('span'); |         const nameSpan = document.createElement('span'); | ||||||
|  |         nameSpan.classList.add('name'); | ||||||
|         nameSpan.textContent = name; |         nameSpan.textContent = name; | ||||||
|         li.append(nameSpan); |         li.append(nameSpan); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user