mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed copy-paste row issues in View/Edit Data. Fixes #3947
1) Copy table rows across two or more active query tool sessions. 2) Copied rows can be pasted multiple times without selecting a row in the query tool grid. 3) Adds an empty row at the end in the query tool grid after pasting rows.
This commit is contained in:
committed by
Akshay Joshi
parent
dc1e32a632
commit
0ce4f49e08
@@ -64,6 +64,9 @@ define(['sources/gettext', 'alertify'], function (gettext, alertify) {
|
||||
|
||||
if (clipboardData) {
|
||||
clipboardData.setData('text', text);
|
||||
// As there no uniform way to read data from clipboard
|
||||
// storing copied data into main window object, so it is accessible from anywhere in the application
|
||||
window.parent.window.clipboardData = text;
|
||||
// We want our data, not data from any selection, to be written to the clipboard
|
||||
e.preventDefault();
|
||||
}
|
||||
@@ -83,6 +86,9 @@ define(['sources/gettext', 'alertify'], function (gettext, alertify) {
|
||||
|
||||
document.body.removeChild(textArea);
|
||||
},
|
||||
getTextFromClipboard: function() {
|
||||
return window.parent.window.clipboardData || '';
|
||||
},
|
||||
};
|
||||
return clipboard;
|
||||
});
|
||||
|
||||
@@ -48,6 +48,10 @@ function ($, _, clipboard, RangeSelectionHelper, rangeBoundaryNavigator) {
|
||||
var setPasteRowButtonEnablement = function (canEditFlag, isEnabled) {
|
||||
if (canEditFlag) {
|
||||
$('#btn-paste-row').prop('disabled', !isEnabled);
|
||||
if(isEnabled && window.parent.$) {
|
||||
// trigger copied event to all sessions
|
||||
window.parent.$(window.parent.document).trigger('pgadmin-sqleditor:rows-copied', copyWithHeader());
|
||||
}
|
||||
}
|
||||
};
|
||||
return copyData;
|
||||
|
||||
Reference in New Issue
Block a user