Skip to content

Commit

Permalink
feat(osm_edit_link): set default osmEditor value to josm (#799)
Browse files Browse the repository at this point in the history
* feat(osm_edit_link): set default osmEditor value to josm

* feat(osm_edit_link): extract default osm editor constant
  • Loading branch information
dqunbp authored Jul 18, 2024
1 parent 7b2af75 commit b1518de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/features/osm_edit_link/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ import { i18n } from '~core/localization';

export const EDIT_IN_OSM_CONTROL_ID = 'EditInOsm';
export const EDIT_IN_OSM_CONTROL_NAME = i18n.t('toolbar.edit_in_osm');
export const DEFAULT_OSM_EDITOR = 'josm';
9 changes: 6 additions & 3 deletions src/features/osm_edit_link/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { toolbar } from '~core/toolbar';
import { i18n } from '~core/localization';
import { configRepo } from '~core/config';
import { store } from '~core/store/store';
import { EDIT_IN_OSM_CONTROL_ID, EDIT_IN_OSM_CONTROL_NAME } from './constants';
import {
DEFAULT_OSM_EDITOR,
EDIT_IN_OSM_CONTROL_ID,
EDIT_IN_OSM_CONTROL_NAME,
} from './constants';
import { openOsmLink } from './openOsmLink';

export const osmEditControl = toolbar.setupControl({
Expand All @@ -22,8 +26,7 @@ osmEditControl.onStateChange((ctx, state) => {
try {
const position = store.getState(currentMapPositionAtom);
if (!position) throw Error('Unknown position');
const { osmEditor } = store.getState(currentUserAtom);
if (!osmEditor) throw Error('Unknown editor');
const { osmEditor = DEFAULT_OSM_EDITOR } = store.getState(currentUserAtom);

const editor = configRepo
.get()
Expand Down

0 comments on commit b1518de

Please sign in to comment.