mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	Add filters for toMarkdown to paste data to compose-box.
This fixes bugs with pasting headings and italic styling. Fixes #7485.
This commit is contained in:
		@@ -141,7 +141,24 @@ function copy_handler() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.paste_handler_converter = function (paste_html) {
 | 
			
		||||
    var markdown_html = toMarkdown(paste_html);
 | 
			
		||||
    var converters = {
 | 
			
		||||
        converters: [
 | 
			
		||||
            {
 | 
			
		||||
                filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
 | 
			
		||||
                replacement: function (content) {
 | 
			
		||||
                    return content;
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
            {
 | 
			
		||||
                filter: ['em', 'i'],
 | 
			
		||||
                replacement: function (content) {
 | 
			
		||||
                    return '*' + content + '*';
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
        ],
 | 
			
		||||
    };
 | 
			
		||||
    var markdown_html = toMarkdown(paste_html, converters);
 | 
			
		||||
 | 
			
		||||
    // Now that we've done the main conversion, we want to remove
 | 
			
		||||
    // any HTML tags that weren't converted to markdown-style
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user