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

Bucket - Editor #2415

Draft
wants to merge 48 commits into
base: master
Choose a base branch
from
Draft

Bucket - Editor #2415

wants to merge 48 commits into from

Conversation

lucatume
Copy link
Contributor

@lucatume lucatume commented Feb 24, 2025

No description provided.

Add a drop-in replacement for  the `tribe_assets` function that will
load assets from the `/build` directory.
Since assets are immediately registered in WordPress on registration,
the URL will be set to the registration one. To avoid unregistering and
re-registering the asset with the correct (/build) URL, just provide the
`group_path` argument during registration.
This updates the `data` attribute to use a less generic name and
modifies the `click` handler logic to target IAN elements only.
Additionally, ensure elements exist in the current context before
targeting them.
Add a drop-in replacement for  the `tribe_assets` function that will
load assets from the `/build` directory.
Since assets are immediately registered in WordPress on registration,
the URL will be set to the registration one. To avoid unregistering and
re-registering the asset with the correct (/build) URL, just provide the
`group_path` argument during registration.
This function is a shorthand for the application of the
`tec_using_new_editor` filter.
@lucatume lucatume self-assigned this Feb 24, 2025
// Vendor files should be loaded from `/vendor` directly, they are not built.
if ( ! str_starts_with( $file, 'vendor' ) && ! isset( $arguments['group_path'] ) ) {
// Build the group name from the plugin class name.
$build_group_name = is_object( $origin ) ? get_class( $origin ) : (string) $origin;
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
Generic.Formatting.MultipleStatementAlignment.NotSameWarning
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space

*
* @since TBD
*
* @param object $origin The main Object for the plugin you are enqueueing the script/style for.
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
StellarWP.Whitespace.DocCommentSpacing.ExtraSpaces
There should be exactly one space after the @param tag, not multiple.

* @since TBD
*
* @param object $origin The main Object for the plugin you are enqueueing the script/style for.
* @param array $assets {
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
StellarWP.Whitespace.DocCommentSpacing.ExtraSpaces
There should be exactly one space after the @param tag, not multiple.

* @since TBD
*
* @param object $origin The main Object for the plugin you are enqueueing the script/style for.
* @param array $assets {
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
Squiz.Commenting.FunctionComment.ParamCommentFullStop
Parameter comment must end with a full stop

* Indexed array, don't use any associative key.
* E.g.: [ 'slug-my-script', 'my/own/path.js', [ 'jquery' ] ]
*
* @type string $slug Slug to save the asset.
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
StellarWP.Whitespace.DocCommentSpacing.ExtraSpaces
There should be exactly one space after the @type tag, not multiple.

* @type string $file Which file will be loaded, either CSS or JS.
* @type array $deps (optional) Dependencies
* }
* @param string $action A WordPress hook that will automatically enqueue this asset once fired.
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
StellarWP.Whitespace.DocCommentSpacing.ExtraSpaces
There should be exactly one space after the @param tag, not multiple.

* @type array $deps (optional) Dependencies
* }
* @param string $action A WordPress hook that will automatically enqueue this asset once fired.
* @param array $arguments Look at `Tribe__Assets::register()` for more info.
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
StellarWP.Whitespace.DocCommentSpacing.ExtraSpaces
There should be exactly one space after the @param tag, not multiple.

*
* @return array<Asset|bool> Which Assets were registered.
*/
function tec_assets($origin, $assets, $action = null, $arguments = []){
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen
Expected 1 spaces after opening parenthesis; 0 found

*
* @return array<Asset|bool> Which Assets were registered.
*/
function tec_assets($origin, $assets, $action = null, $arguments = []){
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose
Expected 1 spaces before closing parenthesis; 0 found

*
* @return array<Asset|bool> Which Assets were registered.
*/
function tec_assets($origin, $assets, $action = null, $arguments = []){
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
Generic.Functions.OpeningFunctionBraceKernighanRitchie.SpaceBeforeBrace
Expected 1 space before opening brace; found 0

@@ -774,7 +774,10 @@ public function bind_implementations() {
tribe_singleton( 'admin.activation.page', 'Tribe__Admin__Activation_Page' );
tribe_singleton( Translations_Loader::class, Translations_Loader::class );

tribe_register_provider( Tribe__Editor__Provider::class );
if ( !tec_using_classy_editor() ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
StellarWP.Whitespace.LogicalNotSpacing.invalidWhitespace
! must be followed by a single space

@@ -774,7 +774,10 @@
tribe_singleton( 'admin.activation.page', 'Tribe__Admin__Activation_Page' );
tribe_singleton( Translations_Loader::class, Translations_Loader::class );

tribe_register_provider( Tribe__Editor__Provider::class );
if ( !tec_using_classy_editor() ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter
Expected 1 space after "!"; 0 found

@@ -18,3 +18,18 @@ function tec_is_full_site_editor() {
return false;
}
}

if ( ! function_exists( 'tec_using_classy_editor' ) ) {
function tec_using_classy_editor(): bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

[phpcs] reported by reviewdog 🐶
Squiz.Commenting.FunctionComment.Missing
Missing doc comment for function tec_using_classy_editor()

lucatume added 13 commits March 3, 2025 11:24
Replace the WebPack configuration file with one set up by
stellarwp/tyson. Together with it, remove the dependency on
`product-taskmaster` including the babel configuration file.
Update the image paths from relative to the plugin root to relative to
the postcss file being processed.
Explicitly require and include in the PostCSS pre-processing the
`postcss-nested` and `postcss-custom-media` packages to make sure
existing PostCSS code is processed the correct way, before
`autoprefixer` kicks in.
Update the code to fix _most_ issues regarding asset registration and
loading from the `/build` directory.
Update the WebPack configuration file to include all required modules to
build.
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