Fields

Markdown

More information about the field can be found in the repository.

Based on the EasyMDE library.

Installation

To use the field, you need to install the package:

composer require moonshine/easymde

Basics

Inherits from Textarea.

* has the same capabilities.

use MoonShine\EasyMde\Fields\Markdown;
 
Markdown::make('Description')

Default Config

The Markdown field by default uses the most common settings, such as plugins, menu panel, and toolbar.

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 parameters to the configuration file that will apply to all Markdown fields.

return [
'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 the toolbar for the 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 parameters for the field.

addOption(string $name, string|int|float|bool|array $value)
Markdown::make('Description')
->addOption('toolbar', ['bold', 'italic', 'strikethrough', 'code', 'quote', 'horizontal-rule'])