mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
Fix issue where text could not be copied while a feature was selected (close #7908)
This commit is contained in:
@@ -9,7 +9,10 @@ export function behaviorOperation(context) {
|
||||
// prevent operations during low zoom selection
|
||||
if (!context.map().withinEditableZoom()) return;
|
||||
|
||||
if (_operation.availableForKeypress && !_operation.availableForKeypress()) return;
|
||||
|
||||
d3_event.preventDefault();
|
||||
|
||||
var disabled = _operation.disabled();
|
||||
|
||||
if (disabled) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { event as d3_event } from 'd3-selection';
|
||||
|
||||
import { t } from '../core/localizer';
|
||||
import { behaviorOperation } from '../behavior/operation';
|
||||
import { uiCmd } from '../ui/cmd';
|
||||
@@ -19,10 +17,6 @@ export function operationCopy(context, selectedIDs) {
|
||||
|
||||
var operation = function() {
|
||||
|
||||
if (!getSelectionText()) {
|
||||
d3_event.preventDefault();
|
||||
}
|
||||
|
||||
var graph = context.graph();
|
||||
var selected = groupEntities(getFilteredIdsToCopy(), graph);
|
||||
var canCopy = [];
|
||||
@@ -97,11 +91,6 @@ export function operationCopy(context, selectedIDs) {
|
||||
}
|
||||
|
||||
|
||||
function getSelectionText() {
|
||||
return window.getSelection().toString();
|
||||
}
|
||||
|
||||
|
||||
operation.available = function() {
|
||||
return getFilteredIdsToCopy().length > 0;
|
||||
};
|
||||
@@ -116,6 +105,13 @@ export function operationCopy(context, selectedIDs) {
|
||||
};
|
||||
|
||||
|
||||
operation.availableForKeypress = function() {
|
||||
var selection = window.getSelection && window.getSelection();
|
||||
// if the user has text selected then let them copy that, not the selected feature
|
||||
return !selection || !selection.toString();
|
||||
};
|
||||
|
||||
|
||||
operation.tooltip = function() {
|
||||
var disable = operation.disabled();
|
||||
return disable ?
|
||||
|
||||
Reference in New Issue
Block a user