Giter Club home page Giter Club logo

jodit-vue's Introduction

Jodit Vue

license All Contributors

version downloads size gzip size

Watch on GitHub Star on GitHub Tweet

Vue Wrapper for the Jodit Editor

How to use

Install Jodit Vue:

npm install jodit-vue --save
// or with Yarn
yarn add jodit-vue

Import and use it

Since this component is just a wrapper, you need to include the css of the Jodit Editor on your app for it to work properly, if you're using vue-cli to create your app, or another build system you can import it directly or add a link tag with the css file provided by the Jodit Editor package.

import 'jodit/build/jodit.min.css'
import Vue from 'vue'
import JoditVue from 'jodit-vue'

Vue.use(JoditVue)

Instead of using Vue.use(JoditVue) you can use the component locally

<template>
    <div id="app">
        <jodit-editor v-model="content" />
    </div>
</template>

<script>
import 'jodit/build/jodit.min.css'
import { JoditEditor } from 'jodit-vue'

export default {
    name: 'app',

    components: { JoditEditor },

    data () {
        return {
            content: '<h1>Hello Jodit Vue</h1>'
        }
    }
}
</script>

You can check and test it on Codesanbox too.

Using without a build system

If you don't use a build system on your app, you can also use Jodit Vue without problems, check and test it on this JsFiddle.

Component Properties

If you pass only the v-model for the component, it will load all the editor features, if you want to customize it, you can do it with its properties that are listed below, but all of them are not required, just if you want to customize your editor that you will need them:

Property Type Default Value Description
buttons Array null The buttons that you want to show on toolbar, if this is not provided, all the buttons will be shown
extraButtons Array null If you need to create and display custom buttons you can pass an array with your custom buttons to this property
config Object {} The config object that has all the other configurations for the editor

Buttons property

When providing the buttons to show on the editor you will need to provide an array with the buttons that you want to show. The button names can be found here. You can also pass a | to put a divider between the buttons.

<template>
    <div id="app">
        <jodit-editor v-model="content" :buttons="buttons" />
    </div>
</template>

<script>
import 'jodit/build/jodit.min.css'
import { JoditEditor } from 'jodit-vue'

export default {
    name: 'app',

    components: { JoditEditor },

    data () {
        return {
            content: '<h1>Hello Jodit Vue</h1>',
            buttons: ['source', 'image', '|', 'bold', 'underline', 'italic']
        }
    }
}
</script>

Extra Buttons property

If you need to create custom buttons to the editor, you can create them and provide the component with an array

<template>
    <div id="app">
        <jodit-editor v-model="content" :buttons="buttons" :extra-buttons="customButtons" />
    </div>
</template>

<script>
import 'jodit/build/jodit.min.css'
import { JoditEditor } from 'jodit-vue'

export default {
    name: 'app',

    components: { JoditEditor },

    data () {
        return {
            content: '<h1>Hello Jodit Vue</h1>',
            buttons: ['source', 'image', '|', 'bold', 'underline', 'italic'],
            customButtons: [
                {
                    name: 'insertDate',
                    iconURL: 'http://xdsoft.net/jodit/logo.png',
                    exec: function (editor) {
                        editor.selection.insertHTML((new Date).toDateString());
                    }
                }
            ]
        }
    }
}
</script>

To create custom buttons, check the Jodit Editor Docs

Config property

This config allows you to pass all the other configurations found here to customize your editor

Contributors

Thanks goes to these wonderful people (emoji key):

Wendell Adriel
Wendell Adriel

💻 📖 💡 🤔
daarxwalker
daarxwalker

🐛 🤔
Jarosław Sadziński
Jarosław Sadziński

🐛
edgar-koster
edgar-koster

🐛
abdelaziz321
abdelaziz321

🐛 💻 📖
Dino Bettini
Dino Bettini

💬 🐛
Dario Vladović
Dario Vladović

💻 📖

This project follows the all-contributors specification. Contributions of any kind welcome!!!

jodit-vue's People

Contributors

wendelladriel avatar vladimyr avatar abdelaziz321 avatar

Watchers

James Cloos avatar  avatar

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.