Skip to content

Commit

Permalink
Merge pull request #225 from blockeraai/fix/bugs 🏁
Browse files Browse the repository at this point in the history
Fixes some bugs on editor features
  • Loading branch information
rezaelahidev authored Jan 6, 2025
2 parents 792861f + 9309a8a commit b0dec7d
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 32 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
"blockera/http": "*",
"blockera/telemetry": "*",
"vlucas/phpdotenv": "^5.5@dev",
"illuminate/container": "8.x-dev"
"illuminate/container": "8.x-dev",
"psr/container": "1.x-dev"
},
"require-dev": {
"symfony/dom-crawler": "5.4.x-dev",
Expand Down
55 changes: 28 additions & 27 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion packages/editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
## Unreleased

## Bug Fixes
- Ensured compatibility with the React.js rendering pipeline [[🔗 Bug](https://community.blockera.ai/bugs-mdhyb8nc/post/single-product-block-error-bXDiO88g7LsP0hV)].
- Fixed the block mode callback handler to improve functionality and reliability [[🔗 Bug](https://community.blockera.ai/bugs-mdhyb8nc/post/block-mode-switch-not-works-FsR1uwRuIcCakWp)].

### Improvements
- Updated block sections to remove the "Powered by Blockera" icon from the bottom. Instead, an indicator was added at the top of the block to show whether it is in advanced mode, displayed only once per block. (Based on users feedback)


## 1.0.0 (2024-12-08)

### New Features:
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/js/extensions/components/block-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ export const BlockBase: ComponentType<any> = memo((): Element<any> | null => {
);
const setActive = useCallback(
(blockeraMode: 'advanced' | 'basic'): void => {
_setActive('advanced' === blockeraMode);
_setActive(blockeraMode);
setAttributes({
...attributes,
blockeraMode,
blockeraMode: blockeraMode ? 'advanced' : 'basic',
});
},
// eslint-disable-next-line
Expand Down
10 changes: 9 additions & 1 deletion packages/editor/js/extensions/hooks/block-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { select } from '@wordpress/data';
import type { MixedElement } from 'react';
import { doAction } from '@wordpress/hooks';
import { useEffect, useMemo } from '@wordpress/element';
import { useEffect, useMemo, createElement } from '@wordpress/element';
import { SlotFillProvider, Slot } from '@wordpress/components';

/**
Expand Down Expand Up @@ -74,6 +74,14 @@ const EdiBlockWithoutExtensions = ({
}: Object): MixedElement => {
useSharedBlockSideEffect();

// This approach ensures compatibility with React's rendering pipeline.
if (
typeof settings.edit === 'function' &&
/^class\s/.test(Function.prototype?.toString?.call(settings.edit))
) {
return createElement(settings.edit, props);
}

return settings.edit(props);
};

Expand Down

0 comments on commit b0dec7d

Please sign in to comment.