Giter Site home page Giter Site logo

hoangan310 / vue-editor-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from changjoo-park/vue-editor-js

0.0 0.0 0.0 1.82 MB

editor.js for Vue users

Home Page: https://codesandbox.io/embed/o7lyqwmvmq

License: MIT License

JavaScript 69.63% HTML 10.83% Vue 19.54%

vue-editor-js's Introduction

vue-editor-js

vue-editor-js is editorjs wrapper component.

Please see this first. https://editorjs.io/

For before 2.0.0 version users.

This plugins is turned to be just wrapper component. If you need to use plugin for editor.js, just import and set to config property.

Please See the Demo.vue

For before 1.0.0 version users.

Please Vue.use vue-editor-js in main.js.

Supported Plugins

Installation

npm install --save vue-editor-js

# or Yarn
yarn add vue-editor-js

Usage

// In main.js
// ...
import Editor from 'vue-editor-js'

Vue.use(Editor)
// ...
// on Nuxt.js

// in nuxt.config.js
plugins: [
  {
    src: '~/plugins/vue-editor.js', ssr: false
  }
],

// in ~/plugins/vue-editor.js
import Vue from 'vue'
import Editor from 'vue-editor-js'

Vue.use(Editor)
  <editor ref="editor" :config="config" :initialized="onInitialized"/>

define initialize Function for get instance of editor.js when initialized

If you confused using on Nuxt, please see here

Local import

You can import Editor only in components where you need it.

  1. Make sure to install @vue/composition-api
npm i --save @vue/composition-api

#or Yarn
yarn add @vue/composition-api
  1. In main.js:
import Vue from 'vue'
import VueCompositionApi from '@vue/composition-api'

Vue.use(VueCompositionApi)
  1. Don't import anything from 'vue-editor-js' in main.js
  2. In your component:
import { Editor } from 'vue-editor-js'

export default {
  // ...
  components: {
    Editor,
  },
  // ...
}

Tools

Supported tools

Same as in Supported Plugins, but with different naming

  • header
  • list
  • code
  • inlineCode
  • personality
  • embed
  • linkTool
  • marker
  • table
  • raw
  • delimiter
  • quote
  • image
  • warning
  • paragraph
  • checklist

Usage

<editor header list code ... :config="config"/>

Upload Image (>= 1.1.0)

for upload image, You need a backend for processing image. vue-editor-js provide special config props for easy. If you server for test upload image, please see server example.

<editor :config="config" />

<script>
...
data() {
  return {
      config: {
        image: {
          // Like in https://github.com/editor-js/image#config-params
          endpoints: {
            byFile: 'http://localhost:8090/image',
            byUrl: 'http://localhost:8090/image-by-url',
          },
          field: 'image',
          types: 'image/*',
        },
      }
  }
}
</script>

upload personality avatar ( >= 2.0.1)

  config: {
    personality: {
      endpoints: 'http://localhost:8090/image'
    }

Other props:

  • customTools - Object with name (key) and class of a custom tool (value)

Enjoy editorjs with Vue.js Project ๐ŸŽ‰

How to Contribute?

  1. fork this project.
  2. edit code.
  3. PR

OR

  1. Just submit a issue!

Contributors

vue-editor-js's People

Contributors

changjoo-park avatar loskir avatar dependabot[bot] avatar laughte avatar golove 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.