User-424509365 posted
I am developing website using asp.net and inside of it there is a feature like "Quote" in this website. So user have the ability to highlight the text that he want to quote and press the quote button exactl like happening in this website

But I am not a expert in javascript. So far I achieved was this
<script>
function handlePaste(e) {
var clipboardData, pastedData;
// Stop data actually being pasted into div
e.stopPropagation();
e.preventDefault();
// Get pasted data via clipboard API
clipboardData = e.clipboardData || window.clipboardData;
pastedData = clipboardData.getData('Text');
// Do whatever with pasteddata
alert(pastedData);
}
document.getElementById('reference-post-content').addEventListener('paste', handlePaste);
</script>
In there if highlighted a text and press CTRL+C and then again if i press CTRL+V then it will give a popup message by displaying that highlighted text. But this is not what i wanted. What I want is that text should go to richtextbox below if user click quote
btn. Also it should go to rich textbox like this.
message is in a thread in which the user is a THREAD_PARTICIPANT.
I'm afraid I can never state these
I also have this impmentation. I have a tinymce rich textbox to post something.
I found this javascript function when I inspect the elements of this website
<script>
$("#quote-action") != null && $("#quote-action").bind("click", function () {
var n = null, t = $("#quote-createdby").val();
if (window.getSelection && (window.getSelection() || window.getSelection().extentNode != null) && window.getSelection().rangeCount > 0) {
var i = window.getSelection(), u = i.getRangeAt(0).cloneContents(), r = document.createElement("div"); r.appendChild(u); n = r.innerHTML; i.removeAllRanges()
}
else document.selection && (n = document.selection.createRange().htmlText, document.selection.empty()); (n == null || n == "") && (n = $("#reference-post-content").html());
$.ajax({ type: "POST", url: "/soa/post/body/removeprettyprinttags", data: { body: n }, success: function (i) { i != null && i.result != "" && (n = i.result); tinyMCE.activeEditor.focus(); tinyMCE.activeEditor.selection.moveToBookmark(tinyMCE.activeEditor.updatedSelectionBookmark); tinyMCE.execCommand("mceInsertContent", !1, '' + n + "
"); UpdateBookmark(tinyMCE.activeEditor) }, error: function (i, r, u) { isProd || alert("Error: " + r + " " + u); tinyMCE.activeEditor.focus(); tinyMCE.activeEditor.selection.moveToBookmark(tinyMCE.activeEditor.updatedSelectionBookmark); tinyMCE.execCommand("mceInsertContent", !1, '' + n + "
"); UpdateBookmark(tinyMCE.activeEditor) } })
});
</script>
But still its not working
So how to do this? Can somebody provide the code that working on this website?