Skip to content

Commit

Permalink
improve edit button
Browse files Browse the repository at this point in the history
  • Loading branch information
goktug97 committed Sep 27, 2020
1 parent 88d6bc3 commit eeb5267
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@
}
});

var currentFilenodePath;
var previewFrame = document.getElementById("preview-frame"); // div
var hoverNode = document.getElementById("hovernode"); // iframe
var globalNetwork;
Expand All @@ -355,9 +354,17 @@

$("#fileframe #edit-button")
.on("click", function () {
const url = "org-protocol://roam-file?file="
.concat(currentFilenodePath);
window.open(url, "_self");
const url = $('#filenode').attr('src');
let string = url.substring(0, url.lastIndexOf('?'));
string = string.substring(0, string.lastIndexOf('.'));
for (let i = 0; i < select2Data.length; i++) {
if (select2Data[i].id === string) {
window.open("org-protocol://roam-file?file="
.concat(select2Data[i].path),
"_self");
break
}
}
});

$("#fileframe #refresh-button")
Expand Down Expand Up @@ -579,8 +586,9 @@
}
}

var select2Data = [];
function updateDropdown() {
var select2Data = [];
select2Data = [];
for (let i = 0 ; i < roamData.nodes.length; i++) {
select2Data.push({id: roamData.nodes[i].id,
text: roamData.nodes[i].title,
Expand Down Expand Up @@ -680,7 +688,6 @@
if (select2Data[i].id === string) {
link = `org-roam-buffer?path=${select2Data[i].path}&` +
`label=${select2Data[i].text}&token=${token}`;
currentFilenodePath = select2Data[i].path;
break
}
}
Expand Down

0 comments on commit eeb5267

Please sign in to comment.