mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 00:06:06 +08:00
fix(sidebar): Prevent editing items in OutlineView when not allowed
- Fix check in OutlineViewItem
This commit is contained in:
parent
decd7c787e
commit
0c3ca4b6e4
|
@ -96,8 +96,8 @@ class SidebarItem
|
|||
@forCategories: (categories = [], opts = {}) ->
|
||||
id = idForCategories(categories)
|
||||
perspective = MailboxPerspective.forCategories(categories)
|
||||
opts.deletable = true
|
||||
opts.editable = true
|
||||
opts.deletable ?= true
|
||||
opts.editable ?= true
|
||||
@forPerspective(id, perspective, opts)
|
||||
|
||||
@forStarred: (accountIds, opts = {}) ->
|
||||
|
|
|
@ -35,7 +35,7 @@ class SidebarSection
|
|||
|
||||
items = _
|
||||
.reject(cats, (cat) -> cat.name is 'drafts')
|
||||
.map (cat) => SidebarItem.forCategories([cat])
|
||||
.map (cat) => SidebarItem.forCategories([cat], editable: false, deletable: false)
|
||||
|
||||
starredItem = SidebarItem.forStarred([account.id])
|
||||
draftsItem = SidebarItem.forDrafts([account.id])
|
||||
|
@ -73,9 +73,9 @@ class SidebarSection
|
|||
names.map((name) -> CategoryStore.getStandardCategory(acc, name))
|
||||
))
|
||||
return unless cat
|
||||
children.push(SidebarItem.forCategories([cat], name: acc.label))
|
||||
children.push(SidebarItem.forCategories([cat], name: acc.label, editable: false, deletable: false))
|
||||
|
||||
items.push SidebarItem.forCategories(categories, {children})
|
||||
items.push SidebarItem.forCategories(categories, {children, editable: false, deletable: false})
|
||||
|
||||
starredItem = SidebarItem.forStarred(_.pluck(accounts, 'id'),
|
||||
children: accounts.map (acc) -> SidebarItem.forStarred([acc.id], name: acc.label)
|
||||
|
|
|
@ -218,7 +218,9 @@ class OutlineViewItem extends Component {
|
|||
}
|
||||
|
||||
_onEdit = ()=> {
|
||||
this.setState({editing: true});
|
||||
if (this.props.item.onEdited) {
|
||||
this.setState({editing: true});
|
||||
}
|
||||
}
|
||||
|
||||
_onInputFocus = (event)=> {
|
||||
|
|
Loading…
Reference in a new issue