Fixed cursor positioning bug.
git-svn-id: http://svn.automattic.com/wordpress/trunk@599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
49208f7551
commit
28cad83a06
|
@ -249,7 +249,7 @@ function edToolbar() {
|
||||||
function edInsertTag(myField, i) {
|
function edInsertTag(myField, i) {
|
||||||
//IE support
|
//IE support
|
||||||
if (document.selection) {
|
if (document.selection) {
|
||||||
myField.focus();
|
myField.focus();
|
||||||
sel = document.selection.createRange();
|
sel = document.selection.createRange();
|
||||||
if (sel.text.length > 0) {
|
if (sel.text.length > 0) {
|
||||||
sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
|
sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
|
||||||
|
@ -270,7 +270,7 @@ function edInsertTag(myField, i) {
|
||||||
else if (myField.selectionStart || myField.selectionStart == '0') {
|
else if (myField.selectionStart || myField.selectionStart == '0') {
|
||||||
var startPos = myField.selectionStart;
|
var startPos = myField.selectionStart;
|
||||||
var endPos = myField.selectionEnd;
|
var endPos = myField.selectionEnd;
|
||||||
var cursorPos;
|
var cursorPos;
|
||||||
if (startPos != endPos) {
|
if (startPos != endPos) {
|
||||||
myField.value = myField.value.substring(0, startPos)
|
myField.value = myField.value.substring(0, startPos)
|
||||||
+ edButtons[i].tagStart
|
+ edButtons[i].tagStart
|
||||||
|
@ -279,7 +279,7 @@ function edInsertTag(myField, i) {
|
||||||
+ myField.value.substring(endPos, myField.value.length);
|
+ myField.value.substring(endPos, myField.value.length);
|
||||||
cursorPos = endPos
|
cursorPos = endPos
|
||||||
+ edButtons[i].tagStart.length
|
+ edButtons[i].tagStart.length
|
||||||
+ edButtons[i].length;
|
+ edButtons[i].tagEnd.length;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
|
if (!edCheckOpenTags(i) || edButtons[i].tagEnd == '') {
|
||||||
|
|
Loading…
Reference in New Issue