@wordpress/edit-post 7.30.0 → 7.31.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 +2 -0
- package/README.md +1 -58
- package/build/components/init-pattern-modal/index.js +99 -0
- package/build/components/init-pattern-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/layout/index.js +2 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +3 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +1 -2
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/editor.native.js +2 -2
- package/build/editor.native.js.map +1 -1
- package/build/index.js +1 -2
- package/build/index.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js +93 -0
- package/build-module/components/init-pattern-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/layout/index.js +3 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +4 -2
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +2 -3
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/editor.native.js +3 -3
- package/build-module/editor.native.js.map +1 -1
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +1 -1
- package/package.json +32 -32
- package/src/components/init-pattern-modal/index.js +117 -0
- package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/src/components/layout/index.js +2 -2
- package/src/components/sidebar/post-status/index.js +2 -0
- package/src/components/sidebar/settings-sidebar/index.js +1 -3
- package/src/editor.native.js +8 -2
- package/src/index.js +2 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +0 -126
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +0 -118
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +0 -1
- package/src/components/sidebar/plugin-document-setting-panel/index.js +0 -125
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memize","I18nManager","GestureHandlerRootView","Component","EditorProvider","store","editorStore","parse","serialize","withDispatch","withSelect","compose","subscribeSetFocusOnTitle","subscribeFeaturedImageIdNativeUpdated","SlotFillProvider","coreStore","Layout","Editor","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","maxSize","setTitleRef","bind","settings","isRTL","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","type","status","meta","createElement","style","flex","useSubRegistry","select","getEditorMode","dispatch"],"sources":["@wordpress/edit-post/src/editor.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport {
|
|
1
|
+
{"version":3,"names":["memize","I18nManager","GestureHandlerRootView","Component","EditorProvider","ErrorBoundary","store","editorStore","parse","serialize","withDispatch","withSelect","compose","subscribeSetFocusOnTitle","subscribeFeaturedImageIdNativeUpdated","SlotFillProvider","coreStore","Layout","Editor","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","maxSize","setTitleRef","bind","settings","isRTL","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","type","status","meta","createElement","style","flex","useSubRegistry","select","getEditorMode","dispatch"],"sources":["@wordpress/edit-post/src/editor.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport {\n\tEditorProvider,\n\tErrorBoundary,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { parse, serialize } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\t// need to set this globally to avoid race with deprecations\n\t\t// defaulting to true to avoid issues with a not-yet-cached value\n\t\tconst { galleryWithImageBlocks = true } = props;\n\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings( settings ) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t};\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\tinitialEdits,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings( settings );\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditorMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editorStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tswitchEditorMode,\n\t\t\teditEntityRecord,\n\t\t};\n\t} ),\n] )( Editor );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,QAAQ;AAC3B,SAASC,WAAW,QAAQ,cAAc;AAC1C,SAASC,sBAAsB,QAAQ,8BAA8B;;AAErE;AACA;AACA;AACA,SAASC,SAAS,QAAQ,oBAAo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@ import { createRoot } from '@wordpress/element';
|
|
|
9
9
|
import { dispatch, select } from '@wordpress/data';
|
|
10
10
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
11
11
|
import { registerLegacyWidgetBlock, registerWidgetGroupBlock } from '@wordpress/widgets';
|
|
12
|
-
import { privateApis as editorPrivateApis, store as editorStore } from '@wordpress/editor';
|
|
12
|
+
import { PluginDocumentSettingPanel, privateApis as editorPrivateApis, store as editorStore } from '@wordpress/editor';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
@@ -130,7 +130,7 @@ export function reinitializeEditor() {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
export { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';
|
|
133
|
-
export {
|
|
133
|
+
export { PluginDocumentSettingPanel };
|
|
134
134
|
export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
|
|
135
135
|
export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';
|
|
136
136
|
export { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","deprecated","createRoot","dispatch","select","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","privateApis","editorPrivateApis","editorStore","Editor","unlock","PluginPostExcerpt","__experimentalPluginPostExcerpt","initializeEditor","id","postType","postId","settings","initialEdits","isMediumOrBigger","window","matchMedia","matches","target","document","getElementById","root","setDefaults","fullscreenMode","isPublishSidebarEnabled","themeStyles","welcomeGuide","welcomeGuideTemplate","allowRightClickOverrides","editorMode","fixedToolbar","hiddenBlockTypes","inactivePanels","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","reapplyBlockTypeFilters","get","setIsListViewOpened","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","documentMode","compatMode","console","warn","isIphone","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","createElement","reinitializeEditor","since","version","default","PluginBlockSettingsMenuItem","PluginDocumentSettingPanel","PluginMoreMenuItem","PluginPostPublishPanel","PluginPostStatusInfo","PluginPrePublishPanel","PluginSidebar","PluginSidebarMoreMenuItem","__experimentalFullscreenModeClose","__experimentalMainDashboardButton"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { unlock } from './lock-unlock';\n\nconst { PluginPostExcerpt: __experimentalPluginPostExcerpt } =\n\tunlock( editorPrivateApis );\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst isMediumOrBigger = window.matchMedia( '(min-width: 782px)' ).matches;\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\tfullscreenMode: true,\n\t\tisPublishSidebarEnabled: true,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t// This behavior is disabled for small viewports.\n\tif (\n\t\tisMediumOrBigger &&\n\t\tselect( preferencesStore ).get( 'core', 'showListViewByDefault' ) &&\n\t\t! select( preferencesStore ).get( 'core', 'distractionFree' )\n\t) {\n\t\tdispatch( editorStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { __experimentalPluginPostExcerpt };\nexport { store } from './store';\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,kBAAkB,EAClBC,4CAA4C,QACtC,0BAA0B;AACjC,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,iBAAiB;AAClD,SAASP,KAAK,IAAIQ,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,yBAAyB,EACzBC,wBAAwB,QAClB,oBAAoB;AAC3B,SACCC,WAAW,IAAIC,iBAAiB,EAChCZ,KAAK,IAAIa,WAAW,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA,OAAO,SAAS;AAChB,OAAO,WAAW;AAClB,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,MAAM,QAAQ,eAAe;AAEtC,MAAM;EAAEC,iBAAiB,EAAEC;AAAgC,CAAC,GAC3DF,MAAM,CAAEH,iBAAkB,CAAC;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,gBAAgBA,CAC/BC,EAAE,EACFC,QAAQ,E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AAgB,CAAE,MAAM,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErEzC,IAAI,CAAC0C,MAAM,CACVC,aAAA,CAAC5D,MAAM;IACNQ,QAAQ,EAAGA,QAAU;IACrBD,MAAM,EAAGA,MAAQ;IACjBD,QAAQ,EAAGA,QAAU;IACrBG,YAAY,EAAGA;EAAc,CAC7B,CACF,CAAC;EAED,OAAOQ,IAAI;AACZ;;AAEA;AACA;AACA;AACA,OAAO,SAAS4C,kBAAkBA,CAAA,EAAG;EACpCvE,UAAU,CAAE,gCAAgC,EAAE;IAC7CwE,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;AAEA,SAASC,OAAO,IAAIC,2BAA2B,QAAQ,kEAAkE;AACzH,SAASD,OAAO,IAAIE,0BAA0B,QAAQ,oDAAoD;AAC1G,SAASF,OAAO,IAAIG,kBAAkB,QAAQ,2CAA2C;AACzF,SAASH,OAAO,IAAII,sBAAsB,QAAQ,gDAAgD;AAClG,SAASJ,OAAO,IAAIK,oBAAoB,QAAQ,8CAA8C;AAC9F,SAASL,OAAO,IAAIM,qBAAqB,QAAQ,+CAA+C;AAChG,SAASN,OAAO,IAAIO,aAAa,QAAQ,qCAAqC;AAC9E,SAASP,OAAO,IAAIQ,yBAAyB,QAAQ,mDAAmD;AACxG,SAASR,OAAO,IAAIS,iCAAiC,QAAQ,2CAA2C;AACxG,SAAST,OAAO,IAAIU,iCAAiC,QAAQ,2CAA2C;AACxG,SAASvE,+BAA+B;AACxC,SAASjB,KAAK,QAAQ,SAAS"}
|
|
1
|
+
{"version":3,"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","deprecated","createRoot","dispatch","select","preferencesStore","registerLegacyWidgetBlock","registerWidgetGroupBlock","PluginDocumentSettingPanel","privateApis","editorPrivateApis","editorStore","Editor","unlock","PluginPostExcerpt","__experimentalPluginPostExcerpt","initializeEditor","id","postType","postId","settings","initialEdits","isMediumOrBigger","window","matchMedia","matches","target","document","getElementById","root","setDefaults","fullscreenMode","isPublishSidebarEnabled","themeStyles","welcomeGuide","welcomeGuideTemplate","allowRightClickOverrides","editorMode","fixedToolbar","hiddenBlockTypes","inactivePanels","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","reapplyBlockTypeFilters","get","setIsListViewOpened","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","documentMode","compatMode","console","warn","isIphone","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","createElement","reinitializeEditor","since","version","default","PluginBlockSettingsMenuItem","PluginMoreMenuItem","PluginPostPublishPanel","PluginPostStatusInfo","PluginPrePublishPanel","PluginSidebar","PluginSidebarMoreMenuItem","__experimentalFullscreenModeClose","__experimentalMainDashboardButton"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tPluginDocumentSettingPanel,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { unlock } from './lock-unlock';\n\nconst { PluginPostExcerpt: __experimentalPluginPostExcerpt } =\n\tunlock( editorPrivateApis );\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst isMediumOrBigger = window.matchMedia( '(min-width: 782px)' ).matches;\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\tfullscreenMode: true,\n\t\tisPublishSidebarEnabled: true,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t// This behavior is disabled for small viewports.\n\tif (\n\t\tisMediumOrBigger &&\n\t\tselect( preferencesStore ).get( 'core', 'showListViewByDefault' ) &&\n\t\t! select( preferencesStore ).get( 'core', 'distractionFree' )\n\t) {\n\t\tdispatch( editorStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { PluginDocumentSettingPanel };\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { __experimentalPluginPostExcerpt };\nexport { store } from './store';\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCC,kBAAkB,EAClBC,4CAA4C,QACtC,0BAA0B;AACjC,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,iBAAiB;AAClD,SAASP,KAAK,IAAIQ,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,yBAAyB,EACzBC,wBAAwB,QAClB,oBAAoB;AAC3B,SACCC,0BAA0B,EAC1BC,WAAW,IAAIC,iBAAiB,EAChCb,KAAK,IAAIc,WAAW,QACd,mBAAmB;;AAE1B;AACA;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,SAAStE,+BAA+B;AACxC,SAASlB,KAAK,QAAQ,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.31.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,36 +27,36 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^12.
|
|
33
|
-
"@wordpress/block-library": "^8.
|
|
34
|
-
"@wordpress/blocks": "^12.
|
|
35
|
-
"@wordpress/commands": "^0.
|
|
36
|
-
"@wordpress/components": "^27.
|
|
37
|
-
"@wordpress/compose": "^6.
|
|
38
|
-
"@wordpress/core-commands": "^0.
|
|
39
|
-
"@wordpress/core-data": "^6.
|
|
40
|
-
"@wordpress/data": "^9.
|
|
41
|
-
"@wordpress/deprecated": "^3.
|
|
42
|
-
"@wordpress/dom": "^3.
|
|
43
|
-
"@wordpress/editor": "^13.
|
|
44
|
-
"@wordpress/element": "^5.
|
|
45
|
-
"@wordpress/hooks": "^3.
|
|
46
|
-
"@wordpress/i18n": "^4.
|
|
47
|
-
"@wordpress/icons": "^9.
|
|
48
|
-
"@wordpress/interface": "^5.
|
|
49
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
50
|
-
"@wordpress/keycodes": "^3.
|
|
51
|
-
"@wordpress/media-utils": "^4.
|
|
52
|
-
"@wordpress/notices": "^4.
|
|
53
|
-
"@wordpress/plugins": "^6.
|
|
54
|
-
"@wordpress/preferences": "^3.
|
|
55
|
-
"@wordpress/private-apis": "^0.
|
|
56
|
-
"@wordpress/url": "^3.
|
|
57
|
-
"@wordpress/viewport": "^5.
|
|
58
|
-
"@wordpress/warning": "^2.
|
|
59
|
-
"@wordpress/widgets": "^3.
|
|
30
|
+
"@wordpress/a11y": "^3.54.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.51.0",
|
|
32
|
+
"@wordpress/block-editor": "^12.22.0",
|
|
33
|
+
"@wordpress/block-library": "^8.31.0",
|
|
34
|
+
"@wordpress/blocks": "^12.31.0",
|
|
35
|
+
"@wordpress/commands": "^0.25.0",
|
|
36
|
+
"@wordpress/components": "^27.2.0",
|
|
37
|
+
"@wordpress/compose": "^6.31.0",
|
|
38
|
+
"@wordpress/core-commands": "^0.23.0",
|
|
39
|
+
"@wordpress/core-data": "^6.31.0",
|
|
40
|
+
"@wordpress/data": "^9.24.0",
|
|
41
|
+
"@wordpress/deprecated": "^3.54.0",
|
|
42
|
+
"@wordpress/dom": "^3.54.0",
|
|
43
|
+
"@wordpress/editor": "^13.31.0",
|
|
44
|
+
"@wordpress/element": "^5.31.0",
|
|
45
|
+
"@wordpress/hooks": "^3.54.0",
|
|
46
|
+
"@wordpress/i18n": "^4.54.0",
|
|
47
|
+
"@wordpress/icons": "^9.45.0",
|
|
48
|
+
"@wordpress/interface": "^5.31.0",
|
|
49
|
+
"@wordpress/keyboard-shortcuts": "^4.31.0",
|
|
50
|
+
"@wordpress/keycodes": "^3.54.0",
|
|
51
|
+
"@wordpress/media-utils": "^4.45.0",
|
|
52
|
+
"@wordpress/notices": "^4.22.0",
|
|
53
|
+
"@wordpress/plugins": "^6.22.0",
|
|
54
|
+
"@wordpress/preferences": "^3.31.0",
|
|
55
|
+
"@wordpress/private-apis": "^0.36.0",
|
|
56
|
+
"@wordpress/url": "^3.55.0",
|
|
57
|
+
"@wordpress/viewport": "^5.31.0",
|
|
58
|
+
"@wordpress/warning": "^2.54.0",
|
|
59
|
+
"@wordpress/widgets": "^3.31.0",
|
|
60
60
|
"classnames": "^2.3.1",
|
|
61
61
|
"memize": "^2.1.0",
|
|
62
62
|
"rememo": "^4.0.2"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "ffc07735d0abfb3f69e91d48f25b7fe8d1ef92d2"
|
|
72
72
|
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
+
import { __, _x } from '@wordpress/i18n';
|
|
6
|
+
import {
|
|
7
|
+
Modal,
|
|
8
|
+
Button,
|
|
9
|
+
__experimentalHStack as HStack,
|
|
10
|
+
__experimentalVStack as VStack,
|
|
11
|
+
ToggleControl,
|
|
12
|
+
TextControl,
|
|
13
|
+
} from '@wordpress/components';
|
|
14
|
+
import { useEffect, useState } from '@wordpress/element';
|
|
15
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
16
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { unlock } from '../../lock-unlock';
|
|
23
|
+
|
|
24
|
+
const { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );
|
|
25
|
+
|
|
26
|
+
export default function InitPatternModal() {
|
|
27
|
+
const { editPost } = useDispatch( editorStore );
|
|
28
|
+
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
29
|
+
const [ syncType, setSyncType ] = useState( undefined );
|
|
30
|
+
const [ title, setTitle ] = useState( '' );
|
|
31
|
+
|
|
32
|
+
const { postType, isNewPost } = useSelect( ( select ) => {
|
|
33
|
+
const { getEditedPostAttribute, isCleanNewPost } =
|
|
34
|
+
select( editorStore );
|
|
35
|
+
return {
|
|
36
|
+
postType: getEditedPostAttribute( 'type' ),
|
|
37
|
+
isNewPost: isCleanNewPost(),
|
|
38
|
+
};
|
|
39
|
+
}, [] );
|
|
40
|
+
|
|
41
|
+
useEffect( () => {
|
|
42
|
+
if ( isNewPost && postType === 'wp_block' ) {
|
|
43
|
+
setIsModalOpen( true );
|
|
44
|
+
}
|
|
45
|
+
// We only want the modal to open when the page is first loaded.
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, [] );
|
|
48
|
+
|
|
49
|
+
if ( postType !== 'wp_block' || ! isNewPost ) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
{ isModalOpen && (
|
|
56
|
+
<Modal
|
|
57
|
+
title={ __( 'Create pattern' ) }
|
|
58
|
+
onRequestClose={ () => {
|
|
59
|
+
setIsModalOpen( false );
|
|
60
|
+
} }
|
|
61
|
+
overlayClassName="reusable-blocks-menu-items__convert-modal"
|
|
62
|
+
>
|
|
63
|
+
<form
|
|
64
|
+
onSubmit={ ( event ) => {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
setIsModalOpen( false );
|
|
67
|
+
editPost( {
|
|
68
|
+
title,
|
|
69
|
+
meta: {
|
|
70
|
+
wp_pattern_sync_status: syncType,
|
|
71
|
+
},
|
|
72
|
+
} );
|
|
73
|
+
} }
|
|
74
|
+
>
|
|
75
|
+
<VStack spacing="5">
|
|
76
|
+
<TextControl
|
|
77
|
+
label={ __( 'Name' ) }
|
|
78
|
+
value={ title }
|
|
79
|
+
onChange={ setTitle }
|
|
80
|
+
placeholder={ __( 'My pattern' ) }
|
|
81
|
+
className="patterns-create-modal__name-input"
|
|
82
|
+
__nextHasNoMarginBottom
|
|
83
|
+
__next40pxDefaultSize
|
|
84
|
+
/>
|
|
85
|
+
<ReusableBlocksRenameHint />
|
|
86
|
+
<ToggleControl
|
|
87
|
+
label={ _x(
|
|
88
|
+
'Synced',
|
|
89
|
+
'Option that makes an individual pattern synchronized'
|
|
90
|
+
) }
|
|
91
|
+
help={ __(
|
|
92
|
+
'Sync this pattern across multiple locations.'
|
|
93
|
+
) }
|
|
94
|
+
checked={ ! syncType }
|
|
95
|
+
onChange={ () => {
|
|
96
|
+
setSyncType(
|
|
97
|
+
! syncType ? 'unsynced' : undefined
|
|
98
|
+
);
|
|
99
|
+
} }
|
|
100
|
+
/>
|
|
101
|
+
<HStack justify="right">
|
|
102
|
+
<Button
|
|
103
|
+
variant="primary"
|
|
104
|
+
type="submit"
|
|
105
|
+
disabled={ ! title }
|
|
106
|
+
__experimentalIsFocusable
|
|
107
|
+
>
|
|
108
|
+
{ __( 'Create' ) }
|
|
109
|
+
</Button>
|
|
110
|
+
</HStack>
|
|
111
|
+
</VStack>
|
|
112
|
+
</form>
|
|
113
|
+
</Modal>
|
|
114
|
+
) }
|
|
115
|
+
</>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
@@ -46,4 +46,8 @@ export const textFormattingShortcuts = [
|
|
|
46
46
|
'Convert the current paragraph or heading to a heading of level 1 to 6.'
|
|
47
47
|
),
|
|
48
48
|
},
|
|
49
|
+
{
|
|
50
|
+
keyCombination: { modifier: 'primaryShift', character: '\u00a0' },
|
|
51
|
+
description: __( 'Add non breaking space.' ),
|
|
52
|
+
},
|
|
49
53
|
];
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
EditorKeyboardShortcutsRegister,
|
|
15
15
|
EditorKeyboardShortcuts,
|
|
16
16
|
EditorSnackbars,
|
|
17
|
-
PostSyncStatusModal,
|
|
18
17
|
store as editorStore,
|
|
19
18
|
privateApis as editorPrivateApis,
|
|
20
19
|
} from '@wordpress/editor';
|
|
@@ -50,6 +49,7 @@ import VisualEditor from '../visual-editor';
|
|
|
50
49
|
import EditPostKeyboardShortcuts from '../keyboard-shortcuts';
|
|
51
50
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
52
51
|
import EditPostPreferencesModal from '../preferences-modal';
|
|
52
|
+
import InitPatternModal from '../init-pattern-modal';
|
|
53
53
|
import BrowserURL from '../browser-url';
|
|
54
54
|
import Header from '../header';
|
|
55
55
|
import SettingsSidebar from '../sidebar/settings-sidebar';
|
|
@@ -381,7 +381,7 @@ function Layout( { initialPost } ) {
|
|
|
381
381
|
<EditPostPreferencesModal />
|
|
382
382
|
<KeyboardShortcutHelpModal />
|
|
383
383
|
<WelcomeGuide />
|
|
384
|
-
<
|
|
384
|
+
<InitPatternModal />
|
|
385
385
|
<StartPageOptions />
|
|
386
386
|
<PluginArea onError={ onPluginAreaError } />
|
|
387
387
|
{ ! isDistractionFree && <SettingsSidebar /> }
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
PostSyncStatus,
|
|
15
15
|
PostURLPanel,
|
|
16
16
|
PostTemplatePanel,
|
|
17
|
+
PostFeaturedImagePanel,
|
|
17
18
|
store as editorStore,
|
|
18
19
|
} from '@wordpress/editor';
|
|
19
20
|
|
|
@@ -60,6 +61,7 @@ export default function PostStatus() {
|
|
|
60
61
|
<PluginPostStatusInfo.Slot>
|
|
61
62
|
{ ( fills ) => (
|
|
62
63
|
<>
|
|
64
|
+
<PostFeaturedImagePanel withPanelBody={ false } />
|
|
63
65
|
<PostVisibility />
|
|
64
66
|
<PostSchedulePanel />
|
|
65
67
|
<PostTemplatePanel />
|
|
@@ -20,9 +20,9 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
|
20
20
|
import {
|
|
21
21
|
store as editorStore,
|
|
22
22
|
PageAttributesPanel,
|
|
23
|
+
PluginDocumentSettingPanel,
|
|
23
24
|
PostDiscussionPanel,
|
|
24
25
|
PostExcerptPanel,
|
|
25
|
-
PostFeaturedImagePanel,
|
|
26
26
|
PostLastRevisionPanel,
|
|
27
27
|
PostTaxonomiesPanel,
|
|
28
28
|
} from '@wordpress/editor';
|
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
import SettingsHeader from '../settings-header';
|
|
34
34
|
import PostStatus from '../post-status';
|
|
35
35
|
import MetaBoxes from '../../meta-boxes';
|
|
36
|
-
import PluginDocumentSettingPanel from '../plugin-document-setting-panel';
|
|
37
36
|
import PluginSidebarEditPost from '../plugin-sidebar';
|
|
38
37
|
import TemplateSummary from '../template-summary';
|
|
39
38
|
import { store as editPostStore } from '../../../store';
|
|
@@ -117,7 +116,6 @@ const SidebarContent = ( {
|
|
|
117
116
|
<PluginDocumentSettingPanel.Slot />
|
|
118
117
|
<PostLastRevisionPanel />
|
|
119
118
|
<PostTaxonomiesPanel />
|
|
120
|
-
<PostFeaturedImagePanel />
|
|
121
119
|
<PostExcerptPanel />
|
|
122
120
|
<PostDiscussionPanel />
|
|
123
121
|
<PageAttributesPanel />
|
package/src/editor.native.js
CHANGED
|
@@ -9,7 +9,11 @@ import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
11
|
import { Component } from '@wordpress/element';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
EditorProvider,
|
|
14
|
+
ErrorBoundary,
|
|
15
|
+
store as editorStore,
|
|
16
|
+
} from '@wordpress/editor';
|
|
13
17
|
import { parse, serialize } from '@wordpress/blocks';
|
|
14
18
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
15
19
|
import { compose } from '@wordpress/compose';
|
|
@@ -143,7 +147,9 @@ class Editor extends Component {
|
|
|
143
147
|
useSubRegistry={ false }
|
|
144
148
|
{ ...props }
|
|
145
149
|
>
|
|
146
|
-
<
|
|
150
|
+
<ErrorBoundary>
|
|
151
|
+
<Layout setTitleRef={ this.setTitleRef } />
|
|
152
|
+
</ErrorBoundary>
|
|
147
153
|
</EditorProvider>
|
|
148
154
|
</SlotFillProvider>
|
|
149
155
|
</GestureHandlerRootView>
|
package/src/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
registerWidgetGroupBlock,
|
|
16
16
|
} from '@wordpress/widgets';
|
|
17
17
|
import {
|
|
18
|
+
PluginDocumentSettingPanel,
|
|
18
19
|
privateApis as editorPrivateApis,
|
|
19
20
|
store as editorStore,
|
|
20
21
|
} from '@wordpress/editor';
|
|
@@ -161,7 +162,7 @@ export function reinitializeEditor() {
|
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
export { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';
|
|
164
|
-
export {
|
|
165
|
+
export { PluginDocumentSettingPanel };
|
|
165
166
|
export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
|
|
166
167
|
export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';
|
|
167
168
|
export { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _plugins = require("@wordpress/plugins");
|
|
11
|
-
var _data = require("@wordpress/data");
|
|
12
|
-
var _warning = _interopRequireDefault(require("@wordpress/warning"));
|
|
13
|
-
var _editor = require("@wordpress/editor");
|
|
14
|
-
var _lockUnlock = require("../../../lock-unlock");
|
|
15
|
-
/**
|
|
16
|
-
* WordPress dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const {
|
|
24
|
-
Fill,
|
|
25
|
-
Slot
|
|
26
|
-
} = (0, _components.createSlotFill)('PluginDocumentSettingPanel');
|
|
27
|
-
const {
|
|
28
|
-
EnablePluginDocumentSettingPanelOption
|
|
29
|
-
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Renders items below the Status & Availability panel in the Document Sidebar.
|
|
33
|
-
*
|
|
34
|
-
* @param {Object} props Component properties.
|
|
35
|
-
* @param {string} props.name Required. A machine-friendly name for the panel.
|
|
36
|
-
* @param {string} [props.className] An optional class name added to the row.
|
|
37
|
-
* @param {string} [props.title] The title of the panel
|
|
38
|
-
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
|
|
39
|
-
* @param {Element} props.children Children to be rendered
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```js
|
|
43
|
-
* // Using ES5 syntax
|
|
44
|
-
* var el = React.createElement;
|
|
45
|
-
* var __ = wp.i18n.__;
|
|
46
|
-
* var registerPlugin = wp.plugins.registerPlugin;
|
|
47
|
-
* var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
|
|
48
|
-
*
|
|
49
|
-
* function MyDocumentSettingPlugin() {
|
|
50
|
-
* return el(
|
|
51
|
-
* PluginDocumentSettingPanel,
|
|
52
|
-
* {
|
|
53
|
-
* className: 'my-document-setting-plugin',
|
|
54
|
-
* title: 'My Panel',
|
|
55
|
-
* name: 'my-panel',
|
|
56
|
-
* },
|
|
57
|
-
* __( 'My Document Setting Panel' )
|
|
58
|
-
* );
|
|
59
|
-
* }
|
|
60
|
-
*
|
|
61
|
-
* registerPlugin( 'my-document-setting-plugin', {
|
|
62
|
-
* render: MyDocumentSettingPlugin
|
|
63
|
-
* } );
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```jsx
|
|
68
|
-
* // Using ESNext syntax
|
|
69
|
-
* import { registerPlugin } from '@wordpress/plugins';
|
|
70
|
-
* import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
|
|
71
|
-
*
|
|
72
|
-
* const MyDocumentSettingTest = () => (
|
|
73
|
-
* <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel">
|
|
74
|
-
* <p>My Document Setting Panel</p>
|
|
75
|
-
* </PluginDocumentSettingPanel>
|
|
76
|
-
* );
|
|
77
|
-
*
|
|
78
|
-
* registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* @return {Component} The component to be rendered.
|
|
82
|
-
*/
|
|
83
|
-
const PluginDocumentSettingPanel = ({
|
|
84
|
-
name,
|
|
85
|
-
className,
|
|
86
|
-
title,
|
|
87
|
-
icon,
|
|
88
|
-
children
|
|
89
|
-
}) => {
|
|
90
|
-
const {
|
|
91
|
-
name: pluginName
|
|
92
|
-
} = (0, _plugins.usePluginContext)();
|
|
93
|
-
const panelName = `${pluginName}/${name}`;
|
|
94
|
-
const {
|
|
95
|
-
opened,
|
|
96
|
-
isEnabled
|
|
97
|
-
} = (0, _data.useSelect)(select => {
|
|
98
|
-
const {
|
|
99
|
-
isEditorPanelOpened,
|
|
100
|
-
isEditorPanelEnabled
|
|
101
|
-
} = select(_editor.store);
|
|
102
|
-
return {
|
|
103
|
-
opened: isEditorPanelOpened(panelName),
|
|
104
|
-
isEnabled: isEditorPanelEnabled(panelName)
|
|
105
|
-
};
|
|
106
|
-
}, [panelName]);
|
|
107
|
-
const {
|
|
108
|
-
toggleEditorPanelOpened
|
|
109
|
-
} = (0, _data.useDispatch)(_editor.store);
|
|
110
|
-
if (undefined === name) {
|
|
111
|
-
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)('PluginDocumentSettingPanel requires a name property.') : void 0;
|
|
112
|
-
}
|
|
113
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(EnablePluginDocumentSettingPanelOption, {
|
|
114
|
-
label: title,
|
|
115
|
-
panelName: panelName
|
|
116
|
-
}), (0, _react.createElement)(Fill, null, isEnabled && (0, _react.createElement)(_components.PanelBody, {
|
|
117
|
-
className: className,
|
|
118
|
-
title: title,
|
|
119
|
-
icon: icon,
|
|
120
|
-
opened: opened,
|
|
121
|
-
onToggle: () => toggleEditorPanelOpened(panelName)
|
|
122
|
-
}, children)));
|
|
123
|
-
};
|
|
124
|
-
PluginDocumentSettingPanel.Slot = Slot;
|
|
125
|
-
var _default = exports.default = PluginDocumentSettingPanel;
|
|
126
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_plugins","_data","_warning","_interopRequireDefault","_editor","_lockUnlock","Fill","Slot","createSlotFill","EnablePluginDocumentSettingPanelOption","unlock","editorPrivateApis","PluginDocumentSettingPanel","name","className","title","icon","children","pluginName","usePluginContext","panelName","opened","isEnabled","useSelect","select","isEditorPanelOpened","isEditorPanelEnabled","editorStore","toggleEditorPanelOpened","useDispatch","undefined","SCRIPT_DEBUG","warning","_react","createElement","Fragment","label","PanelBody","onToggle","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );\nconst { EnablePluginDocumentSettingPanelOption } = unlock( editorPrivateApis );\n\n/**\n * Renders items below the Status & Availability panel in the Document Sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} props.name Required. A machine-friendly name for the panel.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {string} [props.title] The title of the panel\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var __ = wp.i18n.__;\n * var registerPlugin = wp.plugins.registerPlugin;\n * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;\n *\n * function MyDocumentSettingPlugin() {\n * \treturn el(\n * \t\tPluginDocumentSettingPanel,\n * \t\t{\n * \t\t\tclassName: 'my-document-setting-plugin',\n * \t\t\ttitle: 'My Panel',\n * \t\t\tname: 'my-panel',\n * \t\t},\n * \t\t__( 'My Document Setting Panel' )\n * \t);\n * }\n *\n * registerPlugin( 'my-document-setting-plugin', {\n * \t\trender: MyDocumentSettingPlugin\n * } );\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { registerPlugin } from '@wordpress/plugins';\n * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';\n *\n * const MyDocumentSettingTest = () => (\n * \t\t<PluginDocumentSettingPanel className=\"my-document-setting-plugin\" title=\"My Panel\" name=\"my-panel\">\n *\t\t\t<p>My Document Setting Panel</p>\n *\t\t</PluginDocumentSettingPanel>\n *\t);\n *\n * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginDocumentSettingPanel = ( {\n\tname,\n\tclassName,\n\ttitle,\n\ticon,\n\tchildren,\n} ) => {\n\tconst { name: pluginName } = usePluginContext();\n\tconst panelName = `${ pluginName }/${ name }`;\n\tconst { opened, isEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\topened: isEditorPanelOpened( panelName ),\n\t\t\t\tisEnabled: isEditorPanelEnabled( panelName ),\n\t\t\t};\n\t\t},\n\t\t[ panelName ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( undefined === name ) {\n\t\twarning( 'PluginDocumentSettingPanel requires a name property.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<EnablePluginDocumentSettingPanelOption\n\t\t\t\tlabel={ title }\n\t\t\t\tpanelName={ panelName }\n\t\t\t/>\n\t\t\t<Fill>\n\t\t\t\t{ isEnabled && (\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\topened={ opened }\n\t\t\t\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nPluginDocumentSettingPanel.Slot = Slot;\n\nexport default PluginDocumentSettingPanel;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAQA,IAAAM,WAAA,GAAAN,OAAA;AAfA;AACA;AACA;;AAUA;AACA;AACA;;AAGA,MAAM;EAAEO,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAAE,4BAA6B,CAAC;AACrE,MAAM;EAAEC;AAAuC,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CAAE;EACpC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