PHP code example of xetaio / xetaravel-editor-md

1. Go to this page and download the library: Download xetaio/xetaravel-editor-md 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/ */

    

xetaio / xetaravel-editor-md example snippets


> 'providers' => [
>     //...
>     Xetaio\Editor\EditorServiceProvider::class,
>     //...
> ]
> 

> php artisan vendor:publish --provider="Xetaio\Editor\EditorServiceProvider"
> 
html
> <!-- controller/my_view.blade.php -->
> @extends('layouts.app')
>
> @push('styles')
>    {!! editor_css() !!}
> @endpush
>
> @push('scripts')
>    {!! editor_js() !!}
>
>    @php
>        $config = [
>            'id' => 'commentEditor',
>            'height' => '350',
>            // Others settings here...
>        ];
>    @endphp
>
>    @include('editor/partials/_comment', $config)
> @endpush
>
> @section('content')
> //...
> <div id="commentEditor">
>    <textarea class="form-control" 
html
> <!-- editor/partials/_comment.blade.php -->
> <script type="text/javascript">
> var _{{ array_get($config, 'id', 'myeditor') }};
> $(function() {
>    editormd.emoji = {
>        path : "{{ array_get($config, 'emojiPath', config('editor.emojiPath')) }}",
>        ext : ".png"
>    };
>    _{{ array_get($config, 'id', 'myeditor') }} = editormd({
>        id : "{{ array_get($config, 'id', 'myeditor') }}",
>        width : "{{ array_get($config, 'width', config('editor.width')) }}",
>        height : "{{ array_get($config, 'height', config('editor.height')) }}",
>        saveHTMLToTextarea : {{ array_get($config, 'saveHTMLToTextarea', config('editor.saveHTMLToTextarea')) }},
>        emoji : {{ array_get($config, 'emoji', config('editor.emoji')) }},
>        taskList : {{ array_get($config, 'taskList', config('editor.taskList')) }},
>        tex : {{ array_get($config, 'tex', config('editor.tex')) }},
>        toc : {{ array_get($config, 'toc', config('editor.toc')) }},
>        tocm : {{ array_get($config, 'tocm', config('editor.tocm')) }},
>        codeFold : {{ array_get($config, 'codeFold', config('editor.codeFold')) }},
>        flowChart: {{ array_get($config, 'flowChart', config('editor.flowChart')) }},
>        sequenceDiagram: {{ array_get($config, 'sequenceDiagram', config('editor.sequenceDiagram')) }},
>        path : "{{ array_get($config, 'path', config('editor.path')) }}",
>        imageUpload : {{ array_get($config, 'imageUpload', config('editor.imageUpload')) }},
>        imageFormats : {!! array_get($config, 'imageFormats', json_encode(config('editor.imageFormats'))) !!},
>        imageUploadURL : "{{ array_get($config, 'imageUploadURL', config('editor.imageUploadURL')) }}?_token={{ csrf_token() }}&from=xetaravel-editor-md",
>        pluginPath : "{{ asset(array_get($config, 'pluginPath', config('editor.pluginPath'))) }}/",
>        watch : false,
>        editorTheme : 'mdn-like',
>        placeholder : 'Type your comment here...',
>        toolbarIcons : function () {
>            return [
>                "undo", "redo", "|",
>                "bold", "italic", "quote", "|",
>                "h1", "h2", "|",
>                "help"
>            ];
>        }
>       // Others settings...
>    });
>});
></script>
>