Skip to content

Commit

Permalink
✨ Add Rapid as an external editor (fix #131)
Browse files Browse the repository at this point in the history
  • Loading branch information
ENT8R committed May 22, 2024
1 parent 517679c commit e4fe1f1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ html, body {

body {
&[data-editor-id="false"] .link-editor-id,
&[data-editor-rapid="false"] .link-editor-rapid,
&[data-editor-josm="false"] .link-editor-josm,
&[data-editor-level0="false"] .link-editor-level0,

Expand Down
3 changes: 3 additions & 0 deletions app/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function listener() {
theme: document.getElementById('theme-selection').value,
editors: {
id: document.getElementById('editor-id').checked,
rapid: document.getElementById('editor-rapid').checked,
josm: document.getElementById('editor-josm').checked,
level0: document.getElementById('editor-level0').checked
},
Expand Down Expand Up @@ -235,13 +236,15 @@ function settings() {
const tools = Preferences.get('tools');

document.getElementById('editor-id').checked = editors.id;
document.getElementById('editor-rapid').checked = editors.rapid;
document.getElementById('editor-josm').checked = editors.josm;
document.getElementById('editor-level0').checked = editors.level0;
document.getElementById('tool-openstreetmap').checked = tools.openstreetmap;
document.getElementById('tool-mapillary').checked = tools.mapillary;
document.getElementById('tool-deepl').checked = tools.deepl;

document.body.dataset.editorId = editors.id;
document.body.dataset.editorRapid = editors.rapid;
document.body.dataset.editorJosm = editors.josm;
document.body.dataset.editorLevel0 = editors.level0;
document.body.dataset.toolOpenstreetmap = tools.openstreetmap;
Expand Down
7 changes: 7 additions & 0 deletions app/js/note.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ export default class Note {
icon: 'external',
text: Localizer.message('action.edit.id')
},
rapid: {
class: 'link-editor-rapid',
link: `https://rapideditor.org/edit#map=19/${this.coordinates.join('/')}`,
icon: 'external',
text: Localizer.message('action.edit.rapid')
},
josm: {
class: 'link-editor-josm',
link: `http://127.0.0.1:8111/load_and_zoom?left=${bbox.left}&bottom=${bbox.bottom}&right=${bbox.right}&top=${bbox.top}`,
Expand Down Expand Up @@ -120,6 +126,7 @@ export default class Note {
if (this.linked) {
const { id, type } = this.linked;
actions.iD.link = `${OPENSTREETMAP_SERVER}/edit?editor=id&${type}=${id}`;
actions.rapid.link = `https://rapideditor.org/edit#id=${type.charAt(0)}${id}`;
actions.josm.link += `&select=${type}${id}`;
actions.level0.link = `http://level0.osmz.ru/?url=${type}/${id}&center=${this.coordinates.join()}`;
}
Expand Down
1 change: 1 addition & 0 deletions app/js/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const DEFAULTS = {
},
editors: {
id: true,
rapid: false,
josm: false,
level0: true
}
Expand Down
3 changes: 2 additions & 1 deletion app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"edit": {
"id": "iD",
"josm": "JOSM",
"level0": "Level0"
"level0": "Level0",
"rapid": "Rapid"
},
"login": "Login",
"logout": "Logout",
Expand Down
4 changes: 4 additions & 0 deletions app/templates/modals/settings.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<input id="editor-id" type="checkbox" class="setting"><i class="form-icon"></i>
<span data-i18n="action.edit.id">iD</span>
</label>
<label class="form-checkbox form-inline">
<input id="editor-rapid" type="checkbox" class="setting"><i class="form-icon"></i>
<span data-i18n="action.edit.rapid">Rapid</span>
</label>
<label class="form-checkbox form-inline">
<input id="editor-josm" type="checkbox" class="setting"><i class="form-icon"></i>
<span data-i18n="action.edit.josm">JOSM</span>
Expand Down

0 comments on commit e4fe1f1

Please sign in to comment.