Skip to content

Commit

Permalink
fix #786
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Jul 7, 2016
1 parent eb2709f commit e51ce5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ class Quill {
this.clipboard = this.theme.addModule('clipboard');
this.history = this.theme.addModule('history');
this.theme.init();
// Setting would truncate a newline at the end
this.pasteHTML(0, `<div class='ql-editor' style="white-space: normal;">${html}</div>`);
this.pasteHTML(`<div class='ql-editor' style="white-space: normal;">${html}<p><br></p></div>`);
this.history.clear();
if (options.readOnly) {
this.disable();
Expand Down
8 changes: 8 additions & 0 deletions test/unit/core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ describe('Quill', function() {
expect(quill.getContents()).toEqual(new Delta().insert('\n\n\n'));
expect(quill.root).toEqualHTML('<p><br></p><p><br></p><p><br></p>');
});

it('formatted ending', function() {
let quill = this.initialize(Quill, '<p class="ql-align-center">Test</p>');
expect(quill.getContents()).toEqual(
new Delta().insert('Test').insert('\n', { align: 'center' })
);
expect(quill.root).toEqualHTML('<p class="ql-align-center">Test</p>');
});
});

describe('api', function() {
Expand Down

0 comments on commit e51ce5b

Please # to comment.