Stackoverflow WYSIWYG Pagedown.js Editor restricting live preview to on click rather than on keyup

StackOverflow https://stackoverflow.com/questions/16705099

Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top