It looks like you're new here. If you want to get involved, click one of these buttons!
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);
}
<a name="CommentEditor"></a>
<fieldset>, for it to work.
Comments
any fix or this doesn't supposed to show up like that?
- Spam
- Abuse
0 · Insightful Awesome LOL ·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 += " ";
}
quoteHTML += '<blockquote>';
quoteHTML += '<cite>';
quoteHTML += authorName;
quoteHTML += ': </cite>';
quoteHTML += commentText;
quoteHTML += '</p></div></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 http://tinymce.moxiecode.com/punbb/viewtopic.php?id=6140 (post #3) is the answer; I did not try that yet.
- Spam
- Abuse
0 · Insightful Awesome LOL ·