-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Expand file tree
/
Copy pathactions.js
More file actions
77 lines (74 loc) · 1.95 KB
/
actions.js
File metadata and controls
77 lines (74 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**
* Returns an action object used in signalling that format types have been
* added.
* Ignored from documentation as registerFormatType should be used instead from @wordpress/rich-text
*
* @ignore
*
* @param {Array|Object} formatTypes Format types received.
*
* @return {Object} Action object.
*/
export function addFormatTypes( formatTypes ) {
return {
type: 'ADD_FORMAT_TYPES',
formatTypes: Array.isArray( formatTypes )
? formatTypes
: [ formatTypes ],
};
}
/**
* Returns an action object used to remove a registered format type.
*
* Ignored from documentation as unregisterFormatType should be used instead from @wordpress/rich-text
*
* @ignore
*
* @param {string|Array} names Format name.
*
* @return {Object} Action object.
*/
export function removeFormatTypes( names ) {
return {
type: 'REMOVE_FORMAT_TYPES',
names: Array.isArray( names ) ? names : [ names ],
};
}
/**
* Returns an action object used to disable a format type for a specific block type.
*
* Ignored from documentation as unregisterFormatTypeInBlock should be used instead from @wordpress/rich-text
*
* @ignore
*
* @param {string} blockName Block name (e.g. 'core/heading').
* @param {string} formatName Format type name (e.g. 'core/bold').
*
* @return {Object} Action object.
*/
export function disableFormatTypeInBlock( blockName, formatName ) {
return {
type: 'DISABLE_FORMAT_TYPE_IN_BLOCK',
blockName,
formatName,
};
}
/**
* Returns an action object used to re-enable a format type for a specific block type.
*
* Ignored from documentation as registerFormatTypeInBlock should be used instead from @wordpress/rich-text
*
* @ignore
*
* @param {string} blockName Block name (e.g. 'core/heading').
* @param {string} formatName Format type name (e.g. 'core/bold').
*
* @return {Object} Action object.
*/
export function enableFormatTypeInBlock( blockName, formatName ) {
return {
type: 'ENABLE_FORMAT_TYPE_IN_BLOCK',
blockName,
formatName,
};
}