cblgh / cerca

lean forum software
Other
124 stars 18 forks source link

Edit support for posts #42

Closed stevenleeg closed 8 months ago

stevenleeg commented 1 year ago

I just made a post on the Merveilles forum and, after hitting submit, realized that the formatting was off for my ordered list. The lack of edit functionality makes it so I can't go back and correct it which made me think of this.

Is there any interest in adding this functionality?

cblgh commented 1 year ago

@stevenleeg thanks for the issue and the clear example. yes, edit would be fabulous to have for this exact reason! there is interest in having it. are you interested in adding it, i could share some of guiding thoughts on how i'd go about it?

alexwennerberg commented 9 months ago

Started working on this. Went with a no-JS solution. Need to find some way to redirect back to the original thread though (and do a bit of cleanup / error handling). I'll try and finish it up later this week

https://github.com/cblgh/cerca/compare/main...alexwennerberg:cerca:edit

cblgh commented 9 months ago

nice :) something i was considering for the addition of edit was to simultaneously fix the problem of "oh no my markdown wasn't right" in that the authoring step could also have a preview button

so perhaps something like

[ textarea ]

[ post ] [ preview ]

where [textarea] is the current input textarea, [post] and [preview] are buttons. post works like it does today to not introduce any friction when posting, and preview could potentially re-use the edit view for displaying the post.

one way the edit view could be reused: perhaps by conditionally embedding a textarea below the rendered message one could iterate on the post and, when content, click "post". at which point the post actually is saved in the database. alternatively one could be directed to go back to edit the content

alexwennerberg commented 9 months ago

I like this idea -- I think I'll have some time on Friday to work on it, or may be able to squeeze in a bit of work over lunch today!

alexwennerberg commented 9 months ago

Made a few changes in https://github.com/cblgh/cerca/commit/087acb35d5c3da69b56df30394f4de43f60f0398 to render HTML alongside the edit page

Changed markup to take a string instead of a template.HTML and moving the rendering to a template function. I think this makes sense, bc a markdown string is a. not HTML and b. not necessarily safe to render -- let me know what you think

cblgh commented 9 months ago

i think i like it! can you share a screenshot of what it currently looks like? i'd be curious to see :>

alexwennerberg commented 9 months ago

Will do! It is a rainy weekend in New York so I should be able to put together some PRs

alexwennerberg commented 9 months ago

edit

cblgh commented 8 months ago

we've got it IN #54 thanks @alexwennerberg