Skip to content

Commit

Permalink
Merge PR #68 - Fix NovaEditorJsData constructor issues
Browse files Browse the repository at this point in the history
Kind of a breaking bug, so merging this without reviews.
  • Loading branch information
roelofr committed Jul 17, 2022
2 parents b6f5dfa + 13d8d8d commit 8be8b21
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED]

### Fixed
- Constructor of `NovaEditorJsData` now accepts null values and non-iterables.
- PHPDoc return type of `NovaEditorJsData::toHtml()`.

## [3.0.2]

### Added
- Support for `spatie/image` version 2.x.

## [3.0.1]

### Fixed
- `composer.json` didn't require PHP 8.1+, but the codebase did.

## [3.0.0]

### Added
- Nova 4 support
- `NovaEditorJsConverter` to split HTML conversion from the Nova Field
Expand Down Expand Up @@ -48,7 +64,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

For older changes before v2.0.0, please see the [releases page](https://github.com/advoor/nova-editor-js/releases).

[unreleased]: https://github.com/advoor/nova-editor-js/compare/v2.0.3..master
[unreleased]: https://github.com/advoor/nova-editor-js/compare/v3.0.2..master
[3.0.2]: https://github.com/advoor/nova-editor-js/releases/v3.0.2
[3.0.1]: https://github.com/advoor/nova-editor-js/releases/v3.0.1
[3.0.0]: https://github.com/advoor/nova-editor-js/releases/v3.0.0
[2.0.3]: https://github.com/advoor/nova-editor-js/releases/v2.0.3
[2.0.2]: https://github.com/advoor/nova-editor-js/releases/v2.0.2
[2.0.0]: https://github.com/advoor/nova-editor-js/releases/v2.0.0
7 changes: 6 additions & 1 deletion src/NovaEditorJsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Advoor\NovaEditorJs\NovaEditorJs;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Arr;
use Illuminate\Support\Fluent;
use Stringable;

Expand All @@ -22,13 +23,17 @@ public function __construct($attributes = [])
$attributes = json_decode($attributes);
}

if (! is_iterable($attributes)) {
$attributes = Arr::wrap($attributes);
}

foreach ($attributes as $key => $value) {
$this->attributes[$key] = $value;
}
}

/**
* @return \Advoor\NovaEditorJs\HtmlString
* @return \Illuminate\Support\HtmlString
*/
public function toHtml()
{
Expand Down

0 comments on commit 8be8b21

Please sign in to comment.