moonshine / easymde
Markdown editor for MoonShine
1.0.0
2024-10-12 06:37 UTC
Requires
- php: ^8.2|^8.3
- ext-curl: *
- ext-json: *
Requires (Dev)
- moonshine/moonshine: ^3.0
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.0.1
- rector/rector: ^1.0
Conflicts
- moonshine/moonshine: <3.0.0
This package is auto-updated.
Last update: 2024-10-20 06:36:15 UTC
README
Extends Textarea and has the same features
Compatibility
Installation
composer require moonshine/easymde
Usage
use MoonShine\EasyMde\Fields\Markdown; // ... Markdown::make('Description')
Default config
Markdown
field uses the most common settings such as plugins, menubar and toolbar by default
To change the default settings, you need to publish the configuration file:
php artisan vendor:publish --tag="moonshine-easymde-config"
You can also add additional options to the configuration file that will apply to all Markdown
fields
'previewClass' => ['prose', 'dark:prose-invert'], 'forceSync' => true, 'spellChecker' => false, 'status' => false, 'toolbar' => [ 'bold', 'italic', 'strikethrough', 'code', 'quote', 'horizontal-rule', '|', 'heading-1', 'heading-2', 'heading-3', '|', 'table', 'unordered-list', 'ordered-list', '|', 'link', 'image', '|', 'preview', 'side-by-side', 'fullscreen', '|', 'guide', ],
Toolbar
The toolbar()
method allows you to completely override toolbar for a field
toolbar(string|bool|array $toolbar)
Markdown::make('Description') ->toolbar(['bold', 'italic', 'strikethrough', 'code', 'quote', 'horizontal-rule'])
Options
The addOption()
method allows you to add additional options for a field
addOption(string $name, string|int|float|bool|array $value)
Markdown::make('Description') ->addOption('toolbar', ['bold', 'italic', 'strikethrough', 'code', 'quote', 'horizontal-rule'])