Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve Text Selection after XMLSetCellValues (for Cell Out Save) #179

Merged
merged 1 commit into from
Sep 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions js/jquery.dbCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@
cell.trigger('dbCellIn');

this.editor('option', 'tab_on_return', this.options.tab_on_return);

if ( select === 'preserve' ) {
// preserve text selection
var textrange = this.editor('getTextrange');
if ( textrange.selectionAtStart && textrange.selectionAtEnd ) {
select = 'all';
} else if ( textrange.selectionAtStart && textrange.selectionText === '' ) {
select = 'start';
} else {
select = 'end';
}
}

if ( this.getType() === 'combo' ) {
var data = this.getRow().dbRow('getRowData');
var searchURL = this.getCol().attr('searchURL');
Expand Down
5 changes: 4 additions & 1 deletion js/jquery.dbEditorBool.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@
this.editor.textrange('set', "all");
break;
}
},
},
getTextrange: function() {
return this.editor.textrange('get');
},
destroy: function() {
// If the widget is destroyed, remove the editor from the DOM.
this.editor.remove();
Expand Down
5 changes: 4 additions & 1 deletion js/jquery.dbEditorCombo.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@
this.editor.textrange('set', "all");
break;
}
},
},
getTextrange: function() {
return this.editor.textrange('get');
},
search: function() {
// Server side search for available options
dbEditorCombo = this;
Expand Down
5 changes: 4 additions & 1 deletion js/jquery.dbEditorHTMLArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@
this.editor.textrange('set', "all");
break;
}
},
},
getTextrange: function() {
return this.editor.textrange('get');
},
destroy: function() {
// If the widget is destroyed, remove the editor from the DOM.
this.editor.remove();
Expand Down
5 changes: 4 additions & 1 deletion js/jquery.dbEditorText.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@
this.editor.textrange('set', "all");
break;
}
},
},
getTextrange: function() {
return this.editor.textrange('get');
},
destroy: function() {
// If the widget is destroyed, remove the editor from the DOM.
this.editor.remove();
Expand Down
5 changes: 4 additions & 1 deletion js/jquery.dbEditorTextArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@
this.editor.textrange('set', "all");
break;
}
},
},
getTextrange: function() {
return this.editor.textrange('get');
},
destroy: function() {
// If the widget is destroyed, remove the editor from the DOM.
this.editor.remove();
Expand Down
2 changes: 1 addition & 1 deletion js/jquery.dbRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
dbRow.setCellValue(colName, value);
});
if ( currentCell.size() && this.element.find(currentCell).size() ) {
currentCell.dbCell('cellIn', 'end');
currentCell.dbCell('cellIn', 'preserve');
}
}

Expand Down