@wordpress/edit-post 6.9.0 → 6.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/components/header/header-toolbar/index.js +7 -6
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/template-title/delete-template.js +1 -1
- package/build/components/header/template-title/delete-template.js.map +1 -1
- package/build/components/header/template-title/edit-template-title.js +11 -2
- package/build/components/header/template-title/edit-template-title.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +3 -26
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/post-format/index.js +3 -1
- package/build/components/sidebar/post-format/index.js.map +1 -1
- package/build/components/sidebar/post-schedule/index.js +28 -12
- package/build/components/sidebar/post-schedule/index.js.map +1 -1
- package/build/components/sidebar/post-slug/index.js +3 -1
- package/build/components/sidebar/post-slug/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/post-template/create-modal.js +1 -1
- package/build/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build/components/sidebar/post-template/form.js +1 -1
- package/build/components/sidebar/post-template/form.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +17 -14
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/post-url/index.js +68 -0
- package/build/components/sidebar/post-url/index.js.map +1 -0
- package/build/components/sidebar/post-visibility/index.js +21 -6
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +2 -4
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/visual-editor/index.js +11 -5
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +7 -2
- package/build/editor.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +8 -6
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/template-title/delete-template.js +1 -1
- package/build-module/components/header/template-title/delete-template.js.map +1 -1
- package/build-module/components/header/template-title/edit-template-title.js +12 -2
- package/build-module/components/header/template-title/edit-template-title.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +3 -25
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/post-format/index.js +3 -1
- package/build-module/components/sidebar/post-format/index.js.map +1 -1
- package/build-module/components/sidebar/post-schedule/index.js +31 -15
- package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
- package/build-module/components/sidebar/post-slug/index.js +3 -1
- package/build-module/components/sidebar/post-slug/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +2 -1
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build-module/components/sidebar/post-template/form.js +1 -1
- package/build-module/components/sidebar/post-template/form.js.map +1 -1
- package/build-module/components/sidebar/post-template/index.js +16 -14
- package/build-module/components/sidebar/post-template/index.js.map +1 -1
- package/build-module/components/sidebar/post-url/index.js +59 -0
- package/build-module/components/sidebar/post-url/index.js.map +1 -0
- package/build-module/components/sidebar/post-visibility/index.js +24 -8
- package/build-module/components/sidebar/post-visibility/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/components/visual-editor/index.js +12 -6
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +7 -2
- package/build-module/editor.js.map +1 -1
- package/build-style/style-rtl.css +35 -56
- package/build-style/style.css +35 -60
- package/package.json +27 -27
- package/src/components/header/header-toolbar/index.js +10 -10
- package/src/components/header/header-toolbar/style.scss +2 -5
- package/src/components/header/style.scss +0 -6
- package/src/components/header/template-title/delete-template.js +1 -1
- package/src/components/header/template-title/edit-template-title.js +11 -1
- package/src/components/keyboard-shortcut-help-modal/index.js +1 -2
- package/src/components/keyboard-shortcut-help-modal/style.scss +0 -5
- package/src/components/preferences-modal/index.js +5 -23
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +28 -0
- package/src/components/preferences-modal/test/index.js +3 -3
- package/src/components/sidebar/post-author/style.scss +4 -10
- package/src/components/sidebar/post-format/index.js +1 -1
- package/src/components/sidebar/post-format/style.scss +5 -0
- package/src/components/sidebar/post-schedule/index.js +26 -17
- package/src/components/sidebar/post-schedule/style.scss +0 -2
- package/src/components/sidebar/post-slug/index.js +1 -1
- package/src/components/sidebar/post-slug/style.scss +4 -3
- package/src/components/sidebar/post-status/index.js +3 -1
- package/src/components/sidebar/post-template/create-modal.js +1 -1
- package/src/components/sidebar/post-template/form.js +4 -1
- package/src/components/sidebar/post-template/index.js +13 -9
- package/src/components/sidebar/post-template/style.scss +0 -10
- package/src/components/sidebar/post-url/index.js +51 -0
- package/src/components/sidebar/post-url/style.scss +23 -0
- package/src/components/sidebar/post-visibility/index.js +22 -8
- package/src/components/sidebar/settings-sidebar/index.js +1 -3
- package/src/components/sidebar/template/style.scss +35 -0
- package/src/components/start-page-options/style.scss +0 -9
- package/src/components/visual-editor/index.js +26 -21
- package/src/editor.js +6 -2
- package/src/style.scss +2 -1
- package/build/components/sidebar/post-link/index.js +0 -182
- package/build/components/sidebar/post-link/index.js.map +0 -1
- package/build-module/components/sidebar/post-link/index.js +0 -165
- package/build-module/components/sidebar/post-link/index.js.map +0 -1
- package/src/components/sidebar/post-link/index.js +0 -179
- package/src/components/sidebar/post-link/style.scss +0 -20
package/build-module/editor.js
CHANGED
|
@@ -38,6 +38,7 @@ function Editor(_ref) {
|
|
|
38
38
|
hasFixedToolbar,
|
|
39
39
|
focusMode,
|
|
40
40
|
hasReducedUI,
|
|
41
|
+
hasInlineToolbar,
|
|
41
42
|
hasThemeStyles,
|
|
42
43
|
post,
|
|
43
44
|
preferredStyleVariations,
|
|
@@ -59,7 +60,8 @@ function Editor(_ref) {
|
|
|
59
60
|
const {
|
|
60
61
|
getEntityRecord,
|
|
61
62
|
getPostType,
|
|
62
|
-
getEntityRecords
|
|
63
|
+
getEntityRecords,
|
|
64
|
+
canUser
|
|
63
65
|
} = select(coreStore);
|
|
64
66
|
const {
|
|
65
67
|
getEditorSettings
|
|
@@ -83,17 +85,19 @@ function Editor(_ref) {
|
|
|
83
85
|
|
|
84
86
|
const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
|
|
85
87
|
const isViewable = (_getPostType$viewable = (_getPostType = getPostType(postType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
|
|
88
|
+
const canEditTemplate = canUser('create', 'templates');
|
|
86
89
|
return {
|
|
87
90
|
hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
|
|
88
91
|
focusMode: isFeatureActive('focusMode'),
|
|
89
92
|
hasReducedUI: isFeatureActive('reducedUI'),
|
|
93
|
+
hasInlineToolbar: isFeatureActive('inlineToolbar'),
|
|
90
94
|
hasThemeStyles: isFeatureActive('themeStyles'),
|
|
91
95
|
preferredStyleVariations: select(preferencesStore).get('core/edit-post', 'preferredStyleVariations'),
|
|
92
96
|
hiddenBlockTypes: getHiddenBlockTypes(),
|
|
93
97
|
blockTypes: getBlockTypes(),
|
|
94
98
|
keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'),
|
|
95
99
|
isTemplateMode: isEditingTemplate(),
|
|
96
|
-
template: supportsTemplateMode && isViewable ? getEditedPostTemplate() : null,
|
|
100
|
+
template: supportsTemplateMode && isViewable && canEditTemplate ? getEditedPostTemplate() : null,
|
|
97
101
|
post: postObject
|
|
98
102
|
};
|
|
99
103
|
}, [postType, postId]);
|
|
@@ -110,6 +114,7 @@ function Editor(_ref) {
|
|
|
110
114
|
hasFixedToolbar,
|
|
111
115
|
focusMode,
|
|
112
116
|
hasReducedUI,
|
|
117
|
+
hasInlineToolbar,
|
|
113
118
|
// This is marked as experimental to give time for the quick inserter to mature.
|
|
114
119
|
__experimentalSetIsInserterOpened: setIsInserterOpened,
|
|
115
120
|
keepCaretInsideBlock,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["forEach","map","without","store","blocksStore","useSelect","useDispatch","EditorProvider","ErrorBoundary","PostLockedModal","editorStore","StrictMode","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","Layout","EditorInitialization","editPostStore","Editor","postId","postType","settings","initialEdits","onError","props","hasFixedToolbar","focusMode","hasReducedUI","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","styles","themeStyles","presetStyles","style","__unstableType","push","defaultEditorStyles","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,GAAlB,EAAuBC,OAAvB,QAAsC,QAAtC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,cADD,EAECC,aAFD,EAGCC,eAHD,EAICN,KAAK,IAAIO,WAJV,QAKO,mBALP;AAMA,SAASC,UAAT,EAAqBC,OAArB,QAAoC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AAK,CAACC,cAAR,IAA0BD,KAAK,CAACC,cAAN,KAAyB,OAAxD,EAAkE;AACjEH,QAAAA,WAAW,CAACI,IAAZ,CAAkBF,KAAlB;AACA,OAFD,MAEO;AACND,QAAAA,YAAY,CAACG,IAAb,CAAmBF,KAAnB;AACA;AACD,KANM,CAAP;AAOA,UAAMG,mBAAmB,GAAG,CAC3B,GAAGpD,QAAQ,CAACoD,mBADe,EAE3B,GAAGJ,YAFwB,CAA5B;AAIA,WAAOzC,cAAc,IAAIwC,WAAW,CAACF,MAA9B,GACJ7C,QAAQ,CAAC8C,MADL,GAEJM,mBAFH;AAGA,GAjBqB,EAiBnB,CAAEpD,QAAF,EAAYO,cAAZ,CAjBmB,CAAtB;;AAmBA,MAAK,CAAEC,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,cAAC,UAAD,QACC,cAAC,gBAAD,QACC,cAAC,gBAAD,QACC,cAAC,cAAD;AACC,IAAA,QAAQ,EAAG6B,cADZ;AAEC,IAAA,IAAI,EAAG7B,IAFR;AAGC,IAAA,YAAY,EAAGP,YAHhB;AAIC,IAAA,cAAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EACjBY,cAAc,GAAGC,QAAH,GAAcuC;AAN9B,KAQMlD,KARN,GAUC,cAAC,aAAD;AAAe,IAAA,OAAO,EAAGD;AAAzB,KACC,cAAC,oBAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IADD,EAEC,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGgD;AAAjB,IAFD,CAVD,EAcC,cAAC,eAAD,OAdD,CADD,CADD,CADD,CADD;AAwBA;;AAED,eAAejD,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { forEach, map, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tEditorProvider,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { StrictMode, useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\n\nfunction Editor( {\n\tpostId,\n\tpostType,\n\tsettings,\n\tinitialEdits,\n\tonError,\n\t...props\n} ) {\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\thasReducedUI: isFeatureActive( 'reducedUI' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thasReducedUI,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? map( blockTypes, 'name' )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = without(\n\t\t\t\tdefaultAllowedBlockTypes,\n\t\t\t\t...hiddenBlockTypes\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tforEach( settings.styles, ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StrictMode>\n\t\t\t<ShortcutProvider>\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={ post }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\t\tisTemplateMode ? template : undefined\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\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</ShortcutProvider>\n\t\t</StrictMode>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["forEach","map","without","store","blocksStore","useSelect","useDispatch","EditorProvider","ErrorBoundary","PostLockedModal","editorStore","StrictMode","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","Layout","EditorInitialization","editPostStore","Editor","postId","postType","settings","initialEdits","onError","props","hasFixedToolbar","focusMode","hasReducedUI","hasInlineToolbar","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","styles","themeStyles","presetStyles","style","__unstableType","push","defaultEditorStyles","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,GAAlB,EAAuBC,OAAvB,QAAsC,QAAtC;AAEA;AACA;AACA;;AACA,SAASC,KAA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AzB,KACC,cAAC,oBAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IADD,EAEC,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGmD;AAAjB,IAFD,CAVD,EAcC,cAAC,eAAD,OAdD,CADD,CADD,CADD,CADD;AAwBA;;AAED,eAAepD,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { forEach, map, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tEditorProvider,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { StrictMode, useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\n\nfunction Editor( {\n\tpostId,\n\tpostType,\n\tsettings,\n\tinitialEdits,\n\tonError,\n\t...props\n} ) {\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thasInlineToolbar,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\thasReducedUI: isFeatureActive( 'reducedUI' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thasReducedUI,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? map( blockTypes, 'name' )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = without(\n\t\t\t\tdefaultAllowedBlockTypes,\n\t\t\t\t...hiddenBlockTypes\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tforEach( settings.styles, ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StrictMode>\n\t\t\t<ShortcutProvider>\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={ post }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\t\tisTemplateMode ? template : undefined\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\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</ShortcutProvider>\n\t\t</StrictMode>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
@@ -468,9 +468,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
468
468
|
.interface-preferences-modal .components-modal__content {
|
|
469
469
|
padding: 0;
|
|
470
470
|
}
|
|
471
|
-
.interface-preferences-modal .components-modal__content::before {
|
|
472
|
-
content: none;
|
|
473
|
-
}
|
|
474
471
|
}
|
|
475
472
|
|
|
476
473
|
.interface-preferences__tabs .components-tab-panel__tabs {
|
|
@@ -689,11 +686,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
689
686
|
padding-left: 12px;
|
|
690
687
|
}
|
|
691
688
|
}
|
|
692
|
-
.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
|
|
693
|
-
.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
|
|
694
|
-
.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after {
|
|
695
|
-
content: none;
|
|
696
|
-
}
|
|
697
689
|
.show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft::after,
|
|
698
690
|
.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft::after,
|
|
699
691
|
.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft::after {
|
|
@@ -910,11 +902,8 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
910
902
|
padding: 0;
|
|
911
903
|
}
|
|
912
904
|
.show-icon-labels .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-icon {
|
|
913
|
-
height: 36px;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-text.has-icon {
|
|
917
905
|
width: auto;
|
|
906
|
+
height: 36px;
|
|
918
907
|
padding: 0 8px;
|
|
919
908
|
}
|
|
920
909
|
|
|
@@ -1008,9 +997,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
1008
997
|
.edit-post-keyboard-shortcut-help-modal__section {
|
|
1009
998
|
margin: 0 0 2rem 0;
|
|
1010
999
|
}
|
|
1011
|
-
.edit-post-keyboard-shortcut-help-modal__main-shortcuts .edit-post-keyboard-shortcut-help-modal__shortcut-list {
|
|
1012
|
-
margin-top: -25px;
|
|
1013
|
-
}
|
|
1014
1000
|
.edit-post-keyboard-shortcut-help-modal__section-title {
|
|
1015
1001
|
font-size: 0.9rem;
|
|
1016
1002
|
font-weight: 600;
|
|
@@ -1430,44 +1416,27 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1430
1416
|
padding: 16px;
|
|
1431
1417
|
}
|
|
1432
1418
|
|
|
1433
|
-
.
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
@supports (position: sticky) {
|
|
1438
|
-
.editor-post-author__select {
|
|
1439
|
-
width: auto;
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
.edit-post-post-link__link-post-name {
|
|
1444
|
-
font-weight: 600;
|
|
1419
|
+
.edit-post-post-author {
|
|
1420
|
+
display: flex;
|
|
1421
|
+
flex-direction: column;
|
|
1422
|
+
align-items: stretch;
|
|
1445
1423
|
}
|
|
1446
1424
|
|
|
1447
|
-
.edit-post-post-
|
|
1448
|
-
|
|
1449
|
-
|
|
1425
|
+
.edit-post-post-format {
|
|
1426
|
+
display: flex;
|
|
1427
|
+
flex-direction: column;
|
|
1428
|
+
align-items: stretch;
|
|
1450
1429
|
}
|
|
1451
1430
|
|
|
1452
|
-
.edit-post-post-link__link {
|
|
1453
|
-
text-align: right;
|
|
1454
|
-
word-wrap: break-word;
|
|
1455
|
-
display: block;
|
|
1456
|
-
}
|
|
1457
|
-
.edit-post-post-link__preview-link-container {
|
|
1458
|
-
direction: ltr;
|
|
1459
|
-
}
|
|
1460
1431
|
.edit-post-post-schedule {
|
|
1461
1432
|
width: 100%;
|
|
1462
1433
|
position: relative;
|
|
1463
1434
|
justify-content: flex-start;
|
|
1464
|
-
align-items: flex-start;
|
|
1465
1435
|
}
|
|
1466
1436
|
.edit-post-post-schedule span {
|
|
1467
1437
|
display: block;
|
|
1468
1438
|
width: 45%;
|
|
1469
1439
|
flex-shrink: 0;
|
|
1470
|
-
padding: 6px 0;
|
|
1471
1440
|
}
|
|
1472
1441
|
|
|
1473
1442
|
.components-button.edit-post-post-schedule__toggle {
|
|
@@ -1483,9 +1452,10 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1483
1452
|
margin: 8px;
|
|
1484
1453
|
}
|
|
1485
1454
|
|
|
1486
|
-
.
|
|
1487
|
-
|
|
1488
|
-
|
|
1455
|
+
.edit-post-post-slug {
|
|
1456
|
+
display: flex;
|
|
1457
|
+
flex-direction: column;
|
|
1458
|
+
align-items: stretch;
|
|
1489
1459
|
}
|
|
1490
1460
|
|
|
1491
1461
|
.edit-post-post-status .edit-post-post-publish-dropdown__switch-to-draft {
|
|
@@ -1523,19 +1493,34 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1523
1493
|
margin: 8px;
|
|
1524
1494
|
}
|
|
1525
1495
|
|
|
1526
|
-
.edit-post-post-template__create-modal .components-modal__header {
|
|
1527
|
-
border-bottom: none;
|
|
1528
|
-
}
|
|
1529
|
-
.edit-post-post-template__create-modal .components-modal__content::before {
|
|
1530
|
-
margin-bottom: 4px;
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
1496
|
@media (min-width: 782px) {
|
|
1534
1497
|
.edit-post-post-template__create-form {
|
|
1535
1498
|
width: 320px;
|
|
1536
1499
|
}
|
|
1537
1500
|
}
|
|
1538
1501
|
|
|
1502
|
+
.edit-post-post-url {
|
|
1503
|
+
width: 100%;
|
|
1504
|
+
justify-content: flex-start;
|
|
1505
|
+
}
|
|
1506
|
+
.edit-post-post-url span {
|
|
1507
|
+
display: block;
|
|
1508
|
+
width: 45%;
|
|
1509
|
+
flex-shrink: 0;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
.components-button.edit-post-post-url__toggle {
|
|
1513
|
+
text-align: right;
|
|
1514
|
+
white-space: normal;
|
|
1515
|
+
height: auto;
|
|
1516
|
+
word-break: break-word;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
.edit-post-post-url__dialog .editor-post-url {
|
|
1520
|
+
min-width: 248px;
|
|
1521
|
+
margin: 8px;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1539
1524
|
.edit-post-post-visibility {
|
|
1540
1525
|
width: 100%;
|
|
1541
1526
|
justify-content: flex-start;
|
|
@@ -1769,12 +1754,6 @@ h2.edit-post-template-summary__title {
|
|
|
1769
1754
|
height: 70%;
|
|
1770
1755
|
}
|
|
1771
1756
|
}
|
|
1772
|
-
.edit-post-start-page-options__modal .components-modal__header {
|
|
1773
|
-
border-bottom: none;
|
|
1774
|
-
}
|
|
1775
|
-
.edit-post-start-page-options__modal .components-modal__content::before {
|
|
1776
|
-
content: none;
|
|
1777
|
-
}
|
|
1778
1757
|
|
|
1779
1758
|
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
1780
1759
|
column-count: 2;
|
package/build-style/style.css
CHANGED
|
@@ -468,9 +468,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
468
468
|
.interface-preferences-modal .components-modal__content {
|
|
469
469
|
padding: 0;
|
|
470
470
|
}
|
|
471
|
-
.interface-preferences-modal .components-modal__content::before {
|
|
472
|
-
content: none;
|
|
473
|
-
}
|
|
474
471
|
}
|
|
475
472
|
|
|
476
473
|
.interface-preferences__tabs .components-tab-panel__tabs {
|
|
@@ -689,11 +686,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
689
686
|
padding-right: 12px;
|
|
690
687
|
}
|
|
691
688
|
}
|
|
692
|
-
.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
|
|
693
|
-
.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
|
|
694
|
-
.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after {
|
|
695
|
-
content: none;
|
|
696
|
-
}
|
|
697
689
|
.show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft::after,
|
|
698
690
|
.show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft::after,
|
|
699
691
|
.edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft::after {
|
|
@@ -910,11 +902,8 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
910
902
|
padding: 0;
|
|
911
903
|
}
|
|
912
904
|
.show-icon-labels .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-icon {
|
|
913
|
-
height: 36px;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-text.has-icon {
|
|
917
905
|
width: auto;
|
|
906
|
+
height: 36px;
|
|
918
907
|
padding: 0 8px;
|
|
919
908
|
}
|
|
920
909
|
|
|
@@ -1008,9 +997,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
1008
997
|
.edit-post-keyboard-shortcut-help-modal__section {
|
|
1009
998
|
margin: 0 0 2rem 0;
|
|
1010
999
|
}
|
|
1011
|
-
.edit-post-keyboard-shortcut-help-modal__main-shortcuts .edit-post-keyboard-shortcut-help-modal__shortcut-list {
|
|
1012
|
-
margin-top: -25px;
|
|
1013
|
-
}
|
|
1014
1000
|
.edit-post-keyboard-shortcut-help-modal__section-title {
|
|
1015
1001
|
font-size: 0.9rem;
|
|
1016
1002
|
font-weight: 600;
|
|
@@ -1430,48 +1416,27 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1430
1416
|
padding: 16px;
|
|
1431
1417
|
}
|
|
1432
1418
|
|
|
1433
|
-
.
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
@supports (position: sticky) {
|
|
1438
|
-
.editor-post-author__select {
|
|
1439
|
-
width: auto;
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
.edit-post-post-link__link-post-name {
|
|
1444
|
-
font-weight: 600;
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
.edit-post-post-link__preview-label {
|
|
1448
|
-
font-weight: 400;
|
|
1449
|
-
margin: 0;
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
|
-
.edit-post-post-link__link {
|
|
1453
|
-
text-align: left;
|
|
1454
|
-
word-wrap: break-word;
|
|
1455
|
-
display: block;
|
|
1419
|
+
.edit-post-post-author {
|
|
1420
|
+
display: flex;
|
|
1421
|
+
flex-direction: column;
|
|
1422
|
+
align-items: stretch;
|
|
1456
1423
|
}
|
|
1457
1424
|
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
direction:
|
|
1425
|
+
.edit-post-post-format {
|
|
1426
|
+
display: flex;
|
|
1427
|
+
flex-direction: column;
|
|
1428
|
+
align-items: stretch;
|
|
1461
1429
|
}
|
|
1462
1430
|
|
|
1463
|
-
/* rtl:end:ignore */
|
|
1464
1431
|
.edit-post-post-schedule {
|
|
1465
1432
|
width: 100%;
|
|
1466
1433
|
position: relative;
|
|
1467
1434
|
justify-content: flex-start;
|
|
1468
|
-
align-items: flex-start;
|
|
1469
1435
|
}
|
|
1470
1436
|
.edit-post-post-schedule span {
|
|
1471
1437
|
display: block;
|
|
1472
1438
|
width: 45%;
|
|
1473
1439
|
flex-shrink: 0;
|
|
1474
|
-
padding: 6px 0;
|
|
1475
1440
|
}
|
|
1476
1441
|
|
|
1477
1442
|
.components-button.edit-post-post-schedule__toggle {
|
|
@@ -1487,9 +1452,10 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1487
1452
|
margin: 8px;
|
|
1488
1453
|
}
|
|
1489
1454
|
|
|
1490
|
-
.
|
|
1491
|
-
|
|
1492
|
-
|
|
1455
|
+
.edit-post-post-slug {
|
|
1456
|
+
display: flex;
|
|
1457
|
+
flex-direction: column;
|
|
1458
|
+
align-items: stretch;
|
|
1493
1459
|
}
|
|
1494
1460
|
|
|
1495
1461
|
.edit-post-post-status .edit-post-post-publish-dropdown__switch-to-draft {
|
|
@@ -1527,19 +1493,34 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1527
1493
|
margin: 8px;
|
|
1528
1494
|
}
|
|
1529
1495
|
|
|
1530
|
-
.edit-post-post-template__create-modal .components-modal__header {
|
|
1531
|
-
border-bottom: none;
|
|
1532
|
-
}
|
|
1533
|
-
.edit-post-post-template__create-modal .components-modal__content::before {
|
|
1534
|
-
margin-bottom: 4px;
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
1496
|
@media (min-width: 782px) {
|
|
1538
1497
|
.edit-post-post-template__create-form {
|
|
1539
1498
|
width: 320px;
|
|
1540
1499
|
}
|
|
1541
1500
|
}
|
|
1542
1501
|
|
|
1502
|
+
.edit-post-post-url {
|
|
1503
|
+
width: 100%;
|
|
1504
|
+
justify-content: flex-start;
|
|
1505
|
+
}
|
|
1506
|
+
.edit-post-post-url span {
|
|
1507
|
+
display: block;
|
|
1508
|
+
width: 45%;
|
|
1509
|
+
flex-shrink: 0;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
.components-button.edit-post-post-url__toggle {
|
|
1513
|
+
text-align: left;
|
|
1514
|
+
white-space: normal;
|
|
1515
|
+
height: auto;
|
|
1516
|
+
word-break: break-word;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
.edit-post-post-url__dialog .editor-post-url {
|
|
1520
|
+
min-width: 248px;
|
|
1521
|
+
margin: 8px;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1543
1524
|
.edit-post-post-visibility {
|
|
1544
1525
|
width: 100%;
|
|
1545
1526
|
justify-content: flex-start;
|
|
@@ -1773,12 +1754,6 @@ h2.edit-post-template-summary__title {
|
|
|
1773
1754
|
height: 70%;
|
|
1774
1755
|
}
|
|
1775
1756
|
}
|
|
1776
|
-
.edit-post-start-page-options__modal .components-modal__header {
|
|
1777
|
-
border-bottom: none;
|
|
1778
|
-
}
|
|
1779
|
-
.edit-post-start-page-options__modal .components-modal__content::before {
|
|
1780
|
-
content: none;
|
|
1781
|
-
}
|
|
1782
1757
|
|
|
1783
1758
|
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
1784
1759
|
column-count: 2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.12.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,31 +27,31 @@
|
|
|
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": "^9.
|
|
33
|
-
"@wordpress/block-library": "^7.
|
|
34
|
-
"@wordpress/blocks": "^11.
|
|
35
|
-
"@wordpress/components": "^19.
|
|
36
|
-
"@wordpress/compose": "^5.
|
|
37
|
-
"@wordpress/core-data": "^4.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/editor": "^12.
|
|
41
|
-
"@wordpress/element": "^4.
|
|
42
|
-
"@wordpress/hooks": "^3.
|
|
43
|
-
"@wordpress/i18n": "^4.
|
|
44
|
-
"@wordpress/icons": "^9.
|
|
45
|
-
"@wordpress/interface": "^4.
|
|
46
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
47
|
-
"@wordpress/keycodes": "^3.
|
|
48
|
-
"@wordpress/media-utils": "^4.
|
|
49
|
-
"@wordpress/notices": "^3.
|
|
50
|
-
"@wordpress/plugins": "^4.
|
|
51
|
-
"@wordpress/preferences": "^2.
|
|
52
|
-
"@wordpress/url": "^3.
|
|
53
|
-
"@wordpress/viewport": "^4.
|
|
54
|
-
"@wordpress/warning": "^2.
|
|
30
|
+
"@wordpress/a11y": "^3.15.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.12.0",
|
|
32
|
+
"@wordpress/block-editor": "^9.7.0",
|
|
33
|
+
"@wordpress/block-library": "^7.12.0",
|
|
34
|
+
"@wordpress/blocks": "^11.14.0",
|
|
35
|
+
"@wordpress/components": "^19.17.0",
|
|
36
|
+
"@wordpress/compose": "^5.13.0",
|
|
37
|
+
"@wordpress/core-data": "^4.13.0",
|
|
38
|
+
"@wordpress/data": "^6.15.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.15.0",
|
|
40
|
+
"@wordpress/editor": "^12.14.0",
|
|
41
|
+
"@wordpress/element": "^4.13.0",
|
|
42
|
+
"@wordpress/hooks": "^3.15.0",
|
|
43
|
+
"@wordpress/i18n": "^4.15.0",
|
|
44
|
+
"@wordpress/icons": "^9.6.0",
|
|
45
|
+
"@wordpress/interface": "^4.14.0",
|
|
46
|
+
"@wordpress/keyboard-shortcuts": "^3.13.0",
|
|
47
|
+
"@wordpress/keycodes": "^3.15.0",
|
|
48
|
+
"@wordpress/media-utils": "^4.6.0",
|
|
49
|
+
"@wordpress/notices": "^3.15.0",
|
|
50
|
+
"@wordpress/plugins": "^4.13.0",
|
|
51
|
+
"@wordpress/preferences": "^2.7.0",
|
|
52
|
+
"@wordpress/url": "^3.16.0",
|
|
53
|
+
"@wordpress/viewport": "^4.13.0",
|
|
54
|
+
"@wordpress/warning": "^2.15.0",
|
|
55
55
|
"classnames": "^2.3.1",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
57
|
"memize": "^1.1.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "08358f53b627a15148c3a3e433cdf58cf8714aa4"
|
|
68
68
|
}
|
|
@@ -106,6 +106,14 @@ function HeaderToolbar() {
|
|
|
106
106
|
setIsInserterOpened( true );
|
|
107
107
|
}
|
|
108
108
|
}, [ isInserterOpened, setIsInserterOpened ] );
|
|
109
|
+
|
|
110
|
+
/* translators: button label text should, if possible, be under 16 characters. */
|
|
111
|
+
const longLabel = _x(
|
|
112
|
+
'Toggle block inserter',
|
|
113
|
+
'Generic label for block inserter button'
|
|
114
|
+
);
|
|
115
|
+
const shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );
|
|
116
|
+
|
|
109
117
|
return (
|
|
110
118
|
<NavigableToolbar
|
|
111
119
|
className="edit-post-header-toolbar"
|
|
@@ -122,17 +130,9 @@ function HeaderToolbar() {
|
|
|
122
130
|
onClick={ openInserter }
|
|
123
131
|
disabled={ ! isInserterEnabled }
|
|
124
132
|
icon={ plus }
|
|
125
|
-
|
|
126
|
-
characters. */
|
|
127
|
-
label={ _x(
|
|
128
|
-
'Toggle block inserter',
|
|
129
|
-
'Generic label for block inserter button'
|
|
130
|
-
) }
|
|
133
|
+
label={ showIconLabels ? shortLabel : longLabel }
|
|
131
134
|
showTooltip={ ! showIconLabels }
|
|
132
|
-
|
|
133
|
-
{ showIconLabels &&
|
|
134
|
-
( ! isInserterOpened ? __( 'Add' ) : __( 'Close' ) ) }
|
|
135
|
-
</ToolbarItem>
|
|
135
|
+
/>
|
|
136
136
|
{ ( isWideViewport || ! showIconLabels ) && (
|
|
137
137
|
<>
|
|
138
138
|
{ isLargeViewport && (
|
|
@@ -101,15 +101,12 @@
|
|
|
101
101
|
padding: 0;
|
|
102
102
|
|
|
103
103
|
.show-icon-labels & {
|
|
104
|
+
width: auto;
|
|
104
105
|
height: 36px;
|
|
106
|
+
padding: 0 $grid-unit-10;
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-text.has-icon {
|
|
109
|
-
width: auto;
|
|
110
|
-
padding: 0 $grid-unit-10;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
110
|
.show-icon-labels .edit-post-header-toolbar__left > * + * {
|
|
114
111
|
margin-left: $grid-unit-10;
|
|
115
112
|
}
|
|
@@ -146,12 +146,6 @@
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
// The inserter has a custom label, different from its aria-label, so we don't want to display both.
|
|
150
|
-
.edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle {
|
|
151
|
-
&::after {
|
|
152
|
-
content: none;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
149
|
// The post saved state button has a custom label only on small breakpoint
|
|
156
150
|
.editor-post-save-draft.editor-post-save-draft {
|
|
157
151
|
&::after {
|
|
@@ -9,6 +9,7 @@ import { mapValues } from 'lodash';
|
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
import { TextControl } from '@wordpress/components';
|
|
11
11
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
|
+
import { useState } from '@wordpress/element';
|
|
12
13
|
import { store as editorStore } from '@wordpress/editor';
|
|
13
14
|
import { store as coreStore } from '@wordpress/core-data';
|
|
14
15
|
|
|
@@ -18,6 +19,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
18
19
|
import { store as editPostStore } from '../../../store';
|
|
19
20
|
|
|
20
21
|
export default function EditTemplateTitle() {
|
|
22
|
+
const [ forceEmpty, setForceEmpty ] = useState( false );
|
|
21
23
|
const { template } = useSelect( ( select ) => {
|
|
22
24
|
const { getEditedPostTemplate } = select( editPostStore );
|
|
23
25
|
return {
|
|
@@ -45,11 +47,18 @@ export default function EditTemplateTitle() {
|
|
|
45
47
|
<div className="edit-site-template-details__group">
|
|
46
48
|
<TextControl
|
|
47
49
|
label={ __( 'Title' ) }
|
|
48
|
-
value={ templateTitle }
|
|
50
|
+
value={ forceEmpty ? '' : templateTitle }
|
|
49
51
|
help={ __(
|
|
50
52
|
'Give the template a title that indicates its purpose, e.g. "Full Width".'
|
|
51
53
|
) }
|
|
52
54
|
onChange={ ( newTitle ) => {
|
|
55
|
+
// Allow having the field temporarily empty while typing.
|
|
56
|
+
if ( ! newTitle && ! forceEmpty ) {
|
|
57
|
+
setForceEmpty( true );
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
setForceEmpty( false );
|
|
61
|
+
|
|
53
62
|
const settings = getEditorSettings();
|
|
54
63
|
const newAvailableTemplates = mapValues(
|
|
55
64
|
settings.availableTemplates,
|
|
@@ -68,6 +77,7 @@ export default function EditTemplateTitle() {
|
|
|
68
77
|
title: newTitle,
|
|
69
78
|
} );
|
|
70
79
|
} }
|
|
80
|
+
onBlur={ () => setForceEmpty( false ) }
|
|
71
81
|
/>
|
|
72
82
|
</div>
|
|
73
83
|
);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { isString } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -41,7 +40,7 @@ const ShortcutList = ( { shortcuts } ) => (
|
|
|
41
40
|
className="edit-post-keyboard-shortcut-help-modal__shortcut"
|
|
42
41
|
key={ index }
|
|
43
42
|
>
|
|
44
|
-
{
|
|
43
|
+
{ typeof shortcut === 'string' ? (
|
|
45
44
|
<DynamicShortcut name={ shortcut } />
|
|
46
45
|
) : (
|
|
47
46
|
<Shortcut { ...shortcut } />
|
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
margin: 0 0 2rem 0;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
&__main-shortcuts .edit-post-keyboard-shortcut-help-modal__shortcut-list {
|
|
7
|
-
// Push the shortcut to be flush with top modal header.
|
|
8
|
-
margin-top: -$grid-unit-30 -$border-width;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
6
|
&__section-title {
|
|
12
7
|
font-size: 0.9rem;
|
|
13
8
|
font-weight: 600;
|