mirror of
				https://github.com/BookStackApp/BookStack.git
				synced 2025-11-04 13:31:45 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			389 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			389 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import Code from "../services/code"
 | 
						|
class DetailsHighlighter {
 | 
						|
 | 
						|
    constructor(elem) {
 | 
						|
        this.elem = elem;
 | 
						|
        this.dealtWith = false;
 | 
						|
        elem.addEventListener('toggle', this.onToggle.bind(this));
 | 
						|
    }
 | 
						|
 | 
						|
    onToggle() {
 | 
						|
        if (this.dealtWith) return;
 | 
						|
 | 
						|
        Code.highlightWithin(this.elem);
 | 
						|
        this.dealtWith = true;
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
export default DetailsHighlighter; |