Releases: tonysm/rich-text-laravel
3.2.1
What's Changed
- feat: add safety migration rollback on rich_texts table by @kresnasatya in #60
New Contributors
- @kresnasatya made their first contribution in #60
Full Changelog: 3.2.0...3.2.1
3.2.0
3.1.0
3.0.0
What's Changed
Full Changelog: 2.2.0...3.0.0
Upgrade Guide
In 2.2.0 we introduced a new recommended way to encrypt data, which uses Laravel's Crypt::encryptString()
instead of Crypt::encrypt()
. This is now the default in v3. If you're migrating from 2.x and have existing data stored encrypted, but not using the recommendation in the 2.2.0 release note, you must migrate them (see instructions below).
Migrating Existing Encrypted Data
If you only have encrypted rich text attributes in your application, you may create a new migration and loop through the stored data, encrypting and decrypting it:
DB::table('rich_texts')->whereNotNull('body')->eachById(function ($richText) {
DB::table('rich_texts')
->where('id', $richText->id)
->update([
'body' => Crypt::encryptString(Crypt::decrypt($richText->body)),
]);
});
If you have a mix of encrypted and plain text rich text attributes, you will have to check if the $richText->field
and $richText->record_type
fields match the entities and attribute that are using encryption:
DB::table('rich_texts')
->whereNotNull('body')
->where('field', 'content')
->where('record_type', (new Post())->getMorphClass())
->eachById(function ($richText) {
DB::table('rich_texts')
->where('id', $richText->id)
->update([
'body' => Crypt::encryptString(Crypt::decrypt($richText->body)),
]);
});
2.2.0
What's Changed
Full Changelog: 2.1.0...2.2.0
Upgrade Guide
It's now recommended that you add a RichTextLaravel::encryptAsString()
to your AppServiceProvider::boot
method. If you have existing data stored encrypted, you'll have to migrate them manually (see instructions below). This is an opt-in feature, but it's highly recommended to store encrypted rich text attributes as string (the default way will serialize the value before encrypting, which is not needed).
In the next major version, we'll switch to encrypt as string by default.
Migrating Existing Encrypted Data
If you only have encrypted rich text attributes in your application, you may create a new migration and loop through the stored data, encrypting and decrypting it:
DB::table('rich_texts')->whereNotNull('body')->eachById(function ($richText) {
DB::table('rich_texts')
->where('id', $richText->id)
->update([
'body' => Crypt::encryptString(Crypt::decrypt($richText->body)),
]);
});
Make sure you add the RichTextLaravel::encryptAsString()
to your AppServiceProvider::boot
method.
If you have a mix of encrypted and plain text rich text attributes, you will have to check if the $richText->field
and $richText->record_type
fields match the entities and attribute that are using encryption:
DB::table('rich_texts')
->whereNotNull('body')
->where('field', 'content')
->where('record_type', (new Post())->getMorphClass())
->eachById(function ($richText) {
DB::table('rich_texts')
->where('id', $richText->id)
->update([
'body' => Crypt::encryptString(Crypt::decrypt($richText->body)),
]);
});
2.1.0
What's Changed
- Laravel 11.x Compatibility by @laravel-shift in #47
New Contributors
- @laravel-shift made their first contribution in #47
Full Changelog: 2.0.3...2.1.0
2.0.3
2.0.2
2.0.1
2.0.0
What's Changed
- Tweaks the Install command, published component, and rename attribute by @tonysm in #36
- Adds Workbench by @tonysm in #37
- Model Touching by @tonysm in #39
- New Sanitization Example by @tonysm in #40
- Adds Livewire Example by @tonysm in #41
- Support encrypting content by @tonysm in #38
Full Changelog: 1.7.0...2.0.0
Upgrade Guide
A few things changed from v1. There are some breaking changes, but most are renamings.
Rename the Rich Text Property
Rename all your $richTextFields
properties to $richTextAttributes
on all your models using it
Rename the Styles Component
Rename the <x-rich-text-trix-styles />
to <x-rich-text::styles />
Rename the Published Trix Input Component
Rename the <x-trix-field />
to <x-trix-input />
(both the file and its usages)