Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): add <p> and <a> and <br> elements #5

Merged
merged 11 commits into from
Apr 5, 2024
Merged

Conversation

MaikoTan
Copy link
Contributor

@MaikoTan MaikoTan commented Mar 26, 2024

Not tested (don't know how to test)

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 54.54545% with 30 lines in your changes are missing coverage. Please review.

Project coverage is 83.13%. Comparing base (a721bae) to head (0a24b02).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #5      +/-   ##
==========================================
- Coverage   84.07%   83.13%   -0.95%     
==========================================
  Files          10       10              
  Lines        2261     2324      +63     
  Branches      107      119      +12     
==========================================
+ Hits         1901     1932      +31     
- Misses        358      390      +32     
  Partials        2        2              
Files Coverage Δ
...e-chronocat-api/src/api/message/create/messager.ts 49.08% <54.54%> (+0.02%) ⬆️

@MaikoTan MaikoTan requested a review from ilharp March 26, 2024 05:29
@MaikoTan MaikoTan changed the title feat: add <p> and <a> elements feat: add <p> and <a> and <br> elements Mar 26, 2024
Copy link
Member

@Lipraty Lipraty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ilharp
Copy link
Contributor

ilharp commented Apr 5, 2024

这个 PR 和下版本的一个更改冲突了。我先合了 PR,等之后再来写单测和 review 吧。

@ilharp ilharp merged commit 373ebf1 into master Apr 5, 2024
8 of 10 checks passed
@ilharp ilharp changed the title feat: add <p> and <a> and <br> elements feat(api): add <p> and <a> and <br> elements Apr 5, 2024
Copy link
Contributor

@ilharp ilharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

normalize() 里使用 reduce() 很帅,a 元素没问题了,不过 brp 元素还是有点小问题。我加了几个单测,有谁愿意看看的话之后可以看一下(稍微有点难)。

https://github.com/chrononeko/chronocat/runs/23502779980

cb8d727

有打算解决单测的话,写好代码之后可以新开 PR。

Comment on lines +116 to +133
case 'br': {
// 换行
if (this.isEndLine) {
this.children.push(r.text('\n'))
}
this.isEndLine = false
return
}

case 'p': {
// 文本段落
if (this.isEndLine) {
this.children.push(r.text('\n'))
}
await this.render(children)
this.isEndLine = true
return
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brp 还是有点小问题

@ilharp ilharp deleted the elements-p-et-a branch April 11, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants