diff --git a/modules/modes/save.js b/modules/modes/save.js index 766f66779..391fe2f47 100644 --- a/modules/modes/save.js +++ b/modules/modes/save.js @@ -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');