Home : Products : Gossamer Forum : Discussion :

Products: Gossamer Forum: Discussion: Bug or intended?: Edit Log

Here is the list of edits for this post
Bug or intended?
Hi,

When clicking the smilie images to insert the code automatically into posts (and the other markup), the code is forced to the bottom of the message no matter where your cursor is.

I think it would be better to insert the code at the cursors position.

This code should do that:

Code:
function storeCaret (html)
{
if (html.createTextRange)
html.caretPos = document.selection.createRange().duplicate();
}
function insertAtCaret (text) {
if (document.Sign.html.caretPos)
{
var caretPos = document.Sign.html.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
}
else
alert("You must click in the text area before you can insert html");
}

.......then you want something like:

Code:
<input type="button" onclick="insertAtCaret(' ');" value="Bold">


Last edited by:

jagerman: Sep 14, 2001, 2:46 PM

Edit Log: