Move the Classic block to the packages#10397
Move the Classic block to the packages#10397youknowriad merged 4 commits intoupdate/move-html-blokc-to-packagesfrom
Conversation
|
Should the folders be renamed to |
|
Yes; the "freeform" name is quite confusing! 😅 |
It's called Classic in the UI: I don't like exceptions, but in this case, it is only an internal name. We refer to it as classic every time we chat. I would vote to rename the folder and the variable assigned with import and leave the rest as is. Sidenote: when you search for |
gziolo
left a comment
There was a problem hiding this comment.
This looks great. We could discuss whether it should land in edit-post but this makes all the things easier for the time being and removes a lot of dead code. I would still consider renaming the folder from freeform to classic.
packages/block-library/src/index.js
Outdated
| import * as verse from './verse'; | ||
| import * as video from './video'; | ||
|
|
||
| // The freeform block can't be moved to the "npm" packages folder because it requires the wp.oldEditor global. |
There was a problem hiding this comment.
This comment is no longer relevant, I guess 😅
| } ); | ||
|
|
||
| setDefaultBlockName( paragraph.name ); | ||
| if ( window.wp && window.wp.oldEditor ) { |
There was a problem hiding this comment.
We could register Classic block in here to avoid conditional in other parts.
if ( window.wp && window.wp.oldEditor ) {
registerBlockType( freeform.name, freeform.settings );
setUnknownTypeHandlerName( freeform.name );
}There was a problem hiding this comment.
I wasn't sure about the implication of the order of the block's registration, I know it has some importance in the transforms priority.
There was a problem hiding this comment.
I don't think it is important in this case, but I'm fine with leaving it as it is.
|
We probably still need to add a changelog entry because technically speaking, you still can enable Classic block by defining |
|
I'll wait for a review of #10396 to merge this one as it's targetting that branch. |
| @import "./cover-image/editor.scss"; | ||
| @import "./embed/editor.scss"; | ||
| @import "./file/editor.scss"; | ||
| @import "./freeform/editor.scss"; |
|
Hey @youknowriad - I’m seeing a warning in latest master: It's still there after I cleaned the repo using |
|
@talldan, looking into it. |
|
I can't reproduce: All 3 styles for wp_register_style(
'wp-edit-blocks',
gutenberg_url( 'build/block-library/editor.css' ),
array(
'wp-components',
'wp-editor',
// Always include visual styles so the editor never appears broken.
'wp-block-library-theme',
),
filemtime( gutenberg_dir_path() . 'build/block-library/editor.css' )
); |
|
Hmm, unusual. Restarted my docker env and it's fine now. Thanks for looking into it. |


In order to merge Gutenberg into Core easily, all the Gutenberg JavaScript Core must be shared a reusable npm package. This PR moves the freeform block to the packages folder.
The idea is to test whether the
wp.oldEditorglobal (provided by WP) is available or not before registering the block. An alternative proposed by @gziolo is to move this block toedit-postmodule. I think both alternatives are good options. We'll probably have to revisit at some point either way so I just went with the simplest one for noow.This also means the block library is fully available as a package. (so a bunch of files removed etc...)
Testing instructions
Make sure you can use the classic block properly.