@wordpress/editor 12.9.0 → 12.12.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 +6 -0
- package/build/components/document-outline/index.js +7 -9
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +3 -0
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build/components/index.js +61 -9
- package/build/components/index.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +24 -19
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/page-attributes/order.js +3 -7
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +2 -2
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-format/index.js +5 -8
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +4 -2
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +5 -5
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-schedule/label.js +93 -13
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/index.js +8 -13
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +8 -4
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -0
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +3 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-template/index.js +1 -2
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-url/check.js +54 -0
- package/build/components/post-url/check.js.map +1 -0
- package/build/components/post-url/index.js +115 -0
- package/build/components/post-url/index.js.map +1 -0
- package/build/components/post-url/label.js +30 -0
- package/build/components/post-url/label.js.map +1 -0
- package/build/components/post-visibility/index.js +10 -11
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +5 -0
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +0 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +3 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/table-of-contents/panel.js +5 -1
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +1 -1
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/time-to-read/index.js +60 -0
- package/build/components/time-to-read/index.js.map +1 -0
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/store/actions.js +5 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +2 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js +4 -8
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/components/document-outline/index.js +7 -8
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +2 -0
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build-module/components/index.js +7 -4
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +24 -18
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/page-attributes/order.js +3 -6
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +3 -3
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/select.js.map +1 -1
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-format/index.js +5 -8
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +4 -1
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +5 -5
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-schedule/label.js +90 -13
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/index.js +8 -14
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +8 -6
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +1 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +4 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-template/index.js +1 -2
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-url/check.js +44 -0
- package/build-module/components/post-url/check.js.map +1 -0
- package/build-module/components/post-url/index.js +102 -0
- package/build-module/components/post-url/index.js.map +1 -0
- package/build-module/components/post-url/label.js +18 -0
- package/build-module/components/post-url/label.js.map +1 -0
- package/build-module/components/post-visibility/index.js +12 -13
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +3 -0
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +0 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +4 -2
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +4 -1
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +2 -2
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js +50 -0
- package/build-module/components/time-to-read/index.js.map +1 -0
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/store/actions.js +5 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +2 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +3 -5
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +12 -30
- package/build-style/style.css +15 -29
- package/package.json +28 -28
- package/src/components/document-outline/index.js +9 -8
- package/src/components/editor-help/index.native.js +6 -6
- package/src/components/entities-saved-states/entity-record-item.js +6 -6
- package/src/components/entities-saved-states/index.js +6 -9
- package/src/components/error-boundary/index.js +3 -0
- package/src/components/global-keyboard-shortcuts/save-shortcut.js +2 -3
- package/src/components/index.js +13 -4
- package/src/components/local-autosave-monitor/index.js +39 -38
- package/src/components/page-attributes/order.js +1 -9
- package/src/components/page-attributes/parent.js +6 -10
- package/src/components/post-author/select.js +2 -3
- package/src/components/post-comments/index.js +4 -3
- package/src/components/post-format/index.js +15 -22
- package/src/components/post-format/style.scss +2 -17
- package/src/components/post-last-revision/check.js +2 -4
- package/src/components/post-last-revision/index.js +2 -4
- package/src/components/post-pending-status/check.js +2 -5
- package/src/components/post-pingbacks/index.js +2 -3
- package/src/components/post-publish-button/index.js +7 -8
- package/src/components/post-publish-panel/index.js +2 -3
- package/src/components/post-publish-panel/maybe-category-panel.js +7 -5
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -3
- package/src/components/post-publish-panel/postpublish.js +2 -5
- package/src/components/post-publish-panel/prepublish.js +2 -3
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +1 -1
- package/src/components/post-schedule/label.js +111 -17
- package/src/components/post-schedule/test/label.js +127 -15
- package/src/components/post-slug/index.js +9 -16
- package/src/components/post-slug/test/index.js +7 -6
- package/src/components/post-sticky/index.js +2 -3
- package/src/components/post-switch-to-draft-button/index.js +2 -5
- package/src/components/post-taxonomies/flat-term-selector.js +10 -13
- package/src/components/post-taxonomies/hierarchical-term-selector.js +5 -7
- package/src/components/post-taxonomies/index.js +3 -1
- package/src/components/post-template/index.js +1 -1
- package/src/components/post-title/index.js +21 -31
- package/src/components/post-title/index.native.js +10 -16
- package/src/components/post-title/style.scss +1 -1
- package/src/components/post-trash/check.js +2 -3
- package/src/components/post-url/check.js +38 -0
- package/src/components/post-url/index.js +122 -0
- package/src/components/post-url/label.js +22 -0
- package/src/components/post-url/style.scss +16 -0
- package/src/components/post-visibility/index.js +11 -17
- package/src/components/post-visibility/label.js +4 -0
- package/src/components/post-visibility/style.scss +0 -17
- package/src/components/provider/index.js +2 -3
- package/src/components/provider/index.native.js +12 -17
- package/src/components/provider/use-block-editor-settings.js +4 -8
- package/src/components/table-of-contents/panel.js +7 -2
- package/src/components/template-validation-notice/index.js +2 -3
- package/src/components/theme-support-check/index.js +2 -2
- package/src/components/time-to-read/index.js +59 -0
- package/src/hooks/custom-sources-backwards-compatibility.js +45 -44
- package/src/store/actions.js +213 -190
- package/src/store/reducer.js +2 -2
- package/src/store/selectors.js +17 -25
- package/src/store/test/selectors.js +10 -13
- package/src/style.scss +1 -0
- package/src/utils/media-upload/index.js +2 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-visibility/index.js"],"names":["PostVisibility","onClose","instanceId","status","visibility","password","select","editorStore","getEditedPostAttribute","getEditedPostVisibility","editPost","savePost","hasPassword","setHasPassword","showPrivateConfirmDialog","setShowPrivateConfirmDialog","setPublic","setPrivate","confirmPrivate","handleDialogCancel","setPasswordProtected","updatePassword","event","target","value","
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-visibility/index.js"],"names":["PostVisibility","onClose","instanceId","status","visibility","password","select","editorStore","getEditedPostAttribute","getEditedPostVisibility","editPost","savePost","hasPassword","setHasPassword","showPrivateConfirmDialog","setShowPrivateConfirmDialog","setPublic","setPrivate","confirmPrivate","handleDialogCancel","setPasswordProtected","updatePassword","event","target","value","visibilityOptions","public","label","info","private","PostVisibilityChoice","props"],"mappings":";;;;;;;;;AAIA;;;;AADA;;AAEA;;AAIA;;AACA;;AACA;;AAKA;;AACA;;AAjBA;AACA;AACA;;AAWA;AACA;AACA;AAIe,SA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AAAf,KACC;AACC,IAAA,IAAI,EAAC,OADN;AAEC,IAAA,IAAI,EAAI,mCAAmC7B,UAAY,EAFxD;AAGC,IAAA,KAAK,EAAGsB,KAHT;AAIC,IAAA,EAAE,EAAI,eAAeA,KAAO,IAAItB,UAAY,EAJ7C;AAKC,wBAAoB,eAAesB,KAAO,IAAItB,UAAY,cAL3D;AAMC,IAAA,SAAS,EAAC;AANX,KAOM6B,KAPN,EADD,EAUC;AACC,IAAA,OAAO,EAAI,eAAeP,KAAO,IAAItB,UAAY,EADlD;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGyB,KAJH,CAVD,EAgBC;AACC,IAAA,EAAE,EAAI,eAAeH,KAAO,IAAItB,UAAY,cAD7C;AAEC,IAAA,SAAS,EAAC;AAFX,KAIG0B,IAJH,CAhBD,CADD;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tVisuallyHidden,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { visibilityOptions } from './utils';\nimport { store as editorStore } from '../../store';\n\nexport default function PostVisibility( { onClose } ) {\n\tconst instanceId = useInstanceId( PostVisibility );\n\n\tconst { status, visibility, password } = useSelect( ( select ) => ( {\n\t\tstatus: select( editorStore ).getEditedPostAttribute( 'status' ),\n\t\tvisibility: select( editorStore ).getEditedPostVisibility(),\n\t\tpassword: select( editorStore ).getEditedPostAttribute( 'password' ),\n\t} ) );\n\n\tconst { editPost, savePost } = useDispatch( editorStore );\n\n\tconst [ hasPassword, setHasPassword ] = useState( !! password );\n\tconst [ showPrivateConfirmDialog, setShowPrivateConfirmDialog ] =\n\t\tuseState( false );\n\n\tconst setPublic = () => {\n\t\teditPost( {\n\t\t\tstatus: visibility === 'private' ? 'draft' : status,\n\t\t\tpassword: '',\n\t\t} );\n\t\tsetHasPassword( false );\n\t};\n\n\tconst setPrivate = () => {\n\t\tsetShowPrivateConfirmDialog( true );\n\t};\n\n\tconst confirmPrivate = () => {\n\t\teditPost( { status: 'private', password: '' } );\n\t\tsetHasPassword( false );\n\t\tsetShowPrivateConfirmDialog( false );\n\t\tsavePost();\n\t};\n\n\tconst handleDialogCancel = () => {\n\t\tsetShowPrivateConfirmDialog( false );\n\t};\n\n\tconst setPasswordProtected = () => {\n\t\teditPost( {\n\t\t\tstatus: visibility === 'private' ? 'draft' : status,\n\t\t\tpassword: password || '',\n\t\t} );\n\t\tsetHasPassword( true );\n\t};\n\n\tconst updatePassword = ( event ) => {\n\t\teditPost( { password: event.target.value } );\n\t};\n\n\treturn (\n\t\t<div className=\"editor-post-visibility\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Visibility' ) }\n\t\t\t\thelp={ __( 'Control how this post is viewed.' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<fieldset className=\"editor-post-visibility__fieldset\">\n\t\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t\t{ __( 'Visibility' ) }\n\t\t\t\t</VisuallyHidden>\n\t\t\t\t<PostVisibilityChoice\n\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\tvalue=\"public\"\n\t\t\t\t\tlabel={ visibilityOptions.public.label }\n\t\t\t\t\tinfo={ visibilityOptions.public.info }\n\t\t\t\t\tchecked={ visibility === 'public' && ! hasPassword }\n\t\t\t\t\tonChange={ setPublic }\n\t\t\t\t/>\n\t\t\t\t<PostVisibilityChoice\n\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\tvalue=\"private\"\n\t\t\t\t\tlabel={ visibilityOptions.private.label }\n\t\t\t\t\tinfo={ visibilityOptions.private.info }\n\t\t\t\t\tchecked={ visibility === 'private' }\n\t\t\t\t\tonChange={ setPrivate }\n\t\t\t\t/>\n\t\t\t\t<PostVisibilityChoice\n\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\tvalue=\"password\"\n\t\t\t\t\tlabel={ visibilityOptions.password.label }\n\t\t\t\t\tinfo={ visibilityOptions.password.info }\n\t\t\t\t\tchecked={ hasPassword }\n\t\t\t\t\tonChange={ setPasswordProtected }\n\t\t\t\t/>\n\t\t\t\t{ hasPassword && (\n\t\t\t\t\t<div className=\"editor-post-visibility__password\">\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"label\"\n\t\t\t\t\t\t\thtmlFor={ `editor-post-visibility__password-input-${ instanceId }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create password' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tclassName=\"editor-post-visibility__password-input\"\n\t\t\t\t\t\t\tid={ `editor-post-visibility__password-input-${ instanceId }` }\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tonChange={ updatePassword }\n\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\tplaceholder={ __( 'Use a secure password' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</fieldset>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showPrivateConfirmDialog }\n\t\t\t\tonConfirm={ confirmPrivate }\n\t\t\t\tonCancel={ handleDialogCancel }\n\t\t\t>\n\t\t\t\t{ __( 'Would you like to privately publish this post now?' ) }\n\t\t\t</ConfirmDialog>\n\t\t</div>\n\t);\n}\n\nfunction PostVisibilityChoice( { instanceId, value, label, info, ...props } ) {\n\treturn (\n\t\t<div className=\"editor-post-visibility__choice\">\n\t\t\t<input\n\t\t\t\ttype=\"radio\"\n\t\t\t\tname={ `editor-post-visibility__setting-${ instanceId }` }\n\t\t\t\tvalue={ value }\n\t\t\t\tid={ `editor-post-${ value }-${ instanceId }` }\n\t\t\t\taria-describedby={ `editor-post-${ value }-${ instanceId }-description` }\n\t\t\t\tclassName=\"editor-post-visibility__radio\"\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t<label\n\t\t\t\thtmlFor={ `editor-post-${ value }-${ instanceId }` }\n\t\t\t\tclassName=\"editor-post-visibility__label\"\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</label>\n\t\t\t<p\n\t\t\t\tid={ `editor-post-${ value }-${ instanceId }-description` }\n\t\t\t\tclassName=\"editor-post-visibility__info\"\n\t\t\t>\n\t\t\t\t{ info }\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = PostVisibilityLabel;
|
|
7
|
+
exports.usePostVisibilityLabel = usePostVisibilityLabel;
|
|
7
8
|
|
|
8
9
|
var _data = require("@wordpress/data");
|
|
9
10
|
|
|
@@ -19,6 +20,10 @@ var _store = require("../../store");
|
|
|
19
20
|
* Internal dependencies
|
|
20
21
|
*/
|
|
21
22
|
function PostVisibilityLabel() {
|
|
23
|
+
return usePostVisibilityLabel();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function usePostVisibilityLabel() {
|
|
22
27
|
var _visibilityOptions$vi;
|
|
23
28
|
|
|
24
29
|
const visibility = (0, _data.useSelect)(select => select(_store.store).getEditedPostVisibility());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-visibility/label.js"],"names":["PostVisibilityLabel","visibility","select","editorStore","getEditedPostVisibility","visibilityOptions","label"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-visibility/label.js"],"names":["PostVisibilityLabel","usePostVisibilityLabel","visibility","select","editorStore","getEditedPostVisibility","visibilityOptions","label"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,mBAAT,GAA+B;AAC7C,SAAOC,sBAAsB,EAA7B;AACA;;AAEM,SAASA,sBAAT,GAAkC;AAAA;;AACxC,QAAMC,UAAU,GAAG,qBAAaC,MAAF,IAC7BA,MAAM,CAAEC,YAAF,CAAN,CAAsBC,uBAAtB,EADkB,CAAnB;AAGA,kCAAOC,yBAAmBJ,UAAnB,CAAP,0DAAO,sBAAiCK,KAAxC;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { visibilityOptions } from './utils';\nimport { store as editorStore } from '../../store';\n\nexport default function PostVisibilityLabel() {\n\treturn usePostVisibilityLabel();\n}\n\nexport function usePostVisibilityLabel() {\n\tconst visibility = useSelect( ( select ) =>\n\t\tselect( editorStore ).getEditedPostVisibility()\n\t);\n\treturn visibilityOptions[ visibility ]?.label;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/provider/index.js"],"names":["EditorProvider","__unstableTemplate","post","settings","recovery","initialEdits","children","defaultBlockContext","type","postId","id","postType","selection","isReady","select","getEditorSelection","__unstableIsEditorReady","editorStore","blocks","onInput","onChange","editorSettings","updatePostLock","setupEditor","updateEditorSettings","__experimentalTearDownEditor","createWarningNotice","noticesStore","postLock","template","autosave","actions","label","url","editLink"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AAKA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAYA;AACA;AACA;AAKA,SAASA,cAAT,OAOI;AAAA,MAPqB;AACxBC,IAAAA,kBADwB;AAExBC,IAAAA,IAFwB;AAGxBC,IAAAA,QAHwB;AAIxBC,IAAAA,QAJwB;AAKxBC,IAAAA,YALwB;AAMxBC,IAAAA;AANwB,GAOrB;AACH,QAAMC,mBAAmB,GAAG,sBAAS,MAAM;AAC1C,QAAKL,IAAI,CAACM,IAAL,KAAc,aAAnB,EAAmC;AAClC,aAAO,EAAP;AACA;;AACD,WAAO;AAAEC,MAAAA,MAAM,EAAEP,IAAI,CAACQ,EAAf;AAAmBC,MAAAA,QAAQ,EAAET,IAAI,CAACM;AAAlC,KAAP;AACA,GAL2B,EAKzB,CAAEN,IAAI,CAACQ,EAAP,EAAWR,IAAI,CAACM,IAAhB,CALyB,CAA5B;AAMA,QAAM;AAAEI,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAAyB,qBAAaC,MAAF,IAAc;AACvD,UAAM;AAAEC,MAAAA,kBAAF;AAAsBC,MAAAA;AAAtB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/provider/index.js"],"names":["EditorProvider","__unstableTemplate","post","settings","recovery","initialEdits","children","defaultBlockContext","type","postId","id","postType","selection","isReady","select","getEditorSelection","__unstableIsEditorReady","editorStore","blocks","onInput","onChange","editorSettings","updatePostLock","setupEditor","updateEditorSettings","__experimentalTearDownEditor","createWarningNotice","noticesStore","postLock","template","autosave","actions","label","url","editLink"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AAKA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAYA;AACA;AACA;AAKA,SAASA,cAAT,OAOI;AAAA,MAPqB;AACxBC,IAAAA,kBADwB;AAExBC,IAAAA,IAFwB;AAGxBC,IAAAA,QAHwB;AAIxBC,IAAAA,QAJwB;AAKxBC,IAAAA,YALwB;AAMxBC,IAAAA;AANwB,GAOrB;AACH,QAAMC,mBAAmB,GAAG,sBAAS,MAAM;AAC1C,QAAKL,IAAI,CAACM,IAAL,KAAc,aAAnB,EAAmC;AAClC,aAAO,EAAP;AACA;;AACD,WAAO;AAAEC,MAAAA,MAAM,EAAEP,IAAI,CAACQ,EAAf;AAAmBC,MAAAA,QAAQ,EAAET,IAAI,CAACM;AAAlC,KAAP;AACA,GAL2B,EAKzB,CAAEN,IAAI,CAACQ,EAAP,EAAWR,IAAI,CAACM,IAAhB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I,mBAAJ,CADR;AAECC,UAAAA,GAAG,EAAE9B,QAAQ,CAAC2B,QAAT,CAAkBI;AAFxB,SADQ;AAFV,OAJkB,CAAnB;AAcA;;AAED,WAAO,MAAM;AACZT,MAAAA,4BAA4B;AAC5B,KAFD;AAGA,GA5BD,EA4BG,EA5BH,EAnCG,CAiEH;;AACA,0BAAW,MAAM;AAChBD,IAAAA,oBAAoB,CAAErB,QAAF,CAApB;AACA,GAFD,EAEG,CAAEA,QAAF,CAFH;;AAIA,MAAK,CAAEU,OAAP,EAAiB;AAChB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,wBAAD;AAAgB,IAAA,IAAI,EAAC,MAArB;AAA4B,IAAA,IAAI,EAAC;AAAjC,KACC,4BAAC,wBAAD;AAAgB,IAAA,IAAI,EAAC,UAArB;AAAgC,IAAA,IAAI,EAAGX,IAAI,CAACM,IAA5C;AAAmD,IAAA,EAAE,EAAGN,IAAI,CAACQ;AAA7D,KACC,4BAAC,iCAAD;AAAsB,IAAA,KAAK,EAAGH;AAA9B,KACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAGW,MADT;AAEC,IAAA,QAAQ,EAAGE,QAFZ;AAGC,IAAA,OAAO,EAAGD,OAHX;AAIC,IAAA,SAAS,EAAGP,SAJb;AAKC,IAAA,QAAQ,EAAGS,cALZ;AAMC,IAAA,cAAc,EAAG;AANlB,KAQGf,QARH,EASC,4BAAC,uCAAD,OATD,CADD,CADD,CADD,CADD;AAmBA;;eAEc,mCAAsBN,cAAtB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { EntityProvider, useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tBlockEditorProvider,\n\tBlockContextProvider,\n} from '@wordpress/block-editor';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport { store as editorStore } from '../../store';\nimport useBlockEditorSettings from './use-block-editor-settings';\n\nfunction EditorProvider( {\n\t__unstableTemplate,\n\tpost,\n\tsettings,\n\trecovery,\n\tinitialEdits,\n\tchildren,\n} ) {\n\tconst defaultBlockContext = useMemo( () => {\n\t\tif ( post.type === 'wp_template' ) {\n\t\t\treturn {};\n\t\t}\n\t\treturn { postId: post.id, postType: post.type };\n\t}, [ post.id, post.type ] );\n\tconst { selection, isReady } = useSelect( ( select ) => {\n\t\tconst { getEditorSelection, __unstableIsEditorReady } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisReady: __unstableIsEditorReady(),\n\t\t\tselection: getEditorSelection(),\n\t\t};\n\t}, [] );\n\tconst { id, type } = __unstableTemplate ?? post;\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttype,\n\t\t{ id }\n\t);\n\tconst editorSettings = useBlockEditorSettings(\n\t\tsettings,\n\t\t!! __unstableTemplate\n\t);\n\tconst {\n\t\tupdatePostLock,\n\t\tsetupEditor,\n\t\tupdateEditorSettings,\n\t\t__experimentalTearDownEditor,\n\t} = useDispatch( editorStore );\n\tconst { createWarningNotice } = useDispatch( noticesStore );\n\n\t// Initialize and tear down the editor.\n\t// Ideally this should be synced on each change and not just something you do once.\n\tuseLayoutEffect( () => {\n\t\t// Assume that we don't need to initialize in the case of an error recovery.\n\t\tif ( recovery ) {\n\t\t\treturn;\n\t\t}\n\n\t\tupdatePostLock( settings.postLock );\n\t\tsetupEditor( post, initialEdits, settings.template );\n\t\tif ( settings.autosave ) {\n\t\t\tcreateWarningNotice(\n\t\t\t\t__(\n\t\t\t\t\t'There is an autosave of this post that is more recent than the version below.'\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tid: 'autosave-exists',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'View the autosave' ),\n\t\t\t\t\t\t\turl: settings.autosave.editLink,\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}\n\n\t\treturn () => {\n\t\t\t__experimentalTearDownEditor();\n\t\t};\n\t}, [] );\n\n\t// Synchronize the editor settings as they change.\n\tuseEffect( () => {\n\t\tupdateEditorSettings( settings );\n\t}, [ settings ] );\n\n\tif ( ! isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t<EntityProvider kind=\"postType\" type={ post.type } id={ post.id }>\n\t\t\t\t<BlockContextProvider value={ defaultBlockContext }>\n\t\t\t\t\t<BlockEditorProvider\n\t\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t<ReusableBlocksMenuItems />\n\t\t\t\t\t</BlockEditorProvider>\n\t\t\t\t</BlockContextProvider>\n\t\t\t</EntityProvider>\n\t\t</EntityProvider>\n\t);\n}\n\nexport default withRegistryProvider( EditorProvider );\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","NativeEditorProvider","Component","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","updateSettings","getThemeColors","subscriptionParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","blockName","mediaType","newBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","subscriptionParentUpdateEditorSettings","galleryWithImageBlocks","editorSettings","window","wp","galleryBlockV2Enabled","subscriptionParentUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","setState","storedImpressions","impressions","NEW_BLOCK_TYPES","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","rawStyles","rawFeatures","defaultEditorColors","defaultEditorGradients","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","RNReactNativeGutenbergBridge","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","wordCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","editorStore","getEditorMode","editPostStore","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","blockEditorStore","colors","gradients","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","coreStore","noticesStore","__unstableShouldCreateUndoLevel"],"mappings":";;;;;;;;;AAuBA;;;;AApBA;;AACA;;AAKA;;AAeA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAmBA;;AACA;;AACA;;AACA;;AAKA;;;;;;AA/DA;AACA;AACA;;AAIA;AACA;AACA;AA8BA,MAAMA,gBAAgB,GAAG,CACxB;AAAEC,EAAAA,IAAI,EAAE,MAAR;AAAgBC,EAAAA,OAAO,EAAE;AAAzB,CADwB,EAExB;AAAED,EAAAA,IAAI,EAAE,MAAR;AAAgBC,EAAAA,OAAO,EAAE;AAAzB,CAFwB,EAGxB;AAAED,EAAAA,IAAI,EAAE,YAAR;AAA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AreaProvider } from 'react-native-safe-area-context';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getGlobalStyles, getColorsAndGradients } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n\trawAttributes: [ 'title', 'excerpt', 'content' ],\n} ) );\nimport { EditorHelpTopics, store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes.\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { capabilities, locale, updateSettings } = this.props;\n\n\t\tupdateSettings( {\n\t\t\t...capabilities,\n\t\t\t...this.getThemeColors( this.props ),\n\t\t\tlocale,\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst newBlock = createBlock( blockName, {\n\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t[ payload.mediaType === 'image'\n\t\t\t\t\t\t? 'url'\n\t\t\t\t\t\t: 'src' ]: payload.mediaUrl,\n\t\t\t\t} );\n\n\t\t\t\tconst indexAfterSelected = this.props.selectedBlockIndex + 1;\n\t\t\t\tconst insertionIndex =\n\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings(\n\t\t\t( { galleryWithImageBlocks, ...editorSettings } ) => {\n\t\t\t\tif ( typeof galleryWithImageBlocks === 'boolean' ) {\n\t\t\t\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\t\t\t\t}\n\t\t\t\tupdateSettings( this.getThemeColors( editorSettings ) );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app.\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store.\n\t\t\tupdateSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration.\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { rawStyles, rawFeatures } ) {\n\t\tconst { defaultEditorColors, defaultEditorGradients } = this.props;\n\n\t\tif ( rawStyles && rawFeatures ) {\n\t\t\treturn getGlobalStyles( rawStyles, rawFeatures );\n\t\t}\n\n\t\treturn getColorsAndGradients(\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\trawFeatures\n\t\t);\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly.\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// Refresh html content first.\n\t\tthis.serializeToNativeAction();\n\t\t// Make sure to blur the selected block and dismiss the keyboard.\n\t\tthis.props.clearSelectedBlock();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateSettings( capabilities );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\tpost, // eslint-disable-line no-unused-vars\n\t\t\tcapabilities,\n\t\t\tsettings,\n\t\t\t...props\n\t\t} = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<SafeAreaProvider>{ children }</SafeAreaProvider>\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tclose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t} = select( editorStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetGlobalBlockCount,\n\t\t\tgetSettings: getBlockEditorSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst settings = getBlockEditorSettings();\n\t\tconst defaultEditorColors = settings?.colors ?? [];\n\t\tconst defaultEditorGradients = settings?.gradients ?? [];\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks } = dispatch( editorStore );\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\treplaceBlock,\n\t\t} = dispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( coreStore );\n\t\tconst { createSuccessNotice } = dispatch( noticesStore );\n\n\t\treturn {\n\t\t\tupdateSettings,\n\t\t\taddEntities,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","NativeEditorProvider","Component","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","updateSettings","getThemeColors","subscriptionParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","blockName","mediaType","newBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","subscriptionParentUpdateEditorSettings","galleryWithImageBlocks","editorSettings","window","wp","galleryBlockV2Enabled","subscriptionParentUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","setState","storedImpressions","impressions","NEW_BLOCK_TYPES","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","rawStyles","rawFeatures","defaultEditorColors","defaultEditorGradients","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","RNReactNativeGutenbergBridge","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","wordCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","editorStore","getEditorMode","editPostStore","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","blockEditorStore","colors","gradients","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","coreStore","noticesStore","__unstableShouldCreateUndoLevel"],"mappings":";;;;;;;;;AAuBA;;;;AApBA;;AACA;;AAKA;;AAeA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAmBA;;AACA;;AACA;;AACA;;AAKA;;;;;;AA/DA;AACA;AACA;;AAIA;AACA;AACA;AA8BA,MAAMA,gBAAgB,GAAG,CACxB;AAAEC,EAAAA,IAAI,EAAE,MAAR;AAAgBC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,CAAEtC,IAAF,CAAhB;AACA,KAjBK;;AAkBNY,IAAAA;AAlBM,GAAP;AAoBA,CAhCD,CAnCuB,CAAT,EAoEVjG,oBApEU,C","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getGlobalStyles, getColorsAndGradients } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n\trawAttributes: [ 'title', 'excerpt', 'content' ],\n} ) );\nimport { EditorHelpTopics, store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes.\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { capabilities, locale, updateSettings } = this.props;\n\n\t\tupdateSettings( {\n\t\t\t...capabilities,\n\t\t\t...this.getThemeColors( this.props ),\n\t\t\tlocale,\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst newBlock = createBlock( blockName, {\n\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t[ payload.mediaType === 'image' ? 'url' : 'src' ]:\n\t\t\t\t\t\tpayload.mediaUrl,\n\t\t\t\t} );\n\n\t\t\t\tconst indexAfterSelected = this.props.selectedBlockIndex + 1;\n\t\t\t\tconst insertionIndex =\n\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings =\n\t\t\tsubscribeUpdateEditorSettings(\n\t\t\t\t( { galleryWithImageBlocks, ...editorSettings } ) => {\n\t\t\t\t\tif ( typeof galleryWithImageBlocks === 'boolean' ) {\n\t\t\t\t\t\twindow.wp.galleryBlockV2Enabled =\n\t\t\t\t\t\t\tgalleryWithImageBlocks;\n\t\t\t\t\t}\n\t\t\t\t\tupdateSettings( this.getThemeColors( editorSettings ) );\n\t\t\t\t}\n\t\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app.\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store.\n\t\t\tupdateSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration.\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { rawStyles, rawFeatures } ) {\n\t\tconst { defaultEditorColors, defaultEditorGradients } = this.props;\n\n\t\tif ( rawStyles && rawFeatures ) {\n\t\t\treturn getGlobalStyles( rawStyles, rawFeatures );\n\t\t}\n\n\t\treturn getColorsAndGradients(\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\trawFeatures\n\t\t);\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly.\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// Refresh html content first.\n\t\tthis.serializeToNativeAction();\n\t\t// Make sure to blur the selected block and dismiss the keyboard.\n\t\tthis.props.clearSelectedBlock();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateSettings( capabilities );\n\t}\n\n\trender() {\n\t\tconst { children, post, capabilities, settings, ...props } = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<SafeAreaProvider>{ children }</SafeAreaProvider>\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tclose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t} = select( editorStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetGlobalBlockCount,\n\t\t\tgetSettings: getBlockEditorSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst settings = getBlockEditorSettings();\n\t\tconst defaultEditorColors = settings?.colors ?? [];\n\t\tconst defaultEditorGradients = settings?.gradients ?? [];\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks } = dispatch( editorStore );\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\treplaceBlock,\n\t\t} = dispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( coreStore );\n\t\tconst { createSuccessNotice } = dispatch( noticesStore );\n\n\t\treturn {\n\t\t\tupdateSettings,\n\t\t\taddEntities,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n"]}
|
|
@@ -49,6 +49,8 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
49
49
|
userCanCreatePages,
|
|
50
50
|
pageOnFront
|
|
51
51
|
} = (0, _data.useSelect)(select => {
|
|
52
|
+
var _canUser;
|
|
53
|
+
|
|
52
54
|
const {
|
|
53
55
|
canUserUseUnfilteredHTML
|
|
54
56
|
} = select(_store.store);
|
|
@@ -64,7 +66,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
|
|
|
64
66
|
per_page: -1
|
|
65
67
|
}) : [],
|
|
66
68
|
// Reusable blocks are fetched in the native version of this hook.
|
|
67
|
-
hasUploadPermissions: (
|
|
69
|
+
hasUploadPermissions: (_canUser = canUser('create', 'media')) !== null && _canUser !== void 0 ? _canUser : true,
|
|
68
70
|
userCanCreatePages: canUser('create', 'pages'),
|
|
69
71
|
pageOnFront: siteSettings === null || siteSettings === void 0 ? void 0 : siteSettings.page_on_front
|
|
70
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","select","canUserUseUnfilteredHTML","editorStore","isWeb","Platform","OS","canUser","getEntityRecord","coreStore","siteSettings","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","mediaUpload","undefined","__experimentalReusableBlocks","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA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C/B,WARD,EASCI,kBATD,EAUCC,WAVD,CA1DM,CAAP;AAuEA;;eAEcP,sB","sourcesContent":["/**\n * External dependencies\n */\nimport { pick, defaultTo, unionBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML } = select( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: [], // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tcanUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories: select(\n\t\t\t\tcoreStore\n\t\t\t).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() => unionBy( settingsBlockPatterns, restBlockPatterns, 'name' ),\n\t\t[ settingsBlockPatterns, restBlockPatterns ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\tunionBy(\n\t\t\t\tsettingsBlockPatternCategories,\n\t\t\t\trestBlockPatternCategories,\n\t\t\t\t'name'\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...pick( settings, [\n\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t'__experimentalDiscussionSettings',\n\t\t\t\t'__experimentalFeatures',\n\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t'alignWide',\n\t\t\t\t'allowedBlockTypes',\n\t\t\t\t'bodyPlaceholder',\n\t\t\t\t'canLockBlocks',\n\t\t\t\t'codeEditingEnabled',\n\t\t\t\t'colors',\n\t\t\t\t'disableCustomColors',\n\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t'disableCustomGradients',\n\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t'enableCustomSpacing',\n\t\t\t\t'enableCustomUnits',\n\t\t\t\t'focusMode',\n\t\t\t\t'fontSizes',\n\t\t\t\t'gradients',\n\t\t\t\t'generateAnchors',\n\t\t\t\t'hasFixedToolbar',\n\t\t\t\t'hasReducedUI',\n\t\t\t\t'imageDefaultSize',\n\t\t\t\t'imageDimensions',\n\t\t\t\t'imageEditing',\n\t\t\t\t'imageSizes',\n\t\t\t\t'isRTL',\n\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t'maxWidth',\n\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t'styles',\n\t\t\t\t'template',\n\t\t\t\t'templateLock',\n\t\t\t\t'titlePlaceholder',\n\t\t\t\t'supportsLayout',\n\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t'__unstableResolvedAssets',\n\t\t\t] ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","select","canUserUseUnfilteredHTML","editorStore","isWeb","Platform","OS","canUser","getEntityRecord","coreStore","siteSettings","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","mediaUpload","undefined","__experimentalReusableBlocks","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,sBAAT,CAAiC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ies\n */\nimport { pick, unionBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML } = select( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: [], // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() => unionBy( settingsBlockPatterns, restBlockPatterns, 'name' ),\n\t\t[ settingsBlockPatterns, restBlockPatterns ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\tunionBy(\n\t\t\t\tsettingsBlockPatternCategories,\n\t\t\t\trestBlockPatternCategories,\n\t\t\t\t'name'\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...pick( settings, [\n\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t'__experimentalDiscussionSettings',\n\t\t\t\t'__experimentalFeatures',\n\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t'alignWide',\n\t\t\t\t'allowedBlockTypes',\n\t\t\t\t'bodyPlaceholder',\n\t\t\t\t'canLockBlocks',\n\t\t\t\t'codeEditingEnabled',\n\t\t\t\t'colors',\n\t\t\t\t'disableCustomColors',\n\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t'disableCustomGradients',\n\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t'enableCustomSpacing',\n\t\t\t\t'enableCustomUnits',\n\t\t\t\t'focusMode',\n\t\t\t\t'fontSizes',\n\t\t\t\t'gradients',\n\t\t\t\t'generateAnchors',\n\t\t\t\t'hasFixedToolbar',\n\t\t\t\t'hasReducedUI',\n\t\t\t\t'imageDefaultSize',\n\t\t\t\t'imageDimensions',\n\t\t\t\t'imageEditing',\n\t\t\t\t'imageSizes',\n\t\t\t\t'isRTL',\n\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t'maxWidth',\n\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t'styles',\n\t\t\t\t'template',\n\t\t\t\t'templateLock',\n\t\t\t\t'titlePlaceholder',\n\t\t\t\t'supportsLayout',\n\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t'__unstableResolvedAssets',\n\t\t\t] ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
|
|
@@ -17,6 +17,8 @@ var _blockEditor = require("@wordpress/block-editor");
|
|
|
17
17
|
|
|
18
18
|
var _wordCount = _interopRequireDefault(require("../word-count"));
|
|
19
19
|
|
|
20
|
+
var _timeToRead = _interopRequireDefault(require("../time-to-read"));
|
|
21
|
+
|
|
20
22
|
var _documentOutline = _interopRequireDefault(require("../document-outline"));
|
|
21
23
|
|
|
22
24
|
var _characterCount = _interopRequireDefault(require("../character-count"));
|
|
@@ -64,11 +66,13 @@ function TableOfContentsPanel(_ref) {
|
|
|
64
66
|
className: "table-of-contents__counts"
|
|
65
67
|
}, (0, _element.createElement)("li", {
|
|
66
68
|
className: "table-of-contents__count"
|
|
69
|
+
}, (0, _i18n.__)('Words'), (0, _element.createElement)(_wordCount.default, null)), (0, _element.createElement)("li", {
|
|
70
|
+
className: "table-of-contents__count"
|
|
67
71
|
}, (0, _i18n.__)('Characters'), (0, _element.createElement)("span", {
|
|
68
72
|
className: "table-of-contents__number"
|
|
69
73
|
}, (0, _element.createElement)(_characterCount.default, null))), (0, _element.createElement)("li", {
|
|
70
74
|
className: "table-of-contents__count"
|
|
71
|
-
}, (0, _i18n.__)('
|
|
75
|
+
}, (0, _i18n.__)('Time to read'), (0, _element.createElement)(_timeToRead.default, null)), (0, _element.createElement)("li", {
|
|
72
76
|
className: "table-of-contents__count"
|
|
73
77
|
}, (0, _i18n.__)('Headings'), (0, _element.createElement)("span", {
|
|
74
78
|
className: "table-of-contents__number"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/table-of-contents/panel.js"],"names":["TableOfContentsPanel","hasOutlineItemsDisabled","onRequestClose","headingCount","paragraphCount","numberOfBlocks","select","getGlobalBlockCount","blockEditorStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/table-of-contents/panel.js"],"names":["TableOfContentsPanel","hasOutlineItemsDisabled","onRequestClose","headingCount","paragraphCount","numberOfBlocks","select","getGlobalBlockCount","blockEditorStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAKA;AACA;AACA;AAMA,SAASA,oBAAT,OAA6E;AAAA,MAA9C;AAAEC,IAAAA,uBAAF;AAA2BC,IAAAA;AAA3B,GAA8C;AAC5E,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,cAAhB;AAAgCC,IAAAA;AAAhC,MAAmD,qBACtDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAA0BD,MAAM,CAAEE,kBAAF,CAAtC;AACA,WAAO;AACNL,MAAAA,YAAY,EAAEI,mBAAmB,CAAE,cAAF,CAD3B;AAENH,MAAAA,cAAc,EAAEG,mBAAmB,CAAE,gBAAF,CAF7B;AAGNF,MAAAA,cAAc,EAAEE,mBAAmB;AAH7B,KAAP;AAKA,GARuD,EASxD,EATwD,CAAzD;AAWA;AACC;AACF;AACA;AACA;;AACE;AACA,yDACC;AACC,MAAA,SAAS,EAAC,4BADX;AAEC,MAAA,IAAI,EAAC,MAFN;AAGC,oBAAa,cAAI,qBAAJ,CAHd;AAIC,MAAA,QAAQ,EAAC;AAJV,OAMC;AAAI,MAAA,IAAI,EAAC,MAAT;AAAgB,MAAA,SAAS,EAAC;AAA1B,OACC;AAAI,MAAA,SAAS,EAAC;AAAd,OACG,cAAI,OAAJ,CADH,EAEC,4BAAC,kBAAD,OAFD,CADD,EAKC;AAAI,MAAA,SAAS,EAAC;AAAd,OACG,cAAI,YAAJ,CADH,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACC,4BAAC,uBAAD,OADD,CAFD,CALD,EAWC;AAAI,MAAA,SAAS,EAAC;AAAd,OACG,cAAI,cAAJ,CADH,EAEC,4BAAC,mBAAD,OAFD,CAXD,EAeC;AAAI,MAAA,SAAS,EAAC;AAAd,OACG,cAAI,UAAJ,CADH,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGJ,YADH,CAFD,CAfD,EAqBC;AAAI,MAAA,SAAS,EAAC;AAAd,OACG,cAAI,YAAJ,CADH,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGC,cADH,CAFD,CArBD,EA2BC;AAAI,MAAA,SAAS,EAAC;AAAd,OACG,cAAI,QAAJ,CADH,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGC,cADH,CAFD,CA3BD,CAND,CADD,EA0CGF,YAAY,GAAG,CAAf,IACD,qDACC,uCADD,EAEC;AAAI,MAAA,SAAS,EAAC;AAAd,OACG,cAAI,kBAAJ,CADH,CAFD,EAKC,4BAAC,wBAAD;AACC,MAAA,QAAQ,EAAGD,cADZ;AAEC,MAAA,uBAAuB,EAAGD;AAF3B,MALD,CA3CF;AAuDA;;AA7DD;AA+DA;;eAEcD,oB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport WordCount from '../word-count';\nimport TimeToRead from '../time-to-read';\nimport DocumentOutline from '../document-outline';\nimport CharacterCount from '../character-count';\n\nfunction TableOfContentsPanel( { hasOutlineItemsDisabled, onRequestClose } ) {\n\tconst { headingCount, paragraphCount, numberOfBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getGlobalBlockCount } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\theadingCount: getGlobalBlockCount( 'core/heading' ),\n\t\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t\t\tnumberOfBlocks: getGlobalBlockCount(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn (\n\t\t/*\n\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t */\n\t\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName=\"table-of-contents__wrapper\"\n\t\t\t\trole=\"note\"\n\t\t\t\taria-label={ __( 'Document Statistics' ) }\n\t\t\t\ttabIndex=\"0\"\n\t\t\t>\n\t\t\t\t<ul role=\"list\" className=\"table-of-contents__counts\">\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Words' ) }\n\t\t\t\t\t\t<WordCount />\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Characters' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t<CharacterCount />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Time to read' ) }\n\t\t\t\t\t\t<TimeToRead />\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Headings' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t{ headingCount }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Paragraphs' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t{ paragraphCount }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Blocks' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t{ numberOfBlocks }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t{ headingCount > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t<hr />\n\t\t\t\t\t<h2 className=\"table-of-contents__title\">\n\t\t\t\t\t\t{ __( 'Document Outline' ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<DocumentOutline\n\t\t\t\t\t\tonSelect={ onRequestClose }\n\t\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-redundant-roles */\n\t);\n}\n\nexport default TableOfContentsPanel;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/template-validation-notice/index.js"],"names":["TemplateValidationNotice","isValid","props","confirmSynchronization","window","confirm","synchronizeTemplate","label","onClick","resetTemplateValidity","select","blockEditorStore","isValidTemplate","dispatch","setTemplateValidity"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOA,SAASA,wBAAT,OAA2D;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAW,OAAGC;AAAd,GAAwB;;AAC1D,MAAKD,OAAL,EAAe;AACd,WAAO,IAAP;AACA;;AAED,QAAME,sBAAsB,GAAG,MAAM;AACpC,SACC;AACAC,IAAAA,MAAM,CAACC,OAAP,CACC,cACC,gFADD,CADD,CAFD,EAOE;AACDH,MAAAA,KAAK,CAACI,mBAAN;AACA;AACD,GAXD;;AAaA,SACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,mCADX;AAEC,IAAA,aAAa,EAAG,KAFjB;AAGC,IAAA,MAAM,EAAC,SAHR;AAIC,IAAA,OAAO,EAAG,CACT;AACCC,MAAAA,KAAK,EAAE,cAAI,eAAJ,CADR;AAECC,MAAAA,OAAO,EAAEN,KAAK,CAACO;AAFhB,KADS,EAKT;AACCF,MAAAA,KAAK,EAAE,cAAI,oBAAJ,CADR;AAECC,MAAAA,OAAO,EAAEL;AAFV,KALS;AAJX,KAeG,cACD,iFADC,CAfH,CADD;AAqBA;;eAEc,sBAAS,CACvB,sBAAcO,MAAF,KAAgB;AAC3BT,EAAAA,OAAO,EAAES,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,eAA3B;AADkB,CAAhB,CAAZ,CADuB,EAIvB,wBAAgBC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,mBAAF;AAAuBR,IAAAA;AAAvB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/template-validation-notice/index.js"],"names":["TemplateValidationNotice","isValid","props","confirmSynchronization","window","confirm","synchronizeTemplate","label","onClick","resetTemplateValidity","select","blockEditorStore","isValidTemplate","dispatch","setTemplateValidity"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOA,SAASA,wBAAT,OAA2D;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAW,OAAGC;AAAd,GAAwB;;AAC1D,MAAKD,OAAL,EAAe;AACd,WAAO,IAAP;AACA;;AAED,QAAME,sBAAsB,GAAG,MAAM;AACpC,SACC;AACAC,IAAAA,MAAM,CAACC,OAAP,CACC,cACC,gFADD,CADD,CAFD,EAOE;AACDH,MAAAA,KAAK,CAACI,mBAAN;AACA;AACD,GAXD;;AAaA,SACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,mCADX;AAEC,IAAA,aAAa,EAAG,KAFjB;AAGC,IAAA,MAAM,EAAC,SAHR;AAIC,IAAA,OAAO,EAAG,CACT;AACCC,MAAAA,KAAK,EAAE,cAAI,eAAJ,CADR;AAECC,MAAAA,OAAO,EAAEN,KAAK,CAACO;AAFhB,KADS,EAKT;AACCF,MAAAA,KAAK,EAAE,cAAI,oBAAJ,CADR;AAECC,MAAAA,OAAO,EAAEL;AAFV,KALS;AAJX,KAeG,cACD,iFADC,CAfH,CADD;AAqBA;;eAEc,sBAAS,CACvB,sBAAcO,MAAF,KAAgB;AAC3BT,EAAAA,OAAO,EAAES,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,eAA3B;AADkB,CAAhB,CAAZ,CADuB,EAIvB,wBAAgBC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,mBAAF;AAAuBR,IAAAA;AAAvB,MACLO,QAAQ,CAAEF,kBAAF,CADT;AAEA,SAAO;AACNF,IAAAA,qBAAqB,EAAE,MAAMK,mBAAmB,CAAE,IAAF,CAD1C;AAENR,IAAAA;AAFM,GAAP;AAIA,CAPD,CAJuB,CAAT,EAYVN,wBAZU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction TemplateValidationNotice( { isValid, ...props } ) {\n\tif ( isValid ) {\n\t\treturn null;\n\t}\n\n\tconst confirmSynchronization = () => {\n\t\tif (\n\t\t\t// eslint-disable-next-line no-alert\n\t\t\twindow.confirm(\n\t\t\t\t__(\n\t\t\t\t\t'Resetting the template may result in loss of content, do you want to continue?'\n\t\t\t\t)\n\t\t\t)\n\t\t) {\n\t\t\tprops.synchronizeTemplate();\n\t\t}\n\t};\n\n\treturn (\n\t\t<Notice\n\t\t\tclassName=\"editor-template-validation-notice\"\n\t\t\tisDismissible={ false }\n\t\t\tstatus=\"warning\"\n\t\t\tactions={ [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Keep it as is' ),\n\t\t\t\t\tonClick: props.resetTemplateValidity,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Reset the template' ),\n\t\t\t\t\tonClick: confirmSynchronization,\n\t\t\t\t},\n\t\t\t] }\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'The content of your post doesn’t match the template assigned to your post type.'\n\t\t\t) }\n\t\t</Notice>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => ( {\n\t\tisValid: select( blockEditorStore ).isValidTemplate(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { setTemplateValidity, synchronizeTemplate } =\n\t\t\tdispatch( blockEditorStore );\n\t\treturn {\n\t\t\tresetTemplateValidity: () => setTemplateValidity( true ),\n\t\t\tsynchronizeTemplate,\n\t\t};\n\t} ),\n] )( TemplateValidationNotice );\n"]}
|
|
@@ -38,7 +38,7 @@ function ThemeSupportCheck(_ref) {
|
|
|
38
38
|
// within `supported`. If `postType` isn't passed, then the check
|
|
39
39
|
// should fail.
|
|
40
40
|
|
|
41
|
-
if ('post-thumbnails' === key &&
|
|
41
|
+
if ('post-thumbnails' === key && Array.isArray(supported)) {
|
|
42
42
|
return (0, _lodash.includes)(supported, postType);
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","key","supported","select","getThemeSupports","coreStore","getEditedPostAttribute","editorStore"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,iBAAT,OAKH;AAAA,MAL+B;AAClCC,IAAAA,aADkC;AAElCC,IAAAA,QAFkC;AAGlCC,IAAAA,QAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,WAAW,GAAG,kBAAM,uBAAWD,WAAX,CAAN,EAAkCE,GAAF,IAAW;AAC9D,UAAMC,SAAS,GAAG,iBAAKN,aAAL,EAAoB,CAAEK,GAAF,CAApB,EAA6B,KAA7B,CAAlB,CAD8D,CAE9D;AACA;AACA;AACA;;AACA,QAAK,sBAAsBA,GAAtB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","key","supported","Array","isArray","select","getThemeSupports","coreStore","getEditedPostAttribute","editorStore"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,iBAAT,OAKH;AAAA,MAL+B;AAClCC,IAAAA,aADkC;AAElCC,IAAAA,QAFkC;AAGlCC,IAAAA,QAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,WAAW,GAAG,kBAAM,uBAAWD,WAAX,CAAN,EAAkCE,GAAF,IAAW;AAC9D,UAAMC,SAAS,GAAG,iBAAKN,aAAL,EAAoB,CAAEK,GAAF,CAApB,EAA6B,KAA7B,CAAlB,CAD8D,CAE9D;AACA;AACA;AACA;;AACA,QAAK,sBAAsBA,GAAtB,IAA6BE,KAAK,CAACC,OAAN,CAAeF,SAAf,CAAlC,EAA+D;AAC9D,aAAO,sBAAUA,SAAV,EAAqBJ,QAArB,CAAP;AACA;;AACD,WAAOI,SAAP;AACA,GAVmB,CAApB;;AAYA,MAAK,CAAEF,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOH,QAAP;AACA;;eAEc,sBAAcQ,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAuBD,MAAM,CAAEE,eAAF,CAAnC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA6BH,MAAM,CAAEI,YAAF,CAAzC;AACA,SAAO;AACNX,IAAAA,QAAQ,EAAEU,sBAAsB,CAAE,MAAF,CAD1B;AAENZ,IAAAA,aAAa,EAAEU,gBAAgB;AAFzB,GAAP;AAIA,CAPc,EAOVX,iBAPU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { castArray, includes, get, some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function ThemeSupportCheck( {\n\tthemeSupports,\n\tchildren,\n\tpostType,\n\tsupportKeys,\n} ) {\n\tconst isSupported = some( castArray( supportKeys ), ( key ) => {\n\t\tconst supported = get( themeSupports, [ key ], false );\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn includes( supported, postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getThemeSupports } = select( coreStore );\n\tconst { getEditedPostAttribute } = select( editorStore );\n\treturn {\n\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\tthemeSupports: getThemeSupports(),\n\t};\n} )( ThemeSupportCheck );\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = TimeToRead;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
|
|
14
|
+
var _wordcount = require("@wordpress/wordcount");
|
|
15
|
+
|
|
16
|
+
var _store = require("../../store");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Average reading rate - based on average taken from
|
|
28
|
+
* https://irisreading.com/average-reading-speed-in-various-languages/
|
|
29
|
+
* (Characters/minute used for Chinese rather than words).
|
|
30
|
+
*
|
|
31
|
+
* @type {number} A rough estimate of the average reading rate across multiple languages.
|
|
32
|
+
*/
|
|
33
|
+
const AVERAGE_READING_RATE = 189;
|
|
34
|
+
|
|
35
|
+
function TimeToRead() {
|
|
36
|
+
const content = (0, _data.useSelect)(select => select(_store.store).getEditedPostAttribute('content'), []);
|
|
37
|
+
/*
|
|
38
|
+
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
|
39
|
+
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
|
|
40
|
+
* Do not translate into your own language.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
const wordCountType = (0, _i18n._x)('words', 'Word count type. Do not translate!');
|
|
44
|
+
const minutesToRead = Math.round((0, _wordcount.count)(content, wordCountType) / AVERAGE_READING_RATE);
|
|
45
|
+
const minutesToReadString = minutesToRead === 0 ? (0, _element.createInterpolateElement)((0, _i18n.__)('<span>< 1</span> minute'), {
|
|
46
|
+
span: (0, _element.createElement)("span", {
|
|
47
|
+
className: "table-of-contents__number"
|
|
48
|
+
})
|
|
49
|
+
}) : (0, _element.createInterpolateElement)((0, _i18n.sprintf)(
|
|
50
|
+
/* translators: %s is the number of minutes the post will take to read. */
|
|
51
|
+
(0, _i18n._n)('<span>%d</span> minute', '<span>%d</span> minutes', minutesToRead), minutesToRead), {
|
|
52
|
+
span: (0, _element.createElement)("span", {
|
|
53
|
+
className: "table-of-contents__number"
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
return (0, _element.createElement)("span", {
|
|
57
|
+
className: "time-to-read"
|
|
58
|
+
}, minutesToReadString);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/time-to-read/index.js"],"names":["AVERAGE_READING_RATE","TimeToRead","content","select","editorStore","getEditedPostAttribute","wordCountType","minutesToRead","Math","round","minutesToReadString","span"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAMA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,oBAAoB,GAAG,GAA7B;;AAEe,SAASC,UAAT,GAAsB;AACpC,QAAMC,OAAO,GAAG,qBACbC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,SAA9C,CADC,EAEf,EAFe,CAAhB;AAKA;AACD;AACA;AACA;AACA;;AACC,QAAMC,aAAa,GAAG,cAAI,OAAJ,EAAa,oCAAb,CAAtB;AACA,QAAMC,aAAa,GAAGC,IAAI,CAACC,KAAL,CACrB,sBAAWP,OAAX,EAAoBI,aAApB,IAAsCN,oBADjB,CAAtB;AAGA,QAAMU,mBAAmB,GACxBH,aAAa,KAAK,CAAlB,GACG,uCAA0B,cAAI,yBAAJ,CAA1B,EAA2D;AAC3DI,IAAAA,IAAI,EAAE;AAAM,MAAA,SAAS,EAAC;AAAhB;AADqD,GAA3D,CADH,GAIG,uCACA;AACC;AACA,gBACC,wBADD,EAEC,yBAFD,EAGCJ,aAHD,CAFD,EAOCA,aAPD,CADA,EAUA;AACCI,IAAAA,IAAI,EAAE;AAAM,MAAA,SAAS,EAAC;AAAhB;AADP,GAVA,CALJ;AAoBA,SAAO;AAAM,IAAA,SAAS,EAAC;AAAhB,KAAiCD,mBAAjC,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x, _n, __, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Average reading rate - based on average taken from\n * https://irisreading.com/average-reading-speed-in-various-languages/\n * (Characters/minute used for Chinese rather than words).\n *\n * @type {number} A rough estimate of the average reading rate across multiple languages.\n */\nconst AVERAGE_READING_RATE = 189;\n\nexport default function TimeToRead() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst minutesToRead = Math.round(\n\t\twordCount( content, wordCountType ) / AVERAGE_READING_RATE\n\t);\n\tconst minutesToReadString =\n\t\tminutesToRead === 0\n\t\t\t? createInterpolateElement( __( '<span>< 1</span> minute' ), {\n\t\t\t\t\tspan: <span className=\"table-of-contents__number\" />,\n\t\t\t } )\n\t\t\t: createInterpolateElement(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s is the number of minutes the post will take to read. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'<span>%d</span> minute',\n\t\t\t\t\t\t\t'<span>%d</span> minutes',\n\t\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t\t),\n\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tspan: <span className=\"table-of-contents__number\" />,\n\t\t\t\t\t}\n\t\t\t );\n\n\treturn <span className=\"time-to-read\">{ minutesToReadString }</span>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","select","editorStore","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","value","key","attributeKey","shimAttributeSource","settings","source","edit","blocksStore","getBlockTypes","map","name","getBlockType","forEach"],"mappings":";;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,6BAA6B,GAAKC,cAAF,IACrC,yCACGC,SAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","select","editorStore","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","value","key","attributeKey","shimAttributeSource","settings","source","edit","blocksStore","getBlockTypes","map","name","getBlockType","forEach"],"mappings":";;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,6BAA6B,GAAKC,cAAF,IACrC,yCACGC,SAAF,IACC,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6B,OAAGC;AAAhC,GAA6C;AAC9C,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAsBC,kBAAtB,EADE,EAEhB,EAFgB,CAAjB;AAIA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,6BACzB,UADyB,EAEzBL,QAFyB,EAGzB,MAHyB,CAA1B;AAMA,QAAMM,gBAAgB,GAAG,sBACxB,OAAQ,EACP,GAAGT,UADI;AAEP,OAAG,uBACFF,cADE,EAEAY,OAAF,IAAeH,IAAI,CAAEG,OAAF,CAFj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,EAA4BI,YAA5B,CAA0CD,IAA1C,CAAhB;AAAA,CAFP,EAGEE,OAHF,CAGWT,mBAHX","sourcesContent":["/**\n * External dependencies\n */\nimport { pickBy, mapValues, isEmpty, mapKeys } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...mapValues(\n\t\t\t\t\t\t\tmetaAttributes,\n\t\t\t\t\t\t\t( metaKey ) => meta[ metaKey ]\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = mapKeys(\n\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\tpickBy(\n\t\t\t\t\t\t\t\t\tnextAttributes,\n\t\t\t\t\t\t\t\t\t( value, key ) => metaAttributes[ key ]\n\t\t\t\t\t\t\t\t),\n\n\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t( value, attributeKey ) =>\n\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ]\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isEmpty( nextMeta ) ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = mapValues(\n\t\tpickBy( settings.attributes, { source: 'meta' } ),\n\t\t'meta'\n\t);\n\tif ( ! isEmpty( metaAttributes ) ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
|
package/build/store/actions.js
CHANGED
|
@@ -303,11 +303,15 @@ const trashPost = () => async _ref5 => {
|
|
|
303
303
|
const postTypeSlug = select.getCurrentPostType();
|
|
304
304
|
const postType = await registry.resolveSelect(_coreData.store).getPostType(postTypeSlug);
|
|
305
305
|
registry.dispatch(_notices.store).removeNotice(_constants.TRASH_POST_NOTICE_ID);
|
|
306
|
+
const {
|
|
307
|
+
rest_base: restBase,
|
|
308
|
+
rest_namespace: restNamespace = 'wp/v2'
|
|
309
|
+
} = postType;
|
|
306
310
|
|
|
307
311
|
try {
|
|
308
312
|
const post = select.getCurrentPost();
|
|
309
313
|
await (0, _apiFetch.default)({
|
|
310
|
-
path:
|
|
314
|
+
path: `/${restNamespace}/${restBase}/${post.id}`,
|
|
311
315
|
method: 'DELETE'
|
|
312
316
|
});
|
|
313
317
|
await dispatch.savePost();
|