Skip to content

Commit

Permalink
Merge pull request #1 from danice/main
Browse files Browse the repository at this point in the history
fix for Toast page onclick event not working: M was not accessible from html onclick events
  • Loading branch information
wuda-io authored Dec 11, 2023
2 parents 92d73a8 + e38e9ef commit ed7ba6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import "./style.scss";
import "prismjs/themes/prism.min.css";
import { config } from "../config.materialize";

globalThis.M = M

document.addEventListener("DOMContentLoaded", function() {
function rgb2hex(rgb: string) {
if (/^#[0-9A-F]{6}$/i.test(rgb)) return rgb;
Expand Down
2 changes: 1 addition & 1 deletion toasts.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<button
type="button"
class="waves-effect waves-light btn"
onclick="M.toast({text: 'I am a toast'})"
onclick="M.toast({text: 'I am a toast', classes: 'primary'})"
>
Toast!
</button>
Expand Down

0 comments on commit ed7ba6b

Please sign in to comment.