1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-06-27 16:36:00 +00:00

Extract QRCode controller

This commit is contained in:
Yassine Guedidi 2025-02-23 22:40:55 +01:00
parent e5042074a2
commit 3125eb43ad
4 changed files with 12 additions and 11 deletions

View file

@ -0,0 +1,10 @@
import { Controller } from '@hotwired/stimulus';
import jrQrcode from 'jr-qrcode';
export default class extends Controller {
static values = { url: String };
connect() {
this.element.setAttribute('src', jrQrcode.getQrBase64(this.urlValue));
}
}

View file

@ -12,9 +12,6 @@ import annotator from 'annotator';
import ClipboardJS from 'clipboard';
import 'mathjax/es5/tex-svg';
/* jrQrcode */
import jrQrcode from 'jr-qrcode';
/* Fonts */
import 'material-design-icons-iconfont/dist/material-design-icons.css';
import 'lato-font/css/lato-font.css';
@ -342,10 +339,4 @@ $(document).ready(() => {
$('form[name="form_mass_action"] button[name="tag"]').trigger('click');
}
});
document.querySelectorAll('img.jr-qrcode').forEach((qrcode) => {
const src = jrQrcode.getQrBase64(qrcode.getAttribute('data-url'));
qrcode.setAttribute('src', src);
});
});