Combining feedback widget and Giscus #7324
pawamoy
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
This worked great for me however I had to modify the script slightly to avoid this issue. Thanks @pawamoy ! @squidfunk I think this documentation code snippet needs updating to avoid the instant reload issue. // docs/javascripts/feedback.js
document$.subscribe(function () {
const feedback = document.forms.feedback;
if (feedback === undefined) return;
feedback.hidden = false;
feedback.addEventListener("submit", function (ev) {
ev.preventDefault();
feedback.firstElementChild.disabled = true;
const data = ev.submitter.getAttribute("data-md-value");
if (data == 0) {
const commentElement = document.getElementById("comments");
commentElement.style.display = "block";
}
const note = feedback.querySelector(
".md-feedback__note [data-md-value='" + data + "']"
);
if (note) {
note.hidden = false;
}
});
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was going to open a new issue, but actually it works even without setting a custom, empty provider. See the text below for what I was going to post.
I'm kinda hijacking Giscus to provide a feeback system on my documentation pages. So I don't actually use any analytics provider. But Material for MkDocs seems to require that I set a
provider
underextra.analytics
. So I setcustom
and added an empty partial.<!-- docs/.overrides/partials/integrations/analytics/custom.html -->
The Giscus comments are wrapped in a div with display: none, and when I click on the sad face, it displays it 🙂 (actually with the code above it also displays it when I click on the happy face but I'll change that).
Would it be possible to not require setting
provider: custom
and creating an empty partial with the same name? Or am I hijacking the system too much? I'm just combining two nice features 🥹So actually as stated in the first sentence of this discussion, it works without the custom, empty provider, thanks to the additional feedback.js which enables the widget 🙂
The JSON schema still complains though and seems to want me to add a provider (missing property "provider" and missing property "property").
Beta Was this translation helpful? Give feedback.
All reactions