Compare commits

..

No commits in common. "9916afc768e8272a075125f071bbf5a246159b46" and "88025b57a470f23719cb8e7fd711f10635641cf3" have entirely different histories.

5 changed files with 12 additions and 114 deletions

View File

@ -1,39 +1,11 @@
import { useSelect, useDispatch } from '@wordpress/data';
import { useEffect } from '@wordpress/element';
import { InterfaceSkeleton, FullscreenMode, ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
import { BlockBreadcrumb, BlockCanvas, store as blockEditorStore } from '@wordpress/block-editor';
import { useSelect } from '@wordpress/data';
import { BlockCanvas, store as blockEditorStore } from '@wordpress/block-editor';
import Sidebar from './Sidebar';
export default function BlockEditor() {
const { styles, sidebarIsOpen, hasBlockSelected } = useSelect(( select ) => {
const { getSettings, getBlockSelectionStart } = select( blockEditorStore );
const { getActiveComplementaryArea } = select( interfaceStore );
return {
styles: getSettings().styles,
hasBlockSelected: !!getBlockSelectionStart(),
sidebarIsOpen: !!getActiveComplementaryArea( 'tipus/editor' )
};
}, []);
const { enableComplementaryArea, disableComplementaryArea } = useDispatch( interfaceStore );
useEffect(() => {
if (hasBlockSelected) {
enableComplementaryArea( 'tipus/editor', 'edit-post/block' );
} else {
disableComplementaryArea( 'tipus/editor' );
}
}, [ hasBlockSelected ]);
return (
<>
<FullscreenMode isActive={ true } />
<Sidebar />
<InterfaceSkeleton
content={ <BlockCanvas height="100%" styles={styles} /> }
sidebar={ sidebarIsOpen && <ComplementaryArea.Slot scope="tipus/editor" /> }
footer={ <BlockBreadcrumb /> }
/>
</>
);
export default function BlockEditor({ rootClientId }) {
const styles = useSelect(( select ) => {
const { getSettings } = select( blockEditorStore );
return getSettings().styles;
});
console.log(styles);
return <BlockCanvas height="100%" styles={styles} />
}

View File

@ -1,17 +0,0 @@
import { useSelect } from '@wordpress/data';
import { ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
import { Panel } from '@wordpress/components';
import { BlockInspector } from '@wordpress/block-editor';
export default function Sidebar () {
return (
<ComplementaryArea
scope="tipus/editor"
identifier="edit-post/block"
>
<Panel>
<BlockInspector />
</Panel>
</ComplementaryArea>
);
}

View File

@ -1,7 +1,6 @@
@import '@wordpress/components/build-style/style.css';
@import '@wordpress/interface/build-style/style.css';
@import '@wordpress/block-editor/build-style/style.css';
@import '@wordpress/block-editor/build-style/content.css';
@import '@wordpress/components/build-style/style.css';
body, html {
height: 100%;

56
package-lock.json generated
View File

@ -12,10 +12,8 @@
"@wordpress/block-editor": "13.0.0",
"@wordpress/block-library": "9.0.0",
"@wordpress/components": "28.0.0",
"@wordpress/data": "^10.0.0",
"@wordpress/element": "6.0.0",
"@wordpress/format-library": "5.0.0",
"@wordpress/interface": "6.0.0"
"@wordpress/format-library": "5.0.0"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.3.1",
@ -2261,35 +2259,6 @@
"npm": ">=8.19.2"
}
},
"node_modules/@wordpress/interface": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@wordpress/interface/-/interface-6.0.0.tgz",
"integrity": "sha512-7nx+3cJfGzpR/0+i2I8nVLH+OtkNEVGP9eG7oVli+IrCisOzIqK2d5R6+c7mmD8m16ypul+PKnhTRF3QGmt+4Q==",
"dependencies": {
"@babel/runtime": "^7.16.0",
"@wordpress/a11y": "^4.0.0",
"@wordpress/components": "^28.0.0",
"@wordpress/compose": "^7.0.0",
"@wordpress/data": "^10.0.0",
"@wordpress/deprecated": "^4.0.0",
"@wordpress/element": "^6.0.0",
"@wordpress/i18n": "^5.0.0",
"@wordpress/icons": "^10.0.0",
"@wordpress/plugins": "^7.0.0",
"@wordpress/preferences": "^4.0.0",
"@wordpress/private-apis": "^1.0.0",
"@wordpress/viewport": "^6.0.0",
"clsx": "^2.1.1"
},
"engines": {
"node": ">=18.12.0",
"npm": ">=8.19.2"
},
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
},
"node_modules/@wordpress/is-shallow-equal": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-5.0.0.tgz",
@ -2380,29 +2349,6 @@
"react-dom": "^18.0.0"
}
},
"node_modules/@wordpress/plugins": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/@wordpress/plugins/-/plugins-7.0.0.tgz",
"integrity": "sha512-X/dMJbbW/Rl3epjS482iAP0mj9V1kW+QnyNjGBYkBoQxn+DG3v2Ok6A31lrzxiebl1yACVvwxSKR85xHNFcZ6A==",
"dependencies": {
"@babel/runtime": "^7.16.0",
"@wordpress/components": "^28.0.0",
"@wordpress/compose": "^7.0.0",
"@wordpress/element": "^6.0.0",
"@wordpress/hooks": "^4.0.0",
"@wordpress/icons": "^10.0.0",
"@wordpress/is-shallow-equal": "^5.0.0",
"memize": "^2.0.1"
},
"engines": {
"node": ">=18.12.0",
"npm": ">=8.19.2"
},
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
},
"node_modules/@wordpress/preferences": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@wordpress/preferences/-/preferences-4.0.0.tgz",

View File

@ -14,10 +14,8 @@
"@wordpress/block-editor": "13.0.0",
"@wordpress/block-library": "9.0.0",
"@wordpress/components": "28.0.0",
"@wordpress/data": "^10.0.0",
"@wordpress/element": "6.0.0",
"@wordpress/format-library": "5.0.0",
"@wordpress/interface": "6.0.0"
"@wordpress/format-library": "5.0.0"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.3.1",