diff --git a/.editorconfig b/.editorconfig index e48297b..e4c8a7c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,5 +8,5 @@ indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true -[*.{yaml,yml}] +[*.{yaml,yml,md}] indent_size = 2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b6694d..d43785f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -30,33 +33,39 @@ 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 @@ -64,6 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - 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 @@ -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 --- diff --git a/EXTENDING.md b/EXTENDING.md index 09a493b..de3f347 100644 --- a/EXTENDING.md +++ b/EXTENDING.md @@ -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` @@ -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
-
-

{{ $title }}

-

{{ $message }}

-
+
+

{{ $title }}

+

{{ $message }}

+
``` @@ -109,4 +112,3 @@ public function boot() ``` That's it for extending the Nova EditorJS package! - diff --git a/README.md b/README.md index 701b338..ed1fa6c 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ composer require advoor/nova-editor-js ``` Publish the config file + ``` php artisan vendor:publish --provider="Advoor\NovaEditorJs\FieldServiceProvider" ``` @@ -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 | @@ -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 @@ -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) -* [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) +- [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/`. - The *Embeds* tool is triggered by pasting URLs to embeddable + The _Embeds_ tool is triggered by pasting URLs to embeddable content. It does not have an entry in the "Add" menu. ### Registering custom components diff --git a/UPGRADING.md b/UPGRADING.md index e713971..bdaff71 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -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 diff --git a/package.json b/package.json index 4cf74f4..661bd3e 100644 --- a/package.json +++ b/package.json @@ -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": { @@ -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" } }