Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Combining TinyMCE and Quotations

I have made some changes to the Quotations add-on, to make it work with the TinyMCE add-on.

For those who are interested, the changes are as follows.

In extensions/Quotations/quote.js, I changed the quote function into:
function quote(commentId, authorId, authorName) { var selText = getSel(); var commentText = ""; commentText = dumpCodeTree(document.getElementById("CommentBody_" + commentId)); if(selText != "") commentText = selText; location.hash = '#CommentEditor'; var rtEditor = tinyMCE.getInstanceById('CommentBox'); tinyMCE.activeEditor.setContent(commentText); }

The location'hash part is an addition to let the browser scroll to the editor when the user has clicked the quote button.
In my theme's Comment_Form.php I have added
<a name="CommentEditor"></a>
just before <fieldset>, for it to work.


  • thanks sylviastuurman, is sort of working now, however, the text doesn't come formatted as "quoted by" so it looks like if it's not a quote but text from the person who's writing a message if you know what I mean...
    any fix or this doesn't supposed to show up like that?
  • That's right.
    The full code I have is:
    // the quotation to paste var commentText = ""; var selText = getSel(); if(selText != "") { commentText = selText; } commentText = dumpCodeTree(document.getElementById("CommentBody_" + commentId)); // the quotation in HTML var quoteHTML = ""; // the TinyMCE editor var rtEditor = tinyMCE.getInstanceById('CommentBox'); if(tinyMCE.activeEditor.getContent() != "") { quoteHTML += "&nbsp;"; } quoteHTML += '<blockquote>'; quoteHTML += '<cite>'; quoteHTML += authorName; quoteHTML += ': &nbsp;&nbsp;</cite>'; quoteHTML += commentText; quoteHTML += '</blockquote>'; // present the user with the editor location.hash = '#CommentEditor'; // insert the quote var rtEditor = tinyMCE.getInstanceById('CommentBox'); tinyMCE.activeEditor.execCommand('mceInsertContent',false, quoteHTML);
    But there are still problems with this code in Opera: the caret is inside the blockquote, and the user can't get out of it without switching to HTML.

    Maybe (post #3) is the answer; I did not try that yet.
This discussion has been closed.