Cursor position improvements, focused fields - part 1 (more in addons) [SCI-8098]

This commit is contained in:
Giga Chubinidze 2023-05-26 02:59:19 +04:00
parent cf6a901b67
commit d72653aff2
7 changed files with 28 additions and 3 deletions

View file

@ -9,6 +9,7 @@ function applyCreateWopiFileCallback() {
$modal.find('#element_id').val($(this).data('id'));
$modal.find('#element_type').val($(this).data('type'));
$modal.modal('show');
$($modal).find('#new-wopi-file-name').focus();
return false;
});

View file

@ -343,6 +343,13 @@ var ExperimnetTable = {
}
});
},
initModalInputFocus: function() {
$(document).on('shown.bs.modal', function() {
var inputField = $('#edit-module-name-input');
var value = inputField.val();
inputField.focus().val('').val(value);
});
},
initMoveModulesModal: function() {
$(this.tableContainer).on('click', '#moveTask', (e) => {
e.stopPropagation();
@ -633,6 +640,7 @@ var ExperimnetTable = {
this.initMyModuleActions();
this.initRestoreMyModules();
this.initManageUsersDropdown();
this.initModalInputFocus();
}
};

View file

@ -1521,7 +1521,9 @@ function initEditModules() {
})
.on("shown.bs.modal", function(event) {
// Focus the text element
$(this).find("#edit-module-name-input").focus();
var inputField = $('#edit-module-name-input');
var value = inputField.val();
inputField.focus().val('').val(value);
})
.on("hide.bs.modal", function (event) {
// Remove potential error classes

View file

@ -259,6 +259,13 @@ var ProjectsIndex = (function() {
$.get(url, function(result) {
$(editProjectModal).find('.modal-content').html(result.html);
$(editProjectModal).modal('show');
['project_name', 'project_folder_name'].forEach(function(inputId) {
var inputField = $('#' + inputId);
var value = inputField.val();
inputField.focus().val('').val(value);
})
$(editProjectModal).find('.selectpicker').selectpicker();
$(editProjectModal).find('form')
.on('ajax:success', function(ev, data) {
@ -354,7 +361,7 @@ var ProjectsIndex = (function() {
$(moveToModal).find('.modal-content').html(result.html);
$(moveToModal).modal('show');
initializeJSTree($(moveToModal).find('#moveToFolders'));
$('#searchFolderTree').focus();
$(moveToModal).find('form')
.on('ajax:before', function() {
$('<input>').attr({

View file

@ -270,6 +270,12 @@
}
}
$(document).on('shown.bs.modal', function() {
var inputField = $('#experiment-name');
var value = inputField.val();
inputField.focus().val('').val(value);
});
function initNewExperimentToolbarButton() {
let forms = '.new-experiment-form';
$(experimentsPage)

View file

@ -328,7 +328,7 @@
<div class="panel-body">
<div class="form-group">
<label class="control-label">Name</label>
<input type="text" class="form-control"
<input type="text" class="form-control" autofocus
rel="results[name]" name="results[name][${i}]">
</div>
<div class="form-group">

View file

@ -8,6 +8,7 @@ export default {
$wopiModal.find('#element_id').val(step.id);
$wopiModal.find('#element_type').val('Step');
$wopiModal.modal('show');
$($wopiModal).find('#new-wopi-file-name').focus();
$wopiModal.find('form').on(
'ajax:success',