mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-26 20:22:18 +00:00
Moved decode and updated page plaintext decode test
This commit is contained in:
parent
44f3508171
commit
31eec34b5d
@ -25,7 +25,7 @@ class PageContent
|
|||||||
public function setNewHTML(string $html)
|
public function setNewHTML(string $html)
|
||||||
{
|
{
|
||||||
$this->page->html = $this->formatHtml($html);
|
$this->page->html = $this->formatHtml($html);
|
||||||
$this->page->text = html_entity_decode($this->toPlainText());
|
$this->page->text = $this->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +108,7 @@ class PageContent
|
|||||||
protected function toPlainText(): string
|
protected function toPlainText(): string
|
||||||
{
|
{
|
||||||
$html = $this->render(true);
|
$html = $this->render(true);
|
||||||
return strip_tags($html);
|
return html_entity_decode(strip_tags($html));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -312,10 +312,10 @@ class PageContentTest extends TestCase
|
|||||||
$this->actingAs($this->getAdmin())
|
$this->actingAs($this->getAdmin())
|
||||||
->put($page->getUrl(''), [
|
->put($page->getUrl(''), [
|
||||||
'name' => 'Testing',
|
'name' => 'Testing',
|
||||||
'html' => '<p>Hello & welcome</p>',
|
'html' => '<p>"Hello & welcome"</p>',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$page->refresh();
|
$page->refresh();
|
||||||
$this->assertEquals('Hello & welcome', $page->text);
|
$this->assertEquals('"Hello & welcome"', $page->text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user