better cursor position detection

References #185
This commit is contained in:
Garvin Hicking 2014-06-17 10:25:04 +02:00
parent de4c5e5b4f
commit 6f021ef0e6
2 changed files with 6 additions and 4 deletions

View file

@ -54,9 +54,11 @@ function emoticonchooser(instance_name, this_instance, cke_txtarea) {
} else {
// default case: no wysiwyg editor
txtarea = document.getElementById(cke_txtarea); // must be this, since staticpages and entryforms set the [id] different
if (txtarea.createTextRange && txtarea.caretPos) {
caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + ' ' + img + ' ' : caretPos.text + ' ' + img + ' ';
if (txtarea.selectionEnd) {
lft = txtarea.value.substring(0, txtarea.selectionEnd);
rgt = txtarea.value.substring(txtarea.selectionEnd);
txtarea.value = lft + ' ' + img + ' ' + rgt;
} else {
txtarea.value += ' ' + img + ' ';
}

View file

@ -30,7 +30,7 @@ class serendipity_event_emoticonchooser extends serendipity_event
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('version', '2.9.1');
$propbag->add('version', '2.10');
$propbag->add('event_hooks', array(
'backend_entry_toolbar_extended' => true,
'backend_entry_toolbar_body' => true,