@wordpress/editor 12.20.0 → 13.0.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.
Files changed (132) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/components/document-outline/check.js +1 -7
  3. package/build/components/document-outline/check.js.map +1 -1
  4. package/build/components/editor-notices/index.js +12 -12
  5. package/build/components/editor-notices/index.js.map +1 -1
  6. package/build/components/editor-snackbars/index.js +5 -8
  7. package/build/components/editor-snackbars/index.js.map +1 -1
  8. package/build/components/entities-saved-states/entity-record-item.js +1 -0
  9. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  10. package/build/components/page-attributes/parent.js +2 -1
  11. package/build/components/page-attributes/parent.js.map +1 -1
  12. package/build/components/post-author/combobox.js +1 -0
  13. package/build/components/post-author/combobox.js.map +1 -1
  14. package/build/components/post-comments/index.js +1 -0
  15. package/build/components/post-comments/index.js.map +1 -1
  16. package/build/components/post-format/index.js +1 -7
  17. package/build/components/post-format/index.js.map +1 -1
  18. package/build/components/post-pending-status/index.js +1 -0
  19. package/build/components/post-pending-status/index.js.map +1 -1
  20. package/build/components/post-pingbacks/index.js +1 -0
  21. package/build/components/post-pingbacks/index.js.map +1 -1
  22. package/build/components/post-publish-button/index.js +10 -1
  23. package/build/components/post-publish-button/index.js.map +1 -1
  24. package/build/components/post-publish-panel/index.js +1 -0
  25. package/build/components/post-publish-panel/index.js.map +1 -1
  26. package/build/components/post-publish-panel/maybe-category-panel.js +10 -5
  27. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  28. package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
  29. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  30. package/build/components/post-saved-state/index.js +19 -5
  31. package/build/components/post-saved-state/index.js.map +1 -1
  32. package/build/components/post-sticky/index.js +1 -0
  33. package/build/components/post-sticky/index.js.map +1 -1
  34. package/build/components/post-taxonomies/flat-term-selector.js +2 -2
  35. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  36. package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -1
  37. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  38. package/build/components/post-taxonomies/index.js +2 -8
  39. package/build/components/post-taxonomies/index.js.map +1 -1
  40. package/build/components/post-title/index.js +4 -2
  41. package/build/components/post-title/index.js.map +1 -1
  42. package/build/components/post-title/index.native.js +2 -4
  43. package/build/components/post-title/index.native.js.map +1 -1
  44. package/build/components/post-url/index.js +6 -2
  45. package/build/components/post-url/index.js.map +1 -1
  46. package/build/components/provider/index.native.js.map +1 -1
  47. package/build/components/provider/use-block-editor-settings.js +10 -9
  48. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  49. package/build/components/provider/use-block-editor-settings.native.js +3 -1
  50. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  51. package/build-module/components/document-outline/check.js +1 -6
  52. package/build-module/components/document-outline/check.js.map +1 -1
  53. package/build-module/components/editor-notices/index.js +12 -11
  54. package/build-module/components/editor-notices/index.js.map +1 -1
  55. package/build-module/components/editor-snackbars/index.js +5 -7
  56. package/build-module/components/editor-snackbars/index.js.map +1 -1
  57. package/build-module/components/entities-saved-states/entity-record-item.js +1 -0
  58. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  59. package/build-module/components/page-attributes/parent.js +3 -2
  60. package/build-module/components/page-attributes/parent.js.map +1 -1
  61. package/build-module/components/post-author/combobox.js +1 -0
  62. package/build-module/components/post-author/combobox.js.map +1 -1
  63. package/build-module/components/post-comments/index.js +1 -0
  64. package/build-module/components/post-comments/index.js.map +1 -1
  65. package/build-module/components/post-format/index.js +1 -6
  66. package/build-module/components/post-format/index.js.map +1 -1
  67. package/build-module/components/post-pending-status/index.js +1 -0
  68. package/build-module/components/post-pending-status/index.js.map +1 -1
  69. package/build-module/components/post-pingbacks/index.js +1 -0
  70. package/build-module/components/post-pingbacks/index.js.map +1 -1
  71. package/build-module/components/post-publish-button/index.js +10 -1
  72. package/build-module/components/post-publish-button/index.js.map +1 -1
  73. package/build-module/components/post-publish-panel/index.js +1 -0
  74. package/build-module/components/post-publish-panel/index.js.map +1 -1
  75. package/build-module/components/post-publish-panel/maybe-category-panel.js +10 -5
  76. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  77. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -2
  78. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  79. package/build-module/components/post-saved-state/index.js +19 -5
  80. package/build-module/components/post-saved-state/index.js.map +1 -1
  81. package/build-module/components/post-sticky/index.js +1 -0
  82. package/build-module/components/post-sticky/index.js.map +1 -1
  83. package/build-module/components/post-taxonomies/flat-term-selector.js +3 -3
  84. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  85. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  86. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  87. package/build-module/components/post-taxonomies/index.js +2 -7
  88. package/build-module/components/post-taxonomies/index.js.map +1 -1
  89. package/build-module/components/post-title/index.js +3 -2
  90. package/build-module/components/post-title/index.js.map +1 -1
  91. package/build-module/components/post-title/index.native.js +2 -3
  92. package/build-module/components/post-title/index.native.js.map +1 -1
  93. package/build-module/components/post-url/index.js +6 -2
  94. package/build-module/components/post-url/index.js.map +1 -1
  95. package/build-module/components/provider/index.native.js +2 -1
  96. package/build-module/components/provider/index.native.js.map +1 -1
  97. package/build-module/components/provider/use-block-editor-settings.js +10 -8
  98. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  99. package/build-module/components/provider/use-block-editor-settings.native.js +2 -1
  100. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  101. package/build-style/style-rtl.css +17 -3
  102. package/build-style/style.css +17 -3
  103. package/package.json +31 -30
  104. package/src/components/document-outline/check.js +1 -7
  105. package/src/components/editor-help/test/index.native.js +2 -2
  106. package/src/components/editor-notices/index.js +6 -13
  107. package/src/components/editor-snackbars/index.js +3 -8
  108. package/src/components/entities-saved-states/entity-record-item.js +1 -0
  109. package/src/components/page-attributes/parent.js +3 -3
  110. package/src/components/post-author/combobox.js +1 -0
  111. package/src/components/post-comments/index.js +1 -0
  112. package/src/components/post-format/index.js +1 -7
  113. package/src/components/post-pending-status/index.js +1 -0
  114. package/src/components/post-pingbacks/index.js +1 -0
  115. package/src/components/post-publish-button/index.js +11 -1
  116. package/src/components/post-publish-panel/index.js +1 -0
  117. package/src/components/post-publish-panel/maybe-category-panel.js +9 -12
  118. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -2
  119. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +11 -15
  120. package/src/components/post-saved-state/index.js +15 -3
  121. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
  122. package/src/components/post-sticky/index.js +1 -0
  123. package/src/components/post-taxonomies/flat-term-selector.js +3 -3
  124. package/src/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  125. package/src/components/post-taxonomies/index.js +2 -8
  126. package/src/components/post-taxonomies/test/index.js +1 -1
  127. package/src/components/post-title/index.js +6 -2
  128. package/src/components/post-title/index.native.js +2 -3
  129. package/src/components/post-url/index.js +6 -2
  130. package/src/components/provider/index.native.js +1 -0
  131. package/src/components/provider/use-block-editor-settings.js +56 -50
  132. package/src/components/provider/use-block-editor-settings.native.js +3 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.js"],"names":["classnames","__","forwardRef","useEffect","useImperativeHandle","useRef","useState","decodeEntities","ENTER","useSelect","useDispatch","pasteHandler","store","blockEditorStore","__unstableUseRichText","useRichText","create","toHTMLString","insert","useMergeRefs","PostTypeSupportCheck","editorStore","REGEXP_NEWLINES","PostTitle","_","forwardedRef","ref","isSelected","setIsSelected","editPost","insertDefaultBlock","clearSelectedBlock","insertBlocks","isCleanNewPost","title","placeholder","hasFixedToolbar","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","_hasFixedToolbar","focus","current","ownerDocument","activeElement","body","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","name","attributes","slice","newValue","start","end","className","decodedPlaceholder","richTextRef","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","preserveWhiteSpace"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,UADD,EAECC,SAFD,EAGCC,mBAHD,EAICC,MAJD,EAKCC,QALD,QAMO,oBANP;AAOA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAT,QAAsB,qBAAtB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SACCC,qBAAqB,IAAIC,WAD1B,EAECC,MAFD,EAGCC,YAHD,EAICC,MAJD,QAKO,sBALP;AAMA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,4BAAjC;AACA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,UAAxB;;AAEA,SAASC,SAAT,CAAoBC,CAApB,EAAuBC,YAAvB,EAAsC;AACrC,QAAMC,GAAG,GAAGrB,MAAM,EAAlB;AACA,QAAM,CAAEsB,UAAF,EAAcC,aAAd,IAAgCtB,QAAQ,CAAE,KAAF,CAA9C;AACA,QAAM;AAAEuB,IAAAA;AAAF,MAAenB,WAAW,CAAEW,WAAF,CAAhC;AACA,QAAM;AAAES,IAAAA,kBAAF;AAAsBC,IAA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,EAAE,IAlBe;AAmBzCC,IAAAA,kBAAkB,EAAE;AAnBqB,GAAF,CAAxC;AAsBA;;AACA,SACC,cAAC,oBAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACC;AACC,IAAA,GAAG,EAAG5E,YAAY,CAAE,CAAEoE,WAAF,EAAe7D,GAAf,CAAF,CADnB;AAEC,IAAA,eAAe,MAFhB;AAGC,IAAA,SAAS,EAAG2D,SAHb;AAIC,kBAAaC,kBAJd;AAKC,IAAA,IAAI,EAAC,SALN;AAMC,sBAAe,MANhB;AAOC,IAAA,OAAO,EAAG9B,QAPX;AAQC,IAAA,MAAM,EAAGC,UARV;AASC,IAAA,SAAS,EAAGI,SATb;AAUC,IAAA,UAAU,EAAGJ,UAVd;AAWC,IAAA,OAAO,EAAGQ;AAXX,IADD,CADD;AAiBA;AACA;;AAED,eAAe/D,UAAU,CAAEqB,SAAF,CAAzB","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';\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 { ownerDocument } = ref.current;\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( 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( value, create( { html: content } ) );\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\tpreserveWhiteSpace: 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"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.js"],"names":["classnames","__","forwardRef","useEffect","useImperativeHandle","useRef","useState","decodeEntities","ENTER","useSelect","useDispatch","pasteHandler","store","blockEditorStore","__unstableUseRichText","useRichText","create","toHTMLString","insert","useMergeRefs","__unstableStripHTML","stripHTML","PostTypeSupportCheck","editorStore","REGEXP_NEWLINES","PostTitle","_","forwardedRef","ref","isSelected","setIsSelected","editPost","insertDefaultBlock","clearSelectedBlock","insertBlocks","isCleanNewPost","title","placeholder","hasFixedToolbar","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","_hasFixedToolbar","focus","current","ownerDocument","activeElement","body","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","name","attributes","slice","newValue","start","end","className","decodedPlaceholder","richTextRef","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","preserveWhiteSpace"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,UADD,EAECC,SAFD,EAGCC,mBAHD,EAICC,MAJD,EAKCC,QALD,QAMO,oBANP;AAOA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAT,QAAsB,qBAAtB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,KAAK,IAA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Content":["/**\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 { ownerDocument } = ref.current;\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\tpreserveWhiteSpace: 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"]}
@@ -4,7 +4,6 @@ import { createElement } from "@wordpress/element";
4
4
  * External dependencies
5
5
  */
6
6
  import { View } from 'react-native';
7
- import { isEmpty } from 'lodash';
8
7
  /**
9
8
  * WordPress dependencies
10
9
  */
@@ -82,14 +81,14 @@ class PostTitle extends Component {
82
81
 
83
82
  getTitle(title, postType) {
84
83
  if ('page' === postType) {
85
- return isEmpty(title) ?
84
+ return !title ?
86
85
  /* translators: accessibility text. empty page title. */
87
86
  __('Page title. Empty') : sprintf(
88
87
  /* translators: accessibility text. %s: text content of the page title. */
89
88
  __('Page title. %s'), title);
90
89
  }
91
90
 
92
- return isEmpty(title) ?
91
+ return !title ?
93
92
  /* translators: accessibility text. empty post title. */
94
93
  __('Post title. Empty') : sprintf(
95
94
  /* translators: accessibility text. %s: text content of the post title. */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.native.js"],"names":["View","isEmpty","Component","__experimentalRichText","RichText","create","insert","decodeEntities","withDispatch","withSelect","withFocusOutside","withInstanceId","compose","__","sprintf","pasteHandler","store","blockEditorStore","editorStore","styles","PostTitle","constructor","props","setRef","bind","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","onPaste","value","onChange","plainText","content","mode","tagName","valueToInsert","html","richText","getTitle","title","postType","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","borderColor","titleStyles","text","color","placeholderColor","titleContainer","dimmed","onBlur","onUpdate","onEnterPress","select","isPostTitleSelected","getEditedPostAttribute","getSelectedBlockClientId","getBlockRootClientId","getSettings","selectedId","selectionIsNested","__experimentalGlobalStylesBaseStyles","dispatch","undo","redo","togglePostTitleSelection","clearSelectedBlock","insertDefaultBlock","undefined","onUndo","onRedo"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AACA,SAASC,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,sBAAsB,IAAIC,QAD3B,EAECC,MAFD,EAGCC,MAHD,QAIO,sBAJP;AAKA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASC,cAAT,EAAyBC,OAAzB,QAAwC,oBAAxC;AACA,SAASC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Ab,EAAwB,CAAxB,CAAlB;AACA,KAHK;;AAINC,IAAAA,MAAM,EAAEN,IAJF;AAKNO,IAAAA,MAAM,EAAEN,IALF;;AAMN3C,IAAAA,QAAQ,GAAG;AACV4C,MAAAA,wBAAwB,CAAE,IAAF,CAAxB;AACAC,MAAAA,kBAAkB;AAClB,KATK;;AAUNlD,IAAAA,UAAU,GAAG;AACZiD,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;AACA;;AAZK,GAAP;AAcA,CArBW,CApBS,EA0CrBrE,cA1CqB,EA2CrBD,gBA3CqB,CAAP,CA4CZU,SA5CY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport {\n\t__experimentalRichText as RichText,\n\tcreate,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { withFocusOutside } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nclass PostTitle extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.setRef = this.setRef.bind( this );\n\t}\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Unselect if any other block is selected and blur the RichText.\n\t\tif (\n\t\t\tthis.props.isSelected &&\n\t\t\t! prevProps.isAnyBlockSelected &&\n\t\t\tthis.props.isAnyBlockSelected\n\t\t) {\n\t\t\tif ( this.richTextRef ) {\n\t\t\t\tthis.richTextRef.blur();\n\t\t\t}\n\t\t\tthis.props.onUnselect();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.innerRef ) {\n\t\t\tthis.props.innerRef( this );\n\t\t}\n\t}\n\n\thandleFocusOutside() {\n\t\tthis.props.onUnselect();\n\t}\n\n\tfocus() {\n\t\tthis.props.onSelect();\n\t}\n\n\tonPaste( { value, onChange, plainText } ) {\n\t\tconst content = pasteHandler( {\n\t\t\tplainText,\n\t\t\tmode: 'INLINE',\n\t\t\ttagName: 'p',\n\t\t} );\n\n\t\tif ( typeof content === 'string' ) {\n\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t}\n\t}\n\n\tsetRef( richText ) {\n\t\tthis.richTextRef = richText;\n\t}\n\n\tgetTitle( title, postType ) {\n\t\tif ( 'page' === postType ) {\n\t\t\treturn isEmpty( title )\n\t\t\t\t? /* translators: accessibility text. empty page title. */\n\t\t\t\t __( 'Page title. Empty' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: text content of the page title. */\n\t\t\t\t\t\t__( 'Page title. %s' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t );\n\t\t}\n\n\t\treturn isEmpty( title )\n\t\t\t? /* translators: accessibility text. empty post title. */\n\t\t\t __( 'Post title. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: text content of the post title. */\n\t\t\t\t\t__( 'Post title. %s' ),\n\t\t\t\t\ttitle\n\t\t\t );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tstyle,\n\t\t\ttitle,\n\t\t\tfocusedBorderColor,\n\t\t\tborderStyle,\n\t\t\tisDimmed,\n\t\t\tpostType,\n\t\t\tglobalStyles,\n\t\t} = this.props;\n\n\t\tconst decodedPlaceholder = decodeEntities( placeholder );\n\t\tconst borderColor = this.props.isSelected\n\t\t\t? focusedBorderColor\n\t\t\t: 'transparent';\n\t\tconst titleStyles = {\n\t\t\t...style,\n\t\t\t...( globalStyles?.text && {\n\t\t\t\tcolor: globalStyles.text,\n\t\t\t\tplaceholderColor: globalStyles.text,\n\t\t\t} ),\n\t\t};\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\tstyle={ [\n\t\t\t\t\tstyles.titleContainer,\n\t\t\t\t\tborderStyle,\n\t\t\t\t\t{ borderColor },\n\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t] }\n\t\t\t\taccessible={ ! this.props.isSelected }\n\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\taccessibilityHint={ __( 'Updates the title.' ) }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tsetRef={ this.setRef }\n\t\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\t\ttagName={ 'p' }\n\t\t\t\t\ttagsToEliminate={ [ 'strong' ] }\n\t\t\t\t\tunstableOnFocus={ this.props.onSelect }\n\t\t\t\t\tonBlur={ this.props.onBlur } // Always assign onBlur as a props.\n\t\t\t\t\tmultiline={ false }\n\t\t\t\t\tstyle={ titleStyles }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tfontSize={ 24 }\n\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\tfontWeight={ 'bold' }\n\t\t\t\t\tdeleteEnter={ true }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tthis.props.onUpdate( value );\n\t\t\t\t\t} }\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tplaceholder={ decodedPlaceholder }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonSelectionChange={ () => {} }\n\t\t\t\t\tonEnter={ this.props.onEnterPress }\n\t\t\t\t\tdisableEditingMenu={ true }\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t></RichText>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isPostTitleSelected, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\t\tconst { getSelectedBlockClientId, getBlockRootClientId, getSettings } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst selectedId = getSelectedBlockClientId();\n\t\tconst selectionIsNested = !! getBlockRootClientId( selectedId );\n\t\tconst globalStyles =\n\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles?.color;\n\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisAnyBlockSelected: !! selectedId,\n\t\t\tisSelected: isPostTitleSelected(),\n\t\t\tisDimmed: selectionIsNested,\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { undo, redo, togglePostTitleSelection } =\n\t\t\tdispatch( editorStore );\n\n\t\tconst { clearSelectedBlock, insertDefaultBlock } =\n\t\t\tdispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tonEnterPress() {\n\t\t\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t\t\t},\n\t\t\tonUndo: undo,\n\t\t\tonRedo: redo,\n\t\t\tonSelect() {\n\t\t\t\ttogglePostTitleSelection( true );\n\t\t\t\tclearSelectedBlock();\n\t\t\t},\n\t\t\tonUnselect() {\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n\twithFocusOutside\n)( PostTitle );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.native.js"],"names":["View","Component","__experimentalRichText","RichText","create","insert","decodeEntities","withDispatch","withSelect","withFocusOutside","withInstanceId","compose","__","sprintf","pasteHandler","store","blockEditorStore","editorStore","styles","PostTitle","constructor","props","setRef","bind","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","onPaste","value","onChange","plainText","content","mode","tagName","valueToInsert","html","richText","getTitle","title","postType","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","borderColor","titleStyles","text","color","placeholderColor","titleContainer","dimmed","onBlur","onUpdate","onEnterPress","select","isPostTitleSelected","getEditedPostAttribute","getSelectedBlockClientId","getBlockRootClientId","getSettings","selectedId","selectionIsNested","__experimentalGlobalStylesBaseStyles","dispatch","undo","redo","togglePostTitleSelection","clearSelectedBlock","insertDefaultBlock","undefined","onUndo","onRedo"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,sBAAsB,IAAIC,QAD3B,EAECC,MAFD,EAGCC,MAHD,QAIO,sBAJP;AAKA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASC,cAAT,EAAyBC,OAAzB,QAAwC,oBAAxC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;;AAEA,MAAMC,SAAN,SAAwBlB,SAAxB,CAAkC;AACjCmB,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AAEA,SAAKC,MAAL,GAAc,KAAKA,MAAL,CAAYC,IAAZ,CAAkB,IAAlB,CAAd;AACA;;AACDC,EAAAA,kBAAkB,CAAEC,SAAF,EAAc;AAC/B;AACA,QACC,KAAKJ,KAAL,CAAWK,UAAX,IACA,CAAED,SAAS,CAACE,kBADZ,IAEA,KAAKN,KAAL,CAAWM,kBAHZ,EAIE;AACD,UAAK,KAAKC,WAAV,EAAwB;AACvB,aAAKA,WAAL,CAAiBC,IAAjB;AACA;;AACD,WAAKR,KAAL,CAAWS,UAAX;AACA;AACD;;AAEDC,EAAAA,iBAAiB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MAAF,CAD1B;AAEN1C,IAAAA,kBAAkB,EAAE,CAAC,CAAE8C,UAFjB;AAGN/C,IAAAA,UAAU,EAAE0C,mBAAmB,EAHzB;AAINd,IAAAA,QAAQ,EAAEoB,iBAJJ;AAKNnB,IAAAA;AALM,GAAP;AAOA,CAlBS,CADW,EAoBrBhD,YAAY,CAAIqE,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcC,IAAAA;AAAd,MACLH,QAAQ,CAAE3D,WAAF,CADT;AAGA,QAAM;AAAE+D,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MACLL,QAAQ,CAAE5D,gBAAF,CADT;AAGA,SAAO;AACNkD,IAAAA,YAAY,GAAG;AACde,MAAAA,kBAAkB,CAAEC,SAAF,EAAaA,SAAb,EAAwB,CAAxB,CAAlB;AACA,KAHK;;AAINC,IAAAA,MAAM,EAAEN,IAJF;AAKNO,IAAAA,MAAM,EAAEN,IALF;;AAMN3C,IAAAA,QAAQ,GAAG;AACV4C,MAAAA,wBAAwB,CAAE,IAAF,CAAxB;AACAC,MAAAA,kBAAkB;AAClB,KATK;;AAUNlD,IAAAA,UAAU,GAAG;AACZiD,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;AACA;;AAZK,GAAP;AAcA,CArBW,CApBS,EA0CrBrE,cA1CqB,EA2CrBD,gBA3CqB,CAAP,CA4CZU,SA5CY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport {\n\t__experimentalRichText as RichText,\n\tcreate,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { withFocusOutside } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nclass PostTitle extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.setRef = this.setRef.bind( this );\n\t}\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Unselect if any other block is selected and blur the RichText.\n\t\tif (\n\t\t\tthis.props.isSelected &&\n\t\t\t! prevProps.isAnyBlockSelected &&\n\t\t\tthis.props.isAnyBlockSelected\n\t\t) {\n\t\t\tif ( this.richTextRef ) {\n\t\t\t\tthis.richTextRef.blur();\n\t\t\t}\n\t\t\tthis.props.onUnselect();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.innerRef ) {\n\t\t\tthis.props.innerRef( this );\n\t\t}\n\t}\n\n\thandleFocusOutside() {\n\t\tthis.props.onUnselect();\n\t}\n\n\tfocus() {\n\t\tthis.props.onSelect();\n\t}\n\n\tonPaste( { value, onChange, plainText } ) {\n\t\tconst content = pasteHandler( {\n\t\t\tplainText,\n\t\t\tmode: 'INLINE',\n\t\t\ttagName: 'p',\n\t\t} );\n\n\t\tif ( typeof content === 'string' ) {\n\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t}\n\t}\n\n\tsetRef( richText ) {\n\t\tthis.richTextRef = richText;\n\t}\n\n\tgetTitle( title, postType ) {\n\t\tif ( 'page' === postType ) {\n\t\t\treturn ! title\n\t\t\t\t? /* translators: accessibility text. empty page title. */\n\t\t\t\t __( 'Page title. Empty' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: text content of the page title. */\n\t\t\t\t\t\t__( 'Page title. %s' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t );\n\t\t}\n\n\t\treturn ! title\n\t\t\t? /* translators: accessibility text. empty post title. */\n\t\t\t __( 'Post title. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: text content of the post title. */\n\t\t\t\t\t__( 'Post title. %s' ),\n\t\t\t\t\ttitle\n\t\t\t );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tstyle,\n\t\t\ttitle,\n\t\t\tfocusedBorderColor,\n\t\t\tborderStyle,\n\t\t\tisDimmed,\n\t\t\tpostType,\n\t\t\tglobalStyles,\n\t\t} = this.props;\n\n\t\tconst decodedPlaceholder = decodeEntities( placeholder );\n\t\tconst borderColor = this.props.isSelected\n\t\t\t? focusedBorderColor\n\t\t\t: 'transparent';\n\t\tconst titleStyles = {\n\t\t\t...style,\n\t\t\t...( globalStyles?.text && {\n\t\t\t\tcolor: globalStyles.text,\n\t\t\t\tplaceholderColor: globalStyles.text,\n\t\t\t} ),\n\t\t};\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\tstyle={ [\n\t\t\t\t\tstyles.titleContainer,\n\t\t\t\t\tborderStyle,\n\t\t\t\t\t{ borderColor },\n\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t] }\n\t\t\t\taccessible={ ! this.props.isSelected }\n\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\taccessibilityHint={ __( 'Updates the title.' ) }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tsetRef={ this.setRef }\n\t\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\t\ttagName={ 'p' }\n\t\t\t\t\ttagsToEliminate={ [ 'strong' ] }\n\t\t\t\t\tunstableOnFocus={ this.props.onSelect }\n\t\t\t\t\tonBlur={ this.props.onBlur } // Always assign onBlur as a props.\n\t\t\t\t\tmultiline={ false }\n\t\t\t\t\tstyle={ titleStyles }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tfontSize={ 24 }\n\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\tfontWeight={ 'bold' }\n\t\t\t\t\tdeleteEnter={ true }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tthis.props.onUpdate( value );\n\t\t\t\t\t} }\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tplaceholder={ decodedPlaceholder }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonSelectionChange={ () => {} }\n\t\t\t\t\tonEnter={ this.props.onEnterPress }\n\t\t\t\t\tdisableEditingMenu={ true }\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t></RichText>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isPostTitleSelected, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\t\tconst { getSelectedBlockClientId, getBlockRootClientId, getSettings } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst selectedId = getSelectedBlockClientId();\n\t\tconst selectionIsNested = !! getBlockRootClientId( selectedId );\n\t\tconst globalStyles =\n\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles?.color;\n\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisAnyBlockSelected: !! selectedId,\n\t\t\tisSelected: isPostTitleSelected(),\n\t\t\tisDimmed: selectionIsNested,\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { undo, redo, togglePostTitleSelection } =\n\t\t\tdispatch( editorStore );\n\n\t\tconst { clearSelectedBlock, insertDefaultBlock } =\n\t\t\tdispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tonEnterPress() {\n\t\t\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t\t\t},\n\t\t\tonUndo: undo,\n\t\t\tonRedo: redo,\n\t\t\tonSelect() {\n\t\t\t\ttogglePostTitleSelection( true );\n\t\t\t\tclearSelectedBlock();\n\t\t\t},\n\t\t\tonUnselect() {\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n\twithFocusOutside\n)( PostTitle );\n"]}
@@ -27,14 +27,18 @@ export default function PostURL(_ref) {
27
27
  permalinkPrefix,
28
28
  permalinkSuffix
29
29
  } = useSelect(select => {
30
+ var _post$_links$wpActio, _post$_links;
31
+
32
+ const post = select(editorStore).getCurrentPost();
30
33
  const postTypeSlug = select(editorStore).getCurrentPostType();
31
34
  const postType = select(coreStore).getPostType(postTypeSlug);
32
35
  const permalinkParts = select(editorStore).getPermalinkParts();
36
+ const hasPublishAction = (_post$_links$wpActio = post === null || post === void 0 ? void 0 : (_post$_links = post._links) === null || _post$_links === void 0 ? void 0 : _post$_links['wp:action-publish']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false;
33
37
  return {
34
- isEditable: select(editorStore).isPermalinkEditable(),
38
+ isEditable: select(editorStore).isPermalinkEditable() && hasPublishAction,
35
39
  postSlug: safeDecodeURIComponent(select(editorStore).getEditedPostSlug()),
36
40
  viewPostLabel: postType === null || postType === void 0 ? void 0 : postType.labels.view_item,
37
- postLink: select(editorStore).getCurrentPost().link,
41
+ postLink: post.link,
38
42
  permalinkPrefix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.prefix,
39
43
  permalinkSuffix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.suffix
40
44
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-url/index.js"],"names":["useSelect","useDispatch","safeDecodeURIComponent","cleanForSlug","useState","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","__","TextControl","ExternalLink","store","coreStore","editorStore","PostURL","onClose","isEditable","postSlug","viewPostLabel","postLink","permalinkPrefix","permalinkSuffix","select","postTypeSlug","getCurrentPostType","postType","getPostType","permalinkParts","getPermalinkParts","isPermalinkEditable","getEditedPostSlug","labels","view_item","getCurrentPost","link","prefix","suffix","editPost","forceEmptyField","setForceEmptyField","newValue","slug","event","target","value"],"mappings":";;AAAA;AACA;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AA,QAAQ,CAAE;AACTI,QAAAA,IAAI,EAAErC,YAAY,CAAEsC,KAAK,CAACC,MAAN,CAAaC,KAAf;AADT,OAAF,CAAR;;AAGA,UAAKN,eAAL,EAAuB;AACtBC,QAAAA,kBAAkB,CAAE,KAAF,CAAlB;AACA;AACD;AAxCF,IAHF,EA8CGvB,UAAU,IACX;AAAI,IAAA,SAAS,EAAC;AAAd,KACGE,aADH,aACGA,aADH,cACGA,aADH,GACoBV,EAAE,CAAE,WAAF,CADtB,CA/CF,EAmDC,yBACC,cAAC,YAAD;AACC,IAAA,SAAS,EAAC,uBADX;AAEC,IAAA,IAAI,EAAGW,QAFR;AAGC,IAAA,MAAM,EAAC;AAHR,KAKGH,UAAU,GACX,8BACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGI,eADH,CADD,EAIC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGH,QADH,CAJD,EAOC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGI,eADH,CAPD,CADW,GAaXF,QAlBF,CADD,CAnDD,CADD;AA6EA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tviewPostLabel,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t} = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\treturn {\n\t\t\tisEditable: select( editorStore ).isPermalinkEditable(),\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: select( editorStore ).getCurrentPost().link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader title={ __( 'URL' ) } onClose={ onClose } />\n\t\t\t{ isEditable && (\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Permalink' ) }\n\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __( 'The last part of the URL.' ) }{ ' ' }\n\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/settings-sidebar/#permalink'\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\t{ __( 'Learn more.' ) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\tslug: cleanForSlug( event.target.value ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isEditable && (\n\t\t\t\t<h3 className=\"editor-post-url__link-label\">\n\t\t\t\t\t{ viewPostLabel ?? __( 'View post' ) }\n\t\t\t\t</h3>\n\t\t\t) }\n\t\t\t<p>\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\thref={ postLink }\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t>\n\t\t\t\t\t{ isEditable ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tpostLink\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-url/index.js"],"names":["useSelect","useDispatch","safeDecodeURIComponent","cleanForSlug","useState","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","__","TextControl","ExternalLink","store","coreStore","editorStore","PostURL","onClose","isEditable","postSlug","viewPostLabel","postLink","permalinkPrefix","permalinkSuffix","select","post","getCurrentPost","postTypeSlug","getCurrentPostType","postType","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","getEditedPostSlug","labels","view_item","link","prefix","suffix","editPost","forceEmptyField","setForceEmptyField","newValue","slug","event","target","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,sBAAT,EAAiCC,YAAjC,QAAqD,gBAArD;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,oCAAoC,IAAIC,sBAAjD,QAA+E,yBAA/E;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,YAAtB,QAA0C,uBAA1C;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,OAAT,OAAgC;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AAC9C,QAAM;AACLC,IAAAA,UADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,aAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,eALK;AAMLC,IAAAA;AANK,MAOFpB,SAAS,CAAIqB,MAAF,IAAc;AAAA;;AAC5B,UAAMC,IAAI,GAAGD,MAAM,CAAET,WAAF,CAAN,CAAsBW,cAAtB,EAAb;AACA,UAAMC,YAAY,GAAGH,MAAM,CAAET,WAAF,CAAN,CAAsBa,kBAAtB,EAArB;AACA,UAAMC,QAAQ,GAAGL,MAAM,CAAEV,SAAF,CAAN,CAAoBgB,WAApB,CAAiCH,YAAjC,CAAjB;AACA,UAAMI,cAAc,GAAGP,MAAM,CAAET,WAAF,CAAN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GADxC,EAEC,cAAC,YAAD;AACC,MAAA,IAAI,EAAGA,EAAE,CACR,mEADQ;AADV,OAKGA,EAAE,CAAE,aAAF,CALL,CAFD,CANF;AAiBC,IAAA,QAAQ,EAAKmC,QAAF,IAAgB;AAC1BH,MAAAA,QAAQ,CAAE;AAAEI,QAAAA,IAAI,EAAED;AAAR,OAAF,CAAR,CAD0B,CAE1B;AACA;AACA;AACA;;AACA,UAAK,CAAEA,QAAP,EAAkB;AACjB,YAAK,CAAEF,eAAP,EAAyB;AACxBC,UAAAA,kBAAkB,CAAE,IAAF,CAAlB;AACA;;AACD;AACA;;AACD,UAAKD,eAAL,EAAuB;AACtBC,QAAAA,kBAAkB,CAAE,KAAF,CAAlB;AACA;AACD,KAhCF;AAiCC,IAAA,MAAM,EAAKG,KAAF,IAAa;AACrBL,MAAAA,QAAQ,CAAE;AACTI,QAAAA,IAAI,EAAExC,YAAY,CAAEyC,KAAK,CAACC,MAAN,CAAaC,KAAf;AADT,OAAF,CAAR;;AAGA,UAAKN,eAAL,EAAuB;AACtBC,QAAAA,kBAAkB,CAAE,KAAF,CAAlB;AACA;AACD;AAxCF,IAHF,EA8CG1B,UAAU,IACX;AAAI,IAAA,SAAS,EAAC;AAAd,KACGE,aADH,aACGA,aADH,cACGA,aADH,GACoBV,EAAE,CAAE,WAAF,CADtB,CA/CF,EAmDC,yBACC,cAAC,YAAD;AACC,IAAA,SAAS,EAAC,uBADX;AAEC,IAAA,IAAI,EAAGW,QAFR;AAGC,IAAA,MAAM,EAAC;AAHR,KAKGH,UAAU,GACX,8BACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGI,eADH,CADD,EAIC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGH,QADH,CAJD,EAOC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGI,eADH,CAPD,CADW,GAaXF,QAlBF,CADD,CAnDD,CADD;AA6EA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tviewPostLabel,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t} = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tconst hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;\n\n\t\treturn {\n\t\t\tisEditable:\n\t\t\t\tselect( editorStore ).isPermalinkEditable() && hasPublishAction,\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: post.link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader title={ __( 'URL' ) } onClose={ onClose } />\n\t\t\t{ isEditable && (\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Permalink' ) }\n\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __( 'The last part of the URL.' ) }{ ' ' }\n\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/settings-sidebar/#permalink'\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\t{ __( 'Learn more.' ) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\tslug: cleanForSlug( event.target.value ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isEditable && (\n\t\t\t\t<h3 className=\"editor-post-url__link-label\">\n\t\t\t\t\t{ viewPostLabel ?? __( 'View post' ) }\n\t\t\t\t</h3>\n\t\t\t) }\n\t\t\t<p>\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\thref={ postLink }\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t>\n\t\t\t\t\t{ isEditable ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tpostLink\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"]}
@@ -46,7 +46,8 @@ const postTypeEntities = [{
46
46
  }));
47
47
  import { EditorHelpTopics, store as editorStore } from '@wordpress/editor';
48
48
  import { store as noticesStore } from '@wordpress/notices';
49
- import { store as coreStore } from '@wordpress/core-data';
49
+ import { store as coreStore } from '@wordpress/core-data'; // eslint-disable-next-line no-restricted-imports
50
+
50
51
  import { store as editPostStore } from '@wordpress/edit-post';
51
52
  /**
52
53
  * Internal dependencies
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["memize","SafeAreaProvider","RNReactNativeGutenbergBridge","requestBlockTypeImpressions","setBlockTypeImpressions","subscribeParentGetHtml","subscribeParentToggleHTMLMode","subscribeUpdateHtml","subscribeSetTitle","subscribeMediaAppend","subscribeReplaceBlock","subscribeUpdateEditorSettings","subscribeUpdateCapabilities","subscribeShowNotice","subscribeShowEditorHelp","Component","count","wordCount","parse","serialize","getUnregisteredTypeHandlerName","createBlock","withDispatch","withSelect","compose","applyFilters","store","blockEditorStore","getGlobalStyles","getColorsAndGradients","NEW_BLOCK_TYPES","postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","EditorHelpTopics","editorStore","noticesStore","coreStore","editPostStore","EditorProvider","NativeEditorProvider","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","hostAppNamespace","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","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","rawStyles","rawFeatures","defaultEditorColors","defaultEditorGradients","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","getEditorMode","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","colors","gradients","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","__unstableShouldCreateUndoLevel"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,MAAP,MAAmB,QAAnB;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AAEA;AACA;AACA;;AACA,OAAO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F,EAAS;AAClBkC,MAAAA,gBAAgB,CAAElC,IAAF,CAAhB;AACA,KAjBK;;AAkBNW,IAAAA;AAlBM,GAAP;AAoBA,CAhCW,CAnCW,CAAF,CAAP,CAoEV9F,oBApEU,CAAf","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, hostAppNamespace, updateSettings } =\n\t\t\tthis.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\thostAppNamespace,\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"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["memize","SafeAreaProvider","RNReactNativeGutenbergBridge","requestBlockTypeImpressions","setBlockTypeImpressions","subscribeParentGetHtml","subscribeParentToggleHTMLMode","subscribeUpdateHtml","subscribeSetTitle","subscribeMediaAppend","subscribeReplaceBlock","subscribeUpdateEditorSettings","subscribeUpdateCapabilities","subscribeShowNotice","subscribeShowEditorHelp","Component","count","wordCount","parse","serialize","getUnregisteredTypeHandlerName","createBlock","withDispatch","withSelect","compose","applyFilters","store","blockEditorStore","getGlobalStyles","getColorsAndGradients","NEW_BLOCK_TYPES","postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","EditorHelpTopics","editorStore","noticesStore","coreStore","editPostStore","EditorProvider","NativeEditorProvider","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","hostAppNamespace","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","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","rawStyles","rawFeatures","defaultEditorColors","defaultEditorGradients","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","getEditorMode","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","colors","gradients","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","__unstableShouldCreateUndoLevel"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,MAAP,MAAmB,QAAnB;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AAEA;AACA;AACA;;AACA,OAAOC,4BAAP,IACCC,2BADD,EAECC,uBAFD,EAGCC,sBAHD,EAICC,6BAJD,EAKCC,mBALD,EAMCC,iBAND,EAOCC,oBAPD,EAQCC,qBARD,EASCC,6BATD,EAUCC,2BAVD,EAWCC,mBAXD,EAYCC,uBAZD,QAaO,gCAbP;AAcA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SACCC,KADD,EAECC,SAFD,EAGCC,8BAHD,EAICC,WAJD,QAKO,mBALP;AAMA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,eAAT,EAA0BC,qBAA1B,QAAuD,uBAAvD;AACA,SAASC,eAAT,QAAgC,0BAAhC;AAEA,MAAMC,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;AAAsBC,EAAAA,OAAO,EAAE;AAA/B,CAHwB,EAIxB;AAAED,E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N2F,IAAAA,kBAHM;AAINpD,IAAAA,WAJM;AAKNU,IAAAA,mBALM;;AAMN7B,IAAAA,SAAS,CAAEC,KAAF,EAAU;AAClByF,MAAAA,QAAQ,CAAE;AAAEzF,QAAAA;AAAF,OAAF,CAAR;AACA,KARK;;AASNpB,IAAAA,oBATM;;AAUNsF,IAAAA,iCAAiC,CAAEvG,MAAF,EAAW;AAC3C+H,MAAAA,iBAAiB,CAAE/H,MAAF,EAAU;AAC1BiI,QAAAA,+BAA+B,EAAE;AADP,OAAV,CAAjB;AAGA,KAdK;;AAeNvB,IAAAA,UAAU,CAAEZ,IAAF,EAAS;AAClBkC,MAAAA,gBAAgB,CAAElC,IAAF,CAAhB;AACA,KAjBK;;AAkBNW,IAAAA;AAlBM,GAAP;AAoBA,CAhCW,CAnCW,CAAF,CAAP,CAoEV9F,oBApEU,CAAf","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';\n// eslint-disable-next-line no-restricted-imports\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, hostAppNamespace, updateSettings } =\n\t\t\tthis.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\thostAppNamespace,\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"]}
@@ -1,14 +1,9 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { pick } from 'lodash';
5
1
  /**
6
2
  * WordPress dependencies
7
3
  */
8
-
9
4
  import { Platform, useMemo } from '@wordpress/element';
10
5
  import { useDispatch, useSelect } from '@wordpress/data';
11
- import { store as coreStore, __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
6
+ import { store as coreStore, __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimentalFetchUrlData as fetchUrlData, __experimentalFetchMedia as fetchMedia } from '@wordpress/core-data';
12
7
  import { __ } from '@wordpress/i18n';
13
8
  /**
14
9
  * Internal dependencies
@@ -16,6 +11,7 @@ import { __ } from '@wordpress/i18n';
16
11
 
17
12
  import { mediaUpload } from '../../utils';
18
13
  import { store as editorStore } from '../../store';
14
+ const EMPTY_BLOCKS_LIST = [];
19
15
  /**
20
16
  * React hook used to compute the block editor settings to use for the post editor.
21
17
  *
@@ -52,7 +48,7 @@ function useBlockEditorSettings(settings, hasTemplate) {
52
48
  canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
53
49
  reusableBlocks: isWeb ? select(coreStore).getEntityRecords('postType', 'wp_block', {
54
50
  per_page: -1
55
- }) : [],
51
+ }) : EMPTY_BLOCKS_LIST,
56
52
  // Reusable blocks are fetched in the native version of this hook.
57
53
  hasUploadPermissions: (_canUser = canUser('create', 'media')) !== null && _canUser !== void 0 ? _canUser : true,
58
54
  userCanCreatePages: canUser('create', 'pages'),
@@ -104,12 +100,18 @@ function useBlockEditorSettings(settings, hasTemplate) {
104
100
  return saveEntityRecord('postType', 'page', options);
105
101
  };
106
102
 
107
- return useMemo(() => ({ ...pick(settings, ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'isDistractionFree', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets']),
103
+ return useMemo(() => ({ ...Object.fromEntries(Object.entries(settings).filter(_ref2 => {
104
+ let [key] = _ref2;
105
+ return ['__experimentalBlockDirectory', '__experimentalBlockInspectorTabs', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'isDistractionFree', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets'].includes(key);
106
+ })),
108
107
  mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
109
108
  __experimentalReusableBlocks: reusableBlocks,
110
109
  __experimentalBlockPatterns: blockPatterns,
111
110
  __experimentalBlockPatternCategories: blockPatternCategories,
112
111
  __experimentalFetchLinkSuggestions: (search, searchOptions) => fetchLinkSuggestions(search, searchOptions, settings),
112
+ // TODO: We should find a proper way to consolidate similar cases
113
+ // like reusable blocks, fetch entities, etc.
114
+ __unstableFetchMedia: fetchMedia,
113
115
  __experimentalFetchRichUrlData: fetchUrlData,
114
116
  __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
115
117
  __experimentalUndo: undo,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["pick","Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","mediaUpload","editorStore","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","isWeb","OS","canUser","getEntityRecord","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","__experimentalReusableBlocks","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,sBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASP,KAAK,IAAIQ,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;AAAA;;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA;AANK,MAOFlB,SAAS,CAAImB,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QACLF,MAAM,CAAEV,WAAF,CADP;AAEA,UAAMa,KAAK,GAAGzB,QAAQ,CAAC0B,EAAT,KAAgB,KAA9B;AACA,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,QAA+BN,MAAM,CAAEjB,SAAF,CAA3C;AAEA,UAAMwB,YAAY,GAAGF,OAAO,CAAE,MAAF,EAAU,UAAV,CAAP,GAClBC,eAAe,CAAE,MAAF,EAAU,MAAV,CADG,GAElBE,SAFH;AAIA,WAAO;AACNZ,MAAAA,oBAAoB,EAAEK,wBAAwB,EAD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B;AAyDPC,IAAAA,WAzDO;AA0DPqD,IAAAA,kCAAkC,EAAE1D;AA1D7B,GAAR,CADa,EA6Db,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAIC4B,aAJD,EAKCY,sBALD,EAMCtC,oBAND,EAOCuC,IAPD,EAQC1C,WARD,EASCI,kBATD,EAUCC,WAVD,CA7Da,CAAd;AA0EA;;AAED,eAAeP,sBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { pick } 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\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\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\tpostType: getCurrentPostType(),\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() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.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'disableCustomSpacingSizes',\n\t\t\t\t'disableCustomGradients',\n\t\t\t\t'disableLayoutStyles',\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'isDistractionFree',\n\t\t\t\t'hasInlineToolbar',\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":["Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__experimentalFetchMedia","fetchMedia","__","mediaUpload","editorStore","EMPTY_BLOCKS_LIST","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","isWeb","OS","canUser","getEntityRecord","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","Object","fromEntries","entries","key","__experimentalReusableBlocks","search","searchOptions","__unstableFetchMedia","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,EAICC,wBAAwB,IAAIC,UAJ7B,QAKO,sBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAAST,KAAK,IAAIU,WAAlB,QAAqC,aAArC;AAEA,MAAMC,iBAAiB,GAAG,EAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;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,kBAxCD,EAyCC,gBAzCD,EA0CC,wCA1CD,EA2CC,0BA3CD,EA4CEZ,QA5CF,CA4CYY,GA5CZ,CADkC;AAAA,KAAnC,CADE,CADI;AAkDPzD,IAAAA,WAAW,EAAEO,oBAAoB,GAAGP,WAAH,GAAiBoB,SAlD3C;AAmDPsC,IAAAA,4BAA4B,EAAEpD,cAnDvB;AAoDPoB,IAAAA,2BAA2B,EAAEQ,aApDtB;AAqDPL,IAAAA,oCAAoC,EAAEiB,sBArD/B;AAsDPrD,IAAAA,kCAAkC,EAAE,CAAEkE,MAAF,EAAUC,aAAV,KACnClE,oBAAoB,CAAEiE,MAAF,EAAUC,aAAV,EAAyBxD,QAAzB,CAvDd;AAwDP;AACA;AACAyD,IAAAA,oBAAoB,EAAE/D,UA1Df;AA2DPgE,IAAAA,8BAA8B,EAAElE,YA3DzB;AA4DPmE,IAAAA,sCAAsC,EAAEvD,oBA5DjC;AA6DPwD,IAAAA,kBAAkB,EAAEjB,IA7Db;AA8DPkB,IAAAA,WAAW,EAAE5D,WA9DN;AA+DP6D,IAAAA,8BAA8B,EAAEjB,gBA/DzB;AAgEPkB,IAAAA,gCAAgC,EAAE1D,kBAhE3B;AAiEPC,IAAAA,WAjEO;AAkEP0D,IAAAA,kCAAkC,EAAE/D;AAlE7B,GAAR,CADa,EAqEb,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAIC4B,aAJD,EAKCY,sBALD,EAMCtC,oBAND,EAOCuC,IAPD,EAQC1C,WARD,EASCI,kBATD,EAUCC,WAVD,CArEa,CAAd;AAkFA;;AAED,eAAeP,sBAAf","sourcesContent":["/**\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\t__experimentalFetchMedia as fetchMedia,\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\nconst EMPTY_BLOCKS_LIST = [];\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\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\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: EMPTY_BLOCKS_LIST, // 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\tpostType: getCurrentPostType(),\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() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.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...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\t[\n\t\t\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t\t\t'__experimentalBlockInspectorTabs',\n\t\t\t\t\t\t'__experimentalDiscussionSettings',\n\t\t\t\t\t\t'__experimentalFeatures',\n\t\t\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t\t\t'alignWide',\n\t\t\t\t\t\t'allowedBlockTypes',\n\t\t\t\t\t\t'bodyPlaceholder',\n\t\t\t\t\t\t'canLockBlocks',\n\t\t\t\t\t\t'codeEditingEnabled',\n\t\t\t\t\t\t'colors',\n\t\t\t\t\t\t'disableCustomColors',\n\t\t\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t\t\t'disableCustomSpacingSizes',\n\t\t\t\t\t\t'disableCustomGradients',\n\t\t\t\t\t\t'disableLayoutStyles',\n\t\t\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t\t\t'enableCustomSpacing',\n\t\t\t\t\t\t'enableCustomUnits',\n\t\t\t\t\t\t'focusMode',\n\t\t\t\t\t\t'fontSizes',\n\t\t\t\t\t\t'gradients',\n\t\t\t\t\t\t'generateAnchors',\n\t\t\t\t\t\t'hasFixedToolbar',\n\t\t\t\t\t\t'isDistractionFree',\n\t\t\t\t\t\t'hasInlineToolbar',\n\t\t\t\t\t\t'imageDefaultSize',\n\t\t\t\t\t\t'imageDimensions',\n\t\t\t\t\t\t'imageEditing',\n\t\t\t\t\t\t'imageSizes',\n\t\t\t\t\t\t'isRTL',\n\t\t\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t\t\t'maxWidth',\n\t\t\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t\t\t'styles',\n\t\t\t\t\t\t'template',\n\t\t\t\t\t\t'templateLock',\n\t\t\t\t\t\t'titlePlaceholder',\n\t\t\t\t\t\t'supportsLayout',\n\t\t\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t\t\t'__unstableResolvedAssets',\n\t\t\t\t\t].includes( key )\n\t\t\t\t)\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// TODO: We should find a proper way to consolidate similar cases\n\t\t\t// like reusable blocks, fetch entities, etc.\n\t\t\t__unstableFetchMedia: fetchMedia,\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"]}
@@ -10,6 +10,7 @@ import { store as coreStore } from '@wordpress/core-data';
10
10
 
11
11
  import useBlockEditorSettings from './use-block-editor-settings.js';
12
12
  import { store as editorStore } from '../../store';
13
+ const EMPTY_BLOCKS_LIST = [];
13
14
 
14
15
  function useNativeBlockEditorSettings(settings, hasTemplate) {
15
16
  var _settings$capabilitie;
@@ -26,7 +27,7 @@ function useNativeBlockEditorSettings(settings, hasTemplate) {
26
27
  // Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661
27
28
  {
28
29
  per_page: 100
29
- }) : [],
30
+ }) : EMPTY_BLOCKS_LIST,
30
31
  isTitleSelected: select(editorStore).isPostTitleSelected()
31
32
  };
32
33
  }, [supportReusableBlock]);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.native.js"],"names":["useMemo","useSelect","store","coreStore","useBlockEditorSettings","editorStore","useNativeBlockEditorSettings","settings","hasTemplate","capabilities","editorSettings","supportReusableBlock","reusableBlock","reusableBlocks","isTitleSelected","select","getEntityRecords","per_page","isPostTitleSelected","__experimentalReusableBlocks","__experimentalShouldInsertAtTheTop"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,gCAAnC;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;;AAEA,SAASC,4BAAT,CAAuCC,QAAvC,EAAiDC,WAAjD,EAA+D;AAAA;;AAC9D,QAAMC,YAAY,4BAAGF,QAAQ,CAACE,YAAZ,yEAA4B,EAA9C;AACA,QAAMC,cAAc,GAAGN,sBAAsB,CAAEG,QAAF,EAAYC,WAAZ,CAA7C;AAEA,QAAMG,oBAAoB,GAAGF,YAAY,CAACG,aAAb,KAA+B,IAA5D;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAsCb,SAAS,CAClDc,MAAF,IAAc;AACb,WAAO;AACNF,MAAAA,cAAc,EAAEF,oBAAoB,GACjCI,MAAM,CAAEZ,SAAF,CAAN,CAAoBa,gBAApB,CACA,UADA,EAEA,UAFA,EAGA;AACA;AACA;AAAEC,QAAAA,QAAQ,EAAE;AAAZ,OALA,CADiC,GAQjC,EATG;AAUNH,MAAAA,eAAe,EAAEC,MAAM,CAAEV,WAAF,CAAN,CAAsBa,mBAAtB;AAVX,KAAP;AAYA,GAdmD,EAepD,CAAEP,oBAAF,CAfoD,CAArD;AAkBA,SAAOX,OAAO,CACb,OAAQ,EACP,GAAGU,cADI;AAEPS,IAAAA,4BAA4B,EAAEN,cAFvB;AAGPO,IAAAA,kCAAkC,EAAEN;AAH7B,GAAR,CADa,EAMb,CAAEJ,cAAF,EAAkBG,cAAlB,EAAkCC,eAAlC,CANa,CAAd;AAQA;;AAED,eAAeR,4BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport useBlockEditorSettings from './use-block-editor-settings.js';\nimport { store as editorStore } from '../../store';\n\nfunction useNativeBlockEditorSettings( settings, hasTemplate ) {\n\tconst capabilities = settings.capabilities ?? {};\n\tconst editorSettings = useBlockEditorSettings( settings, hasTemplate );\n\n\tconst supportReusableBlock = capabilities.reusableBlock === true;\n\tconst { reusableBlocks, isTitleSelected } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\treusableBlocks: supportReusableBlock\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t\t// Unbounded queries are not supported on native so as a workaround, we set per_page with the maximum value that native version can handle.\n\t\t\t\t\t\t\t// Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661\n\t\t\t\t\t\t\t{ per_page: 100 }\n\t\t\t\t\t )\n\t\t\t\t\t: [],\n\t\t\t\tisTitleSelected: select( editorStore ).isPostTitleSelected(),\n\t\t\t};\n\t\t},\n\t\t[ supportReusableBlock ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...editorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalShouldInsertAtTheTop: isTitleSelected,\n\t\t} ),\n\t\t[ editorSettings, reusableBlocks, isTitleSelected ]\n\t);\n}\n\nexport default useNativeBlockEditorSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.native.js"],"names":["useMemo","useSelect","store","coreStore","useBlockEditorSettings","editorStore","EMPTY_BLOCKS_LIST","useNativeBlockEditorSettings","settings","hasTemplate","capabilities","editorSettings","supportReusableBlock","reusableBlock","reusableBlocks","isTitleSelected","select","getEntityRecords","per_page","isPostTitleSelected","__experimentalReusableBlocks","__experimentalShouldInsertAtTheTop"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,gCAAnC;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;AAEA,MAAMC,iBAAiB,GAAG,EAA1B;;AAEA,SAASC,4BAAT,CAAuCC,QAAvC,EAAiDC,WAAjD,EAA+D;AAAA;;AAC9D,QAAMC,YAAY,4BAAGF,QAAQ,CAACE,YAAZ,yEAA4B,EAA9C;AACA,QAAMC,cAAc,GAAGP,sBAAsB,CAAEI,QAAF,EAAYC,WAAZ,CAA7C;AAEA,QAAMG,oBAAoB,GAAGF,YAAY,CAACG,aAAb,KAA+B,IAA5D;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAsCd,SAAS,CAClDe,MAAF,IAAc;AACb,WAAO;AACNF,MAAAA,cAAc,EAAEF,oBAAoB,GACjCI,MAAM,CAAEb,SAAF,CAAN,CAAoBc,gBAApB,CACA,UADA,EAEA,UAFA,EAGA;AACA;AACA;AAAEC,QAAAA,QAAQ,EAAE;AAAZ,OALA,CADiC,GAQjCZ,iBATG;AAUNS,MAAAA,eAAe,EAAEC,MAAM,CAAEX,WAAF,CAAN,CAAsBc,mBAAtB;AAVX,KAAP;AAYA,GAdmD,EAepD,CAAEP,oBAAF,CAfoD,CAArD;AAkBA,SAAOZ,OAAO,CACb,OAAQ,EACP,GAAGW,cADI;AAEPS,IAAAA,4BAA4B,EAAEN,cAFvB;AAGPO,IAAAA,kCAAkC,EAAEN;AAH7B,GAAR,CADa,EAMb,CAAEJ,cAAF,EAAkBG,cAAlB,EAAkCC,eAAlC,CANa,CAAd;AAQA;;AAED,eAAeR,4BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport useBlockEditorSettings from './use-block-editor-settings.js';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nfunction useNativeBlockEditorSettings( settings, hasTemplate ) {\n\tconst capabilities = settings.capabilities ?? {};\n\tconst editorSettings = useBlockEditorSettings( settings, hasTemplate );\n\n\tconst supportReusableBlock = capabilities.reusableBlock === true;\n\tconst { reusableBlocks, isTitleSelected } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\treusableBlocks: supportReusableBlock\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t\t// Unbounded queries are not supported on native so as a workaround, we set per_page with the maximum value that native version can handle.\n\t\t\t\t\t\t\t// Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661\n\t\t\t\t\t\t\t{ per_page: 100 }\n\t\t\t\t\t )\n\t\t\t\t\t: EMPTY_BLOCKS_LIST,\n\t\t\t\tisTitleSelected: select( editorStore ).isPostTitleSelected(),\n\t\t\t};\n\t\t},\n\t\t[ supportReusableBlock ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...editorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalShouldInsertAtTheTop: isTitleSelected,\n\t\t} ),\n\t\t[ editorSettings, reusableBlocks, isTitleSelected ]\n\t);\n}\n\nexport default useNativeBlockEditorSettings;\n"]}
@@ -1,4 +1,10 @@
1
1
  @charset "UTF-8";
2
+ /**
3
+ * Converts a hex value into the rgb equivalent.
4
+ *
5
+ * @param {string} hex - the hexadecimal value to convert
6
+ * @return {string} comma separated rgb values
7
+ */
2
8
  /**
3
9
  * Colors
4
10
  */
@@ -12,6 +18,12 @@
12
18
  * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
13
19
  * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
14
20
  */
21
+ /**
22
+ * Converts a hex value into the rgb equivalent.
23
+ *
24
+ * @param {string} hex - the hexadecimal value to convert
25
+ * @return {string} comma separated rgb values
26
+ */
15
27
  /**
16
28
  * Colors
17
29
  */
@@ -83,6 +95,8 @@
83
95
  --wp-admin-theme-color-darker-20: #005a87;
84
96
  --wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
85
97
  --wp-admin-border-width-focus: 2px;
98
+ --wp-block-synced-color: #7a00df;
99
+ --wp-block-synced-color--rgb: 122, 0, 223;
86
100
  }
87
101
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
88
102
  :root {
@@ -277,7 +291,7 @@
277
291
  max-width: 780px;
278
292
  padding: 20px;
279
293
  margin-top: 60px;
280
- box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25);
294
+ box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.15), 0 2.7px 3.8px -0.2px rgba(0, 0, 0, 0.15), 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.15), -0.1px 11.5px 16.4px -0.5px rgba(0, 0, 0, 0.15);
281
295
  }
282
296
 
283
297
  .editor-page-attributes__order {
@@ -747,7 +761,7 @@
747
761
  box-shadow: 0 0 0 transparent;
748
762
  transition: box-shadow 0.1s linear;
749
763
  border-radius: 2px;
750
- border: 1px solid #757575;
764
+ border: 1px solid #949494;
751
765
  /* Fonts smaller than 16px causes mobile safari to zoom. */
752
766
  font-size: 16px;
753
767
  /* Override core line-height. To be reviewed. */
@@ -835,7 +849,7 @@
835
849
  box-shadow: 0 0 0 transparent;
836
850
  transition: box-shadow 0.1s linear;
837
851
  border-radius: 2px;
838
- border: 1px solid #757575;
852
+ border: 1px solid #949494;
839
853
  /* Fonts smaller than 16px causes mobile safari to zoom. */
840
854
  font-size: 16px;
841
855
  /* Override core line-height. To be reviewed. */