Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 5fee622

Browse files
committed
fixed snippet list wall not display
1 parent c393cba commit 5fee622

File tree

1 file changed

+11
-8
lines changed
  • browser/render/layouts/list-and-detail/snippet-list

1 file changed

+11
-8
lines changed

browser/render/layouts/list-and-detail/snippet-list/index.jsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ import './snippet-list'
88

99
@observer
1010
export default class SnippetList extends React.Component {
11+
state = {
12+
isEditingOn: false
13+
}
1114
componentDidMount () {
1215
eventEmitter.on('snippet-detail:edit-start', () => {
13-
this.refs.wall.style.display = 'block'
16+
this.setState({ isEditingOn: true })
1417
})
1518
eventEmitter.on('snippet-detail:edit-end', () => {
16-
this.refs.wall.style.display = 'none'
19+
this.setState({ isEditingOn: false })
1720
})
1821
eventEmitter.on('snippet-list:previous', () => {
1922
const { snippets, selectedSnippet } = this.props.store
@@ -53,12 +56,16 @@ export default class SnippetList extends React.Component {
5356
})
5457
}
5558

56-
renderSnippetList () {
59+
render () {
60+
const { isEditingOn } = this.state
5761
const { store, config } = this.props
5862
const { snippets, selectedSnippet } = store
5963
return (
6064
<div className="snippets list-and-detail">
61-
<div className="wall" ref="wall" />
65+
<div
66+
className="wall"
67+
style={{ display: `${isEditingOn ? 'block' : 'none'}` }}
68+
/>
6269
<SearchSnippetBar store={store} />
6370
<SortSnippetTool store={store} />
6471
<ul>
@@ -78,8 +85,4 @@ export default class SnippetList extends React.Component {
7885
</div>
7986
)
8087
}
81-
82-
render () {
83-
return this.renderSnippetList()
84-
}
8588
}

0 commit comments

Comments
 (0)