@wordpress/editor 13.23.0 → 13.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/entities-saved-states/index.js +15 -1
  3. package/build/components/entities-saved-states/index.js.map +1 -1
  4. package/build/components/index.js +26 -2
  5. package/build/components/index.js.map +1 -1
  6. package/build/components/post-author/panel.js +24 -0
  7. package/build/components/post-author/panel.js.map +1 -0
  8. package/build/components/post-panel-row/index.js +36 -0
  9. package/build/components/post-panel-row/index.js.map +1 -0
  10. package/build/components/post-saved-state/index.js +21 -16
  11. package/build/components/post-saved-state/index.js.map +1 -1
  12. package/build/components/post-schedule/panel.js +67 -0
  13. package/build/components/post-schedule/panel.js.map +1 -0
  14. package/build/components/post-sync-status/index.js +8 -4
  15. package/build/components/post-sync-status/index.js.map +1 -1
  16. package/build/components/post-title/constants.js +11 -0
  17. package/build/components/post-title/constants.js.map +1 -0
  18. package/build/components/post-title/index.js +61 -89
  19. package/build/components/post-title/index.js.map +1 -1
  20. package/build/components/post-title/post-title-raw.js +92 -0
  21. package/build/components/post-title/post-title-raw.js.map +1 -0
  22. package/build/components/post-title/use-post-title-focus.js +64 -0
  23. package/build/components/post-title/use-post-title-focus.js.map +1 -0
  24. package/build/components/post-title/use-post-title.js +41 -0
  25. package/build/components/post-title/use-post-title.js.map +1 -0
  26. package/build/components/post-url/panel.js +4 -3
  27. package/build/components/post-url/panel.js.map +1 -1
  28. package/build/components/provider/constants.js +9 -0
  29. package/build/components/provider/constants.js.map +1 -0
  30. package/build/components/provider/disable-non-page-content-blocks.js +63 -0
  31. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -0
  32. package/build/components/provider/index.js +27 -9
  33. package/build/components/provider/index.js.map +1 -1
  34. package/build/private-apis.js +2 -0
  35. package/build/private-apis.js.map +1 -1
  36. package/build/store/actions.js +23 -2
  37. package/build/store/actions.js.map +1 -1
  38. package/build/store/reducer.js +10 -1
  39. package/build/store/reducer.js.map +1 -1
  40. package/build/store/selectors.js +16 -2
  41. package/build/store/selectors.js.map +1 -1
  42. package/build-module/components/entities-saved-states/index.js +16 -2
  43. package/build-module/components/entities-saved-states/index.js.map +1 -1
  44. package/build-module/components/index.js +3 -0
  45. package/build-module/components/index.js.map +1 -1
  46. package/build-module/components/post-author/panel.js +14 -0
  47. package/build-module/components/post-author/panel.js.map +1 -0
  48. package/build-module/components/post-panel-row/index.js +27 -0
  49. package/build-module/components/post-panel-row/index.js.map +1 -0
  50. package/build-module/components/post-saved-state/index.js +22 -17
  51. package/build-module/components/post-saved-state/index.js.map +1 -1
  52. package/build-module/components/post-schedule/panel.js +59 -0
  53. package/build-module/components/post-schedule/panel.js.map +1 -0
  54. package/build-module/components/post-sync-status/index.js +8 -5
  55. package/build-module/components/post-sync-status/index.js.map +1 -1
  56. package/build-module/components/post-title/constants.js +3 -0
  57. package/build-module/components/post-title/constants.js.map +1 -0
  58. package/build-module/components/post-title/index.js +62 -91
  59. package/build-module/components/post-title/index.js.map +1 -1
  60. package/build-module/components/post-title/post-title-raw.js +83 -0
  61. package/build-module/components/post-title/post-title-raw.js.map +1 -0
  62. package/build-module/components/post-title/use-post-title-focus.js +57 -0
  63. package/build-module/components/post-title/use-post-title-focus.js.map +1 -0
  64. package/build-module/components/post-title/use-post-title.js +33 -0
  65. package/build-module/components/post-title/use-post-title.js.map +1 -0
  66. package/build-module/components/post-url/panel.js +5 -4
  67. package/build-module/components/post-url/panel.js.map +1 -1
  68. package/build-module/components/provider/constants.js +2 -0
  69. package/build-module/components/provider/constants.js.map +1 -0
  70. package/build-module/components/provider/disable-non-page-content-blocks.js +56 -0
  71. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -0
  72. package/build-module/components/provider/index.js +25 -6
  73. package/build-module/components/provider/index.js.map +1 -1
  74. package/build-module/private-apis.js +2 -0
  75. package/build-module/private-apis.js.map +1 -1
  76. package/build-module/store/actions.js +21 -0
  77. package/build-module/store/actions.js.map +1 -1
  78. package/build-module/store/reducer.js +9 -1
  79. package/build-module/store/reducer.js.map +1 -1
  80. package/build-module/store/selectors.js +11 -0
  81. package/build-module/store/selectors.js.map +1 -1
  82. package/build-style/style-rtl.css +51 -18
  83. package/build-style/style.css +51 -18
  84. package/package.json +31 -31
  85. package/src/components/entities-saved-states/index.js +16 -1
  86. package/src/components/index.js +3 -0
  87. package/src/components/post-author/panel.js +18 -0
  88. package/src/components/post-author/style.scss +7 -0
  89. package/src/components/post-panel-row/index.js +26 -0
  90. package/src/components/post-panel-row/style.scss +21 -0
  91. package/src/components/post-saved-state/index.js +46 -37
  92. package/src/components/post-schedule/panel.js +65 -0
  93. package/src/components/post-schedule/style.scss +23 -0
  94. package/src/components/post-sync-status/index.js +5 -6
  95. package/src/components/post-sync-status/style.scss +3 -17
  96. package/src/components/post-title/constants.js +4 -0
  97. package/src/components/post-title/index.js +56 -87
  98. package/src/components/post-title/post-title-raw.js +82 -0
  99. package/src/components/post-title/style.scss +5 -0
  100. package/src/components/post-title/use-post-title-focus.js +50 -0
  101. package/src/components/post-title/use-post-title.js +25 -0
  102. package/src/components/post-url/panel.js +4 -8
  103. package/src/components/post-url/style.scss +1 -12
  104. package/src/components/provider/README.md +0 -13
  105. package/src/components/provider/constants.js +5 -0
  106. package/src/components/provider/disable-non-page-content-blocks.js +55 -0
  107. package/src/components/provider/index.js +41 -14
  108. package/src/private-apis.js +2 -0
  109. package/src/store/actions.js +21 -0
  110. package/src/store/reducer.js +10 -0
  111. package/src/store/selectors.js +11 -0
  112. package/src/style.scss +4 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_components","_element","_blockEditor","_store","_lockUnlock","ReusableBlocksRenameHint","unlock","blockEditorPrivateApis","PostSyncStatus","syncStatus","postType","useSelect","select","getEditedPostAttribute","editorStore","meta","currentSyncStatus","wp_pattern_sync_status","_react","createElement","PanelRow","className","__","PostSyncStatusModal","editPost","useDispatch","isModalOpen","setIsModalOpen","useState","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","useEffect","setSyncStatus","Fragment","Modal","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","__experimentalVStack","spacing","ToggleControl","label","_x","help","checked","onChange","__experimentalHStack","justify","Button","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tPanelRow,\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst meta = getEditedPostAttribute( 'meta' );\n\n\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\tconst currentSyncStatus =\n\t\t\tmeta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? 'unsynced'\n\t\t\t\t: getEditedPostAttribute( 'wp_pattern_sync_status' );\n\n\t\treturn {\n\t\t\tsyncStatus: currentSyncStatus,\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-sync-status\">\n\t\t\t<span>{ __( 'Sync status' ) }</span>\n\t\t\t<div>\n\t\t\t\t{ syncStatus === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n\nexport function PostSyncStatusModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst setSyncStatus = () => {\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t},\n\t\t} );\n\t};\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Set pattern sync status' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetSyncStatus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Editing the pattern will update it anywhere it is used.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AApBA;AACA;AACA;;AAcA;AACA;AACA;;AAIA,MAAM;EAAEO;AAAyB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEtD,SAASC,cAAcA,CAAA,EAAG;EACxC,MAAM;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzD,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,MAAMC,IAAI,GAAGF,sBAAsB,CAAE,MAAO,CAAC;;IAE7C;IACA,MA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,UAAU,GAAGE,SAC3B,CAAC;IACF;EAAG,CACH,CAAC,EACF,IAAAb,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAAoD,oBAAM;IAACC,OAAO,EAAC;EAAO,GACtB,IAAAnC,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAAsD,MAAM;IAACC,OAAO,EAAC,SAAS;IAACC,IAAI,EAAC;EAAQ,GACpC,IAAAlC,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
1
+ {"version":3,"names":["_data","require","_i18n","_components","_element","_blockEditor","_postPanelRow","_interopRequireDefault","_store","_lockUnlock","ReusableBlocksRenameHint","unlock","blockEditorPrivateApis","PostSyncStatus","syncStatus","postType","useSelect","select","getEditedPostAttribute","editorStore","meta","currentSyncStatus","wp_pattern_sync_status","_react","createElement","default","label","__","className","PostSyncStatusModal","editPost","useDispatch","isModalOpen","setIsModalOpen","useState","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","useEffect","setSyncStatus","Fragment","Modal","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","__experimentalVStack","spacing","ToggleControl","_x","help","checked","onChange","__experimentalHStack","justify","Button","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst meta = getEditedPostAttribute( 'meta' );\n\n\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\tconst currentSyncStatus =\n\t\t\tmeta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? 'unsynced'\n\t\t\t\t: getEditedPostAttribute( 'wp_pattern_sync_status' );\n\n\t\treturn {\n\t\t\tsyncStatus: currentSyncStatus,\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Sync status' ) }>\n\t\t\t<div className=\"editor-post-sync-status__value\">\n\t\t\t\t{ syncStatus === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ) }\n\t\t\t</div>\n\t\t</PostPanelRow>\n\t);\n}\n\nexport function PostSyncStatusModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst setSyncStatus = () => {\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t},\n\t\t} );\n\t};\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Set pattern sync status' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetSyncStatus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Sync this pattern across multiple locations.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,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5D,IAAAvB,MAAA,CAAAC,aAAA;IACCuB,QAAQ,EAAKC,KAAK,IAAM;MACvBA,KAAK,CAACC,cAAc,CAAC,CAAC;MACtBhB,cAAc,CAAE,KAAM,CAAC;MACvBQ,aAAa,CAAC,CAAC;IAChB;EAAG,GAEH,IAAAlB,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAA+C,oBAAM;IAACC,OAAO,EAAC;EAAG,GAClB,IAAA5B,MAAA,CAAAC,aAAA,EAACd,wBAAwB,MAAE,CAAC,EAC5B,IAAAa,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAAiD,aAAa;IACb1B,KAAK,EAAG,IAAA2B,QAAE,EACT,QAAQ,EACR,sDACD,CAAG;IACHC,IAAI,EAAG,IAAA3B,QAAE,EACR,8CACD,CAAG;IACH4B,OAAO,EAAG,CAAEpB,QAAU;IACtBqB,QAAQ,EAAGA,CAAA,KAAM;MAChBpB,WAAW,CACV,CAAED,QAAQ,GAAG,UAAU,GAAGE,SAC3B,CAAC;IACF;EAAG,CACH,CAAC,EACF,IAAAd,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAAsD,oBAAM;IAACC,OAAO,EAAC;EAAO,GACtB,IAAAnC,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAAwD,MAAM;IAACC,OAAO,EAAC,SAAS;IAACC,IAAI,EAAC;EAAQ,GACpC,IAAAlC,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.REGEXP_NEWLINES = exports.DEFAULT_CLASSNAMES = void 0;
7
+ const DEFAULT_CLASSNAMES = 'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text';
8
+ exports.DEFAULT_CLASSNAMES = DEFAULT_CLASSNAMES;
9
+ const REGEXP_NEWLINES = /[\r\n]+/g;
10
+ exports.REGEXP_NEWLINES = REGEXP_NEWLINES;
11
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_CLASSNAMES","exports","REGEXP_NEWLINES"],"sources":["@wordpress/editor/src/components/post-title/constants.js"],"sourcesContent":["export const DEFAULT_CLASSNAMES =\n\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text';\n\nexport const REGEXP_NEWLINES = /[\\r\\n]+/g;\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAC9B,kHAAkH;AAACC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA;AAE7G,MAAME,eAAe,GAAG,UAAU;AAACD,OAAA,CAAAC,eAAA,GAAAA,eAAA"}
@@ -10,15 +10,18 @@ var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _i18n = require("@wordpress/i18n");
11
11
  var _element = require("@wordpress/element");
12
12
  var _htmlEntities = require("@wordpress/html-entities");
13
- var _keycodes = require("@wordpress/keycodes");
14
13
  var _data = require("@wordpress/data");
15
- var _blocks = require("@wordpress/blocks");
16
14
  var _blockEditor = require("@wordpress/block-editor");
15
+ var _keycodes = require("@wordpress/keycodes");
16
+ var _blocks = require("@wordpress/blocks");
17
17
  var _richText = require("@wordpress/rich-text");
18
18
  var _compose = require("@wordpress/compose");
19
19
  var _dom = require("@wordpress/dom");
20
- var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
21
20
  var _store = require("../../store");
21
+ var _constants = require("./constants");
22
+ var _usePostTitleFocus = _interopRequireDefault(require("./use-post-title-focus"));
23
+ var _usePostTitle = _interopRequireDefault(require("./use-post-title"));
24
+ var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
22
25
  /**
23
26
  * External dependencies
24
27
  */
@@ -31,30 +34,13 @@ var _store = require("../../store");
31
34
  * Internal dependencies
32
35
  */
33
36
 
34
- /**
35
- * Constants
36
- */
37
- const REGEXP_NEWLINES = /[\r\n]+/g;
38
37
  function PostTitle(_, forwardedRef) {
39
- const ref = (0, _element.useRef)();
40
- const [isSelected, setIsSelected] = (0, _element.useState)(false);
41
- const {
42
- editPost
43
- } = (0, _data.useDispatch)(_store.store);
44
- const {
45
- insertDefaultBlock,
46
- clearSelectedBlock,
47
- insertBlocks
48
- } = (0, _data.useDispatch)(_blockEditor.store);
49
38
  const {
50
- isCleanNewPost,
51
- title,
52
39
  placeholder,
53
40
  hasFixedToolbar
54
41
  } = (0, _data.useSelect)(select => {
55
42
  const {
56
- getEditedPostAttribute,
57
- isCleanNewPost: _isCleanNewPost
43
+ getEditedPostAttribute
58
44
  } = select(_store.store);
59
45
  const {
60
46
  getSettings
@@ -64,54 +50,31 @@ function PostTitle(_, forwardedRef) {
64
50
  hasFixedToolbar: _hasFixedToolbar
65
51
  } = getSettings();
66
52
  return {
67
- isCleanNewPost: _isCleanNewPost(),
68
53
  title: getEditedPostAttribute('title'),
69
54
  placeholder: titlePlaceholder,
70
55
  hasFixedToolbar: _hasFixedToolbar
71
56
  };
72
57
  }, []);
73
- (0, _element.useImperativeHandle)(forwardedRef, () => ({
74
- focus: () => {
75
- ref?.current?.focus();
76
- }
77
- }));
78
- (0, _element.useEffect)(() => {
79
- if (!ref.current) {
80
- return;
81
- }
82
- const {
83
- defaultView
84
- } = ref.current.ownerDocument;
85
- const {
86
- name,
87
- parent
88
- } = defaultView;
89
- const ownerDocument = name === 'editor-canvas' ? parent.document : defaultView.document;
90
- const {
91
- activeElement,
92
- body
93
- } = ownerDocument;
94
-
95
- // Only autofocus the title when the post is entirely empty. This should
96
- // only happen for a new post, which means we focus the title on new
97
- // post so the author can start typing right away, without needing to
98
- // click anything.
99
- if (isCleanNewPost && (!activeElement || body === activeElement)) {
100
- ref.current.focus();
101
- }
102
- }, [isCleanNewPost]);
103
- function onEnterPress() {
104
- insertDefaultBlock(undefined, undefined, 0);
58
+ const [isSelected, setIsSelected] = (0, _element.useState)(false);
59
+ const {
60
+ ref: focusRef
61
+ } = (0, _usePostTitleFocus.default)(forwardedRef);
62
+ const {
63
+ title,
64
+ setTitle: onUpdate
65
+ } = (0, _usePostTitle.default)();
66
+ const [selection, setSelection] = (0, _element.useState)({});
67
+ const {
68
+ clearSelectedBlock,
69
+ insertBlocks,
70
+ insertDefaultBlock
71
+ } = (0, _data.useDispatch)(_blockEditor.store);
72
+ function onChange(value) {
73
+ onUpdate(value.replace(_constants.REGEXP_NEWLINES, ' '));
105
74
  }
106
75
  function onInsertBlockAfter(blocks) {
107
76
  insertBlocks(blocks, 0);
108
77
  }
109
- function onUpdate(newTitle) {
110
- editPost({
111
- title: newTitle
112
- });
113
- }
114
- const [selection, setSelection] = (0, _element.useState)({});
115
78
  function onSelect() {
116
79
  setIsSelected(true);
117
80
  clearSelectedBlock();
@@ -120,8 +83,8 @@ function PostTitle(_, forwardedRef) {
120
83
  setIsSelected(false);
121
84
  setSelection({});
122
85
  }
123
- function onChange(value) {
124
- onUpdate(value.replace(REGEXP_NEWLINES, ' '));
86
+ function onEnterPress() {
87
+ insertDefaultBlock(undefined, undefined, 0);
125
88
  }
126
89
  function onKeyDown(event) {
127
90
  if (event.keyCode === _keycodes.ENTER) {
@@ -165,7 +128,11 @@ function PostTitle(_, forwardedRef) {
165
128
  if (typeof content !== 'string') {
166
129
  const [firstBlock] = content;
167
130
  if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) {
168
- onUpdate((0, _dom.__unstableStripHTML)(firstBlock.attributes.content));
131
+ // Strip HTML to avoid unwanted HTML being added to the title.
132
+ // In the majority of cases it is assumed that HTML in the title
133
+ // is undesirable.
134
+ const contentNoHTML = (0, _dom.__unstableStripHTML)(firstBlock.attributes.content);
135
+ onUpdate(contentNoHTML);
169
136
  onInsertBlockAfter(content.slice(1));
170
137
  } else {
171
138
  onInsertBlockAfter(content);
@@ -177,8 +144,13 @@ function PostTitle(_, forwardedRef) {
177
144
  }),
178
145
  ...selection
179
146
  };
147
+
148
+ // Strip HTML to avoid unwanted HTML being added to the title.
149
+ // In the majority of cases it is assumed that HTML in the title
150
+ // is undesirable.
151
+ const contentNoHTML = (0, _dom.__unstableStripHTML)(content);
180
152
  const newValue = (0, _richText.insert)(value, (0, _richText.create)({
181
- html: (0, _dom.__unstableStripHTML)(content)
153
+ html: contentNoHTML
182
154
  }));
183
155
  onUpdate((0, _richText.toHTMLString)({
184
156
  value: newValue
@@ -189,13 +161,6 @@ function PostTitle(_, forwardedRef) {
189
161
  });
190
162
  }
191
163
  }
192
-
193
- // The wp-block className is important for editor styles.
194
- // This same block is used in both the visual and the code editor.
195
- const className = (0, _classnames.default)('wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text', {
196
- 'is-selected': isSelected,
197
- 'has-fixed-toolbar': hasFixedToolbar
198
- });
199
164
  const decodedPlaceholder = (0, _htmlEntities.decodeEntities)(placeholder) || (0, _i18n.__)('Add title');
200
165
  const {
201
166
  ref: richTextRef
@@ -220,26 +185,33 @@ function PostTitle(_, forwardedRef) {
220
185
  };
221
186
  });
222
187
  },
223
- __unstableDisableFormats: true
188
+ __unstableDisableFormats: false
224
189
  });
225
190
 
226
- /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
227
- return (0, _react.createElement)(_postTypeSupportCheck.default, {
228
- supportKeys: "title"
229
- }, (0, _react.createElement)("h1", {
230
- ref: (0, _compose.useMergeRefs)([richTextRef, ref]),
231
- contentEditable: true,
232
- className: className,
233
- "aria-label": decodedPlaceholder,
234
- role: "textbox",
235
- "aria-multiline": "true",
236
- onFocus: onSelect,
237
- onBlur: onUnselect,
238
- onKeyDown: onKeyDown,
239
- onKeyPress: onUnselect,
240
- onPaste: onPaste
241
- }));
242
- /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
191
+ // The wp-block className is important for editor styles.
192
+ // This same block is used in both the visual and the code editor.
193
+ const className = (0, _classnames.default)(_constants.DEFAULT_CLASSNAMES, {
194
+ 'is-selected': isSelected,
195
+ 'has-fixed-toolbar': hasFixedToolbar
196
+ });
197
+ return (/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
198
+ (0, _react.createElement)(_postTypeSupportCheck.default, {
199
+ supportKeys: "title"
200
+ }, (0, _react.createElement)("h1", {
201
+ ref: (0, _compose.useMergeRefs)([richTextRef, focusRef]),
202
+ contentEditable: true,
203
+ className: className,
204
+ "aria-label": decodedPlaceholder,
205
+ role: "textbox",
206
+ "aria-multiline": "true",
207
+ onFocus: onSelect,
208
+ onBlur: onUnselect,
209
+ onKeyDown: onKeyDown,
210
+ onKeyPress: onUnselect,
211
+ onPaste: onPaste
212
+ }))
213
+ /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
214
+ );
243
215
  }
244
216
  var _default = (0, _element.forwardRef)(PostTitle);
245
217
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_element","_htmlEntities","_keycodes","_data","_blocks","_blockEditor","_richText","_compose","_dom","_postTypeSupportCheck","_store","REGEXP_NEWLINES","PostTitle","_","forwardedRef","ref","useRef","isSelected","setIsSelected","useState","editPost","useDispatch","editorStore","insertDefaultBlock","clearSelectedBlock","insertBlocks","blockEditorStore","isCleanNewPost","title","placeholder","hasFixedToolbar","useSelect","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","_hasFixedToolbar","useImperativeHandle","focus","current","useEffect","defaultView","ownerDocument","name","parent","document","activeElement","body","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","pasteHandler","HTML","length","firstBlock","stripHTML","attributes","slice","create","newValue","insert","toHTMLString","start","end","className","classnames","decodedPlaceholder","decodeEntities","__","richTextRef","useRichText","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","_react","createElement","default","supportKeys","useMergeRefs","contentEditable","role","onFocus","onBlur","onKeyPress","_default","forwardRef","exports"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Constants\n */\nconst REGEXP_NEWLINES = /[\\r\\n]+/g;\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst ref = useRef();\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { insertDefaultBlock, clearSelectedBlock, insertBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { isCleanNewPost, title, placeholder, hasFixedToolbar } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, isCleanNewPost: _isCleanNewPost } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =\n\t\t\t\tgetSettings();\n\n\t\t\treturn {\n\t\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\t\tplaceholder: titlePlaceholder,\n\t\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseImperativeHandle( forwardedRef, () => ( {\n\t\tfocus: () => {\n\t\t\tref?.current?.focus();\n\t\t},\n\t} ) );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = ref.current.ownerDocument;\n\t\tconst { name, parent } = defaultView;\n\t\tconst ownerDocument =\n\t\t\tname === 'editor-canvas' ? parent.document : defaultView.document;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onUpdate( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\tonUpdate( stripHTML( firstBlock.attributes.content ) );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\t\t\tconst newValue = insert(\n\t\t\t\tvalue,\n\t\t\t\tcreate( { html: stripHTML( content ) } )\n\t\t\t);\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames(\n\t\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text',\n\t\t{\n\t\t\t'is-selected': isSelected,\n\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t}\n\t);\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: true,\n\t} );\n\n\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, ref ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t);\n\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( PostTitle );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC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AAA,CAAAV,OAAA,GAAAQ,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_element","_htmlEntities","_data","_blockEditor","_keycodes","_blocks","_richText","_compose","_dom","_store","_constants","_usePostTitleFocus","_usePostTitle","_postTypeSupportCheck","PostTitle","_","forwardedRef","placeholder","hasFixedToolbar","useSelect","select","getEditedPostAttribute","editorStore","getSettings","blockEditorStore","titlePlaceholder","_hasFixedToolbar","title","isSelected","setIsSelected","useState","ref","focusRef","usePostTitleFocus","setTitle","onUpdate","usePostTitle","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","useDispatch","onChange","value","replace","REGEXP_NEWLINES","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","pasteHandler","HTML","length","firstBlock","name","contentNoHTML","stripHTML","attributes","slice","create","newValue","insert","toHTMLString","start","end","decodedPlaceholder","decodeEntities","__","richTextRef","useRichText","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","className","classnames","DEFAULT_CLASSNAMES","_react","createElement","default","supportKeys","useMergeRefs","contentEditable","role","onFocus","onBlur","onKeyPress","_default","forwardRef","exports"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { ENTER } from '@wordpress/keycodes';\nimport { pasteHandler } from '@wordpress/blocks';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { DEFAULT_CLASSNAMES, REGEXP_NEWLINES } from './constants';\nimport usePostTitleFocus from './use-post-title-focus';\nimport usePostTitle from './use-post-title';\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst { placeholder, hasFixedToolbar } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =\n\t\t\tgetSettings();\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tplaceholder: titlePlaceholder,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t};\n\t}, [] );\n\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\n\tconst { ref: focusRef } = usePostTitleFocus( forwardedRef );\n\n\tconst { title, setTitle: onUpdate } = usePostTitle();\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tconst { clearSelectedBlock, insertBlocks, insertDefaultBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t\t// is undesirable.\n\t\t\t\tconst contentNoHTML = stripHTML(\n\t\t\t\t\tfirstBlock.attributes.content\n\t\t\t\t);\n\t\t\t\tonUpdate( contentNoHTML );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\n\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t// is undesirable.\n\t\t\tconst contentNoHTML = stripHTML( content );\n\n\t\t\tconst newValue = insert( value, create( { html: contentNoHTML } ) );\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: false,\n\t} );\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames( DEFAULT_CLASSNAMES, {\n\t\t'is-selected': isSelected,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t} );\n\n\treturn (\n\t\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, focusRef ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t);\n}\n\nexport default forwardRef( PostTitle );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAMA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAV,OAAA;AAKA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AACA,IAAAa,kBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,aAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,qBAAA,GAAAhB,sBAAA,CAAAC,OAAA;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;;AAOA,SAASgB,SAASA,CAAEC,CAAC,EAAEC,YAAY,EAAG;EACrC,MAAM;IAAEC,WAAW;IAAEC;EAAgB,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACjE,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,MAAM;MAAEC;IAAY,CAAC,GAAGH,MAAM,CAAEI,kBAAiB,CAAC;IAClD,MAAM;MAAEC,gBAAgB;MAAEP,eAAe,EAAEQ;IAAiB,CAAC,GAC5DH,WAAW,CAAC,CAAC;IAEd,OAAO;MACNI,KAAK,EAAEN,sBAAsB,CAAE,OAAQ,CAAC;MACxC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ACN,CAAC;MACF,CAAE,CAAC;IACJ,CAAC;IACDE,wBAAwB,EAAE;EAC3B,CAAE,CAAC;;EAEH;EACA;EACA,MAAMC,SAAS,GAAG,IAAAC,mBAAU,EAAEC,6BAAkB,EAAE;IACjD,aAAa,EAAEtE,UAAU;IACzB,mBAAmB,EAAEV;EACtB,CAAE,CAAC;EAEH,OACC;IACA,IAAAiF,MAAA,CAAAC,aAAA,EAACvF,qBAAA,CAAAwF,OAAoB;MAACC,WAAW,EAAC;IAAO,GACxC,IAAAH,MAAA,CAAAC,aAAA;MACCrE,GAAG,EAAG,IAAAwE,qBAAY,EAAE,CAAEhB,WAAW,EAAEvD,QAAQ,CAAG,CAAG;MACjDwE,eAAe;MACfR,SAAS,EAAGA,SAAW;MACvB,cAAaZ,kBAAoB;MACjCqB,IAAI,EAAC,SAAS;MACd,kBAAe,MAAM;MACrBC,OAAO,EAAGzD,QAAU;MACpB0D,MAAM,EAAGzD,UAAY;MACrBG,SAAS,EAAGA,SAAW;MACvBuD,UAAU,EAAG1D,UAAY;MACzBQ,OAAO,EAAGA;IAAS,CACnB,CACoB;IACtB;EAAA;AAEF;AAAC,IAAAmD,QAAA,GAEc,IAAAC,mBAAU,EAAEhG,SAAU,CAAC;AAAAiG,OAAA,CAAAV,OAAA,GAAAQ,QAAA"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = require("react");
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _components = require("@wordpress/components");
11
+ var _i18n = require("@wordpress/i18n");
12
+ var _htmlEntities = require("@wordpress/html-entities");
13
+ var _data = require("@wordpress/data");
14
+ var _blockEditor = require("@wordpress/block-editor");
15
+ var _element = require("@wordpress/element");
16
+ var _constants = require("./constants");
17
+ var _usePostTitleFocus = _interopRequireDefault(require("./use-post-title-focus"));
18
+ var _usePostTitle = _interopRequireDefault(require("./use-post-title"));
19
+ /**
20
+ * External dependencies
21
+ */
22
+
23
+ /**
24
+ * WordPress dependencies
25
+ */
26
+
27
+ /**
28
+ * Internal dependencies
29
+ */
30
+
31
+ function PostTitleRaw(_, forwardedRef) {
32
+ const {
33
+ placeholder,
34
+ hasFixedToolbar
35
+ } = (0, _data.useSelect)(select => {
36
+ const {
37
+ getSettings
38
+ } = select(_blockEditor.store);
39
+ const {
40
+ titlePlaceholder,
41
+ hasFixedToolbar: _hasFixedToolbar
42
+ } = getSettings();
43
+ return {
44
+ placeholder: titlePlaceholder,
45
+ hasFixedToolbar: _hasFixedToolbar
46
+ };
47
+ }, []);
48
+ const [isSelected, setIsSelected] = (0, _element.useState)(false);
49
+ const {
50
+ title,
51
+ setTitle: onUpdate
52
+ } = (0, _usePostTitle.default)();
53
+ const {
54
+ ref: focusRef
55
+ } = (0, _usePostTitleFocus.default)(forwardedRef);
56
+ function onChange(value) {
57
+ onUpdate(value.replace(_constants.REGEXP_NEWLINES, ' '));
58
+ }
59
+ function onSelect() {
60
+ setIsSelected(true);
61
+ }
62
+ function onUnselect() {
63
+ setIsSelected(false);
64
+ }
65
+
66
+ // The wp-block className is important for editor styles.
67
+ // This same block is used in both the visual and the code editor.
68
+ const className = (0, _classnames.default)(_constants.DEFAULT_CLASSNAMES, {
69
+ 'is-selected': isSelected,
70
+ 'has-fixed-toolbar': hasFixedToolbar,
71
+ 'is-raw-text': true
72
+ });
73
+ const decodedPlaceholder = (0, _htmlEntities.decodeEntities)(placeholder) || (0, _i18n.__)('Add title');
74
+ return (0, _react.createElement)(_components.TextareaControl, {
75
+ ref: focusRef,
76
+ value: title,
77
+ onChange: onChange,
78
+ onFocus: onSelect,
79
+ onBlur: onUnselect,
80
+ label: placeholder,
81
+ className: className,
82
+ placeholder: decodedPlaceholder,
83
+ hideLabelFromVision: true,
84
+ autoComplete: "off",
85
+ dir: "auto",
86
+ rows: 1,
87
+ __nextHasNoMarginBottom: true
88
+ });
89
+ }
90
+ var _default = (0, _element.forwardRef)(PostTitleRaw);
91
+ exports.default = _default;
92
+ //# sourceMappingURL=post-title-raw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_htmlEntities","_data","_blockEditor","_element","_constants","_usePostTitleFocus","_usePostTitle","PostTitleRaw","_","forwardedRef","placeholder","hasFixedToolbar","useSelect","select","getSettings","blockEditorStore","titlePlaceholder","_hasFixedToolbar","isSelected","setIsSelected","useState","title","setTitle","onUpdate","usePostTitle","ref","focusRef","usePostTitleFocus","onChange","value","replace","REGEXP_NEWLINES","onSelect","onUnselect","className","classnames","DEFAULT_CLASSNAMES","decodedPlaceholder","decodeEntities","__","_react","createElement","TextareaControl","onFocus","onBlur","label","hideLabelFromVision","autoComplete","dir","rows","__nextHasNoMarginBottom","_default","forwardRef","exports","default"],"sources":["@wordpress/editor/src/components/post-title/post-title-raw.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { TextareaControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { DEFAULT_CLASSNAMES, REGEXP_NEWLINES } from './constants';\nimport usePostTitleFocus from './use-post-title-focus';\nimport usePostTitle from './use-post-title';\n\nfunction PostTitleRaw( _, forwardedRef ) {\n\tconst { placeholder, hasFixedToolbar } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =\n\t\t\tgetSettings();\n\n\t\treturn {\n\t\t\tplaceholder: titlePlaceholder,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t};\n\t}, [] );\n\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\n\tconst { title, setTitle: onUpdate } = usePostTitle();\n\tconst { ref: focusRef } = usePostTitleFocus( forwardedRef );\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames( DEFAULT_CLASSNAMES, {\n\t\t'is-selected': isSelected,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t'is-raw-text': true,\n\t} );\n\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\n\treturn (\n\t\t<TextareaControl\n\t\t\tref={ focusRef }\n\t\t\tvalue={ title }\n\t\t\tonChange={ onChange }\n\t\t\tonFocus={ onSelect }\n\t\t\tonBlur={ onUnselect }\n\t\t\tlabel={ placeholder }\n\t\t\tclassName={ className }\n\t\t\tplaceholder={ decodedPlaceholder }\n\t\t\thideLabelFromVision={ true }\n\t\t\tautoComplete=\"off\"\n\t\t\tdir=\"auto\"\n\t\t\trows={ 1 }\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t);\n}\n\nexport default forwardRef( PostTitleRaw );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,aAAA,GAAAV,sBAAA,CAAAC,OAAA;AApBA;AACA;AACA;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AAC,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAA4C,eAAe;IACfjB,GAAG,EAAGC,QAAU;IAChBG,KAAK,EAAGR,KAAO;IACfO,QAAQ,EAAGA,QAAU;IACrBe,OAAO,EAAGX,QAAU;IACpBY,MAAM,EAAGX,UAAY;IACrBY,KAAK,EAAGnC,WAAa;IACrBwB,SAAS,EAAGA,SAAW;IACvBxB,WAAW,EAAG2B,kBAAoB;IAClCS,mBAAmB,EAAG,IAAM;IAC5BC,YAAY,EAAC,KAAK;IAClBC,GAAG,EAAC,MAAM;IACVC,IAAI,EAAG,CAAG;IACVC,uBAAuB;EAAA,CACvB,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEc,IAAAC,mBAAU,EAAE7C,YAAa,CAAC;AAAA8C,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = usePostTitleFocus;
7
+ var _element = require("@wordpress/element");
8
+ var _data = require("@wordpress/data");
9
+ var _store = require("../../store");
10
+ /**
11
+ * WordPress dependencies
12
+ */
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+
18
+ function usePostTitleFocus(forwardedRef) {
19
+ const ref = (0, _element.useRef)();
20
+ const {
21
+ isCleanNewPost
22
+ } = (0, _data.useSelect)(select => {
23
+ const {
24
+ isCleanNewPost: _isCleanNewPost
25
+ } = select(_store.store);
26
+ return {
27
+ isCleanNewPost: _isCleanNewPost()
28
+ };
29
+ }, []);
30
+ (0, _element.useImperativeHandle)(forwardedRef, () => ({
31
+ focus: () => {
32
+ ref?.current?.focus();
33
+ }
34
+ }));
35
+ (0, _element.useEffect)(() => {
36
+ if (!ref.current) {
37
+ return;
38
+ }
39
+ const {
40
+ defaultView
41
+ } = ref.current.ownerDocument;
42
+ const {
43
+ name,
44
+ parent
45
+ } = defaultView;
46
+ const ownerDocument = name === 'editor-canvas' ? parent.document : defaultView.document;
47
+ const {
48
+ activeElement,
49
+ body
50
+ } = ownerDocument;
51
+
52
+ // Only autofocus the title when the post is entirely empty. This should
53
+ // only happen for a new post, which means we focus the title on new
54
+ // post so the author can start typing right away, without needing to
55
+ // click anything.
56
+ if (isCleanNewPost && (!activeElement || body === activeElement)) {
57
+ ref.current.focus();
58
+ }
59
+ }, [isCleanNewPost]);
60
+ return {
61
+ ref
62
+ };
63
+ }
64
+ //# sourceMappingURL=use-post-title-focus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_data","_store","usePostTitleFocus","forwardedRef","ref","useRef","isCleanNewPost","useSelect","select","_isCleanNewPost","editorStore","useImperativeHandle","focus","current","useEffect","defaultView","ownerDocument","name","parent","document","activeElement","body"],"sources":["@wordpress/editor/src/components/post-title/use-post-title-focus.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useImperativeHandle, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function usePostTitleFocus( forwardedRef ) {\n\tconst ref = useRef();\n\n\tconst { isCleanNewPost } = useSelect( ( select ) => {\n\t\tconst { isCleanNewPost: _isCleanNewPost } = select( editorStore );\n\n\t\treturn {\n\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseImperativeHandle( forwardedRef, () => ( {\n\t\tfocus: () => {\n\t\t\tref?.current?.focus();\n\t\t},\n\t} ) );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = ref.current.ownerDocument;\n\t\tconst { name, parent } = defaultView;\n\t\tconst ownerDocument =\n\t\t\tname === 'editor-canvas' ? parent.document : defaultView.document;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\treturn { ref };\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASG,iBAAiBA,CAAEC,YAAY,EAAG;EACzD,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EAEpB,MAAM;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACnD,MAAM;MAAEF,cAAc,EAAEG;IAAgB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IAEjE,OAAO;MACNJ,cAAc,EAAEG,eAAe,CAAC;IACjC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAAE,4BAAmB,EAAER,YAAY,EAAE,OAAQ;IAC1CS,KAAK,EAAEA,CAAA,KAAM;MACZR,GAAG,EAAES,OAAO,EAAED,KAAK,CAAC,CAAC;IACtB;EACD,CAAC,CAAG,CAAC;EAEL,IAAAE,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEV,GAAG,CAACS,OAAO,EAAG;MACpB;IACD;IAEA,MAAM;MAAEE;IAAY,CAAC,GAAGX,GAAG,CAACS,OAAO,CAACG,aAAa;IACjD,MAAM;MAAEC,IAAI;MAAEC;IAAO,CAAC,GAAGH,WAAW;IACpC,MAAMC,aAAa,GAClBC,IAAI,KAAK,eAAe,GAAGC,MAAM,CAACC,QAAQ,GAAGJ,WAAW,CAACI,QAAQ;IAClE,MAAM;MAAEC,aAAa;MAAEC;IAAK,CAAC,GAAGL,aAAa;;IAE7C;IACA;IACA;IACA;IACA,IAAKV,cAAc,KAAM,CAAEc,aAAa,IAAIC,IAAI,KAAKD,aAAa,CAAE,EAAG;MACtEhB,GAAG,CAACS,OAAO,CAACD,KAAK,CAAC,CAAC;IACpB;EACD,CAAC,EAAE,CAAEN,cAAc,CAAG,CAAC;EAEvB,OAAO;IAAEF;EAAI,CAAC;AACf"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = usePostTitle;
7
+ var _data = require("@wordpress/data");
8
+ var _store = require("../../store");
9
+ /**
10
+ * WordPress dependencies
11
+ */
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+
17
+ function usePostTitle() {
18
+ const {
19
+ editPost
20
+ } = (0, _data.useDispatch)(_store.store);
21
+ const {
22
+ title
23
+ } = (0, _data.useSelect)(select => {
24
+ const {
25
+ getEditedPostAttribute
26
+ } = select(_store.store);
27
+ return {
28
+ title: getEditedPostAttribute('title')
29
+ };
30
+ }, []);
31
+ function updateTitle(newTitle) {
32
+ editPost({
33
+ title: newTitle
34
+ });
35
+ }
36
+ return {
37
+ title,
38
+ setTitle: updateTitle
39
+ };
40
+ }
41
+ //# sourceMappingURL=use-post-title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_data","require","_store","usePostTitle","editPost","useDispatch","editorStore","title","useSelect","select","getEditedPostAttribute","updateTitle","newTitle","setTitle"],"sources":["@wordpress/editor/src/components/post-title/use-post-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function usePostTitle() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { title } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t};\n\t}, [] );\n\n\tfunction updateTitle( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\treturn { title, setTitle: updateTitle };\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAPA;AACA;AACA;;AAEA;AACA;AACA;;AAGe,SAASE,YAAYA,CAAA,EAAG;EACtC,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC/C,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC1C,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEH,YAAY,CAAC;IAExD,OAAO;MACNC,KAAK,EAAEG,sBAAsB,CAAE,OAAQ;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,SAASC,WAAWA,CAAEC,QAAQ,EAAG;IAChCR,QAAQ,CAAE;MAAEG,KAAK,EAAEK;IAAS,CAAE,CAAC;EAChC;EAEA,OAAO;IAAEL,KAAK;IAAEM,QAAQ,EAAEF;EAAY,CAAC;AACxC"}
@@ -12,6 +12,7 @@ var _i18n = require("@wordpress/i18n");
12
12
  var _check = _interopRequireDefault(require("./check"));
13
13
  var _index = _interopRequireDefault(require("./index"));
14
14
  var _label = require("./label");
15
+ var _postPanelRow = _interopRequireDefault(require("../post-panel-row"));
15
16
  /**
16
17
  * WordPress dependencies
17
18
  */
@@ -29,10 +30,10 @@ function PostURLPanel() {
29
30
  anchor: popoverAnchor,
30
31
  placement: 'bottom-end'
31
32
  }), [popoverAnchor]);
32
- return (0, _react.createElement)(_check.default, null, (0, _react.createElement)(_components.__experimentalHStack, {
33
- className: "editor-post-url__panel",
33
+ return (0, _react.createElement)(_check.default, null, (0, _react.createElement)(_postPanelRow.default, {
34
+ label: (0, _i18n.__)('URL'),
34
35
  ref: setPopoverAnchor
35
- }, (0, _react.createElement)("span", null, (0, _i18n.__)('URL')), (0, _react.createElement)(_components.Dropdown, {
36
+ }, (0, _react.createElement)(_components.Dropdown, {
36
37
  popoverProps: popoverProps,
37
38
  className: "editor-post-url__panel-dropdown",
38
39
  contentClassName: "editor-post-url__panel-dialog",
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_components","_i18n","_check","_interopRequireDefault","_index","_label","PostURLPanel","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","_react","createElement","default","__experimentalHStack","className","ref","__","Dropdown","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","label","usePostURLLabel","Button","variant","sprintf"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport {\n\t__experimentalHStack as HStack,\n\tDropdown,\n\tButton,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport { usePostURLLabel } from './label';\n\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<HStack className=\"editor-post-url__panel\" ref={ setPopoverAnchor }>\n\t\t\t\t<span>{ __( 'URL' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst label = usePostURLLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post URL.\n\t\t\taria-label={ sprintf( __( 'Change URL: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAhBA;AACA;AACA;;AASA;AACA;AACA;;AAKe,SAASO,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,IAAK,CAAC;EAC5D;EACA,MAAMC,YAAY,GAAG,IAAAC,gBAAO,EAC3B,OAAQ;IAAEC,MAAM,EAAEL,aAAa;IAAEM,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEN,aAAa,CAChB,CAAC;EAED,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACb,MAAA,CAAAc,OAAY,QACZ,IAAAF,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAiB,oBAAM;IAACC,SAAS,EAAC,wBAAwB;IAACC,GAAG,EAAGX;EAAkB,GAClE,IAAAM,MAAA,CAAAC,aAAA,gBAAQ,IAAAK,QAAE,EAAE,KAAM,CAAS,CAAC,EAC5B,IAAAN,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAqB,QAAQ;IACRX,YAAY,EAAGA,YAAc;IAC7BQ,SAAS,EAAC,iCAAiC;IAC3CI,gBAAgB,EAAC,+BAA+B;IAChDC,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpC,IAAAZ,MAAA,CAAAC,aAAA,EAACY,aAAa;MAACF,MAAM,EAAGA,MAAQ;MAACG,OAAO,EAAGF;IAAU,CAAE,CACrD;IACHG,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5B,IAAAhB,MAAA,CAAAC,aAAA,EAACX,MAAA,CAAAY,OAAO;MAACc,OAAO,EAAGA;IAAS,CAAE;EAC5B,CACH,CACM,CACK,CAAC;AAEjB;AAEA,SAASH,aAAaA,CAAE;EAAEF,MAAM;EAAEG;AAAQ,CAAC,EAAG;EAC7C,MAAMG,KAAK,GAAG,IAAAC,sBAAe,EAAC,CAAC;EAC/B,OACC,IAAAlB,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAiC,MAAM;IACNf,SAAS,EAAC,+BAA+B;IACzCgB,OAAO,EAAC,UAAU;IAClB,iBAAgBT;IAChB;IAAA;IACA,cAAa,IAAAU,aAAO,EAAE,IAAAf,QAAE,EAAE,gBAAiB,CAAC,EAAEW,KAAM,CAAG;IACvDH,OAAO,EAAGA;EAAS,GAEjBG,KACK,CAAC;AAEX"}
1
+ {"version":3,"names":["_element","require","_components","_i18n","_check","_interopRequireDefault","_index","_label","_postPanelRow","PostURLPanel","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","_react","createElement","default","label","__","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","usePostURLLabel","Button","variant","sprintf"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport { usePostURLLabel } from './label';\nimport PostPanelRow from '../post-panel-row';\n\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ __( 'URL' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst label = usePostURLLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post URL.\n\t\t\taria-label={ sprintf( __( 'Change URL: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OA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