diff --git a/CHANGELOG.md b/CHANGELOG.md index d1bf5d6..0c264f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.2.2 (2021-10-18) + +- [fix] Fix compatibility with the newly renamed Bard Mutator + ## 1.2.1 (2021-10-18) - [fix] Don't add blank class attributes to regular paragraphs diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 62c645e..376d765 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -5,7 +5,6 @@ use Statamic\Statamic; use Statamic\Fieldtypes\Bard\Augmentor; use Composer\InstalledVersions; -use JackSleight\BardMutator\Facades\Mutator; class ServiceProvider extends AddonServiceProvider { @@ -25,16 +24,28 @@ public function boot() 'bard-paragraph-style' => config('bard-paragraph-style'), ]); - if (InstalledVersions::isInstalled('jacksleight/bard-mutator')) { + if (InstalledVersions::isInstalled('jacksleight/statamic-bard-mutator')) { + $this->bootStatamicBardMutator(); + } else if (InstalledVersions::isInstalled('jacksleight/bard-mutator')) { $this->bootBardMutator(); } else { $this->bootStandalone(); } } + protected function bootStatamicBardMutator() + { + \JackSleight\StatamicBardMutator\Facades\Mutator::node('paragraph', function ($tag, $node) { + if (isset($node->attrs->class)) { + $tag[0]['attrs']['class'] = $node->attrs->class; + } + return $tag; + }); + } + protected function bootBardMutator() { - Mutator::node('paragraph', function ($tag, $node) { + \JackSleight\BardMutator\Facades\Mutator::node('paragraph', function ($tag, $node) { if (isset($node->attrs->class)) { $tag[0]['attrs']['class'] = $node->attrs->class; }