Skip to content

Commit

Permalink
fixup! fixup! feat(playground): add Reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Apr 17, 2024
1 parent b80444d commit 3f7b92d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/src/playground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,22 @@ export default function Playground() {

updateWithEditorContent();
};

const reset = async () => {
htmlRef.current?.setContent(initialCode?.html || HTML_DEFAULT);
cssRef.current?.setContent(initialCode?.css || CSS_DEFAULT);
jsRef.current?.setContent(initialCode?.js || JS_DEFAULT);

updateWithEditorContent();
};

const clearConfirm = async () => {
if (window.confirm("Do you really want to clear everything?")) {
gleanClick(`${PLAYGROUND}: reset-click`);
await clear();
}
};

const resetConfirm = async () => {
if (window.confirm("Do you really want to revert your changes?")) {
gleanClick(`${PLAYGROUND}: revert-click`);
Expand Down

0 comments on commit 3f7b92d

Please sign in to comment.