2017-09-27 02:46:00 +08:00
|
|
|
{RetinaImg} = require 'mailspring-component-kit'
|
2017-09-27 02:42:18 +08:00
|
|
|
{React, PropTypes, Actions, FocusedContentStore} = require "mailspring-exports"
|
2015-07-10 04:28:02 +08:00
|
|
|
|
|
|
|
class DraftDeleteButton extends React.Component
|
|
|
|
@displayName: 'DraftDeleteButton'
|
|
|
|
@containerRequired: false
|
|
|
|
|
|
|
|
@propTypes:
|
2017-09-27 02:33:08 +08:00
|
|
|
selection: PropTypes.object.isRequired
|
2015-07-10 04:28:02 +08:00
|
|
|
|
|
|
|
render: ->
|
|
|
|
<button style={order:-100}
|
|
|
|
className="btn btn-toolbar"
|
2015-10-22 02:03:27 +08:00
|
|
|
title="Delete"
|
2015-10-22 01:38:00 +08:00
|
|
|
onClick={@_destroySelected}>
|
2015-07-10 04:28:02 +08:00
|
|
|
<RetinaImg name="icon-composer-trash.png" mode={RetinaImg.Mode.ContentIsMask} />
|
|
|
|
</button>
|
|
|
|
|
2015-10-22 01:38:00 +08:00
|
|
|
_destroySelected: =>
|
|
|
|
for item in @props.selection.items()
|
2017-09-06 04:15:37 +08:00
|
|
|
Actions.destroyDraft(item)
|
2015-10-22 01:38:00 +08:00
|
|
|
@props.selection.clear()
|
2016-01-26 09:08:38 +08:00
|
|
|
return
|
2015-07-10 04:28:02 +08:00
|
|
|
|
|
|
|
module.exports = {DraftDeleteButton}
|