Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/trix/models/html_parser.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ class Trix.HTMLParser extends Trix.BasicObject
@appendAttachmentWithAttributes(attributes, @getTextAttributes(element))
@processedElements.push(element)
when "tr"
unless element.parentNode.firstChild is element
unless element.parentNode.firstElementChild is element
@appendStringWithAttributes("\n")
when "td"
unless element.parentNode.firstChild is element
unless element.parentNode.firstElementChild is element
@appendStringWithAttributes(" | ")

# Document construction
Expand Down
2 changes: 1 addition & 1 deletion test/src/unit/html_parser_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ testGroup "Trix.HTMLParser", ->
assert.documentHTMLEqual Trix.HTMLParser.parse(html).getDocument(), expectedHTML

test "translates tables into plain text", ->
html = """<table><tr><td>a</td><td>b</td></tr><tr><td>1</td><td><p>2</p></td></tr><table>"""
html = """<table><tr>\r\n<td>a</td><td>b</td></tr><tr><td>1</td><td><p>2</p></td></tr><table>"""
expectedHTML = """<div><!--block-->a | b<br>1 | 2</div>"""
assert.documentHTMLEqual Trix.HTMLParser.parse(html).getDocument(), expectedHTML

Expand Down