Skip to content

Commit

Permalink
Added Prettier for consistent Markdown files
Browse files Browse the repository at this point in the history
  • Loading branch information
roelofr committed Sep 25, 2022
1 parent d066031 commit 64b7471
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{yaml,yml}]
[*.{yaml,yml,md}]
indent_size = 2
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.1.0]

### Added

- Guzzle is now a dependency of this project.
- Added `php-cs-fixer` for code standards.
- Added `php-parallel-lint` to ensure all files are actually valid PHP code.
- Added `pretttier` for consistent Markdown files.
- Added RTL support (`editorSettings.rtl`)

### Changed

- Improved image upload handling, using Laravel-native libraries
- Improved link metadata retrieval, using Laravel-native libraries

Expand All @@ -30,40 +33,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.0.5]

### Fixed

- When no changes are made to the editor, the value is left as-is, instead of double-encoding it (thanks @waelelsawy)
- Templates for `list`', `paragraph` and `table` to use raw-html statements on cleaned fields.

## [3.0.4]

### Fixed

- NovaEditorJsCast now properly handles JSON, not double-encoding stuff and decoding double-encoded properties.

## [3.0.3]

### 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
- `NovaEditorJsData` model to store JSON data and allow easy HTML conversion
- `NovaEditorJsCast` to easily convert between raw data and the `NovaEditorJsData` model
- JS linter, EditorConfig and other tools for better development

### Changed

- **PHP version requirements changed**, now requires PHP 8.1 or higher
- `NovaEditorJs` facade for better separation of concerns
- Improved README and separated extending docs to separate file
Expand All @@ -73,24 +83,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- More robust conversion between the model data and the Nova editor field

## Deprecated

- `NovaEditorJs::make`, use `NovaEditorJsField::make` instead

## [2.0.3] - 2020-12-07

### Fixed

- Fix for Amazon S3 file support (#49)

## [2.0.2] - 2020-11-29

### Changed

- Reduced minimum height of editor (#47)

### Fixed

- Fix for when using an S3 disk (#46)

## [2.0.0] - 2020-08-03

### Added

- Added support for extending the EditorJS field with custom plugins

---
Expand Down
38 changes: 20 additions & 18 deletions EXTENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,28 @@ The second step allows you to create a blade view file and pass it to the field
* fetch any value that is contained in your laravel config file from there.
*/
NovaEditorJS.booting(function (editorConfig, fieldConfig) {
if (fieldConfig.toolSettings.warning.activated === true) {
editorConfig.tools.warning = {
class: require('@editorjs/warning'),
shortcut: fieldConfig.toolSettings.warning.shortcut,
config: {
titlePlaceholder: fieldConfig.toolSettings.warning.titlePlaceholder,
messagePlaceholder: fieldConfig.toolSettings.warning.messagePlaceholder,
},
}
}
if (fieldConfig.toolSettings.warning.activated === true) {
editorConfig.tools.warning = {
class: require("@editorjs/warning"),
shortcut: fieldConfig.toolSettings.warning.shortcut,
config: {
titlePlaceholder: fieldConfig.toolSettings.warning.titlePlaceholder,
messagePlaceholder: fieldConfig.toolSettings.warning.messagePlaceholder,
},
};
}
});
```

`webpack.mix.js`

```js
const mix = require('laravel-mix');
const mix = require("laravel-mix");

mix.js('resources/js/editor-js-plugins/warning.js', 'public/js/editor-js-plugins/warning.js');
mix.js(
"resources/js/editor-js-plugins/warning.js",
"public/js/editor-js-plugins/warning.js"
);
```

`app/Providers/NovaServiceProvider.php`
Expand Down Expand Up @@ -78,14 +81,14 @@ return [

`resources/views/editorjs/warning.blade.php`

*CSS classes taken from [here](https://github.com/editor-js/warning/blob/master/src/index.css).*
_CSS classes taken from [here](https://github.com/editor-js/warning/blob/master/src/index.css)._

```html
<div class="editor-js-block">
<div class="cdx-warning">
<h3 class="cdx-warning__title">{{ $title }}</h3>
<p class="cdx-warning__message">{{ $message }}</p>
</div>
<div class="cdx-warning">
<h3 class="cdx-warning__title">{{ $title }}</h3>
<p class="cdx-warning__message">{{ $message }}</p>
</div>
</div>
```

Expand All @@ -109,4 +112,3 @@ public function boot()
```

That's it for extending the Nova EditorJS package!

31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ composer require advoor/nova-editor-js
```

Publish the config file

```
php artisan vendor:publish --provider="Advoor\NovaEditorJs\FieldServiceProvider"
```
Expand All @@ -24,7 +25,7 @@ Laravel Nova 4.x isn't backwards compatible with 3.x, so we had to make a versio
Please use the below table to find which versions are suitable for your installation.

| Package version | Nova Version | Laravel Version | PHP version |
|-----------------|--------------|-----------------|-------------|
| --------------- | ------------ | --------------- | ----------- |
| `3.x` | 4.x | 8.x - 9.x | 8.1+ |
| `2.x` | 2.x - 3.x | 5.x - 8.x | 5.6 - 7.4 |

Expand Down Expand Up @@ -117,7 +118,7 @@ From the config, you can define the following editor settings:
- `placeholder` ([docs][placeholder-docs]) - The placeholder to show in an empty editor
- `defaultBlock` ([docs][defaultblock-docs]) - The block that's used by default
- `autofocus` ([docs][autofocus-docs]) - If the editor should auto-focus, only use if you never have multiple editors on a page and after considering the
[accessibility implications][autofocus-accessibility]
[accessibility implications][autofocus-accessibility]
- `rtl` ([docs][rtl-docs]) - Set to true to enable right-to-left mode, for languages like Arabic and Hebrew

[placeholder-docs]: https://editorjs.io/configuration#placeholder
Expand All @@ -128,22 +129,22 @@ From the config, you can define the following editor settings:

Furthermore, you can customize the tools the editor should use. The following tools are enabled by default:

* [Header](https://github.com/editor-js/header)
* [Image](https://github.com/editor-js/image)
* [Link](https://github.com/editor-js/link)
* [List](https://github.com/editor-js/list)
* [Code block](https://github.com/editor-js/code)
* [Inline code](https://github.com/editor-js/inline-code)
* [Checklist](https://github.com/editor-js/checklist)
* [Marker](https://github.com/editor-js/marker)
* [Embeds](https://github.com/editor-js/embed)<sup>†</sup>
* [Delimiter](https://github.com/editor-js/delimiter)
* [Table](https://github.com/editor-js/table)
* [Raw](https://github.com/editor-js/raw)
- [Header](https://github.com/editor-js/header)
- [Image](https://github.com/editor-js/image)
- [Link](https://github.com/editor-js/link)
- [List](https://github.com/editor-js/list)
- [Code block](https://github.com/editor-js/code)
- [Inline code](https://github.com/editor-js/inline-code)
- [Checklist](https://github.com/editor-js/checklist)
- [Marker](https://github.com/editor-js/marker)
- [Embeds](https://github.com/editor-js/embed)<sup>†</sup>
- [Delimiter](https://github.com/editor-js/delimiter)
- [Table](https://github.com/editor-js/table)
- [Raw](https://github.com/editor-js/raw)

You can customize the views for each component, by changing the view in `resources/views/vendor/nova-editor-js/`.

<sup>†</sup> The *Embeds* tool is triggered by pasting URLs to embeddable
<sup>†</sup> The _Embeds_ tool is triggered by pasting URLs to embeddable
content. It does not have an entry in the "Add" menu.

### Registering custom components
Expand Down
2 changes: 1 addition & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The changes are somewhat backwards compatible, but you're advices to quickly fix

## From 1.x to 2.x

*No significant changes written down.*
_No significant changes written down._

## From 0.4 to 1.x

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix build --production",
"format": "eslint --fix resources/js/**/*.{js,vue} *.js",
"format": "eslint --fix resources/js/**/*.{js,vue} *.js && prettier --write *.md",
"nova:install": "npm --prefix='./vendor/laravel/nova' ci"
},
"dependencies": {
Expand All @@ -34,6 +34,7 @@
"eslint-plugin-vue": "^9.1.0",
"laravel-mix": "^6.0.44",
"postcss": "^8.4.14",
"prettier": "^2.7.1",
"vue-loader": "^16.8.3"
}
}

0 comments on commit 64b7471

Please sign in to comment.