class Skr.Components.LatexSnippets extends Lanes.React.Component getInitialState: -> name: '' latex: '' componentWillMount: -> @props.settings['latex_snippets'] ||= {} saveSnippet: (ev) -> @setState(latex: ev.target.value) name = @refs.name.value if @state.name @props.settings['latex_snippets'][@state.name] = ev.target.value updateName: (ev) -> @setState(name: ev.target.value) setSnippet: (choice) -> @setState(name: choice.id, latex: @props.settings['latex_snippets'][choice.id]) getSnippets: -> snippets = [] for name, latex of @props.settings['latex_snippets'] snippets.push {id: name} snippets onRemove: -> delete @props.settings['latex_snippets'][@state.name] @setState(name: '', latex: '') render: ->

Print Form Snippets

Snippet name Latex