X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/db7b11fe933b6f9b9962aec18f45a74b56458db5..refs/pull/5689/head:/app/Util/HtmlDocument.php diff --git a/app/Util/HtmlDocument.php b/app/Util/HtmlDocument.php index f0e12d528..7517955b9 100644 --- a/app/Util/HtmlDocument.php +++ b/app/Util/HtmlDocument.php @@ -6,6 +6,7 @@ use DOMDocument; use DOMElement; use DOMNode; use DOMNodeList; +use DOMText; use DOMXPath; /** @@ -81,6 +82,14 @@ class HtmlDocument return $element; } + /** + * Create a new text node within this document. + */ + public function createTextNode(string $text): DOMText + { + return $this->document->createTextNode($text); + } + /** * Get an element within the document of the given ID. */ @@ -125,7 +134,7 @@ class HtmlDocument */ public function getHtml(): string { - return $this->document->saveHTML(); + return $this->document->saveHTML($this->document->documentElement); } /**