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

solarized light/dark bug fix #1081

Merged
merged 3 commits into from
Nov 12, 2017
Merged

Conversation

yosmoc
Copy link
Member

@yosmoc yosmoc commented Nov 6, 2017

fixup commit for 0bf7e8b
Solarized light/dark shares the same css file 'solarized.css'. Split by a space and use first one, since "solarized light" and "solarized dark" are the only theme which has a space in the theme name.

@kazup01 kazup01 requested a review from sota1235 November 7, 2017 03:33
@kazup01
Copy link
Member

kazup01 commented Nov 7, 2017

Thank you for your contribution! We will check it.

@kazup01 kazup01 added the awaiting review ❇️ Pull request is awaiting a review. label Nov 7, 2017
@@ -122,7 +122,7 @@ function set (updates) {
: 'default'

if (newTheme !== 'default') {
editorTheme.setAttribute('href', '../node_modules/codemirror/theme/' + newTheme + '.css')
editorTheme.setAttribute('href', '../node_modules/codemirror/theme/' + newTheme.split(' ')[0] + '.css')
Copy link
Contributor

Choose a reason for hiding this comment

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

This fixing is just only for solarized theme.
Can you add checking that newTheme is solarized or not?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this change is for solarized theme only. Currently, solarized dark/light is the only the theme which contains space, so this change will not cause the problem for other theme.

However, as you pointed out, if I add the newTheme is solarized or not, this makes more clear the intention of code.

Following code also doesn't check the theme, so I will also update this.
https://github.com/BoostIO/Boostnote/blob/993cb9cb0b7c72b13b1a1cba5ed26c7a29fbcdb7/browser/components/MarkdownPreview.js#L261

Thanks for reviewing!

Copy link
Contributor

@sota1235 sota1235 left a comment

Choose a reason for hiding this comment

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

Please confirm comment

@yosmoc yosmoc force-pushed the solarized_bug_fix branch from 6b107f5 to 864c5e4 Compare November 9, 2017 22:12
@@ -258,7 +258,9 @@ export default class MarkdownPreview extends React.Component {
theme = consts.THEMES.some((_theme) => _theme === theme) && theme !== 'default'
? theme
: 'elegant'
this.getWindow().document.getElementById('codeTheme').href = `${appPath}/node_modules/codemirror/theme/${theme.split(' ')[0]}.css`
this.getWindow().document.getElementById('codeTheme').href = theme.startsWith('solarized')
? `${appPath}/node_modules/codemirror/theme/${theme.split(' ')[0]}.css`
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using theme.substr(0, 9); instead of splitting? Looks a bit clearer to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for suggestion.

Personally, I cannot see significant differences between your suggestion and original code from readable perspective. However now this code is only called for solarized dark/light theme, so I think
${appPath}/node_modules/codemirror/theme/solarized.css
is the most clear code. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

@yosmoc Oh.. yes. Completely overlooked that.

fixup for 0bf7e8b
ConfigManager is also needed to change.
solarized dark/light shares the solarized.css
Copy link
Contributor

@sota1235 sota1235 left a comment

Choose a reason for hiding this comment

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

LGTM
Thank you for fixing!

@sota1235 sota1235 added next release (v0.8.17) and removed awaiting review ❇️ Pull request is awaiting a review. labels Nov 12, 2017
@kazup01 kazup01 merged commit 8edfc15 into BoostIO:master Nov 12, 2017
@kazup01
Copy link
Member

kazup01 commented Nov 12, 2017

Merged. Thank you for your contribution @yosmoc :)

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.

5 participants