PluginProbe
Parse.ly / 3.23.5
Parse.ly v3.23.5
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
wp-parsely / src / @types / gutenberg / types.ts

types.ts in Parse.ly 3.23.5, at src/@types/gutenberg/types.ts

69 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // eslint-disable-next-line import/named
2 import { BlockInstance } from '@wordpress/blocks';
3 import { dispatch } from '@wordpress/data';
4
5 /**
6 * Defines typings for core/block-editor functions, to avoid intellisense errors
7 * in function calls.
8 *
9 * This can be removed once Gutenberg provides typings for these functions.
10 *
11 * @since 3.12.0
12 */
13 export interface GutenbergFunction {
14 getBlock: ( clientId: string ) => BlockInstance | null;
15 getBlockParents: ( clientId: string ) => string[];
16 getBlocks: () => BlockInstance[];
17 getCurrentPostAttribute: ( attribute: string ) => string;
18 getCurrentPostId: () => number | undefined;
19 getEditedPostAttribute: ( attribute: string ) => string;
20 getEditedPostContent: () => string;
21 getPermalink: () => string | null;
22 getSelectedBlock: () => BlockInstance | null;
23 hasMetaBoxes: () => boolean;
24 isAutosavingPost: () => boolean;
25 isSavingPost: () => boolean;
26 removeEditorPanel: ( panelName: string ) => void;
27 selectBlock: ( clientId: string, initialPosition?: number ) => void;
28 updateBlockAttributes: ( clientId: string, attributes: Record<string, unknown> ) => void;
29 }
30
31 /**
32 * Defines typings for core/editor functions, to avoid intellisense errors in
33 * function calls.
34 *
35 * This can be removed once Gutenberg provides typings for these functions.
36 *
37 * @since 3.17.0 Moved from the GutenbergFunction interface.
38 */
39 export interface GutenbergCoreEditorFunction {
40 editPost: ( edits: Record<string, unknown> ) => void;
41 lockPostAutosaving: ( lockName: string ) => void;
42 lockPostSaving: ( lockName: string ) => void;
43 unlockPostAutosaving: ( lockName: string ) => void;
44 unlockPostSaving: ( lockName: string ) => void;
45 }
46
47 /**
48 * Alias for dispatch( 'core/block-editor' ) calls that prevents intellisense
49 * errors.
50 *
51 * @since 3.16.0
52 */
53 export const dispatchCoreBlockEditor = dispatch( 'core/block-editor' ) as GutenbergFunction;
54
55 /**
56 * Alias for dispatch( 'core/editor' ) calls that prevents intellisense errors.
57 *
58 * @since 3.16.0
59 */
60 export const dispatchCoreEditor = dispatch( 'core/editor' ) as unknown as GutenbergCoreEditorFunction;
61
62 /**
63 * Alias for dispatch( 'core/edit-post' ) calls that prevents intellisense
64 * errors.
65 *
66 * @since 3.16.0
67 */
68 export const dispatchCoreEditPost = dispatch( 'core/edit-post' );
69