Skip to content
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

Added rtl toggle button #3282

Merged
merged 7 commits into from
Jan 29, 2020
Merged

Added rtl toggle button #3282

merged 7 commits into from
Jan 29, 2020

Conversation

ibraude
Copy link
Contributor

@ibraude ibraude commented Oct 17, 2019

Description

I have added a direction toggle switch for the MarkdownPreview and CodeEditor. (It's located at the top right, next to the Toggle Mode switch button)
This is so notes can be taken and read comfortably when using right-to-left languages like Hebrew or Arabic.

Here is the Boostnote welcome page in the LTR direction:
image

Here is the Boostnote welcome page in Hebrew with the RTL direction:
image

I have also added a hotkey for direction toggle:
image

Issue fixed

This fixes the open issue "Please add RTL support" #846
I believe this is a simple solution that answers the need for people using both ltr and rtl languages regularly.

Type of changes

  • 🔘 Bug fix (Change that fixed an issue)
  • ⚪ Breaking change (Change that can cause existing functionality to change)
  • ⚪ Improvement (Change that improves the code. Maybe performance or development improvement)
  • 🔘 Feature (Change that adds new functionality)
  • ⚪ Documentation change (Change that modifies documentation. Maybe typo fixes)

Checklist:

  • 🔘 My code follows the project code style
  • ⚪ I have written test for my code and it has been tested
  • ⚪ All existing tests have been passed
  • 🔘 I have attached a screenshot/video to visualize my change if possible

All tests pass except for the test: tests/lib/markdown-toc-generator-test.js
I think that the test throws an error because it recognizes the difference between the rtl to ltr as seen in the image below when infact it is the desired result.

image

Hope this helps.

Cheers

@ZeroX-DG ZeroX-DG added the awaiting review ❇️ Pull request is awaiting a review. label Oct 17, 2019
@@ -294,6 +294,8 @@ export default class CodeEditor extends React.Component {
scrollPastEnd: this.props.scrollPastEnd,
inputStyle: 'textarea',
dragDrop: false,
direction: RTL ? 'rtl' : 'ltr',
rtlMoveVisually: RTL ? 'true' : 'false',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you just write RTL instead of RTL ? 'true' : 'false'

@@ -555,6 +557,10 @@ export default class CodeEditor extends React.Component {
if (prevProps.keyMap !== this.props.keyMap) {
needRefresh = true
}
if (prevProps.RTL !== this.props.RTL) {
this.editor.setOption('direction', this.props.RTL ? 'rtl' : 'ltr')
this.editor.setOption('rtlMoveVisually', this.props.RTL ? 'true' : 'false')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write this.props.RTL instead of this.props.RTL ? 'true' : 'false' please?

${RTL ? 'direction: rtl;' : ''}
${RTL ? 'text-align: right;' : ''}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these 2 empty lines

onClick, editorDirection
}) => (
<div styleName='control-toggleModeButton'>
<div styleName={editorDirection ? 'active' : undefined} onClick={() => onClick()}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

editorDirection is quite hard to understand, can you assign it to a more meaningful variable name such as isRTL or something?

@ZeroX-DG ZeroX-DG added awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. and removed awaiting review ❇️ Pull request is awaiting a review. labels Nov 7, 2019
@ZeroX-DG
Copy link
Member

@ibraude ping!

@ibraude
Copy link
Contributor Author

ibraude commented Dec 25, 2019

@ZeroX-DG Sorry for the delay

@Flexo013 Flexo013 requested a review from ZeroX-DG December 27, 2019 12:16
@Flexo013 Flexo013 added awaiting review ❇️ Pull request is awaiting a review. and removed awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. labels Dec 27, 2019
Copy link
Member

@ZeroX-DG ZeroX-DG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@ZeroX-DG
Copy link
Member

ZeroX-DG commented Jan 5, 2020

@ibraude can you fix the conflict before I officially approve it?

@ZeroX-DG ZeroX-DG added awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. and removed awaiting review ❇️ Pull request is awaiting a review. labels Jan 5, 2020
@Flexo013 Flexo013 added awaiting review ❇️ Pull request is awaiting a review. and removed awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. labels Jan 8, 2020
Copy link
Member

@ZeroX-DG ZeroX-DG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response. I found some bug when I test it again, can you fix it please?

${scrollPastEnd ? `
padding-bottom: 90vh;
box-sizing: border-box;
`
: ''}
${optimizeOverflowScroll ? 'height: 100%;' : ''}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This optimizeOverflowScroll variable is undefined can you fix it please

@ZeroX-DG ZeroX-DG added awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. and removed awaiting review ❇️ Pull request is awaiting a review. labels Jan 12, 2020
Copy link
Member

@ZeroX-DG ZeroX-DG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, very cool 🎉

@ZeroX-DG ZeroX-DG added approved 👍 Pull request has been approved by sufficient reviewers. and removed awaiting changes 🖊️ Pull request has been reviewed, but contributor needs to make changes. labels Jan 18, 2020
@Rokt33r Rokt33r modified the milestones: v0.14.0, v0.15.0 Jan 29, 2020
@Rokt33r Rokt33r removed the approved 👍 Pull request has been approved by sufficient reviewers. label Jan 29, 2020
@Rokt33r Rokt33r merged commit 8218d5e into BoostIO:master Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants