In save mode, escape should cancel and return to browse mode

(closes #4230)
This commit is contained in:
Bryan Housel
2017-08-15 14:32:16 -04:00
parent 09a661c718
commit c56dc5afc3

View File

@@ -1,6 +1,7 @@
import * as d3 from 'd3';
import _ from 'lodash';
import { d3keybinding } from '../lib/d3.keybinding.js';
import { t } from '../util/locale';
import { JXON } from '../util/jxon';
@@ -34,6 +35,8 @@ export function modeSave(context) {
id: 'save'
};
var keybinding = d3keybinding('select');
var commit = uiCommit(context)
.on('cancel', cancel)
.on('save', save);
@@ -360,6 +363,12 @@ export function modeSave(context) {
context.ui().sidebar.show(commit);
}
keybinding
.on('⎋', cancel, true);
d3.select(document)
.call(keybinding);
context.container().selectAll('#content')
.attr('class', 'inactive');
@@ -381,6 +390,8 @@ export function modeSave(context) {
mode.exit = function() {
keybinding.off();
context.container().selectAll('#content')
.attr('class', 'active');