From edc30ad41c3c4b2b4f3a81a578882b4f4d5827b6 Mon Sep 17 00:00:00 2001 From: Nikita Mashukov Date: Fri, 20 Oct 2017 20:20:42 +0700 Subject: [PATCH] no prevent the copy event when there is selected text --- modules/behavior/copy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/behavior/copy.js b/modules/behavior/copy.js index 34e5ac88f..73fe16b5e 100644 --- a/modules/behavior/copy.js +++ b/modules/behavior/copy.js @@ -48,7 +48,7 @@ export function behaviorCopy(context) { function doCopy() { - d3_event.preventDefault(); + if (!getSelectionText()) d3_event.preventDefault(); var graph = context.graph(), selected = groupEntities(context.selectedIDs(), graph), @@ -87,6 +87,9 @@ export function behaviorCopy(context) { return copy; } + function getSelectionText() { + return window.getSelection().toString(); + } copy.off = function() { d3_select(document).call(keybinding.off);