@wordpress/editor 13.7.0 → 13.9.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 +4 -0
- package/build/components/entities-saved-states/index.js +12 -7
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/post-excerpt/index.js +1 -1
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +13 -7
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-template/index.js +1 -7
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-title/index.native.js +41 -11
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-url/index.js +1 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +21 -19
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +12 -6
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +1 -1
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +15 -9
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-template/index.js +1 -6
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +41 -11
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +21 -18
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-style/style-rtl.css +3 -19
- package/build-style/style.css +3 -19
- package/package.json +31 -32
- package/src/components/entities-saved-states/index.js +8 -6
- package/src/components/post-excerpt/index.js +1 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -0
- package/src/components/post-taxonomies/hierarchical-term-selector.js +26 -21
- package/src/components/post-taxonomies/style.scss +5 -20
- package/src/components/post-template/index.js +5 -6
- package/src/components/post-title/index.native.js +31 -8
- package/src/components/post-url/index.js +1 -1
- package/src/hooks/custom-sources-backwards-compatibility.js +13 -17
|
@@ -1 +1 @@
|
|
|
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,QAA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MN3C,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\ttestID=\"post-title\"\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","onPaste","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","value","onChange","plainText","html","title","onInsertBlockAfter","onUpdate","content","HTML","length","valueToInsert","firstBlock","name","attributes","slice","richText","getTitle","postType","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","borderColor","titleStyles","text","color","placeholderColor","titleContainer","dimmed","onBlur","onEnterPress","select","isPostTitleSelected","getEditedPostAttribute","getSelectedBlockClientId","getBlockRootClientId","getSettings","selectedId","selectionIsNested","__experimentalGlobalStylesBaseStyles","dispatch","undo","redo","togglePostTitleSelection","editPost","clearSelectedBlock","insertDefaultBlock","insertBlocks","undefined","onUndo","onRedo","blocks"],"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,SAAKC,OAAL,GAAe,KAAKA,OAAL,CAAaD,IAAb,CAAmB,IAAnB,CAAf;AACA;;AACDE,EAAAA,kBAAkB,CAAEC,SAAF,EAAc;AAC/B;AACA,QACC,KAAKL,KAAL,CAAWM,UAAX,IACA,CAAED,SAAS,CAACE,kBADZ,IAEA,KAAKP,KAAL,CAAWO,kBAHZ,EAIE;AACD,UAAK,KAAKC,WAAV,EAAwB;AACvB,aAAKA,WAAL,CAAiBC,IAAjB;AACA;;AACD,WAAKT,KAAL,CAAWU,UAAX;AACA;AACD;;AAEDC,EAA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IAJF;AAKNS,IAAAA,MAAM,EAAER,IALF;;AAMN/C,IAAAA,QAAQ,GAAG;AACVgD,MAAAA,wBAAwB,CAAE,IAAF,CAAxB;AACAE,MAAAA,kBAAkB;AAClB,KATK;;AAUNvD,IAAAA,UAAU,GAAG;AACZqD,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;AACA,KAZK;;AAaNzC,IAAAA,QAAQ,CAAEF,KAAF,EAAU;AACjB4C,MAAAA,QAAQ,CAAE;AAAE5C,QAAAA;AAAF,OAAF,CAAR;AACA,KAfK;;AAgBNC,IAAAA,kBAAkB,CAAEkD,MAAF,EAAW;AAC5BJ,MAAAA,YAAY,CAAEI,MAAF,EAAU,CAAV,CAAZ;AACA;;AAlBK,GAAP;AAoBA,CA3BW,CArBS,EAiDrBlF,cAjDqB,EAkDrBD,gBAlDqB,CAAP,CAmDZU,SAnDY,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\tthis.onPaste = this.onPaste.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, html } ) {\n\t\tconst { title, onInsertBlockAfter, onUpdate } = this.props;\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tif ( content.length ) {\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else {\n\t\t\t\tconst [ firstBlock ] = content;\n\t\t\t\tif (\n\t\t\t\t\t! title &&\n\t\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t\t) {\n\t\t\t\t\tonUpdate( firstBlock.attributes.content );\n\t\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t\t} else {\n\t\t\t\t\tonInsertBlockAfter( content );\n\t\t\t\t}\n\t\t\t}\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\ttestID=\"post-title\"\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\ttitle: getEditedPostAttribute( 'title' ),\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, editPost } =\n\t\t\tdispatch( editorStore );\n\n\t\tconst { clearSelectedBlock, insertDefaultBlock, insertBlocks } =\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\tonUpdate( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\tonInsertBlockAfter( blocks ) {\n\t\t\t\tinsertBlocks( blocks, 0 );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n\twithFocusOutside\n)( PostTitle );\n"]}
|
|
@@ -59,7 +59,7 @@ export default function PostURL(_ref) {
|
|
|
59
59
|
autoComplete: "off",
|
|
60
60
|
spellCheck: "false",
|
|
61
61
|
help: createElement(Fragment, null, __('The last part of the URL.'), ' ', createElement(ExternalLink, {
|
|
62
|
-
href: __('https://wordpress.org/
|
|
62
|
+
href: __('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink')
|
|
63
63
|
}, __('Learn more.'))),
|
|
64
64
|
onChange: newValue => {
|
|
65
65
|
editPost({
|
|
@@ -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","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,SA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,cAAF,uBAAEA,cAAc,CAAES,MAR3B;AASNjB,MAAAA,eAAe,EAAEQ,cAAF,aAAEA,cAAF,uBAAEA,cAAc,CAAEU;AAT3B,KAAP;AAWA,GAlBY,EAkBV,EAlBU,CAPb;AA2BA,QAAM;AAAEC,IAAAA;AAAF,MAAetC,WAAW,CAAEW,WAAF,CAAhC;AAEA,QAAM,CAAE4B,eAAF,EAAmBC,kBAAnB,IAA0CrC,QAAQ,CAAE,KAAF,CAAxD;AAEA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,sBAAD;AAAwB,IAAA,KAAK,EAAGG,EAAE,CAAE,KAAF,CAAlC;AAA8C,IAAA,OAAO,EAAGO;AAAxD,IADD,EAEGC,UAAU,IACX,cAAC,WAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGR,EAAE,CAAE,WAAF,CAFX;AAGC,IAAA,KAAK,EAAGiC,eAAe,GAAG,EAAH,GAAQxB,QAHhC;AAIC,IAAA,YAAY,EAAC,KAJd;AAKC,IAAA,UAAU,EAAC,OALZ;AAMC,IAAA,IAAI,EACH,8BACGT,EAAE,CAAE,2BAAF,CADL,EACwC,GADxC,EAEC,cAAC,YAAD;AACC,MAAA,IAAI,EAAGA,EAAE,CACR,
|
|
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,WAAp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B,CAAE,IAAF,CAAlB;AACA;;AACD;AACA;;AACD,UAAKD,eAAL,EAAuB;AACtBC,QAAAA,kBAAkB,CAAE,KAAF,CAAlB;AACA;AACD,KAjCF;AAkCC,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;AAzCF,IAHF,EA+CG1B,UAAU,IACX;AAAI,IAAA,SAAS,EAAC;AAAd,KACGE,aADH,aACGA,aADH,cACGA,aADH,GACoBV,EAAE,CAAE,WAAF,CADtB,CAhDF,EAoDC,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,CApDD,CADD;AA8EA","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\t__nextHasNoMarginBottom\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/documentation/article/page-post-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,14 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { createElement } from "@wordpress/element";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* External dependencies
|
|
6
|
-
*/
|
|
7
|
-
import { mapValues, isEmpty } from 'lodash';
|
|
8
4
|
/**
|
|
9
5
|
* WordPress dependencies
|
|
10
6
|
*/
|
|
11
|
-
|
|
12
7
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
13
8
|
import { select as globalSelect, useSelect } from '@wordpress/data';
|
|
14
9
|
import { useEntityProp } from '@wordpress/core-data';
|
|
@@ -53,23 +48,26 @@ const createWithMetaAttributeSource = metaAttributes => createHigherOrderCompone
|
|
|
53
48
|
const postType = useSelect(select => select(editorStore).getCurrentPostType(), []);
|
|
54
49
|
const [meta, setMeta] = useEntityProp('postType', postType, 'meta');
|
|
55
50
|
const mergedAttributes = useMemo(() => ({ ...attributes,
|
|
56
|
-
...
|
|
51
|
+
...Object.fromEntries(Object.entries(metaAttributes).map(_ref2 => {
|
|
52
|
+
let [attributeKey, metaKey] = _ref2;
|
|
53
|
+
return [attributeKey, meta[metaKey]];
|
|
54
|
+
}))
|
|
57
55
|
}), [attributes, meta]);
|
|
58
56
|
return createElement(BlockEdit, _extends({
|
|
59
57
|
attributes: mergedAttributes,
|
|
60
58
|
setAttributes: nextAttributes => {
|
|
61
59
|
const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( // Filter to intersection of keys between the updated
|
|
62
60
|
// attributes and those with an associated meta key.
|
|
63
|
-
|
|
64
|
-
let [key] =
|
|
61
|
+
_ref3 => {
|
|
62
|
+
let [key] = _ref3;
|
|
65
63
|
return key in metaAttributes;
|
|
66
|
-
}).map(
|
|
67
|
-
let [attributeKey, value] =
|
|
64
|
+
}).map(_ref4 => {
|
|
65
|
+
let [attributeKey, value] = _ref4;
|
|
68
66
|
return [// Rename the keys to the expected meta key name.
|
|
69
67
|
metaAttributes[attributeKey], value];
|
|
70
68
|
}));
|
|
71
69
|
|
|
72
|
-
if (
|
|
70
|
+
if (Object.entries(nextMeta).length) {
|
|
73
71
|
setMeta(nextMeta);
|
|
74
72
|
}
|
|
75
73
|
|
|
@@ -91,14 +89,19 @@ function shimAttributeSource(settings) {
|
|
|
91
89
|
var _settings$attributes;
|
|
92
90
|
|
|
93
91
|
/** @type {WPMetaAttributeMapping} */
|
|
94
|
-
const metaAttributes =
|
|
92
|
+
const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(_ref5 => {
|
|
95
93
|
let [, {
|
|
96
94
|
source
|
|
97
|
-
}] =
|
|
95
|
+
}] = _ref5;
|
|
98
96
|
return source === 'meta';
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
}).map(_ref6 => {
|
|
98
|
+
let [attributeKey, {
|
|
99
|
+
meta
|
|
100
|
+
}] = _ref6;
|
|
101
|
+
return [attributeKey, meta];
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
if (Object.entries(metaAttributes).length) {
|
|
102
105
|
settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
|
|
103
106
|
}
|
|
104
107
|
|
|
@@ -124,10 +127,10 @@ addFilter('blocks.registerBlockType', 'core/editor/custom-sources-backwards-comp
|
|
|
124
127
|
// In the future, we could support updating block settings, at which point this
|
|
125
128
|
// implementation could use that mechanism instead.
|
|
126
129
|
|
|
127
|
-
globalSelect(blocksStore).getBlockTypes().map(
|
|
130
|
+
globalSelect(blocksStore).getBlockTypes().map(_ref7 => {
|
|
128
131
|
let {
|
|
129
132
|
name
|
|
130
|
-
} =
|
|
133
|
+
} = _ref7;
|
|
131
134
|
return globalSelect(blocksStore).getBlockType(name);
|
|
132
135
|
}).forEach(shimAttributeSource);
|
|
133
136
|
//# sourceMappingURL=custom-sources-backwards-compatibility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","Object","fromEntries","entries","map","attributeKey","metaKey","nextAttributes","nextMeta","filter","key","value","length","shimAttributeSource","settings","source","edit","getBlockTypes","name","getBlockType","forEach"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,MAAM,IAAIC,YAAnB,EAAiCC,SAAjC,QAAkD,iBAAlD;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,UAArC;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,6BAA6B,GAAKC,cAAF,IACrCJ,0BAA0B,CACvBK,SAAF,IACC,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6B,OAAGC;AAAhC,GAA6C;AAC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,CAAb;AACA;AAtBF,KAuBMZ,KAvBN,EADD;AA2BA,CAvDuB,EAwDzB,yBAxDyB,CAD3B;AA4DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASkB,mBAAT,CAA8BC,QAA9B,EAAyC;AAAA;;AACxC;AACA,QAAMvB,cAAc,GAAGU,MAAM,CAACC,WAAP,CACtBD,MAAM,CAACE,OAAP,yBAAgBW,QAAQ,CAACrB,UAAzB,uEAAuC,EAAvC,EACEgB,MADF,CACU;AAAA,QAAE,GAAI;AAAEM,MAAAA;AAAF,KAAJ,CAAF;AAAA,WAAwBA,MAAM,KAAK,MAAnC;AAAA,GADV,EAEEX,GAFF,CAEO;AAAA,QAAE,CAAEC,YAAF,EAAgB;AAAEP,MAAAA;AAAF,KAAhB,CAAF;AAAA,WAAkC,CAAEO,YAAF,EAAgBP,IAAhB,CAAlC;AAAA,GAFP,CADsB,CAAvB;;AAKA,MAAKG,MAAM,CAACE,OAAP,CAAgBZ,cAAhB,EAAiCqB,MAAtC,EAA+C;AAC9CE,IAAAA,QAAQ,CAACE,IAAT,GAAgB1B,6BAA6B,CAAEC,cAAF,CAA7B,CACfuB,QAAQ,CAACE,IADM,CAAhB;AAGA;;AAED,SAAOF,QAAP;AACA;;AAED1B,SAAS,CACR,0BADQ,EAER,0EAFQ,EAGRyB,mBAHQ,CAAT,C,CAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA9B,YAAY,CAAEF,WAAF,CAAZ,CACEoC,aADF,GAEEb,GAFF,CAEO;AAAA,MAAE;AAAEc,IAAAA;AAAF,GAAF;AAAA,SAAgBnC,YAAY,CAAEF,WAAF,CAAZ,CAA4BsC,YAA5B,CAA0CD,IAA1C,CAAhB;AAAA,CAFP,EAGEE,OAHF,CAGWP,mBAHX","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( metaAttributes ).map(\n\t\t\t\t\t\t\t\t( [ attributeKey, metaKey ] ) => [\n\t\t\t\t\t\t\t\t\tattributeKey,\n\t\t\t\t\t\t\t\t\tmeta[ metaKey ],\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.entries( nextMeta ).length ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = Object.fromEntries(\n\t\tObject.entries( settings.attributes ?? {} )\n\t\t\t.filter( ( [ , { source } ] ) => source === 'meta' )\n\t\t\t.map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] )\n\t);\n\tif ( Object.entries( metaAttributes ).length ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
|
|
@@ -615,31 +615,15 @@
|
|
|
615
615
|
.editor-post-taxonomies__hierarchical-terms-choice {
|
|
616
616
|
margin-bottom: 8px;
|
|
617
617
|
}
|
|
618
|
+
.editor-post-taxonomies__hierarchical-terms-choice:last-child {
|
|
619
|
+
margin-bottom: 4px;
|
|
620
|
+
}
|
|
618
621
|
|
|
619
622
|
.editor-post-taxonomies__hierarchical-terms-subchoices {
|
|
620
623
|
margin-top: 8px;
|
|
621
624
|
margin-right: 16px;
|
|
622
625
|
}
|
|
623
626
|
|
|
624
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-submit,
|
|
625
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-add {
|
|
626
|
-
margin-top: 12px;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
.editor-post-taxonomies__hierarchical-terms-label {
|
|
630
|
-
display: inline-block;
|
|
631
|
-
margin-top: 12px;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
.editor-post-taxonomies__hierarchical-terms-input {
|
|
635
|
-
margin-top: 8px;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
.editor-post-taxonomies__hierarchical-terms-filter {
|
|
639
|
-
margin-bottom: 8px;
|
|
640
|
-
width: 100%;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
627
|
.editor-post-taxonomies__flat-term-most-used .editor-post-taxonomies__flat-term-most-used-label {
|
|
644
628
|
margin-bottom: 4px;
|
|
645
629
|
}
|
package/build-style/style.css
CHANGED
|
@@ -615,31 +615,15 @@
|
|
|
615
615
|
.editor-post-taxonomies__hierarchical-terms-choice {
|
|
616
616
|
margin-bottom: 8px;
|
|
617
617
|
}
|
|
618
|
+
.editor-post-taxonomies__hierarchical-terms-choice:last-child {
|
|
619
|
+
margin-bottom: 4px;
|
|
620
|
+
}
|
|
618
621
|
|
|
619
622
|
.editor-post-taxonomies__hierarchical-terms-subchoices {
|
|
620
623
|
margin-top: 8px;
|
|
621
624
|
margin-left: 16px;
|
|
622
625
|
}
|
|
623
626
|
|
|
624
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-submit,
|
|
625
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-add {
|
|
626
|
-
margin-top: 12px;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
.editor-post-taxonomies__hierarchical-terms-label {
|
|
630
|
-
display: inline-block;
|
|
631
|
-
margin-top: 12px;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
.editor-post-taxonomies__hierarchical-terms-input {
|
|
635
|
-
margin-top: 8px;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
.editor-post-taxonomies__hierarchical-terms-filter {
|
|
639
|
-
margin-bottom: 8px;
|
|
640
|
-
width: 100%;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
627
|
.editor-post-taxonomies__flat-term-most-used .editor-post-taxonomies__flat-term-most-used-label {
|
|
644
628
|
margin-bottom: 4px;
|
|
645
629
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.9.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,41 +31,40 @@
|
|
|
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": "^12.
|
|
39
|
-
"@wordpress/components": "^23.
|
|
40
|
-
"@wordpress/compose": "^6.
|
|
41
|
-
"@wordpress/core-data": "^6.
|
|
42
|
-
"@wordpress/data": "^9.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^5.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/media-utils": "^4.
|
|
54
|
-
"@wordpress/notices": "^
|
|
55
|
-
"@wordpress/preferences": "^3.
|
|
56
|
-
"@wordpress/private-apis": "^0.
|
|
57
|
-
"@wordpress/reusable-blocks": "^4.
|
|
58
|
-
"@wordpress/rich-text": "^6.
|
|
59
|
-
"@wordpress/server-side-render": "^4.
|
|
60
|
-
"@wordpress/url": "^3.
|
|
61
|
-
"@wordpress/wordcount": "^3.
|
|
34
|
+
"@wordpress/a11y": "^3.32.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.29.0",
|
|
36
|
+
"@wordpress/blob": "^3.32.0",
|
|
37
|
+
"@wordpress/block-editor": "^12.0.0",
|
|
38
|
+
"@wordpress/blocks": "^12.9.0",
|
|
39
|
+
"@wordpress/components": "^23.9.0",
|
|
40
|
+
"@wordpress/compose": "^6.9.0",
|
|
41
|
+
"@wordpress/core-data": "^6.9.0",
|
|
42
|
+
"@wordpress/data": "^9.2.0",
|
|
43
|
+
"@wordpress/date": "^4.32.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.32.0",
|
|
45
|
+
"@wordpress/dom": "^3.32.0",
|
|
46
|
+
"@wordpress/element": "^5.9.0",
|
|
47
|
+
"@wordpress/hooks": "^3.32.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.32.0",
|
|
49
|
+
"@wordpress/i18n": "^4.32.0",
|
|
50
|
+
"@wordpress/icons": "^9.23.0",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.9.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.32.0",
|
|
53
|
+
"@wordpress/media-utils": "^4.23.0",
|
|
54
|
+
"@wordpress/notices": "^4.0.0",
|
|
55
|
+
"@wordpress/preferences": "^3.9.0",
|
|
56
|
+
"@wordpress/private-apis": "^0.14.0",
|
|
57
|
+
"@wordpress/reusable-blocks": "^4.9.0",
|
|
58
|
+
"@wordpress/rich-text": "^6.9.0",
|
|
59
|
+
"@wordpress/server-side-render": "^4.9.0",
|
|
60
|
+
"@wordpress/url": "^3.33.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.32.0",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"date-fns": "^2.28.0",
|
|
64
64
|
"escape-html": "^1.0.3",
|
|
65
|
-
"lodash": "^4.17.21",
|
|
66
65
|
"memize": "^1.1.0",
|
|
67
66
|
"react-autosize-textarea": "^7.1.0",
|
|
68
|
-
"rememo": "^4.0.
|
|
67
|
+
"rememo": "^4.0.2",
|
|
69
68
|
"remove-accents": "^0.4.2"
|
|
70
69
|
},
|
|
71
70
|
"peerDependencies": {
|
|
@@ -75,5 +74,5 @@
|
|
|
75
74
|
"publishConfig": {
|
|
76
75
|
"access": "public"
|
|
77
76
|
},
|
|
78
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "6df0c62d43b8901414ccd22ffbe56eaa99d012a6"
|
|
79
78
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { groupBy } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -83,7 +78,14 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
83
78
|
useDispatch( noticesStore );
|
|
84
79
|
|
|
85
80
|
// To group entities by type.
|
|
86
|
-
const partitionedSavables =
|
|
81
|
+
const partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {
|
|
82
|
+
const { name } = record;
|
|
83
|
+
if ( ! acc[ name ] ) {
|
|
84
|
+
acc[ name ] = [];
|
|
85
|
+
}
|
|
86
|
+
acc[ name ].push( record );
|
|
87
|
+
return acc;
|
|
88
|
+
}, {} );
|
|
87
89
|
|
|
88
90
|
// Sort entity groups.
|
|
89
91
|
const {
|
|
@@ -23,7 +23,7 @@ function PostExcerpt( { excerpt, onUpdateExcerpt } ) {
|
|
|
23
23
|
/>
|
|
24
24
|
<ExternalLink
|
|
25
25
|
href={ __(
|
|
26
|
-
'https://wordpress.org/
|
|
26
|
+
'https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'
|
|
27
27
|
) }
|
|
28
28
|
>
|
|
29
29
|
{ __( 'Learn more about manual excerpts' ) }
|
|
@@ -595,6 +595,8 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
|
|
|
595
595
|
position: relative;
|
|
596
596
|
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
|
|
597
597
|
overflow: visible;
|
|
598
|
+
opacity: 1;
|
|
599
|
+
background-color: transparent;
|
|
598
600
|
}
|
|
599
601
|
|
|
600
602
|
.emotion-2 {
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
TextControl,
|
|
10
10
|
TreeSelect,
|
|
11
11
|
withFilters,
|
|
12
|
-
|
|
12
|
+
Flex,
|
|
13
|
+
FlexItem,
|
|
13
14
|
} from '@wordpress/components';
|
|
14
15
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
15
16
|
import { useDebounce } from '@wordpress/compose';
|
|
@@ -392,11 +393,10 @@ export function HierarchicalTermSelector( { slug } ) {
|
|
|
392
393
|
const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
|
|
393
394
|
|
|
394
395
|
return (
|
|
395
|
-
|
|
396
|
+
<Flex direction="column" gap="4">
|
|
396
397
|
{ showFilter && (
|
|
397
398
|
<TextControl
|
|
398
399
|
__nextHasNoMarginBottom
|
|
399
|
-
className="editor-post-taxonomies__hierarchical-terms-filter"
|
|
400
400
|
label={ filterLabel }
|
|
401
401
|
value={ filterValue }
|
|
402
402
|
onChange={ setFilter }
|
|
@@ -413,18 +413,20 @@ export function HierarchicalTermSelector( { slug } ) {
|
|
|
413
413
|
) }
|
|
414
414
|
</div>
|
|
415
415
|
{ ! loading && hasCreateAction && (
|
|
416
|
-
<
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
416
|
+
<FlexItem>
|
|
417
|
+
<Button
|
|
418
|
+
onClick={ onToggleForm }
|
|
419
|
+
className="editor-post-taxonomies__hierarchical-terms-add"
|
|
420
|
+
aria-expanded={ showForm }
|
|
421
|
+
variant="link"
|
|
422
|
+
>
|
|
423
|
+
{ newTermButtonLabel }
|
|
424
|
+
</Button>
|
|
425
|
+
</FlexItem>
|
|
424
426
|
) }
|
|
425
427
|
{ showForm && (
|
|
426
428
|
<form onSubmit={ onAddTerm }>
|
|
427
|
-
<
|
|
429
|
+
<Flex direction="column" gap="4">
|
|
428
430
|
<TextControl
|
|
429
431
|
__nextHasNoMarginBottom
|
|
430
432
|
className="editor-post-taxonomies__hierarchical-terms-input"
|
|
@@ -435,6 +437,7 @@ export function HierarchicalTermSelector( { slug } ) {
|
|
|
435
437
|
/>
|
|
436
438
|
{ !! availableTerms.length && (
|
|
437
439
|
<TreeSelect
|
|
440
|
+
__nextHasNoMarginBottom
|
|
438
441
|
label={ parentSelectLabel }
|
|
439
442
|
noOptionLabel={ noParentOption }
|
|
440
443
|
onChange={ onChangeFormParent }
|
|
@@ -442,17 +445,19 @@ export function HierarchicalTermSelector( { slug } ) {
|
|
|
442
445
|
tree={ availableTermsTree }
|
|
443
446
|
/>
|
|
444
447
|
) }
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
448
|
+
<FlexItem>
|
|
449
|
+
<Button
|
|
450
|
+
variant="secondary"
|
|
451
|
+
type="submit"
|
|
452
|
+
className="editor-post-taxonomies__hierarchical-terms-submit"
|
|
453
|
+
>
|
|
454
|
+
{ newTermSubmitLabel }
|
|
455
|
+
</Button>
|
|
456
|
+
</FlexItem>
|
|
457
|
+
</Flex>
|
|
453
458
|
</form>
|
|
454
459
|
) }
|
|
455
|
-
|
|
460
|
+
</Flex>
|
|
456
461
|
);
|
|
457
462
|
}
|
|
458
463
|
|
|
@@ -10,32 +10,17 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.editor-post-taxonomies__hierarchical-terms-choice {
|
|
13
|
-
margin-bottom:
|
|
13
|
+
margin-bottom: $grid-unit-10;
|
|
14
|
+
&:last-child {
|
|
15
|
+
margin-bottom: $grid-unit-05;
|
|
16
|
+
}
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
.editor-post-taxonomies__hierarchical-terms-subchoices {
|
|
17
|
-
margin-top:
|
|
20
|
+
margin-top: $grid-unit-10;
|
|
18
21
|
margin-left: $grid-unit-20;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-submit,
|
|
22
|
-
.components-button.editor-post-taxonomies__hierarchical-terms-add {
|
|
23
|
-
margin-top: 12px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.editor-post-taxonomies__hierarchical-terms-label {
|
|
27
|
-
display: inline-block;
|
|
28
|
-
margin-top: 12px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.editor-post-taxonomies__hierarchical-terms-input {
|
|
32
|
-
margin-top: 8px;
|
|
33
|
-
}
|
|
34
|
-
.editor-post-taxonomies__hierarchical-terms-filter {
|
|
35
|
-
margin-bottom: 8px;
|
|
36
|
-
width: 100%;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
24
|
.editor-post-taxonomies__flat-term-most-used {
|
|
40
25
|
.editor-post-taxonomies__flat-term-most-used-label {
|
|
41
26
|
margin-bottom: $grid-unit-05;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { isEmpty } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -38,7 +33,11 @@ export function PostTemplate() {
|
|
|
38
33
|
|
|
39
34
|
const { editPost } = useDispatch( editorStore );
|
|
40
35
|
|
|
41
|
-
if (
|
|
36
|
+
if (
|
|
37
|
+
! isViewable ||
|
|
38
|
+
! availableTemplates ||
|
|
39
|
+
! Object.keys( availableTemplates ).length
|
|
40
|
+
) {
|
|
42
41
|
return null;
|
|
43
42
|
}
|
|
44
43
|
|