]> BookStack Code Mirror - bookstack/blobdiff - app/Util/HtmlDocument.php
Tests: Updated comment test to account for new editor usage
[bookstack] / app / Util / HtmlDocument.php
index f0e12d52864a90a808b3959b4ba7283dc0c2e0c5..7517955b9f60b2e14afbd91fddb7123fc9fb2095 100644 (file)
@@ -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);
     }
 
     /**