PHP code example of maxeckel / livewire-editorjs

1. Go to this page and download the library: Download maxeckel/livewire-editorjs 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/ */

    

maxeckel / livewire-editorjs example snippets

 
protected $listeners = ['editorjs-save:editorId' => 'saveEditorState'];

public function saveEditorState($editorJsonData)
{
    $this->model->data = $editorJsonData;
}



return [
    'enabled_component_registration' => true,

    'component_name' => 'editorjs',

    // Sets the default placeholder to use when a new and empty Editor.js instance is created.
    'default_placeholder' => '',

    /*
     * Available options:
     *
     * VERBOSE	Show all messages (default)
     * INFO	Show info and debug messages
     * WARN	Show only warn messages
     * ERROR	Show only error messages
     *
     * Taken from the offical docs of Editor.js:
     * https://editorjs.io/configuration#log-level
     */
    'editorjs_log_level' => 'ERROR',

    // Defines on which disk images, uploaded through the editor, should be stored.
    'default_img_upload_disk' => 'public',

    // Defines on which disk images, downloaded by pasting an image url into the editor, should be stored.
    'default_img_download_disk' => 'public',
];




namespace App\Http\Livewire;

use Maxeckel\LivewireEditorjs\Http\Livewire\EditorJS;

class MyCustomEditor extends EditorJS
{
    // Put your custom code here
}
bash
php artisan vendor:publish --tag=livewire-editorjs:config
bash
php artisan vendor:publish --tag=livewire-editorjs:assets:compiled --force
json
{
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi",
            "@php artisan vendor:publish --tag=livewire-editorjs:assets:compiled --force"
        ]
    }
}
 php
<livewire:editorjs
   editor-id="myEditor"
   :value="$value" 
   upload-disk="public" 
   download-disk="public" 
   class="..." 
   style="..."
   :read-only="true"
   placeholder="Lorem ipsum dolor sit amet"
/>