"Switch to legacy editor" should preserve content of page
This can be achieved with some JavaScript. The notice is here:
https://github.com/publiclab/plots2/blob/master/app/controllers/editor_controller.rb#L40
But we should probably move it into the HTML template here:
https://github.com/publiclab/plots2/blob/master/app/views/editor/rich.html.erb
Once we do that, we can use editor.richTextModule.value(); from the PublicLab.Editor project to fetch the markdown of the post and add it to the URL of the legacy editor with ?body=______ syntax. Same for the title and tags (although we won't be able to grab the lead image as easily)
Can I pick this up?
Yes please!!! That would be great. I'm happy to add any info necessary!
On Aug 4, 2017 8:09 PM, "Pratik Kamble" [email protected] wrote:
Can I pick this up?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/1563#issuecomment-320377974, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ5xmlcguQL3iCdVil2D27j1qW8tVks5sU7KagaJpZM4OsTfL .
Did you need some help getting started with this? Thanks!
@jywarren Sorry, I got caught up with something else, I'll get started on this, and get back to you if I need some help! Thanks
...Once we do that..
What is it exactly? From what I understood, I have to use JS to get the body markdown and add it here. However, I do not see said line on the html, so where am I supposed to append it?
Hi, so, I believe we have to set up an onClick listener, since we'll have to get the latest body text. So something like:
$('.legacy-button').click(function onLegacyClick() {
window.location = "/post?legacy=true&body=" + editor.richTextModule.value();
});
But, sometimes people arrive at the /post page with URL get parameters already set. So we may need to think about getting those too:
https://publiclab.org/post?tags=community,web-development,software,plots2,outreach
We can get those using editor.tagsModule.value() -- so let's append those to the end as well. The final URL in this case would be:
https://publiclab.org/post?legacy=true&tags=community,web-development,software,plots2,outreach&body=____
For title, editor.titleModule.value(). So I think we can assemble all three and add them to the URL. Make sense?
Also, just mentioning @Fastie who originally requested this feature so he knows when it's complete. Hi, Chris!
@jywarren If this issue is still available, can I work on it?
Yes please! Thank you!
On Oct 6, 2017 2:58 AM, "Diksha Manchanda" [email protected] wrote:
@jywarren https://github.com/jywarren If this issue is still available, can I work on it?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/1563#issuecomment-334698779, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJwjNRkT6P1FXq3twcOZch269qCDLks5speufgaJpZM4OsTfL .
I believe this has been solved, although I'm not sure it'll work for very complex existing body text. If we have trouble with that, we may want to look into submitting a synchronous POST request with the body text instead of trying to include it in the URL GET parameters.
And thanks, @Dishka2008! We'll get this published in the next few days!
@icarito if you're comfortable publishing to production please go ahead!