Skip to content

showLoading and showUndo "ignore" isHTML = true #2203

Description

@Sector6759

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.

const loaderContent = document.createElement('span')
loaderContent.classList.add('toast-loader-container')
loaderContent.innerText = text
loaderContent.appendChild(loader)
return showMessage(loaderContent, {
...options,
close: false,
timeout: TOAST_PERMANENT_TIMEOUT,
type: ToastType.LOADING,
})

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

.toast-loader-container,
.toast-undo-container {
display: flex;
align-items: center;
width: 100%;
}

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 { }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions