-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Enable lock in MarkdownEditor #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
74ee6ae
672d409
e9525fa
bbeeecc
aa0ad3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,8 @@ class MarkdownNoteDetail extends React.Component { | |
| note: Object.assign({ | ||
| title: '', | ||
| content: '' | ||
| }, props.note) | ||
| }, props.note), | ||
| locked: false | ||
| } | ||
| this.dispatchTimer = null | ||
| } | ||
|
|
@@ -200,6 +201,16 @@ class MarkdownNoteDetail extends React.Component { | |
| } | ||
| } | ||
|
|
||
| handleLockButtonClick () { | ||
| ee.emit('editor:lock') | ||
| this.focus() | ||
| this.setState({ locked: !this.state.locked }) | ||
| } | ||
|
|
||
| toggleLockButton () { | ||
|
||
| return this.state.locked ? 'fa-lock' : 'fa-unlock-alt' | ||
|
||
| } | ||
|
|
||
| handleDeleteKeyDown (e) { | ||
| if (e.keyCode === 27) this.handleDeleteCancelButtonClick(e) | ||
| } | ||
|
|
@@ -235,6 +246,20 @@ class MarkdownNoteDetail extends React.Component { | |
| /> | ||
| </div> | ||
| <div styleName='info-right'> | ||
| {(() => { | ||
| // TODO: get a state of MarkdownEditor somehow | ||
| const editorStatus='CODE' | ||
| let faClassName=`fa ${this.toggleLockButton()}` | ||
|
||
| if (editorStatus === 'CODE') { | ||
| return( | ||
| <button styleName='info-right-button' | ||
| onClick={(e) => this.handleLockButtonClick(e)} | ||
| > | ||
| <i className={faClassName}/> | ||
| </button> | ||
| ) | ||
| } | ||
|
||
| })()} | ||
| <button styleName='info-right-button' | ||
| onClick={(e) => this.handleContextButtonClick(e)} | ||
| > | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicated and not connected the state with https://github.com/asmsuechan/Boostnote/blob/74ee6ae6ce047ae7c349b35ae048ae14930c547e/browser/main/Detail/MarkdownNoteDetail.js#L29.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, I'm not sure how it connects each other.