diff -Naur roundcubemail-0.1-rc2-orig/program/js/app.js roundcubemail-0.1-rc2-caret_position/program/js/app.js
|
old
|
new
|
|
| 1833 | 1833 | input_message.value = message; |
| 1834 | 1834 | |
| 1835 | 1835 | this.env.identity = id; |
| | 1836 | |
| | 1837 | // Setting caret to start of message box, after writing signatures |
| | 1838 | this.set_caret2pos(input_message); |
| | 1839 | |
| 1836 | 1840 | return true; |
| 1837 | 1841 | }; |
| 1838 | 1842 | |
| … |
… |
|
| 3547 | 3551 | obj.focus(); |
| 3548 | 3552 | }; |
| 3549 | 3553 | |
| | 3554 | this.set_caret2pos = function(obj) |
| | 3555 | { |
| | 3556 | if (!obj.caretPos) |
| | 3557 | obj.caretPos = 0; |
| | 3558 | if (obj.createTextRange) |
| | 3559 | { |
| | 3560 | this.set_caret2start(obj); |
| | 3561 | } |
| | 3562 | else if (obj.setSelectionRange) |
| | 3563 | obj.setSelectionRange(obj.caretPos,obj.caretPos); |
| | 3564 | }; |
| | 3565 | |
| | 3566 | this.save_caret_pos = function(obj) |
| | 3567 | { |
| | 3568 | if (obj.createTextRange) |
| | 3569 | { |
| | 3570 | var range = document.selection.createRange(); |
| | 3571 | var isCollapsed = range.compareEndPoints("StartToEnd", range) == 0; |
| | 3572 | if (!isCollapsed) |
| | 3573 | range.collapse(true); |
| | 3574 | var b = range.getBookmark() |
| | 3575 | obj.caretPos = b.charCodeAt(2) - 481; |
| | 3576 | } |
| | 3577 | else if (obj.selectionStart) |
| | 3578 | obj.caretPos = obj.selectionStart; |
| | 3579 | }; |
| 3550 | 3580 | |
| 3551 | 3581 | // set all fields of a form disabled |
| 3552 | 3582 | this.lock_form = function(form, lock) |
diff -Naur roundcubemail-0.1-rc2-orig/program/steps/mail/compose.inc roundcubemail-0.1-rc2-caret_position/program/steps/mail/compose.inc
|
old
|
new
|
|
| 431 | 431 | // If desired, set this text area to be editable by TinyMCE |
| 432 | 432 | if ($isHtml) |
| 433 | 433 | $attrib['mce_editable'] = "true"; |
| | 434 | $attrib['onmouseup'] = "rcmail.save_caret_pos(this);"; |
| | 435 | $attrib['onkeyup'] = "rcmail.save_caret_pos(this);"; |
| | 436 | $attrib['onfocus'] = "rcmail.set_caret2pos(this);"; |
| 434 | 437 | $textarea = new textarea($attrib); |
| 435 | 438 | $out .= $textarea->show($body); |
| 436 | 439 | $out .= $form_end ? "\n$form_end" : ''; |