Skip to content

Commit 5907e6a

Browse files
fix missing script
1 parent 5224754 commit 5907e6a

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

layouts/partials/md-dropdown.html

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,36 @@
6868
</div>
6969
</button>
7070
</div>
71-
</details>
71+
</details>
72+
73+
<script>
74+
function getCurrentPlaintextUrl() {
75+
const url = window.location.href.split("#")[0].replace(/\/$/, "");
76+
return `${url}/index.md`;
77+
}
78+
79+
function copyMarkdown() {
80+
fetch(getCurrentPlaintextUrl())
81+
.then((response) => response.text())
82+
.then((text) => {
83+
navigator.clipboard
84+
.writeText(text)
85+
.then(() => alert("Markdown copied to clipboard!"))
86+
.catch((err) => alert("Failed to copy markdown: " + err));
87+
})
88+
.catch((err) => alert("Error fetching markdown: " + err));
89+
}
90+
91+
function viewPlainText() {
92+
window.open(getCurrentPlaintextUrl(), "_blank");
93+
}
94+
95+
function openInDocsAI() {
96+
const kapaButton = document.querySelector(".open-kapa-widget");
97+
if (kapaButton) {
98+
kapaButton.click();
99+
} else {
100+
alert("Couldn't find Docs AI.");
101+
}
102+
}
103+
</script>

0 commit comments

Comments
 (0)