1. // Quote Text
  2. var $m = $('#canvas_frame').contents();
  3. var orig_button = $m.find('.fa.eL')
  4. var button = '<img id=":kl" class="fa eL blockquote-sel" src="images/cleardot.gif" command="+BLOCKQUOTE_TEXT" title="Quote" unselectable="on">';
  5. var $ta = $m.find('iframe.Am.Al.editable').contents();
  6. // Only add when it's not there.
  7. if ( ! orig_button.next().hasClass('blockquote')) {
  8.  
  9. orig_button.after(button);
  10. orig_button.next().unbind().click(function() {
  11. var selection = $m[0].getSelection().toString();
  12. var quote = [
  13. "<div><br></div>",
  14. '<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">' + selection + "</blockquote>",
  15. "<div><br></div>"
  16. ].join('');
  17.  
  18. console.log('Doing it.');
  19. // body can be empty.
  20. $ta.find('body').html($ta.find('body').html() + quote);
  21. });
  22. }