Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Toast messages don't respect line breaks

Aperta
#34 1 commento 5 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Inizia riproducendo la chiamata al plugin Toast dell’issue in una pagina del browser usando pwa-elements e capacitor.js, quindi segui l’implementazione di PWA Toast che normalizza il testo di input. Conferma come vengono gestiti i caratteri di nuova riga e gli altri caratteri di whitespace, e verifica che i messaggi Toast preservino le interruzioni di riga senza analizzare HTML.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I can not figure out how to create line breaks in a toast message. When on Android, for example, I can use \n to insert a newline, which works great. However, the same messages are being flattened to one line in the PWA, which looks ugly. Is there a way to represent line breaks?

I'm submitting a ...
[x] bug report
[x] feature request
[x] support request

Current behavior:
All whitespace (\n, \t, multiple spaces in a row) in the input text of the Toast plugin seems to be normalized to a single space. When I try to use HTML line breaks like <br />, they are passed through un-parsed.

Expected behavior:
There should be a way to represent line breaks in the toast messages, like on other Capacitor-supported platforms. Ideally this should simply respect the \n character so toast works identically across platforms.

Steps to reproduce:
On a browser page with both pwa elements and capacitor.js, paste in the developer console:

window.Capacitor.Plugins.Toast.show({ text: "0m 11s spent on Meditate \n Meditate ➤ Workout \n Starting from 0m 0s", duration: '10000'}).then();
Lingua principale
TypeScript
Stelle
172
Fork
50
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ionic-team/pwa-elements

Tutte le issue di ionic-team/pwa-elements

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.