From c0cd90fcc7ffaf4cd4a0687ae01c9bc62a9fa45d Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Wed, 5 May 2021 14:21:53 -0400 Subject: [PATCH] Revert c5a32c7 PR #3648 was merged without noticing it was targeting the wrong branch. --- src/Fieldtypes/Bard/Augmentor.php | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/Fieldtypes/Bard/Augmentor.php b/src/Fieldtypes/Bard/Augmentor.php index 9ceabfafef..2f47e702b4 100644 --- a/src/Fieldtypes/Bard/Augmentor.php +++ b/src/Fieldtypes/Bard/Augmentor.php @@ -19,8 +19,6 @@ class Augmentor protected static $customMarks = []; protected static $customNodes = []; - protected static $replaceMarks = []; - protected static $replaceNodes = []; public function __construct($fieldtype) { @@ -94,21 +92,12 @@ protected function addSetIndexes($value) public function convertToHtml($value) { - $renderer = (new Renderer) + return (new Renderer) ->replaceNode(DefaultImageNode::class, CustomImageNode::class) ->addNode(SetNode::class) ->addNodes(static::$customNodes) - ->addMarks(static::$customMarks); - - foreach (static::$replaceNodes as $searchNode => $replaceNode) { - $renderer->replaceNode($searchNode, $replaceNode); - } - - foreach (static::$replaceMarks as $searchMark => $replaceMark) { - $renderer->replaceMark($searchMark, $replaceMark); - } - - return $renderer->render(['type' => 'doc', 'content' => $value]); + ->addMarks(static::$customMarks) + ->render(['type' => 'doc', 'content' => $value]); } public static function addNode($node) @@ -121,16 +110,6 @@ public static function addMark($mark) static::$customMarks[] = $mark; } - public static function replaceNode($searchNode, $replaceNode) - { - static::$replaceNodes[$searchNode] = $replaceNode; - } - - public static function replaceMark($searchMark, $replaceMark) - { - static::$replaceMarks[$searchMark] = $replaceMark; - } - protected function convertToSets($html) { $arr = preg_split('/(index-\d+<\/set>)/', $html, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);