PHP code example of abdelhamiderrahmouni / filament-monaco-editor

1. Go to this page and download the library: Download abdelhamiderrahmouni/filament-monaco-editor 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/ */

    

abdelhamiderrahmouni / filament-monaco-editor example snippets


return [
"general" => [
        "enable-preview" => true,
        "show-full-screen-toggle" => true,
        "show-placeholder" => true,
        "placeholder-text" => "Your code here...",
        "show-loader" => true,
        "font-size" => "15px",
        "line-numbers-min-chars" => true,
        "automatic-layout" => true,
        "default-theme" => "blackboard"
    ],
    "themes" => [
        "blackboard" => [
            "base" => "vs-dark",
            "inherit" => true,
            "rules" => [
                # long list of rules ... 
            ],
            "colors" => [
                "editor.foreground" => "#F8F8F8",
                "editor.background" => "#0C1021",
                "editor.selectionBackground" => "#253B76",
                "editor.lineHighlightBackground" => "#FFFFFF0F",
                "editorCursor.foreground" => "#FFFFFFA6",
                "editorWhitespace.foreground" => "#FFFFFF40"
            ]
        ]
    ],
];

MonacoEditor::make('content')
            ->language('php'),

->theme('blackboard') # themes should be defined in the config file in the themes array 

->previewHeadEndContent("<script src='https://cdn.tailwindcss.com'></script><script defer src='https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js'></script>"),

->previewBodyAttributes([
    'class' => 'bg-red-500',
    'id' => 'preview-body'
]),

->previewBodyStartContent("<div class='bg-red-500'>"),

->previewBodyEndContent("</div>"),
 
->enablePreview(false)
# or
->disablePreview()

->showFullScreenButton(false)
# or
->hideFullScreenButton()

->showLoader(false)
# or
->hideLoader()

->showPlaceholder(false)
# or
->hidePlaceholder()

->placeholderText('Your placeholder text')

->fontSize('14px')

"themes" => [
    "themeName" => [
        "base" => "vs-dark|vs-light",
        "inherit" => true|false,
        "rules" => [
           //... your rules
        ],
        "colors" => [
            // your colors, the following are an example...
            "editor.foreground" => "#F8F8F8",
            "editor.background" => "#0C1021",
            "editor.selectionBackground" => "#253B76",
            "editor.lineHighlightBackground" => "#FFFFFF0F",
            "editorCursor.foreground" => "#FFFFFFA6",
            "editorWhitespace.foreground" => "#FFFFFF40"
        ]
    ]
],
bash
php artisan vendor:publish --tag="filament-monaco-editor-config"
bash
php artisan vendor:publish --tag="filament-monaco-editor-views"