@wordpress/edit-post 4.1.19 → 4.1.22
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/README.md +50 -69
- package/build/components/layout/index.js +1 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/meta-boxes/index.js +39 -19
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/visual-editor/index.js +6 -5
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/index.js +9 -12
- package/build/index.js.map +1 -1
- package/build/store/actions.js +52 -34
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +20 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/layout/index.js +2 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/meta-boxes/index.js +40 -19
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +6 -5
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/index.js +2 -5
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +50 -34
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +20 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +11 -0
- package/build-module/store/selectors.js.map +1 -1
- package/package.json +26 -26
- package/src/components/layout/index.js +2 -0
- package/src/components/meta-boxes/index.js +41 -13
- package/src/components/visual-editor/index.js +12 -15
- package/src/index.js +2 -5
- package/src/store/actions.js +70 -52
- package/src/store/reducer.js +17 -0
- package/src/store/selectors.js +11 -0
package/README.md
CHANGED
|
@@ -27,22 +27,19 @@ They can be found in the global variable `wp.editPost` when defining `wp-edit-po
|
|
|
27
27
|
|
|
28
28
|
<!-- START TOKEN(Autogenerated API docs) -->
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
### initializeEditor
|
|
31
31
|
|
|
32
32
|
Initializes and returns an instance of Editor.
|
|
33
33
|
|
|
34
|
-
The return value of this function is not necessary if we change where we
|
|
35
|
-
call initializeEditor(). This is due to metaBox timing.
|
|
36
|
-
|
|
37
34
|
_Parameters_
|
|
38
35
|
|
|
39
36
|
- _id_ `string`: Unique identifier for editor instance.
|
|
40
|
-
- _postType_ `
|
|
37
|
+
- _postType_ `string`: Post type of the post to edit.
|
|
41
38
|
- _postId_ `Object`: ID of the post to edit.
|
|
42
39
|
- _settings_ `?Object`: Editor settings object.
|
|
43
40
|
- _initialEdits_ `Object`: Programmatic edits to apply initially, to be considered as non-user-initiated (bypass for unsaved changes prompt).
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
### PluginBlockSettingsMenuItem
|
|
46
43
|
|
|
47
44
|
Renders a new item in the block settings menu.
|
|
48
45
|
|
|
@@ -53,20 +50,17 @@ _Usage_
|
|
|
53
50
|
var __ = wp.i18n.__;
|
|
54
51
|
var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
|
|
55
52
|
|
|
56
|
-
function doOnClick(){
|
|
53
|
+
function doOnClick() {
|
|
57
54
|
// To be called when the user clicks the menu item.
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
function MyPluginBlockSettingsMenuItem() {
|
|
61
|
-
return wp.element.createElement(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
onClick: doOnClick,
|
|
68
|
-
}
|
|
69
|
-
);
|
|
58
|
+
return wp.element.createElement( PluginBlockSettingsMenuItem, {
|
|
59
|
+
allowedBlocks: [ 'core/paragraph' ],
|
|
60
|
+
icon: 'dashicon-name',
|
|
61
|
+
label: __( 'Menu item text' ),
|
|
62
|
+
onClick: doOnClick,
|
|
63
|
+
} );
|
|
70
64
|
}
|
|
71
65
|
```
|
|
72
66
|
|
|
@@ -75,16 +69,17 @@ function MyPluginBlockSettingsMenuItem() {
|
|
|
75
69
|
import { __ } from '@wordpress/i18n';
|
|
76
70
|
import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
|
|
77
71
|
|
|
78
|
-
const doOnClick = (
|
|
79
|
-
|
|
72
|
+
const doOnClick = () => {
|
|
73
|
+
// To be called when the user clicks the menu item.
|
|
80
74
|
};
|
|
81
75
|
|
|
82
76
|
const MyPluginBlockSettingsMenuItem = () => (
|
|
83
|
-
|
|
77
|
+
<PluginBlockSettingsMenuItem
|
|
84
78
|
allowedBlocks={ [ 'core/paragraph' ] }
|
|
85
|
-
icon=
|
|
79
|
+
icon="dashicon-name"
|
|
86
80
|
label={ __( 'Menu item text' ) }
|
|
87
|
-
onClick={ doOnClick }
|
|
81
|
+
onClick={ doOnClick }
|
|
82
|
+
/>
|
|
88
83
|
);
|
|
89
84
|
```
|
|
90
85
|
|
|
@@ -102,7 +97,7 @@ _Returns_
|
|
|
102
97
|
|
|
103
98
|
- `WPComponent`: The component to be rendered.
|
|
104
99
|
|
|
105
|
-
|
|
100
|
+
### PluginDocumentSettingPanel
|
|
106
101
|
|
|
107
102
|
Renders items below the Status & Availability panel in the Document Sidebar.
|
|
108
103
|
|
|
@@ -127,7 +122,7 @@ function MyDocumentSettingPlugin() {
|
|
|
127
122
|
}
|
|
128
123
|
|
|
129
124
|
registerPlugin( 'my-document-setting-plugin', {
|
|
130
|
-
|
|
125
|
+
render: MyDocumentSettingPlugin,
|
|
131
126
|
} );
|
|
132
127
|
```
|
|
133
128
|
|
|
@@ -137,12 +132,15 @@ import { registerPlugin } from '@wordpress/plugins';
|
|
|
137
132
|
import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
|
|
138
133
|
|
|
139
134
|
const MyDocumentSettingTest = () => (
|
|
140
|
-
|
|
135
|
+
<PluginDocumentSettingPanel
|
|
136
|
+
className="my-document-setting-plugin"
|
|
137
|
+
title="My Panel"
|
|
138
|
+
>
|
|
141
139
|
<p>My Document Setting Panel</p>
|
|
142
140
|
</PluginDocumentSettingPanel>
|
|
143
141
|
);
|
|
144
142
|
|
|
145
|
-
|
|
143
|
+
registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
|
|
146
144
|
```
|
|
147
145
|
|
|
148
146
|
_Parameters_
|
|
@@ -157,7 +155,7 @@ _Returns_
|
|
|
157
155
|
|
|
158
156
|
- `WPComponent`: The component to be rendered.
|
|
159
157
|
|
|
160
|
-
|
|
158
|
+
### PluginMoreMenuItem
|
|
161
159
|
|
|
162
160
|
Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
|
|
163
161
|
The text within the component appears as the menu item label.
|
|
@@ -197,10 +195,7 @@ function onButtonClick() {
|
|
|
197
195
|
}
|
|
198
196
|
|
|
199
197
|
const MyButtonMoreMenuItem = () => (
|
|
200
|
-
<PluginMoreMenuItem
|
|
201
|
-
icon={ more }
|
|
202
|
-
onClick={ onButtonClick }
|
|
203
|
-
>
|
|
198
|
+
<PluginMoreMenuItem icon={ more } onClick={ onButtonClick }>
|
|
204
199
|
{ __( 'My button title' ) }
|
|
205
200
|
</PluginMoreMenuItem>
|
|
206
201
|
);
|
|
@@ -218,7 +213,7 @@ _Returns_
|
|
|
218
213
|
|
|
219
214
|
- `WPComponent`: The component to be rendered.
|
|
220
215
|
|
|
221
|
-
|
|
216
|
+
### PluginPostPublishPanel
|
|
222
217
|
|
|
223
218
|
Renders provided content to the post-publish panel in the publish flow
|
|
224
219
|
(side panel that opens after a user publishes the post).
|
|
@@ -254,7 +249,7 @@ const MyPluginPostPublishPanel = () => (
|
|
|
254
249
|
title={ __( 'My panel title' ) }
|
|
255
250
|
initialOpen={ true }
|
|
256
251
|
>
|
|
257
|
-
|
|
252
|
+
{ __( 'My panel content' ) }
|
|
258
253
|
</PluginPostPublishPanel>
|
|
259
254
|
);
|
|
260
255
|
```
|
|
@@ -271,7 +266,7 @@ _Returns_
|
|
|
271
266
|
|
|
272
267
|
- `WPComponent`: The component to be rendered.
|
|
273
268
|
|
|
274
|
-
|
|
269
|
+
### PluginPostStatusInfo
|
|
275
270
|
|
|
276
271
|
Renders a row in the Status & visibility panel of the Document sidebar.
|
|
277
272
|
It should be noted that this is named and implemented around the function it serves
|
|
@@ -291,7 +286,7 @@ function MyPluginPostStatusInfo() {
|
|
|
291
286
|
className: 'my-plugin-post-status-info',
|
|
292
287
|
},
|
|
293
288
|
__( 'My post status info' )
|
|
294
|
-
)
|
|
289
|
+
);
|
|
295
290
|
}
|
|
296
291
|
```
|
|
297
292
|
|
|
@@ -301,9 +296,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
301
296
|
import { PluginPostStatusInfo } from '@wordpress/edit-post';
|
|
302
297
|
|
|
303
298
|
const MyPluginPostStatusInfo = () => (
|
|
304
|
-
<PluginPostStatusInfo
|
|
305
|
-
className="my-plugin-post-status-info"
|
|
306
|
-
>
|
|
299
|
+
<PluginPostStatusInfo className="my-plugin-post-status-info">
|
|
307
300
|
{ __( 'My post status info' ) }
|
|
308
301
|
</PluginPostStatusInfo>
|
|
309
302
|
);
|
|
@@ -319,7 +312,7 @@ _Returns_
|
|
|
319
312
|
|
|
320
313
|
- `WPComponent`: The component to be rendered.
|
|
321
314
|
|
|
322
|
-
|
|
315
|
+
### PluginPrePublishPanel
|
|
323
316
|
|
|
324
317
|
Renders provided content to the pre-publish side panel in the publish flow
|
|
325
318
|
(side panel that opens when a user first pushes "Publish" from the main editor).
|
|
@@ -355,7 +348,7 @@ const MyPluginPrePublishPanel = () => (
|
|
|
355
348
|
title={ __( 'My panel title' ) }
|
|
356
349
|
initialOpen={ true }
|
|
357
350
|
>
|
|
358
|
-
|
|
351
|
+
{ __( 'My panel content' ) }
|
|
359
352
|
</PluginPrePublishPanel>
|
|
360
353
|
);
|
|
361
354
|
```
|
|
@@ -372,14 +365,16 @@ _Returns_
|
|
|
372
365
|
|
|
373
366
|
- `WPComponent`: The component to be rendered.
|
|
374
367
|
|
|
375
|
-
|
|
368
|
+
### PluginSidebar
|
|
376
369
|
|
|
377
370
|
Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
|
|
378
371
|
It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
|
|
379
372
|
If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
|
|
380
373
|
|
|
381
374
|
```js
|
|
382
|
-
wp.data
|
|
375
|
+
wp.data
|
|
376
|
+
.dispatch( 'core/edit-post' )
|
|
377
|
+
.openGeneralSidebar( 'plugin-name/sidebar-name' );
|
|
383
378
|
```
|
|
384
379
|
|
|
385
380
|
_Related_
|
|
@@ -398,17 +393,13 @@ var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
|
|
|
398
393
|
|
|
399
394
|
function MyPluginSidebar() {
|
|
400
395
|
return el(
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
PanelBody,
|
|
409
|
-
{},
|
|
410
|
-
__( 'My sidebar content' )
|
|
411
|
-
)
|
|
396
|
+
PluginSidebar,
|
|
397
|
+
{
|
|
398
|
+
name: 'my-sidebar',
|
|
399
|
+
title: 'My sidebar title',
|
|
400
|
+
icon: moreIcon,
|
|
401
|
+
},
|
|
402
|
+
el( PanelBody, {}, __( 'My sidebar content' ) )
|
|
412
403
|
);
|
|
413
404
|
}
|
|
414
405
|
```
|
|
@@ -421,14 +412,8 @@ import { PluginSidebar } from '@wordpress/edit-post';
|
|
|
421
412
|
import { more } from '@wordpress/icons';
|
|
422
413
|
|
|
423
414
|
const MyPluginSidebar = () => (
|
|
424
|
-
<PluginSidebar
|
|
425
|
-
|
|
426
|
-
title="My sidebar title"
|
|
427
|
-
icon={ more }
|
|
428
|
-
>
|
|
429
|
-
<PanelBody>
|
|
430
|
-
{ __( 'My sidebar content' ) }
|
|
431
|
-
</PanelBody>
|
|
415
|
+
<PluginSidebar name="my-sidebar" title="My sidebar title" icon={ more }>
|
|
416
|
+
<PanelBody>{ __( 'My sidebar content' ) }</PanelBody>
|
|
432
417
|
</PluginSidebar>
|
|
433
418
|
);
|
|
434
419
|
```
|
|
@@ -442,7 +427,7 @@ _Parameters_
|
|
|
442
427
|
- _props.isPinnable_ `[boolean]`: Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
|
|
443
428
|
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
|
|
444
429
|
|
|
445
|
-
|
|
430
|
+
### PluginSidebarMoreMenuItem
|
|
446
431
|
|
|
447
432
|
Renders a menu item in `Plugins` group in `More Menu` drop down,
|
|
448
433
|
and can be used to activate the corresponding `PluginSidebar` component.
|
|
@@ -464,7 +449,7 @@ function MySidebarMoreMenuItem() {
|
|
|
464
449
|
icon: moreIcon,
|
|
465
450
|
},
|
|
466
451
|
__( 'My sidebar title' )
|
|
467
|
-
)
|
|
452
|
+
);
|
|
468
453
|
}
|
|
469
454
|
```
|
|
470
455
|
|
|
@@ -475,10 +460,7 @@ import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
|
|
|
475
460
|
import { more } from '@wordpress/icons';
|
|
476
461
|
|
|
477
462
|
const MySidebarMoreMenuItem = () => (
|
|
478
|
-
<PluginSidebarMoreMenuItem
|
|
479
|
-
target="my-sidebar"
|
|
480
|
-
icon={ more }
|
|
481
|
-
>
|
|
463
|
+
<PluginSidebarMoreMenuItem target="my-sidebar" icon={ more }>
|
|
482
464
|
{ __( 'My sidebar title' ) }
|
|
483
465
|
</PluginSidebarMoreMenuItem>
|
|
484
466
|
);
|
|
@@ -494,7 +476,7 @@ _Returns_
|
|
|
494
476
|
|
|
495
477
|
- `WPComponent`: The component to be rendered.
|
|
496
478
|
|
|
497
|
-
|
|
479
|
+
### reinitializeEditor
|
|
498
480
|
|
|
499
481
|
Reinitializes the editor after the user chooses to reboot the editor after
|
|
500
482
|
an unhandled error occurs, replacing previously mounted editor element using
|
|
@@ -508,7 +490,7 @@ _Parameters_
|
|
|
508
490
|
- _settings_ `?Object`: Editor settings object.
|
|
509
491
|
- _initialEdits_ `Object`: Programmatic edits to apply initially, to be considered as non-user-initiated (bypass for unsaved changes prompt).
|
|
510
492
|
|
|
511
|
-
|
|
493
|
+
### store
|
|
512
494
|
|
|
513
495
|
Store definition for the edit post namespace.
|
|
514
496
|
|
|
@@ -520,7 +502,6 @@ _Type_
|
|
|
520
502
|
|
|
521
503
|
- `Object`
|
|
522
504
|
|
|
523
|
-
|
|
524
505
|
<!-- END TOKEN(Autogenerated API docs) -->
|
|
525
506
|
|
|
526
507
|
<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
|
|
@@ -198,6 +198,7 @@ function Layout({
|
|
|
198
198
|
}, hasBlockSelected ? (0, _i18n.__)('Open block settings') : (0, _i18n.__)('Open document settings'))), (0, _element.createElement)(_interface.ComplementaryArea.Slot, {
|
|
199
199
|
scope: "core/edit-post"
|
|
200
200
|
})),
|
|
201
|
+
notices: (0, _element.createElement)(_editor.EditorSnackbars, null),
|
|
201
202
|
content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_editor.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0, _element.createElement)(_textEditor.default, null), isRichEditingEnabled && mode === 'visual' && (0, _element.createElement)(_visualEditor.default, {
|
|
202
203
|
styles: styles
|
|
203
204
|
}), !isTemplateMode && (0, _element.createElement)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["interfaceLabels","secondarySidebar","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","editPostStore","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","hasReducedUI","showBlockBreadcrumbs","isTemplateMode","select","editorSettings","editorStore","getEditorSettings","isEditingTemplate","isFeatureActive","interfaceStore","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","keyboardShortcutsStore","getAllShortcutRawKeyCombinations","className","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","previous","next"],"mappings":";;;;;;;;;AA4BA;;AAzBA;;AAKA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhDA;AACA;AACA;;AAGA;AACA;AACA;;AAwBA;AACA;AACA;AAiBA,MAAMA,eAAe,GAAG;AACvBC,EAAAA,gBAAgB,EAAE,cAAI,eAAJ,CADK;;AAEvB;AACAC,EAAAA,MAAM,EAAE,cAAI,gBAAJ,CAHe;;AAIvB;AACAC,EAAAA,IAAI,EAAE,cAAI,gBAAJ,CALiB;;AAMvB;AACAC,EAAAA,OAAO,EAAE,cAAI,iBAAJ,CAPc;;AAQvB;AACAC,EAAAA,OAAO,EAAE,cAAI,gBAAJ,CATc;;AAUvB;AACAC,EAAAA,MAAM,EAAE,cAAI,eAAJ;AAXe,CAAxB;;AAcA,SAASC,MAAT,CAAiB;AAAEC,EAAAA;AAAF,CAAjB,EAA8B;AAC7B,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAMC,cAAc,GAAG,+BAAkB,MAAlB,EAA0B,IAA1B,CAAvB;AACA,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA;AAHK,MAIF,uBAAaC,YAAb,CAJJ;AAKA,QAAM;AACLC,IAAAA,IADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,eAJK;AAKLC,IAAAA,kBALK;AAMLC,IAAAA,eANK;AAOLC,IAAA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AAK,EAAC;AAA9B,MAfD,CAbH;AAgCC,IAAA,OAAO,EACN,qDACC,4BAAC,qBAAD,OADD,EAEG,CAAER,IAAI,KAAK,MAAT,IAAmB,CAAEE,oBAAvB,KACD,4BAAC,mBAAD,OAHF,EAKGA,oBAAoB,IAAIF,IAAI,KAAK,QAAjC,IACD,4BAAC,qBAAD;AAAc,MAAA,MAAM,EAAGP;AAAvB,MANF,EAQG,CAAEqB,cAAF,IACD;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,kBAAD;AAAW,MAAA,QAAQ,EAAC;AAApB,MADD,EAEC,4BAAC,kBAAD;AAAW,MAAA,QAAQ,EAAC;AAApB,MAFD,CATF,EAcGpB,gBAAgB,IAAIS,eAApB,IACD,4BAAC,sBAAD,OAfF,CAjCF;AAoDC,IAAA,MAAM,EACL,CAAES,YAAF,IACAC,oBADA,IAEA,CAAEnB,gBAFF,IAGAQ,oBAHA,IAIAF,IAAI,KAAK,QAJT,IAKC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,4BAAD,OADD,CA1DH;AA+DC,IAAA,OAAO,EACN,4BAAC,qBAAD;AACC,MAAA,wBAAwB,EAAGkC,wBAD5B;AAEC,MAAA,yBAAyB,EACxBF,2BAHF;AAKC,MAAA,8BAA8B,EAC7BC;AANF,MAhEF;AA0EC,IAAA,SAAS,EAAG;AACXG,MAAAA,QAAQ,EAAE9B,gBADC;AAEX+B,MAAAA,IAAI,EAAE9B;AAFK;AA1Eb,IATD,EAwFC,4BAAC,0BAAD,OAxFD,EAyFC,4BAAC,yBAAD,OAzFD,EA0FC,4BAAC,kCAAD,OA1FD,EA2FC,4BAAC,qBAAD,OA3FD,EA4FC,4BAAC,mBAAD,CAAS,IAAT,OA5FD,EA6FC,4BAAC,mBAAD,OA7FD,CADD;AAiGA;;eAEcf,M","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorNotices,\n\tEditorKeyboardShortcutsRegister,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { AsyncModeProvider, useSelect, useDispatch } from '@wordpress/data';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { Button, ScrollLock, Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tFullscreenMode,\n\tInterfaceSkeleton,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ManageBlocksModal from '../manage-blocks-modal';\nimport PreferencesModal from '../preferences-modal';\nimport BrowserURL from '../browser-url';\nimport Header from '../header';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport SettingsSidebar from '../sidebar/settings-sidebar';\nimport MetaBoxes from '../meta-boxes';\nimport WelcomeGuide from '../welcome-guide';\nimport ActionsPanel from './actions-panel';\nimport { store as editPostStore } from '../../store';\n\nconst interfaceLabels = {\n\tsecondarySidebar: __( 'Block library' ),\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nfunction Layout( { styles } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tsetIsInserterOpened,\n\t} = useDispatch( editPostStore );\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\tisRichEditingEnabled,\n\t\tsidebarIsOpened,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\thasBlockSelected,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tshowIconLabels,\n\t\thasReducedUI,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t} = useSelect( ( select ) => {\n\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar: select( editPostStore ).isFeatureActive(\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditPostStore.name\n\t\t\t\t) || select( editPostStore ).isPublishSidebarOpened()\n\t\t\t),\n\t\t\tisFullscreenActive: select( editPostStore ).isFeatureActive(\n\t\t\t\t'fullscreenMode'\n\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editPostStore ).isListViewOpened(),\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutRawKeyCombinations(\n\t\t\t\t'core/edit-post/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutRawKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\thasReducedUI: select( editPostStore ).isFeatureActive(\n\t\t\t\t'reducedUI'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst className = classnames( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'is-sidebar-opened': sidebarIsOpened,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t\t'show-icon-labels': showIconLabels,\n\t} );\n\tconst openSidebarPanel = () =>\n\t\topenGeneralSidebar(\n\t\t\thasBlockSelected ? 'edit-post/block' : 'edit-post/document'\n\t\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( sidebarIsOpened && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t}\n\t}, [ sidebarIsOpened, isHugeViewport ] );\n\tuseEffect( () => {\n\t\tif ( isInserterOpened && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isHugeViewport ] );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [\n\t\tentitiesSavedStatesCallback,\n\t\tsetEntitiesSavedStatesCallback,\n\t] = useState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\tconst secondarySidebar = () => {\n\t\tif ( mode === 'visual' && isInserterOpened ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( mode === 'visual' && isListViewOpened ) {\n\t\t\treturn (\n\t\t\t\t<AsyncModeProvider value=\"true\">\n\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t</AsyncModeProvider>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t<BrowserURL />\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<AutosaveMonitor />\n\t\t\t<LocalAutosaveMonitor />\n\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ interfaceLabels }\n\t\t\t\theader={\n\t\t\t\t\t<Header\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\tsidebar={\n\t\t\t\t\t( ! isMobileViewport || sidebarIsOpened ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isMobileViewport && ! sidebarIsOpened && (\n\t\t\t\t\t\t\t\t<div className=\"edit-post-layout__toggle-sidebar-panel\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tisSecondary\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-post-layout__toggle-sidebar-panel-button\"\n\t\t\t\t\t\t\t\t\t\tonClick={ openSidebarPanel }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ hasBlockSelected\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Open block settings' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Open document settings' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t{ ( mode === 'text' || ! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t<TextEditor />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isRichEditingEnabled && mode === 'visual' && (\n\t\t\t\t\t\t\t<VisualEditor styles={ styles } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-layout__metaboxes\">\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isMobileViewport && sidebarIsOpened && (\n\t\t\t\t\t\t\t<ScrollLock />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t! hasReducedUI &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t<div className=\"edit-post-layout__footer\">\n\t\t\t\t\t\t\t<BlockBreadcrumb />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<ActionsPanel\n\t\t\t\t\t\tcloseEntitiesSavedStates={ closeEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tshortcuts={ {\n\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ManageBlocksModal />\n\t\t\t<PreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["interfaceLabels","secondarySidebar","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","editPostStore","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","hasReducedUI","showBlockBreadcrumbs","isTemplateMode","select","editorSettings","editorStore","getEditorSettings","isEditingTemplate","isFeatureActive","interfaceStore","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","keyboardShortcutsStore","getAllShortcutRawKeyCombinations","className","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","previous","next"],"mappings":";;;;;;;;;AA6BA;;AA1BA;;AAKA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjDA;AACA;AACA;;AAGA;AACA;AACA;;AAyBA;AACA;AACA;AAiBA,MAAMA,eAAe,GAAG;AACvBC,EAAAA,gBAAgB,EAAE,cAAI,eAAJ,CADK;;AAEvB;A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CF;AAqDC,IAAA,MAAM,EACL,CAAES,YAAF,IACAC,oBADA,IAEA,CAAEnB,gBAFF,IAGAQ,oBAHA,IAIAF,IAAI,KAAK,QAJT,IAKC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,4BAAD,OADD,CA3DH;AAgEC,IAAA,OAAO,EACN,4BAAC,qBAAD;AACC,MAAA,wBAAwB,EAAGkC,wBAD5B;AAEC,MAAA,yBAAyB,EACxBF,2BAHF;AAKC,MAAA,8BAA8B,EAC7BC;AANF,MAjEF;AA2EC,IAAA,SAAS,EAAG;AACXG,MAAAA,QAAQ,EAAE9B,gBADC;AAEX+B,MAAAA,IAAI,EAAE9B;AAFK;AA3Eb,IATD,EAyFC,4BAAC,0BAAD,OAzFD,EA0FC,4BAAC,yBAAD,OA1FD,EA2FC,4BAAC,kCAAD,OA3FD,EA4FC,4BAAC,qBAAD,OA5FD,EA6FC,4BAAC,mBAAD,CAAS,IAAT,OA7FD,EA8FC,4BAAC,mBAAD,OA9FD,CADD;AAkGA;;eAEcf,M","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorNotices,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { AsyncModeProvider, useSelect, useDispatch } from '@wordpress/data';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { Button, ScrollLock, Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tFullscreenMode,\n\tInterfaceSkeleton,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ManageBlocksModal from '../manage-blocks-modal';\nimport PreferencesModal from '../preferences-modal';\nimport BrowserURL from '../browser-url';\nimport Header from '../header';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport SettingsSidebar from '../sidebar/settings-sidebar';\nimport MetaBoxes from '../meta-boxes';\nimport WelcomeGuide from '../welcome-guide';\nimport ActionsPanel from './actions-panel';\nimport { store as editPostStore } from '../../store';\n\nconst interfaceLabels = {\n\tsecondarySidebar: __( 'Block library' ),\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nfunction Layout( { styles } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tsetIsInserterOpened,\n\t} = useDispatch( editPostStore );\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\tisRichEditingEnabled,\n\t\tsidebarIsOpened,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\thasBlockSelected,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tshowIconLabels,\n\t\thasReducedUI,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t} = useSelect( ( select ) => {\n\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar: select( editPostStore ).isFeatureActive(\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditPostStore.name\n\t\t\t\t) || select( editPostStore ).isPublishSidebarOpened()\n\t\t\t),\n\t\t\tisFullscreenActive: select( editPostStore ).isFeatureActive(\n\t\t\t\t'fullscreenMode'\n\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editPostStore ).isListViewOpened(),\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutRawKeyCombinations(\n\t\t\t\t'core/edit-post/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutRawKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\thasReducedUI: select( editPostStore ).isFeatureActive(\n\t\t\t\t'reducedUI'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst className = classnames( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'is-sidebar-opened': sidebarIsOpened,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t\t'show-icon-labels': showIconLabels,\n\t} );\n\tconst openSidebarPanel = () =>\n\t\topenGeneralSidebar(\n\t\t\thasBlockSelected ? 'edit-post/block' : 'edit-post/document'\n\t\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( sidebarIsOpened && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t}\n\t}, [ sidebarIsOpened, isHugeViewport ] );\n\tuseEffect( () => {\n\t\tif ( isInserterOpened && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isHugeViewport ] );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [\n\t\tentitiesSavedStatesCallback,\n\t\tsetEntitiesSavedStatesCallback,\n\t] = useState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\tconst secondarySidebar = () => {\n\t\tif ( mode === 'visual' && isInserterOpened ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( mode === 'visual' && isListViewOpened ) {\n\t\t\treturn (\n\t\t\t\t<AsyncModeProvider value=\"true\">\n\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t</AsyncModeProvider>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t<BrowserURL />\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<AutosaveMonitor />\n\t\t\t<LocalAutosaveMonitor />\n\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ interfaceLabels }\n\t\t\t\theader={\n\t\t\t\t\t<Header\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\tsidebar={\n\t\t\t\t\t( ! isMobileViewport || sidebarIsOpened ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isMobileViewport && ! sidebarIsOpened && (\n\t\t\t\t\t\t\t\t<div className=\"edit-post-layout__toggle-sidebar-panel\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tisSecondary\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-post-layout__toggle-sidebar-panel-button\"\n\t\t\t\t\t\t\t\t\t\tonClick={ openSidebarPanel }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ hasBlockSelected\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Open block settings' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Open document settings' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t{ ( mode === 'text' || ! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t<TextEditor />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isRichEditingEnabled && mode === 'visual' && (\n\t\t\t\t\t\t\t<VisualEditor styles={ styles } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-layout__metaboxes\">\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isMobileViewport && sidebarIsOpened && (\n\t\t\t\t\t\t\t<ScrollLock />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t! hasReducedUI &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t<div className=\"edit-post-layout__footer\">\n\t\t\t\t\t\t\t<BlockBreadcrumb />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<ActionsPanel\n\t\t\t\t\t\tcloseEntitiesSavedStates={ closeEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tshortcuts={ {\n\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<ManageBlocksModal />\n\t\t\t<PreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = MetaBoxes;
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
@@ -13,6 +13,8 @@ var _lodash = require("lodash");
|
|
|
13
13
|
|
|
14
14
|
var _data = require("@wordpress/data");
|
|
15
15
|
|
|
16
|
+
var _editor = require("@wordpress/editor");
|
|
17
|
+
|
|
16
18
|
var _metaBoxesArea = _interopRequireDefault(require("./meta-boxes-area"));
|
|
17
19
|
|
|
18
20
|
var _metaBoxVisibility = _interopRequireDefault(require("./meta-box-visibility"));
|
|
@@ -31,10 +33,43 @@ var _store = require("../../store");
|
|
|
31
33
|
* Internal dependencies
|
|
32
34
|
*/
|
|
33
35
|
function MetaBoxes({
|
|
34
|
-
location
|
|
35
|
-
isVisible,
|
|
36
|
-
metaBoxes
|
|
36
|
+
location
|
|
37
37
|
}) {
|
|
38
|
+
const registry = (0, _data.useRegistry)();
|
|
39
|
+
const {
|
|
40
|
+
metaBoxes,
|
|
41
|
+
isVisible,
|
|
42
|
+
areMetaBoxesInitialized,
|
|
43
|
+
isEditorReady
|
|
44
|
+
} = (0, _data.useSelect)(select => {
|
|
45
|
+
const {
|
|
46
|
+
__unstableIsEditorReady
|
|
47
|
+
} = select(_editor.store);
|
|
48
|
+
const {
|
|
49
|
+
isMetaBoxLocationVisible,
|
|
50
|
+
getMetaBoxesPerLocation,
|
|
51
|
+
areMetaBoxesInitialized: _areMetaBoxesInitialized
|
|
52
|
+
} = select(_store.store);
|
|
53
|
+
return {
|
|
54
|
+
metaBoxes: getMetaBoxesPerLocation(location),
|
|
55
|
+
isVisible: isMetaBoxLocationVisible(location),
|
|
56
|
+
areMetaBoxesInitialized: _areMetaBoxesInitialized(),
|
|
57
|
+
isEditorReady: __unstableIsEditorReady()
|
|
58
|
+
};
|
|
59
|
+
}, [location]); // When editor is ready, initialize postboxes (wp core script) and metabox
|
|
60
|
+
// saving. This initializes all meta box locations, not just this specific
|
|
61
|
+
// one.
|
|
62
|
+
|
|
63
|
+
(0, _element.useEffect)(() => {
|
|
64
|
+
if (isEditorReady && !areMetaBoxesInitialized) {
|
|
65
|
+
registry.dispatch(_store.store).initializeMetaBoxes();
|
|
66
|
+
}
|
|
67
|
+
}, [isEditorReady, areMetaBoxesInitialized]);
|
|
68
|
+
|
|
69
|
+
if (!areMetaBoxesInitialized) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
38
73
|
return (0, _element.createElement)(_element.Fragment, null, (0, _lodash.map)(metaBoxes, ({
|
|
39
74
|
id
|
|
40
75
|
}) => (0, _element.createElement)(_metaBoxVisibility.default, {
|
|
@@ -44,19 +79,4 @@ function MetaBoxes({
|
|
|
44
79
|
location: location
|
|
45
80
|
}));
|
|
46
81
|
}
|
|
47
|
-
|
|
48
|
-
var _default = (0, _data.withSelect)((select, {
|
|
49
|
-
location
|
|
50
|
-
}) => {
|
|
51
|
-
const {
|
|
52
|
-
isMetaBoxLocationVisible,
|
|
53
|
-
getMetaBoxesPerLocation
|
|
54
|
-
} = select(_store.store);
|
|
55
|
-
return {
|
|
56
|
-
metaBoxes: getMetaBoxesPerLocation(location),
|
|
57
|
-
isVisible: isMetaBoxLocationVisible(location)
|
|
58
|
-
};
|
|
59
|
-
})(MetaBoxes);
|
|
60
|
-
|
|
61
|
-
exports.default = _default;
|
|
62
82
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/meta-boxes/index.js"],"names":["MetaBoxes","location","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/meta-boxes/index.js"],"names":["MetaBoxes","location","registry","metaBoxes","isVisible","areMetaBoxesInitialized","isEditorReady","select","__unstableIsEditorReady","editorStore","isMetaBoxLocationVisible","getMetaBoxesPerLocation","_areMetaBoxesInitialized","editPostStore","dispatch","initializeM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S,IAAI,4BAAC,sBAAD;AAAe,IAAA,QAAQ,EAAGH;AAA1B,IAJhB,CADD;AAQA","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useRegistry } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport MetaBoxesArea from './meta-boxes-area';\nimport MetaBoxVisibility from './meta-box-visibility';\nimport { store as editPostStore } from '../../store';\n\nexport default function MetaBoxes( { location } ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tmetaBoxes,\n\t\tisVisible,\n\t\tareMetaBoxesInitialized,\n\t\tisEditorReady,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __unstableIsEditorReady } = select( editorStore );\n\t\t\tconst {\n\t\t\t\tisMetaBoxLocationVisible,\n\t\t\t\tgetMetaBoxesPerLocation,\n\t\t\t\tareMetaBoxesInitialized: _areMetaBoxesInitialized,\n\t\t\t} = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tmetaBoxes: getMetaBoxesPerLocation( location ),\n\t\t\t\tisVisible: isMetaBoxLocationVisible( location ),\n\t\t\t\tareMetaBoxesInitialized: _areMetaBoxesInitialized(),\n\t\t\t\tisEditorReady: __unstableIsEditorReady(),\n\t\t\t};\n\t\t},\n\t\t[ location ]\n\t);\n\n\t// When editor is ready, initialize postboxes (wp core script) and metabox\n\t// saving. This initializes all meta box locations, not just this specific\n\t// one.\n\tuseEffect( () => {\n\t\tif ( isEditorReady && ! areMetaBoxesInitialized ) {\n\t\t\tregistry.dispatch( editPostStore ).initializeMetaBoxes();\n\t\t}\n\t}, [ isEditorReady, areMetaBoxesInitialized ] );\n\n\tif ( ! areMetaBoxesInitialized ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ map( metaBoxes, ( { id } ) => (\n\t\t\t\t<MetaBoxVisibility key={ id } id={ id } />\n\t\t\t) ) }\n\t\t\t{ isVisible && <MetaBoxesArea location={ location } /> }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -54,13 +54,14 @@ function MaybeIframe({
|
|
|
54
54
|
if (!isTemplateMode) {
|
|
55
55
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.__unstableEditorStyles, {
|
|
56
56
|
styles: styles
|
|
57
|
-
}), (0, _element.createElement)(
|
|
57
|
+
}), (0, _element.createElement)(_blockEditor.WritingFlow, {
|
|
58
58
|
ref: contentRef,
|
|
59
59
|
className: "editor-styles-wrapper",
|
|
60
60
|
style: {
|
|
61
61
|
flex: '1',
|
|
62
62
|
...style
|
|
63
|
-
}
|
|
63
|
+
},
|
|
64
|
+
tabIndex: -1
|
|
64
65
|
}, children));
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -75,7 +76,7 @@ function MaybeIframe({
|
|
|
75
76
|
height: '100%',
|
|
76
77
|
display: 'block'
|
|
77
78
|
}
|
|
78
|
-
}, children);
|
|
79
|
+
}, (0, _element.createElement)(_blockEditor.WritingFlow, null, children));
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
function VisualEditor({
|
|
@@ -214,11 +215,11 @@ function VisualEditor({
|
|
|
214
215
|
}, themeSupportsLayout && !isTemplateMode && (0, _element.createElement)(_blockEditor.__experimentalLayoutStyle, {
|
|
215
216
|
selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
|
|
216
217
|
layout: defaultLayout
|
|
217
|
-
}),
|
|
218
|
+
}), !isTemplateMode && (0, _element.createElement)("div", {
|
|
218
219
|
className: "edit-post-visual-editor__post-title-wrapper"
|
|
219
220
|
}, (0, _element.createElement)(_editor.PostTitle, null)), (0, _element.createElement)(RecursionProvider, null, (0, _element.createElement)(_blockEditor.BlockList, {
|
|
220
221
|
__experimentalLayout: layout
|
|
221
|
-
}))))))
|
|
222
|
+
})))))), (0, _element.createElement)(_blockEditor.__unstableBlockSettingsMenuFirstItem, null, ({
|
|
222
223
|
onClose
|
|
223
224
|
}) => (0, _element.createElement)(_blockInspectorButton.default, {
|
|
224
225
|
onClick: onClose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["MaybeIframe","children","contentRef","isTemplateMode","styles","style","ref","flex","width","height","display","VisualEditor","deviceType","wrapperBlockName","wrapperUniqueId","select","isEditingTemplate","__experimentalGetPreviewDeviceType","editPostStore","getCurrentPostId","getCurrentPostType","editorStore","_isTemplateMode","_wrapperBlockName","hasMetaBoxes","themeSupportsLayout","getSettings","blockEditorStore","supportsLayout","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","defaultLayout","contentSize","wideSize","animatedStyles","paddingBottom","blockSelectionClearerRef","RecursionProvider","layout","type","alignments","undefined","padding","arrowLeft","onClose"],"mappings":";;;;;;;;;AAiCA;;AA9BA;;AACA;;AAKA;;AAKA;;AAoBA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA5CA;AACA;AACA;;AAIA;AACA;AACA;;AAgCA;AACA;AACA;AAIA,SAASA,WAAT,CAAsB;AACrBC,EAAAA,QADqB;AAErBC,EAAAA,UAFqB;AAGrBC,EAAAA,cAHqB;AAIrBC,EAAAA,MAJqB;AAKrBC,EAAAA;AALqB,CAAtB,EAMI;AACH,QAAMC,GAAG,GAAG,qDAAZ;;AAEA,MAAK,CAAEH,cAAP,EAAwB;AACvB,WACC,qDACC,4BAAC,mCAAD;AAAc,MAAA,MAAM,EAAGC;AAAvB,MADD,EAEC;AACC,MAAA,GAAG,EAAGF,UADP;AAEC,MAAA,SAAS,EAAC,uBAFX;AAGC,MAAA,KAAK,EAAG;AAAEK,QAAAA,IAAI,EAAE,GAAR;AAAa,WAAGF;AAAhB;AAHT,OAKGJ,QALH,CAFD,CADD;AAYA;;AAED,SACC,4BAAC,6BAAD;AACC,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fvB,MAAAA,kBAAkB;AAClBC,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AANF,KAQG,cAAI,MAAJ,CARH,CARF,EAmBC,4BAAC,oBAAD,CAAQ,GAAR;AACC,IAAA,OAAO,EAAGa,cADX;AAEC,IAAA,OAAO,EAAGZ;AAFX,KAIC,4BAAC,WAAD;AACC,IAAA,cAAc,EAAG5B,cADlB;AAEC,IAAA,UAAU,EAAGD,UAFd;AAGC,IAAA,MAAM,EAAGE,MAHV;AAIC,IAAA,KAAK,EAAG;AAAEwC,MAAAA;AAAF;AAJT,KAMGnB,mBAAmB,IAAI,CAAEtB,cAAzB,IACD,4BAAC,sCAAD;AACC,IAAA,QAAQ,EAAC,kGADV;AAEC,IAAA,MAAM,EAAGqC;AAFV,IAPF,EAYC,4BAAC,wBAAD,QACG,CAAErC,cAAF,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,iBAAD,OADD,CAFF,EAMC,4BAAC,iBAAD,QACC,4BAAC,sBAAD;AACC,IAAA,oBAAoB,EAAG4C;AADxB,IADD,CAND,CAZD,CAJD,CAnBD,CADD,CAND,EA0DC,4BAAC,iDAAD,QACG,CAAE;AAAEM,IAAAA;AAAF,GAAF,KACD,4BAAC,6BAAD;AAAsB,IAAA,OAAO,EAAGA;AAAhC,IAFF,CA1DD,CADD;AAkEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { motion } from 'framer-motion';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableUseCanvasClickRedirect as useCanvasClickRedirect,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n} from '@wordpress/block-editor';\nimport { useRef, useMemo } from '@wordpress/element';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( {\n\tchildren,\n\tcontentRef,\n\tisTemplateMode,\n\tstyles,\n\tstyle,\n} ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! isTemplateMode ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<div\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisTemplateMode,\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst defaultLayout = useSetting( 'layout' );\n\tconst { contentSize, wideSize } = defaultLayout || {};\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseCanvasClickRedirect(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\tconst [ , RecursionProvider ] = useNoRecursiveRenders(\n\t\twrapperUniqueId,\n\t\twrapperBlockName\n\t);\n\n\tconst layout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\tconst alignments =\n\t\t\t\tcontentSize || wideSize\n\t\t\t\t\t? [ 'wide', 'full', 'left', 'center', 'right' ]\n\t\t\t\t\t: [ 'left', 'center', 'right' ];\n\t\t\treturn {\n\t\t\t\ttype: 'default',\n\t\t\t\t// Find a way to inject this in the support flag code (hooks).\n\t\t\t\talignments,\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t}, [ isTemplateMode, themeSupportsLayout, contentSize, wideSize ] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<BlockTools __unstableContentRef={ ref }>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\t\tanimate={ {\n\t\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t\t} }\n\t\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t\t>\n\t\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\t\tisTemplateMode={ isTemplateMode }\n\t\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\t\tstyle={ { paddingBottom } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ themeSupportsLayout && ! isTemplateMode && (\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\tlayout={ defaultLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t\t\t<div className=\"edit-post-visual-editor__post-title-wrapper\">\n\t\t\t\t\t\t\t\t\t\t<PostTitle />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<RecursionProvider>\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\t__experimentalLayout={ layout }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t\t\t</WritingFlow>\n\t\t\t\t\t\t</MaybeIframe>\n\t\t\t\t\t</motion.div>\n\t\t\t\t</motion.div>\n\t\t\t</BlockTools>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</div>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["MaybeIframe","children","contentRef","isTemplateMode","styles","style","ref","flex","width","height","display","VisualEditor","deviceType","wrapperBlockName","wrapperUniqueId","select","isEditingTemplate","__experimentalGetPreviewDeviceType","editPostStore","getCurrentPostId","getCurrentPostType","editorStore","_isTemplateMode","_wrapperBlockName","hasMetaBoxes","themeSupportsLayout","getSettings","blockEditorStore","supportsLayout","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","defaultLayout","contentSize","wideSize","animatedStyles","paddingBottom","blockSelectionClearerRef","RecursionProvider","layout","type","alignments","undefined","padding","arrowLeft","onClose"],"mappings":";;;;;;;;;AAiCA;;AA9BA;;AACA;;AAKA;;AAKA;;AAoBA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA5CA;AACA;AACA;;AAIA;AACA;AACA;;AAgCA;AACA;AACA;AAIA,SAASA,WAAT,CAAsB;AACrBC,EAAAA,QADqB;AAErBC,EAAAA,UAFqB;AAGrBC,EAAAA,cAHqB;AAIrBC,EAAAA,MAJqB;AAKrBC,EAAAA;AALqB,CAAtB,EAMI;AACH,QAAMC,GAAG,GAAG,qDAAZ;;AAEA,MAAK,CAAEH,cAAP,EAAwB;AACvB,WACC,qDACC,4BAAC,mCAAD;AAAc,MAAA,MAAM,EAAGC;AAAvB,MADD,EAEC,4BAAC,wBAAD;AACC,MAAA,GAAG,EAAGF,UADP;AAEC,MAAA,SAAS,EAAC,uBAFX;A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EAAEhD,cAAc,GAAG,aAAH,GAAmB;AADjC,KAFX;AAKC,IAAA,GAAG,EAAG0C;AALP,KAOG1C,cAAc,IACf,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,IAAI,EAAGiD,gBAFR;AAGC,IAAA,OAAO,EAAG,MAAM;AACfvB,MAAAA,kBAAkB;AAClBC,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AANF,KAQG,cAAI,MAAJ,CARH,CARF,EAmBC,4BAAC,oBAAD,CAAQ,GAAR;AACC,IAAA,OAAO,EAAGa,cADX;AAEC,IAAA,OAAO,EAAGZ;AAFX,KAIC,4BAAC,WAAD;AACC,IAAA,cAAc,EAAG5B,cADlB;AAEC,IAAA,UAAU,EAAGD,UAFd;AAGC,IAAA,MAAM,EAAGE,MAHV;AAIC,IAAA,KAAK,EAAG;AAAEwC,MAAAA;AAAF;AAJT,KAMGnB,mBAAmB,IAAI,CAAEtB,cAAzB,IACD,4BAAC,sCAAD;AACC,IAAA,QAAQ,EAAC,kGADV;AAEC,IAAA,MAAM,EAAGqC;AAFV,IAPF,EAYG,CAAErC,cAAF,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,iBAAD,OADD,CAbF,EAiBC,4BAAC,iBAAD,QACC,4BAAC,sBAAD;AAAW,IAAA,oBAAoB,EAAG4C;AAAlC,IADD,CAjBD,CAJD,CAnBD,CADD,CAND,EAsDC,4BAAC,iDAAD,QACG,CAAE;AAAEM,IAAAA;AAAF,GAAF,KACD,4BAAC,6BAAD;AAAsB,IAAA,OAAO,EAAGA;AAAhC,IAFF,CAtDD,CADD;AA8DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { motion } from 'framer-motion';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableUseCanvasClickRedirect as useCanvasClickRedirect,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n} from '@wordpress/block-editor';\nimport { useRef, useMemo } from '@wordpress/element';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( {\n\tchildren,\n\tcontentRef,\n\tisTemplateMode,\n\tstyles,\n\tstyle,\n} ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! isTemplateMode ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t>\n\t\t\t<WritingFlow>{ children }</WritingFlow>\n\t\t</Iframe>\n\t);\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisTemplateMode,\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst defaultLayout = useSetting( 'layout' );\n\tconst { contentSize, wideSize } = defaultLayout || {};\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseCanvasClickRedirect(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\tconst [ , RecursionProvider ] = useNoRecursiveRenders(\n\t\twrapperUniqueId,\n\t\twrapperBlockName\n\t);\n\n\tconst layout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\tconst alignments =\n\t\t\t\tcontentSize || wideSize\n\t\t\t\t\t? [ 'wide', 'full', 'left', 'center', 'right' ]\n\t\t\t\t\t: [ 'left', 'center', 'right' ];\n\t\t\treturn {\n\t\t\t\ttype: 'default',\n\t\t\t\t// Find a way to inject this in the support flag code (hooks).\n\t\t\t\talignments,\n\t\t\t};\n\t\t}\n\t\treturn undefined;\n\t}, [ isTemplateMode, themeSupportsLayout, contentSize, wideSize ] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<BlockTools __unstableContentRef={ ref }>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\t\tanimate={ {\n\t\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t\t} }\n\t\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t\t>\n\t\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\t\tisTemplateMode={ isTemplateMode }\n\t\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\t\tstyle={ { paddingBottom } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ themeSupportsLayout && ! isTemplateMode && (\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\tlayout={ defaultLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t\t<div className=\"edit-post-visual-editor__post-title-wrapper\">\n\t\t\t\t\t\t\t\t\t<PostTitle />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<RecursionProvider>\n\t\t\t\t\t\t\t\t<BlockList __experimentalLayout={ layout } />\n\t\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t\t</MaybeIframe>\n\t\t\t\t\t</motion.div>\n\t\t\t\t</motion.div>\n\t\t\t</BlockTools>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</div>\n\t);\n}\n"]}
|