@wordpress/editor 14.0.1 → 14.0.2
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/build/components/document-tools/index.js +12 -3
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +4 -12
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/global-styles-provider/index.js +9 -2
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/post-actions/actions.js +1 -1
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-trash/index.js +1 -0
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-visibility/index.js +1 -0
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/template-validation-notice/index.js +1 -0
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js +1 -0
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/hooks/pattern-overrides.js +2 -1
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build-module/components/document-tools/index.js +12 -3
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +6 -14
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +9 -2
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +1 -1
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-trash/index.js +1 -0
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-visibility/index.js +1 -0
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +1 -0
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -0
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +2 -1
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-style/style-rtl.css +1 -15
- package/build-style/style.css +1 -15
- package/package.json +18 -18
- package/src/components/document-tools/index.js +13 -4
- package/src/components/entities-saved-states/entity-record-item.js +4 -14
- package/src/components/entities-saved-states/style.scss +0 -13
- package/src/components/global-styles-provider/index.js +12 -2
- package/src/components/post-actions/actions.js +1 -1
- package/src/components/post-trash/index.js +1 -0
- package/src/components/post-visibility/index.js +1 -0
- package/src/components/template-validation-notice/index.js +1 -0
- package/src/components/visual-editor/edit-template-blocks-notification.js +1 -0
- package/src/hooks/pattern-overrides.js +2 -0
- package/src/lock-unlock.js +1 -1
|
@@ -32,9 +32,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
32
32
|
* Internal dependencies
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
const preventDefault = event => {
|
|
36
|
-
event.preventDefault();
|
|
37
|
-
};
|
|
38
35
|
function DocumentTools({
|
|
39
36
|
className,
|
|
40
37
|
disableBlockTools = false
|
|
@@ -84,6 +81,18 @@ function DocumentTools({
|
|
|
84
81
|
isZoomedOutView: __unstableGetEditorMode() === 'zoom-out'
|
|
85
82
|
};
|
|
86
83
|
}, []);
|
|
84
|
+
const preventDefault = event => {
|
|
85
|
+
// Because the inserter behaves like a dialog,
|
|
86
|
+
// if the inserter is opened already then when we click on the toggle button
|
|
87
|
+
// then the initial click event will close the inserter and then be propagated
|
|
88
|
+
// to the inserter toggle and it will open it again.
|
|
89
|
+
// To prevent this we need to stop the propagation of the event.
|
|
90
|
+
// This won't be necessary when the inserter no longer behaves like a dialog.
|
|
91
|
+
|
|
92
|
+
if (isInserterOpened) {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
87
96
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
88
97
|
const isWideViewport = (0, _compose.useViewportMatch)('wide');
|
|
89
98
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_data","_i18n","_blockEditor","_components","_icons","_element","_keyboardShortcuts","_preferences","_lockUnlock","_store","_redo","_undo","_jsxRuntime","preventDefault","event","DocumentTools","className","disableBlockTools","setIsInserterOpened","setIsListViewOpened","useDispatch","editorStore","isDistractionFree","isInserterOpened","isListViewOpen","listViewShortcut","inserterSidebarToggleRef","listViewToggleRef","hasFixedToolbar","showIconLabels","useSelect","select","getSettings","blockEditorStore","get","preferencesStore","isListViewOpened","getEditorMode","getInserterSidebarToggleRef","getListViewToggleRef","unlock","getShortcutRepresentation","keyboardShortcutsStore","__unstableGetEditorMode","isVisualMode","isZoomedOutView","isLargeViewport","useViewportMatch","isWideViewport","toolbarAriaLabel","__","toggleListView","useCallback","toggleInserter","longLabel","_x","shortLabel","jsx","NavigableToolbar","clsx","variant","children","jsxs","ToolbarItem","ref","as","Button","isPressed","onMouseDown","onClick","disabled","icon","plus","label","showTooltip","Fragment","ToolSelector","undefined","size","EditorHistoryUndo","EditorHistoryRedo","listView","shortcut","_default","exports","default"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nfunction DocumentTools( { className, disableBlockTools = false } ) {\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisDistractionFree,\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t\thasFixedToolbar,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst {\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetListViewToggleRef,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpened ),\n\t\t[ isInserterOpened, setIsInserterOpened ]\n\t);\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t// Some plugins expect and use the `edit-post-header-toolbar` CSS class to\n\t\t// find the toolbar and inject UI elements into it. This is not officially\n\t\t// supported, but we're keeping it in the list of class names for backwards\n\t\t// compatibility.\n\t\t<NavigableToolbar\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-document-tools',\n\t\t\t\t'edit-post-header-toolbar',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,KAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,KAAA,GAAAd,sBAAA,CAAAC,OAAA;AAAuD,IAAAc,WAAA,GAAAd,OAAA;AA5BvD;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;;AAMA,MAAMe,cAAc,GAAKC,KAAK,IAAM;EACnCA,KAAK,CAACD,cAAc,CAAC,CAAC;AACvB,CAAC;AAED,SAASE,aAAaA,CAAE;EAAEC,SAAS;EAAEC,iBAAiB,GAAG;AAAM,CAAC,EAAG;EAClE,MAAM;IAAEC,mBAAmB;IAAEC;EAAoB,CAAC,GACjD,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC3B,MAAM;IACLC,iBAAiB;IACjBC,gBAAgB;IAChBC,cAAc;IACdC,gBAAgB;IAChBC,wBAAw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B;YAC7BiD,WAAW,EAAG,CAAE7C,cAAgB;YAChC+B,OAAO,EACN/B,cAAc,GAAG,UAAU,GAAGgD,SAC9B;YACD,iBAAgBrD,cAAgB;YAChCwC,GAAG,EAAGrC,iBAAmB;YACzBmD,IAAI,EAAC;UAAS,CACd,CACD;QAAA,CACA,CACF;MAAA,CACG;IAAC,CACW;EAAC;AAErB;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEctE,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_data","_i18n","_blockEditor","_components","_icons","_element","_keyboardShortcuts","_preferences","_lockUnlock","_store","_redo","_undo","_jsxRuntime","DocumentTools","className","disableBlockTools","setIsInserterOpened","setIsListViewOpened","useDispatch","editorStore","isDistractionFree","isInserterOpened","isListViewOpen","listViewShortcut","inserterSidebarToggleRef","listViewToggleRef","hasFixedToolbar","showIconLabels","useSelect","select","getSettings","blockEditorStore","get","preferencesStore","isListViewOpened","getEditorMode","getInserterSidebarToggleRef","getListViewToggleRef","unlock","getShortcutRepresentation","keyboardShortcutsStore","__unstableGetEditorMode","isVisualMode","isZoomedOutView","preventDefault","event","isLargeViewport","useViewportMatch","isWideViewport","toolbarAriaLabel","__","toggleListView","useCallback","toggleInserter","longLabel","_x","shortLabel","jsx","NavigableToolbar","clsx","variant","children","jsxs","ToolbarItem","ref","as","Button","isPressed","onMouseDown","onClick","disabled","icon","plus","label","showTooltip","Fragment","ToolSelector","undefined","size","EditorHistoryUndo","EditorHistoryRedo","listView","shortcut","_default","exports","default"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tNavigableToolbar,\n\tToolSelector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nfunction DocumentTools( { className, disableBlockTools = false } ) {\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisDistractionFree,\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t\thasFixedToolbar,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst {\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetListViewToggleRef,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst preventDefault = ( event ) => {\n\t\t// Because the inserter behaves like a dialog,\n\t\t// if the inserter is opened already then when we click on the toggle button\n\t\t// then the initial click event will close the inserter and then be propagated\n\t\t// to the inserter toggle and it will open it again.\n\t\t// To prevent this we need to stop the propagation of the event.\n\t\t// This won't be necessary when the inserter no longer behaves like a dialog.\n\n\t\tif ( isInserterOpened ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpened ),\n\t\t[ isInserterOpened, setIsInserterOpened ]\n\t);\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t// Some plugins expect and use the `edit-post-header-toolbar` CSS class to\n\t\t// find the toolbar and inject UI elements into it. This is not officially\n\t\t// supported, but we're keeping it in the list of class names for backwards\n\t\t// compatibility.\n\t\t<NavigableToolbar\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-document-tools',\n\t\t\t\t'edit-post-header-toolbar',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && ! hasFixedToolbar && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,KAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IA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,EAACtD,WAAA,CAAA4D,WAAW;YACXE,EAAE,EAAGe,aAAmB;YACxBN,WAAW,EAAG,CAAE/C,cAAgB;YAChCiC,OAAO,EAAGjC,cAAc,GAAG,UAAU,GAAGkD,SAAW;YACnDC,IAAI,EAAC;UAAS,CACd,CAAC,EACA,CAAE1D,iBAAiB,iBACpB,IAAAR,WAAA,CAAA6C,GAAA,EAACtD,WAAA,CAAA4D,WAAW;YACXE,EAAE,EAAGC,kBAAQ;YACbpD,SAAS,EAAC,iDAAiD;YAC3DyD,IAAI,EAAGU,eAAU;YACjBX,QAAQ,EAAGvD,iBAAmB;YAC9BoD,SAAS,EAAG7C;YACZ;YACAmD,KAAK,EAAG,IAAAvB,QAAE,EAAE,mBAAoB,CAAG;YACnCmB,OAAO,EAAGlB,cAAgB;YAC1B+B,QAAQ,EAAG3D,gBAAkB;YAC7BmD,WAAW,EAAG,CAAE/C,cAAgB;YAChCiC,OAAO,EACNjC,cAAc,GAAG,UAAU,GAAGkD,SAC9B;YACD,iBAAgBvD,cAAgB;YAChC0C,GAAG,EAAGvC,iBAAmB;YACzBqD,IAAI,EAAC;UAAS,CACd,CACD;QAAA,CACA,CACF;MAAA,CACG;IAAC,CACW;EAAC;AAErB;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxE,aAAa","ignoreList":[]}
|
|
@@ -9,7 +9,6 @@ var _i18n = require("@wordpress/i18n");
|
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
10
|
var _coreData = require("@wordpress/core-data");
|
|
11
11
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
12
|
-
var _icons = require("@wordpress/icons");
|
|
13
12
|
var _store = require("../../store");
|
|
14
13
|
var _lockUnlock = require("../../lock-unlock");
|
|
15
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -58,17 +57,10 @@ function EntityRecordItem({
|
|
|
58
57
|
checked: checked,
|
|
59
58
|
onChange: onChange
|
|
60
59
|
})
|
|
61
|
-
}), hasPostMetaChanges && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
children:
|
|
65
|
-
className: "entities-saved-states__connections-icon",
|
|
66
|
-
icon: _icons.connection,
|
|
67
|
-
size: 24
|
|
68
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
69
|
-
className: "entities-saved-states__bindings-text",
|
|
70
|
-
children: (0, _i18n.__)('Post Meta.')
|
|
71
|
-
})]
|
|
60
|
+
}), hasPostMetaChanges && /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
61
|
+
className: "entities-saved-states__changes",
|
|
62
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
63
|
+
children: (0, _i18n.__)('Post Meta.')
|
|
72
64
|
})
|
|
73
65
|
})]
|
|
74
66
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_data","_coreData","_htmlEntities","
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_data","_coreData","_htmlEntities","_store","_lockUnlock","_jsxRuntime","EntityRecordItem","record","checked","onChange","name","kind","title","key","entityRecordTitle","hasPostMetaChanges","useSelect","select","unlock","editorStore","template","coreStore","getEditedEntityRecord","__experimentalGetTemplateInfo","jsxs","Fragment","children","jsx","PanelRow","CheckboxControl","__nextHasNoMarginBottom","label","decodeEntities","__","className"],"sources":["@wordpress/editor/src/components/entities-saved-states/entity-record-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CheckboxControl, PanelRow } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function EntityRecordItem( { record, checked, onChange } ) {\n\tconst { name, kind, title, key } = record;\n\n\t// Handle templates that might use default descriptive titles.\n\tconst { entityRecordTitle, hasPostMetaChanges } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( 'postType' !== kind || 'wp_template' !== name ) {\n\t\t\t\treturn {\n\t\t\t\t\tentityRecordTitle: title,\n\t\t\t\t\thasPostMetaChanges: unlock(\n\t\t\t\t\t\tselect( editorStore )\n\t\t\t\t\t).hasPostMetaChanges( name, key ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst template = select( coreStore ).getEditedEntityRecord(\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\tkey\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tentityRecordTitle:\n\t\t\t\t\tselect( editorStore ).__experimentalGetTemplateInfo(\n\t\t\t\t\t\ttemplate\n\t\t\t\t\t).title,\n\t\t\t\thasPostMetaChanges: unlock(\n\t\t\t\t\tselect( editorStore )\n\t\t\t\t).hasPostMetaChanges( name, key ),\n\t\t\t};\n\t\t},\n\t\t[ name, kind, title, key ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tdecodeEntities( entityRecordTitle ) || __( 'Untitled' )\n\t\t\t\t\t}\n\t\t\t\t\tchecked={ checked }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t{ hasPostMetaChanges && (\n\t\t\t\t<ul className=\"entities-saved-states__changes\">\n\t\t\t\t\t<li>{ __( 'Post Meta.' ) }</li>\n\t\t\t\t</ul>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAA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e;QACfC,uBAAuB;QACvBC,KAAK,EACJ,IAAAC,4BAAc,EAAElB,iBAAkB,CAAC,IAAI,IAAAmB,QAAE,EAAE,UAAW,CACtD;QACDzB,OAAO,EAAGA,OAAS;QACnBC,QAAQ,EAAGA;MAAU,CACrB;IAAC,CACO,CAAC,EACTM,kBAAkB,iBACnB,IAAAV,WAAA,CAAAsB,GAAA;MAAIO,SAAS,EAAC,gCAAgC;MAAAR,QAAA,eAC7C,IAAArB,WAAA,CAAAsB,GAAA;QAAAD,QAAA,EAAM,IAAAO,QAAE,EAAE,YAAa;MAAC,CAAM;IAAC,CAC5B,CACJ;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -136,7 +136,14 @@ function useGlobalStylesUserConfig() {
|
|
|
136
136
|
_links: _links !== null && _links !== void 0 ? _links : {}
|
|
137
137
|
};
|
|
138
138
|
}, [settings, styles, _links]);
|
|
139
|
-
const setConfig = (0, _element.useCallback)(
|
|
139
|
+
const setConfig = (0, _element.useCallback)(
|
|
140
|
+
/**
|
|
141
|
+
* Set the global styles config.
|
|
142
|
+
* @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.
|
|
143
|
+
* Otherwise, overwrite the current config with the incoming object.
|
|
144
|
+
* @param {Object} options Options for editEntityRecord Core selector.
|
|
145
|
+
*/
|
|
146
|
+
(callbackOrObject, options = {}) => {
|
|
140
147
|
var _record$styles, _record$settings, _record$_links;
|
|
141
148
|
const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId);
|
|
142
149
|
const currentConfig = {
|
|
@@ -144,7 +151,7 @@ function useGlobalStylesUserConfig() {
|
|
|
144
151
|
settings: (_record$settings = record?.settings) !== null && _record$settings !== void 0 ? _record$settings : {},
|
|
145
152
|
_links: (_record$_links = record?._links) !== null && _record$_links !== void 0 ? _record$_links : {}
|
|
146
153
|
};
|
|
147
|
-
const updatedConfig =
|
|
154
|
+
const updatedConfig = typeof callbackOrObject === 'function' ? callbackOrObject(currentConfig) : callbackOrObject;
|
|
148
155
|
editEntityRecord('root', 'globalStyles', globalStylesId, {
|
|
149
156
|
styles: cleanEmptyObject(updatedConfig.styles) || {},
|
|
150
157
|
settings: cleanEmptyObject(updatedConfig.settings) || {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_deepmerge","_interopRequireDefault","require","_isPlainObject","_blocks","_blockEditor","_coreData","_data","_element","_lockUnlock","_setNestedValue","_jsxRuntime","GlobalStylesContext","cleanEmptyObject","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","base","user","deepmerge","isMergeableObject","isPlainObject","useResolvedBlockStyleVariationsConfig","userConfig","getBlockStyles","useSelect","blocksStore","sharedVariations","styles","blocks","variations","userConfigToMerge","unregisteredStyles","useMemo","variationsConfigToMerge","unregisteredBlockStyles","Object","entries","forEach","variationName","variation","blockTypes","length","blockName","blockStyles","registeredBlockStyle","find","name","push","label","path","setNestedValue","useEffect","unregisteredStyle","registerBlockStyle","updatedConfig","useGlobalStylesUserConfig","globalStylesId","isReady","settings","_links","select","getEditedEntityRecord","hasFinishedResolution","coreStore","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","undefined","hasResolved","editEntityRecord","useDispatch","config","setConfig","useCallback","callback","options","_record$styles","_record$settings","_record$_links","currentConfig","useGlobalStylesBaseConfig","baseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","useGlobalStylesContext","isUserConfigReady","setUserConfig","isBaseConfigReady","userConfigWithVariations","mergedConfig","context","merged","GlobalStylesProvider","children","jsx","Provider","value"],"sources":["@wordpress/editor/src/components/global-styles-provider/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { registerBlockStyle, store as blocksStore } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { GlobalStylesContext, cleanEmptyObject } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport function mergeBaseAndUserConfigs( base, user ) {\n\treturn deepmerge( base, user, {\n\t\t// We only pass as arrays the presets,\n\t\t// in which case we want the new array of values\n\t\t// to override the old array (no merging).\n\t\tisMergeableObject: isPlainObject,\n\t} );\n}\n\n/**\n * Resolves shared block style variation definitions from the user origin\n * under their respective block types and registers the block style if required.\n *\n * @param {Object} userConfig Current user origin global styles data.\n * @return {Object} Updated global styles data.\n */\nfunction useResolvedBlockStyleVariationsConfig( userConfig ) {\n\tconst { getBlockStyles } = useSelect( blocksStore );\n\tconst sharedVariations = userConfig?.styles?.blocks?.variations;\n\n\t// Collect block style variation definitions to merge and unregistered\n\t// block styles for automatic registration.\n\tconst [ userConfigToMerge, unregisteredStyles ] = useMemo( () => {\n\t\tif ( ! sharedVariations ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst variationsConfigToMerge = {};\n\t\tconst unregisteredBlockStyles = [];\n\n\t\tObject.entries( sharedVariations ).forEach(\n\t\t\t( [ variationName, variation ] ) => {\n\t\t\t\tif ( ! variation?.blockTypes?.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvariation.blockTypes.forEach( ( blockName ) => {\n\t\t\t\t\tconst blockStyles = getBlockStyles( blockName );\n\t\t\t\t\tconst registeredBlockStyle = blockStyles.find(\n\t\t\t\t\t\t( { name } ) => name === variationName\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( ! registeredBlockStyle ) {\n\t\t\t\t\t\tunregisteredBlockStyles.push( [\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: variationName,\n\t\t\t\t\t\t\t\tlabel: variationName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] );\n\t\t\t\t\t}\n\n\t\t\t\t\tconst path = [\n\t\t\t\t\t\t'styles',\n\t\t\t\t\t\t'blocks',\n\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t'variations',\n\t\t\t\t\t\tvariationName,\n\t\t\t\t\t];\n\t\t\t\t\tsetNestedValue( variationsConfigToMerge, path, variation );\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\n\t\treturn [ variationsConfigToMerge, unregisteredBlockStyles ];\n\t}, [ sharedVariations, getBlockStyles ] );\n\n\t// Automatically register missing block styles from variations.\n\tuseEffect(\n\t\t() =>\n\t\t\tunregisteredStyles?.forEach( ( unregisteredStyle ) =>\n\t\t\t\tregisterBlockStyle( ...unregisteredStyle )\n\t\t\t),\n\t\t[ unregisteredStyles ]\n\t);\n\n\t// Merge shared block style variation definitions into overall user config.\n\tconst updatedConfig = useMemo( () => {\n\t\tif ( ! userConfigToMerge ) {\n\t\t\treturn userConfig;\n\t\t}\n\n\t\treturn deepmerge( userConfigToMerge, userConfig );\n\t}, [ userConfigToMerge, userConfig ] );\n\n\treturn updatedConfig;\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\t\t\tconst record = _globalStylesId\n\t\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t_globalStylesId\n\t\t\t\t )\n\t\t\t\t: undefined;\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\thasResolved = _globalStylesId\n\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t ] )\n\t\t\t\t\t: true;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t\t_links: record?._links,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t( callback, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\t\t\tconst updatedConfig = callback( currentConfig );\n\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect( ( select ) => {\n\t\treturn select(\n\t\t\tcoreStore\n\t\t).__experimentalGetCurrentThemeBaseGlobalStyles();\n\t}, [] );\n\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\tconst userConfigWithVariations =\n\t\tuseResolvedBlockStyleVariationsConfig( userConfig );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfigWithVariations ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfigWithVariations );\n\t}, [ userConfigWithVariations, baseConfig ] );\n\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfigWithVariations,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfigWithVariations,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n\nexport function GlobalStylesProvider( { children } ) {\n\tconst context = useGlobalStylesContext();\n\tif ( ! context.isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,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E+B,iBAAiB,EAAEL,UAAU,CAAE,GAAGD,yBAAyB,CAAC,CAAC;EACrE,MAAMO,wBAAwB,GAC7BlE,qCAAqC,CAAEC,UAAW,CAAC;EAEpD,MAAMkE,YAAY,GAAG,IAAAxD,gBAAO,EAAE,MAAM;IACnC,IAAK,CAAEiD,UAAU,IAAI,CAAEM,wBAAwB,EAAG;MACjD,OAAO,CAAC,CAAC;IACV;IAEA,OAAOxE,uBAAuB,CAAEkE,UAAU,EAAEM,wBAAyB,CAAC;EACvE,CAAC,EAAE,CAAEA,wBAAwB,EAAEN,UAAU,CAAG,CAAC;EAE7C,MAAMQ,OAAO,GAAG,IAAAzD,gBAAO,EAAE,MAAM;IAC9B,OAAO;MACNyB,OAAO,EAAE2B,iBAAiB,IAAIE,iBAAiB;MAC/CrE,IAAI,EAAEsE,wBAAwB;MAC9BvE,IAAI,EAAEiE,UAAU;MAChBS,MAAM,EAAEF,YAAY;MACpBH;IACD,CAAC;EACF,CAAC,EAAE,CACFG,YAAY,EACZD,wBAAwB,EACxBN,UAAU,EACVI,aAAa,EACbD,iBAAiB,EACjBE,iBAAiB,CAChB,CAAC;EAEH,OAAOG,OAAO;AACf;AAEO,SAASE,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACpD,MAAMH,OAAO,GAAGN,sBAAsB,CAAC,CAAC;EACxC,IAAK,CAAEM,OAAO,CAAChC,OAAO,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,oBACC,IAAA/C,WAAA,CAAAmF,GAAA,EAAClF,mBAAmB,CAACmF,QAAQ;IAACC,KAAK,EAAGN,OAAS;IAAAG,QAAA,EAC5CA;EAAQ,CACmB,CAAC;AAEjC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_deepmerge","_interopRequireDefault","require","_isPlainObject","_blocks","_blockEditor","_coreData","_data","_element","_lockUnlock","_setNestedValue","_jsxRuntime","GlobalStylesContext","cleanEmptyObject","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","base","user","deepmerge","isMergeableObject","isPlainObject","useResolvedBlockStyleVariationsConfig","userConfig","getBlockStyles","useSelect","blocksStore","sharedVariations","styles","blocks","variations","userConfigToMerge","unregisteredStyles","useMemo","variationsConfigToMerge","unregisteredBlockStyles","Object","entries","forEach","variationName","variation","blockTypes","length","blockName","blockStyles","registeredBlockStyle","find","name","push","label","path","setNestedValue","useEffect","unregisteredStyle","registerBlockStyle","updatedConfig","useGlobalStylesUserConfig","globalStylesId","isReady","settings","_links","select","getEditedEntityRecord","hasFinishedResolution","coreStore","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","undefined","hasResolved","editEntityRecord","useDispatch","config","setConfig","useCallback","callbackOrObject","options","_record$styles","_record$settings","_record$_links","currentConfig","useGlobalStylesBaseConfig","baseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","useGlobalStylesContext","isUserConfigReady","setUserConfig","isBaseConfigReady","userConfigWithVariations","mergedConfig","context","merged","GlobalStylesProvider","children","jsx","Provider","value"],"sources":["@wordpress/editor/src/components/global-styles-provider/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { registerBlockStyle, store as blocksStore } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { GlobalStylesContext, cleanEmptyObject } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport function mergeBaseAndUserConfigs( base, user ) {\n\treturn deepmerge( base, user, {\n\t\t// We only pass as arrays the presets,\n\t\t// in which case we want the new array of values\n\t\t// to override the old array (no merging).\n\t\tisMergeableObject: isPlainObject,\n\t} );\n}\n\n/**\n * Resolves shared block style variation definitions from the user origin\n * under their respective block types and registers the block style if required.\n *\n * @param {Object} userConfig Current user origin global styles data.\n * @return {Object} Updated global styles data.\n */\nfunction useResolvedBlockStyleVariationsConfig( userConfig ) {\n\tconst { getBlockStyles } = useSelect( blocksStore );\n\tconst sharedVariations = userConfig?.styles?.blocks?.variations;\n\n\t// Collect block style variation definitions to merge and unregistered\n\t// block styles for automatic registration.\n\tconst [ userConfigToMerge, unregisteredStyles ] = useMemo( () => {\n\t\tif ( ! sharedVariations ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst variationsConfigToMerge = {};\n\t\tconst unregisteredBlockStyles = [];\n\n\t\tObject.entries( sharedVariations ).forEach(\n\t\t\t( [ variationName, variation ] ) => {\n\t\t\t\tif ( ! variation?.blockTypes?.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvariation.blockTypes.forEach( ( blockName ) => {\n\t\t\t\t\tconst blockStyles = getBlockStyles( blockName );\n\t\t\t\t\tconst registeredBlockStyle = blockStyles.find(\n\t\t\t\t\t\t( { name } ) => name === variationName\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( ! registeredBlockStyle ) {\n\t\t\t\t\t\tunregisteredBlockStyles.push( [\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: variationName,\n\t\t\t\t\t\t\t\tlabel: variationName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] );\n\t\t\t\t\t}\n\n\t\t\t\t\tconst path = [\n\t\t\t\t\t\t'styles',\n\t\t\t\t\t\t'blocks',\n\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t'variations',\n\t\t\t\t\t\tvariationName,\n\t\t\t\t\t];\n\t\t\t\t\tsetNestedValue( variationsConfigToMerge, path, variation );\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\n\t\treturn [ variationsConfigToMerge, unregisteredBlockStyles ];\n\t}, [ sharedVariations, getBlockStyles ] );\n\n\t// Automatically register missing block styles from variations.\n\tuseEffect(\n\t\t() =>\n\t\t\tunregisteredStyles?.forEach( ( unregisteredStyle ) =>\n\t\t\t\tregisterBlockStyle( ...unregisteredStyle )\n\t\t\t),\n\t\t[ unregisteredStyles ]\n\t);\n\n\t// Merge shared block style variation definitions into overall user config.\n\tconst updatedConfig = useMemo( () => {\n\t\tif ( ! userConfigToMerge ) {\n\t\t\treturn userConfig;\n\t\t}\n\n\t\treturn deepmerge( userConfigToMerge, userConfig );\n\t}, [ userConfigToMerge, userConfig ] );\n\n\treturn updatedConfig;\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\t\t\tconst record = _globalStylesId\n\t\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t_globalStylesId\n\t\t\t\t )\n\t\t\t\t: undefined;\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\thasResolved = _globalStylesId\n\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t ] )\n\t\t\t\t\t: true;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t\t_links: record?._links,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t/**\n\t\t * Set the global styles config.\n\t\t * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.\n\t\t * Otherwise, overwrite the current config with the incoming object.\n\t\t * @param {Object} options Options for editEntityRecord Core selector.\n\t\t */\n\t\t( callbackOrObject, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\n\t\t\tconst updatedConfig =\n\t\t\t\ttypeof callbackOrObject === 'function'\n\t\t\t\t\t? callbackOrObject( currentConfig )\n\t\t\t\t\t: callbackOrObject;\n\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect( ( select ) => {\n\t\treturn select(\n\t\t\tcoreStore\n\t\t).__experimentalGetCurrentThemeBaseGlobalStyles();\n\t}, [] );\n\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\tconst userConfigWithVariations =\n\t\tuseResolvedBlockStyleVariationsConfig( userConfig );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfigWithVariations ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfigWithVariations );\n\t}, [ userConfigWithVariations, baseConfig ] );\n\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfigWithVariations,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfigWithVariations,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n\nexport function GlobalStylesProvider( { children } ) {\n\tconst context = useGlobalStylesContext();\n\tif ( ! context.isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAT,sBAAA,CAAAC,OAAA;AAA0D,IAAAS,WAAA,GAAAT,OAAA;AAnB1D;AACA;AACA;;AAI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B,EAAEL,UAAU,CAAE,GAAGD,yBAAyB,CAAC,CAAC;EACrE,MAAMO,wBAAwB,GAC7BlE,qCAAqC,CAAEC,UAAW,CAAC;EAEpD,MAAMkE,YAAY,GAAG,IAAAxD,gBAAO,EAAE,MAAM;IACnC,IAAK,CAAEiD,UAAU,IAAI,CAAEM,wBAAwB,EAAG;MACjD,OAAO,CAAC,CAAC;IACV;IAEA,OAAOxE,uBAAuB,CAAEkE,UAAU,EAAEM,wBAAyB,CAAC;EACvE,CAAC,EAAE,CAAEA,wBAAwB,EAAEN,UAAU,CAAG,CAAC;EAE7C,MAAMQ,OAAO,GAAG,IAAAzD,gBAAO,EAAE,MAAM;IAC9B,OAAO;MACNyB,OAAO,EAAE2B,iBAAiB,IAAIE,iBAAiB;MAC/CrE,IAAI,EAAEsE,wBAAwB;MAC9BvE,IAAI,EAAEiE,UAAU;MAChBS,MAAM,EAAEF,YAAY;MACpBH;IACD,CAAC;EACF,CAAC,EAAE,CACFG,YAAY,EACZD,wBAAwB,EACxBN,UAAU,EACVI,aAAa,EACbD,iBAAiB,EACjBE,iBAAiB,CAChB,CAAC;EAEH,OAAOG,OAAO;AACf;AAEO,SAASE,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACpD,MAAMH,OAAO,GAAGN,sBAAsB,CAAC,CAAC;EACxC,IAAK,CAAEM,OAAO,CAAChC,OAAO,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,oBACC,IAAA/C,WAAA,CAAAmF,GAAA,EAAClF,mBAAmB,CAACmF,QAAQ;IAACC,KAAK,EAAGN,OAAS;IAAAG,QAAA,EAC5CA;EAAQ,CACmB,CAAC;AAEjC","ignoreList":[]}
|
|
@@ -615,7 +615,7 @@ const duplicatePostAction = {
|
|
|
615
615
|
});
|
|
616
616
|
createSuccessNotice((0, _i18n.sprintf)(
|
|
617
617
|
// translators: %s: Title of the created template e.g: "Category".
|
|
618
|
-
(0, _i18n.__)('"%s" successfully created.'), newItem.title?.rendered || title), {
|
|
618
|
+
(0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(newItem.title?.rendered || title)), {
|
|
619
619
|
id: 'duplicate-post-action',
|
|
620
620
|
type: 'snackbar'
|
|
621
621
|
});
|