Convert HTML to Delta or Delta to HTML
The purpose of this package is to assist in migrating to or from the Quill editor.
Via NPM
npm install node-quill-converter --saveVia Yarn
yarn add node-quill-converter
`Getting Started
$3
`js
const { convertTextToDelta } = require('node-quill-converter');let text = 'hello, world';
let delta = convertTextToDelta(text);
console.log(JSON.stringify(delta)); // {"ops":[{"insert":"hello, world\n"}]}
`$3
`js
const { convertHtmlToDelta } = require('node-quill-converter');let htmlString = '
hello, world
';
let delta = convertHtmlToDelta(htmlString);console.log(JSON.stringify(delta); // {"ops":[{"insert":"hello, "},{"insert":"world","attributes":{"bold":true}}]}
`$3
`js
const { convertDeltaToHtml } = require('node-quill-converter');let html = convertDeltaToHtml(delta);
console.log(html) ; // '
hello, world
'
``