bryanph / GeistMap

An experimental personal knowledge base with a focus on connections
https://geistmap.com
GNU Affero General Public License v3.0
446 stars 31 forks source link

code snippets in editor use lots of line spacing in some situations #161

Closed VincentVW closed 6 years ago

VincentVW commented 6 years ago

See screenshot below.

When copy pasting the code snippets are mostly wrapped in one \

 block and the lines have no vertical spacing. When writing snippets yourself you get a \
 html element for each line you type. 

I would say each code snippet just needs one \

 block? Or an alternative would be removing the margin which causes the line spacing (current \
 margin is 1em 0).

Also; when copy pasting from npmjs.com, it messes up the format / moves out of code snippet mode, but I guess that's due to npmjs.com using odd spans in their code snippets.

screen shot 2018-01-05 at 12 12 22 pm

bryanph commented 6 years ago

Thanks, the code blocks are just the default draft-js example code blocks now so it has the same issues. Something like this could be implemented to handle it better: https://github.com/SamyPesse/draft-js-code

VincentVW commented 6 years ago

draft-js-code def looks like a nice set of additional utils, I don't think it relates to the line spacing though. When I compare https://draftjs.org/ to the Geist editor then the first does not add vertical spacing on new lines. The diff is that the first imports draft.css which has a line to set margins to 0.

Could it be that you're not importing anything of draft's css? https://draftjs.org/docs/advanced-topics-issues-and-pitfalls.html#missing-draft-css

If you directly use that draft.css it should be wrapped it in a namespace though, that default draft.css file def would cause side effects on the rest of your styling.

bryanph commented 6 years ago

@VincentVW Ah yes you are right, they have some global styles included there that remove all default styling. I didn't apply that everywhere so it wasn't applied in the draft editor. This should fix it: https://github.com/bryanph/Geist/commit/17bc091a7053769c611ce153896141f08ba36eac . Thanks for the issue :man_dancing: