mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-08 13:44:53 +08:00
fix(drafts): Don't display raw HTML tags in draft previews
This commit is contained in:
parent
443b3ce642
commit
9aeeb431cb
1 changed files with 11 additions and 5 deletions
|
@ -21,15 +21,15 @@ DraftList = React.createClass
|
||||||
selectedId: null
|
selectedId: null
|
||||||
|
|
||||||
componentDidMount: ->
|
componentDidMount: ->
|
||||||
@draft_store_unsubscribe = DraftStore.listen @_onChange
|
@draftStoreUnsubscribe = DraftStore.listen @_onChange
|
||||||
@body_unsubscriber = atom.commands.add 'body',
|
@bodyUnsubscriber = atom.commands.add 'body',
|
||||||
'application:previous-item': => @_onShiftSelectedIndex(-1)
|
'application:previous-item': => @_onShiftSelectedIndex(-1)
|
||||||
'application:next-item': => @_onShiftSelectedIndex(1)
|
'application:next-item': => @_onShiftSelectedIndex(1)
|
||||||
'application:remove-item': @_onDeleteSelected
|
'application:remove-item': @_onDeleteSelected
|
||||||
|
|
||||||
componentWillUnmount: ->
|
componentWillUnmount: ->
|
||||||
@draft_store_unsubscribe()
|
@draftStoreUnsubscribe()
|
||||||
@body_unsubscriber.dispose()
|
@bodyUnsubscriber.dispose()
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
<div className="thread-list">
|
<div className="thread-list">
|
||||||
|
@ -50,6 +50,12 @@ DraftList = React.createClass
|
||||||
Actions.composePopoutDraft(localId)
|
Actions.composePopoutDraft(localId)
|
||||||
|
|
||||||
_computeColumns: ->
|
_computeColumns: ->
|
||||||
|
snippet = (html) =>
|
||||||
|
@draftSanitizer ?= document.createElement('div')
|
||||||
|
@draftSanitizer.innerHTML = html
|
||||||
|
text = @draftSanitizer.innerText
|
||||||
|
text[0..140]
|
||||||
|
|
||||||
c1 = new ListTabular.Column
|
c1 = new ListTabular.Column
|
||||||
name: "Name"
|
name: "Name"
|
||||||
flex: 2
|
flex: 2
|
||||||
|
@ -70,7 +76,7 @@ DraftList = React.createClass
|
||||||
name: "Snippet"
|
name: "Snippet"
|
||||||
flex: 4
|
flex: 4
|
||||||
resolver: (draft) ->
|
resolver: (draft) ->
|
||||||
<span className="snippet">{draft.body}</span>
|
<span className="snippet">{snippet(draft.body)}</span>
|
||||||
|
|
||||||
c4 = new ListTabular.Column
|
c4 = new ListTabular.Column
|
||||||
name: "Date"
|
name: "Date"
|
||||||
|
|
Loading…
Add table
Reference in a new issue