@wordpress/edit-post 6.1.0 → 6.3.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/header/plugin-more-menu-item/index.js +5 -0
  3. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  4. package/build/components/header/template-title/delete-template.js +3 -1
  5. package/build/components/header/template-title/delete-template.js.map +1 -1
  6. package/build/components/sidebar/post-link/index.js +1 -1
  7. package/build/components/sidebar/post-link/index.js.map +1 -1
  8. package/build/components/visual-editor/index.js +3 -3
  9. package/build/components/visual-editor/index.js.map +1 -1
  10. package/build/editor.js +4 -6
  11. package/build/editor.js.map +1 -1
  12. package/build/index.js +5 -0
  13. package/build/index.js.map +1 -1
  14. package/build/index.native.js +15 -0
  15. package/build/index.native.js.map +1 -1
  16. package/build/store/actions.js +99 -74
  17. package/build/store/actions.js.map +1 -1
  18. package/build/store/index.js +7 -10
  19. package/build/store/index.js.map +1 -1
  20. package/build/store/reducer.js +0 -118
  21. package/build/store/reducer.js.map +1 -1
  22. package/build/store/selectors.js +95 -34
  23. package/build/store/selectors.js.map +1 -1
  24. package/build-module/components/header/plugin-more-menu-item/index.js +4 -0
  25. package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
  26. package/build-module/components/header/template-title/delete-template.js +3 -1
  27. package/build-module/components/header/template-title/delete-template.js.map +1 -1
  28. package/build-module/components/sidebar/post-link/index.js +1 -1
  29. package/build-module/components/sidebar/post-link/index.js.map +1 -1
  30. package/build-module/components/visual-editor/index.js +3 -3
  31. package/build-module/components/visual-editor/index.js.map +1 -1
  32. package/build-module/editor.js +3 -6
  33. package/build-module/editor.js.map +1 -1
  34. package/build-module/index.js +5 -0
  35. package/build-module/index.js.map +1 -1
  36. package/build-module/index.native.js +13 -0
  37. package/build-module/index.native.js.map +1 -1
  38. package/build-module/store/actions.js +92 -68
  39. package/build-module/store/actions.js.map +1 -1
  40. package/build-module/store/index.js +7 -10
  41. package/build-module/store/index.js.map +1 -1
  42. package/build-module/store/reducer.js +1 -115
  43. package/build-module/store/reducer.js.map +1 -1
  44. package/build-module/store/selectors.js +89 -28
  45. package/build-module/store/selectors.js.map +1 -1
  46. package/build-style/style-rtl.css +1 -4
  47. package/build-style/style.css +1 -4
  48. package/package.json +27 -26
  49. package/src/components/header/plugin-more-menu-item/index.js +2 -0
  50. package/src/components/header/template-title/delete-template.js +3 -1
  51. package/src/components/sidebar/post-link/index.js +1 -1
  52. package/src/components/visual-editor/index.js +5 -3
  53. package/src/editor.js +3 -8
  54. package/src/index.js +5 -0
  55. package/src/index.native.js +14 -0
  56. package/src/store/actions.js +87 -42
  57. package/src/store/index.js +7 -11
  58. package/src/store/reducer.js +1 -106
  59. package/src/store/selectors.js +124 -50
  60. package/src/store/test/actions.js +89 -46
  61. package/src/store/test/reducer.js +0 -135
  62. package/src/store/test/selectors.js +0 -174
  63. package/src/style.scss +0 -4
  64. package/build/store/defaults.js +0 -19
  65. package/build/store/defaults.js.map +0 -1
  66. package/build-module/store/defaults.js +0 -12
  67. package/build-module/store/defaults.js.map +0 -1
  68. package/src/store/defaults.js +0 -11
@@ -7,7 +7,6 @@ import deepFreeze from 'deep-freeze';
7
7
  * Internal dependencies
8
8
  */
9
9
  import {
10
- preferences,
11
10
  activeModal,
12
11
  isSavingMetaBoxes,
13
12
  metaBoxLocations,
@@ -15,144 +14,10 @@ import {
15
14
  blockInserterPanel,
16
15
  listViewPanel,
17
16
  } from '../reducer';
18
- import { PREFERENCES_DEFAULTS } from '../defaults';
19
17
 
20
18
  import { setIsInserterOpened, setIsListViewOpened } from '../actions';
21
19
 
22
20
  describe( 'state', () => {
23
- describe( 'preferences()', () => {
24
- it( 'should apply all defaults', () => {
25
- const state = preferences( undefined, {} );
26
-
27
- expect( state ).toEqual( PREFERENCES_DEFAULTS );
28
- } );
29
-
30
- it( 'should disable panels by default', () => {
31
- const original = deepFreeze( {
32
- panels: {},
33
- } );
34
- const state = preferences( original, {
35
- type: 'TOGGLE_PANEL_ENABLED',
36
- panelName: 'post-status',
37
- } );
38
- expect( state.panels ).toEqual( {
39
- 'post-status': { enabled: false },
40
- } );
41
- } );
42
-
43
- it( 'should disable panels that are enabled', () => {
44
- const original = deepFreeze( {
45
- panels: {
46
- 'post-status': { enabled: true },
47
- },
48
- } );
49
- const state = preferences( original, {
50
- type: 'TOGGLE_PANEL_ENABLED',
51
- panelName: 'post-status',
52
- } );
53
- expect( state.panels ).toEqual( {
54
- 'post-status': { enabled: false },
55
- } );
56
- } );
57
-
58
- it( 'should enable panels that are disabled', () => {
59
- const original = deepFreeze( {
60
- panels: {
61
- 'post-status': { enabled: false },
62
- },
63
- } );
64
- const state = preferences( original, {
65
- type: 'TOGGLE_PANEL_ENABLED',
66
- panelName: 'post-status',
67
- } );
68
- expect( state.panels ).toEqual( {
69
- 'post-status': { enabled: true },
70
- } );
71
- } );
72
-
73
- it( 'should open panels by default', () => {
74
- const original = deepFreeze( {
75
- panels: {},
76
- } );
77
- const state = preferences( original, {
78
- type: 'TOGGLE_PANEL_OPENED',
79
- panelName: 'post-status',
80
- } );
81
- expect( state.panels ).toEqual( {
82
- 'post-status': { opened: true },
83
- } );
84
- } );
85
-
86
- it( 'should open panels that are closed', () => {
87
- const original = deepFreeze( {
88
- panels: {
89
- 'post-status': { opened: false },
90
- },
91
- } );
92
- const state = preferences( original, {
93
- type: 'TOGGLE_PANEL_OPENED',
94
- panelName: 'post-status',
95
- } );
96
- expect( state.panels ).toEqual( {
97
- 'post-status': { opened: true },
98
- } );
99
- } );
100
-
101
- it( 'should close panels that are opened', () => {
102
- const original = deepFreeze( {
103
- panels: {
104
- 'post-status': { opened: true },
105
- },
106
- } );
107
- const state = preferences( original, {
108
- type: 'TOGGLE_PANEL_OPENED',
109
- panelName: 'post-status',
110
- } );
111
- expect( state.panels ).toEqual( {
112
- 'post-status': { opened: false },
113
- } );
114
- } );
115
-
116
- it( 'should open panels that are legacy closed', () => {
117
- const original = deepFreeze( {
118
- panels: {
119
- 'post-status': false,
120
- },
121
- } );
122
- const state = preferences( original, {
123
- type: 'TOGGLE_PANEL_OPENED',
124
- panelName: 'post-status',
125
- } );
126
- expect( state.panels ).toEqual( {
127
- 'post-status': { opened: true },
128
- } );
129
- } );
130
-
131
- it( 'should close panels that are legacy opened', () => {
132
- const original = deepFreeze( {
133
- panels: {
134
- 'post-status': true,
135
- },
136
- } );
137
- const state = preferences( original, {
138
- type: 'TOGGLE_PANEL_OPENED',
139
- panelName: 'post-status',
140
- } );
141
- expect( state.panels ).toEqual( {
142
- 'post-status': { opened: false },
143
- } );
144
- } );
145
-
146
- it( 'should return switched mode', () => {
147
- const state = preferences( deepFreeze( { editorMode: 'visual' } ), {
148
- type: 'SWITCH_MODE',
149
- mode: 'text',
150
- } );
151
-
152
- expect( state.editorMode ).toBe( 'text' );
153
- } );
154
- } );
155
-
156
21
  describe( 'activeModal', () => {
157
22
  it( 'should default to null', () => {
158
23
  const state = activeModal( undefined, {} );
@@ -7,67 +7,17 @@ import deepFreeze from 'deep-freeze';
7
7
  * Internal dependencies
8
8
  */
9
9
  import {
10
- getEditorMode,
11
- getPreference,
12
- isEditorPanelOpened,
13
10
  isModalActive,
14
11
  hasMetaBoxes,
15
12
  isSavingMetaBoxes,
16
13
  getActiveMetaBoxLocations,
17
14
  isMetaBoxLocationActive,
18
- isEditorPanelEnabled,
19
15
  isEditorPanelRemoved,
20
16
  isInserterOpened,
21
17
  isListViewOpened,
22
18
  } from '../selectors';
23
19
 
24
20
  describe( 'selectors', () => {
25
- describe( 'getEditorMode', () => {
26
- it( 'should return the selected editor mode', () => {
27
- const state = {
28
- preferences: { editorMode: 'text' },
29
- };
30
-
31
- expect( getEditorMode( state ) ).toEqual( 'text' );
32
- } );
33
-
34
- it( 'should fallback to visual if not set', () => {
35
- const state = {
36
- preferences: {},
37
- };
38
-
39
- expect( getEditorMode( state ) ).toEqual( 'visual' );
40
- } );
41
- } );
42
-
43
- describe( 'getPreference', () => {
44
- it( 'should return the preference value if set', () => {
45
- const state = {
46
- preferences: { chicken: true },
47
- };
48
-
49
- expect( getPreference( state, 'chicken' ) ).toBe( true );
50
- } );
51
-
52
- it( 'should return undefined if the preference is unset', () => {
53
- const state = {
54
- preferences: { chicken: true },
55
- };
56
-
57
- expect( getPreference( state, 'ribs' ) ).toBeUndefined();
58
- } );
59
-
60
- it( 'should return the default value if provided', () => {
61
- const state = {
62
- preferences: {},
63
- };
64
-
65
- expect( getPreference( state, 'ribs', 'chicken' ) ).toEqual(
66
- 'chicken'
67
- );
68
- } );
69
- } );
70
-
71
21
  describe( 'isModalActive', () => {
72
22
  it( 'returns true if the provided name matches the value in the preferences activeModal property', () => {
73
23
  const state = {
@@ -114,130 +64,6 @@ describe( 'selectors', () => {
114
64
  } );
115
65
  } );
116
66
 
117
- describe( 'isEditorPanelEnabled', () => {
118
- it( 'should return true by default', () => {
119
- const state = {
120
- preferences: {
121
- panels: {},
122
- },
123
- };
124
-
125
- expect( isEditorPanelEnabled( state, 'post-status' ) ).toBe( true );
126
- } );
127
-
128
- it( 'should return true when a panel has been enabled', () => {
129
- const state = {
130
- preferences: {
131
- panels: {
132
- 'post-status': { enabled: true },
133
- },
134
- },
135
- };
136
-
137
- expect( isEditorPanelEnabled( state, 'post-status' ) ).toBe( true );
138
- } );
139
-
140
- it( 'should return false when a panel has been disabled', () => {
141
- const state = {
142
- preferences: {
143
- panels: {
144
- 'post-status': { enabled: false },
145
- },
146
- },
147
- };
148
-
149
- expect( isEditorPanelEnabled( state, 'post-status' ) ).toBe(
150
- false
151
- );
152
- } );
153
-
154
- it( 'should return false when a panel is enabled but removed', () => {
155
- const state = deepFreeze( {
156
- preferences: {
157
- panels: {
158
- 'post-status': {
159
- enabled: true,
160
- },
161
- },
162
- },
163
- removedPanels: [ 'post-status' ],
164
- } );
165
-
166
- expect( isEditorPanelEnabled( state, 'post-status' ) ).toBe(
167
- false
168
- );
169
- } );
170
- } );
171
-
172
- describe( 'isEditorPanelOpened', () => {
173
- it( 'is tolerant to an undefined panels preference', () => {
174
- // See: https://github.com/WordPress/gutenberg/issues/14580
175
- const state = {
176
- preferences: {},
177
- };
178
-
179
- expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( false );
180
- } );
181
-
182
- it( 'should return false by default', () => {
183
- const state = {
184
- preferences: {
185
- panels: {},
186
- },
187
- };
188
-
189
- expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( false );
190
- } );
191
-
192
- it( 'should return true when a panel has been opened', () => {
193
- const state = {
194
- preferences: {
195
- panels: {
196
- 'post-status': { opened: true },
197
- },
198
- },
199
- };
200
-
201
- expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( true );
202
- } );
203
-
204
- it( 'should return false when a panel has been closed', () => {
205
- const state = {
206
- preferences: {
207
- panels: {
208
- 'post-status': { opened: false },
209
- },
210
- },
211
- };
212
-
213
- expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( false );
214
- } );
215
-
216
- it( 'should return true when a panel has been legacy opened', () => {
217
- const state = {
218
- preferences: {
219
- panels: {
220
- 'post-status': true,
221
- },
222
- },
223
- };
224
-
225
- expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( true );
226
- } );
227
-
228
- it( 'should return false when a panel has been legacy closed', () => {
229
- const state = {
230
- preferences: {
231
- panels: {
232
- 'post-status': false,
233
- },
234
- },
235
- };
236
-
237
- expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( false );
238
- } );
239
- } );
240
-
241
67
  describe( 'hasMetaBoxes', () => {
242
68
  it( 'should return true if there are active meta boxes', () => {
243
69
  const state = {
package/src/style.scss CHANGED
@@ -93,10 +93,6 @@ body.block-editor-page {
93
93
  max-width: 100%;
94
94
  height: auto;
95
95
  }
96
-
97
- iframe {
98
- width: 100%;
99
- }
100
96
  }
101
97
 
102
98
  @include wordpress-admin-schemes();
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PREFERENCES_DEFAULTS = void 0;
7
- const PREFERENCES_DEFAULTS = {
8
- editorMode: 'visual',
9
- panels: {
10
- 'post-status': {
11
- opened: true
12
- }
13
- },
14
- hiddenBlockTypes: [],
15
- preferredStyleVariations: {},
16
- localAutosaveInterval: 15
17
- };
18
- exports.PREFERENCES_DEFAULTS = PREFERENCES_DEFAULTS;
19
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","editorMode","panels","opened","hiddenBlockTypes","preferredStyleVariations","localAutosaveInterval"],"mappings":";;;;;;AAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,UAAU,EAAE,QADuB;AAEnCC,EAAAA,MAAM,EAAE;AACP,mBAAe;AACdC,MAAAA,MAAM,EAAE;AADM;AADR,GAF2B;AAOnCC,EAAAA,gBAAgB,EAAE,EAPiB;AAQnCC,EAAAA,wBAAwB,EAAE,EARS;AASnCC,EAAAA,qBAAqB,EAAE;AATY,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\teditorMode: 'visual',\n\tpanels: {\n\t\t'post-status': {\n\t\t\topened: true,\n\t\t},\n\t},\n\thiddenBlockTypes: [],\n\tpreferredStyleVariations: {},\n\tlocalAutosaveInterval: 15,\n};\n"]}
@@ -1,12 +0,0 @@
1
- export const PREFERENCES_DEFAULTS = {
2
- editorMode: 'visual',
3
- panels: {
4
- 'post-status': {
5
- opened: true
6
- }
7
- },
8
- hiddenBlockTypes: [],
9
- preferredStyleVariations: {},
10
- localAutosaveInterval: 15
11
- };
12
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","editorMode","panels","opened","hiddenBlockTypes","preferredStyleVariations","localAutosaveInterval"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,UAAU,EAAE,QADuB;AAEnCC,EAAAA,MAAM,EAAE;AACP,mBAAe;AACdC,MAAAA,MAAM,EAAE;AADM;AADR,GAF2B;AAOnCC,EAAAA,gBAAgB,EAAE,EAPiB;AAQnCC,EAAAA,wBAAwB,EAAE,EARS;AASnCC,EAAAA,qBAAqB,EAAE;AATY,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\teditorMode: 'visual',\n\tpanels: {\n\t\t'post-status': {\n\t\t\topened: true,\n\t\t},\n\t},\n\thiddenBlockTypes: [],\n\tpreferredStyleVariations: {},\n\tlocalAutosaveInterval: 15,\n};\n"]}
@@ -1,11 +0,0 @@
1
- export const PREFERENCES_DEFAULTS = {
2
- editorMode: 'visual',
3
- panels: {
4
- 'post-status': {
5
- opened: true,
6
- },
7
- },
8
- hiddenBlockTypes: [],
9
- preferredStyleVariations: {},
10
- localAutosaveInterval: 15,
11
- };