@wordpress/editor 13.24.0 → 13.25.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 +2 -0
- package/build/components/document-bar/index.js +152 -0
- package/build/components/document-bar/index.js.map +1 -0
- package/build/components/editor-canvas/edit-template-blocks-notification.js +106 -0
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
- package/build/components/editor-canvas/index.js +292 -0
- package/build/components/editor-canvas/index.js.map +1 -0
- package/build/components/index.js +24 -8
- package/build/components/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +1 -0
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +2 -4
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-saved-state/index.js +1 -0
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-template/block-theme.js +99 -0
- package/build/components/post-template/block-theme.js.map +1 -0
- package/build/components/post-template/classic-theme.js +171 -0
- package/build/components/post-template/classic-theme.js.map +1 -0
- package/build/components/post-template/create-new-template-modal.js +98 -0
- package/build/components/post-template/create-new-template-modal.js.map +1 -0
- package/build/components/post-template/create-new-template.js +55 -0
- package/build/components/post-template/create-new-template.js.map +1 -0
- package/build/components/post-template/hooks.js +88 -0
- package/build/components/post-template/hooks.js.map +1 -0
- package/build/components/post-template/panel.js +71 -0
- package/build/components/post-template/panel.js.map +1 -0
- package/build/components/post-template/reset-default-template.js +48 -0
- package/build/components/post-template/reset-default-template.js.map +1 -0
- package/build/components/post-template/swap-template-button.js +84 -0
- package/build/components/post-template/swap-template-button.js.map +1 -0
- package/build/components/post-title/index.native.js +0 -1
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/preview-dropdown/index.js +113 -0
- package/build/components/preview-dropdown/index.js.map +1 -0
- package/build/components/provider/index.js +36 -77
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +17 -8
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/navigation-block-editing-mode.js +40 -0
- package/build/components/provider/navigation-block-editing-mode.js.map +1 -0
- package/build/components/provider/use-block-editor-settings.js +9 -10
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/pattern-partial-syncing.js +49 -0
- package/build/hooks/pattern-partial-syncing.js.map +1 -0
- package/build/private-apis.js +4 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +59 -11
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +3 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +52 -0
- package/build/store/private-actions.js.map +1 -0
- package/build/store/reducer.js +32 -27
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +0 -1
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +31 -10
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/document-bar/index.js +144 -0
- package/build-module/components/document-bar/index.js.map +1 -0
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +100 -0
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
- package/build-module/components/editor-canvas/index.js +283 -0
- package/build-module/components/editor-canvas/index.js.map +1 -0
- package/build-module/components/index.js +3 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +1 -0
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -4
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +1 -0
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +91 -0
- package/build-module/components/post-template/block-theme.js.map +1 -0
- package/build-module/components/post-template/classic-theme.js +162 -0
- package/build-module/components/post-template/classic-theme.js.map +1 -0
- package/build-module/components/post-template/create-new-template-modal.js +91 -0
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -0
- package/build-module/components/post-template/create-new-template.js +47 -0
- package/build-module/components/post-template/create-new-template.js.map +1 -0
- package/build-module/components/post-template/hooks.js +78 -0
- package/build-module/components/post-template/hooks.js.map +1 -0
- package/build-module/components/post-template/panel.js +63 -0
- package/build-module/components/post-template/panel.js.map +1 -0
- package/build-module/components/post-template/reset-default-template.js +41 -0
- package/build-module/components/post-template/reset-default-template.js.map +1 -0
- package/build-module/components/post-template/swap-template-button.js +77 -0
- package/build-module/components/post-template/swap-template-button.js.map +1 -0
- package/build-module/components/post-title/index.native.js +0 -1
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +105 -0
- package/build-module/components/preview-dropdown/index.js.map +1 -0
- package/build-module/components/provider/index.js +37 -78
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +18 -9
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/navigation-block-editing-mode.js +34 -0
- package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -0
- package/build-module/components/provider/use-block-editor-settings.js +9 -10
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/pattern-partial-syncing.js +46 -0
- package/build-module/hooks/pattern-partial-syncing.js.map +1 -0
- package/build-module/private-apis.js +4 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +53 -9
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +3 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +44 -0
- package/build-module/store/private-actions.js.map +1 -0
- package/build-module/store/reducer.js +30 -26
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +1 -2
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +26 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +182 -0
- package/build-style/style.css +182 -0
- package/package.json +32 -31
- package/src/components/document-bar/index.js +182 -0
- package/src/components/document-bar/style.scss +130 -0
- package/src/components/editor-canvas/edit-template-blocks-notification.js +108 -0
- package/src/components/editor-canvas/index.js +381 -0
- package/src/components/index.js +3 -1
- package/src/components/post-publish-button/index.js +1 -0
- package/src/components/post-publish-panel/maybe-upload-media.js +3 -8
- package/src/components/post-saved-state/index.js +1 -0
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-template/block-theme.js +109 -0
- package/src/components/post-template/classic-theme.js +213 -0
- package/src/components/post-template/create-new-template-modal.js +139 -0
- package/src/components/post-template/create-new-template.js +50 -0
- package/src/components/post-template/hooks.js +95 -0
- package/src/components/post-template/panel.js +67 -0
- package/src/components/post-template/reset-default-template.js +43 -0
- package/src/components/post-template/style.scss +52 -0
- package/src/components/post-template/swap-template-button.js +83 -0
- package/src/components/post-title/index.native.js +0 -1
- package/src/components/preview-dropdown/index.js +136 -0
- package/src/components/preview-dropdown/style.scss +5 -0
- package/src/components/provider/index.js +39 -112
- package/src/components/provider/index.native.js +26 -12
- package/src/components/provider/navigation-block-editing-mode.js +37 -0
- package/src/components/provider/use-block-editor-settings.js +6 -9
- package/src/hooks/index.js +1 -0
- package/src/hooks/pattern-partial-syncing.js +73 -0
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +51 -9
- package/src/store/defaults.js +1 -0
- package/src/store/index.js +3 -0
- package/src/store/private-actions.js +61 -0
- package/src/store/reducer.js +32 -27
- package/src/store/reducer.native.js +0 -2
- package/src/store/selectors.js +64 -42
- package/src/store/test/selectors.js +88 -147
- package/src/style.scss +3 -0
- package/build/components/post-template/index.js +0 -66
- package/build/components/post-template/index.js.map +0 -1
- package/build-module/components/post-template/index.js +0 -57
- package/build-module/components/post-template/index.js.map +0 -1
- package/src/components/post-template/index.js +0 -64
|
@@ -122,6 +122,10 @@ selectorNames.forEach( ( name ) => {
|
|
|
122
122
|
},
|
|
123
123
|
};
|
|
124
124
|
},
|
|
125
|
+
|
|
126
|
+
getBlocks() {
|
|
127
|
+
return state.getBlocks && state.getBlocks();
|
|
128
|
+
},
|
|
125
129
|
} );
|
|
126
130
|
|
|
127
131
|
selectorNames.forEach( ( otherName ) => {
|
|
@@ -2155,16 +2159,9 @@ describe( 'selectors', () => {
|
|
|
2155
2159
|
describe( 'getSuggestedPostFormat', () => {
|
|
2156
2160
|
it( 'returns null if cannot be determined', () => {
|
|
2157
2161
|
const state = {
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
blocks: {
|
|
2161
|
-
value: [],
|
|
2162
|
-
},
|
|
2163
|
-
edits: {},
|
|
2164
|
-
},
|
|
2162
|
+
getBlocks() {
|
|
2163
|
+
return [];
|
|
2165
2164
|
},
|
|
2166
|
-
initialEdits: {},
|
|
2167
|
-
currentPost: {},
|
|
2168
2165
|
};
|
|
2169
2166
|
|
|
2170
2167
|
expect( getSuggestedPostFormat( state ) ).toBeNull();
|
|
@@ -2172,77 +2169,56 @@ describe( 'selectors', () => {
|
|
|
2172
2169
|
|
|
2173
2170
|
it( 'return null if only one block of type `core/embed` and provider not matched', () => {
|
|
2174
2171
|
const state = {
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
},
|
|
2185
|
-
innerBlocks: [],
|
|
2186
|
-
},
|
|
2187
|
-
],
|
|
2172
|
+
getBlocks() {
|
|
2173
|
+
return [
|
|
2174
|
+
{
|
|
2175
|
+
clientId: 567,
|
|
2176
|
+
name: 'core/embed',
|
|
2177
|
+
attributes: {
|
|
2178
|
+
providerNameSlug: 'instagram',
|
|
2179
|
+
},
|
|
2180
|
+
innerBlocks: [],
|
|
2188
2181
|
},
|
|
2189
|
-
|
|
2190
|
-
},
|
|
2182
|
+
];
|
|
2191
2183
|
},
|
|
2192
|
-
initialEdits: {},
|
|
2193
|
-
currentPost: {},
|
|
2194
2184
|
};
|
|
2195
2185
|
expect( getSuggestedPostFormat( state ) ).toBeNull();
|
|
2196
2186
|
} );
|
|
2197
2187
|
|
|
2198
2188
|
it( 'return null if only one block of type `core/embed` and provider not exists', () => {
|
|
2199
2189
|
const state = {
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
attributes: {},
|
|
2208
|
-
innerBlocks: [],
|
|
2209
|
-
},
|
|
2210
|
-
],
|
|
2190
|
+
getBlocks() {
|
|
2191
|
+
return [
|
|
2192
|
+
{
|
|
2193
|
+
clientId: 567,
|
|
2194
|
+
name: 'core/embed',
|
|
2195
|
+
attributes: {},
|
|
2196
|
+
innerBlocks: [],
|
|
2211
2197
|
},
|
|
2212
|
-
|
|
2213
|
-
},
|
|
2198
|
+
];
|
|
2214
2199
|
},
|
|
2215
|
-
initialEdits: {},
|
|
2216
|
-
currentPost: {},
|
|
2217
2200
|
};
|
|
2218
2201
|
expect( getSuggestedPostFormat( state ) ).toBeNull();
|
|
2219
2202
|
} );
|
|
2220
2203
|
|
|
2221
2204
|
it( 'returns null if there is more than one block in the post', () => {
|
|
2222
2205
|
const state = {
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
attributes: {},
|
|
2231
|
-
innerBlocks: [],
|
|
2232
|
-
},
|
|
2233
|
-
{
|
|
2234
|
-
clientId: 456,
|
|
2235
|
-
name: 'core/quote',
|
|
2236
|
-
attributes: {},
|
|
2237
|
-
innerBlocks: [],
|
|
2238
|
-
},
|
|
2239
|
-
],
|
|
2206
|
+
getBlocks() {
|
|
2207
|
+
return [
|
|
2208
|
+
{
|
|
2209
|
+
clientId: 123,
|
|
2210
|
+
name: 'core/image',
|
|
2211
|
+
attributes: {},
|
|
2212
|
+
innerBlocks: [],
|
|
2240
2213
|
},
|
|
2241
|
-
|
|
2242
|
-
|
|
2214
|
+
{
|
|
2215
|
+
clientId: 456,
|
|
2216
|
+
name: 'core/quote',
|
|
2217
|
+
attributes: {},
|
|
2218
|
+
innerBlocks: [],
|
|
2219
|
+
},
|
|
2220
|
+
];
|
|
2243
2221
|
},
|
|
2244
|
-
initialEdits: {},
|
|
2245
|
-
currentPost: {},
|
|
2246
2222
|
};
|
|
2247
2223
|
|
|
2248
2224
|
expect( getSuggestedPostFormat( state ) ).toBeNull();
|
|
@@ -2250,23 +2226,16 @@ describe( 'selectors', () => {
|
|
|
2250
2226
|
|
|
2251
2227
|
it( 'returns Image if the first block is of type `core/image`', () => {
|
|
2252
2228
|
const state = {
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
attributes: {},
|
|
2261
|
-
innerBlocks: [],
|
|
2262
|
-
},
|
|
2263
|
-
],
|
|
2229
|
+
getBlocks() {
|
|
2230
|
+
return [
|
|
2231
|
+
{
|
|
2232
|
+
clientId: 123,
|
|
2233
|
+
name: 'core/image',
|
|
2234
|
+
attributes: {},
|
|
2235
|
+
innerBlocks: [],
|
|
2264
2236
|
},
|
|
2265
|
-
|
|
2266
|
-
},
|
|
2237
|
+
];
|
|
2267
2238
|
},
|
|
2268
|
-
initialEdits: {},
|
|
2269
|
-
currentPost: {},
|
|
2270
2239
|
};
|
|
2271
2240
|
|
|
2272
2241
|
expect( getSuggestedPostFormat( state ) ).toBe( 'image' );
|
|
@@ -2274,23 +2243,16 @@ describe( 'selectors', () => {
|
|
|
2274
2243
|
|
|
2275
2244
|
it( 'returns Quote if the first block is of type `core/quote`', () => {
|
|
2276
2245
|
const state = {
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
attributes: {},
|
|
2285
|
-
innerBlocks: [],
|
|
2286
|
-
},
|
|
2287
|
-
],
|
|
2246
|
+
getBlocks() {
|
|
2247
|
+
return [
|
|
2248
|
+
{
|
|
2249
|
+
clientId: 456,
|
|
2250
|
+
name: 'core/quote',
|
|
2251
|
+
attributes: {},
|
|
2252
|
+
innerBlocks: [],
|
|
2288
2253
|
},
|
|
2289
|
-
|
|
2290
|
-
},
|
|
2254
|
+
];
|
|
2291
2255
|
},
|
|
2292
|
-
initialEdits: {},
|
|
2293
|
-
currentPost: {},
|
|
2294
2256
|
};
|
|
2295
2257
|
|
|
2296
2258
|
expect( getSuggestedPostFormat( state ) ).toBe( 'quote' );
|
|
@@ -2298,25 +2260,18 @@ describe( 'selectors', () => {
|
|
|
2298
2260
|
|
|
2299
2261
|
it( 'returns Video if the first block is of type `core/embed from youtube`', () => {
|
|
2300
2262
|
const state = {
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
},
|
|
2311
|
-
innerBlocks: [],
|
|
2312
|
-
},
|
|
2313
|
-
],
|
|
2263
|
+
getBlocks() {
|
|
2264
|
+
return [
|
|
2265
|
+
{
|
|
2266
|
+
clientId: 567,
|
|
2267
|
+
name: 'core/embed',
|
|
2268
|
+
attributes: {
|
|
2269
|
+
providerNameSlug: 'youtube',
|
|
2270
|
+
},
|
|
2271
|
+
innerBlocks: [],
|
|
2314
2272
|
},
|
|
2315
|
-
|
|
2316
|
-
},
|
|
2273
|
+
];
|
|
2317
2274
|
},
|
|
2318
|
-
initialEdits: {},
|
|
2319
|
-
currentPost: {},
|
|
2320
2275
|
};
|
|
2321
2276
|
|
|
2322
2277
|
expect( getSuggestedPostFormat( state ) ).toBe( 'video' );
|
|
@@ -2324,25 +2279,18 @@ describe( 'selectors', () => {
|
|
|
2324
2279
|
|
|
2325
2280
|
it( 'returns Audio if the first block is of type `core/embed from soundcloud`', () => {
|
|
2326
2281
|
const state = {
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
},
|
|
2337
|
-
innerBlocks: [],
|
|
2338
|
-
},
|
|
2339
|
-
],
|
|
2282
|
+
getBlocks() {
|
|
2283
|
+
return [
|
|
2284
|
+
{
|
|
2285
|
+
clientId: 567,
|
|
2286
|
+
name: 'core/embed',
|
|
2287
|
+
attributes: {
|
|
2288
|
+
providerNameSlug: 'soundcloud',
|
|
2289
|
+
},
|
|
2290
|
+
innerBlocks: [],
|
|
2340
2291
|
},
|
|
2341
|
-
|
|
2342
|
-
},
|
|
2292
|
+
];
|
|
2343
2293
|
},
|
|
2344
|
-
initialEdits: {},
|
|
2345
|
-
currentPost: {},
|
|
2346
2294
|
};
|
|
2347
2295
|
|
|
2348
2296
|
expect( getSuggestedPostFormat( state ) ).toBe( 'audio' );
|
|
@@ -2350,29 +2298,22 @@ describe( 'selectors', () => {
|
|
|
2350
2298
|
|
|
2351
2299
|
it( 'returns Quote if the first block is of type `core/quote` and second is of type `core/paragraph`', () => {
|
|
2352
2300
|
const state = {
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
attributes: {},
|
|
2361
|
-
innerBlocks: [],
|
|
2362
|
-
},
|
|
2363
|
-
{
|
|
2364
|
-
clientId: 789,
|
|
2365
|
-
name: 'core/paragraph',
|
|
2366
|
-
attributes: {},
|
|
2367
|
-
innerBlocks: [],
|
|
2368
|
-
},
|
|
2369
|
-
],
|
|
2301
|
+
getBlocks() {
|
|
2302
|
+
return [
|
|
2303
|
+
{
|
|
2304
|
+
clientId: 456,
|
|
2305
|
+
name: 'core/quote',
|
|
2306
|
+
attributes: {},
|
|
2307
|
+
innerBlocks: [],
|
|
2370
2308
|
},
|
|
2371
|
-
|
|
2372
|
-
|
|
2309
|
+
{
|
|
2310
|
+
clientId: 789,
|
|
2311
|
+
name: 'core/paragraph',
|
|
2312
|
+
attributes: {},
|
|
2313
|
+
innerBlocks: [],
|
|
2314
|
+
},
|
|
2315
|
+
];
|
|
2373
2316
|
},
|
|
2374
|
-
initialEdits: {},
|
|
2375
|
-
currentPost: {},
|
|
2376
2317
|
};
|
|
2377
2318
|
|
|
2378
2319
|
expect( getSuggestedPostFormat( state ) ).toBe( 'quote' );
|
package/src/style.scss
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import "./components/autocompleters/style.scss";
|
|
2
|
+
@import "./components/document-bar/style.scss";
|
|
2
3
|
@import "./components/document-outline/style.scss";
|
|
3
4
|
@import "./components/editor-notices/style.scss";
|
|
4
5
|
@import "./components/entities-saved-states/style.scss";
|
|
@@ -16,10 +17,12 @@
|
|
|
16
17
|
@import "./components/post-schedule/style.scss";
|
|
17
18
|
@import "./components/post-sync-status/style.scss";
|
|
18
19
|
@import "./components/post-taxonomies/style.scss";
|
|
20
|
+
@import "./components/post-template/style.scss";
|
|
19
21
|
@import "./components/post-text-editor/style.scss";
|
|
20
22
|
@import "./components/post-title/style.scss";
|
|
21
23
|
@import "./components/post-url/style.scss";
|
|
22
24
|
@import "./components/post-visibility/style.scss";
|
|
23
25
|
@import "./components/post-trash/style.scss";
|
|
26
|
+
@import "./components/preview-dropdown/style.scss";
|
|
24
27
|
@import "./components/table-of-contents/style.scss";
|
|
25
28
|
@import "./components/template-validation-notice/style.scss";
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PostTemplate = PostTemplate;
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _i18n = require("@wordpress/i18n");
|
|
10
|
-
var _components = require("@wordpress/components");
|
|
11
|
-
var _data = require("@wordpress/data");
|
|
12
|
-
var _coreData = require("@wordpress/core-data");
|
|
13
|
-
var _store = require("../../store");
|
|
14
|
-
/**
|
|
15
|
-
* WordPress dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
function PostTemplate() {
|
|
23
|
-
const {
|
|
24
|
-
availableTemplates,
|
|
25
|
-
selectedTemplate,
|
|
26
|
-
isViewable
|
|
27
|
-
} = (0, _data.useSelect)(select => {
|
|
28
|
-
var _getPostType$viewable;
|
|
29
|
-
const {
|
|
30
|
-
getEditedPostAttribute,
|
|
31
|
-
getEditorSettings,
|
|
32
|
-
getCurrentPostType
|
|
33
|
-
} = select(_store.store);
|
|
34
|
-
const {
|
|
35
|
-
getPostType
|
|
36
|
-
} = select(_coreData.store);
|
|
37
|
-
return {
|
|
38
|
-
selectedTemplate: getEditedPostAttribute('template'),
|
|
39
|
-
availableTemplates: getEditorSettings().availableTemplates,
|
|
40
|
-
isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false
|
|
41
|
-
};
|
|
42
|
-
}, []);
|
|
43
|
-
const {
|
|
44
|
-
editPost
|
|
45
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
46
|
-
if (!isViewable || !availableTemplates || !Object.keys(availableTemplates).length) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return (0, _react.createElement)(_components.SelectControl, {
|
|
50
|
-
__nextHasNoMarginBottom: true,
|
|
51
|
-
label: (0, _i18n.__)('Template:'),
|
|
52
|
-
value: selectedTemplate,
|
|
53
|
-
onChange: templateSlug => {
|
|
54
|
-
editPost({
|
|
55
|
-
template: templateSlug || ''
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
options: Object.entries(availableTemplates !== null && availableTemplates !== void 0 ? availableTemplates : {}).map(([templateSlug, templateName]) => ({
|
|
59
|
-
value: templateSlug,
|
|
60
|
-
label: templateName
|
|
61
|
-
}))
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
var _default = PostTemplate;
|
|
65
|
-
exports.default = _default;
|
|
66
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_coreData","_store","PostTemplate","availableTemplates","selectedTemplate","isViewable","useSelect","select","_getPostType$viewable","getEditedPostAttribute","getEditorSettings","getCurrentPostType","editorStore","getPostType","coreStore","viewable","editPost","useDispatch","Object","keys","length","_react","createElement","SelectControl","__nextHasNoMarginBottom","label","__","value","onChange","templateSlug","template","options","entries","map","templateName","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTemplate() {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif (\n\t\t! isViewable ||\n\t\t! availableTemplates ||\n\t\t! Object.keys( availableTemplates ).length\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ Object.entries( availableTemplates ?? {} ).map(\n\t\t\t\t( [ templateSlug, templateName ] ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGO,SAASK,YAAYA,CAAA,EAAG;EAC9B,MAAM;IAAEC,kBAAkB;IAAEC,gBAAgB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EACnEC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACb,MAAM;MACLC,sBAAsB;MACtBC,iBAAiB;MACjBC;IACD,CAAC,GAAGJ,MAAM,CAAEK,YAAY,CAAC;IACzB,MAAM;MAAEC;IAAY,CAAC,GAAGN,MAAM,CAAEO,eAAU,CAAC;IAE3C,OAAO;MACNV,gBAAgB,EAAEK,sBAAsB,CAAE,UAAW,CAAC;MACtDN,kBAAkB,EAAEO,iBAAiB,CAAC,CAAC,CAACP,kBAAkB;MAC1DE,UAAU,GAAAG,qBAAA,GACTK,WAAW,CAAEF,kBAAkB,CAAC,CAAE,CAAC,EAAEI,QAAQ,cAAAP,qBAAA,cAAAA,qBAAA,GAAI;IACnD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAM;IAAEQ;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEL,YAAY,CAAC;EAE/C,IACC,CAAEP,UAAU,IACZ,CAAEF,kBAAkB,IACpB,CAAEe,MAAM,CAACC,IAAI,CAAEhB,kBAAmB,CAAC,CAACiB,MAAM,EACzC;IACD,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAAyB,aAAa;IACbC,uBAAuB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,WAAY,CAAG;IAC3BC,KAAK,EAAGvB,gBAAkB;IAC1BwB,QAAQ,EAAKC,YAAY,IAAM;MAC9Bb,QAAQ,CAAE;QACTc,QAAQ,EAAED,YAAY,IAAI;MAC3B,CAAE,CAAC;IACJ,CAAG;IACHE,OAAO,EAAGb,MAAM,CAACc,OAAO,CAAE7B,kBAAkB,aAAlBA,kBAAkB,cAAlBA,kBAAkB,GAAI,CAAC,CAAE,CAAC,CAAC8B,GAAG,CACvD,CAAE,CAAEJ,YAAY,EAAEK,YAAY,CAAE,MAAQ;MACvCP,KAAK,EAAEE,YAAY;MACnBJ,KAAK,EAAES;IACR,CAAC,CACF;EAAG,CACH,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEcjC,YAAY;AAAAkC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { SelectControl } from '@wordpress/components';
|
|
7
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { store as editorStore } from '../../store';
|
|
14
|
-
export function PostTemplate() {
|
|
15
|
-
const {
|
|
16
|
-
availableTemplates,
|
|
17
|
-
selectedTemplate,
|
|
18
|
-
isViewable
|
|
19
|
-
} = useSelect(select => {
|
|
20
|
-
var _getPostType$viewable;
|
|
21
|
-
const {
|
|
22
|
-
getEditedPostAttribute,
|
|
23
|
-
getEditorSettings,
|
|
24
|
-
getCurrentPostType
|
|
25
|
-
} = select(editorStore);
|
|
26
|
-
const {
|
|
27
|
-
getPostType
|
|
28
|
-
} = select(coreStore);
|
|
29
|
-
return {
|
|
30
|
-
selectedTemplate: getEditedPostAttribute('template'),
|
|
31
|
-
availableTemplates: getEditorSettings().availableTemplates,
|
|
32
|
-
isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false
|
|
33
|
-
};
|
|
34
|
-
}, []);
|
|
35
|
-
const {
|
|
36
|
-
editPost
|
|
37
|
-
} = useDispatch(editorStore);
|
|
38
|
-
if (!isViewable || !availableTemplates || !Object.keys(availableTemplates).length) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return createElement(SelectControl, {
|
|
42
|
-
__nextHasNoMarginBottom: true,
|
|
43
|
-
label: __('Template:'),
|
|
44
|
-
value: selectedTemplate,
|
|
45
|
-
onChange: templateSlug => {
|
|
46
|
-
editPost({
|
|
47
|
-
template: templateSlug || ''
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
options: Object.entries(availableTemplates !== null && availableTemplates !== void 0 ? availableTemplates : {}).map(([templateSlug, templateName]) => ({
|
|
51
|
-
value: templateSlug,
|
|
52
|
-
label: templateName
|
|
53
|
-
}))
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
export default PostTemplate;
|
|
57
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__","SelectControl","useSelect","useDispatch","store","coreStore","editorStore","PostTemplate","availableTemplates","selectedTemplate","isViewable","select","_getPostType$viewable","getEditedPostAttribute","getEditorSettings","getCurrentPostType","getPostType","viewable","editPost","Object","keys","length","createElement","__nextHasNoMarginBottom","label","value","onChange","templateSlug","template","options","entries","map","templateName"],"sources":["@wordpress/editor/src/components/post-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTemplate() {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif (\n\t\t! isViewable ||\n\t\t! availableTemplates ||\n\t\t! Object.keys( availableTemplates ).length\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ Object.entries( availableTemplates ?? {} ).map(\n\t\t\t\t( [ templateSlug, templateName ] ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,YAAYA,CAAA,EAAG;EAC9B,MAAM;IAAEC,kBAAkB;IAAEC,gBAAgB;IAAEC;EAAW,CAAC,GAAGR,SAAS,CACnES,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACb,MAAM;MACLC,sBAAsB;MACtBC,iBAAiB;MACjBC;IACD,CAAC,GAAGJ,MAAM,CAAEL,WAAY,CAAC;IACzB,MAAM;MAAEU;IAAY,CAAC,GAAGL,MAAM,CAAEN,SAAU,CAAC;IAE3C,OAAO;MACNI,gBAAgB,EAAEI,sBAAsB,CAAE,UAAW,CAAC;MACtDL,kBAAkB,EAAEM,iBAAiB,CAAC,CAAC,CAACN,kBAAkB;MAC1DE,UAAU,GAAAE,qBAAA,GACTI,WAAW,CAAED,kBAAkB,CAAC,CAAE,CAAC,EAAEE,QAAQ,cAAAL,qBAAA,cAAAA,qBAAA,GAAI;IACnD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAM;IAAEM;EAAS,CAAC,GAAGf,WAAW,CAAEG,WAAY,CAAC;EAE/C,IACC,CAAEI,UAAU,IACZ,CAAEF,kBAAkB,IACpB,CAAEW,MAAM,CAACC,IAAI,CAAEZ,kBAAmB,CAAC,CAACa,MAAM,EACzC;IACD,OAAO,IAAI;EACZ;EAEA,OACCC,aAAA,CAACrB,aAAa;IACbsB,uBAAuB;IACvBC,KAAK,EAAGxB,EAAE,CAAE,WAAY,CAAG;IAC3ByB,KAAK,EAAGhB,gBAAkB;IAC1BiB,QAAQ,EAAKC,YAAY,IAAM;MAC9BT,QAAQ,CAAE;QACTU,QAAQ,EAAED,YAAY,IAAI;MAC3B,CAAE,CAAC;IACJ,CAAG;IACHE,OAAO,EAAGV,MAAM,CAACW,OAAO,CAAEtB,kBAAkB,aAAlBA,kBAAkB,cAAlBA,kBAAkB,GAAI,CAAC,CAAE,CAAC,CAACuB,GAAG,CACvD,CAAE,CAAEJ,YAAY,EAAEK,YAAY,CAAE,MAAQ;MACvCP,KAAK,EAAEE,YAAY;MACnBH,KAAK,EAAEQ;IACR,CAAC,CACF;EAAG,CACH,CAAC;AAEJ;AAEA,eAAezB,YAAY"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { SelectControl } from '@wordpress/components';
|
|
6
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import { store as editorStore } from '../../store';
|
|
13
|
-
|
|
14
|
-
export function PostTemplate() {
|
|
15
|
-
const { availableTemplates, selectedTemplate, isViewable } = useSelect(
|
|
16
|
-
( select ) => {
|
|
17
|
-
const {
|
|
18
|
-
getEditedPostAttribute,
|
|
19
|
-
getEditorSettings,
|
|
20
|
-
getCurrentPostType,
|
|
21
|
-
} = select( editorStore );
|
|
22
|
-
const { getPostType } = select( coreStore );
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
selectedTemplate: getEditedPostAttribute( 'template' ),
|
|
26
|
-
availableTemplates: getEditorSettings().availableTemplates,
|
|
27
|
-
isViewable:
|
|
28
|
-
getPostType( getCurrentPostType() )?.viewable ?? false,
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
[]
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const { editPost } = useDispatch( editorStore );
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
! isViewable ||
|
|
38
|
-
! availableTemplates ||
|
|
39
|
-
! Object.keys( availableTemplates ).length
|
|
40
|
-
) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<SelectControl
|
|
46
|
-
__nextHasNoMarginBottom
|
|
47
|
-
label={ __( 'Template:' ) }
|
|
48
|
-
value={ selectedTemplate }
|
|
49
|
-
onChange={ ( templateSlug ) => {
|
|
50
|
-
editPost( {
|
|
51
|
-
template: templateSlug || '',
|
|
52
|
-
} );
|
|
53
|
-
} }
|
|
54
|
-
options={ Object.entries( availableTemplates ?? {} ).map(
|
|
55
|
-
( [ templateSlug, templateName ] ) => ( {
|
|
56
|
-
value: templateSlug,
|
|
57
|
-
label: templateName,
|
|
58
|
-
} )
|
|
59
|
-
) }
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default PostTemplate;
|