diff --git a/CHANGELOG.md b/CHANGELOG.md
index df1786b..06c66a3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+3.14.2
+======
+
+* (improvement) Widen support for tags in TipTaps HTML to rich text transformer
+
+
3.14.1
======
diff --git a/src/RichText/HtmlToRichTextTransformer.php b/src/RichText/HtmlToRichTextTransformer.php
index 2a65677..dfa4854 100644
--- a/src/RichText/HtmlToRichTextTransformer.php
+++ b/src/RichText/HtmlToRichTextTransformer.php
@@ -3,6 +3,12 @@
namespace Torr\Storyblok\RichText;
use Tiptap\Editor;
+use Tiptap\Extensions\StarterKit;
+use Tiptap\Marks\Highlight;
+use Tiptap\Marks\Link;
+use Tiptap\Marks\Subscript;
+use Tiptap\Marks\Superscript;
+use Tiptap\Marks\Underline;
use Tiptap\Nodes\BulletList;
use Tiptap\Nodes\CodeBlock;
use Tiptap\Nodes\HardBreak;
@@ -21,7 +27,18 @@ final class HtmlToRichTextTransformer
*/
public function __construct ()
{
- $this->editor = new Editor();
+ $this->editor = new Editor([
+ "extensions" => [
+ new StarterKit(),
+ new Link(),
+ new Highlight([
+ "multicolor" => true,
+ ]),
+ new Superscript(),
+ new Subscript(),
+ new Underline(),
+ ],
+ ]);
}
/**
diff --git a/tests/RichText/HtmlToRichTextTransformerTest.php b/tests/RichText/HtmlToRichTextTransformerTest.php
index 5a34bf4..ddf2841 100644
--- a/tests/RichText/HtmlToRichTextTransformerTest.php
+++ b/tests/RichText/HtmlToRichTextTransformerTest.php
@@ -30,6 +30,22 @@ public function testBasic () : void
Heading 4
Heading 5
Heading 6
+ Text with
+ bold 1
+ bold 2
+ italic 1
+ italic 2
+ External Link
+ Link
+ highlight
+ highlight with color
+ superscript
+ subscript
+ underline
+
+ code
+
+
HTML;
// use assertSame() as the order is important
@@ -155,6 +171,121 @@ public function testBasic () : void
],
],
],
+ [
+ "type" => "paragraph",
+ "content" => [
+ [
+ "type" => "text",
+ "text" => "Text with\n",
+ ],
+ [
+ "type" => "text",
+ "text" => "bold 1",
+ "marks" => [
+ ["type" => "bold"],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "bold 2",
+ "marks" => [
+ ["type" => "bold"],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "italic 1",
+ "marks" => [
+ ["type" => "italic"],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "italic 2",
+ "marks" => [
+ ["type" => "italic"],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "External Link",
+ "marks" => [
+ [
+ "type" => "link",
+ "attrs" => [
+ "href" => "/test",
+ "target" => "_blank",
+ ],
+ ],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "Link",
+ "marks" => [
+ [
+ "type" => "link",
+ "attrs" => [
+ "href" => "/test",
+ ],
+ ],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "highlight",
+ "marks" => [
+ ["type" => "highlight"],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "highlight with color",
+ "marks" => [
+ [
+ "type" => "highlight",
+ "attrs" => [
+ "color" => "#ef2b7c",
+ ],
+ ],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "superscript",
+ "marks" => [
+ ["type" => "superscript"],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "subscript",
+ "marks" => [
+ ["type" => "subscript"],
+ ],
+ ],
+ [
+ "type" => "text",
+ "text" => "underline",
+ "marks" => [
+ ["type" => "underline"],
+ ],
+ ],
+ [
+ "type" => "hard_break",
+ ],
+ [
+ "type" => "text",
+ "text" => "code",
+ "marks" => [
+ ["type" => "code"],
+ ],
+ ],
+ ],
+ ],
+ [
+ "type" => "horizontal_rule",
+ ],
],
], $transformer->parseHtmlToRichText($html));
}