Skip to content

Commit

Permalink
Handle block inserts with inline styles
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
daguej committed Aug 3, 2015
1 parent 28e0029 commit 3545481
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ function convert(ops) {
var op = ops[i];
if (op.insert === 1) {
for (var k in op.attributes) {
newLine();
format.block[k].call(line, $, op.attributes[k]);
newLine();
activeInline = {};
if (format.block[k]) {
newLine();
applyStyles(op.attributes);
format.block[k].call(el, $, op.attributes[k]);
newLine();
}
}
} else {
var lines = op.insert.split('\n');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quill-render",
"version": "1.0.3",
"version": "1.0.4",
"description": "Renders quilljs deltas into HTML",
"main": "index.js",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ describe('quill-render', function() {
.to.equal('<p><i>Italics! <a href="http://example.com">Italic link</a></i><a href="http://example.com"> regular link</a></p>');
});

it('handles multi-block inserts', function() {
it('handles block inserts with inline styles', function() {
expect(render([
{
"attributes": {
Expand All @@ -192,6 +192,6 @@ describe('quill-render', function() {
"insert": 1
}
]))
.to.equal('<p><a href="http://example.com"><img src="https://placekitten.com/g/200/300"></a></p>');
.to.equal('<p></p><p><a href="http://example.com"><img src="https://placekitten.com/g/200/300"></a></p><p></p>');
});
});

0 comments on commit 3545481

Please sign in to comment.