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

#7493 Document Builder custom styles Slice 3: Attach stylesheets to the rendered document #7507

Merged
merged 4 commits into from
Feb 2, 2024

Conversation

BLoe
Copy link
Contributor

@BLoe BLoe commented Feb 1, 2024

What does this PR do?

Demo

https://www.loom.com/share/c9f441bfb11146118920b3816a5328e8

Future Work

  • I spent a while trying to get a document render test working with a nested document and stylesheets applied, but couldn't figure out how to get rid of the "delayed render" effect. I tried fake timers, await tick(), sleep, and mocking out various hooks and components, but nothing seemed to work, the rendered test always had the content hidden and a loading indicator showing. So, future work is to figure that out and actually get a test working to show that the stylesheet link is rendered in the document view. I verified this manually for now.

Checklist

  • Add tests
  • New files added to src/tsconfig.strictNullChecks.json (if possible)
  • Designate a primary reviewer - @grahamlangford

@BLoe BLoe self-assigned this Feb 1, 2024
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (e631cdb) 72.64% compared to head (89879e2) 72.66%.

Files Patch % Lines
src/bricks/renderers/document.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7507      +/-   ##
==========================================
+ Coverage   72.64%   72.66%   +0.01%     
==========================================
  Files        1212     1212              
  Lines       37956    37961       +5     
  Branches     7126     7128       +2     
==========================================
+ Hits        27575    27584       +9     
+ Misses      10381    10377       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -102,6 +103,7 @@ export class DocumentRenderer extends RendererABC {
Component: DocumentViewLazy,
props: {
body,
stylesheets: compact(stylesheets).filter((url) => isValidUrl(url)),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want to throw BusinessError on any invalid URLs vs. silently ignoring?

"/DocumentView.css",
bootstrap,
bootstrapOverrides,
...stylesheets,
Copy link
Contributor

@twschiller twschiller Feb 1, 2024

Choose a reason for hiding this comment

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

Open for the definition of done debate, but my original intent was to exclude the base bootstrap stylesheet if any stylesheet overrides are passed in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I didn't see that in the spec, but happy to make that change here. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, there are some implications of this that would change the scope of this quite a bit I think. I'll make a new slice to address this at the end.

Copy link
Contributor

@twschiller twschiller left a comment

Choose a reason for hiding this comment

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

Approved to unblock dependent slices. See specification clarification here: #7507 (comment)

Copy link

github-actions bot commented Feb 1, 2024

When the PR is merged, the first loom link found on this PR will be posted to #sprint-demo on Slack. Do not edit this comment manually.

@twschiller twschiller added this to the 1.8.8 milestone Feb 1, 2024
@BLoe BLoe merged commit 78865b6 into main Feb 2, 2024
28 checks passed
@BLoe BLoe deleted the feature/7493-document-custom-styles-slice3 branch February 2, 2024 00:02
@grahamlangford grahamlangford changed the title #7593 Document Builder custom styles Slice 3: Attach stylesheets to the rendered document #7493 Document Builder custom styles Slice 3: Attach stylesheets to the rendered document Feb 5, 2024
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.

Document Builder custom styles Slice 3: Attach stylesheets to the rendered document
2 participants