mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
Consolidate localization behavior and init to a coreLocalizer function and singleton Explicitly support `en-US` locale Rename coreData to coreFileFetcher and export a singleton rather than using a property of coreContext Add `apiConnections` property of coreContext to simplify adding a source switcher Replace some init functions with re-callable, promise-supporting `ensureLoaded` functions Make coreContext itself load the UI if a container has been specified at init time Fix code tests
71 lines
1.5 KiB
JavaScript
71 lines
1.5 KiB
JavaScript
import { t } from '../core/localizer';
|
|
import { uiModal } from './modal';
|
|
|
|
|
|
export function uiRestore(context) {
|
|
return function(selection) {
|
|
if (!context.history().hasRestorableChanges()) return;
|
|
|
|
let modalSelection = uiModal(selection, true);
|
|
|
|
modalSelection.select('.modal')
|
|
.attr('class', 'modal fillL');
|
|
|
|
let introModal = modalSelection.select('.content');
|
|
|
|
introModal
|
|
.append('div')
|
|
.attr('class', 'modal-section')
|
|
.append('h3')
|
|
.text(t('restore.heading'));
|
|
|
|
introModal
|
|
.append('div')
|
|
.attr('class','modal-section')
|
|
.append('p')
|
|
.text(t('restore.description'));
|
|
|
|
let buttonWrap = introModal
|
|
.append('div')
|
|
.attr('class', 'modal-actions');
|
|
|
|
let restore = buttonWrap
|
|
.append('button')
|
|
.attr('class', 'restore')
|
|
.on('click', () => {
|
|
context.history().restore();
|
|
modalSelection.remove();
|
|
});
|
|
|
|
restore
|
|
.append('svg')
|
|
.attr('class', 'logo logo-restore')
|
|
.append('use')
|
|
.attr('xlink:href', '#iD-logo-restore');
|
|
|
|
restore
|
|
.append('div')
|
|
.text(t('restore.restore'));
|
|
|
|
let reset = buttonWrap
|
|
.append('button')
|
|
.attr('class', 'reset')
|
|
.on('click', () => {
|
|
context.history().clearSaved();
|
|
modalSelection.remove();
|
|
});
|
|
|
|
reset
|
|
.append('svg')
|
|
.attr('class', 'logo logo-reset')
|
|
.append('use')
|
|
.attr('xlink:href', '#iD-logo-reset');
|
|
|
|
reset
|
|
.append('div')
|
|
.text(t('restore.reset'));
|
|
|
|
restore.node().focus();
|
|
};
|
|
}
|