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