We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00d7dd3 commit 7b1e9e0Copy full SHA for 7b1e9e0
src/plugins/design-library-button/design-library-button.js
@@ -17,6 +17,16 @@ const DesignLibraryButton = () => {
17
const { getEditorDom } = useSelect( 'stackable/editor-dom' )
18
19
const onClick = useCallback( () => {
20
+ // If there's a design library block already in the editor, just open it.
21
+ if ( getEditorDom()?.querySelector( '[data-type="stackable/design-library"]' ) ) {
22
+ const button = getEditorDom()?.querySelector( `[data-type="stackable/design-library"] button` )
23
+ // Open the design library.
24
+ if ( button ) {
25
+ button.click()
26
+ }
27
+ return
28
29
+
30
// Insert a design library block.
31
const block = createBlock( 'stackable/design-library' )
32
0 commit comments