mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-08 14:26:10 +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){
|
||||
var start = this.selectionStart,
|
||||
end = this.selectionEnd;
|
||||
|
||||
value = $(this).val().toLowerCase().replace(/\s/g, '-').replace(/[^a-z0-9_\-]/g, '');
|
||||
$(this).val(value);
|
||||
|
||||
// restore cursor position
|
||||
this.setSelectionRange(start, end);
|
||||
});
|
||||
|
||||
childrenToggles.on('click', function () {
|
||||
|
||||
Reference in New Issue
Block a user