![New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions](https://cdn.sanity.io/images/cgdhsj6q/production/86e6ebdea652d20da070ebbda20134b839972db7-1024x1024.webp?w=800&fit=max&auto=format)
Security News
New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
editorjs-viewer
Advanced tools
Readme
editorjs-viewer
is package to turn JSON
data to HTML
from editor.js dynamicly and extremly easy to use.
by default this package can parse the following data:
not too many right, it's because we want to provide you a dynamic
return easily and it's up to you whatever data you want to return you can do that it's absolutly posible, by doing that you can parse any json data to any html tag.
npm install editorjs-viewer
import {parser} from 'editorjs-viewer'
// example data from editor.js
const example = {
blokcs: [
{
"id": "4VO1-bae5v",
"type": "header",
"data": {
"text": "Editor.js",
"level": 1
}
},
{
"id": "uF5EPBJ50g",
"type": "paragraph",
"data": {
"text": "Hey. Meet the new Editor. On this page you can see it in action — try to edit this text."
}
},
]
};
// turn json to html
const result = parser.toHTML(example.blocks)
console.log(result)
In this example below, i wan't to turn image
block to html
tag but in the default configuration there's no configuration for returning image block as html, so here's the benefit by using this package you can use custom configuration look at example below
import {parser} from 'editorjs-viewer'
// example from editor js
const examples = {
blokcs: [
{
"id": "4VO1-bae5v",
"type": "header",
"data": {
"text": "Editor.js",
"level": 1
}
},
{
"id": "uF5EPBJ50g",
"type": "paragraph",
"data": {
"text": "Hey. Meet the new Editor. On this page you can see it in action — try to edit this text."
}
},
{
"id" : "mom8ixFY4s",
"type" : "image",
"data" : {
"file" : {
"url" : "https://codex.so/public/app/img/external/codex2x.png"
},
"caption" : "",
"withBorder" : false,
"stretched" : false,
"withBackground" : false
}
}
]
};
// define custom configuration
const conf = {
// naming must be in lower case and can not be combined
image : {
onReturn(value){
// value.data.file.url is the value from editor js image look at here https://github.com/editor-js/image
// if you want to use another tag such as link, iframe or etc then follow their return rules
return `<img src='${value.data.file.url}'`/>
}
},
// you can add more e.g iframe, code, raw and etc
}
// passing the custom configuration as the second argument
const result = parser.toHTML(example.blocks, conf)
console.log(result)
FAQs
Extremly easy turn JSON data to HTML from editor.js dynamicly
The npm package editorjs-viewer receives a total of 4 weekly downloads. As such, editorjs-viewer popularity was classified as not popular.
We found that editorjs-viewer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
Security News
Results from the 2023 State of JavaScript Survey highlight key trends, including Vite's dominance, rising TypeScript adoption, and the enduring popularity of React. Discover more insights on developer preferences and technology usage.
Security News
The US Justice Department has penalized two consulting firms $11.3 million for failing to meet cybersecurity requirements on federally funded projects, emphasizing strict enforcement to protect sensitive government data.