diff --git a/src/RichText/TextBuilder.php b/src/RichText/TextBuilder.php index 99175886..22f7f3c2 100644 --- a/src/RichText/TextBuilder.php +++ b/src/RichText/TextBuilder.php @@ -45,12 +45,11 @@ public static function make(string $text = ''): static * $post = Post::create($builder->text, $builder->facets); * ``` * ``` - * // You can add more facets after detectFacets(). * $post = Post::build(function (TextBuilder $builder) { * $builder->text('[at]alice.test test https://example.com #alice') * ->detectFacets() * ->newLine() - * ->tag('#bob', 'bob'); + * ->tag('#bob', 'bob');// Add more facets after detectFacets(). * }); * ``` * ([at] should be written as @) @@ -154,6 +153,16 @@ public function facet(array $facet): static return $this; } + /** + * Remove all Facets. + */ + public function resetFacets(): static + { + $this->facets = []; + + return $this; + } + private function buildFacetIndex(string $text): array { return [