@wordpress/patterns 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/category-selector.js +9 -41
- package/build/components/category-selector.js.map +1 -1
- package/build/components/create-pattern-modal.js +45 -9
- package/build/components/create-pattern-modal.js.map +1 -1
- package/build/components/pattern-convert-button.js +11 -8
- package/build/components/pattern-convert-button.js.map +1 -1
- package/build/constants.js +3 -1
- package/build/constants.js.map +1 -1
- package/build/private-apis.js +1 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build-module/components/category-selector.js +8 -42
- package/build-module/components/category-selector.js.map +1 -1
- package/build-module/components/create-pattern-modal.js +43 -8
- package/build-module/components/create-pattern-modal.js.map +1 -1
- package/build-module/components/pattern-convert-button.js +11 -8
- package/build-module/components/pattern-convert-button.js.map +1 -1
- package/build-module/constants.js +1 -0
- package/build-module/constants.js.map +1 -1
- package/build-module/private-apis.js +2 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/package.json +15 -15
- package/src/components/category-selector.js +7 -45
- package/src/components/create-pattern-modal.js +51 -9
- package/src/components/pattern-convert-button.js +11 -8
- package/src/constants.js +1 -0
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +1 -1
|
@@ -21,6 +21,7 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
21
21
|
import { store as patternsStore } from '../store';
|
|
22
22
|
import CreatePatternModal from './create-pattern-modal';
|
|
23
23
|
import { unlock } from '../lock-unlock';
|
|
24
|
+
import { PATTERN_SYNC_TYPES } from '../constants';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Menu control to convert block(s) to a pattern block.
|
|
@@ -96,23 +97,25 @@ export default function PatternConvertButton( { clientIds, rootClientId } ) {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
const handleSuccess = ( { pattern } ) => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
if ( pattern.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced ) {
|
|
101
|
+
const newBlock = createBlock( 'core/block', {
|
|
102
|
+
ref: pattern.id,
|
|
103
|
+
} );
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
replaceBlocks( clientIds, newBlock );
|
|
106
|
+
setEditingPattern( newBlock.clientId, true );
|
|
107
|
+
}
|
|
105
108
|
|
|
106
109
|
createSuccessNotice(
|
|
107
|
-
pattern.wp_pattern_sync_status ===
|
|
110
|
+
pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced
|
|
108
111
|
? sprintf(
|
|
109
112
|
// translators: %s: the name the user has given to the pattern.
|
|
110
|
-
__( 'Unsynced
|
|
113
|
+
__( 'Unsynced pattern created: %s' ),
|
|
111
114
|
pattern.title.raw
|
|
112
115
|
)
|
|
113
116
|
: sprintf(
|
|
114
117
|
// translators: %s: the name the user has given to the pattern.
|
|
115
|
-
__( 'Synced
|
|
118
|
+
__( 'Synced pattern created: %s' ),
|
|
116
119
|
pattern.title.raw
|
|
117
120
|
),
|
|
118
121
|
{
|
package/src/constants.js
CHANGED
package/src/private-apis.js
CHANGED
|
@@ -7,6 +7,7 @@ import PatternsMenuItems from './components';
|
|
|
7
7
|
import {
|
|
8
8
|
PATTERN_TYPES,
|
|
9
9
|
PATTERN_DEFAULT_CATEGORY,
|
|
10
|
+
PATTERN_USER_CATEGORY,
|
|
10
11
|
PATTERN_CORE_SOURCES,
|
|
11
12
|
PATTERN_SYNC_TYPES,
|
|
12
13
|
} from './constants';
|
|
@@ -17,6 +18,7 @@ lock( privateApis, {
|
|
|
17
18
|
PatternsMenuItems,
|
|
18
19
|
PATTERN_TYPES,
|
|
19
20
|
PATTERN_DEFAULT_CATEGORY,
|
|
21
|
+
PATTERN_USER_CATEGORY,
|
|
20
22
|
PATTERN_CORE_SOURCES,
|
|
21
23
|
PATTERN_SYNC_TYPES,
|
|
22
24
|
} );
|
package/src/store/actions.js
CHANGED
|
@@ -69,7 +69,7 @@ export const createPatternFromFile =
|
|
|
69
69
|
( parsedContent.syncStatus &&
|
|
70
70
|
typeof parsedContent.syncStatus !== 'string' )
|
|
71
71
|
) {
|
|
72
|
-
throw new Error( 'Invalid
|
|
72
|
+
throw new Error( 'Invalid pattern JSON file' );
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const pattern = await dispatch.createPattern(
|