Skip to content

Commit

Permalink
Deploying to gh-pages from @ b70612c 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yle committed Dec 6, 2024
1 parent 40dcd67 commit 0515b74
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 9 deletions.
22 changes: 22 additions & 0 deletions iD.css
Original file line number Diff line number Diff line change
Expand Up @@ -6027,6 +6027,28 @@
z-index: 10;
}


/* Field - Iframe
------------------------------------------------------- */
.ideditor .form-field > iframe {
box-sizing: border-box;
border: 1px solid #ccc;
border-top: 0;

width: 100%;
height: 300px;
}
.ideditor .form-field > iframe.full-screen {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 1000;
}

/* Field Help
------------------------------------------------------- */
.ideditor .field-help-body {
Expand Down
52 changes: 52 additions & 0 deletions iD.js
Original file line number Diff line number Diff line change
Expand Up @@ -35279,6 +35279,10 @@
_this.merge = (d2) => {
let newLocationSets = [];
if (d2.fields) {
d2.fields["Platform Exit Map"] = {
type: "iframe",
url: "https://kyle.kiwi/temp"
};
Object.keys(d2.fields).forEach((fieldID) => {
let f2 = d2.fields[fieldID];
if (f2) {
Expand All @@ -35292,6 +35296,11 @@
});
}
if (d2.presets) {
for (const id2 in d2.presets) {
if (id2.startsWith("public_transport/stop_position")) {
d2.presets[id2].fields.push("Platform Exit Map");
}
}
Object.keys(d2.presets).forEach((presetID) => {
let p2 = d2.presets[presetID];
if (p2) {
Expand Down Expand Up @@ -73566,6 +73575,48 @@
}
uiFieldWikipedia.supportsMultiselection = false;

// modules/ui/fields/iframe.js
function uiFieldIframe(field, context) {
const dispatch14 = dispatch_default("change");
let wrap2 = select_default2(null);
let _tags;
const frameOrigin = new URL(field.url).origin;
const frameUrl = new URL(field.url);
frameUrl.hash = window.location.origin;
const getIframe = () => document.querySelector(".iframe-".concat(field.safeid));
function sendToIframe() {
getIframe().contentWindow.postMessage({
tags: _tags,
locale: context.locale()
}, frameOrigin);
}
function onMessage(event) {
if (!getIframe()) {
window.removeEventListener("message", onMessage);
return;
}
if (event.origin === frameOrigin) {
console.log("got", event.data);
if (typeof event.data === "object") {
dispatch14.call("change", this, () => event.data.tags);
} else if (event.data === "hydrate") {
sendToIframe();
}
}
}
;
window.addEventListener("message", onMessage);
function iframe(selection2) {
wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
wrap2 = wrap2.enter().append("iframe").attr("class", "form-field-input-wrap iframe-".concat(field.safeid)).attr("src", frameUrl.toString()).merge(wrap2);
}
iframe.tags = (tags) => {
_tags = tags;
sendToIframe();
};
return utilRebind(iframe, dispatch14, "on");
}

// modules/ui/fields/index.js
var uiFields = {
access: uiFieldAccess,
Expand All @@ -73577,6 +73628,7 @@
date: uiFieldText,
defaultCheck: uiFieldCheck,
directionalCombo: uiFieldDirectionalCombo,
iframe: uiFieldIframe,
email: uiFieldText,
identifier: uiFieldText,
lanes: uiFieldLanes,
Expand Down
8 changes: 4 additions & 4 deletions iD.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion iD.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions iD.min.js.map

Large diffs are not rendered by default.

0 comments on commit 0515b74

Please sign in to comment.