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

fix the bug when using markdown syntax h1 #510

Merged
merged 6 commits into from May 20, 2017

Conversation

sosukesuzuki
Copy link
Member

@sosukesuzuki sosukesuzuki commented Apr 26, 2017

This PR can resolve the issue #495.

Before
2017-04-26 18 19 41


After
2017-04-29 14 14 20


@asmsuechan
Copy link
Contributor

An error happens

Uncaught TypeError: Cannot read property 'trim' of undefined

screen shot 2017-04-30 at 13 28 23

And cannot save the note. Because, I expect, this line is buggy: let trimmedNextLine = splitted[i + 1].trim() due to the array index out of bound.

Probably, you should use forEach instead of for. Feel free to ask me anything whenever!

let trimmedNextLine = splitted[i + 1].trim()
splitted.forEach((line, index) => {
let trimmedLine = line.trim()
let trimmedNextLine = typeof splitted[index + 1] === 'undefined' ? '' : splitted[index + 1].trim()
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use just splitted[index + 1] === undefined.

Copy link
Contributor

@asmsuechan asmsuechan left a comment

Choose a reason for hiding this comment

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

dppu0z9

@asmsuechan asmsuechan merged commit adbdc2c into master May 20, 2017
@asmsuechan asmsuechan deleted the fix-note-title-bug-for-h1 branch May 20, 2017 05:27
@kohei-takata kohei-takata mentioned this pull request Jun 12, 2017
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.

None yet

3 participants