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(puppeteer): support to configure styles while rendering fragment segments #318

Merged
merged 1 commit into from
Aug 8, 2021

Conversation

Anillc
Copy link
Member

@Anillc Anillc commented Jul 29, 2021

No description provided.

@codecov
Copy link

codecov bot commented Jul 29, 2021

Codecov Report

Merging #318 (c67e8e3) into develop (11bbad7) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
packages/plugin-eval/src/loaders/coffeescript.ts 91.48% <0.00%> (+3.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11bbad7...c67e8e3. Read the comment docs.

packages/plugin-puppeteer/package.json Outdated Show resolved Hide resolved
packages/plugin-puppeteer/src/index.ts Outdated Show resolved Hide resolved
packages/plugin-puppeteer/src/index.ts Show resolved Hide resolved
packages/plugin-puppeteer/src/index.ts Outdated Show resolved Hide resolved
@@ -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};`)
Copy link
Member

Choose a reason for hiding this comment

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

其实这里可以不要那个分号,然后下面用 join('; ') 看起来稍好一些

Copy link
Member Author

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>
Copy link
Member

Choose a reason for hiding this comment

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

jsxContainerStyle 怎么样呢

Copy link
Member Author

Choose a reason for hiding this comment

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

Container 也许不是很合适,不过只要在文档里写好叫什么都没问题(

@shigma shigma merged commit 5989230 into koishijs:develop Aug 8, 2021
@Anillc Anillc deleted the pptdev2 branch August 8, 2021 14:53
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.

2 participants