-
-
Save gokmen/5676379 to your computer and use it in GitHub Desktop.
React's markdown example with KDFramework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Markdown extends JView | |
constructor:-> | |
super cssClass : 'markdown', | |
markdown : "Type some *markdown* here!" | |
@textInput = new KDInputView | |
bind : "keyup" | |
type : "textarea" | |
defaultValue : @data.markdown | |
keyup : @bound 'updateData' | |
updateData:-> | |
@data.markdown = @textInput.getValue() | |
@render() | |
pistachio:-> | |
""" | |
<h3>Input</h3> | |
{{> @textInput}} | |
<h3>Output</h3> | |
{{KD.utils.applyMarkdown(#(markdown))}} | |
""" | |
appView.addSubView new Markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.markdown { | |
background-color : #eee; | |
width : auto; | |
height : auto; | |
padding : 10px; | |
margin : 20px; | |
border : 1px solid #ccc; | |
} | |
.markdown h3 { | |
margin-bottom: 10px; | |
margin-top: 10px; | |
} | |
.markdown textarea { | |
width: 100%; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment