Compare commits
1 Commits
f27bb870e1
...
5c6c7ba2fc
Author | SHA1 | Date | |
---|---|---|---|
5c6c7ba2fc |
@ -1,19 +0,0 @@
|
||||
import { Popover } from "bootstrap";
|
||||
|
||||
async function copyToClipboard(event: MouseEvent) {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
|
||||
const data = new ClipboardItem({
|
||||
"text/plain": new Blob([document.getElementById("preview")!.innerHTML], {
|
||||
type: "text/plain",
|
||||
}),
|
||||
});
|
||||
await navigator.clipboard.write([data]);
|
||||
|
||||
let popover = Popover.getInstance(event.target as Element)!;
|
||||
popover.show();
|
||||
setTimeout(() => popover.hide(), 1000);
|
||||
}
|
||||
|
||||
const button = document.getElementById("copy-button")!;
|
||||
new Popover(button, { trigger: "manual" });
|
||||
button.addEventListener("click", copyToClipboard);
|
@ -1,11 +1,6 @@
|
||||
{% extends "base.dj.html" %}
|
||||
|
||||
{% load nh3_tags %}
|
||||
{% load django_vite %}
|
||||
|
||||
{% block vite_extra_assets %}
|
||||
{% vite_asset 'membershipworks/js/upcoming_events_post_generator.entry.ts' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}Upcoming Events{% endblock %}
|
||||
{% block content %}
|
||||
@ -141,3 +136,25 @@
|
||||
</button>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block script %}
|
||||
<script>
|
||||
async function copyToClipboard(event) {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
|
||||
const data = new ClipboardItem({
|
||||
"text/plain": new Blob(
|
||||
[document.getElementById("preview").innerHTML], {
|
||||
type: "text/plain"
|
||||
})
|
||||
});
|
||||
await navigator.clipboard.write([data]);
|
||||
|
||||
bootstrap.Popover.getInstance(event.target).show();
|
||||
setTimeout(() => bootstrap.Popover.getInstance(event.target).hide(), 1000);
|
||||
}
|
||||
const button = document.getElementById("copy-button");
|
||||
const popover = new bootstrap.Popover(button, {
|
||||
trigger: "manual"
|
||||
})
|
||||
button.addEventListener("click", copyToClipboard);
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -46,7 +46,7 @@ requires-python = ">=3.11"
|
||||
[project.optional-dependencies]
|
||||
server = [
|
||||
"uvicorn[standard]~=0.30",
|
||||
"setuptools~=72.2",
|
||||
"setuptools~=72.1",
|
||||
]
|
||||
|
||||
[project.entry-points."djangoq.errorreporters"]
|
||||
@ -119,7 +119,7 @@ lint = [
|
||||
typing = [
|
||||
"mypy~=1.10",
|
||||
"django-stubs~=5.0",
|
||||
"setuptools~=72.2",
|
||||
"setuptools~=72.1",
|
||||
"types-bleach~=6.1",
|
||||
"types-requests~=2.32",
|
||||
"types-urllib3~=1.26",
|
||||
|
Loading…
Reference in New Issue
Block a user