mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix copying selected text in workflow editor
The only text we could copy had to be within input boxes, but we may want to also copy text from the error / upgrade message modal or from the help text or other links. So if there's currently any highlighted text we skip the workflow copy logic.
This commit is contained in:
@@ -220,12 +220,17 @@ class CanvasManager {
|
||||
}
|
||||
init_copy_paste() {
|
||||
/*
|
||||
Both of these copy/paste event bindings check the active element
|
||||
The copy/paste event bindings check the active element
|
||||
and, if it's one of the text inputs, skip the workflow copy/paste
|
||||
logic so we don't interfere with standard copy/paste functionality.
|
||||
The copy binding also skips the node copy if text is currently highlighted.
|
||||
*/
|
||||
document.addEventListener("copy", (e) => {
|
||||
if (document.activeElement && !inputElementTypes.includes(document.activeElement.type)) {
|
||||
if (
|
||||
document.activeElement &&
|
||||
!inputElementTypes.includes(document.activeElement.type) &&
|
||||
!document.getSelection().toString()
|
||||
) {
|
||||
if (this.app.activeNode && this.app.activeNode.type !== "subworkflow") {
|
||||
e.clipboardData.setData(
|
||||
"application/json",
|
||||
@@ -233,8 +238,8 @@ class CanvasManager {
|
||||
nodeId: this.app.activeNode.id,
|
||||
})
|
||||
);
|
||||
e.preventDefault();
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
document.addEventListener("paste", (e) => {
|
||||
|
||||
Reference in New Issue
Block a user