Skip to content

Releases: tonysm/rich-text-laravel

1.4.0

09 Feb 01:30
64f59ea

Choose a tag to compare

Changelog

  • CHANGED: Laravel 9 support
  • CHANGED: Bumps the tonysm/globalid-laravel package to ^1.1.0

1.3.0

29 Jan 01:45
27a149b

Choose a tag to compare

Changelog

  • NEW: There's a new Content::attachables() method which allows pulling all the attachables of a document right away without having to pluck them out of the attachaments. Previously: $message->content->attachments()->pluck('attachable'), Now: $message->content->attachables(). PR: #20
  • NEW: Attachments now have a toHtml(): string method which allows for easily rendering them. We can now do Attachment::fromAttachable($user)->toHtml() which renders the <rich-text-attachment> tag. Same PR as above: #20

Here's an example of how we can use the Attachment->toHtml() method to parse the document and create attachments from the backend:

class Message extends Model
{
  public static function booted()
  {
    static::creating(function (Message $message) {
      // Scan the document looking for @-mentions and replace them
      // with a `<rich-text-attachment>` for the mentioned user...

      $message->content = preg_replace_callback(
        '/\B\@(\w+)/',
        function ($matches) {
          if ($user = User::where('username', $matches[1])->first()) {
            return Attachment::fromAttachable($user)->toHtml();
          }

          return $matches[0];
        },
        $message->content->toHtml(),
      );
    });
  }
}

1.2.0

29 Oct 01:28
60fa2c1

Choose a tag to compare

Changelog

  • NEW: Better handles deeply nested lists and lists inside lists
  • CHANGED: [internal] Most of the methods of the plain text converter were supposed to be private. This is technically BC, but I don't think it was worth a major version.

1.1.0

27 Oct 01:56
7f1354e

Choose a tag to compare

Changelog

  • NEW: Added basic support for non-image file attachments. Now, users can attach .txt, .pdf, .doc, .csv, etc. in the same way as the basic image upload example (in fact, using the same code). PR #17

1.0.2

20 Oct 02:34
acb62ad

Choose a tag to compare

Changelog

  • FIXED: Fixes emoji rendering. #14
  • CHANGED: Replace the windows-latest test matrix with macos-latest. Tests were failing on Windows for encoding reasons and I just don't have the bandwidth to fix it. Users can still consume the package there using WSL2, I think.

1.0.1

20 Oct 02:32
ee4ef14

Choose a tag to compare

Changelog

  • FIXED: Fixes the installer by using ensureDirectoryExists() (which is idempotent) instead of mkdir() (which fails when dir already exists)

1.0.0

16 Sep 00:01
7a8bb29

Choose a tag to compare

Official 1.0.0 release! 🎉🎉🎉

Changelog

  • CHANGED: Bumped the tonysm/globalid-laravel to 1.0.0

1.0.0-RC1

07 Sep 01:33
1baa7a3

Choose a tag to compare

Changelog

  • NEW: Bumps the tonysm/globalid-laravel package to RC1, which brings support for Eloquent's Custom Polymorphic Types.

1.0.0-BETA

31 Aug 02:01

Choose a tag to compare

First beta release.

0.0.3

14 Aug 19:52
439b578

Choose a tag to compare

Changelog

  • CHANGED: more documentation (see the README.md)
  • NEW: the package now recommends keeping the rich text content outside of the main entity on its own rich_texts table, which uses the new RichText polymorphic model that the package ships with. The behavior is documented at the The RichText Model section on the readme. The old behavior of using the custom cast directly still works (in fact, the RichText model uses that same approach). You can find more about this in the PR and in the RFC issue.