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

未关闭
#2,203 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
typescript
领域
frontend

调研方向

从 lib/toast.ts 的第 213-223 行附近开始,检查 showLoading 和 showUndo 如何处理 text 和 isHTML。查看 styles/toast.scss 的第 23-28 行附近,然后验证 HTML 文本是否按预期渲染,同时不会破坏 toast 布局。

由索引模型根据 Issue 内容生成。

描述

1. to develop bug

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 { }
主要语言
TypeScript
星标
19
派生
9
平均合并
1 天 5 小时
30 天内合并 PR
70

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nextcloud-libraries/nextcloud-dialogs 的其他 Issue

查看 nextcloud-libraries/nextcloud-dialogs 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。