Coder Social home page Coder Social logo

mantix / livewire-jodit-text-editor Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 56 KB

A powerful Livewire rich text editor (WYSIWYG) component built top of Jodit Editor.

Home Page: https://mantix.nl

License: MIT License

Blade 20.45% PHP 79.55%
jodit laravel laravel10 laravel11 livewire livewire3 wysiwyg wysiwyg-editor wysiwyg-html-editor jodit-livewire

livewire-jodit-text-editor's People

Contributors

mantix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

livewire-jodit-text-editor's Issues

Add button dynamically

Hi,
Could you add the possibility to add button dynamicaly ?

There is the code to modify

<livewire:jodit-text-editor wire:model.live="description" :buttons="['bold', 'italic', 'underline', 'strikeThrough', '|', 'left', 'center', 'right', '|', 'link', 'image']" />

in livewire classe:

     public array $buttons = [
        "bold",
        "italic",
        "underline",
    ];

    public function mount(array $buttons = []): void {
        $this->joditId = 'jodit-editor-' . Str::uuid()->toString();
        if (!empty($buttons)) {
            $this->buttons = $buttons;
        }
    }
In view:
     <script>
        const buttons = @json($buttons);

        const editor = Jodit.make('#' + @js($joditId), {
            "autofocus": true,
            "toolbarSticky": true,

             "uploader": {
                "insertImageAsBase64URI": true
            },
            "toolbarButtonSize": "large",
            "showCharsCounter": false,
            "showWordsCounter": false,
            "showXPathInStatusbar": false,
            "defaultActionOnPaste": "insert_clear_html",
            "buttons": buttons,
        });
        document.getElementById(@js($joditId)).addEventListener('change', function() {
            @this.set('value', this.value);
        });

        window.addEventListener('update-jodit-content', (event) => {
            editor.value = event.detail[0];
        });
    </script>
@endscript

Have a nice day ;-)

cdnjs.cloudflare.com 404 error

Thanks for this great package - it was just what I needed. I thought you might like to know that that cloudflare.com are no longer providing Jodit. Instead I used these with your package and it worked fine:

<script src="https://unpkg.com/[email protected]/es2021/jodit.min.js"></script>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.