@wordpress/edit-post 8.6.1 → 8.7.1-next.5368f64a9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/back-button/fullscreen-mode-close.js +4 -1
- package/build/components/back-button/fullscreen-mode-close.js.map +1 -1
- package/build/components/browser-url/index.js +2 -41
- package/build/components/browser-url/index.js.map +1 -1
- package/build/components/editor-initialization/listener-hooks.js +4 -4
- package/build/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build/components/init-pattern-modal/index.js +4 -1
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/layout/index.js +4 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/use-padding-appender.js +4 -9
- package/build/components/layout/use-padding-appender.js.map +1 -1
- package/build/components/preferences-modal/enable-custom-fields.js +4 -1
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/store/private-selectors.js +2 -2
- package/build/store/private-selectors.js.map +1 -1
- package/build-module/components/back-button/fullscreen-mode-close.js +4 -1
- package/build-module/components/back-button/fullscreen-mode-close.js.map +1 -1
- package/build-module/components/browser-url/index.js +2 -40
- package/build-module/components/browser-url/index.js.map +1 -1
- package/build-module/components/editor-initialization/listener-hooks.js +4 -4
- package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js +4 -1
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +4 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/use-padding-appender.js +4 -9
- package/build-module/components/layout/use-padding-appender.js.map +1 -1
- package/build-module/components/preferences-modal/enable-custom-fields.js +4 -1
- package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build-module/index.js +7 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/package.json +31 -31
- package/src/components/back-button/fullscreen-mode-close.js +2 -0
- package/src/components/back-button/style.scss +2 -2
- package/src/components/browser-url/index.js +2 -38
- package/src/components/browser-url/test/index.js +1 -9
- package/src/components/editor-initialization/listener-hooks.js +4 -4
- package/src/components/init-pattern-modal/index.js +2 -0
- package/src/components/layout/index.js +3 -8
- package/src/components/layout/use-padding-appender.js +5 -10
- package/src/components/preferences-modal/enable-custom-fields.js +2 -0
- package/src/index.js +8 -0
- package/src/store/private-selectors.js +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useState","__","Button","withSelect","store","editorStore","privateApis","preferencesPrivateApis","getPathAndQueryString","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PreferenceBaseOption","submitCustomFieldsForm","customFieldsForm","document","getElementById","querySelector","setAttribute","window","location","href","submit","CustomFieldsConfirmation","willEnable","isReloading","setIsReloading","children","className","variant","isBusy","accessibleWhenDisabled","disabled","onClick","EnableCustomFieldsOption","label","areCustomFieldsEnabled","isChecked","setIsChecked","onChange","select","getEditorSettings","enableCustomFields"],"sources":["@wordpress/edit-post/src/components/preferences-modal/enable-custom-fields.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { getPathAndQueryString } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferenceBaseOption } = unlock( preferencesPrivateApis );\n\nfunction submitCustomFieldsForm() {\n\tconst customFieldsForm = document.getElementById(\n\t\t'toggle-custom-fields-form'\n\t);\n\n\t// Ensure the referrer values is up to update with any\n\tcustomFieldsForm\n\t\t.querySelector( '[name=\"_wp_http_referer\"]' )\n\t\t.setAttribute( 'value', getPathAndQueryString( window.location.href ) );\n\n\tcustomFieldsForm.submit();\n}\n\nexport function CustomFieldsConfirmation( { willEnable } ) {\n\tconst [ isReloading, setIsReloading ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<p className=\"edit-post-preferences-modal__custom-fields-confirmation-message\">\n\t\t\t\t{ __(\n\t\t\t\t\t'A page reload is required for this change. Make sure your content is saved before reloading.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-preferences-modal__custom-fields-confirmation-button\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tisBusy={ isReloading }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ isReloading }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsReloading( true );\n\t\t\t\t\tsubmitCustomFieldsForm();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ willEnable\n\t\t\t\t\t? __( 'Show & Reload Page' )\n\t\t\t\t\t: __( 'Hide & Reload Page' ) }\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport function EnableCustomFieldsOption( { label, areCustomFieldsEnabled } ) {\n\tconst [ isChecked, setIsChecked ] = useState( areCustomFieldsEnabled );\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\tlabel={ label }\n\t\t\tisChecked={ isChecked }\n\t\t\tonChange={ setIsChecked }\n\t\t>\n\t\t\t{ isChecked !== areCustomFieldsEnabled && (\n\t\t\t\t<CustomFieldsConfirmation willEnable={ isChecked } />\n\t\t\t) }\n\t\t</PreferenceBaseOption>\n\t);\n}\n\nexport default withSelect( ( select ) => ( {\n\tareCustomFieldsEnabled:\n\t\t!! select( editorStore ).getEditorSettings().enableCustomFields,\n} ) )( EnableCustomFieldsOption );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,wBAAwB;AAC9E,SAASC,qBAAqB,QAAQ,gBAAgB;;AAEtD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC;AAAqB,CAAC,GAAGP,MAAM,CAAEF,sBAAuB,CAAC;AAEjE,SAASU,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,gBAAgB,GAAGC,QAAQ,CAACC,cAAc,CAC/C,2BACD,CAAC;;EAED;EACAF,gBAAgB,CACdG,aAAa,CAAE,2BAA4B,CAAC,CAC5CC,YAAY,CAAE,OAAO,EAAEd,qBAAqB,CAAEe,MAAM,CAACC,QAAQ,CAACC,IAAK,CAAE,CAAC;EAExEP,gBAAgB,CAACQ,MAAM,CAAC,CAAC;AAC1B;AAEA,OAAO,SAASC,wBAAwBA,CAAE;EAAEC;AAAW,CAAC,EAAG;EAC1D,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAG9B,QAAQ,CAAE,KAAM,CAAC;EACzD,oBACCe,KAAA,CAAAF,SAAA;IAAAkB,QAAA,gBACCpB,IAAA;MAAGqB,SAAS,EAAC,iEAAiE;MAAAD,QAAA,EAC3E9B,EAAE,CACH,8FACD;IAAC,CACC,CAAC,eACJU,IAAA,CAACT,
|
|
1
|
+
{"version":3,"names":["useState","__","Button","withSelect","store","editorStore","privateApis","preferencesPrivateApis","getPathAndQueryString","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PreferenceBaseOption","submitCustomFieldsForm","customFieldsForm","document","getElementById","querySelector","setAttribute","window","location","href","submit","CustomFieldsConfirmation","willEnable","isReloading","setIsReloading","children","className","__next40pxDefaultSize","variant","isBusy","accessibleWhenDisabled","disabled","onClick","EnableCustomFieldsOption","label","areCustomFieldsEnabled","isChecked","setIsChecked","onChange","select","getEditorSettings","enableCustomFields"],"sources":["@wordpress/edit-post/src/components/preferences-modal/enable-custom-fields.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { getPathAndQueryString } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferenceBaseOption } = unlock( preferencesPrivateApis );\n\nfunction submitCustomFieldsForm() {\n\tconst customFieldsForm = document.getElementById(\n\t\t'toggle-custom-fields-form'\n\t);\n\n\t// Ensure the referrer values is up to update with any\n\tcustomFieldsForm\n\t\t.querySelector( '[name=\"_wp_http_referer\"]' )\n\t\t.setAttribute( 'value', getPathAndQueryString( window.location.href ) );\n\n\tcustomFieldsForm.submit();\n}\n\nexport function CustomFieldsConfirmation( { willEnable } ) {\n\tconst [ isReloading, setIsReloading ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<p className=\"edit-post-preferences-modal__custom-fields-confirmation-message\">\n\t\t\t\t{ __(\n\t\t\t\t\t'A page reload is required for this change. Make sure your content is saved before reloading.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\tclassName=\"edit-post-preferences-modal__custom-fields-confirmation-button\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tisBusy={ isReloading }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ isReloading }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsReloading( true );\n\t\t\t\t\tsubmitCustomFieldsForm();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ willEnable\n\t\t\t\t\t? __( 'Show & Reload Page' )\n\t\t\t\t\t: __( 'Hide & Reload Page' ) }\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport function EnableCustomFieldsOption( { label, areCustomFieldsEnabled } ) {\n\tconst [ isChecked, setIsChecked ] = useState( areCustomFieldsEnabled );\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\tlabel={ label }\n\t\t\tisChecked={ isChecked }\n\t\t\tonChange={ setIsChecked }\n\t\t>\n\t\t\t{ isChecked !== areCustomFieldsEnabled && (\n\t\t\t\t<CustomFieldsConfirmation willEnable={ isChecked } />\n\t\t\t) }\n\t\t</PreferenceBaseOption>\n\t);\n}\n\nexport default withSelect( ( select ) => ( {\n\tareCustomFieldsEnabled:\n\t\t!! select( editorStore ).getEditorSettings().enableCustomFields,\n} ) )( EnableCustomFieldsOption );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,wBAAwB;AAC9E,SAASC,qBAAqB,QAAQ,gBAAgB;;AAEtD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC;AAAqB,CAAC,GAAGP,MAAM,CAAEF,sBAAuB,CAAC;AAEjE,SAASU,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,gBAAgB,GAAGC,QAAQ,CAACC,cAAc,CAC/C,2BACD,CAAC;;EAED;EACAF,gBAAgB,CACdG,aAAa,CAAE,2BAA4B,CAAC,CAC5C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C;AAEzB;AAEA,eAAevC,UAAU,CAAI0C,MAAM,KAAQ;EAC1CJ,sBAAsB,EACrB,CAAC,CAAEI,MAAM,CAAExC,WAAY,CAAC,CAACyC,iBAAiB,CAAC,CAAC,CAACC;AAC/C,CAAC,CAAG,CAAC,CAAER,wBAAyB,CAAC","ignoreList":[]}
|
package/build-module/index.js
CHANGED
|
@@ -53,8 +53,15 @@ export function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
53
53
|
showBlockBreadcrumbs: true,
|
|
54
54
|
showIconLabels: false,
|
|
55
55
|
showListViewByDefault: false,
|
|
56
|
+
enableChoosePatternModal: true,
|
|
56
57
|
isPublishSidebarEnabled: true
|
|
57
58
|
});
|
|
59
|
+
if (window.__experimentalMediaProcessing) {
|
|
60
|
+
dispatch(preferencesStore).setDefaults('core/media', {
|
|
61
|
+
requireApproval: true,
|
|
62
|
+
optimizeOnUpload: true
|
|
63
|
+
});
|
|
64
|
+
}
|
|
58
65
|
dispatch(blocksStore).reapplyBlockTypeFilters();
|
|
59
66
|
|
|
60
67
|
// Check if the block list view should be open by default.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","deprecated","createRoot","StrictMode","dispatch","select","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","editorStore","privateApis","editorPrivateApis","Layout","unlock","jsx","_jsx","BackButton","__experimentalMainDashboardButton","registerCoreBlockBindingsSources","bootstrapBlockBindingsSourcesFromServer","initializeEditor","id","postType","postId","settings","initialEdits","isMediumOrBigger","window","matchMedia","matches","target","document","getElementById","root","setDefaults","fullscreenMode","themeStyles","welcomeGuide","welcomeGuideTemplate","allowRightClickOverrides","editorMode","fixedToolbar","hiddenBlockTypes","inactivePanels","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","isPublishSidebarEnabled","reapplyBlockTypeFilters","get","setIsListViewOpened","blockBindingsSources","inserter","globalThis","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","documentMode","compatMode","console","warn","isIphone","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","children","reinitializeEditor","since","version","default","__experimentalFullscreenModeClose"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { unlock } from './lock-unlock';\n\nconst {\n\tBackButton: __experimentalMainDashboardButton,\n\tregisterCoreBlockBindingsSources,\n\tbootstrapBlockBindingsSourcesFromServer,\n} = unlock( editorPrivateApis );\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\tconst isMediumOrBigger = window.matchMedia( '(min-width: 782px)' ).matches;\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\tfullscreenMode: true,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tisPublishSidebarEnabled: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t// This behavior is disabled for small viewports.\n\tif (\n\t\tisMediumOrBigger &&\n\t\tselect( preferencesStore ).get( 'core', 'showListViewByDefault' ) &&\n\t\t! select( preferencesStore ).get( 'core', 'distractionFree' )\n\t) {\n\t\tdispatch( editorStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tbootstrapBlockBindingsSourcesFromServer( settings?.blockBindingsSources );\n\tregisterCoreBlockBindingsSources();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.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\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<Layout\n\t\t\t\tsettings={ settings }\n\t\t\t\tpostId={ postId }\n\t\t\t\tpostType={ postType }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t/>\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as __experimentalFullscreenModeClose } from './components/back-button/fullscreen-mode-close';\nexport { __experimentalMainDashboardButton };\nexport { store } from './store';\nexport * from './deprecated';\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,kBAAkB,EAClBC,4CAA4C,QACtC,0BAA0B;AACjC,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;AAC3D,SAASC,QAAQ,EAAEC,MAAM,QAAQ,iBAAiB;AAClD,SAASR,KAAK,IAAIS,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,yBAAyB,EACzBC,wBAAwB,QAClB,oBAAoB;AAC3B,SACCX,KAAK,IAAIY,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;;AAE1B;AACA;AACA;AACA,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,MAAM,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEvC,MAAM;EACLC,UAAU,EAAEC,iCAAiC;EAC7CC,gCAAgC;EAChCC;AACD,CAAC,GAAGN,MAAM,CAAEF,iBAAkB,CAAC;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,gBAAgBA,CAC/BC,EAAE,EACFC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,YAAY,EACX;EACD,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,UAAU,CAAE,oBAAqB,CAAC,CAACC,OAAO;EAC1E,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CAAEX,EAAG,CAAC;EAC5C,MAAMY,IAAI,GAAG/B,UAAU,CAAE4B,MAAO,CAAC;EAEjC1B,QAAQ,CAAEE,gBAAiB,CAAC,CAAC4B,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,cA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,EAAGA,QAAU;MACrBG,YAAY,EAAGA;IAAc,CAC7B;EAAC,CACS,CACb,CAAC;EAED,OAAOQ,IAAI;AACZ;;AAEA;AACA;AACA;AACA,OAAO,SAAS4C,kBAAkBA,CAAA,EAAG;EACpC5E,UAAU,CAAE,gCAAgC,EAAE;IAC7C6E,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;AAEA,SAASC,OAAO,IAAIC,iCAAiC,QAAQ,gDAAgD;AAC7G,SAAShE,iCAAiC;AAC1C,SAASpB,KAAK,QAAQ,SAAS;AAC/B,cAAc,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","deprecated","createRoot","StrictMode","dispatch","select","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","editorStore","privateApis","editorPrivateApis","Layout","unlock","jsx","_jsx","BackButton","__experimentalMainDashboardButton","registerCoreBlockBindingsSources","bootstrapBlockBindingsSourcesFromServer","initializeEditor","id","postType","postId","settings","initialEdits","isMediumOrBigger","window","matchMedia","matches","target","document","getElementById","root","setDefaults","fullscreenMode","themeStyles","welcomeGuide","welcomeGuideTemplate","allowRightClickOverrides","editorMode","fixedToolbar","hiddenBlockTypes","inactivePanels","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","enableChoosePatternModal","isPublishSidebarEnabled","__experimentalMediaProcessing","requireApproval","optimizeOnUpload","reapplyBlockTypeFilters","get","setIsListViewOpened","blockBindingsSources","inserter","globalThis","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","documentMode","compatMode","console","warn","isIphone","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","children","reinitializeEditor","since","version","default","__experimentalFullscreenModeClose"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { unlock } from './lock-unlock';\n\nconst {\n\tBackButton: __experimentalMainDashboardButton,\n\tregisterCoreBlockBindingsSources,\n\tbootstrapBlockBindingsSourcesFromServer,\n} = unlock( editorPrivateApis );\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\tconst isMediumOrBigger = window.matchMedia( '(min-width: 782px)' ).matches;\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\tfullscreenMode: true,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tenableChoosePatternModal: true,\n\t\tisPublishSidebarEnabled: true,\n\t} );\n\n\tif ( window.__experimentalMediaProcessing ) {\n\t\tdispatch( preferencesStore ).setDefaults( 'core/media', {\n\t\t\trequireApproval: true,\n\t\t\toptimizeOnUpload: true,\n\t\t} );\n\t}\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t// This behavior is disabled for small viewports.\n\tif (\n\t\tisMediumOrBigger &&\n\t\tselect( preferencesStore ).get( 'core', 'showListViewByDefault' ) &&\n\t\t! select( preferencesStore ).get( 'core', 'distractionFree' )\n\t) {\n\t\tdispatch( editorStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tbootstrapBlockBindingsSourcesFromServer( settings?.blockBindingsSources );\n\tregisterCoreBlockBindingsSources();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.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\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<Layout\n\t\t\t\tsettings={ settings }\n\t\t\t\tpostId={ postId }\n\t\t\t\tpostType={ postType }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t/>\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as __experimentalFullscreenModeClose } from './components/back-button/fullscreen-mode-close';\nexport { __experimentalMainDashboard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AU;IAAA6E,QAAA,eACVjE,IAAA,CAACH,MAAM;MACNY,QAAQ,EAAGA,QAAU;MACrBD,MAAM,EAAGA,MAAQ;MACjBD,QAAQ,EAAGA,QAAU;MACrBG,YAAY,EAAGA;IAAc,CAC7B;EAAC,CACS,CACb,CAAC;EAED,OAAOQ,IAAI;AACZ;;AAEA;AACA;AACA;AACA,OAAO,SAASgD,kBAAkBA,CAAA,EAAG;EACpChF,UAAU,CAAE,gCAAgC,EAAE;IAC7CiF,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;AAEA,SAASC,OAAO,IAAIC,iCAAiC,QAAQ,gDAAgD;AAC7G,SAASpE,iCAAiC;AAC1C,SAASpB,KAAK,QAAQ,SAAS;AAC/B,cAAc,cAAc","ignoreList":[]}
|
|
@@ -11,14 +11,14 @@ export const getEditedPostTemplateId = createRegistrySelector(select => () => {
|
|
|
11
11
|
slug
|
|
12
12
|
} = select(editorStore).getCurrentPost();
|
|
13
13
|
const {
|
|
14
|
-
|
|
14
|
+
getEntityRecord,
|
|
15
15
|
getEntityRecords,
|
|
16
16
|
canUser
|
|
17
17
|
} = select(coreStore);
|
|
18
18
|
const siteSettings = canUser('read', {
|
|
19
19
|
kind: 'root',
|
|
20
20
|
name: 'site'
|
|
21
|
-
}) ?
|
|
21
|
+
}) ? getEntityRecord('root', 'site') : undefined;
|
|
22
22
|
// First check if the current page is set as the posts page.
|
|
23
23
|
const isPostsPage = +postId === siteSettings?.page_for_posts;
|
|
24
24
|
if (isPostsPage) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createRegistrySelector","store","coreStore","editorStore","getEditedPostTemplateId","select","id","postId","type","postType","slug","getCurrentPost","
|
|
1
|
+
{"version":3,"names":["createRegistrySelector","store","coreStore","editorStore","getEditedPostTemplateId","select","id","postId","type","postType","slug","getCurrentPost","getEntityRecord","getEntityRecords","canUser","siteSettings","kind","name","undefined","isPostsPage","page_for_posts","getDefaultTemplateId","currentTemplate","getEditedPostAttribute","templateWithSameSlug","per_page","find","template","slugToCheck"],"sources":["@wordpress/edit-post/src/store/private-selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport const getEditedPostTemplateId = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst {\n\t\t\tid: postId,\n\t\t\ttype: postType,\n\t\t\tslug,\n\t\t} = select( editorStore ).getCurrentPost();\n\t\tconst { getEntityRecord, getEntityRecords, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\t// First check if the current page is set as the posts page.\n\t\tconst isPostsPage = +postId === siteSettings?.page_for_posts;\n\t\tif ( isPostsPage ) {\n\t\t\treturn select( coreStore ).getDefaultTemplateId( { slug: 'home' } );\n\t\t}\n\t\tconst currentTemplate =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\t\tif ( currentTemplate ) {\n\t\t\tconst templateWithSameSlug = getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\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 templateWithSameSlug.id;\n\t\t}\n\t\tlet slugToCheck;\n\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t// through template hierarchy.\n\t\tif ( slug ) {\n\t\t\tslugToCheck =\n\t\t\t\tpostType === 'page'\n\t\t\t\t\t? `${ postType }-${ slug }`\n\t\t\t\t\t: `single-${ postType }-${ slug }`;\n\t\t} else {\n\t\t\tslugToCheck = postType === 'page' ? 'page' : `single-${ postType }`;\n\t\t}\n\n\t\tif ( postType ) {\n\t\t\treturn select( coreStore ).getDefaultTemplateId( {\n\t\t\t\tslug: slugToCheck,\n\t\t\t} );\n\t\t}\n\t}\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AAExD,OAAO,MAAMC,uBAAuB,GAAGJ,sBAAsB,CAC1DK,MAAM,IAAM,MAAM;EACnB,MAAM;IACLC,EAAE,EAAEC,MAAM;IACVC,IAAI,EAAEC,QAAQ;IACdC;EACD,CAAC,GAAGL,MAAM,CAAEF,WAAY,CAAC,CAACQ,cAAc,CAAC,CAAC;EAC1C,MAAM;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAQ,CAAC,GACnDT,MAAM,CAAEH,SAAU,CAAC;EACpB,MAAMa,YAAY,GAAGD,OAAO,CAAE,MAAM,EAAE;IACrCE,IAAI,EAAE,MAAM;IACZC,IAAI,EAAE;EACP,CAAE,CAAC,GACAL,eAAe,CAAE,MAAM,EAAE,MAAO,CAAC,GACjCM,SAAS;EACZ;EACA,MAAMC,WAAW,GAAG,CAACZ,MAAM,KAAKQ,YAAY,EAAEK,cAAc;EAC5D,IAAKD,WAAW,EAAG;IAClB,OAAOd,MAAM,CAAEH,SAAU,CAAC,CAACmB,oBAAoB,CAAE;MAAEX,IAAI,EAAE;IAAO,CAAE,CAAC;EACpE;EACA,MAAMY,eAAe,GACpBjB,MAAM,CAAEF,WAAY,CAAC,CAACoB,sBAAsB,CAAE,UAAW,CAAC;EAC3D,IAAKD,eAAe,EAAG;IACtB,MAAME,oBAAoB,GAAGX,gBAAgB,CAC5C,UAAU,EACV,aAAa,EACb;MAAEY,QAAQ,EAAE,CAAC;IAAE,CAChB,CAAC,EAAEC,IAAI,CAAIC,QAAQ,IAAMA,QAAQ,CAACjB,IAAI,KAAKY,eAAgB,CAAC;IAC5D,IAAK,CAAEE,oBAAoB,EAAG;MAC7B,OAAOA,oBAAoB;IAC5B;IACA,OAAOA,oBAAoB,CAAClB,EAAE;EAC/B;EACA,IAAIsB,WAAW;EACf;EACA;EACA;EACA;EACA,IAAKlB,IAAI,EAAG;IACXkB,WAAW,GACVnB,QAAQ,KAAK,MAAM,GACf,GAAGA,QAAU,IAAIC,IAAM,EAAC,GACxB,UAAUD,QAAU,IAAIC,IAAM,EAAC;EACrC,CAAC,MAAM;IACNkB,WAAW,GAAGnB,QAAQ,KAAK,MAAM,GAAG,MAAM,GAAI,UAAUA,QAAU,EAAC;EACpE;EAEA,IAAKA,QAAQ,EAAG;IACf,OAAOJ,MAAM,CAAEH,SAAU,CAAC,CAACmB,oBAAoB,CAAE;MAChDX,IAAI,EAAEkB;IACP,CAAE,CAAC;EACJ;AACD,CACD,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.1-next.5368f64a9.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -28,35 +28,35 @@
|
|
|
28
28
|
"react-native": "src/index",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.16.0",
|
|
31
|
-
"@wordpress/a11y": "^4.
|
|
32
|
-
"@wordpress/api-fetch": "^7.
|
|
33
|
-
"@wordpress/block-editor": "^14.1.0",
|
|
34
|
-
"@wordpress/block-library": "^9.
|
|
35
|
-
"@wordpress/blocks": "^13.
|
|
36
|
-
"@wordpress/commands": "^1.
|
|
37
|
-
"@wordpress/components": "^28.
|
|
38
|
-
"@wordpress/compose": "^7.
|
|
39
|
-
"@wordpress/core-commands": "^1.
|
|
40
|
-
"@wordpress/core-data": "^7.
|
|
41
|
-
"@wordpress/data": "^10.
|
|
42
|
-
"@wordpress/deprecated": "^4.
|
|
43
|
-
"@wordpress/dom": "^4.
|
|
44
|
-
"@wordpress/editor": "^14.
|
|
45
|
-
"@wordpress/element": "^6.
|
|
46
|
-
"@wordpress/hooks": "^4.
|
|
47
|
-
"@wordpress/html-entities": "^4.
|
|
48
|
-
"@wordpress/i18n": "^5.
|
|
49
|
-
"@wordpress/icons": "^10.
|
|
50
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
51
|
-
"@wordpress/keycodes": "^4.
|
|
52
|
-
"@wordpress/notices": "^5.
|
|
53
|
-
"@wordpress/plugins": "^7.
|
|
54
|
-
"@wordpress/preferences": "^4.
|
|
55
|
-
"@wordpress/private-apis": "^1.
|
|
56
|
-
"@wordpress/url": "^4.
|
|
57
|
-
"@wordpress/viewport": "^6.
|
|
58
|
-
"@wordpress/warning": "^3.
|
|
59
|
-
"@wordpress/widgets": "^4.
|
|
31
|
+
"@wordpress/a11y": "^4.7.1-next.5368f64a9.0",
|
|
32
|
+
"@wordpress/api-fetch": "^7.7.1-next.5368f64a9.0",
|
|
33
|
+
"@wordpress/block-editor": "^14.2.1-next.5368f64a9.0",
|
|
34
|
+
"@wordpress/block-library": "^9.7.1-next.5368f64a9.0",
|
|
35
|
+
"@wordpress/blocks": "^13.7.1-next.5368f64a9.0",
|
|
36
|
+
"@wordpress/commands": "^1.7.1-next.5368f64a9.0",
|
|
37
|
+
"@wordpress/components": "^28.8.1-next.5368f64a9.0",
|
|
38
|
+
"@wordpress/compose": "^7.8.1-next.5368f64a9.0",
|
|
39
|
+
"@wordpress/core-commands": "^1.7.1-next.5368f64a9.0",
|
|
40
|
+
"@wordpress/core-data": "^7.7.1-next.5368f64a9.0",
|
|
41
|
+
"@wordpress/data": "^10.7.1-next.5368f64a9.0",
|
|
42
|
+
"@wordpress/deprecated": "^4.7.1-next.5368f64a9.0",
|
|
43
|
+
"@wordpress/dom": "^4.7.1-next.5368f64a9.0",
|
|
44
|
+
"@wordpress/editor": "^14.7.1-next.5368f64a9.0",
|
|
45
|
+
"@wordpress/element": "^6.7.1-next.5368f64a9.0",
|
|
46
|
+
"@wordpress/hooks": "^4.7.1-next.5368f64a9.0",
|
|
47
|
+
"@wordpress/html-entities": "^4.7.1-next.5368f64a9.0",
|
|
48
|
+
"@wordpress/i18n": "^5.7.1-next.5368f64a9.0",
|
|
49
|
+
"@wordpress/icons": "^10.7.1-next.5368f64a9.0",
|
|
50
|
+
"@wordpress/keyboard-shortcuts": "^5.7.1-next.5368f64a9.0",
|
|
51
|
+
"@wordpress/keycodes": "^4.7.1-next.5368f64a9.0",
|
|
52
|
+
"@wordpress/notices": "^5.7.1-next.5368f64a9.0",
|
|
53
|
+
"@wordpress/plugins": "^7.7.1-next.5368f64a9.0",
|
|
54
|
+
"@wordpress/preferences": "^4.7.1-next.5368f64a9.0",
|
|
55
|
+
"@wordpress/private-apis": "^1.7.1-next.5368f64a9.0",
|
|
56
|
+
"@wordpress/url": "^4.7.1-next.5368f64a9.0",
|
|
57
|
+
"@wordpress/viewport": "^6.7.1-next.5368f64a9.0",
|
|
58
|
+
"@wordpress/warning": "^3.7.1-next.5368f64a9.0",
|
|
59
|
+
"@wordpress/widgets": "^4.7.1-next.5368f64a9.0",
|
|
60
60
|
"clsx": "^2.1.1",
|
|
61
61
|
"memize": "^2.1.0"
|
|
62
62
|
},
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "24934a1f5251bbee15045d1fd953d9c5650317cd"
|
|
71
71
|
}
|
|
@@ -91,6 +91,8 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
|
|
|
91
91
|
return (
|
|
92
92
|
<motion.div whileHover="expand">
|
|
93
93
|
<Button
|
|
94
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
95
|
+
__next40pxDefaultSize={ false }
|
|
94
96
|
className={ classes }
|
|
95
97
|
href={ buttonHref }
|
|
96
98
|
label={ buttonLabel }
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
right: 9px;
|
|
33
33
|
bottom: 9px + $border-width; // Height of toolbar in edit-post (not edit-site) is 61px tall.
|
|
34
34
|
left: 9px;
|
|
35
|
-
border-radius: $radius-
|
|
35
|
+
border-radius: $radius-small + $border-width + $border-width;
|
|
36
36
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-900;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
.edit-post-fullscreen-mode-close_site-icon {
|
|
55
55
|
width: $button-size;
|
|
56
56
|
height: $button-size;
|
|
57
|
-
border-radius: $radius-
|
|
57
|
+
border-radius: $radius-small;
|
|
58
58
|
object-fit: cover;
|
|
59
59
|
// Compensate for the top-bar border.
|
|
60
60
|
margin-top: -($border-width);
|
|
@@ -17,22 +17,6 @@ export function getPostEditURL( postId ) {
|
|
|
17
17
|
return addQueryArgs( 'post.php', { post: postId, action: 'edit' } );
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Returns the Post's Trashed URL.
|
|
22
|
-
*
|
|
23
|
-
* @param {number} postId Post ID.
|
|
24
|
-
* @param {string} postType Post Type.
|
|
25
|
-
*
|
|
26
|
-
* @return {string} Post trashed URL.
|
|
27
|
-
*/
|
|
28
|
-
export function getPostTrashedURL( postId, postType ) {
|
|
29
|
-
return addQueryArgs( 'edit.php', {
|
|
30
|
-
trashed: 1,
|
|
31
|
-
post_type: postType,
|
|
32
|
-
ids: postId,
|
|
33
|
-
} );
|
|
34
|
-
}
|
|
35
|
-
|
|
36
20
|
export class BrowserURL extends Component {
|
|
37
21
|
constructor() {
|
|
38
22
|
super( ...arguments );
|
|
@@ -43,17 +27,9 @@ export class BrowserURL extends Component {
|
|
|
43
27
|
}
|
|
44
28
|
|
|
45
29
|
componentDidUpdate( prevProps ) {
|
|
46
|
-
const { postId, postStatus,
|
|
47
|
-
this.props;
|
|
30
|
+
const { postId, postStatus, hasHistory } = this.props;
|
|
48
31
|
const { historyId } = this.state;
|
|
49
32
|
|
|
50
|
-
// Posts are still dirty while saving so wait for saving to finish
|
|
51
|
-
// to avoid the unsaved changes warning when trashing posts.
|
|
52
|
-
if ( postStatus === 'trash' && ! isSavingPost ) {
|
|
53
|
-
this.setTrashURL( postId, postType );
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
33
|
if (
|
|
58
34
|
( postId !== prevProps.postId || postId !== historyId ) &&
|
|
59
35
|
postStatus !== 'auto-draft' &&
|
|
@@ -64,16 +40,6 @@ export class BrowserURL extends Component {
|
|
|
64
40
|
}
|
|
65
41
|
}
|
|
66
42
|
|
|
67
|
-
/**
|
|
68
|
-
* Navigates the browser to the post trashed URL to show a notice about the trashed post.
|
|
69
|
-
*
|
|
70
|
-
* @param {number} postId Post ID.
|
|
71
|
-
* @param {string} postType Post Type.
|
|
72
|
-
*/
|
|
73
|
-
setTrashURL( postId, postType ) {
|
|
74
|
-
window.location.href = getPostTrashedURL( postId, postType );
|
|
75
|
-
}
|
|
76
|
-
|
|
77
43
|
/**
|
|
78
44
|
* Replaces the browser URL with a post editor link for the given post ID.
|
|
79
45
|
*
|
|
@@ -101,7 +67,7 @@ export class BrowserURL extends Component {
|
|
|
101
67
|
}
|
|
102
68
|
|
|
103
69
|
export default withSelect( ( select ) => {
|
|
104
|
-
const { getCurrentPost
|
|
70
|
+
const { getCurrentPost } = select( editorStore );
|
|
105
71
|
const post = getCurrentPost();
|
|
106
72
|
let { id, status, type } = post;
|
|
107
73
|
const isTemplate = [ 'wp_template', 'wp_template_part' ].includes( type );
|
|
@@ -112,7 +78,5 @@ export default withSelect( ( select ) => {
|
|
|
112
78
|
return {
|
|
113
79
|
postId: id,
|
|
114
80
|
postStatus: status,
|
|
115
|
-
postType: type,
|
|
116
|
-
isSavingPost: isSavingPost(),
|
|
117
81
|
};
|
|
118
82
|
} )( BrowserURL );
|
|
@@ -6,7 +6,7 @@ import { render } from '@testing-library/react';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { getPostEditURL,
|
|
9
|
+
import { getPostEditURL, BrowserURL } from '../';
|
|
10
10
|
|
|
11
11
|
describe( 'getPostEditURL', () => {
|
|
12
12
|
it( 'should generate relative path with post and action arguments', () => {
|
|
@@ -16,14 +16,6 @@ describe( 'getPostEditURL', () => {
|
|
|
16
16
|
} );
|
|
17
17
|
} );
|
|
18
18
|
|
|
19
|
-
describe( 'getPostTrashedURL', () => {
|
|
20
|
-
it( 'should generate relative path with post and action arguments', () => {
|
|
21
|
-
const url = getPostTrashedURL( 1, 'page' );
|
|
22
|
-
|
|
23
|
-
expect( url ).toBe( 'edit.php?trashed=1&post_type=page&ids=1' );
|
|
24
|
-
} );
|
|
25
|
-
} );
|
|
26
|
-
|
|
27
19
|
describe( 'BrowserURL', () => {
|
|
28
20
|
let replaceStateSpy;
|
|
29
21
|
|
|
@@ -24,18 +24,18 @@ export const useUpdatePostLinkListener = () => {
|
|
|
24
24
|
} ),
|
|
25
25
|
[]
|
|
26
26
|
);
|
|
27
|
-
const
|
|
27
|
+
const nodeToUpdateRef = useRef();
|
|
28
28
|
|
|
29
29
|
useEffect( () => {
|
|
30
|
-
|
|
30
|
+
nodeToUpdateRef.current =
|
|
31
31
|
document.querySelector( VIEW_AS_PREVIEW_LINK_SELECTOR ) ||
|
|
32
32
|
document.querySelector( VIEW_AS_LINK_SELECTOR );
|
|
33
33
|
}, [] );
|
|
34
34
|
|
|
35
35
|
useEffect( () => {
|
|
36
|
-
if ( ! newPermalink || !
|
|
36
|
+
if ( ! newPermalink || ! nodeToUpdateRef.current ) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
nodeToUpdateRef.current.setAttribute( 'href', newPermalink );
|
|
40
40
|
}, [ newPermalink ] );
|
|
41
41
|
};
|
|
@@ -74,7 +74,6 @@ function useEditorStyles() {
|
|
|
74
74
|
hasThemeStyleSupport,
|
|
75
75
|
editorSettings,
|
|
76
76
|
isZoomedOutView,
|
|
77
|
-
hasMetaBoxes,
|
|
78
77
|
renderingMode,
|
|
79
78
|
postType,
|
|
80
79
|
} = useSelect( ( select ) => {
|
|
@@ -86,7 +85,6 @@ function useEditorStyles() {
|
|
|
86
85
|
select( editPostStore ).isFeatureActive( 'themeStyles' ),
|
|
87
86
|
editorSettings: select( editorStore ).getEditorSettings(),
|
|
88
87
|
isZoomedOutView: __unstableGetEditorMode() === 'zoom-out',
|
|
89
|
-
hasMetaBoxes: select( editPostStore ).hasMetaBoxes(),
|
|
90
88
|
renderingMode: getRenderingMode(),
|
|
91
89
|
postType: _postType,
|
|
92
90
|
};
|
|
@@ -128,20 +126,17 @@ function useEditorStyles() {
|
|
|
128
126
|
? editorSettings.styles ?? []
|
|
129
127
|
: defaultEditorStyles;
|
|
130
128
|
|
|
131
|
-
// Add a
|
|
132
|
-
//
|
|
129
|
+
// Add a space for the typewriter effect. When typing in the last block,
|
|
130
|
+
// there needs to be room to scroll up.
|
|
133
131
|
if (
|
|
134
132
|
! isZoomedOutView &&
|
|
135
|
-
! hasMetaBoxes &&
|
|
136
133
|
renderingMode === 'post-only' &&
|
|
137
134
|
! DESIGN_POST_TYPES.includes( postType )
|
|
138
135
|
) {
|
|
139
136
|
return [
|
|
140
137
|
...baseStyles,
|
|
141
138
|
{
|
|
142
|
-
|
|
143
|
-
// specificity.
|
|
144
|
-
css: ':root :where(body){padding-bottom: 40vh}',
|
|
139
|
+
css: ':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}',
|
|
145
140
|
},
|
|
146
141
|
];
|
|
147
142
|
}
|
|
@@ -18,12 +18,12 @@ export function usePaddingAppender() {
|
|
|
18
18
|
const { ownerDocument } = node;
|
|
19
19
|
const { defaultView } = ownerDocument;
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
defaultView.getComputedStyle( node ).
|
|
21
|
+
const pseudoHeight = defaultView.parseInt(
|
|
22
|
+
defaultView.getComputedStyle( node, ':after' ).height,
|
|
23
23
|
10
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
if ( !
|
|
26
|
+
if ( ! pseudoHeight ) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -38,25 +38,20 @@ export function usePaddingAppender() {
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
event.
|
|
41
|
+
event.stopPropagation();
|
|
42
42
|
|
|
43
43
|
const blockOrder = registry
|
|
44
44
|
.select( blockEditorStore )
|
|
45
45
|
.getBlockOrder( '' );
|
|
46
46
|
const lastBlockClientId = blockOrder[ blockOrder.length - 1 ];
|
|
47
47
|
|
|
48
|
-
// Do nothing when only default block appender is present.
|
|
49
|
-
if ( ! lastBlockClientId ) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
48
|
const lastBlock = registry
|
|
54
49
|
.select( blockEditorStore )
|
|
55
50
|
.getBlock( lastBlockClientId );
|
|
56
51
|
const { selectBlock, insertDefaultBlock } =
|
|
57
52
|
registry.dispatch( blockEditorStore );
|
|
58
53
|
|
|
59
|
-
if ( isUnmodifiedDefaultBlock( lastBlock ) ) {
|
|
54
|
+
if ( lastBlock && isUnmodifiedDefaultBlock( lastBlock ) ) {
|
|
60
55
|
selectBlock( lastBlockClientId );
|
|
61
56
|
} else {
|
|
62
57
|
insertDefaultBlock();
|
|
@@ -39,6 +39,8 @@ export function CustomFieldsConfirmation( { willEnable } ) {
|
|
|
39
39
|
) }
|
|
40
40
|
</p>
|
|
41
41
|
<Button
|
|
42
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
43
|
+
__next40pxDefaultSize={ false }
|
|
42
44
|
className="edit-post-preferences-modal__custom-fields-confirmation-button"
|
|
43
45
|
variant="secondary"
|
|
44
46
|
isBusy={ isReloading }
|
package/src/index.js
CHANGED
|
@@ -70,9 +70,17 @@ export function initializeEditor(
|
|
|
70
70
|
showBlockBreadcrumbs: true,
|
|
71
71
|
showIconLabels: false,
|
|
72
72
|
showListViewByDefault: false,
|
|
73
|
+
enableChoosePatternModal: true,
|
|
73
74
|
isPublishSidebarEnabled: true,
|
|
74
75
|
} );
|
|
75
76
|
|
|
77
|
+
if ( window.__experimentalMediaProcessing ) {
|
|
78
|
+
dispatch( preferencesStore ).setDefaults( 'core/media', {
|
|
79
|
+
requireApproval: true,
|
|
80
|
+
optimizeOnUpload: true,
|
|
81
|
+
} );
|
|
82
|
+
}
|
|
83
|
+
|
|
76
84
|
dispatch( blocksStore ).reapplyBlockTypeFilters();
|
|
77
85
|
|
|
78
86
|
// Check if the block list view should be open by default.
|
|
@@ -12,12 +12,13 @@ export const getEditedPostTemplateId = createRegistrySelector(
|
|
|
12
12
|
type: postType,
|
|
13
13
|
slug,
|
|
14
14
|
} = select( editorStore ).getCurrentPost();
|
|
15
|
-
const {
|
|
15
|
+
const { getEntityRecord, getEntityRecords, canUser } =
|
|
16
|
+
select( coreStore );
|
|
16
17
|
const siteSettings = canUser( 'read', {
|
|
17
18
|
kind: 'root',
|
|
18
19
|
name: 'site',
|
|
19
20
|
} )
|
|
20
|
-
?
|
|
21
|
+
? getEntityRecord( 'root', 'site' )
|
|
21
22
|
: undefined;
|
|
22
23
|
// First check if the current page is set as the posts page.
|
|
23
24
|
const isPostsPage = +postId === siteSettings?.page_for_posts;
|