Skip to content

Commit

Permalink
Fix retention of formats between lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
willrowe committed Jun 25, 2015
1 parent 564848e commit 9e11eff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/modules/keyboard.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Keyboard
_.each(leaf.formats, (value, format) =>
@quill.prepareFormat(format, value)
@toolbar.setActive(format, value) if @toolbar?
return
)
return false
)
Expand Down
9 changes: 9 additions & 0 deletions test/unit/modules/keyboard.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,14 @@ describe('Keyboard', ->
dom(@quill.root).trigger('keydown', Quill.Module.Keyboard.hotkeys.OUTDENT)
expect(@quill.root).toEqualHTML('<div>0123</div>', true)
)

it('retain formatting', ->
@quill.setHTML('<div><span style="font-family: monospace; font-size: 18px;">foo bar baz</span></div>')
@quill.setSelection(@quill.getLength(), @quill.getLength())
dom(@quill.root).trigger('keydown', { key: dom.KEYS.ENTER })
document.execCommand('insertText', false, 'foo')
@quill.editor.checkUpdate()
expect(@quill.getHTML()).toEqual('<div><span style="font-family: monospace; font-size: 18px;">foo bar baz</span></div><div><span style="font-family: monospace; font-size: 18px;">foo</span></div>')
)
)
)

0 comments on commit 9e11eff

Please sign in to comment.