mirror of
https://github.com/wallabag/wallabag.git
synced 2025-06-27 16:36:00 +00:00
Extract Materialize Toast controller
This commit is contained in:
parent
76c101938d
commit
e5042074a2
5 changed files with 18 additions and 12 deletions
12
assets/controllers/materialize/toast_controller.js
Normal file
12
assets/controllers/materialize/toast_controller.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { Controller } from '@hotwired/stimulus';
|
||||
import M from '@materializecss/materialize';
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
this.instance = M.toast({ text: this.element.innerText });
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.instance.dismissAll();
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import $ from 'jquery';
|
|||
|
||||
/* Materialize imports */
|
||||
import '@materializecss/materialize/dist/css/materialize.css';
|
||||
import M from '@materializecss/materialize/dist/js/materialize';
|
||||
import '@materializecss/materialize/dist/js/materialize';
|
||||
|
||||
/* Annotations */
|
||||
import annotator from 'annotator';
|
||||
|
@ -348,10 +348,4 @@ $(document).ready(() => {
|
|||
|
||||
qrcode.setAttribute('src', src);
|
||||
});
|
||||
|
||||
document.querySelectorAll('.material-toast').forEach((toast) => {
|
||||
M.toast({
|
||||
text: toast.innerText,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue