I stuck some alerts in to see which method Opera is using, it's using document.selection mode
I put window.selection at the top so it was tested first, no joy.
Now, I have just tried moving the netscape method to the top, bingo!
function insertAtCursor(myField, myValue) {
//Mozilla/Firefox/Netscape 7+ support
if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length);
}
//IE support
else if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
else {
myField.value += myValue;
}
}
Can anyone replace function insertAtCursor at line 976 in imagepicker.module and test in Opera as well as IE.
I don't have easy access to IE and it needs to be supported.
Good news, so far. I would still like a confirmation for IE8
I am also thinking that the insertAtCursor function is asking the wrong question, surely it should be detecting the browser and deciding which method to use on that basis.
more later.....
Comments
Comment #1
hutch commentedThat's right, it did work in earlier versions of Opera, very annoying ;-(
Comment #2
Tarsjusz commentedis any solution known already? or coming...
Comment #3
hutch commentedThis is AFAIK beyond the control of imagepicker, unless anyone knows of a javascript fix/hack for Opera
Comment #4
arkhnchul commentedin imagepicker.module, function isertAtCursor (line 976) insert code for opera before final else:
Comment #5
hutch commentedDoesn't work for me ;-(
I stuck some alerts in to see which method Opera is using, it's using document.selection mode
I put window.selection at the top so it was tested first, no joy.
Now, I have just tried moving the netscape method to the top, bingo!
Can anyone replace function insertAtCursor at line 976 in imagepicker.module and test in Opera as well as IE.
I don't have easy access to IE and it needs to be supported.
Comment #6
arkhnchul commentedopera 10.00, 10.01, 10.10 (linux buids)
IE7
it works.
Comment #7
hutch commentedGood news, so far. I would still like a confirmation for IE8
I am also thinking that the insertAtCursor function is asking the wrong question, surely it should be detecting the browser and deciding which method to use on that basis.
more later.....
Comment #8
hutch commentedHere is another version of insertAtCursor()
it uses Jquery browser detection function
I have tested this with firefox 2 and 3, Opera 9 and 10 and safari version 4.
Please test and report back folks!
Comment #9
hutch commentedPlease try the latest development snapshot for this issue.
Comment #10
hutch commented