Skip to content
Snippets Groups Projects
Commit d221cad6 authored by netpro2k's avatar netpro2k
Browse files

Add media button missing file

parent 34a4ec9d
No related branches found
No related tags found
No related merge requests found
......@@ -298,17 +298,24 @@ const onReady = async () => {
NAF.connection.entities.completeSync(ev.detail.clientId);
});
document.addEventListener("paste", e => {
const scene = AFRAME.scenes[0];
const imgUrl = e.clipboardData.getData("text");
console.log("Pasted: ", imgUrl);
const addMedia = url => {
const image = document.createElement("a-entity");
image.id = "interactable-image-" + Date.now();
image.setAttribute("position", { x: 0, y: 2, z: 1 });
image.setAttribute("image-plus", "src", imgUrl);
image.setAttribute("image-plus", "src", url);
image.setAttribute("networked", { template: "#interactable-image" });
scene.appendChild(image);
};
scene.addEventListener("add_media", e => {
addMedia(e.detail);
});
document.addEventListener("paste", e => {
if (e.target.nodeName === "INPUT") return;
const imgUrl = e.clipboardData.getData("text");
console.log("Pasted: ", imgUrl, e);
addMedia(imgUrl);
});
if (!qsTruthy("offline")) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment