     format = newFormat
     if format == "markdown"
       label = "Markdown"
-      decorator = markdownDecorator
+      decorator = -> markdownDecorator
     else if format == "html"
       label = "HTML"
-      decorator = htmlDecorator
+      decorator = -> htmlDecorator
 
     formatButton.find("a").html(label)
 


  # Quoting
  $(Sugar).on "quote", (event, data) ->
    [prefix, replacement, postfix] = decorator.quote(
      data.text,
      data.html,
      data.username,
      data.permalink
    )
    replaceSelection(prefix, replacement, postfix)

    # Scroll to the bottom of the textarea
    textarea.scrollTop = textarea.scrollHeight

  # Emoticons
  addEmojiButton = (name, image) ->
    link = $("<a title=\"#{name}\"><img alt=\"#{name}\" class=\"emoji\" src=\"#{image}\" width=\"16\" height=\"16\"></a>")
    link.click -> replaceSelection(textarea, "", ":" + name + ": ", "")
    $("<li class=\"button\"></li>").append(link).appendTo(emojiBar)

  # TODO: Get these from the backend
