mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Support Downgrade and Delete operations at the same time (close #7682)
This commit is contained in:
@@ -177,19 +177,15 @@ export function modeSelect(context, selectedIDs) {
|
||||
|
||||
_operations = Object.values(Operations)
|
||||
.map(function(o) { return o(context, selectedIDs); })
|
||||
.filter(function(o) { return o.available() && o.id !== 'delete' && o.id !== 'downgrade' && o.id !== 'copy'; });
|
||||
|
||||
var copyOperation = Operations.operationCopy(context, selectedIDs);
|
||||
if (copyOperation.available()) {
|
||||
// group copy operation with delete/downgrade
|
||||
_operations.push(copyOperation);
|
||||
}
|
||||
|
||||
var downgradeOperation = Operations.operationDowngrade(context, selectedIDs);
|
||||
// don't allow delete if downgrade is available
|
||||
var lastOperation = !context.inIntro() && downgradeOperation.available() ? downgradeOperation : Operations.operationDelete(context, selectedIDs);
|
||||
|
||||
_operations.push(lastOperation);
|
||||
.filter(function(o) { return o.id !== 'delete' && o.id !== 'downgrade' && o.id !== 'copy'; })
|
||||
.concat([
|
||||
// group copy/downgrade/delete operation together at the end of the list
|
||||
Operations.operationCopy(context, selectedIDs),
|
||||
Operations.operationDowngrade(context, selectedIDs),
|
||||
Operations.operationDelete(context, selectedIDs)
|
||||
]).filter(function(operation) {
|
||||
return operation.available();
|
||||
});
|
||||
|
||||
_operations.forEach(function(operation) {
|
||||
if (operation.behavior) {
|
||||
|
||||
@@ -127,7 +127,7 @@ export function operationDowngrade(context, selectedIDs) {
|
||||
|
||||
|
||||
operation.id = 'downgrade';
|
||||
operation.keys = [uiCmd('⌘⌫'), uiCmd('⌘⌦'), uiCmd('⌦')];
|
||||
operation.keys = [uiCmd('⌫')];
|
||||
operation.title = t('operations.downgrade.title');
|
||||
operation.behavior = behaviorOperation(context).which(operation);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user