Skip to content

Commit

Permalink
Update TextBuilder.php
Browse files Browse the repository at this point in the history
  • Loading branch information
kawax committed Nov 21, 2024
1 parent 4137f63 commit 168bd1f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/RichText/TextBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 @)
Expand Down Expand Up @@ -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 [
Expand Down

0 comments on commit 168bd1f

Please sign in to comment.