mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-19 07:01:11 -05:00
Add flag to send HTML or plain Text to banner (#947)
This commit is contained in:
@@ -41,8 +41,8 @@ export function ensureUniqueId(el: HTMLElement) {
|
||||
if (el.id === '') el.id = `py-internal-${_uniqueIdCounter++}`;
|
||||
}
|
||||
|
||||
export function showWarning(msg: string): void {
|
||||
_createAlertBanner(msg, "warning")
|
||||
export function showWarning(msg: string, messageType: "text" | "html" = "text"): void {
|
||||
_createAlertBanner(msg, "warning", messageType);
|
||||
}
|
||||
|
||||
export function handleFetchError(e: Error, singleFile: string) {
|
||||
@@ -69,8 +69,8 @@ export function handleFetchError(e: Error, singleFile: string) {
|
||||
// We need to create the banner because `handleFetchError` is called before we
|
||||
// use withUserErrorHandler in main.js we are also disabling the log message
|
||||
// because it will be logged by the uncaught exception in promise.
|
||||
_createAlertBanner(errorContent, "error", false)
|
||||
throw new UserError(errorContent)
|
||||
_createAlertBanner(errorContent, "error", "html", false);
|
||||
throw new UserError(errorContent);
|
||||
}
|
||||
|
||||
export function readTextFromPath(path: string) {
|
||||
|
||||
Reference in New Issue
Block a user