Question

This very textbox I'm typing in on Stackoverflow uses Pagedown.js markdown to HTML conversion.

I'd like to use the Pagedown.js editor but only show the live preview HTML onclick rather than onkeyup. My reasoning is that for mobile devices the keyup-based parsing seems too taxing (SO itself doesn't use it) and it would provide just as nice a user experience to click a button to reveal the formatted text.

Is there any way to separate out editor.run() such that the button bar formatting (e.g., bracketing text with asterisks) and the live preview formatting can be uncoupled?

Was it helpful?

Solution

You can trigger the refresh by calling editor.refreshPreview() after calling editor.run(). However, the onkeyup event doesn't seem to be configurable. You can disable it by changing var startType = "delayed" to "manual" in Markdown.Editor.js.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top