mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-08 06:16:02 +01:00
Maintain cursor position while cleaning up the folder name value (fixes #144)
This commit is contained in:
@@ -163,8 +163,14 @@ $(function(){
|
|||||||
|
|
||||||
|
|
||||||
$('input[name="folder"]').on('input', function(e){
|
$('input[name="folder"]').on('input', function(e){
|
||||||
|
var start = this.selectionStart,
|
||||||
|
end = this.selectionEnd;
|
||||||
|
|
||||||
value = $(this).val().toLowerCase().replace(/\s/g, '-').replace(/[^a-z0-9_\-]/g, '');
|
value = $(this).val().toLowerCase().replace(/\s/g, '-').replace(/[^a-z0-9_\-]/g, '');
|
||||||
$(this).val(value);
|
$(this).val(value);
|
||||||
|
|
||||||
|
// restore cursor position
|
||||||
|
this.setSelectionRange(start, end);
|
||||||
});
|
});
|
||||||
|
|
||||||
childrenToggles.on('click', function () {
|
childrenToggles.on('click', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user