nextcloud-libraries / nextcloud-libraries/nextcloud-dialogs

`showLoading` and `showUndo` "ignore" `isHTML = true`

Open
#2,203 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
19
Forks
8
Avg merge
2d 5h
Merged PRs (30d)
37

Description

The showLoading and showUndo functions somewhat "ignore" isHTML = true, because they don't simply pass the text argument to showMessage, which itself just forwards it to Toastify, but they create a new element and set its innerText property to the value of text and then pass the whole element to showMessage.

https://github.com/nextcloud-libraries/nextcloud-dialogs/blob/c32717e1a0593f043a52a6b5bf9c42d427503d50/lib/toast.ts#L213-L223

I think it would be fine to do

const loaderContent = document.createElement('div')
loaderContent[options.isHTML ? 'innerHTML' : 'innerText'] = text

The containers are flex containers, so I think it won't be a problem

https://github.com/nextcloud-libraries/nextcloud-dialogs/blob/c32717e1a0593f043a52a6b5bf9c42d427503d50/styles/toast.scss#L23-L28

If you don't want to change this, I think it would be a good idea to at least remove isHTML from the options

export function showLoading(text: string, options?: Omit<ToastOptions, 'isHTML'>): Toast { }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/toast.ts around lines 213-223 to inspect how showLoading and showUndo handle text and isHTML. Check styles/toast.scss around lines 23-28, then verify that HTML text is rendered as intended without breaking the toast layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.