@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
package/build/index.js
CHANGED
|
@@ -173,9 +173,14 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
173
173
|
const target = document.getElementById(id);
|
|
174
174
|
const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
|
|
175
175
|
(0, _data.dispatch)(_preferences.store).setDefaults('core/edit-post', {
|
|
176
|
+
editorMode: 'visual',
|
|
176
177
|
fixedToolbar: false,
|
|
177
178
|
fullscreenMode: true,
|
|
178
179
|
hiddenBlockTypes: [],
|
|
180
|
+
inactivePanels: [],
|
|
181
|
+
isPublishSidebarEnabled: true,
|
|
182
|
+
openPanels: ['post-status'],
|
|
183
|
+
preferredStyleVariations: {},
|
|
179
184
|
showBlockBreadcrumbs: true,
|
|
180
185
|
showIconLabels: false,
|
|
181
186
|
themeStyles: true,
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/index.js"],"names":["reinitializeEditor","postType","postId","target","settings","initialEdits","reboot","bind","initializeEditor","id","can","blockType","editPostStore","isEditingTemplate","name","document","getElementById","preferencesStore","setDefaults","fixedToolbar","fullscreenMode","hiddenBlockTypes","showBlockBreadcrumbs","showIconLabels","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;AALA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAgKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA5LA;AACA;AACA;;AAWA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CACNC,QADM,EAENC,MAFM,EAGNC,MAHM,EAINC,QAJM,EAKNC,YALM,EAML;AACD,uCAAwBF,MAAxB;AACA,QAAMG,MAAM,GAAGN,kBAAkB,CAACO,IAAnB,CACd,IADc,EAEdN,QAFc,EAGdC,MAHc,EAIdC,MAJc,EAKdC,QALc,EAMdC,YANc,CAAf;AASA,uBACC,4BAAC,eAAD;AACC,IAAA,QAAQ,EAAGD,QADZ;AAEC,IAAA,OAAO,E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ADmB,KAA9C;AAGA,GA5CA,CA8CD;;;AACA,QAAMC,YAAY,GACjBnB,QAAQ,CAACoB,UAAT,KAAwB,YAAxB,GAAuC,WAAvC,GAAqD,QADtD;;AAEA,MAAKD,YAAY,KAAK,WAAtB,EAAoC;AACnC;AACAE,IAAAA,OAAO,CAACC,IAAR,CACC,sXADD;AAGA,GAtDA,CAwDD;AACA;AACA;AACA;AACA;AACA;;;AAEA,QAAMC,QAAQ,GAAGC,MAAM,CAACC,SAAP,CAAiBC,SAAjB,CAA2BC,OAA3B,CAAoC,QAApC,MAAmD,CAAC,CAArE;;AACA,MAAKJ,QAAL,EAAgB;AACfC,IAAAA,MAAM,CAACI,gBAAP,CAAyB,QAAzB,EAAqCC,KAAF,IAAa;AAC/C,YAAMC,qBAAqB,GAAG9B,QAAQ,CAAC+B,sBAAT,CAC7B,oCAD6B,EAE3B,CAF2B,CAA9B;;AAGA,UAAKF,KAAK,CAACzC,MAAN,KAAiBY,QAAtB,EAAiC;AAChC;AACA;AACA,YAAKwB,MAAM,CAACQ,OAAP,GAAiB,GAAtB,EAA4B;AAC3BF,UAAAA,qBAAqB,CAACG,SAAtB,GACCH,qBAAqB,CAACG,SAAtB,GAAkCT,MAAM,CAACQ,OAD1C;AAEA,SAN+B,CAOhC;;;AACA,YACChC,QAAQ,CAAC+B,sBAAT,CAAiC,gBAAjC,EAAqD,CAArD,CADD,EAEE;AACDP,UAAAA,MAAM,CAACU,QAAP,CAAiB,CAAjB,EAAoB,CAApB;AACA;AACD;AACD,KAlBD;AAmBA;;AAED,uBACC,4BAAC,eAAD;AACC,IAAA,QAAQ,EAAG7C,QADZ;AAEC,IAAA,OAAO,EAAGE,MAFX;AAGC,IAAA,MAAM,EAAGJ,MAHV;AAIC,IAAA,QAAQ,EAAGD,QAJZ;AAKC,IAAA,YAAY,EAAGI;AALhB,IADD,EAQCF,MARD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function reinitializeEditor(\n\tpostType,\n\tpostId,\n\ttarget,\n\tsettings,\n\tinitialEdits\n) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind(\n\t\tnull,\n\t\tpostType,\n\t\tpostId,\n\t\ttarget,\n\t\tsettings,\n\t\tinitialEdits\n\t);\n\n\trender(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tonError={ reboot }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t\trecovery\n\t\t/>,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\t// Prevent adding template part in the post editor.\n\t// Only add the filter when the post editor is initialized, not imported.\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( can, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn can;\n\t\t}\n\t);\n\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind(\n\t\tnull,\n\t\tpostType,\n\t\tpostId,\n\t\ttarget,\n\t\tsettings,\n\t\tinitialEdits\n\t);\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\trender(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tonError={ reboot }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>,\n\t\ttarget\n\t);\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { store } from './store';\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/index.js"],"names":["reinitializeEditor","postType","postId","target","settings","initialEdits","reboot","bind","initializeEditor","id","can","blockType","editPostStore","isEditingTemplate","name","document","getElementById","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;AALA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAqKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjMA;AACA;AACA;;AAWA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CACNC,QADM,EAENC,MAFM,EAGNC,MAHM,EAINC,QAJM,EAKNC,YALM,EAML;AACD,uCAAwBF,MAAxB;AACA,QAAMG,MAAM,GAAGN,kBAAkB,CAACO,IAAnB,CACd,IADc,EAEdN,QAFc,EAGdC,MAHc,EAIdC,MAJc,EAKdC,QALc,EAMdC,YANc,CAAf;AASA,uBACC,4BAAC,eAAD;AACC,IAAA,QAAQ,EAAGD,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C,IAAA,OAAO,EAAGE,MAFX;AAGC,IAAA,MAAM,EAAGJ,MAHV;AAIC,IAAA,QAAQ,EAAGD,QAJZ;AAKC,IAAA,YAAY,EAAGI;AALhB,IADD,EAQCF,MARD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function reinitializeEditor(\n\tpostType,\n\tpostId,\n\ttarget,\n\tsettings,\n\tinitialEdits\n) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind(\n\t\tnull,\n\t\tpostType,\n\t\tpostId,\n\t\ttarget,\n\t\tsettings,\n\t\tinitialEdits\n\t);\n\n\trender(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tonError={ reboot }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t\trecovery\n\t\t/>,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\t// Prevent adding template part in the post editor.\n\t// Only add the filter when the post editor is initialized, not imported.\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( can, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn can;\n\t\t}\n\t);\n\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind(\n\t\tnull,\n\t\tpostType,\n\t\tpostId,\n\t\ttarget,\n\t\tsettings,\n\t\tinitialEdits\n\t);\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\trender(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tonError={ reboot }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>,\n\t\ttarget\n\t);\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { store } from './store';\n"]}
|
package/build/index.native.js
CHANGED
|
@@ -19,6 +19,10 @@ require("@wordpress/core-data");
|
|
|
19
19
|
|
|
20
20
|
require("@wordpress/format-library");
|
|
21
21
|
|
|
22
|
+
var _data = require("@wordpress/data");
|
|
23
|
+
|
|
24
|
+
var _preferences = require("@wordpress/preferences");
|
|
25
|
+
|
|
22
26
|
var _store = require("./store");
|
|
23
27
|
|
|
24
28
|
var _editor = _interopRequireDefault(require("./editor"));
|
|
@@ -40,6 +44,17 @@ var _editor = _interopRequireDefault(require("./editor"));
|
|
|
40
44
|
* @param {Object} postId ID of the post to edit (unused right now)
|
|
41
45
|
*/
|
|
42
46
|
function initializeEditor(id, postType, postId) {
|
|
47
|
+
(0, _data.dispatch)(_preferences.store).setDefaults('core/edit-post', {
|
|
48
|
+
editorMode: 'visual',
|
|
49
|
+
fixedToolbar: false,
|
|
50
|
+
fullscreenMode: true,
|
|
51
|
+
hiddenBlockTypes: [],
|
|
52
|
+
inactivePanels: [],
|
|
53
|
+
isPublishSidebarEnabled: true,
|
|
54
|
+
openPanels: ['post-status'],
|
|
55
|
+
preferredStyleVariations: {},
|
|
56
|
+
welcomeGuide: true
|
|
57
|
+
});
|
|
43
58
|
return (0, _element.createElement)(_editor.default, {
|
|
44
59
|
postId: postId,
|
|
45
60
|
postType: postType
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/index.native.js"],"names":["initializeEditor","id","postType","postId"],"mappings":";;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/index.native.js"],"names":["initializeEditor","id","postType","postId","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","welcomeGuide"],"mappings":";;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAAyCC,MAAzC,EAAkD;AACxD,sBAAUC,kBAAV,EAA6BC,WAA7B,CAA0C,gBAA1C,EAA4D;AAC3DC,IAAAA,UAAU,EAAE,QAD+C;AAE3DC,IAAAA,YAAY,EAAE,KAF6C;AAG3DC,IAAAA,cAAc,EAAE,IAH2C;AAI3DC,IAAAA,gBAAgB,EAAE,EAJyC;AAK3DC,IAAAA,cAAc,EAAE,EAL2C;AAM3DC,IAAAA,uBAAuB,EAAE,IANkC;AAO3DC,IAAAA,UAAU,EAAE,CAAE,aAAF,CAP+C;AAQ3DC,IAAAA,wBAAwB,EAAE,EARiC;AAS3DC,IAAAA,YAAY,EAAE;AAT6C,GAA5D;AAYA,SAAO,4BAAC,eAAD;AAAQ,IAAA,MAAM,EAAGX,MAAjB;AAA0B,IAAA,QAAQ,EAAGD;AAArC,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\twelcomeGuide: true,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"]}
|
package/build/store/actions.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.__experimentalSetPreviewDeviceType = __experimentalSetPreviewDeviceType;
|
|
9
|
-
exports.__experimentalUpdateLocalAutosaveInterval = __experimentalUpdateLocalAutosaveInterval;
|
|
10
9
|
exports.closeGeneralSidebar = exports.__unstableSwitchToTemplateMode = exports.__unstableCreateTemplate = void 0;
|
|
11
10
|
exports.closeModal = closeModal;
|
|
12
11
|
exports.closePublishSidebar = closePublishSidebar;
|
|
@@ -21,12 +20,9 @@ exports.setAvailableMetaBoxesPerLocation = exports.requestMetaBoxUpdates = void
|
|
|
21
20
|
exports.setIsEditingTemplate = setIsEditingTemplate;
|
|
22
21
|
exports.setIsInserterOpened = setIsInserterOpened;
|
|
23
22
|
exports.setIsListViewOpened = setIsListViewOpened;
|
|
24
|
-
exports.switchEditorMode = exports.showBlockTypes = void 0;
|
|
25
|
-
exports.toggleEditorPanelEnabled = toggleEditorPanelEnabled;
|
|
26
|
-
exports.toggleEditorPanelOpened = toggleEditorPanelOpened;
|
|
27
|
-
exports.togglePinnedPluginItem = exports.toggleFeature = void 0;
|
|
23
|
+
exports.togglePinnedPluginItem = exports.toggleFeature = exports.toggleEditorPanelOpened = exports.toggleEditorPanelEnabled = exports.switchEditorMode = exports.showBlockTypes = void 0;
|
|
28
24
|
exports.togglePublishSidebar = togglePublishSidebar;
|
|
29
|
-
exports.updatePreferredStyleVariations =
|
|
25
|
+
exports.updatePreferredStyleVariations = void 0;
|
|
30
26
|
|
|
31
27
|
var _lodash = require("lodash");
|
|
32
28
|
|
|
@@ -164,27 +160,55 @@ function togglePublishSidebar() {
|
|
|
164
160
|
*/
|
|
165
161
|
|
|
166
162
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
163
|
+
const toggleEditorPanelEnabled = panelName => _ref3 => {
|
|
164
|
+
var _registry$select$get;
|
|
165
|
+
|
|
166
|
+
let {
|
|
167
|
+
registry
|
|
168
|
+
} = _ref3;
|
|
169
|
+
const inactivePanels = (_registry$select$get = registry.select(_preferences.store).get('core/edit-post', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
|
|
170
|
+
const isPanelInactive = !!(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName)); // If the panel is inactive, remove it to enable it, else add it to
|
|
171
|
+
// make it inactive.
|
|
172
|
+
|
|
173
|
+
let updatedInactivePanels;
|
|
174
|
+
|
|
175
|
+
if (isPanelInactive) {
|
|
176
|
+
updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName);
|
|
177
|
+
} else {
|
|
178
|
+
updatedInactivePanels = [...inactivePanels, panelName];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
registry.dispatch(_preferences.store).set('core/edit-post', 'inactivePanels', updatedInactivePanels);
|
|
182
|
+
};
|
|
173
183
|
/**
|
|
174
|
-
*
|
|
184
|
+
* Opens a closed panel and closes an open panel.
|
|
175
185
|
*
|
|
176
186
|
* @param {string} panelName A string that identifies the panel to open or close.
|
|
177
|
-
*
|
|
178
|
-
* @return {Object} Action object.
|
|
179
187
|
*/
|
|
180
188
|
|
|
181
189
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
190
|
+
exports.toggleEditorPanelEnabled = toggleEditorPanelEnabled;
|
|
191
|
+
|
|
192
|
+
const toggleEditorPanelOpened = panelName => _ref4 => {
|
|
193
|
+
var _registry$select$get2;
|
|
194
|
+
|
|
195
|
+
let {
|
|
196
|
+
registry
|
|
197
|
+
} = _ref4;
|
|
198
|
+
const openPanels = (_registry$select$get2 = registry.select(_preferences.store).get('core/edit-post', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
|
|
199
|
+
const isPanelOpen = !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName)); // If the panel is open, remove it to close it, else add it to
|
|
200
|
+
// make it open.
|
|
201
|
+
|
|
202
|
+
let updatedOpenPanels;
|
|
203
|
+
|
|
204
|
+
if (isPanelOpen) {
|
|
205
|
+
updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName);
|
|
206
|
+
} else {
|
|
207
|
+
updatedOpenPanels = [...openPanels, panelName];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
registry.dispatch(_preferences.store).set('core/edit-post', 'openPanels', updatedOpenPanels);
|
|
211
|
+
};
|
|
188
212
|
/**
|
|
189
213
|
* Returns an action object used to remove a panel from the editor.
|
|
190
214
|
*
|
|
@@ -194,6 +218,8 @@ function toggleEditorPanelOpened(panelName) {
|
|
|
194
218
|
*/
|
|
195
219
|
|
|
196
220
|
|
|
221
|
+
exports.toggleEditorPanelOpened = toggleEditorPanelOpened;
|
|
222
|
+
|
|
197
223
|
function removeEditorPanel(panelName) {
|
|
198
224
|
return {
|
|
199
225
|
type: 'REMOVE_PANEL',
|
|
@@ -207,10 +233,10 @@ function removeEditorPanel(panelName) {
|
|
|
207
233
|
*/
|
|
208
234
|
|
|
209
235
|
|
|
210
|
-
const toggleFeature = feature =>
|
|
236
|
+
const toggleFeature = feature => _ref5 => {
|
|
211
237
|
let {
|
|
212
238
|
registry
|
|
213
|
-
} =
|
|
239
|
+
} = _ref5;
|
|
214
240
|
return registry.dispatch(_preferences.store).toggle('core/edit-post', feature);
|
|
215
241
|
};
|
|
216
242
|
/**
|
|
@@ -222,15 +248,11 @@ const toggleFeature = feature => _ref3 => {
|
|
|
222
248
|
|
|
223
249
|
exports.toggleFeature = toggleFeature;
|
|
224
250
|
|
|
225
|
-
const switchEditorMode = mode =>
|
|
251
|
+
const switchEditorMode = mode => _ref6 => {
|
|
226
252
|
let {
|
|
227
|
-
dispatch,
|
|
228
253
|
registry
|
|
229
|
-
} =
|
|
230
|
-
dispatch(
|
|
231
|
-
type: 'SWITCH_MODE',
|
|
232
|
-
mode
|
|
233
|
-
}); // Unselect blocks when we switch to the code editor.
|
|
254
|
+
} = _ref6;
|
|
255
|
+
registry.dispatch(_preferences.store).set('core/edit-post', 'editorMode', mode); // Unselect blocks when we switch to the code editor.
|
|
234
256
|
|
|
235
257
|
if (mode !== 'visual') {
|
|
236
258
|
registry.dispatch(_blockEditor.store).clearSelectedBlock();
|
|
@@ -248,10 +270,10 @@ const switchEditorMode = mode => _ref4 => {
|
|
|
248
270
|
|
|
249
271
|
exports.switchEditorMode = switchEditorMode;
|
|
250
272
|
|
|
251
|
-
const togglePinnedPluginItem = pluginName =>
|
|
273
|
+
const togglePinnedPluginItem = pluginName => _ref7 => {
|
|
252
274
|
let {
|
|
253
275
|
registry
|
|
254
|
-
} =
|
|
276
|
+
} = _ref7;
|
|
255
277
|
const isPinned = registry.select(_interface.store).isItemPinned('core/edit-post', pluginName);
|
|
256
278
|
registry.dispatch(_interface.store)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName);
|
|
257
279
|
};
|
|
@@ -260,35 +282,36 @@ const togglePinnedPluginItem = pluginName => _ref5 => {
|
|
|
260
282
|
*
|
|
261
283
|
* @param {string} blockName Name of the block.
|
|
262
284
|
* @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
|
|
263
|
-
*
|
|
264
|
-
* @return {Object} Action object.
|
|
265
285
|
*/
|
|
266
286
|
|
|
267
287
|
|
|
268
288
|
exports.togglePinnedPluginItem = togglePinnedPluginItem;
|
|
269
289
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
type: 'UPDATE_PREFERRED_STYLE_VARIATIONS',
|
|
273
|
-
blockName,
|
|
274
|
-
blockStyle
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Returns an action object used in signalling that the editor should attempt
|
|
279
|
-
* to locally autosave the current post every `interval` seconds.
|
|
280
|
-
*
|
|
281
|
-
* @param {number} interval The new interval, in seconds.
|
|
282
|
-
* @return {Object} Action object.
|
|
283
|
-
*/
|
|
290
|
+
const updatePreferredStyleVariations = (blockName, blockStyle) => _ref8 => {
|
|
291
|
+
var _registry$select$get3;
|
|
284
292
|
|
|
293
|
+
let {
|
|
294
|
+
registry
|
|
295
|
+
} = _ref8;
|
|
285
296
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
};
|
|
291
|
-
|
|
297
|
+
if (!blockName) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const existingVariations = (_registry$select$get3 = registry.select(_preferences.store).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get3 !== void 0 ? _registry$select$get3 : {}; // When the blockStyle is omitted, remove the block's preferred variation.
|
|
302
|
+
|
|
303
|
+
if (!blockStyle) {
|
|
304
|
+
const updatedVariations = { ...existingVariations
|
|
305
|
+
};
|
|
306
|
+
delete updatedVariations[blockName];
|
|
307
|
+
registry.dispatch(_preferences.store).set('core/edit-post', 'preferredStyleVariations', updatedVariations);
|
|
308
|
+
} else {
|
|
309
|
+
// Else add the variation.
|
|
310
|
+
registry.dispatch(_preferences.store).set('core/edit-post', 'preferredStyleVariations', { ...existingVariations,
|
|
311
|
+
[blockName]: blockStyle
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
};
|
|
292
315
|
/**
|
|
293
316
|
* Update the provided block types to be visible.
|
|
294
317
|
*
|
|
@@ -296,13 +319,15 @@ function __experimentalUpdateLocalAutosaveInterval(interval) {
|
|
|
296
319
|
*/
|
|
297
320
|
|
|
298
321
|
|
|
299
|
-
|
|
300
|
-
|
|
322
|
+
exports.updatePreferredStyleVariations = updatePreferredStyleVariations;
|
|
323
|
+
|
|
324
|
+
const showBlockTypes = blockNames => _ref9 => {
|
|
325
|
+
var _registry$select$get4;
|
|
301
326
|
|
|
302
327
|
let {
|
|
303
328
|
registry
|
|
304
|
-
} =
|
|
305
|
-
const existingBlockNames = (_registry$select$
|
|
329
|
+
} = _ref9;
|
|
330
|
+
const existingBlockNames = (_registry$select$get4 = registry.select(_preferences.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get4 !== void 0 ? _registry$select$get4 : [];
|
|
306
331
|
const newBlockNames = (0, _lodash.without)(existingBlockNames, ...(0, _lodash.castArray)(blockNames));
|
|
307
332
|
registry.dispatch(_preferences.store).set('core/edit-post', 'hiddenBlockTypes', newBlockNames);
|
|
308
333
|
};
|
|
@@ -315,13 +340,13 @@ const showBlockTypes = blockNames => _ref6 => {
|
|
|
315
340
|
|
|
316
341
|
exports.showBlockTypes = showBlockTypes;
|
|
317
342
|
|
|
318
|
-
const hideBlockTypes = blockNames =>
|
|
319
|
-
var _registry$select$
|
|
343
|
+
const hideBlockTypes = blockNames => _ref10 => {
|
|
344
|
+
var _registry$select$get5;
|
|
320
345
|
|
|
321
346
|
let {
|
|
322
347
|
registry
|
|
323
|
-
} =
|
|
324
|
-
const existingBlockNames = (_registry$select$
|
|
348
|
+
} = _ref10;
|
|
349
|
+
const existingBlockNames = (_registry$select$get5 = registry.select(_preferences.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get5 !== void 0 ? _registry$select$get5 : [];
|
|
325
350
|
const mergedBlockNames = new Set([...existingBlockNames, ...(0, _lodash.castArray)(blockNames)]);
|
|
326
351
|
registry.dispatch(_preferences.store).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]);
|
|
327
352
|
};
|
|
@@ -335,10 +360,10 @@ const hideBlockTypes = blockNames => _ref7 => {
|
|
|
335
360
|
|
|
336
361
|
exports.hideBlockTypes = hideBlockTypes;
|
|
337
362
|
|
|
338
|
-
const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation =>
|
|
363
|
+
const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref11 => {
|
|
339
364
|
let {
|
|
340
365
|
dispatch
|
|
341
|
-
} =
|
|
366
|
+
} = _ref11;
|
|
342
367
|
return dispatch({
|
|
343
368
|
type: 'SET_META_BOXES_PER_LOCATIONS',
|
|
344
369
|
metaBoxesPerLocation
|
|
@@ -351,12 +376,12 @@ const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref8 => {
|
|
|
351
376
|
|
|
352
377
|
exports.setAvailableMetaBoxesPerLocation = setAvailableMetaBoxesPerLocation;
|
|
353
378
|
|
|
354
|
-
const requestMetaBoxUpdates = () => async
|
|
379
|
+
const requestMetaBoxUpdates = () => async _ref12 => {
|
|
355
380
|
let {
|
|
356
381
|
registry,
|
|
357
382
|
select,
|
|
358
383
|
dispatch
|
|
359
|
-
} =
|
|
384
|
+
} = _ref12;
|
|
360
385
|
dispatch({
|
|
361
386
|
type: 'REQUEST_META_BOX_UPDATES'
|
|
362
387
|
}); // Saves the wp_editor fields.
|
|
@@ -381,8 +406,8 @@ const requestMetaBoxUpdates = () => async _ref9 => {
|
|
|
381
406
|
|
|
382
407
|
return memo;
|
|
383
408
|
}, new window.FormData());
|
|
384
|
-
additionalData.forEach(
|
|
385
|
-
let [key, value] =
|
|
409
|
+
additionalData.forEach(_ref13 => {
|
|
410
|
+
let [key, value] = _ref13;
|
|
386
411
|
return formData.append(key, value);
|
|
387
412
|
});
|
|
388
413
|
|
|
@@ -497,12 +522,12 @@ function setIsEditingTemplate(value) {
|
|
|
497
522
|
|
|
498
523
|
const __unstableSwitchToTemplateMode = function () {
|
|
499
524
|
let newTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
500
|
-
return
|
|
525
|
+
return _ref14 => {
|
|
501
526
|
let {
|
|
502
527
|
registry,
|
|
503
528
|
select,
|
|
504
529
|
dispatch
|
|
505
|
-
} =
|
|
530
|
+
} = _ref14;
|
|
506
531
|
dispatch(setIsEditingTemplate(true));
|
|
507
532
|
const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
|
|
508
533
|
|
|
@@ -523,10 +548,10 @@ const __unstableSwitchToTemplateMode = function () {
|
|
|
523
548
|
|
|
524
549
|
exports.__unstableSwitchToTemplateMode = __unstableSwitchToTemplateMode;
|
|
525
550
|
|
|
526
|
-
const __unstableCreateTemplate = template => async
|
|
551
|
+
const __unstableCreateTemplate = template => async _ref15 => {
|
|
527
552
|
let {
|
|
528
553
|
registry
|
|
529
|
-
} =
|
|
554
|
+
} = _ref15;
|
|
530
555
|
const savedTemplate = await registry.dispatch(_coreData.store).saveEntityRecord('postType', 'wp_template', template);
|
|
531
556
|
const post = registry.select(_editor.store).getCurrentPost();
|
|
532
557
|
registry.dispatch(_coreData.store).editEntityRecord('postType', post.type, post.id, {
|
|
@@ -540,12 +565,12 @@ let metaBoxesInitialized = false;
|
|
|
540
565
|
* Initializes WordPress `postboxes` script and the logic for saving meta boxes.
|
|
541
566
|
*/
|
|
542
567
|
|
|
543
|
-
const initializeMetaBoxes = () =>
|
|
568
|
+
const initializeMetaBoxes = () => _ref16 => {
|
|
544
569
|
let {
|
|
545
570
|
registry,
|
|
546
571
|
select,
|
|
547
572
|
dispatch
|
|
548
|
-
} =
|
|
573
|
+
} = _ref16;
|
|
549
574
|
|
|
550
575
|
const isEditorReady = registry.select(_editor.store).__unstableIsEditorReady();
|
|
551
576
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/actions.js"],"names":["openGeneralSidebar","name","registry","dispatch","interfaceStore","enableComplementaryArea","editPostStore","closeGeneralSidebar","disableComplementaryArea","openModal","type","closeModal","openPublishSidebar","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","preferencesStore","toggle","switchEditorMode","mode","blockEditorStore","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","select","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","__experimentalUpdateLocalAutosaveInterval","interval","showBlockTypes","blockNames","existingBlockNames","get","newBlockNames","set","hideBlockTypes","mergedBlockNames","Set","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","editorStore","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","filter","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","newTemplate","isWelcomeGuideActive","isFeatureActive","noticesStore","createSuccessNotice","__unstableCreateTemplate","template","savedTemplate","coreStore","saveEntityRecord","editEntityRecord","id","slug","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","wasSavingPost","isSavingPost","wasAutosavingPost","isAutosavingPost","hasMetaBoxes","subscribe","shouldTriggerMetaboxesSave"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAtBA;AACA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,MAAM,CAAC8D,SAAP,CAAiBC,IAAjB,KAA0BH,QAA/B,EAA0C;AACzC5D,IAAAA,MAAM,CAAC8D,SAAP,CAAiBE,mBAAjB,CAAsCJ,QAAtC;AACA;;AAEDJ,EAAAA,oBAAoB,GAAG,IAAvB;AAEA,MAAIS,aAAa,GAAGjH,QAAQ,CAAC6B,MAAT,CAAiBuB,aAAjB,EAA+B8D,YAA/B,EAApB;AACA,MAAIC,iBAAiB,GAAGnH,QAAQ,CAAC6B,MAAT,CAAiBuB,aAAjB,EAA+BgE,gBAA/B,EAAxB;AACA,QAAMC,YAAY,GAAGxF,MAAM,CAACwF,YAAP,EAArB,CArB8E,CAuB9E;;AACArH,EAAAA,QAAQ,CAACsH,SAAT,CAAoB,YAAY;AAC/B,UAAMJ,YAAY,GAAGlH,QAAQ,CAAC6B,MAAT,CAAiBuB,aAAjB,EAA+B8D,YAA/B,EAArB;AACA,UAAME,gBAAgB,GAAGpH,QAAQ,CAC/B6B,MADuB,CACfuB,aADe,EAEvBgE,gBAFuB,EAAzB,CAF+B,CAM/B;AACA;AACA;AACA;AACA;AACA;;AACA,UAAMG,0BAA0B,GAC/BF,YAAY,IACZJ,aADA,IAEA,CAAEC,YAFF,IAGA,CAAEC,iBAJH,CAZ+B,CAkB/B;;AACAF,IAAAA,aAAa,GAAGC,YAAhB;AACAC,IAAAA,iBAAiB,GAAGC,gBAApB;;AAEA,QAAKG,0BAAL,EAAkC;AACjC,YAAMtH,QAAQ,CAAC8C,qBAAT,EAAN;AACA;AACD,GAzBD;AA2BA9C,EAAAA,QAAQ,CAAE;AACTO,IAAAA,IAAI,EAAE;AADG,GAAF,CAAR;AAGA,CAtDM","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray, reduce, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar = ( name ) => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.enableComplementaryArea( editPostStore.name, name );\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n */\nexport const closeGeneralSidebar = () => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.disableComplementaryArea( editPostStore.name );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport function toggleEditorPanelEnabled( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_ENABLED',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Returns an action object used to open or close a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n *\n * @return {Object} Action object.\n */\nexport function toggleEditorPanelOpened( panelName ) {\n\treturn {\n\t\ttype: 'TOGGLE_PANEL_OPENED',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport function removeEditorPanel( panelName ) {\n\treturn {\n\t\ttype: 'REMOVE_PANEL',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature = ( feature ) => ( { registry } ) =>\n\tregistry.dispatch( preferencesStore ).toggle( 'core/edit-post', feature );\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode = ( mode ) => ( { dispatch, registry } ) => {\n\tdispatch( {\n\t\ttype: 'SWITCH_MODE',\n\t\tmode,\n\t} );\n\n\t// Unselect blocks when we switch to the code editor.\n\tif ( mode !== 'visual' ) {\n\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t}\n\n\tconst message =\n\t\tmode === 'visual'\n\t\t\t? __( 'Visual editor selected' )\n\t\t\t: __( 'Code editor selected' );\n\tspeak( message, 'assertive' );\n};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem = ( pluginName ) => ( { registry } ) => {\n\tconst isPinned = registry\n\t\t.select( interfaceStore )\n\t\t.isItemPinned( 'core/edit-post', pluginName );\n\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t[ isPinned ? 'unpinItem' : 'pinItem' ]( 'core/edit-post', pluginName );\n};\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n *\n * @return {Object} Action object.\n */\nexport function updatePreferredStyleVariations( blockName, blockStyle ) {\n\treturn {\n\t\ttype: 'UPDATE_PREFERRED_STYLE_VARIATIONS',\n\t\tblockName,\n\t\tblockStyle,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the editor should attempt\n * to locally autosave the current post every `interval` seconds.\n *\n * @param {number} interval The new interval, in seconds.\n * @return {Object} Action object.\n */\nexport function __experimentalUpdateLocalAutosaveInterval( interval ) {\n\treturn {\n\t\ttype: 'UPDATE_LOCAL_AUTOSAVE_INTERVAL',\n\t\tinterval,\n\t};\n}\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes = ( blockNames ) => ( { registry } ) => {\n\tconst existingBlockNames =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\tconst newBlockNames = without(\n\t\texistingBlockNames,\n\t\t...castArray( blockNames )\n\t);\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'hiddenBlockTypes', newBlockNames );\n};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes = ( blockNames ) => ( { registry } ) => {\n\tconst existingBlockNames =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\tconst mergedBlockNames = new Set( [\n\t\t...existingBlockNames,\n\t\t...castArray( blockNames ),\n\t] );\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'hiddenBlockTypes', [ ...mergedBlockNames ] );\n};\n\n/**\n * Returns an action object used in signaling\n * what Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport const setAvailableMetaBoxesPerLocation = ( metaBoxesPerLocation ) => ( {\n\tdispatch,\n} ) =>\n\tdispatch( {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t} );\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates = () => async ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( {\n\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t} );\n\n\t// Saves the wp_editor fields.\n\tif ( window.tinyMCE ) {\n\t\twindow.tinyMCE.triggerSave();\n\t}\n\n\t// Additional data needed for backward compatibility.\n\t// If we do not provide this data, the post will be overridden with the default values.\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tconst additionalData = [\n\t\tpost.comment_status ? [ 'comment_status', post.comment_status ] : false,\n\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t].filter( Boolean );\n\n\t// We gather all the metaboxes locations data and the base form data.\n\tconst baseFormData = new window.FormData(\n\t\tdocument.querySelector( '.metabox-base-form' )\n\t);\n\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\tconst formDataToMerge = [\n\t\tbaseFormData,\n\t\t...activeMetaBoxLocations.map(\n\t\t\t( location ) =>\n\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t),\n\t];\n\n\t// Merge all form data objects into a single one.\n\tconst formData = reduce(\n\t\tformDataToMerge,\n\t\t( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t},\n\t\tnew window.FormData()\n\t);\n\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\tformData.append( key, value )\n\t);\n\n\ttry {\n\t\t// Save the metaboxes.\n\t\tawait apiFetch( {\n\t\t\turl: window._wpMetaBoxUrl,\n\t\t\tmethod: 'POST',\n\t\t\tbody: formData,\n\t\t\tparse: false,\n\t\t} );\n\t\tdispatch.metaBoxUpdatesSuccess();\n\t} catch {\n\t\tdispatch.metaBoxUpdatesFailure();\n\t}\n};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n * @return {Object} Action object.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @param {boolean} value Is editing template.\n * @return {Object} Action object.\n */\nexport function setIsEditingTemplate( value ) {\n\treturn {\n\t\ttype: 'SET_IS_EDITING_TEMPLATE',\n\t\tvalue,\n\t};\n}\n\n/**\n * Switches to the template mode.\n *\n * @param {boolean} newTemplate Is new template.\n */\nexport const __unstableSwitchToTemplateMode = ( newTemplate = false ) => ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( setIsEditingTemplate( true ) );\n\tconst isWelcomeGuideActive = select.isFeatureActive(\n\t\t'welcomeGuideTemplate'\n\t);\n\tif ( ! isWelcomeGuideActive ) {\n\t\tconst message = newTemplate\n\t\t\t? __( \"Custom template created. You're in template mode now.\" )\n\t\t\t: __(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t );\n\t\tregistry.dispatch( noticesStore ).createSuccessNotice( message, {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n};\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const __unstableCreateTemplate = ( template ) => async ( {\n\tregistry,\n} ) => {\n\tconst savedTemplate = await registry\n\t\t.dispatch( coreStore )\n\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.editEntityRecord( 'postType', post.type, post.id, {\n\t\t\ttemplate: savedTemplate.slug,\n\t\t} );\n};\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes = () => ( { registry, select, dispatch } ) => {\n\tconst isEditorReady = registry\n\t\t.select( editorStore )\n\t\t.__unstableIsEditorReady();\n\n\tif ( ! isEditorReady ) {\n\t\treturn;\n\t}\n\t// Only initialize once.\n\tif ( metaBoxesInitialized ) {\n\t\treturn;\n\t}\n\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\tif ( window.postboxes.page !== postType ) {\n\t\twindow.postboxes.add_postbox_toggles( postType );\n\t}\n\n\tmetaBoxesInitialized = true;\n\n\tlet wasSavingPost = registry.select( editorStore ).isSavingPost();\n\tlet wasAutosavingPost = registry.select( editorStore ).isAutosavingPost();\n\tconst hasMetaBoxes = select.hasMetaBoxes();\n\n\t// Save metaboxes when performing a full save on the post.\n\tregistry.subscribe( async () => {\n\t\tconst isSavingPost = registry.select( editorStore ).isSavingPost();\n\t\tconst isAutosavingPost = registry\n\t\t\t.select( editorStore )\n\t\t\t.isAutosavingPost();\n\n\t\t// Save metaboxes on save completion, except for autosaves that are not a post preview.\n\t\t//\n\t\t// Meta boxes are initialized once at page load. It is not necessary to\n\t\t// account for updates on each state change.\n\t\t//\n\t\t// See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309.\n\t\tconst shouldTriggerMetaboxesSave =\n\t\t\thasMetaBoxes &&\n\t\t\twasSavingPost &&\n\t\t\t! isSavingPost &&\n\t\t\t! wasAutosavingPost;\n\n\t\t// Save current state for next inspection.\n\t\twasSavingPost = isSavingPost;\n\t\twasAutosavingPost = isAutosavingPost;\n\n\t\tif ( shouldTriggerMetaboxesSave ) {\n\t\t\tawait dispatch.requestMetaBoxUpdates();\n\t\t}\n\t} );\n\n\tdispatch( {\n\t\ttype: 'META_BOXES_INITIALIZED',\n\t} );\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/store/actions.js"],"names":["openGeneralSidebar","name","registry","dispatch","interfaceStore","enableComplementaryArea","editPostStore","closeGeneralSidebar","disableComplementaryArea","openModal","type","closeModal","openPublishSidebar","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","inactivePanels","select","preferencesStore","get","isPanelInactive","includes","updatedInactivePanels","filter","invactivePanelName","set","toggleEditorPanelOpened","openPanels","isPanelOpen","updatedOpenPanels","openPanelName","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","blockEditorStore","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","existingVariations","updatedVariations","showBlockTypes","blockNames","existingBlockNames","newBlockNames","hideBlockTypes","mergedBlockNames","Set","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","editorStore","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","newTemplate","isWelcomeGuideActive","isFeatureActive","noticesStore","createSuccessNotice","__unstableCreateTemplate","template","savedTemplate","coreStore","saveEntityRecord","editEntityRecord","id","slug","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","wasSavingPost","isSavingPost","wasAutosavingPost","isAutosavingPost","hasMetaBoxes","subscribe","shouldTriggerMetaboxesSave"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAAKC,IAAF,IAAY;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SAC7CA,QAAQ,CACNC,QADF,CACYC,gBADZ,EAEEC,uBAFF,CAE2BC,QAAcL,IAFzC,EAE+CA,IAF/C,CAD6C;AAAA,CAAvC;AAKP;AACA;AACA;;;;;AACO,MAAMM,mBAAmB,GAAG,MAAM;AAAA,MAAE;AAAEL,IAAAA;AAAF,GAAF;AAAA,SACxCA,QAAQ,CACNC,Q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,MAAM,CAAC6D,SAAP,CAAiBC,IAAjB,KAA0BH,QAA/B,EAA0C;AACzC3D,IAAAA,MAAM,CAAC6D,SAAP,CAAiBE,mBAAjB,CAAsCJ,QAAtC;AACA;;AAEDJ,EAAAA,oBAAoB,GAAG,IAAvB;AAEA,MAAIS,aAAa,GAAG1H,QAAQ,CAACgB,MAAT,CAAiB8C,aAAjB,EAA+B6D,YAA/B,EAApB;AACA,MAAIC,iBAAiB,GAAG5H,QAAQ,CAACgB,MAAT,CAAiB8C,aAAjB,EAA+B+D,gBAA/B,EAAxB;AACA,QAAMC,YAAY,GAAG9G,MAAM,CAAC8G,YAAP,EAArB,CArB8E,CAuB9E;;AACA9H,EAAAA,QAAQ,CAAC+H,SAAT,CAAoB,YAAY;AAC/B,UAAMJ,YAAY,GAAG3H,QAAQ,CAACgB,MAAT,CAAiB8C,aAAjB,EAA+B6D,YAA/B,EAArB;AACA,UAAME,gBAAgB,GAAG7H,QAAQ,CAC/BgB,MADuB,CACf8C,aADe,EAEvB+D,gBAFuB,EAAzB,CAF+B,CAM/B;AACA;AACA;AACA;AACA;AACA;;AACA,UAAMG,0BAA0B,GAC/BF,YAAY,IACZJ,aADA,IAEA,CAAEC,YAFF,IAGA,CAAEC,iBAJH,CAZ+B,CAkB/B;;AACAF,IAAAA,aAAa,GAAGC,YAAhB;AACAC,IAAAA,iBAAiB,GAAGC,gBAApB;;AAEA,QAAKG,0BAAL,EAAkC;AACjC,YAAM/H,QAAQ,CAACwD,qBAAT,EAAN;AACA;AACD,GAzBD;AA2BAxD,EAAAA,QAAQ,CAAE;AACTO,IAAAA,IAAI,EAAE;AADG,GAAF,CAAR;AAGA,CAtDM","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray, reduce, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar = ( name ) => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.enableComplementaryArea( editPostStore.name, name );\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n */\nexport const closeGeneralSidebar = () => ( { registry } ) =>\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.disableComplementaryArea( editPostStore.name );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport const toggleEditorPanelEnabled = ( panelName ) => ( { registry } ) => {\n\tconst inactivePanels =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'inactivePanels' ) ?? [];\n\n\tconst isPanelInactive = !! inactivePanels?.includes( panelName );\n\n\t// If the panel is inactive, remove it to enable it, else add it to\n\t// make it inactive.\n\tlet updatedInactivePanels;\n\tif ( isPanelInactive ) {\n\t\tupdatedInactivePanels = inactivePanels.filter(\n\t\t\t( invactivePanelName ) => invactivePanelName !== panelName\n\t\t);\n\t} else {\n\t\tupdatedInactivePanels = [ ...inactivePanels, panelName ];\n\t}\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'inactivePanels', updatedInactivePanels );\n};\n\n/**\n * Opens a closed panel and closes an open panel.\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n */\nexport const toggleEditorPanelOpened = ( panelName ) => ( { registry } ) => {\n\tconst openPanels =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'openPanels' ) ?? [];\n\n\tconst isPanelOpen = !! openPanels?.includes( panelName );\n\n\t// If the panel is open, remove it to close it, else add it to\n\t// make it open.\n\tlet updatedOpenPanels;\n\tif ( isPanelOpen ) {\n\t\tupdatedOpenPanels = openPanels.filter(\n\t\t\t( openPanelName ) => openPanelName !== panelName\n\t\t);\n\t} else {\n\t\tupdatedOpenPanels = [ ...openPanels, panelName ];\n\t}\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'openPanels', updatedOpenPanels );\n};\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport function removeEditorPanel( panelName ) {\n\treturn {\n\t\ttype: 'REMOVE_PANEL',\n\t\tpanelName,\n\t};\n}\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature = ( feature ) => ( { registry } ) =>\n\tregistry.dispatch( preferencesStore ).toggle( 'core/edit-post', feature );\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode = ( mode ) => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'editorMode', mode );\n\n\t// Unselect blocks when we switch to the code editor.\n\tif ( mode !== 'visual' ) {\n\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t}\n\n\tconst message =\n\t\tmode === 'visual'\n\t\t\t? __( 'Visual editor selected' )\n\t\t\t: __( 'Code editor selected' );\n\tspeak( message, 'assertive' );\n};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem = ( pluginName ) => ( { registry } ) => {\n\tconst isPinned = registry\n\t\t.select( interfaceStore )\n\t\t.isItemPinned( 'core/edit-post', pluginName );\n\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t[ isPinned ? 'unpinItem' : 'pinItem' ]( 'core/edit-post', pluginName );\n};\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n */\nexport const updatePreferredStyleVariations = ( blockName, blockStyle ) => ( {\n\tregistry,\n} ) => {\n\tif ( ! blockName ) {\n\t\treturn;\n\t}\n\n\tconst existingVariations =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};\n\n\t// When the blockStyle is omitted, remove the block's preferred variation.\n\tif ( ! blockStyle ) {\n\t\tconst updatedVariations = {\n\t\t\t...existingVariations,\n\t\t};\n\n\t\tdelete updatedVariations[ blockName ];\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set(\n\t\t\t\t'core/edit-post',\n\t\t\t\t'preferredStyleVariations',\n\t\t\t\tupdatedVariations\n\t\t\t);\n\t} else {\n\t\t// Else add the variation.\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( 'core/edit-post', 'preferredStyleVariations', {\n\t\t\t\t...existingVariations,\n\t\t\t\t[ blockName ]: blockStyle,\n\t\t\t} );\n\t}\n};\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes = ( blockNames ) => ( { registry } ) => {\n\tconst existingBlockNames =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\tconst newBlockNames = without(\n\t\texistingBlockNames,\n\t\t...castArray( blockNames )\n\t);\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'hiddenBlockTypes', newBlockNames );\n};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes = ( blockNames ) => ( { registry } ) => {\n\tconst existingBlockNames =\n\t\tregistry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-post', 'hiddenBlockTypes' ) ?? [];\n\n\tconst mergedBlockNames = new Set( [\n\t\t...existingBlockNames,\n\t\t...castArray( blockNames ),\n\t] );\n\n\tregistry\n\t\t.dispatch( preferencesStore )\n\t\t.set( 'core/edit-post', 'hiddenBlockTypes', [ ...mergedBlockNames ] );\n};\n\n/**\n * Returns an action object used in signaling\n * what Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport const setAvailableMetaBoxesPerLocation = ( metaBoxesPerLocation ) => ( {\n\tdispatch,\n} ) =>\n\tdispatch( {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t} );\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates = () => async ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( {\n\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t} );\n\n\t// Saves the wp_editor fields.\n\tif ( window.tinyMCE ) {\n\t\twindow.tinyMCE.triggerSave();\n\t}\n\n\t// Additional data needed for backward compatibility.\n\t// If we do not provide this data, the post will be overridden with the default values.\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tconst additionalData = [\n\t\tpost.comment_status ? [ 'comment_status', post.comment_status ] : false,\n\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t].filter( Boolean );\n\n\t// We gather all the metaboxes locations data and the base form data.\n\tconst baseFormData = new window.FormData(\n\t\tdocument.querySelector( '.metabox-base-form' )\n\t);\n\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\tconst formDataToMerge = [\n\t\tbaseFormData,\n\t\t...activeMetaBoxLocations.map(\n\t\t\t( location ) =>\n\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t),\n\t];\n\n\t// Merge all form data objects into a single one.\n\tconst formData = reduce(\n\t\tformDataToMerge,\n\t\t( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t},\n\t\tnew window.FormData()\n\t);\n\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\tformData.append( key, value )\n\t);\n\n\ttry {\n\t\t// Save the metaboxes.\n\t\tawait apiFetch( {\n\t\t\turl: window._wpMetaBoxUrl,\n\t\t\tmethod: 'POST',\n\t\t\tbody: formData,\n\t\t\tparse: false,\n\t\t} );\n\t\tdispatch.metaBoxUpdatesSuccess();\n\t} catch {\n\t\tdispatch.metaBoxUpdatesFailure();\n\t}\n};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Returns an action object used to toggle the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n * @return {Object} Action object.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @param {boolean} value Is editing template.\n * @return {Object} Action object.\n */\nexport function setIsEditingTemplate( value ) {\n\treturn {\n\t\ttype: 'SET_IS_EDITING_TEMPLATE',\n\t\tvalue,\n\t};\n}\n\n/**\n * Switches to the template mode.\n *\n * @param {boolean} newTemplate Is new template.\n */\nexport const __unstableSwitchToTemplateMode = ( newTemplate = false ) => ( {\n\tregistry,\n\tselect,\n\tdispatch,\n} ) => {\n\tdispatch( setIsEditingTemplate( true ) );\n\tconst isWelcomeGuideActive = select.isFeatureActive(\n\t\t'welcomeGuideTemplate'\n\t);\n\tif ( ! isWelcomeGuideActive ) {\n\t\tconst message = newTemplate\n\t\t\t? __( \"Custom template created. You're in template mode now.\" )\n\t\t\t: __(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t );\n\t\tregistry.dispatch( noticesStore ).createSuccessNotice( message, {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n};\n\n/**\n * Create a block based template.\n *\n * @param {Object?} template Template to create and assign.\n */\nexport const __unstableCreateTemplate = ( template ) => async ( {\n\tregistry,\n} ) => {\n\tconst savedTemplate = await registry\n\t\t.dispatch( coreStore )\n\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\tconst post = registry.select( editorStore ).getCurrentPost();\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.editEntityRecord( 'postType', post.type, post.id, {\n\t\t\ttemplate: savedTemplate.slug,\n\t\t} );\n};\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes = () => ( { registry, select, dispatch } ) => {\n\tconst isEditorReady = registry\n\t\t.select( editorStore )\n\t\t.__unstableIsEditorReady();\n\n\tif ( ! isEditorReady ) {\n\t\treturn;\n\t}\n\t// Only initialize once.\n\tif ( metaBoxesInitialized ) {\n\t\treturn;\n\t}\n\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\tif ( window.postboxes.page !== postType ) {\n\t\twindow.postboxes.add_postbox_toggles( postType );\n\t}\n\n\tmetaBoxesInitialized = true;\n\n\tlet wasSavingPost = registry.select( editorStore ).isSavingPost();\n\tlet wasAutosavingPost = registry.select( editorStore ).isAutosavingPost();\n\tconst hasMetaBoxes = select.hasMetaBoxes();\n\n\t// Save metaboxes when performing a full save on the post.\n\tregistry.subscribe( async () => {\n\t\tconst isSavingPost = registry.select( editorStore ).isSavingPost();\n\t\tconst isAutosavingPost = registry\n\t\t\t.select( editorStore )\n\t\t\t.isAutosavingPost();\n\n\t\t// Save metaboxes on save completion, except for autosaves that are not a post preview.\n\t\t//\n\t\t// Meta boxes are initialized once at page load. It is not necessary to\n\t\t// account for updates on each state change.\n\t\t//\n\t\t// See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309.\n\t\tconst shouldTriggerMetaboxesSave =\n\t\t\thasMetaBoxes &&\n\t\t\twasSavingPost &&\n\t\t\t! isSavingPost &&\n\t\t\t! wasAutosavingPost;\n\n\t\t// Save current state for next inspection.\n\t\twasSavingPost = isSavingPost;\n\t\twasAutosavingPost = isAutosavingPost;\n\n\t\tif ( shouldTriggerMetaboxesSave ) {\n\t\t\tawait dispatch.requestMetaBoxUpdates();\n\t\t}\n\t} );\n\n\tdispatch( {\n\t\ttype: 'META_BOXES_INITIALIZED',\n\t} );\n};\n"]}
|
package/build/store/index.js
CHANGED
|
@@ -28,12 +28,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
28
28
|
/**
|
|
29
29
|
* Internal dependencies
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
|
-
reducer: _reducer.default,
|
|
33
|
-
actions,
|
|
34
|
-
selectors,
|
|
35
|
-
persist: ['preferences']
|
|
36
|
-
};
|
|
31
|
+
|
|
37
32
|
/**
|
|
38
33
|
* Store definition for the edit post namespace.
|
|
39
34
|
*
|
|
@@ -41,9 +36,11 @@ const storeConfig = {
|
|
|
41
36
|
*
|
|
42
37
|
* @type {Object}
|
|
43
38
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
const store = (0, _data.createReduxStore)(_constants.STORE_NAME, {
|
|
40
|
+
reducer: _reducer.default,
|
|
41
|
+
actions,
|
|
42
|
+
selectors
|
|
43
|
+
});
|
|
47
44
|
exports.store = store;
|
|
48
|
-
(0, _data.
|
|
45
|
+
(0, _data.register)(store);
|
|
49
46
|
//# sourceMappingURL=index.js.map
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/store/index.js"],"names":["store","STORE_NAME","reducer","actions","selectors"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8B;AAClDC,EAAAA,OAAO,EAAPA,gBADkD;AAElDC,EAAAA,OAFkD;AAGlDC,EAAAA;AAHkD,CAA9B,CAAd;;AAMP,oBAAUJ,KAAV","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the edit post namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"]}
|