Skip to content

Instantly share code, notes, and snippets.

@gokmen
Forked from anonymous/index.coffee
Created May 30, 2013 08:00
Show Gist options
  • Save gokmen/5676379 to your computer and use it in GitHub Desktop.
Save gokmen/5676379 to your computer and use it in GitHub Desktop.
React's markdown example with KDFramework
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
.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