@wordpress/editor 14.0.3 → 14.0.5
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/build/bindings/pattern-overrides.js +8 -5
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +4 -0
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/editor/index.js +5 -0
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-interface/index.js +2 -1
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +2 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-actions/actions.js +14 -36
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/export-pattern-action.js +2 -2
- package/build/components/post-actions/export-pattern-action.js.map +1 -1
- package/build/components/post-saved-state/index.js +11 -1
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-status/index.js +2 -1
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/save-publish-panels/index.js +30 -16
- package/build/components/save-publish-panels/index.js.map +1 -1
- package/build/hooks/pattern-overrides.js +2 -2
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/store/utils/is-template-revertable.js +6 -8
- package/build/store/utils/is-template-revertable.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +8 -5
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +4 -0
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/editor/index.js +5 -0
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-interface/index.js +2 -1
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +2 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-actions/actions.js +14 -36
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/export-pattern-action.js +2 -2
- package/build-module/components/post-actions/export-pattern-action.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +11 -1
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-status/index.js +1 -1
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +30 -16
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +3 -1
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/store/utils/is-template-revertable.js +6 -8
- package/build-module/store/utils/is-template-revertable.js.map +1 -1
- package/build-style/style-rtl.css +13 -1
- package/build-style/style.css +13 -1
- package/package.json +6 -6
- package/src/bindings/pattern-overrides.js +9 -10
- package/src/bindings/post-meta.js +5 -0
- package/src/components/editor/index.js +6 -0
- package/src/components/editor-interface/index.js +17 -12
- package/src/components/page-attributes/parent.js +6 -3
- package/src/components/post-actions/actions.js +33 -58
- package/src/components/post-actions/export-pattern-action.js +4 -2
- package/src/components/post-featured-image/style.scss +15 -0
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-saved-state/index.js +11 -1
- package/src/components/post-status/index.js +1 -1
- package/src/components/save-publish-panels/index.js +33 -23
- package/src/components/visual-editor/style.scss +1 -1
- package/src/hooks/pattern-overrides.js +4 -1
- package/src/store/utils/is-template-revertable.js +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","CheckboxControl","Dropdown","__experimentalText","Text","__experimentalVStack","VStack","TextControl","RadioControl","__","sprintf","useDispatch","useSelect","useState","useMemo","store","coreStore","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","useInstanceId","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","NAVIGATION_POST_TYPE","PostPanelRow","PrivatePostSchedule","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","labels","draft","pending","private","future","publish","STATUS_OPTIONS","label","children","variant","size","value","DESIGN_POST_TYPES","PostStatus","status","date","password","postId","postType","canEdit","select","_getCurrentPost$_link","getEditedPostAttribute","getCurrentPostId","getCurrentPostType","getCurrentPost","_links","showPassword","setShowPassword","passwordInputId","editEntityRecord","popoverAnchor","setPopoverAnchor","popoverProps","anchor","headerTitle","placement","offset","shift","includes","updatePost","newStatus","newPassword","newDate","handleTogglePassword","handleStatus","Date","ref","className","contentClassName","focusOnMount","renderToggle","onToggle","onClick","renderContent","onClose","title","spacing","hideLabelFromVision","options","onChange","selected","showPopoverHeaderActions","isCompact","as","__nextHasNoMarginBottom","help","checked","placeholder","type","id","__next40pxDefaultSize"],"sources":["@wordpress/editor/src/components/post-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCheckboxControl,\n\tDropdown,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tTextControl,\n\tRadioControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport PostPanelRow from '../post-panel-row';\nimport { PrivatePostSchedule } from '../post-schedule';\nimport { store as editorStore } from '../../store';\n\nconst labels = {\n\t'auto-draft': __( 'Draft' ),\n\tdraft: __( 'Draft' ),\n\tpending: __( 'Pending' ),\n\tprivate: __( 'Private' ),\n\tfuture: __( 'Scheduled' ),\n\tpublish: __( 'Published' ),\n};\n\nconst STATUS_OPTIONS = [\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Draft' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Not ready to publish.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'draft',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Pending' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Waiting for review before publishing.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'pending',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Private' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Only visible to site admins and editors.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'private',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Scheduled' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Publish automatically on a chosen date.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'future',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Published' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Visible to everyone.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'publish',\n\t},\n];\n\nconst DESIGN_POST_TYPES = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n];\n\nexport default function PostStatus() {\n\tconst { status, date, password, postId, postType, canEdit } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPost,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tstatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tdate: getEditedPostAttribute( 'date' ),\n\t\t\t\tpassword: getEditedPostAttribute( 'password' ),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tcanEdit:\n\t\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ showPassword, setShowPassword ] = useState( !! password );\n\tconst passwordInputId = useInstanceId(\n\t\tPostStatus,\n\t\t'editor-change-status__password-input'\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': __( 'Status & visibility' ),\n\t\t\theaderTitle: __( 'Status & visibility' ),\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( DESIGN_POST_TYPES.includes( postType ) ) {\n\t\treturn null;\n\t}\n\n\tconst updatePost = ( {\n\t\tstatus: newStatus = status,\n\t\tpassword: newPassword = password,\n\t\tdate: newDate = date,\n\t} ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tstatus: newStatus,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\tconst handleTogglePassword = ( value ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tupdatePost( { password: '' } );\n\t\t}\n\t};\n\n\tconst handleStatus = ( value ) => {\n\t\tlet newDate = date;\n\t\tlet newPassword = password;\n\t\tif ( status === 'future' && new Date( date ) > new Date() ) {\n\t\t\tnewDate = null;\n\t\t}\n\t\tif ( value === 'private' && password ) {\n\t\t\tnewPassword = '';\n\t\t}\n\t\tupdatePost( {\n\t\t\tstatus: value,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Status' ) } ref={ setPopoverAnchor }>\n\t\t\t{ canEdit ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tclassName=\"editor-post-status\"\n\t\t\t\t\tcontentClassName=\"editor-change-status__content\"\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post status.\n\t\t\t\t\t\t\t\t__( 'Change post status: %s' ),\n\t\t\t\t\t\t\t\tlabels[ status ]\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels[ status ] }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Status & visibility' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Status' ) }\n\t\t\t\t\t\t\t\t\t\toptions={ STATUS_OPTIONS }\n\t\t\t\t\t\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\t\t\tstatus === 'auto-draft'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t\t\t\t: status\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ status === 'future' && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__publish-date-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<PrivatePostSchedule\n\t\t\t\t\t\t\t\t\t\t\t\tshowPopoverHeaderActions={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tisCompact\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ status !== 'private' && (\n\t\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\t\tas=\"fieldset\"\n\t\t\t\t\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__password-fieldset\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Password protected'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Only visible to those who know the password'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tchecked={ showPassword }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleTogglePassword\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ showPassword && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__password-input\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePost( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Use a secure password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ passwordInputId }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div className=\"editor-post-status is-read-only\">\n\t\t\t\t\t{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QAAQ,iBACpBnB,IAAA;cAAKqD,SAAS,EAAC,4CAA4C;cAAAxC,QAAA,eAC1Db,IAAA,CAACH,mBAAmB;gBACnBsE,wBAAwB,EACvB,KACA;gBACDC,SAAS;cAAA,CACT;YAAC,CACE,CACL,EACCjD,MAAM,KAAK,SAAS,iBACrBf,KAAA,CAAC1B,MAAM;cACN2F,EAAE,EAAC,UAAU;cACbP,OAAO,EAAG,CAAG;cACbT,SAAS,EAAC,yCAAyC;cAAAxC,QAAA,gBAEnDb,IAAA,CAAC3B,eAAe;gBACfiG,uBAAuB;gBACvB1D,KAAK,EAAG/B,EAAE,CACT,oBACD,CAAG;gBACH0F,IAAI,EAAG1F,EAAE,CACR,6CACD,CAAG;gBACH2F,OAAO,EAAGxC,YAAc;gBACxBiC,QAAQ,EACPhB;cACA,CACD,CAAC,EACAjB,YAAY,iBACbhC,IAAA;gBAAKqD,SAAS,EAAC,sCAAsC;gBAAAxC,QAAA,eACpDb,IAAA,CAACrB,WAAW;kBACXiC,KAAK,EAAG/B,EAAE,CACT,UACD,CAAG;kBACHoF,QAAQ,EAAKjD,KAAK,IACjB6B,UAAU,CAAE;oBACXxB,QAAQ,EAAEL;kBACX,CAAE,CACF;kBACDA,KAAK,EAAGK,QAAU;kBAClBoD,WAAW,EAAG5F,EAAE,CACf,uBACD,CAAG;kBACH6F,IAAI,EAAC,MAAM;kBACXC,EAAE,EAAGzC,eAAiB;kBACtB0C,qBAAqB;kBACrBN,uBAAuB;gBAAA,CACvB;cAAC,CACE,CACL;YAAA,CACM,CACR;UAAA,CACM;QAAC,CACJ,CAAC;MAAA,CACN;IACA,CACH,CAAC,gBAEFtE,IAAA;MAAKqD,SAAS,EAAC,iCAAiC;MAAAxC,QAAA,EAC7CR,MAAM,CAAEc,MAAM;IAAE,CACd;EACL,CACY,CAAC;AAEjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Button","CheckboxControl","Dropdown","__experimentalText","Text","__experimentalVStack","VStack","TextControl","RadioControl","__","sprintf","useDispatch","useSelect","useState","useMemo","store","coreStore","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","useInstanceId","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","NAVIGATION_POST_TYPE","PostPanelRow","PrivatePostSchedule","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","labels","draft","pending","private","future","publish","STATUS_OPTIONS","label","children","variant","size","value","DESIGN_POST_TYPES","PostStatus","status","date","password","postId","postType","canEdit","select","_getCurrentPost$_link","getEditedPostAttribute","getCurrentPostId","getCurrentPostType","getCurrentPost","_links","showPassword","setShowPassword","passwordInputId","editEntityRecord","popoverAnchor","setPopoverAnchor","popoverProps","anchor","headerTitle","placement","offset","shift","includes","updatePost","newStatus","newPassword","newDate","handleTogglePassword","handleStatus","Date","ref","className","contentClassName","focusOnMount","renderToggle","onToggle","onClick","renderContent","onClose","title","spacing","hideLabelFromVision","options","onChange","selected","showPopoverHeaderActions","isCompact","as","__nextHasNoMarginBottom","help","checked","placeholder","type","id","__next40pxDefaultSize"],"sources":["@wordpress/editor/src/components/post-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCheckboxControl,\n\tDropdown,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tTextControl,\n\tRadioControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport PostPanelRow from '../post-panel-row';\nimport { PrivatePostSchedule } from '../post-schedule';\nimport { store as editorStore } from '../../store';\n\nconst labels = {\n\t'auto-draft': __( 'Draft' ),\n\tdraft: __( 'Draft' ),\n\tpending: __( 'Pending' ),\n\tprivate: __( 'Private' ),\n\tfuture: __( 'Scheduled' ),\n\tpublish: __( 'Published' ),\n};\n\nexport const STATUS_OPTIONS = [\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Draft' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Not ready to publish.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'draft',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Pending' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Waiting for review before publishing.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'pending',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Private' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Only visible to site admins and editors.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'private',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Scheduled' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Publish automatically on a chosen date.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'future',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Published' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Visible to everyone.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'publish',\n\t},\n];\n\nconst DESIGN_POST_TYPES = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n];\n\nexport default function PostStatus() {\n\tconst { status, date, password, postId, postType, canEdit } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPost,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tstatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tdate: getEditedPostAttribute( 'date' ),\n\t\t\t\tpassword: getEditedPostAttribute( 'password' ),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tcanEdit:\n\t\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ showPassword, setShowPassword ] = useState( !! password );\n\tconst passwordInputId = useInstanceId(\n\t\tPostStatus,\n\t\t'editor-change-status__password-input'\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': __( 'Status & visibility' ),\n\t\t\theaderTitle: __( 'Status & visibility' ),\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( DESIGN_POST_TYPES.includes( postType ) ) {\n\t\treturn null;\n\t}\n\n\tconst updatePost = ( {\n\t\tstatus: newStatus = status,\n\t\tpassword: newPassword = password,\n\t\tdate: newDate = date,\n\t} ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tstatus: newStatus,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\tconst handleTogglePassword = ( value ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tupdatePost( { password: '' } );\n\t\t}\n\t};\n\n\tconst handleStatus = ( value ) => {\n\t\tlet newDate = date;\n\t\tlet newPassword = password;\n\t\tif ( status === 'future' && new Date( date ) > new Date() ) {\n\t\t\tnewDate = null;\n\t\t}\n\t\tif ( value === 'private' && password ) {\n\t\t\tnewPassword = '';\n\t\t}\n\t\tupdatePost( {\n\t\t\tstatus: value,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Status' ) } ref={ setPopoverAnchor }>\n\t\t\t{ canEdit ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tclassName=\"editor-post-status\"\n\t\t\t\t\tcontentClassName=\"editor-change-status__content\"\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post status.\n\t\t\t\t\t\t\t\t__( 'Change post status: %s' ),\n\t\t\t\t\t\t\t\tlabels[ status ]\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels[ status ] }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Status & visibility' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Status' ) }\n\t\t\t\t\t\t\t\t\t\toptions={ STATUS_OPTIONS }\n\t\t\t\t\t\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\t\t\tstatus === 'auto-draft'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t\t\t\t: status\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ status === 'future' && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__publish-date-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<PrivatePostSchedule\n\t\t\t\t\t\t\t\t\t\t\t\tshowPopoverHeaderActions={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tisCompact\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ status !== 'private' && (\n\t\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\t\tas=\"fieldset\"\n\t\t\t\t\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__password-fieldset\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Password protected'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Only visible to those who know the password'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tchecked={ showPassword }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleTogglePassword\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ showPassword && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__password-input\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePost( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Use a secure password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ passwordInputId }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div className=\"editor-post-status is-read-only\">\n\t\t\t\t\t{ labels[ status ] }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,eAAe,EACfC,QAAQ,EACRC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,EACXC,YAAY,QACN,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,oBAAoB,QACd,uBAAuB;AAC9B,OAAOC,YAAY,MAAM,mBAAmB;AAC5C,SAASC,mBAAmB,QAAQ,kBAAkB;AACtD,SAASV,KAAK,IAAIW,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAMC,MAAM,GAAG;EACd,YAAY,EAAExB,EAAE,CAAE,OAAQ,CAAC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ACtB0C,qBAAqB;kBACrBN,uBAAuB;gBAAA,CACvB;cAAC,CACE,CACL;YAAA,CACM,CACR;UAAA,CACM;QAAC,CACJ,CAAC;MAAA,CACN;IACA,CACH,CAAC,gBAEFtE,IAAA;MAAKqD,SAAS,EAAC,iCAAiC;MAAAxC,QAAA,EAC7CR,MAAM,CAAEc,MAAM;IAAE,CACd;EACL,CACY,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -35,13 +35,25 @@ export default function SavePublishPanels({
|
|
|
35
35
|
} = useDispatch(editorStore);
|
|
36
36
|
const {
|
|
37
37
|
publishSidebarOpened,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
isPublishable,
|
|
39
|
+
isDirty,
|
|
40
|
+
hasOtherEntitiesChanges
|
|
41
|
+
} = useSelect(select => {
|
|
42
|
+
const {
|
|
43
|
+
isPublishSidebarOpened,
|
|
44
|
+
isEditedPostPublishable,
|
|
45
|
+
isCurrentPostPublished,
|
|
46
|
+
isEditedPostDirty,
|
|
47
|
+
hasNonPostEntityChanges
|
|
48
|
+
} = select(editorStore);
|
|
49
|
+
const _hasOtherEntitiesChanges = hasNonPostEntityChanges() || unlock(select(editorStore)).hasPostMetaChanges();
|
|
50
|
+
return {
|
|
51
|
+
publishSidebarOpened: isPublishSidebarOpened(),
|
|
52
|
+
isPublishable: !isCurrentPostPublished() && isEditedPostPublishable(),
|
|
53
|
+
isDirty: _hasOtherEntitiesChanges || isEditedPostDirty(),
|
|
54
|
+
hasOtherEntitiesChanges: _hasOtherEntitiesChanges
|
|
55
|
+
};
|
|
56
|
+
}, []);
|
|
45
57
|
const openEntitiesSavedStates = useCallback(() => setEntitiesSavedStatesCallback(true), []);
|
|
46
58
|
|
|
47
59
|
// It is ok for these components to be unmounted when not in visual use.
|
|
@@ -54,26 +66,28 @@ export default function SavePublishPanels({
|
|
|
54
66
|
PrePublishExtension: PluginPrePublishPanel.Slot,
|
|
55
67
|
PostPublishExtension: PluginPostPublishPanel.Slot
|
|
56
68
|
});
|
|
57
|
-
} else if (
|
|
69
|
+
} else if (isPublishable && !hasOtherEntitiesChanges) {
|
|
58
70
|
unmountableContent = /*#__PURE__*/_jsx("div", {
|
|
59
|
-
className: "editor-layout__toggle-
|
|
71
|
+
className: "editor-layout__toggle-publish-panel",
|
|
60
72
|
children: /*#__PURE__*/_jsx(Button, {
|
|
61
73
|
variant: "secondary",
|
|
62
|
-
className: "editor-layout__toggle-
|
|
63
|
-
onClick:
|
|
74
|
+
className: "editor-layout__toggle-publish-panel-button",
|
|
75
|
+
onClick: togglePublishSidebar,
|
|
64
76
|
"aria-expanded": false,
|
|
65
|
-
children: __('Open
|
|
77
|
+
children: __('Open publish panel')
|
|
66
78
|
})
|
|
67
79
|
});
|
|
68
80
|
} else {
|
|
69
81
|
unmountableContent = /*#__PURE__*/_jsx("div", {
|
|
70
|
-
className: "editor-layout__toggle-
|
|
82
|
+
className: "editor-layout__toggle-entities-saved-states-panel",
|
|
71
83
|
children: /*#__PURE__*/_jsx(Button, {
|
|
72
84
|
variant: "secondary",
|
|
73
|
-
className: "editor-layout__toggle-
|
|
74
|
-
onClick:
|
|
85
|
+
className: "editor-layout__toggle-entities-saved-states-panel-button",
|
|
86
|
+
onClick: openEntitiesSavedStates,
|
|
75
87
|
"aria-expanded": false,
|
|
76
|
-
|
|
88
|
+
disabled: !isDirty,
|
|
89
|
+
__experimentalIsFocusable: true,
|
|
90
|
+
children: __('Open save panel')
|
|
77
91
|
})
|
|
78
92
|
});
|
|
79
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","Button","createSlotFill","__","useCallback","EntitiesSavedStates","PostPublishPanel","PluginPrePublishPanel","PluginPostPublishPanel","store","editorStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Fill","Slot","ActionsPanelFill","SavePublishPanels","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","closePublishSidebar","togglePublishSidebar","publishSidebarOpened","
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","Button","createSlotFill","__","useCallback","EntitiesSavedStates","PostPublishPanel","PluginPrePublishPanel","PluginPostPublishPanel","store","editorStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Fill","Slot","ActionsPanelFill","SavePublishPanels","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","closePublishSidebar","togglePublishSidebar","publishSidebarOpened","isPublishable","isDirty","hasOtherEntitiesChanges","select","isPublishSidebarOpened","isEditedPostPublishable","isCurrentPostPublished","isEditedPostDirty","hasNonPostEntityChanges","_hasOtherEntitiesChanges","hasPostMetaChanges","openEntitiesSavedStates","unmountableContent","onClose","forceIsDirty","PrePublishExtension","PostPublishExtension","className","children","variant","onClick","disabled","__experimentalIsFocusable","close","bubblesVirtually"],"sources":["@wordpress/editor/src/components/save-publish-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, createSlotFill } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntitiesSavedStates from '../entities-saved-states';\nimport PostPublishPanel from '../post-publish-panel';\nimport PluginPrePublishPanel from '../plugin-pre-publish-panel';\nimport PluginPostPublishPanel from '../plugin-post-publish-panel';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Fill, Slot } = createSlotFill( 'ActionsPanel' );\n\nexport const ActionsPanelFill = Fill;\n\nexport default function SavePublishPanels( {\n\tsetEntitiesSavedStatesCallback,\n\tcloseEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n\tforceIsDirtyPublishPanel,\n} ) {\n\tconst { closePublishSidebar, togglePublishSidebar } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tpublishSidebarOpened,\n\t\tisPublishable,\n\t\tisDirty,\n\t\thasOtherEntitiesChanges,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPublishSidebarOpened,\n\t\t\tisEditedPostPublishable,\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostDirty,\n\t\t\thasNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst _hasOtherEntitiesChanges =\n\t\t\thasNonPostEntityChanges() ||\n\t\t\tunlock( select( editorStore ) ).hasPostMetaChanges();\n\t\treturn {\n\t\t\tpublishSidebarOpened: isPublishSidebarOpened(),\n\t\t\tisPublishable:\n\t\t\t\t! isCurrentPostPublished() && isEditedPostPublishable(),\n\t\t\tisDirty: _hasOtherEntitiesChanges || isEditedPostDirty(),\n\t\t\thasOtherEntitiesChanges: _hasOtherEntitiesChanges,\n\t\t};\n\t}, [] );\n\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setEntitiesSavedStatesCallback( true ),\n\t\t[]\n\t);\n\n\t// It is ok for these components to be unmounted when not in visual use.\n\t// We don't want more than one present at a time, decide which to render.\n\tlet unmountableContent;\n\tif ( publishSidebarOpened ) {\n\t\tunmountableContent = (\n\t\t\t<PostPublishPanel\n\t\t\t\tonClose={ closePublishSidebar }\n\t\t\t\tforceIsDirty={ forceIsDirtyPublishPanel }\n\t\t\t\tPrePublishExtension={ PluginPrePublishPanel.Slot }\n\t\t\t\tPostPublishExtension={ PluginPostPublishPanel.Slot }\n\t\t\t/>\n\t\t);\n\t} else if ( isPublishable && ! hasOtherEntitiesChanges ) {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-publish-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-publish-panel-button\"\n\t\t\t\t\tonClick={ togglePublishSidebar }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open publish panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-entities-saved-states-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-entities-saved-states-panel-button\"\n\t\t\t\t\tonClick={ openEntitiesSavedStates }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Since EntitiesSavedStates controls its own panel, we can keep it\n\t// always mounted to retain its own component state (such as checkboxes).\n\treturn (\n\t\t<>\n\t\t\t{ isEntitiesSavedStatesOpen && (\n\t\t\t\t<EntitiesSavedStates close={ closeEntitiesSavedStates } />\n\t\t\t) }\n\t\t\t<Slot bubblesVirtually />\n\t\t\t{ ! isEntitiesSavedStatesOpen && unmountableContent }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,gBAAgB,MAAM,uBAAuB;AACpD,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,OAAOC,sBAAsB,MAAM,8BAA8B;AACjE,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC,I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BAAoB,EAAGrC,sBAAsB,CAACW;IAAM,CACpD,CACD;EACF,CAAC,MAAM,IAAKU,aAAa,IAAI,CAAEE,uBAAuB,EAAG;IACxDU,kBAAkB,gBACjB5B,IAAA;MAAKiC,SAAS,EAAC,qCAAqC;MAAAC,QAAA,eACnDlC,IAAA,CAACZ,MAAM;QACN+C,OAAO,EAAC,WAAW;QACnBF,SAAS,EAAC,4CAA4C;QACtDG,OAAO,EAAGtB,oBAAsB;QAChC,iBAAgB,KAAO;QAAAoB,QAAA,EAErB5C,EAAE,CAAE,oBAAqB;MAAC,CACrB;IAAC,CACL,CACL;EACF,CAAC,MAAM;IACNsC,kBAAkB,gBACjB5B,IAAA;MAAKiC,SAAS,EAAC,mDAAmD;MAAAC,QAAA,eACjElC,IAAA,CAACZ,MAAM;QACN+C,OAAO,EAAC,WAAW;QACnBF,SAAS,EAAC,0DAA0D;QACpEG,OAAO,EAAGT,uBAAyB;QACnC,iBAAgB,KAAO;QACvBU,QAAQ,EAAG,CAAEpB,OAAS;QACtBqB,yBAAyB;QAAAJ,QAAA,EAEvB5C,EAAE,CAAE,iBAAkB;MAAC,CAClB;IAAC,CACL,CACL;EACF;;EAEA;EACA;EACA,oBACCc,KAAA,CAAAF,SAAA;IAAAgC,QAAA,GACGvB,yBAAyB,iBAC1BX,IAAA,CAACR,mBAAmB;MAAC+C,KAAK,EAAG7B;IAA0B,CAAE,CACzD,eACDV,IAAA,CAACM,IAAI;MAACkC,gBAAgB;IAAA,CAAE,CAAC,EACvB,CAAE7B,yBAAyB,IAAIiB,kBAAkB;EAAA,CAClD,CAAC;AAEL","ignoreList":[]}
|
|
@@ -13,6 +13,8 @@ import { store as blocksStore } from '@wordpress/blocks';
|
|
|
13
13
|
*/
|
|
14
14
|
import { store as editorStore } from '../store';
|
|
15
15
|
import { unlock } from '../lock-unlock';
|
|
16
|
+
|
|
17
|
+
/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -43,7 +45,7 @@ const withPatternOverrideControls = createHigherOrderComponent(BlockEdit => prop
|
|
|
43
45
|
...props
|
|
44
46
|
}), isSupportedBlock && /*#__PURE__*/_jsx(PatternOverridesBlockControls, {})]
|
|
45
47
|
});
|
|
46
|
-
});
|
|
48
|
+
}, 'withPatternOverrideControls');
|
|
47
49
|
|
|
48
50
|
// Split into a separate component to avoid a store subscription
|
|
49
51
|
// on every block.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["addFilter","privateApis","patternsPrivateApis","createHigherOrderComponent","useBlockEditingMode","useSelect","store","blocksStore","editorStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PatternOverridesControls","ResetOverridesControl","PatternOverridesBlockControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","PATTERN_SYNC_TYPES","withPatternOverrideControls","BlockEdit","props","isSupportedBlock","name","children","isSelected","ControlsWithStoreSubscription","blockEditingMode","hasPatternOverridesSource","isEditingSyncedPattern","select","getBlockBindingsSource","getCurrentPostType","getEditedPostAttribute","user","wp_pattern_sync_status","unsynced","bindings","attributes","metadata","hasPatternBindings","Object","values","some","binding","source","shouldShowPatternOverridesControls","shouldShowResetOverridesControl"],"sources":["@wordpress/editor/src/hooks/pattern-overrides.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useBlockEditingMode } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst {\n\tPatternOverridesControls,\n\tResetOverridesControl,\n\tPatternOverridesBlockControls,\n\tPATTERN_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternsPrivateApis );\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a partial syncing controls to supported blocks in the pattern editor.\n * Currently, only the `core/paragraph` block is supported.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withPatternOverrideControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isSupportedBlock =\n\t\t\t!! PARTIAL_SYNCING_SUPPORTED_BLOCKS[ props.name ];\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ props.isSelected && isSupportedBlock && (\n\t\t\t\t\t<ControlsWithStoreSubscription { ...props } />\n\t\t\t\t) }\n\t\t\t\t{ isSupportedBlock && <PatternOverridesBlockControls /> }\n\t\t\t</>\n\t\t);\n\t}\n);\n\n// Split into a separate component to avoid a store subscription\n// on every block.\nfunction ControlsWithStoreSubscription( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst { hasPatternOverridesSource, isEditingSyncedPattern } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockBindingsSource } = unlock( select( blocksStore ) );\n\t\t\tconst { getCurrentPostType, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\t\thasPatternOverridesSource: !! getBlockBindingsSource(\n\t\t\t\t\t'core/pattern-overrides'\n\t\t\t\t),\n\t\t\t\tisEditingSyncedPattern:\n\t\t\t\t\tgetCurrentPostType() === PATTERN_TYPES.user &&\n\t\t\t\t\tgetEditedPostAttribute( 'meta' )?.wp_pattern_sync_status !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced &&\n\t\t\t\t\tgetEditedPostAttribute( 'wp_pattern_sync_status' ) !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst bindings = props.attributes.metadata?.bindings;\n\tconst hasPatternBindings =\n\t\t!! bindings &&\n\t\tObject.values( bindings ).some(\n\t\t\t( binding ) => binding.source === 'core/pattern-overrides'\n\t\t);\n\n\tconst shouldShowPatternOverridesControls =\n\t\tisEditingSyncedPattern && blockEditingMode === 'default';\n\tconst shouldShowResetOverridesControl =\n\t\t! isEditingSyncedPattern &&\n\t\t!! props.attributes.metadata?.name &&\n\t\tblockEditingMode !== 'disabled' &&\n\t\thasPatternBindings;\n\n\tif ( ! hasPatternOverridesSource ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ shouldShowPatternOverridesControls && (\n\t\t\t\t<PatternOverridesControls { ...props } />\n\t\t\t) }\n\t\t\t{ shouldShowResetOverridesControl && (\n\t\t\t\t<ResetOverridesControl { ...props } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-pattern-override-controls',\n\twithPatternOverrideControls\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AACxE,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,UAAU;AAC/C,SAASC,MAAM,QAAQ,gBAAgB;
|
|
1
|
+
{"version":3,"names":["addFilter","privateApis","patternsPrivateApis","createHigherOrderComponent","useBlockEditingMode","useSelect","store","blocksStore","editorStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PatternOverridesControls","ResetOverridesControl","PatternOverridesBlockControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","PATTERN_SYNC_TYPES","withPatternOverrideControls","BlockEdit","props","isSupportedBlock","name","children","isSelected","ControlsWithStoreSubscription","blockEditingMode","hasPatternOverridesSource","isEditingSyncedPattern","select","getBlockBindingsSource","getCurrentPostType","getEditedPostAttribute","user","wp_pattern_sync_status","unsynced","bindings","attributes","metadata","hasPatternBindings","Object","values","some","binding","source","shouldShowPatternOverridesControls","shouldShowResetOverridesControl"],"sources":["@wordpress/editor/src/hooks/pattern-overrides.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useBlockEditingMode } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\nconst {\n\tPatternOverridesControls,\n\tResetOverridesControl,\n\tPatternOverridesBlockControls,\n\tPATTERN_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternsPrivateApis );\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a partial syncing controls to supported blocks in the pattern editor.\n * Currently, only the `core/paragraph` block is supported.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withPatternOverrideControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isSupportedBlock =\n\t\t\t!! PARTIAL_SYNCING_SUPPORTED_BLOCKS[ props.name ];\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ props.isSelected && isSupportedBlock && (\n\t\t\t\t\t<ControlsWithStoreSubscription { ...props } />\n\t\t\t\t) }\n\t\t\t\t{ isSupportedBlock && <PatternOverridesBlockControls /> }\n\t\t\t</>\n\t\t);\n\t},\n\t'withPatternOverrideControls'\n);\n\n// Split into a separate component to avoid a store subscription\n// on every block.\nfunction ControlsWithStoreSubscription( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst { hasPatternOverridesSource, isEditingSyncedPattern } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockBindingsSource } = unlock( select( blocksStore ) );\n\t\t\tconst { getCurrentPostType, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\t\thasPatternOverridesSource: !! getBlockBindingsSource(\n\t\t\t\t\t'core/pattern-overrides'\n\t\t\t\t),\n\t\t\t\tisEditingSyncedPattern:\n\t\t\t\t\tgetCurrentPostType() === PATTERN_TYPES.user &&\n\t\t\t\t\tgetEditedPostAttribute( 'meta' )?.wp_pattern_sync_status !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced &&\n\t\t\t\t\tgetEditedPostAttribute( 'wp_pattern_sync_status' ) !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst bindings = props.attributes.metadata?.bindings;\n\tconst hasPatternBindings =\n\t\t!! bindings &&\n\t\tObject.values( bindings ).some(\n\t\t\t( binding ) => binding.source === 'core/pattern-overrides'\n\t\t);\n\n\tconst shouldShowPatternOverridesControls =\n\t\tisEditingSyncedPattern && blockEditingMode === 'default';\n\tconst shouldShowResetOverridesControl =\n\t\t! isEditingSyncedPattern &&\n\t\t!! props.attributes.metadata?.name &&\n\t\tblockEditingMode !== 'disabled' &&\n\t\thasPatternBindings;\n\n\tif ( ! hasPatternOverridesSource ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ shouldShowPatternOverridesControls && (\n\t\t\t\t<PatternOverridesControls { ...props } />\n\t\t\t) }\n\t\t\t{ shouldShowResetOverridesControl && (\n\t\t\t\t<ResetOverridesControl { ...props } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-pattern-override-controls',\n\twithPatternOverrideControls\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AACxE,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,UAAU;AAC/C,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEA,MAAM;EACLC,wBAAwB;EACxBC,qBAAqB;EACrBC,6BAA6B;EAC7BC,aAAa;EACbC,gCAAgC;EAChCC;AACD,CAAC,GAAGZ,MAAM,CAAEP,mBAAoB,CAAC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMoB,2BAA2B,GAAGnB,0BAA0B,CAC3DoB,SAAS,IAAQC,KAAK,IAAM;EAC7B,MAAMC,gBAAgB,GACrB,CAAC,CAAEL,gCAAgC,CAAEI,KAAK,CAACE,IAAI,CAAE;EAElD,oBACCX,KAAA,CAAAF,SAAA;IAAAc,QAAA,gBACChB,IAAA,CAACY,SAAS;MAAA,GAAMC;IAAK,CAAI,CAAC,EACxBA,KAAK,CAACI,UAAU,IAAIH,gBAAgB,iBACrCd,IAAA,CAACkB,6BAA6B;MAAA,GAAML;IAAK,CAAI,CAC7C,EACCC,gBAA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kB;EAEnB,IAAK,CAAEZ,yBAAyB,EAAG;IAClC,OAAO,IAAI;EACZ;EAEA,oBACChB,KAAA,CAAAF,SAAA;IAAAc,QAAA,GACGsB,kCAAkC,iBACnCtC,IAAA,CAACK,wBAAwB;MAAA,GAAMQ;IAAK,CAAI,CACxC,EACC0B,+BAA+B,iBAChCvC,IAAA,CAACM,qBAAqB;MAAA,GAAMO;IAAK,CAAI,CACrC;EAAA,CACA,CAAC;AAEL;AAEAxB,SAAS,CACR,kBAAkB,EAClB,4CAA4C,EAC5CsB,2BACD,CAAC","ignoreList":[]}
|
|
@@ -6,17 +6,15 @@ import { TEMPLATE_ORIGINS } from '../constants';
|
|
|
6
6
|
// Copy of the function from packages/edit-site/src/utils/is-template-revertable.js
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Check if a template is revertable to its original theme-provided
|
|
9
|
+
* Check if a template or template part is revertable to its original theme-provided file.
|
|
10
10
|
*
|
|
11
|
-
* @param {Object}
|
|
12
|
-
* @return {boolean} Whether the
|
|
11
|
+
* @param {Object} templateOrTemplatePart The entity to check.
|
|
12
|
+
* @return {boolean} Whether the entity is revertable.
|
|
13
13
|
*/
|
|
14
|
-
export default function isTemplateRevertable(
|
|
15
|
-
if (!
|
|
14
|
+
export default function isTemplateRevertable(templateOrTemplatePart) {
|
|
15
|
+
if (!templateOrTemplatePart) {
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return template?.source === TEMPLATE_ORIGINS.custom && template?.has_theme_file;
|
|
20
|
-
/* eslint-enable camelcase */
|
|
18
|
+
return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && templateOrTemplatePart.has_theme_file;
|
|
21
19
|
}
|
|
22
20
|
//# sourceMappingURL=is-template-revertable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TEMPLATE_ORIGINS","isTemplateRevertable","
|
|
1
|
+
{"version":3,"names":["TEMPLATE_ORIGINS","isTemplateRevertable","templateOrTemplatePart","source","custom","has_theme_file"],"sources":["@wordpress/editor/src/store/utils/is-template-revertable.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS } from '../constants';\n\n// Copy of the function from packages/edit-site/src/utils/is-template-revertable.js\n\n/**\n * Check if a template or template part is revertable to its original theme-provided file.\n *\n * @param {Object} templateOrTemplatePart The entity to check.\n * @return {boolean} Whether the entity is revertable.\n */\nexport default function isTemplateRevertable( templateOrTemplatePart ) {\n\tif ( ! templateOrTemplatePart ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttemplateOrTemplatePart.source === TEMPLATE_ORIGINS.custom &&\n\t\ttemplateOrTemplatePart.has_theme_file\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,cAAc;;AAE/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAEC,sBAAsB,EAAG;EACtE,IAAK,CAAEA,sBAAsB,EAAG;IAC/B,OAAO,KAAK;EACb;EAEA,OACCA,sBAAsB,CAACC,MAAM,KAAKH,gBAAgB,CAACI,MAAM,IACzDF,sBAAsB,CAACG,cAAc;AAEvC","ignoreList":[]}
|
|
@@ -1542,6 +1542,17 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
1542
1542
|
.editor-post-featured-image__container:hover .editor-post-featured-image__actions, .editor-post-featured-image__container:focus .editor-post-featured-image__actions, .editor-post-featured-image__container:focus-within .editor-post-featured-image__actions {
|
|
1543
1543
|
opacity: 1;
|
|
1544
1544
|
}
|
|
1545
|
+
.editor-post-featured-image__container .components-drop-zone__content {
|
|
1546
|
+
border-radius: 2px;
|
|
1547
|
+
}
|
|
1548
|
+
.editor-post-featured-image__container:has(.editor-post-featured-image__toggle) .components-drop-zone .components-drop-zone__content-inner {
|
|
1549
|
+
display: flex;
|
|
1550
|
+
align-items: center;
|
|
1551
|
+
gap: 8px;
|
|
1552
|
+
}
|
|
1553
|
+
.editor-post-featured-image__container:has(.editor-post-featured-image__toggle) .components-drop-zone .components-drop-zone__content-inner .components-drop-zone__content-icon {
|
|
1554
|
+
margin: 0;
|
|
1555
|
+
}
|
|
1545
1556
|
|
|
1546
1557
|
.editor-post-featured-image__toggle,
|
|
1547
1558
|
.editor-post-featured-image__preview {
|
|
@@ -1692,6 +1703,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
1692
1703
|
.editor-post-panel__row-control .components-button {
|
|
1693
1704
|
max-width: 100%;
|
|
1694
1705
|
text-align: right;
|
|
1706
|
+
white-space: normal;
|
|
1695
1707
|
text-wrap: balance;
|
|
1696
1708
|
text-wrap: pretty;
|
|
1697
1709
|
height: auto;
|
|
@@ -2656,7 +2668,7 @@ h3.components-heading.editor-template-areas__title {
|
|
|
2656
2668
|
.editor-visual-editor.has-padding {
|
|
2657
2669
|
padding: 24px 24px 0;
|
|
2658
2670
|
}
|
|
2659
|
-
.editor-visual-editor
|
|
2671
|
+
.editor-visual-editor.is-iframed {
|
|
2660
2672
|
overflow: hidden;
|
|
2661
2673
|
}
|
|
2662
2674
|
.editor-visual-editor .components-button {
|
package/build-style/style.css
CHANGED
|
@@ -1542,6 +1542,17 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
1542
1542
|
.editor-post-featured-image__container:hover .editor-post-featured-image__actions, .editor-post-featured-image__container:focus .editor-post-featured-image__actions, .editor-post-featured-image__container:focus-within .editor-post-featured-image__actions {
|
|
1543
1543
|
opacity: 1;
|
|
1544
1544
|
}
|
|
1545
|
+
.editor-post-featured-image__container .components-drop-zone__content {
|
|
1546
|
+
border-radius: 2px;
|
|
1547
|
+
}
|
|
1548
|
+
.editor-post-featured-image__container:has(.editor-post-featured-image__toggle) .components-drop-zone .components-drop-zone__content-inner {
|
|
1549
|
+
display: flex;
|
|
1550
|
+
align-items: center;
|
|
1551
|
+
gap: 8px;
|
|
1552
|
+
}
|
|
1553
|
+
.editor-post-featured-image__container:has(.editor-post-featured-image__toggle) .components-drop-zone .components-drop-zone__content-inner .components-drop-zone__content-icon {
|
|
1554
|
+
margin: 0;
|
|
1555
|
+
}
|
|
1545
1556
|
|
|
1546
1557
|
.editor-post-featured-image__toggle,
|
|
1547
1558
|
.editor-post-featured-image__preview {
|
|
@@ -1692,6 +1703,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
1692
1703
|
.editor-post-panel__row-control .components-button {
|
|
1693
1704
|
max-width: 100%;
|
|
1694
1705
|
text-align: left;
|
|
1706
|
+
white-space: normal;
|
|
1695
1707
|
text-wrap: balance;
|
|
1696
1708
|
text-wrap: pretty;
|
|
1697
1709
|
height: auto;
|
|
@@ -2660,7 +2672,7 @@ h3.components-heading.editor-template-areas__title {
|
|
|
2660
2672
|
.editor-visual-editor.has-padding {
|
|
2661
2673
|
padding: 24px 24px 0;
|
|
2662
2674
|
}
|
|
2663
|
-
.editor-visual-editor
|
|
2675
|
+
.editor-visual-editor.is-iframed {
|
|
2664
2676
|
overflow: hidden;
|
|
2665
2677
|
}
|
|
2666
2678
|
.editor-visual-editor .components-button {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.5",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"@wordpress/a11y": "^4.0.1",
|
|
36
36
|
"@wordpress/api-fetch": "^7.0.1",
|
|
37
37
|
"@wordpress/blob": "^4.0.1",
|
|
38
|
-
"@wordpress/block-editor": "^13.0.
|
|
38
|
+
"@wordpress/block-editor": "^13.0.5",
|
|
39
39
|
"@wordpress/blocks": "^13.0.3",
|
|
40
40
|
"@wordpress/commands": "^1.0.3",
|
|
41
41
|
"@wordpress/components": "^28.0.3",
|
|
42
42
|
"@wordpress/compose": "^7.0.1",
|
|
43
|
-
"@wordpress/core-data": "^7.0.
|
|
43
|
+
"@wordpress/core-data": "^7.0.5",
|
|
44
44
|
"@wordpress/data": "^10.0.2",
|
|
45
45
|
"@wordpress/date": "^5.0.1",
|
|
46
46
|
"@wordpress/deprecated": "^4.0.1",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"@wordpress/keycodes": "^4.0.1",
|
|
56
56
|
"@wordpress/media-utils": "^5.0.1",
|
|
57
57
|
"@wordpress/notices": "^5.0.2",
|
|
58
|
-
"@wordpress/patterns": "^2.0.
|
|
58
|
+
"@wordpress/patterns": "^2.0.5",
|
|
59
59
|
"@wordpress/plugins": "^7.0.3",
|
|
60
60
|
"@wordpress/preferences": "^4.0.3",
|
|
61
61
|
"@wordpress/private-apis": "^1.0.2",
|
|
62
|
-
"@wordpress/reusable-blocks": "^5.0.
|
|
62
|
+
"@wordpress/reusable-blocks": "^5.0.5",
|
|
63
63
|
"@wordpress/rich-text": "^7.0.2",
|
|
64
64
|
"@wordpress/server-side-render": "^5.0.3",
|
|
65
65
|
"@wordpress/url": "^4.0.1",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "38063ae466e1b62d400b910136757a4cafdbe7fa"
|
|
87
87
|
}
|
|
@@ -9,23 +9,22 @@ const CONTENT = 'content';
|
|
|
9
9
|
export default {
|
|
10
10
|
name: 'core/pattern-overrides',
|
|
11
11
|
label: _x( 'Pattern Overrides', 'block bindings source' ),
|
|
12
|
-
getValue( { registry, clientId, attributeName } ) {
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
getValue( { registry, clientId, context, attributeName } ) {
|
|
13
|
+
const patternOverridesContent = context[ 'pattern/overrides' ];
|
|
14
|
+
const { getBlockAttributes } = registry.select( blockEditorStore );
|
|
15
15
|
const currentBlockAttributes = getBlockAttributes( clientId );
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
16
|
+
|
|
17
|
+
if ( ! patternOverridesContent ) {
|
|
18
|
+
return currentBlockAttributes[ attributeName ];
|
|
19
|
+
}
|
|
21
20
|
|
|
22
21
|
const overridableValue =
|
|
23
|
-
|
|
22
|
+
patternOverridesContent?.[
|
|
24
23
|
currentBlockAttributes?.metadata?.name
|
|
25
24
|
]?.[ attributeName ];
|
|
26
25
|
|
|
27
26
|
// If there is no pattern client ID, or it is not overwritten, return the default value.
|
|
28
|
-
if (
|
|
27
|
+
if ( overridableValue === undefined ) {
|
|
29
28
|
return currentBlockAttributes[ attributeName ];
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -34,6 +34,11 @@ export default {
|
|
|
34
34
|
} );
|
|
35
35
|
},
|
|
36
36
|
canUserEditValue( { select, context, args } ) {
|
|
37
|
+
// Lock editing in query loop.
|
|
38
|
+
if ( context?.query || context?.queryId ) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
const postType =
|
|
38
43
|
context?.postType || select( editorStore ).getCurrentPostType();
|
|
39
44
|
|
|
@@ -29,6 +29,7 @@ function Editor( {
|
|
|
29
29
|
className,
|
|
30
30
|
styles,
|
|
31
31
|
customSaveButton,
|
|
32
|
+
customSavePanel,
|
|
32
33
|
forceDisableBlockTools,
|
|
33
34
|
title,
|
|
34
35
|
iframeProps,
|
|
@@ -58,6 +59,10 @@ function Editor( {
|
|
|
58
59
|
[ postType, postId, templateId ]
|
|
59
60
|
);
|
|
60
61
|
|
|
62
|
+
if ( ! post ) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
61
66
|
return (
|
|
62
67
|
<ExperimentalEditorProvider
|
|
63
68
|
post={ post }
|
|
@@ -77,6 +82,7 @@ function Editor( {
|
|
|
77
82
|
styles={ styles }
|
|
78
83
|
enableRegionNavigation={ enableRegionNavigation }
|
|
79
84
|
customSaveButton={ customSaveButton }
|
|
85
|
+
customSavePanel={ customSavePanel }
|
|
80
86
|
forceDisableBlockTools={ forceDisableBlockTools }
|
|
81
87
|
title={ title }
|
|
82
88
|
iframeProps={ iframeProps }
|
|
@@ -55,6 +55,7 @@ export default function EditorInterface( {
|
|
|
55
55
|
disableIframe,
|
|
56
56
|
autoFocus,
|
|
57
57
|
customSaveButton,
|
|
58
|
+
customSavePanel,
|
|
58
59
|
forceDisableBlockTools,
|
|
59
60
|
title,
|
|
60
61
|
iframeProps,
|
|
@@ -212,18 +213,22 @@ export default function EditorInterface( {
|
|
|
212
213
|
)
|
|
213
214
|
}
|
|
214
215
|
actions={
|
|
215
|
-
! isPreviewMode
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
216
|
+
! isPreviewMode
|
|
217
|
+
? customSavePanel || (
|
|
218
|
+
<SavePublishPanels
|
|
219
|
+
closeEntitiesSavedStates={
|
|
220
|
+
closeEntitiesSavedStates
|
|
221
|
+
}
|
|
222
|
+
isEntitiesSavedStatesOpen={
|
|
223
|
+
entitiesSavedStatesCallback
|
|
224
|
+
}
|
|
225
|
+
setEntitiesSavedStatesCallback={
|
|
226
|
+
setEntitiesSavedStatesCallback
|
|
227
|
+
}
|
|
228
|
+
forceIsDirtyPublishPanel={ forceIsDirty }
|
|
229
|
+
/>
|
|
230
|
+
)
|
|
231
|
+
: undefined
|
|
227
232
|
}
|
|
228
233
|
shortcuts={ {
|
|
229
234
|
previous: previousShortcut,
|
|
@@ -249,9 +249,12 @@ export function ParentRow() {
|
|
|
249
249
|
onClose={ onClose }
|
|
250
250
|
/>
|
|
251
251
|
<div>
|
|
252
|
-
{
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
{
|
|
253
|
+
/* translators: The domain name should be a reserved domain name to prevent linking to third party sites outside the WordPress project's control. You may also wish to use wordpress.org or a wordpress.org sub-domain. */
|
|
254
|
+
__(
|
|
255
|
+
"Child pages inherit characteristics from their parent, such as URL structure. For instance, if 'Web Design' is a child of 'Services', its URL would be example.org/services/web-design."
|
|
256
|
+
)
|
|
257
|
+
}
|
|
255
258
|
<p>
|
|
256
259
|
{ __(
|
|
257
260
|
'They also show up as sub-items in the default navigation menu. '
|