This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { select } = wp.data; | |
| const { getBlocks } = select( 'core/editor' ); | |
| const blocks = getBlocks(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { select } = wp.data; | |
| const { getEditedPostContent } = select( 'core/editor' ); | |
| const rawPostContent = getEditedPostContent(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { dispatch } = wp.data; | |
| const { saveEntityRecord } = dispatch( 'core' ); | |
| const newPost = { title: 'Guten Tag, Gutenberg!' }; | |
| saveEntityRecord( 'postType', 'post', newPost ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { dispatch } = wp.data; | |
| const { saveEntityRecord } = dispatch( 'core' ); | |
| const TAXONOMY_NAME = 'custom'; | |
| saveEntityRecord( 'taxonomy', TAXONOMY_NAME, { name: 'X', slug: 'x' } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { dispatch } = wp.data; | |
| const { createInfoNotice } = dispatch( 'core/notices' ); | |
| createInfoNotice( 'Gutenberg ist gut!' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const NOTICE_STATUS = 'success'; // Available: info, success, warning, error | |
| const HTML_ELEMENT = '<h1 style="text-align: center">Gutenberg ist gut! 🙌</h1>'; | |
| const { dispatch } = wp.data; | |
| const { createNotice } = dispatch( 'core/notices' ); | |
| createNotice( NOTICE_STATUS, HTML_ELEMENT, { __unstableHTML: true } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { select } = wp.data; | |
| const { getTaxonomies } = select( 'core' ); | |
| const taxonomies = getTaxonomies(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const POST_ID = 25; | |
| const { select } = wp.data; | |
| const { getEntityRecords } = select( 'core' ); | |
| const [ postDetails ] = getEntityRecords( 'postType', 'post', { include: POST_ID } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { select } = wp.data; | |
| const { getEditorSettings } = select( 'core/editor' ); | |
| const { maxUploadFileSize } = getEditorSettings(); | |
| const maxMB = Number( maxUploadFileSize / Math.pow( 1024, 2 ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { select } = wp.data; | |
| const { hasUploadPermissions } = select( 'core' ); | |
| const canUpload = hasUploadPermissions(); |