mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 20:26:56 -04:00
Process markdown on global level instead of line items
This commit is contained in:
parent
330adaaeb0
commit
3a30a527ed
@ -347,7 +347,7 @@ class Design extends BaseDesign
|
|||||||
|
|
||||||
$items = $this->transformLineItems($this->entity->line_items, $type);
|
$items = $this->transformLineItems($this->entity->line_items, $type);
|
||||||
|
|
||||||
$this->processMarkdownOnLineItems($items);
|
// $this->processMarkdownOnLineItems($items);
|
||||||
|
|
||||||
if (count($items) == 0) {
|
if (count($items) == 0) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
namespace App\Services\PdfMaker;
|
namespace App\Services\PdfMaker;
|
||||||
|
|
||||||
|
use League\CommonMark\CommonMarkConverter;
|
||||||
|
|
||||||
class PdfMaker
|
class PdfMaker
|
||||||
{
|
{
|
||||||
use PdfMakerUtilities;
|
use PdfMakerUtilities;
|
||||||
@ -36,6 +38,9 @@ class PdfMaker
|
|||||||
|
|
||||||
private $options;
|
private $options;
|
||||||
|
|
||||||
|
/** @var CommonMarkConverter */
|
||||||
|
protected $commonmark;
|
||||||
|
|
||||||
public function __construct(array $data)
|
public function __construct(array $data)
|
||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
@ -43,6 +48,10 @@ class PdfMaker
|
|||||||
if (array_key_exists('options', $data)) {
|
if (array_key_exists('options', $data)) {
|
||||||
$this->options = $data['options'];
|
$this->options = $data['options'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->commonmark = new CommonMarkConverter([
|
||||||
|
'allow_unsafe_links' => false,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function design(Design $design)
|
public function design(Design $design)
|
||||||
|
@ -91,6 +91,10 @@ trait PdfMakerUtilities
|
|||||||
foreach ($children as $child) {
|
foreach ($children as $child) {
|
||||||
$contains_html = false;
|
$contains_html = false;
|
||||||
|
|
||||||
|
if ($child['element'] !== 'script') {
|
||||||
|
$child['content'] = $this->commonmark->convertToHtml($child['content'] ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($child['content'])) {
|
if (isset($child['content'])) {
|
||||||
if (isset($child['is_empty']) && $child['is_empty'] === true) {
|
if (isset($child['is_empty']) && $child['is_empty'] === true) {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user