1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-16 03:06:27 +00:00

added rtl toggle button

This commit is contained in:
Itai Braude
2019-10-17 20:48:40 +03:00
parent d010c5532d
commit e34485eb83
12 changed files with 168 additions and 19 deletions

View File

@@ -31,6 +31,7 @@ import { confirmDeleteNote } from 'browser/lib/confirmDeleteNote'
import markdownToc from 'browser/lib/markdown-toc-generator'
import queryString from 'query-string'
import { replace } from 'connected-react-router'
import ToggleDirectionButton from "browser/main/Detail/ToggleDirectionButton";
class MarkdownNoteDetail extends React.Component {
constructor (props) {
@@ -46,7 +47,8 @@ class MarkdownNoteDetail extends React.Component {
isLockButtonShown: props.config.editor.type !== 'SPLIT',
isLocked: false,
editorType: props.config.editor.type,
switchPreview: props.config.editor.switchPreview
switchPreview: props.config.editor.switchPreview,
RTL: false
}
this.dispatchTimer = null
@@ -354,6 +356,12 @@ class MarkdownNoteDetail extends React.Component {
})
}
handleSwitchDirection () {
// If in split mode, hide the lock button
let direction = this.state.RTL
this.setState({ RTL: !direction })
}
handleDeleteNote () {
this.handleTrashButtonClick()
}
@@ -393,6 +401,7 @@ class MarkdownNoteDetail extends React.Component {
onChange={this.handleUpdateContent.bind(this)}
isLocked={this.state.isLocked}
ignorePreviewPointerEvents={ignorePreviewPointerEvents}
RTL={this.state.RTL}
/>
} else {
return <MarkdownSplitEditor
@@ -404,6 +413,7 @@ class MarkdownNoteDetail extends React.Component {
linesHighlighted={note.linesHighlighted}
onChange={this.handleUpdateContent.bind(this)}
ignorePreviewPointerEvents={ignorePreviewPointerEvents}
RTL={this.state.RTL}
/>
}
}
@@ -472,7 +482,7 @@ class MarkdownNoteDetail extends React.Component {
</div>
<div styleName='info-right'>
<ToggleModeButton onClick={(e) => this.handleSwitchMode(e)} editorType={editorType} />
<ToggleDirectionButton onClick={(e) => this.handleSwitchDirection(e)} editorDirection={this.state.RTL} />
<StarButton
onClick={(e) => this.handleStarButtonClick(e)}
isActive={note.isStarred}
@@ -518,6 +528,8 @@ class MarkdownNoteDetail extends React.Component {
print={this.print}
/>
</div>
</div>
return (