@wordpress/edit-post 6.1.1 → 6.3.1
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 +4 -0
- package/build/components/header/plugin-more-menu-item/index.js +5 -0
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/header/template-title/delete-template.js +3 -1
- package/build/components/header/template-title/delete-template.js.map +1 -1
- package/build/components/layout/index.js +3 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar/post-link/index.js +1 -1
- package/build/components/sidebar/post-link/index.js.map +1 -1
- package/build/components/start-page-options/index.js +116 -0
- package/build/components/start-page-options/index.js.map +1 -0
- package/build/components/visual-editor/index.js +3 -3
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +4 -6
- package/build/editor.js.map +1 -1
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/index.native.js +15 -0
- package/build/index.native.js.map +1 -1
- package/build/store/actions.js +99 -74
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +7 -10
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +0 -118
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +95 -34
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +4 -0
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/header/template-title/delete-template.js +3 -1
- package/build-module/components/header/template-title/delete-template.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/sidebar/post-link/index.js +1 -1
- package/build-module/components/sidebar/post-link/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +103 -0
- package/build-module/components/start-page-options/index.js.map +1 -0
- package/build-module/components/visual-editor/index.js +3 -3
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +3 -6
- package/build-module/editor.js.map +1 -1
- package/build-module/index.js +5 -0
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +13 -0
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/actions.js +92 -68
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +7 -10
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -115
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +89 -28
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +39 -4
- package/build-style/style.css +39 -4
- package/package.json +27 -26
- package/src/components/header/plugin-more-menu-item/index.js +2 -0
- package/src/components/header/template-title/delete-template.js +3 -1
- package/src/components/layout/index.js +2 -0
- package/src/components/sidebar/post-link/index.js +1 -1
- package/src/components/start-page-options/index.js +121 -0
- package/src/components/start-page-options/style.scss +42 -0
- package/src/components/visual-editor/index.js +5 -3
- package/src/editor.js +3 -8
- package/src/index.js +5 -0
- package/src/index.native.js +14 -0
- package/src/store/actions.js +87 -42
- package/src/store/index.js +7 -11
- package/src/store/reducer.js +1 -106
- package/src/store/selectors.js +124 -50
- package/src/store/test/actions.js +89 -46
- package/src/store/test/reducer.js +0 -135
- package/src/store/test/selectors.js +0 -174
- package/src/style.scss +1 -4
- package/build/store/defaults.js +0 -19
- package/build/store/defaults.js.map +0 -1
- package/build-module/store/defaults.js +0 -12
- package/build-module/store/defaults.js.map +0 -1
- package/src/store/defaults.js +0 -11
|
@@ -1,125 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { includes } from 'lodash';
|
|
5
5
|
/**
|
|
6
6
|
* WordPress dependencies
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { combineReducers } from '@wordpress/data';
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { PREFERENCES_DEFAULTS } from './defaults';
|
|
15
|
-
/**
|
|
16
|
-
* Higher-order reducer creator which provides the given initial state for the
|
|
17
|
-
* original reducer.
|
|
18
|
-
*
|
|
19
|
-
* @param {*} initialState Initial state to provide to reducer.
|
|
20
|
-
*
|
|
21
|
-
* @return {Function} Higher-order reducer.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const createWithInitialState = initialState => reducer => {
|
|
25
|
-
return function () {
|
|
26
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
27
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
28
|
-
return reducer(state, action);
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Reducer returning the user preferences.
|
|
33
|
-
*
|
|
34
|
-
* @param {Object} state Current state.
|
|
35
|
-
* @param {string} state.mode Current editor mode, either
|
|
36
|
-
* "visual" or "text".
|
|
37
|
-
* @param {boolean} state.isGeneralSidebarDismissed Whether general sidebar is
|
|
38
|
-
* dismissed. False by default
|
|
39
|
-
* or when closing general
|
|
40
|
-
* sidebar, true when opening
|
|
41
|
-
* sidebar.
|
|
42
|
-
* @param {boolean} state.isSidebarOpened Whether the sidebar is
|
|
43
|
-
* opened or closed.
|
|
44
|
-
* @param {Object} state.panels The state of the different
|
|
45
|
-
* sidebar panels.
|
|
46
|
-
* @param {Object} action Dispatched action.
|
|
47
|
-
*
|
|
48
|
-
* @return {Object} Updated state.
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export const preferences = flow([combineReducers, createWithInitialState(PREFERENCES_DEFAULTS)])({
|
|
53
|
-
panels(state, action) {
|
|
54
|
-
switch (action.type) {
|
|
55
|
-
case 'TOGGLE_PANEL_ENABLED':
|
|
56
|
-
{
|
|
57
|
-
const {
|
|
58
|
-
panelName
|
|
59
|
-
} = action;
|
|
60
|
-
return { ...state,
|
|
61
|
-
[panelName]: { ...state[panelName],
|
|
62
|
-
enabled: !get(state, [panelName, 'enabled'], true)
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
case 'TOGGLE_PANEL_OPENED':
|
|
68
|
-
{
|
|
69
|
-
const {
|
|
70
|
-
panelName
|
|
71
|
-
} = action;
|
|
72
|
-
const isOpen = state[panelName] === true || get(state, [panelName, 'opened'], false);
|
|
73
|
-
return { ...state,
|
|
74
|
-
[panelName]: { ...state[panelName],
|
|
75
|
-
opened: !isOpen
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return state;
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
editorMode(state, action) {
|
|
85
|
-
if (action.type === 'SWITCH_MODE') {
|
|
86
|
-
return action.mode;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return state;
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
preferredStyleVariations(state, action) {
|
|
93
|
-
switch (action.type) {
|
|
94
|
-
case 'UPDATE_PREFERRED_STYLE_VARIATIONS':
|
|
95
|
-
{
|
|
96
|
-
if (!action.blockName) {
|
|
97
|
-
return state;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (!action.blockStyle) {
|
|
101
|
-
return omit(state, [action.blockName]);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return { ...state,
|
|
105
|
-
[action.blockName]: action.blockStyle
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return state;
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
localAutosaveInterval(state, action) {
|
|
114
|
-
switch (action.type) {
|
|
115
|
-
case 'UPDATE_LOCAL_AUTOSAVE_INTERVAL':
|
|
116
|
-
return action.interval;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return state;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
});
|
|
123
10
|
/**
|
|
124
11
|
* Reducer storing the list of all programmatically removed panels.
|
|
125
12
|
*
|
|
@@ -346,7 +233,6 @@ const metaBoxes = combineReducers({
|
|
|
346
233
|
export default combineReducers({
|
|
347
234
|
activeModal,
|
|
348
235
|
metaBoxes,
|
|
349
|
-
preferences,
|
|
350
236
|
publishSidebarActive,
|
|
351
237
|
removedPanels,
|
|
352
238
|
deviceType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/reducer.js"],"names":["flow","get","includes","omit","combineReducers","PREFERENCES_DEFAULTS","createWithInitialState","initialState","reducer","state","action","preferences","panels","type","panelName","enabled","isOpen","opened","editorMode","mode","preferredStyleVariations","blockName","blockStyle","localAutosaveInterval","interval","removedPanels","activeModal","name","publishSidebarActive","isSavingMetaBoxes","metaBoxLocations","metaBoxesPerLocation","deviceType","blockInserterPanel","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,QAApB,EAA8BC,IAA9B,QAA0C,QAA1C;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,YAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,sBAAsB,GAAKC,YAAF,IAAsBC,OAAF,IAAe;AACjE,SAAO;AAAA,QAAEC,KAAF,uEAAUF,YAAV;AAAA,QAAwBG,MAAxB;AAAA,WAAoCF,OAAO,CAAEC,KAAF,EAASC,MAAT,CAA3C;AAAA,GAAP;AACA,CAFD;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMC,WAAW,GAAGX,IAAI,CAAE,CAChCI,eADgC,EAEhCE,sBAAsB,CAAED,oBAAF,CAFU,CAAF,CAAJ,CAGtB;AACJO,EAAAA,MAAM,CAAEH,KAAF,EAASC,MAAT,EAAkB;AACvB,YAAS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D,UAASA,MAAM,CAACG,IAAhB;AACC,SAAK,wBAAL;AACC,aAAOH,MAAM,CAACwB,KAAP,GAAe,KAAf,GAAuBzB,KAA9B;;AACD,SAAK,yBAAL;AACC,aAAOC,MAAM,CAACM,MAAd;AAJF;;AAMA,SAAOP,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,SAAS2B,iBAAT,GAAoD;AAAA,MAAxB3B,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACnD,UAASA,MAAM,CAACG,IAAhB;AACC,SAAK,yBAAL;AACC,aAAOH,MAAM,CAACwB,KAAd;AAFF;;AAIA,SAAOzB,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS4B,oBAAT,GAAuD;AAAA,MAAxB5B,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACG,IAAhB;AACC,SAAK,wBAAL;AACC,aAAO,IAAP;AAFF;;AAIA,SAAOJ,KAAP;AACA;;AAED,MAAM6B,SAAS,GAAGlC,eAAe,CAAE;AAClCmC,EAAAA,QAAQ,EAAEV,iBADwB;AAElCW,EAAAA,SAAS,EAAEV,gBAFuB;AAGlCW,EAAAA,WAAW,EAAEJ;AAHqB,CAAF,CAAjC;AAMA,eAAejC,eAAe,CAAE;AAC/BsB,EAAAA,WAD+B;AAE/BY,EAAAA,SAF+B;AAG/B3B,EAAAA,WAH+B;AAI/BiB,EAAAA,oBAJ+B;AAK/BH,EAAAA,aAL+B;AAM/BO,EAAAA,UAN+B;AAO/BC,EAAAA,kBAP+B;AAQ/BE,EAAAA,aAR+B;AAS/BC,EAAAA;AAT+B,CAAF,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { flow, get, includes, omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { PREFERENCES_DEFAULTS } from './defaults';\n\n/**\n * Higher-order reducer creator which provides the given initial state for the\n * original reducer.\n *\n * @param {*} initialState Initial state to provide to reducer.\n *\n * @return {Function} Higher-order reducer.\n */\nconst createWithInitialState = ( initialState ) => ( reducer ) => {\n\treturn ( state = initialState, action ) => reducer( state, action );\n};\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {string} state.mode Current editor mode, either\n * \"visual\" or \"text\".\n * @param {boolean} state.isGeneralSidebarDismissed Whether general sidebar is\n * dismissed. False by default\n * or when closing general\n * sidebar, true when opening\n * sidebar.\n * @param {boolean} state.isSidebarOpened Whether the sidebar is\n * opened or closed.\n * @param {Object} state.panels The state of the different\n * sidebar panels.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferences = flow( [\n\tcombineReducers,\n\tcreateWithInitialState( PREFERENCES_DEFAULTS ),\n] )( {\n\tpanels( state, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_PANEL_ENABLED': {\n\t\t\t\tconst { panelName } = action;\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ panelName ]: {\n\t\t\t\t\t\t...state[ panelName ],\n\t\t\t\t\t\tenabled: ! get( state, [ panelName, 'enabled' ], true ),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tcase 'TOGGLE_PANEL_OPENED': {\n\t\t\t\tconst { panelName } = action;\n\t\t\t\tconst isOpen =\n\t\t\t\t\tstate[ panelName ] === true ||\n\t\t\t\t\tget( state, [ panelName, 'opened' ], false );\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ panelName ]: {\n\t\t\t\t\t\t...state[ panelName ],\n\t\t\t\t\t\topened: ! isOpen,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn state;\n\t},\n\teditorMode( state, action ) {\n\t\tif ( action.type === 'SWITCH_MODE' ) {\n\t\t\treturn action.mode;\n\t\t}\n\n\t\treturn state;\n\t},\n\tpreferredStyleVariations( state, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'UPDATE_PREFERRED_STYLE_VARIATIONS': {\n\t\t\t\tif ( ! action.blockName ) {\n\t\t\t\t\treturn state;\n\t\t\t\t}\n\t\t\t\tif ( ! action.blockStyle ) {\n\t\t\t\t\treturn omit( state, [ action.blockName ] );\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\t...state,\n\t\t\t\t\t[ action.blockName ]: action.blockStyle,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn state;\n\t},\n\tlocalAutosaveInterval( state, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'UPDATE_LOCAL_AUTOSAVE_INTERVAL':\n\t\t\t\treturn action.interval;\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! includes( state, action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the meta boxes isSaving state.\n * A \"true\" value means the meta boxes saving request is in-flight.\n *\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function isSavingMetaBoxes( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_META_BOX_UPDATES':\n\t\t\treturn true;\n\t\tcase 'META_BOX_UPDATES_SUCCESS':\n\t\tcase 'META_BOX_UPDATES_FAILURE':\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn state;\n\t}\n}\n\n/**\n * Reducer keeping track of the meta boxes per location.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function metaBoxLocations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_META_BOXES_PER_LOCATIONS':\n\t\t\treturn action.metaBoxesPerLocation;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean} state\n * @param {Object} action\n */\nfunction isEditingTemplate( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_EDITING_TEMPLATE':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether meta boxes are initialized.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nfunction metaBoxesInitialized( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'META_BOXES_INITIALIZED':\n\t\t\treturn true;\n\t}\n\treturn state;\n}\n\nconst metaBoxes = combineReducers( {\n\tisSaving: isSavingMetaBoxes,\n\tlocations: metaBoxLocations,\n\tinitialized: metaBoxesInitialized,\n} );\n\nexport default combineReducers( {\n\tactiveModal,\n\tmetaBoxes,\n\tpreferences,\n\tpublishSidebarActive,\n\tremovedPanels,\n\tdeviceType,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tisEditingTemplate,\n} );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/store/reducer.js"],"names":["includes","combineReducers","removedPanels","state","action","type","panelName","activeModal","name","publishSidebarActive","isSavingMetaBoxes","metaBoxLocations","metaBoxesPerLocation","deviceType","blockInserterPanel","isOpen","value","listViewPanel","isEditingTemplate","metaBoxesInitialized","metaBoxes","isSaving","locations","initialized"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,GAA6C;AAAA,MA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;AACA;AACA;AACA;;;AACA,SAASgB,oBAAT,GAAuD;AAAA,MAAxBhB,KAAwB,uEAAhB,KAAgB;AAAA,MAATC,MAAS;;AACtD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,wBAAL;AACC,aAAO,IAAP;AAFF;;AAIA,SAAOF,KAAP;AACA;;AAED,MAAMiB,SAAS,GAAGnB,eAAe,CAAE;AAClCoB,EAAAA,QAAQ,EAAEX,iBADwB;AAElCY,EAAAA,SAAS,EAAEX,gBAFuB;AAGlCY,EAAAA,WAAW,EAAEJ;AAHqB,CAAF,CAAjC;AAMA,eAAelB,eAAe,CAAE;AAC/BM,EAAAA,WAD+B;AAE/Ba,EAAAA,SAF+B;AAG/BX,EAAAA,oBAH+B;AAI/BP,EAAAA,aAJ+B;AAK/BW,EAAAA,UAL+B;AAM/BC,EAAAA,kBAN+B;AAO/BG,EAAAA,aAP+B;AAQ/BC,EAAAA;AAR+B,CAAF,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer storing the list of all programmatically removed panels.\n *\n * @param {Array} state Current state.\n * @param {Object} action Action object.\n *\n * @return {Array} Updated state.\n */\nexport function removedPanels( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REMOVE_PANEL':\n\t\t\tif ( ! includes( state, action.panelName ) ) {\n\t\t\t\treturn [ ...state, action.panelName ];\n\t\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport function publishSidebarActive( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_PUBLISH_SIDEBAR':\n\t\t\treturn true;\n\t\tcase 'CLOSE_PUBLISH_SIDEBAR':\n\t\t\treturn false;\n\t\tcase 'TOGGLE_PUBLISH_SIDEBAR':\n\t\t\treturn ! state;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the meta boxes isSaving state.\n * A \"true\" value means the meta boxes saving request is in-flight.\n *\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function isSavingMetaBoxes( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_META_BOX_UPDATES':\n\t\t\treturn true;\n\t\tcase 'META_BOX_UPDATES_SUCCESS':\n\t\tcase 'META_BOX_UPDATES_FAILURE':\n\t\t\treturn false;\n\t\tdefault:\n\t\t\treturn state;\n\t}\n}\n\n/**\n * Reducer keeping track of the meta boxes per location.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action Object.\n *\n * @return {Object} Updated state.\n */\nexport function metaBoxLocations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_META_BOXES_PER_LOCATIONS':\n\t\t\treturn action.metaBoxesPerLocation;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the list view panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the inserter panel reducer\n * to make sure that only one of the two panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean} state\n * @param {Object} action\n */\nfunction isEditingTemplate( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_EDITING_TEMPLATE':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer tracking whether meta boxes are initialized.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nfunction metaBoxesInitialized( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'META_BOXES_INITIALIZED':\n\t\t\treturn true;\n\t}\n\treturn state;\n}\n\nconst metaBoxes = combineReducers( {\n\tisSaving: isSavingMetaBoxes,\n\tlocations: metaBoxLocations,\n\tinitialized: metaBoxesInitialized,\n} );\n\nexport default combineReducers( {\n\tactiveModal,\n\tmetaBoxes,\n\tpublishSidebarActive,\n\tremovedPanels,\n\tdeviceType,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tisEditingTemplate,\n} );\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import createSelector from 'rememo';
|
|
5
|
-
import {
|
|
5
|
+
import { includes, some, flatten, values } from 'lodash';
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
@@ -12,7 +12,9 @@ import { store as interfaceStore } from '@wordpress/interface';
|
|
|
12
12
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
13
13
|
import { store as coreStore } from '@wordpress/core-data';
|
|
14
14
|
import { store as editorStore } from '@wordpress/editor';
|
|
15
|
+
import deprecated from '@wordpress/deprecated';
|
|
15
16
|
const EMPTY_ARRAY = [];
|
|
17
|
+
const EMPTY_OBJECT = {};
|
|
16
18
|
/**
|
|
17
19
|
* Returns the current editing mode.
|
|
18
20
|
*
|
|
@@ -21,9 +23,11 @@ const EMPTY_ARRAY = [];
|
|
|
21
23
|
* @return {string} Editing mode.
|
|
22
24
|
*/
|
|
23
25
|
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
export const getEditorMode = createRegistrySelector(select => () => {
|
|
27
|
+
var _select$get;
|
|
28
|
+
|
|
29
|
+
return (_select$get = select(preferencesStore).get('core/edit-post', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual';
|
|
30
|
+
});
|
|
27
31
|
/**
|
|
28
32
|
* Returns true if the editor sidebar is opened.
|
|
29
33
|
*
|
|
@@ -65,10 +69,53 @@ export const isPluginSidebarOpened = createRegistrySelector(select => () => {
|
|
|
65
69
|
|
|
66
70
|
export const getActiveGeneralSidebarName = createRegistrySelector(select => () => {
|
|
67
71
|
return select(interfaceStore).getActiveComplementaryArea('core/edit-post');
|
|
68
|
-
});
|
|
69
|
-
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Converts panels from the new preferences store format to the old format
|
|
75
|
+
* that the post editor previously used.
|
|
76
|
+
*
|
|
77
|
+
* The resultant converted data should look like this:
|
|
78
|
+
* {
|
|
79
|
+
* panelName: {
|
|
80
|
+
* enabled: false,
|
|
81
|
+
* opened: true,
|
|
82
|
+
* },
|
|
83
|
+
* anotherPanelName: {
|
|
84
|
+
* opened: true
|
|
85
|
+
* },
|
|
86
|
+
* }
|
|
87
|
+
*
|
|
88
|
+
* @param {string[] | undefined} inactivePanels An array of inactive panel names.
|
|
89
|
+
* @param {string[] | undefined} openPanels An array of open panel names.
|
|
90
|
+
*
|
|
91
|
+
* @return {Object} The converted panel data.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
function convertPanelsToOldFormat(inactivePanels, openPanels) {
|
|
95
|
+
var _ref;
|
|
70
96
|
|
|
71
|
-
|
|
97
|
+
// First reduce the inactive panels.
|
|
98
|
+
const panelsWithEnabledState = inactivePanels === null || inactivePanels === void 0 ? void 0 : inactivePanels.reduce((accumulatedPanels, panelName) => ({ ...accumulatedPanels,
|
|
99
|
+
[panelName]: {
|
|
100
|
+
enabled: false
|
|
101
|
+
}
|
|
102
|
+
}), {}); // Then reduce the open panels, passing in the result of the previous
|
|
103
|
+
// reduction as the initial value so that both open and inactive
|
|
104
|
+
// panel state is combined.
|
|
105
|
+
|
|
106
|
+
const panels = openPanels === null || openPanels === void 0 ? void 0 : openPanels.reduce((accumulatedPanels, panelName) => {
|
|
107
|
+
const currentPanelState = accumulatedPanels === null || accumulatedPanels === void 0 ? void 0 : accumulatedPanels[panelName];
|
|
108
|
+
return { ...accumulatedPanels,
|
|
109
|
+
[panelName]: { ...currentPanelState,
|
|
110
|
+
opened: true
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}, panelsWithEnabledState !== null && panelsWithEnabledState !== void 0 ? panelsWithEnabledState : {}); // The panels variable will only be set if openPanels wasn't `undefined`.
|
|
114
|
+
// If it isn't set just return `panelsWithEnabledState`, and if that isn't
|
|
115
|
+
// set return an empty object.
|
|
116
|
+
|
|
117
|
+
return (_ref = panels !== null && panels !== void 0 ? panels : panelsWithEnabledState) !== null && _ref !== void 0 ? _ref : EMPTY_OBJECT;
|
|
118
|
+
}
|
|
72
119
|
/**
|
|
73
120
|
* Returns the preferences (these preferences are persisted locally).
|
|
74
121
|
*
|
|
@@ -77,19 +124,30 @@ const MIGRATED_KEYS = ['hiddenBlockTypes'];
|
|
|
77
124
|
* @return {Object} Preferences Object.
|
|
78
125
|
*/
|
|
79
126
|
|
|
80
|
-
|
|
81
|
-
|
|
127
|
+
|
|
128
|
+
export const getPreferences = createRegistrySelector(select => () => {
|
|
129
|
+
deprecated(`wp.data.select( 'core/edit-post' ).getPreferences`, {
|
|
130
|
+
since: '6.0',
|
|
131
|
+
alternative: `wp.data.select( 'core/preferences' ).get`
|
|
132
|
+
}); // These preferences now exist in the preferences store.
|
|
82
133
|
// Fetch them so that they can be merged into the post
|
|
83
134
|
// editor preferences.
|
|
84
135
|
|
|
85
|
-
const
|
|
136
|
+
const preferences = ['hiddenBlockTypes', 'editorMode', 'preferredStyleVariations'].reduce((accumulatedPrefs, preferenceKey) => {
|
|
86
137
|
const value = select(preferencesStore).get('core/edit-post', preferenceKey);
|
|
87
138
|
return { ...accumulatedPrefs,
|
|
88
139
|
[preferenceKey]: value
|
|
89
140
|
};
|
|
90
|
-
}, {});
|
|
91
|
-
|
|
92
|
-
|
|
141
|
+
}, {}); // Panels were a preference, but the data structure changed when the state
|
|
142
|
+
// was migrated to the preferences store. They need to be converted from
|
|
143
|
+
// the new preferences store format to old format to ensure no breaking
|
|
144
|
+
// changes for plugins.
|
|
145
|
+
|
|
146
|
+
const inactivePanels = select(preferencesStore).get('core/edit-post', 'inactivePanels');
|
|
147
|
+
const openPanels = select(preferencesStore).get('core/edit-post', 'openPanels');
|
|
148
|
+
const panels = convertPanelsToOldFormat(inactivePanels, openPanels);
|
|
149
|
+
return { ...preferences,
|
|
150
|
+
panels
|
|
93
151
|
};
|
|
94
152
|
});
|
|
95
153
|
/**
|
|
@@ -102,9 +160,12 @@ export const getPreferences = createRegistrySelector(select => state => {
|
|
|
102
160
|
*/
|
|
103
161
|
|
|
104
162
|
export function getPreference(state, preferenceKey, defaultValue) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
163
|
+
deprecated(`wp.data.select( 'core/edit-post' ).getPreference`, {
|
|
164
|
+
since: '6.0',
|
|
165
|
+
alternative: `wp.data.select( 'core/preferences' ).get`
|
|
166
|
+
}); // Avoid using the `getPreferences` registry selector where possible.
|
|
167
|
+
|
|
168
|
+
const preferences = getPreferences(state);
|
|
108
169
|
const value = preferences[preferenceKey];
|
|
109
170
|
return value === undefined ? defaultValue : value;
|
|
110
171
|
}
|
|
@@ -115,9 +176,9 @@ export function getPreference(state, preferenceKey, defaultValue) {
|
|
|
115
176
|
*/
|
|
116
177
|
|
|
117
178
|
export const getHiddenBlockTypes = createRegistrySelector(select => () => {
|
|
118
|
-
var _select$
|
|
179
|
+
var _select$get2;
|
|
119
180
|
|
|
120
|
-
return (_select$
|
|
181
|
+
return (_select$get2 = select(preferencesStore).get('core/edit-post', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY;
|
|
121
182
|
});
|
|
122
183
|
/**
|
|
123
184
|
* Returns true if the publish sidebar is opened.
|
|
@@ -153,10 +214,10 @@ export function isEditorPanelRemoved(state, panelName) {
|
|
|
153
214
|
* @return {boolean} Whether or not the panel is enabled.
|
|
154
215
|
*/
|
|
155
216
|
|
|
156
|
-
export
|
|
157
|
-
const
|
|
158
|
-
return !isEditorPanelRemoved(state, panelName) &&
|
|
159
|
-
}
|
|
217
|
+
export const isEditorPanelEnabled = createRegistrySelector(select => (state, panelName) => {
|
|
218
|
+
const inactivePanels = select(preferencesStore).get('core/edit-post', 'inactivePanels');
|
|
219
|
+
return !isEditorPanelRemoved(state, panelName) && !(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName));
|
|
220
|
+
});
|
|
160
221
|
/**
|
|
161
222
|
* Returns true if the given panel is open, or false otherwise. Panels are
|
|
162
223
|
* closed by default.
|
|
@@ -167,10 +228,10 @@ export function isEditorPanelEnabled(state, panelName) {
|
|
|
167
228
|
* @return {boolean} Whether or not the panel is open.
|
|
168
229
|
*/
|
|
169
230
|
|
|
170
|
-
export
|
|
171
|
-
const
|
|
172
|
-
return
|
|
173
|
-
}
|
|
231
|
+
export const isEditorPanelOpened = createRegistrySelector(select => (state, panelName) => {
|
|
232
|
+
const openPanels = select(preferencesStore).get('core/edit-post', 'openPanels');
|
|
233
|
+
return !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName));
|
|
234
|
+
});
|
|
174
235
|
/**
|
|
175
236
|
* Returns true if a modal is active, or false otherwise.
|
|
176
237
|
*
|
|
@@ -229,10 +290,10 @@ export const getActiveMetaBoxLocations = createSelector(state => {
|
|
|
229
290
|
*/
|
|
230
291
|
|
|
231
292
|
export function isMetaBoxLocationVisible(state, location) {
|
|
232
|
-
return isMetaBoxLocationActive(state, location) && some(getMetaBoxesPerLocation(state, location),
|
|
293
|
+
return isMetaBoxLocationActive(state, location) && some(getMetaBoxesPerLocation(state, location), _ref2 => {
|
|
233
294
|
let {
|
|
234
295
|
id
|
|
235
|
-
} =
|
|
296
|
+
} = _ref2;
|
|
236
297
|
return isEditorPanelEnabled(state, `meta-box-${id}`);
|
|
237
298
|
});
|
|
238
299
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["createSelector","get","includes","some","flatten","values","createRegistrySelector","store","interfaceStore","preferencesStore","coreStore","editorStore","EMPTY_ARRAY","getEditorMode","state","getPreference","isEditorSidebarOpened","select","activeGeneralSidebar","getActiveComplementaryArea","isPluginSidebarOpened","getActiveGeneralSidebarName","MIGRATED_KEYS","getPreferences","editPostPreferences","preferences","preferenceStorePreferences","reduce","accumulatedPrefs","preferenceKey","value","defaultValue","isMigratedKey","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","panelName","removedPanels","isEditorPanelEnabled","panels","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","id","length","getAllMetaBoxes","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","getEditedPostAttribute","templateWithSameSlug","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,QAAd,EAAwBC,IAAxB,EAA8BC,OAA9B,EAAuCC,MAAvC,QAAqD,QAArD;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AACA,SAASF,KAAK,IAAIG,SAAlB,QAAmC,sBAAnC;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,mBAArC;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AACtC,SAAOC,aAAa,CAAED,KAAF,EAAS,YAAT,EAAuB,QAAvB,CAApB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,qBAAqB,GAAGV,sBAAsB,CACxDW,MAAF,IAAc,MAAM;AACnB,QAAMC,oBAAoB,GAAGD,MAAM,CAClCT,cADkC,CAAN,CAE3BW,0BAF2B,CAEC,gBAFD,CAA7B;AAGA,SAAOjB,QAAQ,CACd,CAAE,oBAAF,EAAwB,iBAAxB,CADc,EAEdgB,oBAFc,CAAf;AAIA,CATyD,CAApD;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,qBAAqB,GAAGd,sBAAsB,CACxDW,MAAF,IAAc,MAAM;AACnB,QAAMC,oBAAoB,GAAGD,MAAM,CACl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ME,oBAAoB,4BAAGlE,MAAM,CAAEP,SAAF,CAAN,CAC3B0E,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBP,eAFd,CAA7B;;AAGA,QAAK,CAAEE,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAOlE,MAAM,CAAEP,SAAF,CAAN,CAAoB+E,qBAApB,CACN,UADM,EAEN,aAFM,EAGNN,oBAAoB,CAACtB,EAHf,CAAP;AAKA;;AAED,QAAM6B,IAAI,GAAGzE,MAAM,CAAEN,WAAF,CAAN,CAAsBgF,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAO3E,MAAM,CAAEP,SAAF,CAAN,CAAoBmF,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3ByD,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { get, includes, some, flatten, values } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn getPreference( state, 'editorMode', 'visual' );\n}\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn includes(\n\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! includes(\n\t\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n// The current list of preference keys that have been migrated to the\n// preferences package.\nconst MIGRATED_KEYS = [ 'hiddenBlockTypes' ];\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst editPostPreferences = state.preferences;\n\n\t\t// Some preferences now exist in the preferences store.\n\t\t// Fetch them so that they can be merged into the post\n\t\t// editor preferences.\n\t\tconst preferenceStorePreferences = MIGRATED_KEYS.reduce(\n\t\t\t( accumulatedPrefs, preferenceKey ) => {\n\t\t\t\tconst value = select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\tpreferenceKey\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\t...accumulatedPrefs,\n\t\t\t\t\t[ preferenceKey ]: value,\n\t\t\t\t};\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\treturn {\n\t\t\t...editPostPreferences,\n\t\t\t...preferenceStorePreferences,\n\t\t};\n\t}\n);\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst isMigratedKey = MIGRATED_KEYS.includes( preferenceKey );\n\tconst preferences = isMigratedKey\n\t\t? getPreferences( state )\n\t\t: state.preferences;\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn includes( state.removedPanels, panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport function isEditorPanelEnabled( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\n\treturn (\n\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\tget( panels, [ panelName, 'enabled' ], true )\n\t);\n}\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport function isEditorPanelOpened( state, panelName ) {\n\tconst panels = getPreference( state, 'panels' );\n\treturn (\n\t\tget( panels, [ panelName ] ) === true ||\n\t\tget( panels, [ panelName, 'opened' ] ) === true\n\t);\n}\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tsome( getMetaBoxesPerLocation( state, location ), ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn flatten( values( state.metaBoxes.locations ) );\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate = select( editorStore ).getEditedPostAttribute(\n\t\t\t'template'\n\t\t);\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/store/selectors.js"],"names":["createSelector","includes","some","flatten","values","createRegistrySelector","store","interfaceStore","preferencesStore","coreStore","editorStore","deprecated","EMPTY_ARRAY","EMPTY_OBJECT","getEditorMode","select","get","isEditorSidebarOpened","activeGeneralSidebar","getActiveComplementaryArea","isPluginSidebarOpened","getActiveGeneralSidebarName","convertPanelsToOldFormat","inactivePanels","openPanels","panelsWithEnabledState","reduce","accumulatedPanels","panelName","enabled","panels","currentPanelState","opened","getPreferences","since","alternative","preferences","accumulatedPrefs","preferenceKey","value","getPreference","state","defaultValue","undefined","getHiddenBlockTypes","isPublishSidebarOpened","publishSidebarActive","isEditorPanelRemoved","removedPanels","isEditorPanelEnabled","isEditorPanelOpened","isModalActive","modalName","activeModal","isFeatureActive","feature","isPluginItemPinned","pluginName","isItemPinned","getActiveMetaBoxLocations","Object","keys","metaBoxes","locations","filter","location","isMetaBoxLocationActive","isMetaBoxLocationVisible","getMetaBoxesPerLocation","id","length","getAllMetaBoxes","hasMetaBoxes","isSavingMetaBoxes","isSaving","__experimentalGetPreviewDeviceType","deviceType","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","isEditingTemplate","areMetaBoxesInitialized","initialized","getEditedPostTemplate","currentTemplate","getEditedPostAttribute","templateWithSameSlug","getEntityRecords","per_page","find","template","slug","getEditedEntityRecord","post","getCurrentPost","link","__experimentalGetTemplateForLink"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,QAAT,EAAmBC,IAAnB,EAAyBC,OAAzB,EAAk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4BAAG5E,MAAM,CAAEN,SAAF,CAAN,CAC3BmF,gBAD2B,CACT,UADS,EACG,aADH,EACkB;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KADlB,CAAH,0DAAG,sBAE1BC,IAF0B,CAElBC,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBP,eAFd,CAA7B;;AAGA,QAAK,CAAEE,oBAAP,EAA8B;AAC7B,aAAOA,oBAAP;AACA;;AACD,WAAO5E,MAAM,CAAEN,SAAF,CAAN,CAAoBwF,qBAApB,CACN,UADM,EAEN,aAFM,EAGNN,oBAAoB,CAACtB,EAHf,CAAP;AAKA;;AAED,QAAM6B,IAAI,GAAGnF,MAAM,CAAEL,WAAF,CAAN,CAAsByF,cAAtB,EAAb;;AACA,MAAKD,IAAI,CAACE,IAAV,EAAiB;AAChB,WAAOrF,MAAM,CAAEN,SAAF,CAAN,CAAoB4F,gCAApB,CACNH,IAAI,CAACE,IADC,CAAP;AAGA;;AAED,SAAO,IAAP;AACA,CA3ByD,CAApD","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { includes, some, flatten, values } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () =>\n\tselect( preferencesStore ).get( 'core/edit-post', 'editorMode' ) ?? 'visual'\n);\n\n/**\n * Returns true if the editor sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the editor sidebar is opened.\n */\nexport const isEditorSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn includes(\n\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\tactiveGeneralSidebar\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the plugin sidebar is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the plugin sidebar is opened.\n */\nexport const isPluginSidebarOpened = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst activeGeneralSidebar = select(\n\t\t\tinterfaceStore\n\t\t).getActiveComplementaryArea( 'core/edit-post' );\n\t\treturn (\n\t\t\t!! activeGeneralSidebar &&\n\t\t\t! includes(\n\t\t\t\t[ 'edit-post/document', 'edit-post/block' ],\n\t\t\t\tactiveGeneralSidebar\n\t\t\t)\n\t\t);\n\t}\n);\n\n/**\n * Returns the current active general sidebar name, or null if there is no\n * general sidebar active. The active general sidebar is a unique name to\n * identify either an editor or plugin sidebar.\n *\n * Examples:\n *\n * - `edit-post/document`\n * - `my-plugin/insert-image-sidebar`\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} Active general sidebar name.\n */\nexport const getActiveGeneralSidebarName = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t'core/edit-post'\n\t\t);\n\t}\n);\n\n/**\n * Converts panels from the new preferences store format to the old format\n * that the post editor previously used.\n *\n * The resultant converted data should look like this:\n * {\n * panelName: {\n * enabled: false,\n * opened: true,\n * },\n * anotherPanelName: {\n * opened: true\n * },\n * }\n *\n * @param {string[] | undefined} inactivePanels An array of inactive panel names.\n * @param {string[] | undefined} openPanels An array of open panel names.\n *\n * @return {Object} The converted panel data.\n */\nfunction convertPanelsToOldFormat( inactivePanels, openPanels ) {\n\t// First reduce the inactive panels.\n\tconst panelsWithEnabledState = inactivePanels?.reduce(\n\t\t( accumulatedPanels, panelName ) => ( {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t} ),\n\t\t{}\n\t);\n\n\t// Then reduce the open panels, passing in the result of the previous\n\t// reduction as the initial value so that both open and inactive\n\t// panel state is combined.\n\tconst panels = openPanels?.reduce( ( accumulatedPanels, panelName ) => {\n\t\tconst currentPanelState = accumulatedPanels?.[ panelName ];\n\t\treturn {\n\t\t\t...accumulatedPanels,\n\t\t\t[ panelName ]: {\n\t\t\t\t...currentPanelState,\n\t\t\t\topened: true,\n\t\t\t},\n\t\t};\n\t}, panelsWithEnabledState ?? {} );\n\n\t// The panels variable will only be set if openPanels wasn't `undefined`.\n\t// If it isn't set just return `panelsWithEnabledState`, and if that isn't\n\t// set return an empty object.\n\treturn panels ?? panelsWithEnabledState ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the preferences (these preferences are persisted locally).\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Preferences Object.\n */\nexport const getPreferences = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `wp.data.select( 'core/edit-post' ).getPreferences`, {\n\t\tsince: '6.0',\n\t\talternative: `wp.data.select( 'core/preferences' ).get`,\n\t} );\n\n\t// These preferences now exist in the preferences store.\n\t// Fetch them so that they can be merged into the post\n\t// editor preferences.\n\tconst preferences = [\n\t\t'hiddenBlockTypes',\n\t\t'editorMode',\n\t\t'preferredStyleVariations',\n\t].reduce( ( accumulatedPrefs, preferenceKey ) => {\n\t\tconst value = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\tpreferenceKey\n\t\t);\n\n\t\treturn {\n\t\t\t...accumulatedPrefs,\n\t\t\t[ preferenceKey ]: value,\n\t\t};\n\t}, {} );\n\n\t// Panels were a preference, but the data structure changed when the state\n\t// was migrated to the preferences store. They need to be converted from\n\t// the new preferences store format to old format to ensure no breaking\n\t// changes for plugins.\n\tconst inactivePanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'inactivePanels'\n\t);\n\tconst openPanels = select( preferencesStore ).get(\n\t\t'core/edit-post',\n\t\t'openPanels'\n\t);\n\tconst panels = convertPanelsToOldFormat( inactivePanels, openPanels );\n\n\treturn {\n\t\t...preferences,\n\t\tpanels,\n\t};\n} );\n\n/**\n *\n * @param {Object} state Global application state.\n * @param {string} preferenceKey Preference Key.\n * @param {*} defaultValue Default Value.\n *\n * @return {*} Preference Value.\n */\nexport function getPreference( state, preferenceKey, defaultValue ) {\n\tdeprecated( `wp.data.select( 'core/edit-post' ).getPreference`, {\n\t\tsince: '6.0',\n\t\talternative: `wp.data.select( 'core/preferences' ).get`,\n\t} );\n\n\t// Avoid using the `getPreferences` registry selector where possible.\n\tconst preferences = getPreferences( state );\n\tconst value = preferences[ preferenceKey ];\n\treturn value === undefined ? defaultValue : value;\n}\n\n/**\n * Returns an array of blocks that are hidden.\n *\n * @return {Array} A list of the hidden block types\n */\nexport const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {\n\treturn (\n\t\tselect( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'hiddenBlockTypes'\n\t\t) ?? EMPTY_ARRAY\n\t);\n} );\n\n/**\n * Returns true if the publish sidebar is opened.\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether the publish sidebar is open.\n */\nexport function isPublishSidebarOpened( state ) {\n\treturn state.publishSidebarActive;\n}\n\n/**\n * Returns true if the given panel was programmatically removed, or false otherwise.\n * All panels are not removed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is removed.\n */\nexport function isEditorPanelRemoved( state, panelName ) {\n\treturn includes( state.removedPanels, panelName );\n}\n\n/**\n * Returns true if the given panel is enabled, or false otherwise. Panels are\n * enabled by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is enabled.\n */\nexport const isEditorPanelEnabled = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst inactivePanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'inactivePanels'\n\t\t);\n\t\treturn (\n\t\t\t! isEditorPanelRemoved( state, panelName ) &&\n\t\t\t! inactivePanels?.includes( panelName )\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the given panel is open, or false otherwise. Panels are\n * closed by default.\n *\n * @param {Object} state Global application state.\n * @param {string} panelName A string that identifies the panel.\n *\n * @return {boolean} Whether or not the panel is open.\n */\nexport const isEditorPanelOpened = createRegistrySelector(\n\t( select ) => ( state, panelName ) => {\n\t\tconst openPanels = select( preferencesStore ).get(\n\t\t\t'core/edit-post',\n\t\t\t'openPanels'\n\t\t);\n\t\treturn !! openPanels?.includes( panelName );\n\t}\n);\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, feature ) => {\n\t\treturn !! select( preferencesStore ).get( 'core/edit-post', feature );\n\t}\n);\n\n/**\n * Returns true if the plugin item is pinned to the header.\n * When the value is not set it defaults to true.\n *\n * @param {Object} state Global application state.\n * @param {string} pluginName Plugin item name.\n *\n * @return {boolean} Whether the plugin item is pinned.\n */\nexport const isPluginItemPinned = createRegistrySelector(\n\t( select ) => ( state, pluginName ) => {\n\t\treturn select( interfaceStore ).isItemPinned(\n\t\t\t'core/edit-post',\n\t\t\tpluginName\n\t\t);\n\t}\n);\n\n/**\n * Returns an array of active meta box locations.\n *\n * @param {Object} state Post editor state.\n *\n * @return {string[]} Active meta box locations.\n */\nexport const getActiveMetaBoxLocations = createSelector(\n\t( state ) => {\n\t\treturn Object.keys( state.metaBoxes.locations ).filter( ( location ) =>\n\t\t\tisMetaBoxLocationActive( state, location )\n\t\t);\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if a metabox location is active and visible\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active and visible.\n */\nexport function isMetaBoxLocationVisible( state, location ) {\n\treturn (\n\t\tisMetaBoxLocationActive( state, location ) &&\n\t\tsome( getMetaBoxesPerLocation( state, location ), ( { id } ) => {\n\t\t\treturn isEditorPanelEnabled( state, `meta-box-${ id }` );\n\t\t} )\n\t);\n}\n\n/**\n * Returns true if there is an active meta box in the given location, or false\n * otherwise.\n *\n * @param {Object} state Post editor state.\n * @param {string} location Meta box location to test.\n *\n * @return {boolean} Whether the meta box location is active.\n */\nexport function isMetaBoxLocationActive( state, location ) {\n\tconst metaBoxes = getMetaBoxesPerLocation( state, location );\n\treturn !! metaBoxes && metaBoxes.length !== 0;\n}\n\n/**\n * Returns the list of all the available meta boxes for a given location.\n *\n * @param {Object} state Global application state.\n * @param {string} location Meta box location to test.\n *\n * @return {?Array} List of meta boxes.\n */\nexport function getMetaBoxesPerLocation( state, location ) {\n\treturn state.metaBoxes.locations[ location ];\n}\n\n/**\n * Returns the list of all the available meta boxes.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} List of meta boxes.\n */\nexport const getAllMetaBoxes = createSelector(\n\t( state ) => {\n\t\treturn flatten( values( state.metaBoxes.locations ) );\n\t},\n\t( state ) => [ state.metaBoxes.locations ]\n);\n\n/**\n * Returns true if the post is using Meta Boxes\n *\n * @param {Object} state Global application state\n *\n * @return {boolean} Whether there are metaboxes or not.\n */\nexport function hasMetaBoxes( state ) {\n\treturn getActiveMetaBoxLocations( state ).length > 0;\n}\n\n/**\n * Returns true if the Meta Boxes are being saved.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the metaboxes are being saved.\n */\nexport function isSavingMetaBoxes( state ) {\n\treturn state.metaBoxes.isSaving;\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns true if the template editing mode is enabled.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether we're editing the template.\n */\nexport function isEditingTemplate( state ) {\n\treturn state.isEditingTemplate;\n}\n\n/**\n * Returns true if meta boxes are initialized.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether meta boxes are initialized.\n */\nexport function areMetaBoxesInitialized( state ) {\n\treturn state.metaBoxes.initialized;\n}\n\n/**\n * Retrieves the template of the currently edited post.\n *\n * @return {Object?} Post Template.\n */\nexport const getEditedPostTemplate = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst currentTemplate = select( editorStore ).getEditedPostAttribute(\n\t\t\t'template'\n\t\t);\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = select( coreStore )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )\n\t\t\t\t?.find( ( template ) => template.slug === currentTemplate );\n\t\t\tif ( ! templateWithSameSlug ) {\n\t\t\t\treturn templateWithSameSlug;\n\t\t\t}\n\t\t\treturn select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplateWithSameSlug.id\n\t\t\t);\n\t\t}\n\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tif ( post.link ) {\n\t\t\treturn select( coreStore ).__experimentalGetTemplateForLink(\n\t\t\t\tpost.link\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n);\n"]}
|
|
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
304
304
|
display: flex;
|
|
305
305
|
flex-direction: column;
|
|
306
306
|
overflow: auto;
|
|
307
|
-
z-index:
|
|
307
|
+
z-index: 20;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
.interface-interface-skeleton__secondary-sidebar,
|
|
@@ -1782,6 +1782,44 @@ h2.edit-post-template-summary__title {
|
|
|
1782
1782
|
fill: #fff;
|
|
1783
1783
|
}
|
|
1784
1784
|
|
|
1785
|
+
@media (min-width: 600px) {
|
|
1786
|
+
.edit-post-start-page-options__modal {
|
|
1787
|
+
width: calc(100% - 32px);
|
|
1788
|
+
height: calc(100% - 120px);
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
@media (min-width: 782px) {
|
|
1792
|
+
.edit-post-start-page-options__modal {
|
|
1793
|
+
width: 750px;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
@media (min-width: 960px) {
|
|
1797
|
+
.edit-post-start-page-options__modal {
|
|
1798
|
+
height: 70%;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
.edit-post-start-page-options__modal .components-modal__header {
|
|
1802
|
+
border-bottom: none;
|
|
1803
|
+
}
|
|
1804
|
+
.edit-post-start-page-options__modal .components-modal__content::before {
|
|
1805
|
+
content: none;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
1809
|
+
column-count: 2;
|
|
1810
|
+
column-gap: 24px;
|
|
1811
|
+
}
|
|
1812
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
|
|
1813
|
+
break-inside: avoid-column;
|
|
1814
|
+
margin-bottom: 24px;
|
|
1815
|
+
}
|
|
1816
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
|
|
1817
|
+
min-height: 100px;
|
|
1818
|
+
}
|
|
1819
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
|
|
1820
|
+
width: 100%;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1785
1823
|
/**
|
|
1786
1824
|
* Animations
|
|
1787
1825
|
*/
|
|
@@ -1891,9 +1929,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
|
1891
1929
|
max-width: 100%;
|
|
1892
1930
|
height: auto;
|
|
1893
1931
|
}
|
|
1894
|
-
.block-editor__container iframe {
|
|
1895
|
-
width: 100%;
|
|
1896
|
-
}
|
|
1897
1932
|
|
|
1898
1933
|
body.admin-color-light {
|
|
1899
1934
|
--wp-admin-theme-color: #0085ba;
|
package/build-style/style.css
CHANGED
|
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
304
304
|
display: flex;
|
|
305
305
|
flex-direction: column;
|
|
306
306
|
overflow: auto;
|
|
307
|
-
z-index:
|
|
307
|
+
z-index: 20;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
.interface-interface-skeleton__secondary-sidebar,
|
|
@@ -1786,6 +1786,44 @@ h2.edit-post-template-summary__title {
|
|
|
1786
1786
|
fill: #fff;
|
|
1787
1787
|
}
|
|
1788
1788
|
|
|
1789
|
+
@media (min-width: 600px) {
|
|
1790
|
+
.edit-post-start-page-options__modal {
|
|
1791
|
+
width: calc(100% - 32px);
|
|
1792
|
+
height: calc(100% - 120px);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
@media (min-width: 782px) {
|
|
1796
|
+
.edit-post-start-page-options__modal {
|
|
1797
|
+
width: 750px;
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
@media (min-width: 960px) {
|
|
1801
|
+
.edit-post-start-page-options__modal {
|
|
1802
|
+
height: 70%;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
.edit-post-start-page-options__modal .components-modal__header {
|
|
1806
|
+
border-bottom: none;
|
|
1807
|
+
}
|
|
1808
|
+
.edit-post-start-page-options__modal .components-modal__content::before {
|
|
1809
|
+
content: none;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
1813
|
+
column-count: 2;
|
|
1814
|
+
column-gap: 24px;
|
|
1815
|
+
}
|
|
1816
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
|
|
1817
|
+
break-inside: avoid-column;
|
|
1818
|
+
margin-bottom: 24px;
|
|
1819
|
+
}
|
|
1820
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
|
|
1821
|
+
min-height: 100px;
|
|
1822
|
+
}
|
|
1823
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
|
|
1824
|
+
width: 100%;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1789
1827
|
/**
|
|
1790
1828
|
* Animations
|
|
1791
1829
|
*/
|
|
@@ -1895,9 +1933,6 @@ body.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
|
1895
1933
|
max-width: 100%;
|
|
1896
1934
|
height: auto;
|
|
1897
1935
|
}
|
|
1898
|
-
.block-editor__container iframe {
|
|
1899
|
-
width: 100%;
|
|
1900
|
-
}
|
|
1901
1936
|
|
|
1902
1937
|
body.admin-color-light {
|
|
1903
1938
|
--wp-admin-theme-color: #0085ba;
|