@wordpress/patterns 1.6.0 → 1.8.0
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/CHANGELOG.md +4 -0
- package/build/components/category-selector.js +2 -1
- package/build/components/category-selector.js.map +1 -1
- package/build/components/create-pattern-modal.js +7 -4
- package/build/components/create-pattern-modal.js.map +1 -1
- package/build/components/duplicate-pattern-modal.js +3 -3
- package/build/components/duplicate-pattern-modal.js.map +1 -1
- package/build/components/index.js +4 -2
- package/build/components/index.js.map +1 -1
- package/build/components/pattern-convert-button.js +7 -4
- package/build/components/pattern-convert-button.js.map +1 -1
- package/build/components/patterns-manage-button.js +4 -5
- package/build/components/patterns-manage-button.js.map +1 -1
- package/build/constants.js +3 -3
- package/build/constants.js.map +1 -1
- package/build/private-apis.js +1 -1
- package/build/private-apis.js.map +1 -1
- package/build-module/components/category-selector.js +2 -1
- package/build-module/components/category-selector.js.map +1 -1
- package/build-module/components/create-pattern-modal.js +8 -5
- package/build-module/components/create-pattern-modal.js.map +1 -1
- package/build-module/components/duplicate-pattern-modal.js +4 -4
- package/build-module/components/duplicate-pattern-modal.js.map +1 -1
- package/build-module/components/index.js +4 -2
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/pattern-convert-button.js +7 -4
- package/build-module/components/pattern-convert-button.js.map +1 -1
- package/build-module/components/patterns-manage-button.js +4 -5
- package/build-module/components/patterns-manage-button.js.map +1 -1
- package/build-module/constants.js +1 -1
- package/build-module/constants.js.map +1 -1
- package/build-module/private-apis.js +2 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-style/style-rtl.css +6 -9
- package/build-style/style.css +6 -9
- package/package.json +16 -16
- package/src/components/category-selector.js +1 -0
- package/src/components/create-pattern-modal.js +10 -4
- package/src/components/duplicate-pattern-modal.js +7 -6
- package/src/components/index.js +2 -1
- package/src/components/pattern-convert-button.js +10 -4
- package/src/components/patterns-manage-button.js +37 -40
- package/src/components/style.scss +9 -14
- package/src/constants.js +1 -2
- package/src/private-apis.js +2 -2
|
@@ -16,41 +16,40 @@ import { store as patternsStore } from '../store';
|
|
|
16
16
|
import { unlock } from '../lock-unlock';
|
|
17
17
|
|
|
18
18
|
function PatternsManageButton( { clientId } ) {
|
|
19
|
-
const { canRemove, isVisible,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const isBlockTheme = getSettings().__unstableIsBlockBasedTheme;
|
|
19
|
+
const { canRemove, isVisible, managePatternsUrl } = useSelect(
|
|
20
|
+
( select ) => {
|
|
21
|
+
const { getBlock, canRemoveBlock, getBlockCount, getSettings } =
|
|
22
|
+
select( blockEditorStore );
|
|
23
|
+
const { canUser } = select( coreStore );
|
|
24
|
+
const reusableBlock = getBlock( clientId );
|
|
25
|
+
const isBlockTheme = getSettings().__unstableIsBlockBasedTheme;
|
|
27
26
|
|
|
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
|
-
|
|
27
|
+
return {
|
|
28
|
+
canRemove: canRemoveBlock( clientId ),
|
|
29
|
+
isVisible:
|
|
30
|
+
!! reusableBlock &&
|
|
31
|
+
isReusableBlock( reusableBlock ) &&
|
|
32
|
+
!! canUser(
|
|
33
|
+
'update',
|
|
34
|
+
'blocks',
|
|
35
|
+
reusableBlock.attributes.ref
|
|
36
|
+
),
|
|
37
|
+
innerBlockCount: getBlockCount( clientId ),
|
|
38
|
+
// The site editor and templates both check whether the user
|
|
39
|
+
// has edit_theme_options capabilities. We can leverage that here
|
|
40
|
+
// and omit the manage patterns link if the user can't access it.
|
|
41
|
+
managePatternsUrl:
|
|
42
|
+
isBlockTheme && canUser( 'read', 'templates' )
|
|
43
|
+
? addQueryArgs( 'site-editor.php', {
|
|
44
|
+
path: '/patterns',
|
|
45
|
+
} )
|
|
46
|
+
: addQueryArgs( 'edit.php', {
|
|
47
|
+
post_type: 'wp_block',
|
|
48
|
+
} ),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
[ clientId ]
|
|
52
|
+
);
|
|
54
53
|
|
|
55
54
|
// Ignore reason: false positive of the lint rule.
|
|
56
55
|
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
|
|
@@ -64,18 +63,16 @@ function PatternsManageButton( { clientId } ) {
|
|
|
64
63
|
|
|
65
64
|
return (
|
|
66
65
|
<>
|
|
67
|
-
<MenuItem href={ managePatternsUrl }>
|
|
68
|
-
{ __( 'Manage patterns' ) }
|
|
69
|
-
</MenuItem>
|
|
70
66
|
{ canRemove && (
|
|
71
67
|
<MenuItem
|
|
72
68
|
onClick={ () => convertSyncedPatternToStatic( clientId ) }
|
|
73
69
|
>
|
|
74
|
-
{
|
|
75
|
-
? __( 'Detach patterns' )
|
|
76
|
-
: __( 'Detach pattern' ) }
|
|
70
|
+
{ __( 'Detach' ) }
|
|
77
71
|
</MenuItem>
|
|
78
72
|
) }
|
|
73
|
+
<MenuItem href={ managePatternsUrl }>
|
|
74
|
+
{ __( 'Manage patterns' ) }
|
|
75
|
+
</MenuItem>
|
|
79
76
|
</>
|
|
80
77
|
);
|
|
81
78
|
}
|
|
@@ -7,32 +7,27 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.patterns-menu-items__convert-modal-categories {
|
|
10
|
-
width: 100%;
|
|
11
10
|
position: relative;
|
|
12
|
-
min-height: 40px;
|
|
13
11
|
}
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
.components-form-token-field__suggestions-list:not(:empty) {
|
|
15
14
|
position: absolute;
|
|
15
|
+
border: $border-width solid var(--wp-admin-theme-color);
|
|
16
|
+
border-bottom-left-radius: $radius-block-ui;
|
|
17
|
+
border-bottom-right-radius: $radius-block-ui;
|
|
18
|
+
box-shadow: 0 0 0.5px 0.5px var(--wp-admin-theme-color);
|
|
16
19
|
box-sizing: border-box;
|
|
17
20
|
z-index: 1;
|
|
18
21
|
background-color: $white;
|
|
19
|
-
// Account for the border width of the token field.
|
|
20
|
-
width: calc(100% + 2px);
|
|
22
|
+
width: calc(100% + 2px); // Account for the border width of the token field.
|
|
21
23
|
left: -1px;
|
|
22
24
|
min-width: initial;
|
|
23
|
-
|
|
24
|
-
border-top: none;
|
|
25
|
-
box-shadow: 0 0 0 0.5px var(--wp-admin-theme-color);
|
|
26
|
-
border-bottom-left-radius: 2px;
|
|
27
|
-
border-bottom-right-radius: 2px;
|
|
25
|
+
max-height: $grid-unit-60 * 2; // Adjust to not cover the save button, showing three items.
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
.patterns-create-modal__name-input input[type="text"] {
|
|
32
|
-
//
|
|
33
|
-
min-height: 40px;
|
|
34
|
-
// Override the default 1px margin-x.
|
|
35
|
-
margin: 0;
|
|
30
|
+
margin: 0; // Override the default 1px margin-x.
|
|
36
31
|
}
|
|
37
32
|
|
|
38
33
|
.patterns-rename-pattern-category-modal__validation-message {
|
package/src/constants.js
CHANGED
|
@@ -5,11 +5,10 @@ export const PATTERN_TYPES = {
|
|
|
5
5
|
|
|
6
6
|
export const PATTERN_DEFAULT_CATEGORY = 'all-patterns';
|
|
7
7
|
export const PATTERN_USER_CATEGORY = 'my-patterns';
|
|
8
|
-
export const
|
|
8
|
+
export const EXCLUDED_PATTERN_SOURCES = [
|
|
9
9
|
'core',
|
|
10
10
|
'pattern-directory/core',
|
|
11
11
|
'pattern-directory/featured',
|
|
12
|
-
'pattern-directory/theme',
|
|
13
12
|
];
|
|
14
13
|
export const PATTERN_SYNC_TYPES = {
|
|
15
14
|
full: 'fully',
|
package/src/private-apis.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
PATTERN_TYPES,
|
|
12
12
|
PATTERN_DEFAULT_CATEGORY,
|
|
13
13
|
PATTERN_USER_CATEGORY,
|
|
14
|
-
|
|
14
|
+
EXCLUDED_PATTERN_SOURCES,
|
|
15
15
|
PATTERN_SYNC_TYPES,
|
|
16
16
|
} from './constants';
|
|
17
17
|
|
|
@@ -25,6 +25,6 @@ lock( privateApis, {
|
|
|
25
25
|
PATTERN_TYPES,
|
|
26
26
|
PATTERN_DEFAULT_CATEGORY,
|
|
27
27
|
PATTERN_USER_CATEGORY,
|
|
28
|
-
|
|
28
|
+
EXCLUDED_PATTERN_SOURCES,
|
|
29
29
|
PATTERN_SYNC_TYPES,
|
|
30
30
|
} );
|