Fix entry_with_replacements unable to select text.
This hook had a bug where you couldn't select text because every time you push a button, including ctrl+a or shift+left/right, the cursor position gets reset and then deselects immediately. So let's only reset the content and cursor only when text changes, so arrow keys and ctrl don't have any negative effects.master
parent
eff0efdf40
commit
4da331a3ab
|
@ -129,9 +129,13 @@ common.entry_with_tagname_replacements =
|
|||
function entry_with_tagname_replacements(event)
|
||||
{
|
||||
var cursor_position = event.target.selectionStart;
|
||||
event.target.value = common.tagname_replacements(event.target.value);
|
||||
event.target.selectionStart = cursor_position;
|
||||
event.target.selectionEnd = cursor_position;
|
||||
var new_value = common.tagname_replacements(event.target.value);
|
||||
if (new_value != event.target.value)
|
||||
{
|
||||
event.target.value = new_value;
|
||||
event.target.selectionStart = cursor_position;
|
||||
event.target.selectionEnd = cursor_position;
|
||||
}
|
||||
}
|
||||
|
||||
common.html_to_element =
|
||||
|
|
Loading…
Reference in New Issue