0.2.0 • Published 7 years ago
@kenyog/rtf-to-quill-delta v0.2.0
rtf-to-quill-delta
This is a Node.js module for converting rtf file into quill delta format.
Requirement
This modules depends on following modules.
Usage
sample program
const RtfToDeltaConverter = require('@kenyog/rtf-to-quill-delta');
async function main() {
  let rtf = await readFile('test.rtf', {encoding: 'ascii'});
  let converter = new RtfToDeltaConverter();
  let delta = await converter.convert(rtf);
  console.log(JSON.stringify(delta, null, 2));
}Output
{
  "ops": [
    {
      "insert": "ai",
      "attributes": {
        "size": "8px",
        "color": "#000000"
      }
    },
    {
      "insert": "ueoaiu",
      "attributes": {
        "bold": true,
        "size": "10.6px",
        "color": "#000000"
      }
    },
    {
      "insert": "eo",
      "attributes": {
        "bold": false,
        "size": "8px",
        "color": "#000000"
      }
    },
    {
      "insert": "\n"
    }
  ]
}Install
npm install @kenyog/rtf-to-quill-deltaLicence
MIT