-
Notifications
You must be signed in to change notification settings - Fork 215
fix: fill the fullscreen component editor with the editor #3211
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
base: master
Are you sure you want to change the base?
Changes from all commits
37ccfd7
78a876c
5275856
cc218f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,24 @@ | |
| overflow: visible; | ||
| } | ||
| } | ||
|
|
||
| // Pass the fullscreen height down: flex-basis outranks h-75 and TinyMCE's inline height. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any |
||
| .editor-modal.pgn__modal-fullscreen { | ||
| .pgn__modal-body, | ||
| .pgn__modal-body-content, | ||
| .editor-body { | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
|
|
||
| .pgn__modal-body-content, | ||
| .editor-body, | ||
| .tox-tinymce { | ||
| flex: 1 1 0; | ||
| min-height: 0; | ||
| } | ||
|
|
||
| .pgn__modal-body-content { | ||
| overflow-y: auto; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { initializeMocks, render, screen } from '../../testUtils'; | ||
| import { ADVANCED_EDITOR_MIN_HEIGHT } from '../../constants'; | ||
| import { IframeProvider } from '../../generic/hooks/context/iFrameContext'; | ||
| import { LibraryBlock } from '.'; | ||
|
|
||
| const usageKey = 'lb:Org:Lib:html:block-1'; | ||
|
|
||
| const renderBlock = (props = {}) => | ||
| render( | ||
| <IframeProvider> | ||
| <LibraryBlock usageKey={usageKey} minHeight={ADVANCED_EDITOR_MIN_HEIGHT} {...props} /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not obvious why this is using |
||
| </IframeProvider>, | ||
| ); | ||
|
|
||
| describe('LibraryBlock', () => { | ||
| beforeEach(() => { | ||
| initializeMocks(); | ||
| }); | ||
|
|
||
| it('sizes the frame to the height the block reports', async () => { | ||
| renderBlock(); | ||
|
|
||
| const iframe = await screen.findByTestId('block-preview'); | ||
| expect(iframe.style.minHeight).toBe(ADVANCED_EDITOR_MIN_HEIGHT); | ||
| expect(iframe.style.flex).toBe(''); | ||
|
Comment on lines
+20
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test doesn't really confirm that the height matches "the height the block reports" - the reported height is not listed anywhere in the test. It just checks that a minimum height is set, and that the The test is fine, I think, but the description should be simplified to be more accurate about what we are testing. Or just add a comment to explain a bit more. |
||
| }); | ||
|
|
||
| it('stretches the frame to its container when asked to', async () => { | ||
| renderBlock({ fillContainer: true }); | ||
|
|
||
| const iframe = await screen.findByTestId('block-preview'); | ||
| expect(iframe.style.flex).toBe('1 1 auto'); | ||
| expect(iframe.style.height).toBe('auto'); | ||
| expect(iframe.style.minHeight).toBe('0'); | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ interface LibraryBlockProps { | |
| view?: string; | ||
| scrolling?: string; | ||
| minHeight?: string; | ||
| fillContainer?: boolean; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really understand why we need this change to |
||
| scrollIntoView?: boolean; | ||
| showTitle?: boolean; | ||
| addHeight?: number; | ||
|
|
@@ -38,6 +39,7 @@ export const LibraryBlock = ({ | |
| version, | ||
| view, | ||
| minHeight, | ||
| fillContainer = false, | ||
| scrolling = 'no', | ||
| scrollIntoView = false, | ||
| showTitle = false, | ||
|
|
@@ -99,9 +101,10 @@ export const LibraryBlock = ({ | |
| referrerPolicy="origin" | ||
| style={{ | ||
| width: '100%', | ||
| height: iframeHeight + addHeight, | ||
| pointerEvents: 'auto', | ||
| minHeight, | ||
| ...(fillContainer | ||
| ? { flex: '1 1 auto', height: 'auto', minHeight: 0 } | ||
| : { height: iframeHeight + addHeight, minHeight }), | ||
| }} | ||
| allow={IFRAME_FEATURE_POLICY} | ||
| allowFullScreen | ||
|
|
||
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.
please move these lines higher or lower. They are currently separating the important comment above from the
IFRAME_FEATURE_POLICYvariable that the comment is describing. Also please describe what this constant is for and why it's set to70vh.