GithubHelp home page GithubHelp logo

salimzade / editorjs-data-parser Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 2.0 1.13 MB

Convert JSON data from EditorJS to HTML elements

Home Page: https://codesandbox.io/s/editor-js-data-parser-demo-forked-l1v7v

License: MIT License

TypeScript 100.00%
editorjs codex-editor parser editorjs-parser

editorjs-data-parser's Introduction

EditorJs Data Parser

Easily convert json data from editorjs to html elements


npm npm npm github

Installaton

npm i editorjs-data-parser

yarn add editorjs-data-parser

Suppoted tools

  • ✅ checklist
  • ✅ embed
  • ✅ head
  • ✅ link
  • ✅ list
  • ✅ marker
  • ✅ image
  • ✅ paragraph
  • ✅ quote
  • ✅ raw
  • ✅ table
  • ✅ code
  • ✅ warning
  • ✅ delimeter

Usage example

import EditorJS from "@editorjs/editorjs";
import CheckList from "@editorjs/checklist";
import Code from "@editorjs/code";
import Header from "@editorjs/header";
import List from "@editorjs/list";
import Embed from "@editorjs/embed";
import Delimiter from "@editorjs/delimiter";
import Marker from "@editorjs/marker";
import Image from "@editorjs/image";
import Raw from "@editorjs/raw";
import Table from "@editorjs/table";
import Warning from "@editorjs/warning";
import { editorJsParser } from "editorjs-data-parser";

const editor = new EditorJS({
  tools: {
    header: {
      class: Header,
      inlineToolbar: true
    },
    list: {
      class: List,
      inlineToolbar: true
    },
    checklist: CheckList,
    delimiter: Delimiter,
    marker: Marker,
    embed: {
      class: Embed,
      inlineToolbar: false,
      config: {
        services: {
          youtube: true,
          coub: true
        }
      }
    },
    image: {
      class: Image,
      config: {
        endpoints: {
          byFile: "http://localhost:8008/uploadFile", // Your backend file uploader endpoint
          byUrl: "http://localhost:8008/fetchUrl" // Your endpoint that provides uploading by Url
        }
      }
    },
    checkList: CheckList,
    code: Code,
    raw: Raw,
    table: Table,
    warning: Warning,
  }
});

let btnConvert = document.getElementById("btnConvert");
btnConvert.addEventListener("click", () => {
  editor.save().then((outputData) => {
    let result = editorJsParser(outputData.blocks);
    console.log(result);
  });
});

Install supported tools

npm i --save @editorjs/checklist

npm i --save @editorjs/code

npm i --save @editorjs/header

npm i --save @editorjs/list

npm i --save @editorjs/embed

npm i --save @editorjs/delimiter

npm i --save @editorjs/marker

npm i --save @editorjs/marker

npm i --save @editorjs/image

npm i --save @editorjs/raw

npm i --save @editorjs/table

npm i --save @editorjs/warning

editorjs-data-parser's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

editorjs-data-parser's Issues

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.