mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			434 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			434 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
export const escapeHtml = (unsafe = '') => {
 | 
						|
  return unsafe
 | 
						|
    .replace(/&/g, '&')
 | 
						|
    .replace(/</g, '<')
 | 
						|
    .replace(/>/g, '>')
 | 
						|
    .replace(/"/g, '"')
 | 
						|
    .replace(/'/g, ''');
 | 
						|
};
 | 
						|
 | 
						|
export const afterSanitizeAttributes = currentNode => {
 | 
						|
  if ('target' in currentNode) {
 | 
						|
    currentNode.setAttribute('target', '_blank');
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
export const domPurifyConfig = {
 | 
						|
  hooks: {
 | 
						|
    afterSanitizeAttributes,
 | 
						|
  },
 | 
						|
};
 |