mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 01:17:30 -05:00 
			
		
		
		
	Fixes for parsing markdown in pdf tables
This commit is contained in:
		
							parent
							
								
									5897a4e749
								
							
						
					
					
						commit
						35c80583c4
					
				@ -382,22 +382,23 @@ document.addEventListener('DOMContentLoaded', function() {
 | 
				
			|||||||
        return $converter->convertToHtml($markdown);
 | 
					        return $converter->convertToHtml($markdown);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function processMarkdownOnLineItems(array &$items): void
 | 
					    // public function processMarkdownOnLineItems(array &$items): void
 | 
				
			||||||
    {
 | 
					    // {
 | 
				
			||||||
        foreach ($items as $key => $item) {
 | 
					    //     foreach ($items as $key => $item) {
 | 
				
			||||||
            foreach ($item as $variable => $value) {
 | 
					    //         foreach ($item as $variable => $value) {
 | 
				
			||||||
                $item[$variable] = DesignHelpers::parseMarkdownToHtml($value ?? '');
 | 
					    //             $item[$variable] = DesignHelpers::parseMarkdownToHtml($value ?? '');
 | 
				
			||||||
            }
 | 
					    //         }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $items[$key] = $item;
 | 
					    //         $items[$key] = $item;
 | 
				
			||||||
        }
 | 
					    //     }
 | 
				
			||||||
    }
 | 
					    // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function processNewLines(array &$items): void
 | 
					    public function processNewLines(array &$items): void
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        foreach ($items as $key => $item) {
 | 
					        foreach ($items as $key => $item) {
 | 
				
			||||||
            foreach ($item as $variable => $value) {
 | 
					            foreach ($item as $variable => $value) {
 | 
				
			||||||
                $item[$variable] = nl2br($value);
 | 
					               // $item[$variable] = nl2br($value, true);
 | 
				
			||||||
 | 
					               $item[$variable] = str_replace( "\n", '<br>', $value);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $items[$key] = $item;
 | 
					            $items[$key] = $item;
 | 
				
			||||||
 | 
				
			|||||||
@ -51,6 +51,7 @@ class PdfMaker
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $this->commonmark = new CommonMarkConverter([
 | 
					        $this->commonmark = new CommonMarkConverter([
 | 
				
			||||||
            'allow_unsafe_links' => false,
 | 
					            'allow_unsafe_links' => false,
 | 
				
			||||||
 | 
					            // 'html_input' => 'allow',
 | 
				
			||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -92,7 +92,9 @@ trait PdfMakerUtilities
 | 
				
			|||||||
            $contains_html = false;
 | 
					            $contains_html = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($child['element'] !== 'script') {
 | 
					            if ($child['element'] !== 'script') {
 | 
				
			||||||
                if (array_key_exists('process_markdown', $this->data) && $this->data['process_markdown']) {
 | 
					                if (array_key_exists('process_markdown', $this->data) && array_key_exists('content', $child) && $this->data['process_markdown']) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    $child['content'] = str_replace("<br>", "\r", $child['content']);
 | 
				
			||||||
                    $child['content'] = $this->commonmark->convertToHtml($child['content'] ?? '');
 | 
					                    $child['content'] = $this->commonmark->convertToHtml($child['content'] ?? '');
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -44,7 +44,6 @@
 | 
				
			|||||||
        "eway/eway-rapid-php": "^1.3",
 | 
					        "eway/eway-rapid-php": "^1.3",
 | 
				
			||||||
        "fakerphp/faker": "^1.14",
 | 
					        "fakerphp/faker": "^1.14",
 | 
				
			||||||
        "fideloper/proxy": "^4.2",
 | 
					        "fideloper/proxy": "^4.2",
 | 
				
			||||||
        "firebase/php-jwt": "^5",
 | 
					 | 
				
			||||||
        "fruitcake/laravel-cors": "^2.0",
 | 
					        "fruitcake/laravel-cors": "^2.0",
 | 
				
			||||||
        "gocardless/gocardless-pro": "^4.12",
 | 
					        "gocardless/gocardless-pro": "^4.12",
 | 
				
			||||||
        "google/apiclient": "^2.7",
 | 
					        "google/apiclient": "^2.7",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user