@secretstache/wordpress-gutenberg 0.4.4 → 0.4.6

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/styles.css CHANGED
@@ -20,6 +20,50 @@
20
20
  .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container {
21
21
  margin-bottom: 0;
22
22
  padding-bottom: 0; }
23
+ .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container .bc-image-wrapper {
24
+ position: relative;
25
+ height: auto;
26
+ align-self: start; }
27
+ .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container .bc-image-wrapper__actions {
28
+ display: none;
29
+ position: absolute;
30
+ top: 0;
31
+ left: 0;
32
+ right: 0;
33
+ bottom: 0;
34
+ flex-wrap: nowrap;
35
+ justify-content: center;
36
+ align-items: center;
37
+ gap: 20px;
38
+ padding: 5px 15px;
39
+ z-index: 20; }
40
+ @media screen and (max-width: 768px) {
41
+ .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container .bc-image-wrapper__actions {
42
+ gap: 15px; } }
43
+ .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container .bc-image-wrapper__btn {
44
+ font-size: 14px !important;
45
+ backdrop-filter: blur(16px) saturate(180%);
46
+ background: rgba(255, 255, 255, 0.75);
47
+ flex-grow: 1;
48
+ justify-content: center;
49
+ max-width: 130px; }
50
+ @media screen and (max-width: 768px) {
51
+ .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container .bc-image-wrapper__btn {
52
+ padding: 5px; } }
53
+ .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container .bc-image-wrapper__overlay {
54
+ display: none;
55
+ position: absolute;
56
+ top: 0;
57
+ left: 0;
58
+ right: 0;
59
+ bottom: 0;
60
+ z-index: 10;
61
+ background: rgba(255, 255, 255, 0.3);
62
+ backdrop-filter: blur(3px); }
63
+ .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container .bc-image-wrapper:hover .bc-image-wrapper__actions {
64
+ display: flex; }
65
+ .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container .bc-image-wrapper:hover .bc-image-wrapper__overlay {
66
+ display: block; }
23
67
  .block-editor__container .editor-visual-editor .editor-styles-wrapper .is-root-container .root-block-appender {
24
68
  position: absolute;
25
69
  bottom: 30px;
@@ -171,51 +215,6 @@
171
215
  width: 100%;
172
216
  height: auto; }
173
217
 
174
- .block-editor__container .editor-sidebar .bc-image-wrapper {
175
- position: relative;
176
- height: auto;
177
- align-self: start; }
178
- .block-editor__container .editor-sidebar .bc-image-wrapper__actions {
179
- display: none;
180
- position: absolute;
181
- top: 0;
182
- left: 0;
183
- right: 0;
184
- bottom: 0;
185
- flex-wrap: nowrap;
186
- justify-content: center;
187
- align-items: center;
188
- gap: 20px;
189
- padding: 5px 15px;
190
- z-index: 20; }
191
- @media screen and (max-width: 768px) {
192
- .block-editor__container .editor-sidebar .bc-image-wrapper__actions {
193
- gap: 15px; } }
194
- .block-editor__container .editor-sidebar .bc-image-wrapper__btn {
195
- font-size: 14px !important;
196
- backdrop-filter: blur(16px) saturate(180%);
197
- background: rgba(255, 255, 255, 0.75);
198
- flex-grow: 1;
199
- justify-content: center;
200
- max-width: 130px; }
201
- @media screen and (max-width: 768px) {
202
- .block-editor__container .editor-sidebar .bc-image-wrapper__btn {
203
- padding: 5px; } }
204
- .block-editor__container .editor-sidebar .bc-image-wrapper__overlay {
205
- display: none;
206
- position: absolute;
207
- top: 0;
208
- left: 0;
209
- right: 0;
210
- bottom: 0;
211
- z-index: 10;
212
- background: rgba(255, 255, 255, 0.3);
213
- backdrop-filter: blur(3px); }
214
- .block-editor__container .editor-sidebar .bc-image-wrapper:hover .bc-image-wrapper__actions {
215
- display: flex; }
216
- .block-editor__container .editor-sidebar .bc-image-wrapper:hover .bc-image-wrapper__overlay {
217
- display: block; }
218
-
219
218
  .block-editor__container .editor-sidebar .bc-selected-media-wrapper {
220
219
  max-width: 200px;
221
220
  cursor: pointer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secretstache/wordpress-gutenberg",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "",
5
5
  "author": "Secret Stache",
6
6
  "license": "GPL-2.0-or-later",
@@ -1,15 +1,20 @@
1
1
  import { TabPanel } from '@wordpress/components';
2
- import { useCallback } from '@wordpress/element';
2
+ import { useCallback, useEffect, useState } from '@wordpress/element';
3
3
 
4
4
  import { SpacingControl } from './SpacingControl.js';
5
5
 
6
+ const getTabName = (deviceType = 'Desktop') => {
7
+ return deviceType === 'Desktop' ? 'desktop' : 'mobile';
8
+ };
9
+
6
10
  export const ResponsiveSpacingControl = ({
7
- max = 6,
8
- min = -1,
9
- hasMargin = true,
10
- hasPadding = true,
11
- onChange,
12
- value = { desktop: { margin: {}, padding: {} }, mobile: { margin: {}, padding: {} } },
11
+ max = 6,
12
+ min = -1,
13
+ hasMargin = true,
14
+ hasPadding = true,
15
+ onChange,
16
+ value = { desktop: { margin: {}, padding: {} }, mobile: { margin: {}, padding: {} } },
17
+ deviceType,
13
18
  }) => {
14
19
  const handleDesktopChange = useCallback(
15
20
  (desktop) => {
@@ -31,9 +36,20 @@ export const ResponsiveSpacingControl = ({
31
36
  [ onChange, value.desktop ],
32
37
  );
33
38
 
39
+ const initialTabName = getTabName(deviceType);
40
+
41
+ const [ selectedTab, setSelectedTab ] = useState(initialTabName);
42
+
43
+ useEffect(() => {
44
+ setSelectedTab(getTabName());
45
+ }, [ deviceType ]);
46
+
34
47
  return (
35
48
  <TabPanel
36
49
  className="bc-responsive-spacing-control"
50
+ initialTabName={initialTabName}
51
+ onSelect={setSelectedTab}
52
+ selectedTabName={selectedTab}
37
53
  tabs={[
38
54
  { name: 'desktop', title: 'Desktop', className: 'bc-responsive-spacing-tab bc-responsive-spacing-tab--desktop' },
39
55
  { name: 'mobile', title: 'Mobile', className: 'bc-responsive-spacing-tab bc-responsive-spacing-tab--mobile' },
@@ -36,6 +36,7 @@
36
36
  }
37
37
 
38
38
  .is-root-container {
39
+ @import "image-wrapper";
39
40
  @import "root-block-appender";
40
41
  @import "empty-block-appender";
41
42
 
@@ -72,7 +73,6 @@
72
73
  @import "link-control";
73
74
  @import "animation-file-renderer";
74
75
  @import "icon-picker";
75
- @import "image-wrapper";
76
76
  @import "media-picker";
77
77
  @import "sortable-select";
78
78
  @import "responsive-spacing";
@@ -61,7 +61,7 @@ export const addUnsetRootBlockFilter = (rootBlockName) => {
61
61
  * @param {Function} [matchPostTypeCallback=null] - Callback function when the post type matches.
62
62
  * @param {Function} [notMatchPostTypeCallback=null] - Callback function when the post type does not match.
63
63
  */
64
- export const setRootBlock = (
64
+ export const setRootBlock = ( // TODO: rebuild params to object
65
65
  rootBlockName,
66
66
  postTypes = ['page', 'ssm_design_system'],
67
67
  initAppender = true,