mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-26 00:48:29 +00:00 
			
		
		
		
	1. Add some "render-content" classes to "markup" elements when the
content is rendered
2. Use correct "markup" wrapper for "preview" (but not set that class on
the tab)
3. Remove incorrect "markup" class from LFS file view, because there is
no markup content
    * "edit-diff" is also removed because it does nothing
5. Use "initPdfViewer" for PDF viewer
6. Remove incorrect "content" class from milestone markup
7. Init all ".markup" elements by new init framework
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			650 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			650 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import {htmlEscape} from 'escape-goat';
 | |
| import {registerGlobalInitFunc} from '../modules/observer.ts';
 | |
| 
 | |
| export async function initPdfViewer() {
 | |
|   registerGlobalInitFunc('initPdfViewer', async (el: HTMLInputElement) => {
 | |
|     const pdfobject = await import(/* webpackChunkName: "pdfobject" */'pdfobject');
 | |
| 
 | |
|     const src = el.getAttribute('data-src');
 | |
|     const fallbackText = el.getAttribute('data-fallback-button-text');
 | |
|     pdfobject.embed(src, el, {
 | |
|       fallbackLink: htmlEscape`
 | |
|         <a role="button" class="ui basic button pdf-fallback-button" href="[url]">${fallbackText}</a>
 | |
|       `,
 | |
|     });
 | |
|     el.classList.remove('is-loading');
 | |
|   });
 | |
| }
 |