Merge pull request #12118 from mvdbeek/fix_copying_in_workflow_editor

[21.05] Fix copying text in workflow editor
This commit is contained in:
John Chilton
2021-06-10 12:05:13 -04:00
committed by GitHub
@@ -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) => {