|
| 1 | +"use strict"; |
| 2 | +Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 | +const html_to_delta_1 = require("./html_to_delta"); |
| 4 | +const delta = new html_to_delta_1.HtmlToDelta().convert('<p>Hello <strong>Word</strong>!<br></p>'); |
| 5 | +delta.ops.forEach((op) => { |
| 6 | + console.log(JSON.stringify(op.insert) + |
| 7 | + (op.attributes ? JSON.stringify(op.attributes) : '')); |
| 8 | +}); |
| 9 | +const delta2 = new html_to_delta_1.HtmlToDelta().convert('<p><span style="color:#F06292FF">This is just pink </span><br/><br/><span style="color:#4DD0E1FF">This is just blue</span><br></p>'); |
| 10 | +console.log('\n'); |
| 11 | +delta2.ops.forEach((op) => { |
| 12 | + console.log(JSON.stringify(op.insert) + |
| 13 | + (op.attributes ? JSON.stringify(op.attributes) : '')); |
| 14 | +}); |
| 15 | +const delta3 = new html_to_delta_1.HtmlToDelta().convert('<p>This is a <a href="https://example.com">link</a> to example.com</p>'); |
| 16 | +console.log('\n'); |
| 17 | +delta3.ops.forEach((op) => { |
| 18 | + console.log(JSON.stringify(op.insert) + |
| 19 | + (op.attributes ? JSON.stringify(op.attributes) : '')); |
| 20 | +}); |
| 21 | +const delta4 = new html_to_delta_1.HtmlToDelta().convert('<p style="font-size: 0.75em">This is a paragraph example</p>'); |
| 22 | +console.log('\n'); |
| 23 | +delta4.ops.forEach((op) => { |
| 24 | + console.log(JSON.stringify(op.insert) + |
| 25 | + (op.attributes ? JSON.stringify(op.attributes) : '')); |
| 26 | +}); |
| 27 | +const delta5 = new html_to_delta_1.HtmlToDelta().convert('<p>This is an image: <img align="center" style="width: 50px;height: 250px;margin: 5px;" src="https://example.com/image.png"/> example</p>'); |
| 28 | +console.log('\n'); |
| 29 | +delta5.ops.forEach((op) => { |
| 30 | + console.log(JSON.stringify(op.insert) + |
| 31 | + (op.attributes ? JSON.stringify(op.attributes) : '')); |
| 32 | +}); |
| 33 | +const delta6 = new html_to_delta_1.HtmlToDelta().convert('<ol><li>First <strong>item</strong><ul><li>SubItem <a href="https://www.google.com">1</a><ol><li>Sub 1.5</li></ol></li><li>SubItem 2</li></ul></li><li>Second item</li></ol>'); |
| 34 | +console.log('\n'); |
| 35 | +delta6.ops.forEach((op) => { |
| 36 | + console.log(JSON.stringify(op.insert) + |
| 37 | + (op.attributes ? JSON.stringify(op.attributes) : '')); |
| 38 | +}); |
| 39 | +const delta7 = new html_to_delta_1.HtmlToDelta().convert('<h1>Example title <span style="font-size: 20px; color: var(--); background-color: #ffffffff">with an internal span</span></h1>'); |
| 40 | +console.log('\n'); |
| 41 | +delta7.ops.forEach((op) => { |
| 42 | + console.log(JSON.stringify(op.insert) + |
| 43 | + (op.attributes ? JSON.stringify(op.attributes) : '')); |
| 44 | +}); |
| 45 | +const delta8 = new html_to_delta_1.HtmlToDelta(null, null, ['div']).convert('<h1>Example title <span style="font-size: 20px; color: var(--); background-color: #ffffffff">with an internal span</span></h1><div><p align="center">Paragraph ignored</p></div>'); |
| 46 | +console.log('\n'); |
| 47 | +delta8.ops.forEach((op) => { |
| 48 | + console.log(JSON.stringify(op.insert) + |
| 49 | + (op.attributes ? JSON.stringify(op.attributes) : '')); |
| 50 | +}); |
0 commit comments