PHP code example of moonshine / tinymce

1. Go to this page and download the library: Download moonshine/tinymce library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

moonshine / tinymce example snippets


use MoonShine\TinyMce\Fields\TinyMce;


TinyMce::make('Description')

php artisan vendor:publish --tag="moonshine-tinymce-config"

'options' => [
    'forced_root_block' => 'div',
    'force_br_newlines' => true,
    'force_p_newlines' => false,
],

locale(string $locale)

TinyMce::make('Description')
    ->locale('ru');

plugins(array $plugins)

TinyMce::make('Description')
    ->plugins(['code', 'image', 'link', 'media', 'table'])

addPlugins(array $plugins)

TinyMce::make('Description')
    ->addPlugins(['wordcount'])

removePlugins(array $plugins)

TinyMce::make('Description')
    ->removePlugins(['autoresize'])

menubar(string|bool $menubar)

TinyMce::make('Description')
    ->menubar('file edit view')

toolbar(string|bool|array $toolbar)

TinyMce::make('Description')
    ->toolbar('file edit view')

addOption(string $name, string|int|float|bool|array $value)

TinyMce::make('Description')
    ->addOption('forced_root_block', 'div')


addCallback(string $name, string $value)

TinyMce::make('Description')
    ->addCallback('setup', '(editor) => console.log(editor)')

composer isan vendor:publish --tag=lfm_config
php artisan vendor:publish --tag=lfm_public

// config/lfm.php

'use_package_routes' => false,

use Illuminate\Support\Facades\Route;
use UniSharp\LaravelFilemanager\Lfm;

Route::prefix('laravel-filemanager')->group(function () {
    Lfm::routes();
});

public function boot()
{
    // ...

    $this->routes(function () {
        // ...

        Route::middleware('moonshine')
            ->namespace($this->namespace)
            ->group(base_path('routes/moonshine.php'));
    });
}

use MoonShine\Laravel\Http\Middleware\Authenticate;

// ...

public function boot()
{
    // ...

    $this->routes(function () {
        // ...

        Route::middleware(['moonshine', Authenticate::class])
            ->namespace($this->namespace)
            ->group(base_path('routes/moonshine.php'));
    });
}

TinyMce::make('Description')
    ->addOptions([
        'file_manager' => 'laravel-filemanager',
    ])

'options' => [
    'file_manager' => 'laravel-filemanager',
],