@wordpress/editor 12.21.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.
- package/CHANGELOG.md +6 -0
- package/build/components/document-outline/check.js +1 -7
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/editor-notices/index.js +12 -12
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +5 -8
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +2 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/combobox.js +1 -0
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-format/index.js +1 -7
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +10 -5
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +2 -2
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +2 -8
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-title/index.native.js +2 -4
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-url/index.js +6 -2
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +10 -9
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js +3 -1
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/document-outline/check.js +1 -6
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/editor-notices/index.js +12 -11
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +5 -7
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +3 -2
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/combobox.js +1 -0
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-format/index.js +1 -6
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +10 -5
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -2
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +3 -3
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +2 -7
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +2 -3
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-url/index.js +6 -2
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +2 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +10 -8
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js +2 -1
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-style/style-rtl.css +17 -3
- package/build-style/style.css +17 -3
- package/package.json +31 -31
- package/src/components/document-outline/check.js +1 -7
- package/src/components/editor-notices/index.js +6 -13
- package/src/components/editor-snackbars/index.js +3 -8
- package/src/components/page-attributes/parent.js +3 -3
- package/src/components/post-author/combobox.js +1 -0
- package/src/components/post-format/index.js +1 -7
- package/src/components/post-publish-panel/maybe-category-panel.js +9 -12
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -2
- package/src/components/post-taxonomies/flat-term-selector.js +3 -3
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/src/components/post-taxonomies/index.js +2 -8
- package/src/components/post-taxonomies/test/index.js +1 -1
- package/src/components/post-title/index.native.js +2 -3
- package/src/components/post-url/index.js +6 -2
- package/src/components/provider/index.native.js +1 -0
- package/src/components/provider/use-block-editor-settings.js +56 -50
- package/src/components/provider/use-block-editor-settings.native.js +3 -1
|
@@ -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,i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/**\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;AAAA;;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA;AANK,MAOFrB,SAAS,CAAIsB,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QACLF,MAAM,CAAEX,WAAF,CADP;AAEA,UAAMc,KAAK,GAAG5B,QAA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EiB,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,
|
|
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
|
|
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 #
|
|
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 #
|
|
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. */
|
package/build-style/style.css
CHANGED
|
@@ -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
|
|
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 {
|
|
@@ -751,7 +765,7 @@
|
|
|
751
765
|
box-shadow: 0 0 0 transparent;
|
|
752
766
|
transition: box-shadow 0.1s linear;
|
|
753
767
|
border-radius: 2px;
|
|
754
|
-
border: 1px solid #
|
|
768
|
+
border: 1px solid #949494;
|
|
755
769
|
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
756
770
|
font-size: 16px;
|
|
757
771
|
/* Override core line-height. To be reviewed. */
|
|
@@ -839,7 +853,7 @@
|
|
|
839
853
|
box-shadow: 0 0 0 transparent;
|
|
840
854
|
transition: box-shadow 0.1s linear;
|
|
841
855
|
border-radius: 2px;
|
|
842
|
-
border: 1px solid #
|
|
856
|
+
border: 1px solid #949494;
|
|
843
857
|
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
844
858
|
font-size: 16px;
|
|
845
859
|
/* Override core line-height. To be reviewed. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,33 +31,33 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/blob": "^3.
|
|
37
|
-
"@wordpress/block-editor": "^
|
|
38
|
-
"@wordpress/blocks": "^
|
|
39
|
-
"@wordpress/components": "^
|
|
40
|
-
"@wordpress/compose": "^
|
|
41
|
-
"@wordpress/core-data": "^
|
|
42
|
-
"@wordpress/data": "^
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/media-utils": "^4.
|
|
54
|
-
"@wordpress/notices": "^3.
|
|
55
|
-
"@wordpress/preferences": "^
|
|
56
|
-
"@wordpress/reusable-blocks": "^
|
|
57
|
-
"@wordpress/rich-text": "^
|
|
58
|
-
"@wordpress/server-side-render": "^
|
|
59
|
-
"@wordpress/url": "^3.
|
|
60
|
-
"@wordpress/wordcount": "^3.
|
|
34
|
+
"@wordpress/a11y": "^3.23.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.20.0",
|
|
36
|
+
"@wordpress/blob": "^3.23.0",
|
|
37
|
+
"@wordpress/block-editor": "^11.0.0",
|
|
38
|
+
"@wordpress/blocks": "^12.0.0",
|
|
39
|
+
"@wordpress/components": "^23.0.0",
|
|
40
|
+
"@wordpress/compose": "^6.0.0",
|
|
41
|
+
"@wordpress/core-data": "^6.0.0",
|
|
42
|
+
"@wordpress/data": "^8.0.0",
|
|
43
|
+
"@wordpress/date": "^4.23.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.23.0",
|
|
45
|
+
"@wordpress/dom": "^3.23.0",
|
|
46
|
+
"@wordpress/element": "^5.0.0",
|
|
47
|
+
"@wordpress/hooks": "^3.23.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.23.0",
|
|
49
|
+
"@wordpress/i18n": "^4.23.0",
|
|
50
|
+
"@wordpress/icons": "^9.14.0",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.0.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.23.0",
|
|
53
|
+
"@wordpress/media-utils": "^4.14.0",
|
|
54
|
+
"@wordpress/notices": "^3.23.0",
|
|
55
|
+
"@wordpress/preferences": "^3.0.0",
|
|
56
|
+
"@wordpress/reusable-blocks": "^4.0.0",
|
|
57
|
+
"@wordpress/rich-text": "^6.0.0",
|
|
58
|
+
"@wordpress/server-side-render": "^4.0.0",
|
|
59
|
+
"@wordpress/url": "^3.24.0",
|
|
60
|
+
"@wordpress/wordcount": "^3.23.0",
|
|
61
61
|
"classnames": "^2.3.1",
|
|
62
62
|
"date-fns": "^2.28.0",
|
|
63
63
|
"escape-html": "^1.0.3",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"remove-accents": "^0.4.2"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"react": "^
|
|
72
|
-
"react-dom": "^
|
|
71
|
+
"react": "^18.0.0",
|
|
72
|
+
"react-dom": "^18.0.0"
|
|
73
73
|
},
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "1eb65aabe6738097f4c062e78f69ae8f05879848"
|
|
78
78
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -10,8 +5,7 @@ import { withSelect } from '@wordpress/data';
|
|
|
10
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
6
|
|
|
12
7
|
function DocumentOutlineCheck( { blocks, children } ) {
|
|
13
|
-
const headings = filter(
|
|
14
|
-
blocks,
|
|
8
|
+
const headings = blocks.filter(
|
|
15
9
|
( block ) => block.name === 'core/heading'
|
|
16
10
|
);
|
|
17
11
|
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -17,14 +12,12 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
17
12
|
import TemplateValidationNotice from '../template-validation-notice';
|
|
18
13
|
|
|
19
14
|
export function EditorNotices( { notices, onRemove } ) {
|
|
20
|
-
const dismissibleNotices = filter(
|
|
21
|
-
isDismissible
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
type: 'default',
|
|
27
|
-
} );
|
|
15
|
+
const dismissibleNotices = notices.filter(
|
|
16
|
+
( { isDismissible, type } ) => isDismissible && type === 'default'
|
|
17
|
+
);
|
|
18
|
+
const nonDismissibleNotices = notices.filter(
|
|
19
|
+
( { isDismissible, type } ) => ! isDismissible && type === 'default'
|
|
20
|
+
);
|
|
28
21
|
|
|
29
22
|
return (
|
|
30
23
|
<>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -16,9 +11,9 @@ export default function EditorSnackbars() {
|
|
|
16
11
|
[]
|
|
17
12
|
);
|
|
18
13
|
const { removeNotice } = useDispatch( noticesStore );
|
|
19
|
-
const snackbarNotices = filter(
|
|
20
|
-
type
|
|
21
|
-
|
|
14
|
+
const snackbarNotices = notices.filter(
|
|
15
|
+
( { type } ) => type === 'snackbar'
|
|
16
|
+
);
|
|
22
17
|
|
|
23
18
|
return (
|
|
24
19
|
<SnackbarList
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get, unescape as unescapeString
|
|
4
|
+
import { get, unescape as unescapeString } from 'lodash';
|
|
5
5
|
import removeAccents from 'remove-accents';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -122,8 +122,7 @@ export function PageAttributesParent() {
|
|
|
122
122
|
const opts = getOptionsFromTree( tree );
|
|
123
123
|
|
|
124
124
|
// Ensure the current parent is in the options list.
|
|
125
|
-
const optsHasParent = find(
|
|
126
|
-
opts,
|
|
125
|
+
const optsHasParent = opts.find(
|
|
127
126
|
( item ) => item.value === parentPostId
|
|
128
127
|
);
|
|
129
128
|
if ( parentPost && ! optsHasParent ) {
|
|
@@ -158,6 +157,7 @@ export function PageAttributesParent() {
|
|
|
158
157
|
|
|
159
158
|
return (
|
|
160
159
|
<ComboboxControl
|
|
160
|
+
__nextHasNoMarginBottom
|
|
161
161
|
className="editor-page-attributes__parent"
|
|
162
162
|
label={ parentPageLabel }
|
|
163
163
|
value={ parentPostId }
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -69,8 +64,7 @@ export default function PostFormat() {
|
|
|
69
64
|
supportedFormats?.includes( format.id ) || postFormat === format.id
|
|
70
65
|
);
|
|
71
66
|
} );
|
|
72
|
-
const suggestion = find(
|
|
73
|
-
formats,
|
|
67
|
+
const suggestion = formats.find(
|
|
74
68
|
( format ) => format.id === suggestedFormat
|
|
75
69
|
);
|
|
76
70
|
|
|
@@ -16,17 +16,14 @@ import { store as editorStore } from '../../store';
|
|
|
16
16
|
function MaybeCategoryPanel() {
|
|
17
17
|
const hasNoCategory = useSelect( ( select ) => {
|
|
18
18
|
const postType = select( editorStore ).getCurrentPostType();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const defaultCategoryId =
|
|
22
|
-
'root',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'category',
|
|
28
|
-
defaultCategoryId
|
|
29
|
-
);
|
|
19
|
+
const { canUser, getEntityRecord, getTaxonomy } = select( coreStore );
|
|
20
|
+
const categoriesTaxonomy = getTaxonomy( 'category' );
|
|
21
|
+
const defaultCategoryId = canUser( 'read', 'settings' )
|
|
22
|
+
? getEntityRecord( 'root', 'site' )?.default_category
|
|
23
|
+
: undefined;
|
|
24
|
+
const defaultCategory = defaultCategoryId
|
|
25
|
+
? getEntityRecord( 'taxonomy', 'category', defaultCategoryId )
|
|
26
|
+
: undefined;
|
|
30
27
|
const postTypeSupportsCategories =
|
|
31
28
|
categoriesTaxonomy &&
|
|
32
29
|
categoriesTaxonomy.types.some( ( type ) => type === postType );
|
|
@@ -45,7 +42,7 @@ function MaybeCategoryPanel() {
|
|
|
45
42
|
postTypeSupportsCategories &&
|
|
46
43
|
( categories?.length === 0 ||
|
|
47
44
|
( categories?.length === 1 &&
|
|
48
|
-
defaultCategory
|
|
45
|
+
defaultCategory?.id === categories[ 0 ] ) )
|
|
49
46
|
);
|
|
50
47
|
}, [] );
|
|
51
48
|
const [ shouldShowPanel, setShouldShowPanel ] = useState( false );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { get } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -21,7 +21,7 @@ const getSuggestion = ( supportedFormats, suggestedPostFormat ) => {
|
|
|
21
21
|
const formats = POST_FORMATS.filter( ( format ) =>
|
|
22
22
|
supportedFormats?.includes( format.id )
|
|
23
23
|
);
|
|
24
|
-
return find(
|
|
24
|
+
return formats.find( ( format ) => format.id === suggestedPostFormat );
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const PostFormatSuggestion = ( {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { get } from 'lodash';
|
|
5
5
|
import escapeHtml from 'escape-html';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -50,7 +50,7 @@ const isSameTermName = ( termA, termB ) =>
|
|
|
50
50
|
const termNamesToIds = ( names, terms ) => {
|
|
51
51
|
return names.map(
|
|
52
52
|
( termName ) =>
|
|
53
|
-
find(
|
|
53
|
+
terms.find( ( term ) => isSameTermName( term.name, termName ) ).id
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -203,7 +203,7 @@ export function FlatTermSelector( { slug } ) {
|
|
|
203
203
|
|
|
204
204
|
const newTermNames = uniqueTerms.filter(
|
|
205
205
|
( termName ) =>
|
|
206
|
-
! find(
|
|
206
|
+
! availableTerms.find( ( term ) =>
|
|
207
207
|
isSameTermName( term.name, termName )
|
|
208
208
|
)
|
|
209
209
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { get, unescape as unescapeString } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -95,7 +95,7 @@ export function sortBySelected( termsTree, terms ) {
|
|
|
95
95
|
* @return {Object} Term object.
|
|
96
96
|
*/
|
|
97
97
|
export function findTerm( terms, parent, name ) {
|
|
98
|
-
return find(
|
|
98
|
+
return terms.find( ( term ) => {
|
|
99
99
|
return (
|
|
100
100
|
( ( ! term.parent && ! parent ) ||
|
|
101
101
|
parseInt( term.parent ) === parseInt( parent ) ) &&
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -25,11 +20,10 @@ export function PostTaxonomies( {
|
|
|
25
20
|
taxonomies,
|
|
26
21
|
taxonomyWrapper = identity,
|
|
27
22
|
} ) {
|
|
28
|
-
const availableTaxonomies =
|
|
23
|
+
const availableTaxonomies = ( taxonomies ?? [] ).filter( ( taxonomy ) =>
|
|
29
24
|
taxonomy.types.includes( postType )
|
|
30
25
|
);
|
|
31
|
-
const visibleTaxonomies = filter(
|
|
32
|
-
availableTaxonomies,
|
|
26
|
+
const visibleTaxonomies = availableTaxonomies.filter(
|
|
33
27
|
// In some circumstances .visibility can end up as undefined so optional chaining operator required.
|
|
34
28
|
// https://github.com/WordPress/gutenberg/issues/40326
|
|
35
29
|
( taxonomy ) => taxonomy.visibility?.show_ui
|
|
@@ -85,7 +85,7 @@ describe( 'PostTaxonomies', () => {
|
|
|
85
85
|
} );
|
|
86
86
|
|
|
87
87
|
it( 'should render no children if taxonomy data not available', () => {
|
|
88
|
-
const taxonomies =
|
|
88
|
+
const taxonomies = null;
|
|
89
89
|
|
|
90
90
|
const { container } = render(
|
|
91
91
|
<PostTaxonomies postType="page" taxonomies={ taxonomies } />
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { View } from 'react-native';
|
|
5
|
-
import { isEmpty } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -80,7 +79,7 @@ class PostTitle extends Component {
|
|
|
80
79
|
|
|
81
80
|
getTitle( title, postType ) {
|
|
82
81
|
if ( 'page' === postType ) {
|
|
83
|
-
return
|
|
82
|
+
return ! title
|
|
84
83
|
? /* translators: accessibility text. empty page title. */
|
|
85
84
|
__( 'Page title. Empty' )
|
|
86
85
|
: sprintf(
|
|
@@ -90,7 +89,7 @@ class PostTitle extends Component {
|
|
|
90
89
|
);
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
return
|
|
92
|
+
return ! title
|
|
94
93
|
? /* translators: accessibility text. empty post title. */
|
|
95
94
|
__( 'Post title. Empty' )
|
|
96
95
|
: sprintf(
|
|
@@ -23,16 +23,20 @@ export default function PostURL( { onClose } ) {
|
|
|
23
23
|
permalinkPrefix,
|
|
24
24
|
permalinkSuffix,
|
|
25
25
|
} = useSelect( ( select ) => {
|
|
26
|
+
const post = select( editorStore ).getCurrentPost();
|
|
26
27
|
const postTypeSlug = select( editorStore ).getCurrentPostType();
|
|
27
28
|
const postType = select( coreStore ).getPostType( postTypeSlug );
|
|
28
29
|
const permalinkParts = select( editorStore ).getPermalinkParts();
|
|
30
|
+
const hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;
|
|
31
|
+
|
|
29
32
|
return {
|
|
30
|
-
isEditable:
|
|
33
|
+
isEditable:
|
|
34
|
+
select( editorStore ).isPermalinkEditable() && hasPublishAction,
|
|
31
35
|
postSlug: safeDecodeURIComponent(
|
|
32
36
|
select( editorStore ).getEditedPostSlug()
|
|
33
37
|
),
|
|
34
38
|
viewPostLabel: postType?.labels.view_item,
|
|
35
|
-
postLink:
|
|
39
|
+
postLink: post.link,
|
|
36
40
|
permalinkPrefix: permalinkParts?.prefix,
|
|
37
41
|
permalinkSuffix: permalinkParts?.suffix,
|
|
38
42
|
};
|
|
@@ -56,6 +56,7 @@ const postTypeEntities = [
|
|
|
56
56
|
import { EditorHelpTopics, store as editorStore } from '@wordpress/editor';
|
|
57
57
|
import { store as noticesStore } from '@wordpress/notices';
|
|
58
58
|
import { store as coreStore } from '@wordpress/core-data';
|
|
59
|
+
// eslint-disable-next-line no-restricted-imports
|
|
59
60
|
import { store as editPostStore } from '@wordpress/edit-post';
|
|
60
61
|
|
|
61
62
|
/**
|