-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Iframe block, pattern and template previews #28165
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
Changes from all commits
77be816
ae8037b
9e01e7a
ad40930
6d302fe
c6c34be
4a02838
c32317c
bb1d9c3
10ce651
0eeed17
0f563ee
8d7042d
bc50888
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 |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ export const settings = { | |
| icon, | ||
| variations, | ||
| example: { | ||
| viewportWidth: 600, // Columns collapse "@media (max-width: 599px)". | ||
|
Member
Author
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. Note that this is an existing API. The |
||
| innerBlocks: [ | ||
| { | ||
| name: 'core/column', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ export { metadata, name }; | |
| export const settings = { | ||
| icon, | ||
| example: { | ||
| viewportWidth: 601, // Columns collapse "@media (max-width: 600px)". | ||
|
Member
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 think if we want we can avoid adding a new viewPortWidth setting by using isStackedOnMobile false attributes on columns and media-text blocks.
Member
Author
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. That could work, yes.
Member
Author
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'm not sure if that's the best approach though. Why do we set previews to such a small width by default?
Member
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. Good question, I'm not sure why the previews are so small by default. I guess it may make sense to explore changing the default. |
||
| attributes: { | ||
| mediaType: 'image', | ||
| mediaUrl: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,10 @@ import { | |
| // eslint-disable-next-line no-restricted-imports | ||
| import { find } from 'puppeteer-testing-library'; | ||
|
|
||
| const twentyTwentyError = `Stylesheet twentytwenty-block-editor-styles-css was not properly added. | ||
| For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style). | ||
| For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`; | ||
|
Member
Author
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. The 2020 theme is not adding editor styles through |
||
|
|
||
| describe( 'Widgets Customizer', () => { | ||
| beforeEach( async () => { | ||
| await deleteAllWidgets(); | ||
|
|
@@ -158,6 +162,8 @@ describe( 'Widgets Customizer', () => { | |
| name: 'My Search', | ||
| selector: '.widget-content *', | ||
| } ).toBeFound( findOptions ); | ||
|
|
||
| expect( console ).toHaveErrored( twentyTwentyError ); | ||
| } ); | ||
|
|
||
| it( 'should open the inspector panel', async () => { | ||
|
|
@@ -243,6 +249,8 @@ describe( 'Widgets Customizer', () => { | |
| } ).toBeFound(); | ||
|
|
||
| await expect( inspectorHeading ).not.toBeVisible(); | ||
|
|
||
| expect( console ).toHaveErrored( twentyTwentyError ); | ||
| } ); | ||
|
|
||
| it( 'should handle the inserter outer section', async () => { | ||
|
|
@@ -350,6 +358,8 @@ describe( 'Widgets Customizer', () => { | |
| name: 'Add a block', | ||
| level: 2, | ||
| } ).not.toBeFound(); | ||
|
|
||
| expect( console ).toHaveErrored( twentyTwentyError ); | ||
| } ); | ||
|
|
||
| it( 'should move focus to the block', async () => { | ||
|
|
@@ -445,6 +455,8 @@ describe( 'Widgets Customizer', () => { | |
| text: 'First Heading', | ||
| } ); | ||
| await expect( headingBlock ).toHaveFocus(); | ||
|
|
||
| expect( console ).toHaveErrored( twentyTwentyError ); | ||
| } ); | ||
|
|
||
| it( 'should clear block selection', async () => { | ||
|
|
@@ -507,6 +519,8 @@ describe( 'Widgets Customizer', () => { | |
| role: 'toolbar', | ||
| name: 'Block tools', | ||
| } ).not.toBeFound(); | ||
|
|
||
| expect( console ).toHaveErrored( twentyTwentyError ); | ||
| } ); | ||
|
|
||
| it( 'should handle legacy widgets', async () => { | ||
|
|
@@ -685,6 +699,8 @@ describe( 'Widgets Customizer', () => { | |
| selector: '*[aria-live="polite"][aria-relevant="additions text"]', | ||
| } ).toBeFound(); | ||
| await expect( paragraphBlock ).toBeVisible(); | ||
|
|
||
| expect( console ).toHaveErrored( twentyTwentyError ); | ||
| } ); | ||
|
|
||
| it( 'should move (inner) blocks to another sidebar', async () => { | ||
|
|
@@ -744,6 +760,8 @@ describe( 'Widgets Customizer', () => { | |
| await expect( movedParagraphBlockQuery ).toBeFound(); | ||
| const movedParagraphBlock = await find( movedParagraphBlockQuery ); | ||
| await expect( movedParagraphBlock ).toHaveFocus(); | ||
|
|
||
| expect( console ).toHaveErrored( twentyTwentyError ); | ||
| } ); | ||
| } ); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| /** | ||
| * External dependencies | ||
| */ | ||
| import { size, map, without, omit } from 'lodash'; | ||
| import { size, map, without } from 'lodash'; | ||
|
|
||
| /** | ||
| * WordPress dependencies | ||
|
|
@@ -109,7 +109,7 @@ function Editor( { | |
|
|
||
| const editorSettings = useMemo( () => { | ||
| const result = { | ||
| ...omit( settings, [ 'styles' ] ), | ||
|
Member
Author
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. The omission was added in https://github.com/WordPress/gutenberg/pull/27947/files#diff-d00cfe048041886ee9b16f6f42422317b6e770cbea20cbe0e4d0ca7c8e0ec0e1R102. It's not clear to me why at this point in the code. It prevents the block editor from being able to access this setting. Cc @youknowriad. |
||
| ...settings, | ||
| __experimentalPreferredStyleVariations: { | ||
| value: preferredStyleVariations, | ||
| onChange: updatePreferredStyleVariations, | ||
|
|
||
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.
There's a weird behavior that is happening now in the patterns explorer because of this component (I think). When you switch to the "buttons" then the "columns" category tab in the modal patterns explorer, you'll notice that the patterns using columns (for example the three columns with images ones) jump between a full width image into the real output (kind of like moving from small screens to bigger) when first rendering. I tried solving this issue but failure for the moment, I'm not sure yet why it's rendering first like if it wasn't scaled (small screen) and then when scaled down, it shows the right sizes...