Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code copy buttons to docs #883

Draft
wants to merge 20 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style(clipboard): cleanup forEach
dancormier committed Jul 6, 2022
commit ac97699b7a5144eaa8f11810ce008632e2f2d7e9
16 changes: 12 additions & 4 deletions docs/assets/js/controllers/clipboard.ts
Original file line number Diff line number Diff line change
@@ -21,12 +21,20 @@ import { Application, Controller } from "stimulus";
const hideElements = scope.findAllElements('[data-hide-on-copy]');
const showElements = scope.findAllElements('[data-show-on-copy]');

hideElements.forEach(el => el.classList.add("d-none"));
showElements.forEach(el => el.classList.remove("d-none"));
hideElements.forEach(el => {
el.classList.add("d-none");
});
showElements.forEach(el => {
el.classList.remove("d-none");
});

setTimeout(function () {
hideElements.forEach(el => el.classList.remove("d-none"));
showElements.forEach(el => el.classList.add("d-none"));
hideElements.forEach(el => {
el.classList.remove("d-none");
});
showElements.forEach(el => {
el.classList.add("d-none");
});
}, 3000);
}
});