standardnotes / markdown-basic

[Moved to https://github.com/standardnotes/app] A basic Markdown editor for Standard Notes
https://standardnotes.com
GNU Affero General Public License v3.0
11 stars 12 forks source link

Typescript Conversion #29

Open TheodoreChu opened 4 years ago

TheodoreChu commented 4 years ago

Changes:

moughxyz commented 4 years ago

It doesn't look like we're handling preview generation (related to EditorKit, not markdown editor): https://github.com/standardnotes/editor-kit/blob/master/src/lib/EditorKitInternal.js#L212

https://github.com/sn-extensions/markdown-basic/blob/master/app/components/Home.js#L163

Previews related to what is shown in the two lines under the note title in the list of notes. Here we want to escape markdown syntax. This is why we render the content even if they are just in edit mode.

For example, if the user types "# hello" in the first line of the note, the preview in the list of notes in the SN interface should just say "hello".

TheodoreChu commented 4 years ago

I think the result of preview generation has to do with EditorKit, not the optimization that I tried to implement earlier

TheodoreChu commented 4 years ago

Custom previews should work with the latest commit: https://github.com/sn-extensions/markdown-basic/pull/29/commits/5be724055c9b0acce041b788788c6e4067336911

TheodoreChu commented 4 years ago

I changed the favicon to a blue hashtag that I found on Figma and I added Prettier. Is that OK?

When the PR is ready, feel free to delete Home.js

moughxyz commented 4 years ago

When the PR is ready, feel free to delete Home.js

Wait what? You should delete this file as part of your PR if that's what constitutes a wholly complete code refactor.

TheodoreChu commented 4 years ago

When the PR is ready, feel free to delete Home.js

Wait what? You should delete this file as part of your PR if that's what constitutes a wholly complete code refactor.

I thought you might have wanted to do the honors of deleting Home.js. I deleted it: https://github.com/sn-extensions/markdown-basic/pull/29/commits/3c26a0887e7d4a1e3ab44eaf0784ccf7bfd1d665

moughxyz commented 4 years ago

@ningsongshen can you review this PR and test locally in SN env? Especially see if previews are being generated correctly (as in the 2-line preview that appears in SN under the note's title)

ningsongshen commented 4 years ago

So I've just tested it (will look at the PR code a bit later), here are my comments:

moughxyz commented 4 years ago

I can only see one line of preview, whether it is on web or desktop or Windows or Linux

I think that's expected.

If there is nothing in the editor, the preview has null in it.

@TheodoreChu

ningsongshen commented 4 years ago

EDIT: nevermind it is an error on my end. Note to self: use http not https

This didn't happen when I last tested it but now I can't seem to import the extension :cry:

image

ningsongshen commented 4 years ago

So Theodore requested some assistance finish up this PR but it's pretty big so I wanted to split it up into smaller parts that I can test and try it out to understand the changes (and for whoever is coming to work on this after me!)