Electron Fundamentals, v2 Export HTML File Exercise
This course is out of date and does not reflect our standards or industry best practices.
Transcript from the "Export HTML File Exercise" Lesson
>> Steve Kinney: So now, your mission. We implemented Save Markdown. Save Markdown had to know if they had a current file, prompt them for a new one if they didn't, and then put that in place and open that file. Export HTML is a subset of that. Basically, no matter what, we want to ask them where they wanna save it.
[00:00:19] We don't need to reopen that file, cuz it's the HTML, it's not what our editor does. So all we need to do in this case is wire it up to the Save HTML button to trigger the Show Save dialog, let them choose a place. Based on that choice, write a file to the file system with that file name and the HTML content.
[00:00:35] If you need the HTML, which you're gonna need, I mean, you could call the marked library, but you also have it in that DOM element, right? You have it in that div where we're rendering it. So you could also just grab the htmlView and grab its innerHTML, and you'll also get the same content.
[00:00:52] So it's up to you which way you choose to do that. I would just grab it. If I already did the work, I would just grab that output and use that.