[bugfix] correct import of @rails/ujs / fix lint issues (#92)

Details: https://github.com/rails/rails/issues/49768
Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/92
Co-authored-by: Zoë Bijl <code@moiety.me>
Co-committed-by: Zoë Bijl <code@moiety.me>
This commit is contained in:
Zoë Bijl
2025-10-10 10:54:11 +02:00
committed by Zoë Bijl
parent 4b4a9f981f
commit 496fd5987e
10 changed files with 5155 additions and 4873 deletions
+4 -4
View File
@@ -1,9 +1,9 @@
// This file will be loaded on settings pages, regardless of theme.
import 'packs/public-path';
import { delegate } from '@rails/ujs';
import Rails from '@rails/ujs';
delegate(document, '#edit_profile input[type=file]', 'change', ({ target }) => {
Rails.delegate(document, '#edit_profile input[type=file]', 'change', ({ target }) => {
const avatar = document.getElementById(target.id + '-preview');
const [file] = target.files || [];
const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc;
@@ -11,13 +11,13 @@ delegate(document, '#edit_profile input[type=file]', 'change', ({ target }) => {
avatar.src = url;
});
delegate(document, '.input-copy input', 'click', ({ target }) => {
Rails.delegate(document, '.input-copy input', 'click', ({ target }) => {
target.focus();
target.select();
target.setSelectionRange(0, target.value.length);
});
delegate(document, '.input-copy button', 'click', ({ target }) => {
Rails.delegate(document, '.input-copy button', 'click', ({ target }) => {
const input = target.parentNode.querySelector('.input-copy__wrapper input');
const oldReadOnly = input.readonly;