-
-
Notifications
You must be signed in to change notification settings - Fork 253
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(puppeteer): support to configure styles while rendering fragment segments #318
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #318 +/- ##
===========================================
+ Coverage 92.71% 92.72% +0.01%
===========================================
Files 58 58
Lines 11340 11345 +5
Branches 2361 2362 +1
===========================================
+ Hits 10514 10520 +6
+ Misses 826 825 -1
Continue to review full report at Codecov.
|
@@ -268,8 +273,12 @@ export function apply(ctx: Context, config: Config = {}) { | |||
ctx.before('eval/send', (content) => { | |||
return segment.transformAsync(content, { | |||
async fragment({ content }) { | |||
const style = Object | |||
.entries(config.bodyStyle) | |||
.map(([key, value]) => `${hyphenate(key)}: ${value};`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
其实这里可以不要那个分号,然后下面用 join('; ')
看起来稍好一些
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我的习惯是最后加上分号,我会修改一下
@@ -64,6 +64,7 @@ export interface Config { | |||
idleTimeout?: number | |||
maxLength?: number | |||
protocols?: string[] | |||
bodyStyle?: Record<string, string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsxContainerStyle 怎么样呢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Container 也许不是很合适,不过只要在文档里写好叫什么都没问题(
No description provided.