Git Product home page Git Product logo

livewire-jodit-text-editor's Introduction

Livewire Jodit Text Editor (WYSIWYG)

Build Status Total Downloads Latest Stable Version License

โœจ Introduction

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

To use this package, you must have Livewire 3 installed.

๐Ÿ“ฆ Installation

Seconds install this package via Composer:

composer require mantix/livewire-jodit-text-editor

Include the Jodit Editor theme and the library in your layout or specific view.

<!-- Include Jodit CSS Styling -->
<link rel="stylesheet" href="//unpkg.com/[email protected]/es2021/jodit.min.css">

<!-- Include the Jodit JS Library -->
<script src="//unpkg.com/[email protected]/es2021/jodit.min.js"></script>

Or you can use NPM to install the Jodit Editor directly in your project:

npm install jodit

Import it in your app.js like:

// Jodit Editor
import 'jodit/esm/plugins/resizer/resizer'; // Resizer plugin is used when inserting images
import 'jodit/esm/plugins/video/video'; // Video plugin is used to insert videos
// Feel free to add extra plugins here...
import { Jodit } from 'jodit';
window.Jodit = Jodit;

And in your app.scss like:

// Jodit Editor
@import 'jodit/es2021/jodit';

For additional information, kindly refer to the Jodit Editor documentation.

๐ŸŽฌ Showcase

Now you can use the text editor component as you like.

<livewire:jodit-text-editor wire:model.live="content" />

Or add the "buttons" attribute to define buttons dynamically.

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

๐ŸŽจ Tailor UI

The text editor component is entirely customizable. Just publish the view file and make it your own.

php artisan vendor:publish --tag=livewire-jodit-text-editor-views

๐Ÿ”„ Changelog

Please see CHANGELOG for more information on what has changed recently.

๐Ÿค Contributing

Please see CONTRIBUTING for details.

โค๏ธ Support Me

Is this plugin helpful to you? Let me know by connecting on LinkedIn or on X.

livewire-jodit-text-editor's People

Contributors

mantix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

livewire-jodit-text-editor's Issues

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>

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 ;-)

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.