@wordpress/edit-post 7.15.0 → 7.16.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/header/{document-title → document-actions}/index.js +10 -11
- package/build/components/header/document-actions/index.js.map +1 -0
- package/build/components/header/header-toolbar/index.native.js +2 -1
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +3 -3
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +23 -4
- package/build/components/header/mode-switcher/index.js.map +1 -1
- package/build/components/layout/index.js +38 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +2 -2
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/discussion-panel/index.js +20 -20
- package/build/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build/editor.js +2 -39
- package/build/editor.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +61 -4
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build-module/components/header/{document-title → document-actions}/index.js +10 -11
- package/build-module/components/header/document-actions/index.js.map +1 -0
- package/build-module/components/header/header-toolbar/index.native.js +2 -1
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +3 -3
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +23 -4
- package/build-module/components/header/mode-switcher/index.js.map +1 -1
- package/build-module/components/layout/index.js +38 -6
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +3 -3
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/discussion-panel/index.js +21 -19
- package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
- package/build-module/editor.js +2 -38
- package/build-module/editor.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +60 -5
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +21 -18
- package/build-style/style.css +21 -18
- package/package.json +32 -32
- package/src/components/header/{document-title → document-actions}/index.js +22 -23
- package/src/components/header/{document-title → document-actions}/style.scss +25 -22
- package/src/components/header/header-toolbar/index.native.js +1 -0
- package/src/components/header/header-toolbar/style.scss +4 -0
- package/src/components/header/index.js +3 -3
- package/src/components/header/mode-switcher/index.js +23 -4
- package/src/components/header/style.scss +1 -1
- package/src/components/layout/index.js +47 -2
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +5 -2
- package/src/components/preferences-modal/test/index.js +4 -4
- package/src/components/secondary-sidebar/list-view-sidebar.js +3 -3
- package/src/components/sidebar/discussion-panel/index.js +15 -20
- package/src/editor.js +2 -47
- package/src/hooks/commands/use-common-commands.js +81 -15
- package/src/index.js +5 -1
- package/src/style.scss +1 -1
- package/src/test/editor.native.js +4 -3
- package/build/components/header/document-title/index.js.map +0 -1
- package/build-module/components/header/document-title/index.js.map +0 -1
|
@@ -49,12 +49,31 @@ function ModeSwitcher() {
|
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
let selectedMode = mode;
|
|
53
|
+
|
|
54
|
+
if (!isRichEditingEnabled && mode === 'visual') {
|
|
55
|
+
selectedMode = 'text';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!isCodeEditingEnabled && mode === 'text') {
|
|
59
|
+
selectedMode = 'visual';
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
const choices = MODES.map(choice => {
|
|
57
|
-
if (choice.value
|
|
63
|
+
if (!isCodeEditingEnabled && choice.value === 'text') {
|
|
64
|
+
choice = { ...choice,
|
|
65
|
+
disabled: true
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (!isRichEditingEnabled && choice.value === 'visual') {
|
|
70
|
+
choice = { ...choice,
|
|
71
|
+
disabled: true,
|
|
72
|
+
info: __('You can enable the visual editor in your profile settings.')
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (choice.value !== selectedMode && !choice.disabled) {
|
|
58
77
|
return { ...choice,
|
|
59
78
|
shortcut
|
|
60
79
|
};
|
|
@@ -66,7 +85,7 @@ function ModeSwitcher() {
|
|
|
66
85
|
label: __('Editor')
|
|
67
86
|
}, createElement(MenuItemsChoice, {
|
|
68
87
|
choices: choices,
|
|
69
|
-
value:
|
|
88
|
+
value: selectedMode,
|
|
70
89
|
onSelect: switchEditorMode
|
|
71
90
|
}));
|
|
72
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/mode-switcher/index.js"],"names":["__","MenuItemsChoice","MenuGroup","useSelect","useDispatch","store","keyboardShortcutsStore","editorStore","editPostStore","MODES","value","label","ModeSwitcher","shortcut","isRichEditingEnabled","isCodeEditingEnabled","isEditingTemplate","mode","select","getShortcutRepresentation","getEditorSettings","richEditingEnabled","codeEditingEnabled","getEditorMode","switchEditorMode","choices","map","choice"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,EAA0BC,SAA1B,QAA2C,uBAA3C;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,gBAAvC;AAEA;AACA;AACA;AACA;AACA;;AACA,MAAMC,KAAK,GAAG,CACb;AACCC,EAAAA,KAAK,EAAE,QADR;AAECC,EAAAA,KAAK,EAAEX,EAAE,CAAE,eAAF;AAFV,CADa,EAKb;AACCU,EAAAA,KAAK,EAAE,MADR;AAECC,EAAAA,KAAK,EAAEX,EAAE,CAAE,aAAF;AAFV,CALa,CAAd;;AAWA,SAASY,YAAT,GAAwB;AACvB,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,iBAJK;AAKLC,IAAAA;AALK,MAMFd,SAAS,CACVe,MAAF,KAAgB;AACfL,IAAAA,QAAQ,EAAEK,MAAM,CACfZ,sBADe,CAAN,CAERa,yBAFQ,CAEmB,4BAFnB,CADK;AAIfL,IAAAA,oBAAoB,EACnBI,MAAM,CAAEX,WAAF,CAAN,CAAsBa,iBAAtB,GAA0CC,kBAL5B;AAMfN,IAAAA,oBAAoB,EACnBG,MAAM,CAAEX,WAAF,CAAN,CAAsBa,iBAAtB,GAA0CE,kBAP5B;AAQfN,IAAAA,iBAAiB,EAAEE,MAAM,CAAEV,aAAF,CAAN,CAAwBQ,iBAAxB,EARJ;AASfC,IAAAA,IAAI,EAAEC,MAAM,CAAEV,aAAF,CAAN,CAAwBe,aAAxB;AATS,GAAhB,CADY,EAYZ,EAZY,CANb;AAoBA,QAAM;AAAEC,IAAAA;AAAF,MAAuBpB,WAAW,CAAEI,aAAF,CAAxC;;AAEA,MAAKQ,iBAAL,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,MAAK,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/mode-switcher/index.js"],"names":["__","MenuItemsChoice","MenuGroup","useSelect","useDispatch","store","keyboardShortcutsStore","editorStore","editPostStore","MODES","value","label","ModeSwitcher","shortcut","isRichEditingEnabled","isCodeEditingEnabled","isEditingTemplate","mode","select","getShortcutRepresentation","getEditorSettings","richEditingEnabled","codeEditingEnabled","getEditorMode","switchEditorMode","selectedMode","choices","map","choice","disabled","info"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,EAA0BC,SAA1B,QAA2C,uBAA3C;AACA,SAAS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AF,IAA0BG,IAAI,KAAK,QAAxC,EAAmD;AAClDQ,IAAAA,YAAY,GAAG,MAAf;AACA;;AACD,MAAK,CAAEV,oBAAF,IAA0BE,IAAI,KAAK,MAAxC,EAAiD;AAChDQ,IAAAA,YAAY,GAAG,QAAf;AACA;;AAED,QAAMC,OAAO,GAAGjB,KAAK,CAACkB,GAAN,CAAaC,MAAF,IAAc;AACxC,QAAK,CAAEb,oBAAF,IAA0Ba,MAAM,CAAClB,KAAP,KAAiB,MAAhD,EAAyD;AACxDkB,MAAAA,MAAM,GAAG,EACR,GAAGA,MADK;AAERC,QAAAA,QAAQ,EAAE;AAFF,OAAT;AAIA;;AACD,QAAK,CAAEf,oBAAF,IAA0Bc,MAAM,CAAClB,KAAP,KAAiB,QAAhD,EAA2D;AAC1DkB,MAAAA,MAAM,GAAG,EACR,GAAGA,MADK;AAERC,QAAAA,QAAQ,EAAE,IAFF;AAGRC,QAAAA,IAAI,EAAE9B,EAAE,CACP,4DADO;AAHA,OAAT;AAOA;;AACD,QAAK4B,MAAM,CAAClB,KAAP,KAAiBe,YAAjB,IAAiC,CAAEG,MAAM,CAACC,QAA/C,EAA0D;AACzD,aAAO,EAAE,GAAGD,MAAL;AAAaf,QAAAA;AAAb,OAAP;AACA;;AACD,WAAOe,MAAP;AACA,GApBe,CAAhB;AAsBA,SACC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAG5B,EAAE,CAAE,QAAF;AAArB,KACC,cAAC,eAAD;AACC,IAAA,OAAO,EAAG0B,OADX;AAEC,IAAA,KAAK,EAAGD,YAFT;AAGC,IAAA,QAAQ,EAAGD;AAHZ,IADD,CADD;AASA;;AAED,eAAeZ,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItemsChoice, MenuGroup } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Set of available mode options.\n *\n * @type {Array}\n */\nconst MODES = [\n\t{\n\t\tvalue: 'visual',\n\t\tlabel: __( 'Visual editor' ),\n\t},\n\t{\n\t\tvalue: 'text',\n\t\tlabel: __( 'Code editor' ),\n\t},\n];\n\nfunction ModeSwitcher() {\n\tconst {\n\t\tshortcut,\n\t\tisRichEditingEnabled,\n\t\tisCodeEditingEnabled,\n\t\tisEditingTemplate,\n\t\tmode,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/edit-post/toggle-mode' ),\n\t\t\tisRichEditingEnabled:\n\t\t\t\tselect( editorStore ).getEditorSettings().richEditingEnabled,\n\t\t\tisCodeEditingEnabled:\n\t\t\t\tselect( editorStore ).getEditorSettings().codeEditingEnabled,\n\t\t\tisEditingTemplate: select( editPostStore ).isEditingTemplate(),\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { switchEditorMode } = useDispatch( editPostStore );\n\n\tif ( isEditingTemplate ) {\n\t\treturn null;\n\t}\n\n\tlet selectedMode = mode;\n\tif ( ! isRichEditingEnabled && mode === 'visual' ) {\n\t\tselectedMode = 'text';\n\t}\n\tif ( ! isCodeEditingEnabled && mode === 'text' ) {\n\t\tselectedMode = 'visual';\n\t}\n\n\tconst choices = MODES.map( ( choice ) => {\n\t\tif ( ! isCodeEditingEnabled && choice.value === 'text' ) {\n\t\t\tchoice = {\n\t\t\t\t...choice,\n\t\t\t\tdisabled: true,\n\t\t\t};\n\t\t}\n\t\tif ( ! isRichEditingEnabled && choice.value === 'visual' ) {\n\t\t\tchoice = {\n\t\t\t\t...choice,\n\t\t\t\tdisabled: true,\n\t\t\t\tinfo: __(\n\t\t\t\t\t'You can enable the visual editor in your profile settings.'\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\tif ( choice.value !== selectedMode && ! choice.disabled ) {\n\t\t\treturn { ...choice, shortcut };\n\t\t}\n\t\treturn choice;\n\t} );\n\n\treturn (\n\t\t<MenuGroup label={ __( 'Editor' ) }>\n\t\t\t<MenuItemsChoice\n\t\t\t\tchoices={ choices }\n\t\t\t\tvalue={ selectedMode }\n\t\t\t\tonSelect={ switchEditorMode }\n\t\t\t/>\n\t\t</MenuGroup>\n\t);\n}\n\nexport default ModeSwitcher;\n"]}
|
|
@@ -10,7 +10,7 @@ import classnames from 'classnames';
|
|
|
10
10
|
|
|
11
11
|
import { AutosaveMonitor, LocalAutosaveMonitor, UnsavedChangesWarning, EditorNotices, EditorKeyboardShortcutsRegister, EditorKeyboardShortcuts, EditorSnackbars, PostSyncStatusModal, store as editorStore } from '@wordpress/editor';
|
|
12
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
|
-
import { BlockBreadcrumb } from '@wordpress/block-editor';
|
|
13
|
+
import { BlockBreadcrumb, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
14
14
|
import { Button, ScrollLock, Popover } from '@wordpress/components';
|
|
15
15
|
import { useViewportMatch } from '@wordpress/compose';
|
|
16
16
|
import { PluginArea } from '@wordpress/plugins';
|
|
@@ -38,6 +38,10 @@ import WelcomeGuide from '../welcome-guide';
|
|
|
38
38
|
import ActionsPanel from './actions-panel';
|
|
39
39
|
import StartPageOptions from '../start-page-options';
|
|
40
40
|
import { store as editPostStore } from '../../store';
|
|
41
|
+
import { unlock } from '../../lock-unlock';
|
|
42
|
+
const {
|
|
43
|
+
getLayoutStyles
|
|
44
|
+
} = unlock(blockEditorPrivateApis);
|
|
41
45
|
const interfaceLabels = {
|
|
42
46
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
43
47
|
header: __('Editor top bar'),
|
|
@@ -55,9 +59,7 @@ const interfaceLabels = {
|
|
|
55
59
|
footer: __('Editor footer')
|
|
56
60
|
};
|
|
57
61
|
|
|
58
|
-
function Layout({
|
|
59
|
-
styles
|
|
60
|
-
}) {
|
|
62
|
+
function Layout() {
|
|
61
63
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
62
64
|
const isHugeViewport = useViewportMatch('huge', '>=');
|
|
63
65
|
const isLargeViewport = useViewportMatch('large');
|
|
@@ -85,14 +87,43 @@ function Layout({
|
|
|
85
87
|
isDistractionFree,
|
|
86
88
|
showBlockBreadcrumbs,
|
|
87
89
|
isTemplateMode,
|
|
88
|
-
documentLabel
|
|
90
|
+
documentLabel,
|
|
91
|
+
styles
|
|
89
92
|
} = useSelect(select => {
|
|
90
93
|
const {
|
|
91
94
|
getEditorSettings,
|
|
92
95
|
getPostTypeLabel
|
|
93
96
|
} = select(editorStore);
|
|
97
|
+
const {
|
|
98
|
+
isFeatureActive
|
|
99
|
+
} = select(editPostStore);
|
|
94
100
|
const editorSettings = getEditorSettings();
|
|
95
101
|
const postTypeLabel = getPostTypeLabel();
|
|
102
|
+
const hasThemeStyles = isFeatureActive('themeStyles');
|
|
103
|
+
const themeStyles = [];
|
|
104
|
+
const presetStyles = [];
|
|
105
|
+
editorSettings.styles?.forEach(style => {
|
|
106
|
+
if (!style.__unstableType || style.__unstableType === 'theme') {
|
|
107
|
+
themeStyles.push(style);
|
|
108
|
+
} else {
|
|
109
|
+
presetStyles.push(style);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const defaultEditorStyles = [...editorSettings.defaultEditorStyles, ...presetStyles]; // If theme styles are not present or displayed, ensure that
|
|
113
|
+
// base layout styles are still present in the editor.
|
|
114
|
+
|
|
115
|
+
if (!editorSettings.disableLayoutStyles && !(hasThemeStyles && themeStyles.length)) {
|
|
116
|
+
defaultEditorStyles.push({
|
|
117
|
+
css: getLayoutStyles({
|
|
118
|
+
style: {},
|
|
119
|
+
selector: 'body',
|
|
120
|
+
hasBlockGapSupport: false,
|
|
121
|
+
hasFallbackGapSupport: true,
|
|
122
|
+
fallbackGapValue: '0.5em'
|
|
123
|
+
})
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
96
127
|
return {
|
|
97
128
|
isTemplateMode: select(editPostStore).isEditingTemplate(),
|
|
98
129
|
hasFixedToolbar: select(editPostStore).isFeatureActive('fixedToolbar'),
|
|
@@ -109,7 +140,8 @@ function Layout({
|
|
|
109
140
|
isDistractionFree: select(editPostStore).isFeatureActive('distractionFree'),
|
|
110
141
|
showBlockBreadcrumbs: select(editPostStore).isFeatureActive('showBlockBreadcrumbs'),
|
|
111
142
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
112
|
-
documentLabel: postTypeLabel || _x('Document', 'noun')
|
|
143
|
+
documentLabel: postTypeLabel || _x('Document', 'noun'),
|
|
144
|
+
styles: hasThemeStyles && themeStyles.length ? editorSettings.styles : defaultEditorStyles
|
|
113
145
|
};
|
|
114
146
|
}, []);
|
|
115
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["classnames","AutosaveMonitor","LocalAutosaveMonitor","UnsavedChangesWarning","EditorNotices","EditorKeyboardShortcutsRegister","EditorKeyboardShortcuts","EditorSnackbars","PostSyncStatusModal","store","editorStore","useSelect","useDispatch","BlockBreadcrumb","Button","ScrollLock","Popover","useViewportMatch","PluginArea","__","_x","sprintf","ComplementaryArea","FullscreenMode","InterfaceSkeleton","interfaceStore","useState","useEffect","useCallback","keyboardShortcutsStore","noticesStore","TextEditor","VisualEditor","EditPostKeyboardShortcuts","KeyboardShortcutHelpModal","EditPostPreferencesModal","BrowserURL","Header","InserterSidebar","ListViewSidebar","SettingsSidebar","MetaBoxes","WelcomeGuide","ActionsPanel","StartPageOptions","editPostStore","interfaceLabels","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","isLargeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","createErrorNotice","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","isDistractionFree","showBlockBreadcrumbs","isTemplateMode","documentLabel","select","getEditorSettings","getPostTypeLabel","editorSettings","postTypeLabel","isEditingTemplate","isFeatureActive","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","getAllShortcutKeyCombinations","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","className","secondarySidebarLabel","secondarySidebar","onPluginAreaError","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,oBAFD,EAGCC,qBAHD,EAICC,aAJD,EAKCC,+BALD,EAMCC,uBAND,EAOCC,eAPD,EAQCC,mBARD,EASCC,KAAK,IAAIC,WATV,QAUO,mBAVP;AAWA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,eAAT,QAAgC,yBAAhC;AACA,SAASC,MAAT,EAAiBC,UAAjB,EAA6BC,OAA7B,QAA4C,uBAA5C;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SACCC,iBADD,EAECC,cAFD,EAGCC,iBAHD,EAICf,KAAK,IAAIgB,cAJV,QAKO,sBALP;AAMA,SAASC,QAAT,EAAmBC,SAAnB,EAA8BC,WAA9B,QAAiD,oBAAjD;AACA,SAASnB,KAAK,IAAIoB,sBAAlB,QAAgD,+BAAhD;AACA,SAASpB,KAAK,IAAIqB,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,yBAAP,MAAsC,uBAAtC;AACA,OAAOC,yBAAP,MAAsC,iCAA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,OACC,cAAC,SAAD;AAAW,MAAA,QAAQ,EAAC;AAApB,MADD,EAEC,cAAC,SAAD;AAAW,MAAA,QAAQ,EAAC;AAApB,MAFD,CATF,EAcGrB,gBAAgB,IAAIU,eAApB,IACD,cAAC,UAAD,OAfF,CAvCF;AA0DC,IAAA,MAAM,EACL,CAAES,iBAAF,IACA,CAAEnB,gBADF,IAEAoB,oBAFA,IAGAX,oBAHA,IAIAF,IAAI,KAAK,QAJT,IAKC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,eAAD;AAAiB,MAAA,aAAa,EAAGe;AAAjC,MADD,CAhEH;AAqEC,IAAA,OAAO,EACN,cAAC,YAAD;AACC,MAAA,wBAAwB,EAAGkB,wBAD5B;AAEC,MAAA,yBAAyB,EACxBF,2BAHF;AAKC,MAAA,8BAA8B,EAC7BC;AANF,MAtEF;AAgFC,IAAA,SAAS,EAAG;AACXO,MAAAA,QAAQ,EAAEjC,gBADC;AAEXkC,MAAAA,IAAI,EAAEjC;AAFK;AAhFb,IAVD,EA+FC,cAAC,wBAAD,OA/FD,EAgGC,cAAC,yBAAD,OAhGD,EAiGC,cAAC,YAAD,OAjGD,EAkGC,cAAC,mBAAD,OAlGD,EAmGC,cAAC,gBAAD,OAnGD,EAoGC,cAAC,OAAD,CAAS,IAAT,OApGD,EAqGC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAG+B;AAAtB,IArGD,CADD;AAyGA;;AAED,eAAe/C,MAAf","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\tEditorKeyboardShortcuts,\n\tEditorSnackbars,\n\tPostSyncStatusModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { 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 { __, _x, sprintf } 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';\nimport { store as noticesStore } from '@wordpress/notices';\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 EditPostPreferencesModal 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 StartPageOptions from '../start-page-options';\nimport { store as editPostStore } from '../../store';\n\nconst interfaceLabels = {\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 isLargeViewport = useViewportMatch( 'large' );\n\tconst { openGeneralSidebar, closeGeneralSidebar, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\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\tisDistractionFree,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t\tdocumentLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fixedToolbar' ),\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:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fullscreenMode' ),\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).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\tisDistractionFree:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'distractionFree' ),\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t};\n\t}, [] );\n\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 [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( 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 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\t'is-distraction-free': isDistractionFree && isLargeViewport,\n\t\t'is-entity-save-view-open': !! entitiesSavedStatesCallback,\n\t} );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\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 <ListViewSidebar />;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\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<EditorKeyboardShortcuts />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tisDistractionFree={ isDistractionFree && isLargeViewport }\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ {\n\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t} }\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\teditorNotices={ <EditorNotices /> }\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\tvariant=\"secondary\"\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{ ! isDistractionFree && <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{ ! isDistractionFree && ! 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! isDistractionFree &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\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 rootLabelText={ documentLabel } />\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<EditPostPreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<PostSyncStatusModal />\n\t\t\t<StartPageOptions />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["classnames","AutosaveMonitor","LocalAutosaveMonitor","UnsavedChangesWarning","EditorNotices","EditorKeyboardShortcutsRegister","EditorKeyboardShortcuts","EditorSnackbars","PostSyncStatusModal","store","editorStore","useSelect","useDispatch","BlockBreadcrumb","privateApis","blockEditorPrivateApis","Button","ScrollLock","Popover","useViewportMatch","PluginArea","__","_x","sprintf","ComplementaryArea","FullscreenMode","InterfaceSkeleton","interfaceStore","useState","useEffect","useCallback","keyboardShortcutsStore","noticesStore","TextEditor","VisualEditor","EditPostKeyboardShortcuts","KeyboardShortcutHelpModal","EditPostPreferencesModal","BrowserURL","Header","InserterSidebar","ListViewSidebar","SettingsSidebar","MetaBoxes","WelcomeGuide","ActionsPanel","StartPageOptions","editPostStore","unlock","getLayoutStyles","interfaceLabels","header","body","sidebar","actions","footer","Layout","isMobileViewport","isHugeViewport","isLargeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","createErrorNotice","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","isDistractionFree","showBlockBreadcrumbs","isTemplateMode","documentLabel","styles","select","getEditorSettings","getPostTypeLabel","isFeatureActive","editorSettings","postTypeLabel","hasThemeStyles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","disableLayoutStyles","length","css","selector","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","isEditingTemplate","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","getAllShortcutKeyCombinations","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","className","secondarySidebarLabel","secondarySidebar","onPluginAreaError","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,oBAFD,EAGCC,qBAHD,EAICC,aAJD,EAKCC,+BALD,EAMCC,uBAND,EAOCC,eAPD,EAQCC,mBARD,EASCC,KAAK,IAAIC,WATV,QAUO,mBAVP;AAWA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,eADD,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SAASC,MAAT,EAAiBC,UAAjB,EAA6BC,OAA7B,QAA4C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C,OAAD,CAAS,IAAT,OApGD,EAqGC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAG+C;AAAtB,IArGD,CADD;AAyGA;;AAED,eAAe9D,MAAf","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\tEditorKeyboardShortcuts,\n\tEditorSnackbars,\n\tPostSyncStatusModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockBreadcrumb,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { Button, ScrollLock, Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, _x, sprintf } 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';\nimport { store as noticesStore } from '@wordpress/notices';\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 EditPostPreferencesModal 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 StartPageOptions from '../start-page-options';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { getLayoutStyles } = unlock( blockEditorPrivateApis );\n\nconst interfaceLabels = {\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() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\tconst { openGeneralSidebar, closeGeneralSidebar, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\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\tisDistractionFree,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t\tdocumentLabel,\n\t\tstyles,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst { isFeatureActive } = select( editPostStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\t\tconst hasThemeStyles = isFeatureActive( 'themeStyles' );\n\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\teditorSettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...editorSettings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif (\n\t\t\t! editorSettings.disableLayoutStyles &&\n\t\t\t! ( hasThemeStyles && themeStyles.length )\n\t\t) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fixedToolbar' ),\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:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fullscreenMode' ),\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).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\tisDistractionFree:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'distractionFree' ),\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t\tstyles:\n\t\t\t\thasThemeStyles && themeStyles.length\n\t\t\t\t\t? editorSettings.styles\n\t\t\t\t\t: defaultEditorStyles,\n\t\t};\n\t}, [] );\n\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 [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( 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 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\t'is-distraction-free': isDistractionFree && isLargeViewport,\n\t\t'is-entity-save-view-open': !! entitiesSavedStatesCallback,\n\t} );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\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 <ListViewSidebar />;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\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<EditorKeyboardShortcuts />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tisDistractionFree={ isDistractionFree && isLargeViewport }\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ {\n\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t} }\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\teditorNotices={ <EditorNotices /> }\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\tvariant=\"secondary\"\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{ ! isDistractionFree && <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{ ! isDistractionFree && ! 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! isDistractionFree &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\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 rootLabelText={ documentLabel } />\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<EditPostPreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<PostSyncStatusModal />\n\t\t\t<StartPageOptions />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
@@ -9,7 +9,7 @@ import { useFocusOnMount, useFocusReturn, useMergeRefs } from '@wordpress/compos
|
|
|
9
9
|
import { useDispatch } from '@wordpress/data';
|
|
10
10
|
import { focus } from '@wordpress/dom';
|
|
11
11
|
import { useRef, useState } from '@wordpress/element';
|
|
12
|
-
import { __ } from '@wordpress/i18n';
|
|
12
|
+
import { __, _x } from '@wordpress/i18n';
|
|
13
13
|
import { closeSmall } from '@wordpress/icons';
|
|
14
14
|
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
15
15
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
@@ -116,11 +116,11 @@ export default function ListViewSidebar() {
|
|
|
116
116
|
selectOnMove: false,
|
|
117
117
|
tabs: [{
|
|
118
118
|
name: 'list-view',
|
|
119
|
-
title: 'List View',
|
|
119
|
+
title: _x('List View', 'Post overview'),
|
|
120
120
|
className: 'edit-post-sidebar__panel-tab'
|
|
121
121
|
}, {
|
|
122
122
|
name: 'outline',
|
|
123
|
-
title: 'Outline',
|
|
123
|
+
title: _x('Outline', 'Post overview'),
|
|
124
124
|
className: 'edit-post-sidebar__panel-tab'
|
|
125
125
|
}]
|
|
126
126
|
}, currentTab => createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["__experimentalListView","ListView","Button","TabPanel","useFocusOnMount","useFocusReturn","useMergeRefs","useDispatch","focus","useRef","useState","__","closeSmall","useShortcut","ESCAPE","store","editPostStore","ListViewOutline","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","dropZoneElement","setDropZoneElement","tab","setTab","sidebarRef","tabPanelRef","listViewRef","listViewContainerRef","handleSidebarFocus","currentTab","tabPanelFocus","tabbable","find","current","listViewApplicationFocus","listViewFocusArea","contains","ownerDocument","activeElement","renderTabContent","tabName","name","title","className"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAnC,QAAmD,yBAAnD;AACA,SAASC,MAAT,EAAiBC,QAAjB,QAAiC,uBAAjC;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,YAHD,QAIO,oBAJP;AAKA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,MAAT,EAAiBC,QAAjB,QAAiC,oBAAjC;AACA,SAASC,EAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["__experimentalListView","ListView","Button","TabPanel","useFocusOnMount","useFocusReturn","useMergeRefs","useDispatch","focus","useRef","useState","__","_x","closeSmall","useShortcut","ESCAPE","store","editPostStore","ListViewOutline","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","dropZoneElement","setDropZoneElement","tab","setTab","sidebarRef","tabPanelRef","listViewRef","listViewContainerRef","handleSidebarFocus","currentTab","tabPanelFocus","tabbable","find","current","listViewApplicationFocus","listViewFocusArea","contains","ownerDocument","activeElement","renderTabContent","tabName","name","title","className"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAnC,QAAmD,yBAAnD;AACA,SAASC,MAAT,EAAiBC,QAAjB,QAAiC,uBAAjC;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,YAHD,QAIO,oBAJP;AAKA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,MAAT,EAAiBC,QAAjB,QAAiC,oBAAjC;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0Bb,WAAW,CAAEU,aAAF,CAA3C,CADyC,CAGzC;;AACA,QAAM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AAM,CAAEiB,OAAF,CAHjC;AAIC,MAAA,YAAY,EAAG,KAJhB;AAKC,MAAA,IAAI,EAAG,CACN;AACCC,QAAAA,IAAI,EAAE,WADP;AAECC,QAAAA,KAAK,EAAEvC,EAAE,CAAE,WAAF,EAAe,eAAf,CAFV;AAGCwC,QAAAA,SAAS,EAAE;AAHZ,OADM,EAMN;AACCF,QAAAA,IAAI,EAAE,SADP;AAECC,QAAAA,KAAK,EAAEvC,EAAE,CAAE,SAAF,EAAa,eAAb,CAFV;AAGCwC,QAAAA,SAAS,EAAE;AAHZ,OANM;AALR,OAkBKd,UAAF,IACD;AACC,MAAA,SAAS,EAAC,uCADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIGY,gBAAgB,CAAEV,UAAU,CAACY,IAAb,CAJnB,CAnBF,CAZD;AAFD;AA2CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button, TabPanel } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useRef, useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport ListViewOutline from './list-view-outline';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editPostStore );\n\n\t// This hook handles focus when the sidebar first renders.\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\t// The next 2 hooks handle focus for when the sidebar closes and returning focus to the element that had focus before sidebar opened.\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\t// Tracks our current tab.\n\tconst [ tab, setTab ] = useState( 'list-view' );\n\n\t// This ref refers to the sidebar as a whole.\n\tconst sidebarRef = useRef();\n\t// This ref refers to the tab panel.\n\tconst tabPanelRef = useRef();\n\t// This ref refers to the list view application area.\n\tconst listViewRef = useRef();\n\n\t// Must merge the refs together so focus can be handled properly in the next function.\n\tconst listViewContainerRef = useMergeRefs( [\n\t\tcontentFocusReturnRef,\n\t\tfocusOnMountRef,\n\t\tlistViewRef,\n\t\tsetDropZoneElement,\n\t] );\n\n\t/*\n\t * Callback function to handle list view or outline focus.\n\t *\n\t * @param {string} currentTab The current tab. Either list view or outline.\n\t *\n\t * @return void\n\t */\n\tfunction handleSidebarFocus( currentTab ) {\n\t\t// Tab panel focus.\n\t\tconst tabPanelFocus = focus.tabbable.find( tabPanelRef.current )[ 0 ];\n\t\t// List view tab is selected.\n\t\tif ( currentTab === 'list-view' ) {\n\t\t\t// Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.\n\t\t\tconst listViewApplicationFocus = focus.tabbable.find(\n\t\t\t\tlistViewRef.current\n\t\t\t)[ 0 ];\n\t\t\tconst listViewFocusArea = sidebarRef.current.contains(\n\t\t\t\tlistViewApplicationFocus\n\t\t\t)\n\t\t\t\t? listViewApplicationFocus\n\t\t\t\t: tabPanelFocus;\n\t\t\tlistViewFocusArea.focus();\n\t\t\t// Outline tab is selected.\n\t\t} else {\n\t\t\ttabPanelFocus.focus();\n\t\t}\n\t}\n\n\t// This only fires when the sidebar is open because of the conditional rendering. It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.\n\tuseShortcut( 'core/edit-post/toggle-list-view', () => {\n\t\t// If the sidebar has focus, it is safe to close.\n\t\tif (\n\t\t\tsidebarRef.current.contains(\n\t\t\t\tsidebarRef.current.ownerDocument.activeElement\n\t\t\t)\n\t\t) {\n\t\t\tsetIsListViewOpened( false );\n\t\t\t// If the list view or outline does not have focus, focus should be moved to it.\n\t\t} else {\n\t\t\thandleSidebarFocus( tab );\n\t\t}\n\t} );\n\n\t/**\n\t * Render tab content for a given tab name.\n\t *\n\t * @param {string} tabName The name of the tab to render.\n\t */\n\tfunction renderTabContent( tabName ) {\n\t\tif ( tabName === 'list-view' ) {\n\t\t\treturn (\n\t\t\t\t<div className=\"edit-post-editor__list-view-panel-content\">\n\t\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t\treturn <ListViewOutline />;\n\t}\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-post-editor__document-overview-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t\tref={ sidebarRef }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-editor__document-overview-panel__close-button\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t\ticon={ closeSmall }\n\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t/>\n\t\t\t<TabPanel\n\t\t\t\tclassName=\"edit-post-editor__document-overview-panel__tab-panel\"\n\t\t\t\tref={ tabPanelRef }\n\t\t\t\tonSelect={ ( tabName ) => setTab( tabName ) }\n\t\t\t\tselectOnMove={ false }\n\t\t\t\ttabs={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'list-view',\n\t\t\t\t\t\ttitle: _x( 'List View', 'Post overview' ),\n\t\t\t\t\t\tclassName: 'edit-post-sidebar__panel-tab',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'outline',\n\t\t\t\t\t\ttitle: _x( 'Outline', 'Post overview' ),\n\t\t\t\t\t\tclassName: 'edit-post-sidebar__panel-tab',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ ( currentTab ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"edit-post-editor__list-view-container\"\n\t\t\t\t\t\tref={ listViewContainerRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ renderTabContent( currentTab.name ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TabPanel>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -6,8 +6,7 @@ import { createElement } from "@wordpress/element";
|
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { PanelBody, PanelRow } from '@wordpress/components';
|
|
8
8
|
import { PostComments, PostPingbacks, PostTypeSupportCheck } from '@wordpress/editor';
|
|
9
|
-
import {
|
|
10
|
-
import { withSelect, withDispatch } from '@wordpress/data';
|
|
9
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
10
|
/**
|
|
12
11
|
* Internal dependencies
|
|
13
12
|
*/
|
|
@@ -19,11 +18,24 @@ import { store as editPostStore } from '../../../store';
|
|
|
19
18
|
|
|
20
19
|
const PANEL_NAME = 'discussion-panel';
|
|
21
20
|
|
|
22
|
-
function DiscussionPanel({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
21
|
+
function DiscussionPanel() {
|
|
22
|
+
const {
|
|
23
|
+
isEnabled,
|
|
24
|
+
isOpened
|
|
25
|
+
} = useSelect(select => {
|
|
26
|
+
const {
|
|
27
|
+
isEditorPanelEnabled,
|
|
28
|
+
isEditorPanelOpened
|
|
29
|
+
} = select(editPostStore);
|
|
30
|
+
return {
|
|
31
|
+
isEnabled: isEditorPanelEnabled(PANEL_NAME),
|
|
32
|
+
isOpened: isEditorPanelOpened(PANEL_NAME)
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
const {
|
|
36
|
+
toggleEditorPanelOpened
|
|
37
|
+
} = useDispatch(editPostStore);
|
|
38
|
+
|
|
27
39
|
if (!isEnabled) {
|
|
28
40
|
return null;
|
|
29
41
|
}
|
|
@@ -33,7 +45,7 @@ function DiscussionPanel({
|
|
|
33
45
|
}, createElement(PanelBody, {
|
|
34
46
|
title: __('Discussion'),
|
|
35
47
|
opened: isOpened,
|
|
36
|
-
onToggle:
|
|
48
|
+
onToggle: () => toggleEditorPanelOpened(PANEL_NAME)
|
|
37
49
|
}, createElement(PostTypeSupportCheck, {
|
|
38
50
|
supportKeys: "comments"
|
|
39
51
|
}, createElement(PanelRow, null, createElement(PostComments, null))), createElement(PostTypeSupportCheck, {
|
|
@@ -41,15 +53,5 @@ function DiscussionPanel({
|
|
|
41
53
|
}, createElement(PanelRow, null, createElement(PostPingbacks, null)))));
|
|
42
54
|
}
|
|
43
55
|
|
|
44
|
-
export default
|
|
45
|
-
return {
|
|
46
|
-
isEnabled: select(editPostStore).isEditorPanelEnabled(PANEL_NAME),
|
|
47
|
-
isOpened: select(editPostStore).isEditorPanelOpened(PANEL_NAME)
|
|
48
|
-
};
|
|
49
|
-
}), withDispatch(dispatch => ({
|
|
50
|
-
onTogglePanel() {
|
|
51
|
-
return dispatch(editPostStore).toggleEditorPanelOpened(PANEL_NAME);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
}))])(DiscussionPanel);
|
|
56
|
+
export default DiscussionPanel;
|
|
55
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/discussion-panel/index.js"],"names":["__","PanelBody","PanelRow","PostComments","PostPingbacks","PostTypeSupportCheck","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/discussion-panel/index.js"],"names":["__","PanelBody","PanelRow","PostComments","PostPingbacks","PostTypeSupportCheck","useDispatch","useSelect","store","editPostStore","PANEL_NAME","DiscussionPanel","isEnabled","isOpened","select","isEditorPanelEn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C,cAAC,QAAD,QACC,cAAC,aAAD,OADD,CADD,CAXD,CADD,CADD;AAqBA;;AAED,eAAeC,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport {\n\tPostComments,\n\tPostPingbacks,\n\tPostTypeSupportCheck,\n} from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'discussion-panel';\n\nfunction DiscussionPanel() {\n\tconst { isEnabled, isOpened } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\tselect( editPostStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editPostStore );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }\n\t\t\t>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"comments\">\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<PostComments />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PostTypeSupportCheck>\n\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"trackbacks\">\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<PostPingbacks />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t</PanelBody>\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default DiscussionPanel;\n"]}
|
package/build-module/editor.js
CHANGED
|
@@ -6,7 +6,6 @@ import { createElement } from "@wordpress/element";
|
|
|
6
6
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
8
|
import { ErrorBoundary, PostLockedModal, store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
9
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
10
9
|
import { useMemo } from '@wordpress/element';
|
|
11
10
|
import { SlotFillProvider } from '@wordpress/components';
|
|
12
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -26,9 +25,6 @@ import useCommonCommands from './hooks/commands/use-common-commands';
|
|
|
26
25
|
const {
|
|
27
26
|
ExperimentalEditorProvider
|
|
28
27
|
} = unlock(editorPrivateApis);
|
|
29
|
-
const {
|
|
30
|
-
getLayoutStyles
|
|
31
|
-
} = unlock(blockEditorPrivateApis);
|
|
32
28
|
const {
|
|
33
29
|
useCommands
|
|
34
30
|
} = unlock(coreCommandsPrivateApis);
|
|
@@ -47,7 +43,6 @@ function Editor({
|
|
|
47
43
|
focusMode,
|
|
48
44
|
isDistractionFree,
|
|
49
45
|
hasInlineToolbar,
|
|
50
|
-
hasThemeStyles,
|
|
51
46
|
post,
|
|
52
47
|
preferredStyleVariations,
|
|
53
48
|
hiddenBlockTypes,
|
|
@@ -60,7 +55,6 @@ function Editor({
|
|
|
60
55
|
|
|
61
56
|
const {
|
|
62
57
|
isFeatureActive,
|
|
63
|
-
__experimentalGetPreviewDeviceType,
|
|
64
58
|
isEditingTemplate,
|
|
65
59
|
getEditedPostTemplate,
|
|
66
60
|
getHiddenBlockTypes
|
|
@@ -95,11 +89,10 @@ function Editor({
|
|
|
95
89
|
const isViewable = (_getPostType$viewable = getPostType(postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
|
|
96
90
|
const canEditTemplate = canUser('create', 'templates');
|
|
97
91
|
return {
|
|
98
|
-
hasFixedToolbar: isFeatureActive('fixedToolbar')
|
|
92
|
+
hasFixedToolbar: isFeatureActive('fixedToolbar'),
|
|
99
93
|
focusMode: isFeatureActive('focusMode'),
|
|
100
94
|
isDistractionFree: isFeatureActive('distractionFree'),
|
|
101
95
|
hasInlineToolbar: isFeatureActive('inlineToolbar'),
|
|
102
|
-
hasThemeStyles: isFeatureActive('themeStyles'),
|
|
103
96
|
preferredStyleVariations: select(preferencesStore).get('core/edit-post', 'preferredStyleVariations'),
|
|
104
97
|
hiddenBlockTypes: getHiddenBlockTypes(),
|
|
105
98
|
blockTypes: getBlockTypes(),
|
|
@@ -143,33 +136,6 @@ function Editor({
|
|
|
143
136
|
|
|
144
137
|
return result;
|
|
145
138
|
}, [settings, hasFixedToolbar, hasInlineToolbar, focusMode, isDistractionFree, hiddenBlockTypes, blockTypes, preferredStyleVariations, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]);
|
|
146
|
-
const styles = useMemo(() => {
|
|
147
|
-
const themeStyles = [];
|
|
148
|
-
const presetStyles = [];
|
|
149
|
-
settings.styles?.forEach(style => {
|
|
150
|
-
if (!style.__unstableType || style.__unstableType === 'theme') {
|
|
151
|
-
themeStyles.push(style);
|
|
152
|
-
} else {
|
|
153
|
-
presetStyles.push(style);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
const defaultEditorStyles = [...settings.defaultEditorStyles, ...presetStyles]; // If theme styles are not present or displayed, ensure that
|
|
157
|
-
// base layout styles are still present in the editor.
|
|
158
|
-
|
|
159
|
-
if (!settings.disableLayoutStyles && !(hasThemeStyles && themeStyles.length)) {
|
|
160
|
-
defaultEditorStyles.push({
|
|
161
|
-
css: getLayoutStyles({
|
|
162
|
-
style: {},
|
|
163
|
-
selector: 'body',
|
|
164
|
-
hasBlockGapSupport: false,
|
|
165
|
-
hasFallbackGapSupport: true,
|
|
166
|
-
fallbackGapValue: '0.5em'
|
|
167
|
-
})
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return hasThemeStyles && themeStyles.length ? settings.styles : defaultEditorStyles;
|
|
172
|
-
}, [settings, hasThemeStyles]);
|
|
173
139
|
|
|
174
140
|
if (!post) {
|
|
175
141
|
return null;
|
|
@@ -184,9 +150,7 @@ function Editor({
|
|
|
184
150
|
...props
|
|
185
151
|
}, createElement(ErrorBoundary, null, createElement(CommandMenu, null), createElement(EditorInitialization, {
|
|
186
152
|
postId: postId
|
|
187
|
-
}), createElement(Layout,
|
|
188
|
-
styles: styles
|
|
189
|
-
})), createElement(PostLockedModal, null))));
|
|
153
|
+
}), createElement(Layout, null)), createElement(PostLockedModal, null))));
|
|
190
154
|
}
|
|
191
155
|
|
|
192
156
|
export default Editor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["store","blocksStore","useSelect","useDispatch","ErrorBoundary","PostLockedModal","editorStore","privateApis","editorPrivateApis","blockEditorPrivateApis","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","CommandMenu","coreCommandsPrivateApis","Layout","EditorInitialization","editPostStore","unlock","useCommonCommands","ExperimentalEditorProvider","getLayoutStyles","useCommands","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","styles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","disableLayoutStyles","css","selector","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,eAFD,EAGCL,KAAK,IAAIM,WAHV,EAICC,WAAW,IAAIC,iBAJhB,QAKO,mBALP;AAMA,SAASD,WAAW,IAAIE,sBAAxB,QAAsD,yBAAtD;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASX,KAAK,IAAIY,SAAlB,QAAmC,sBAAnC;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,WAAT,QAA4B,qBAA5B;AACA,SAASR,WAAW,IAAIS,uBAAxB,QAAuD,0BAAvD;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASlB,KAAK,IAAImB,aAAlB,QAAuC,SAAvC;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,OAAOC,iBAAP,MAA8B,sCAA9B;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAiCF,MAAM,CAAEZ,iBAAF,CAA7C;AACA,MAAM;AAAEe,EAAAA;AAAF,IAAsBH,MAAM,CAAEX,sBAAF,CAAlC;AACA,MAAM;AAAEe,EAAAA;AAAF,IAAkBJ,MAAM,CAAEJ,uBAAF,CAA9B;;AAEA,SAASS,MAAT,CAAiB;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,QAAV;AAAoBC,EAAAA,QAApB;AAA8BC,EAAAA,YAA9B;AAA4C,KAAGC;AAA/C,CAAjB,EAA0E;AACzEN,EAAAA,WAAW;AACXH,EAAAA,iBAAiB;AACjB,QAAM;AACLU,IAAAA,eADK;AAEL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{ useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useCommonCommands from './hooks/commands/use-common-commands';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { getLayoutStyles } = unlock( blockEditorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tuseCommonCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tsettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif (\n\t\t\t! settings.disableLayoutStyles &&\n\t\t\t! ( hasThemeStyles && themeStyles.length )\n\t\t) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["store","blocksStore","useSelect","useDispatch","ErrorBoundary","PostLockedModal","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","CommandMenu","coreCommandsPrivateApis","Layout","EditorInitialization","editPostStore","unlock","useCommonCommands","ExperimentalEditorProvider","useCommands","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,eAFD,EAGCL,KAAK,IAAIM,WAHV,EAICC,WAAW,IAAIC,iBAJhB,QAKO,mBALP;AAMA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASV,KAAK,IAAIW,SAAlB,QAAmC,sBAAnC;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AACA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,WAAT,QAA4B,qBAA5B;AACA,SAASP,WAAW,IAAIQ,uBAAxB,QAAuD,0BAAvD;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,qBAAn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,WAAO,IAAP;AACA;;AAED,SACC,cAAC,gBAAD,QACC,cAAC,gBAAD,QACC,cAAC,0BAAD;AACC,IAAA,QAAQ,EAAG8B,cADZ;AAEC,IAAA,IAAI,EAAG9B,IAFR;AAGC,IAAA,YAAY,EAAGN,YAHhB;AAIC,IAAA,cAAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EAAGW,cAAc,GAAGC,QAAH,GAAcqC,SALlD;AAAA,OAMMhD;AANN,KAQC,cAAC,aAAD,QACC,cAAC,WAAD,OADD,EAEC,cAAC,oBAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IAFD,EAGC,cAAC,MAAD,OAHD,CARD,EAaC,cAAC,eAAD,OAbD,CADD,CADD,CADD;AAqBA;;AAED,eAAeD,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useCommonCommands from './hooks/commands/use-common-commands';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tuseCommonCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar: isFeatureActive( 'fixedToolbar' ),\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|