mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-19 12:41:12 +00:00
Added single click to select on URL in URL generator
This commit is contained in:
parent
1d492c1b11
commit
4c570fd7f6
1 changed files with 17 additions and 0 deletions
|
|
@ -45,5 +45,22 @@ $(function() {
|
|||
$form.change(formChangeHandler);
|
||||
$form.keyup(formChangeHandler);
|
||||
formChangeHandler();
|
||||
|
||||
// When the user clicks the URL, automatically select the whole thing (for easier copying)
|
||||
$result.click(function() {
|
||||
if (document.selection) {
|
||||
document.selection.empty();
|
||||
|
||||
var range = document.body.createTextRange();
|
||||
range.moveToElementText(this);
|
||||
range.select();
|
||||
} else if (window.getSelection) {
|
||||
window.getSelection().removeAllRanges();
|
||||
|
||||
var range = document.createRange();
|
||||
range.selectNodeContents(this);
|
||||
window.getSelection().addRange(range);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue