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

clicking "Edit this note" in the published note should default to the "Both" mode #27

Closed
stragu opened this issue Apr 4, 2019 · 2 comments
Labels
good first issue Good for newcomers type: feature enhancement An improvement to existing functionality

Comments

@stragu
Copy link
Contributor

stragu commented Apr 4, 2019

When clicking the pencil icon ("Edit this note") in a published note page, the default mode should be "Both" (i.e. code on left, rendered on right) rather "View", the current default. That is, if the user has editing rights I guess.

Tested with "Freely" setting.

@SISheogorath SISheogorath added the type: feature enhancement An improvement to existing functionality label Apr 4, 2019
@ccoenen ccoenen added the good first issue Good for newcomers label Apr 4, 2019
@ccoenen
Copy link
Contributor

ccoenen commented Apr 4, 2019

I think this would make a very nice first issue: The button leads to a URL that is essentially /s/<note-id>/edit which is then defined as a route here:

https://github.com/codimd/server/blob/f13a91c6988b55a0cd50fc530bdc13baa96bf3b4/lib/web/noteRouter.js#L18

and which will lead to this function that actually does the rediect.

https://github.com/codimd/server/blob/f13a91c6988b55a0cd50fc530bdc13baa96bf3b4/lib/response.js#L422-L437

So, essentially by changing this line, you could solve your own request:

https://github.com/codimd/server/blob/f13a91c6988b55a0cd50fc530bdc13baa96bf3b4/lib/response.js#L430

There's a similar thing in slides mode by the way, the two should be fixed at the same time:

https://github.com/codimd/server/blob/f13a91c6988b55a0cd50fc530bdc13baa96bf3b4/lib/response.js#L444

All that would be needed is to add ?both to the url!

stragu added a commit to stragu/server that referenced this issue Apr 5, 2019
Add "both" mode to URLs because I assume most people want to straight away see the code when they click the "edit" button in a published note.

Fixes hedgedoc#27

Not tested, followed instructions from @ccoenen , please do review! :)
@stragu
Copy link
Contributor Author

stragu commented Apr 5, 2019

Thanks heaps for the explanations! I definitely needed some hand-holding :)

Hopefully this does it: #37

Cheers

stragu added a commit to stragu/server that referenced this issue Apr 5, 2019
Add "both" mode to URLs because I assume most people want to straight away see the code when they click the "edit" button in a published note.

Fixes hedgedoc#27

Not tested, followed instructions from @ccoenen , please do review! :)

Signed-off-by: Stéphane Guillou <stephane.guillou@member.fsf.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: feature enhancement An improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants