@wordpress/customize-widgets 3.0.2 → 3.0.3-next.a55ed9455a.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/build/components/more-menu/index.js +9 -13
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/sidebar-block-editor/index.js +6 -6
- package/build/components/sidebar-block-editor/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +4 -4
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/store/index.js +3 -5
- package/build/store/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +9 -13
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/index.js +6 -6
- package/build-module/components/sidebar-block-editor/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +4 -4
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +1 -1
- package/build-module/store/index.js +4 -6
- package/build-module/store/index.js.map +1 -1
- package/build-style/style-rtl.css +0 -33
- package/build-style/style.css +0 -33
- package/package.json +25 -20
- package/src/components/more-menu/index.js +9 -16
- package/src/components/sidebar-block-editor/index.js +5 -5
- package/src/components/welcome-guide/index.js +3 -3
- package/src/index.js +2 -2
- package/src/store/index.js +3 -6
- package/src/style.scss +0 -1
- package/src/components/more-menu/style.scss +0 -35
|
@@ -21,6 +21,8 @@ var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
|
21
21
|
|
|
22
22
|
var _interface = require("@wordpress/interface");
|
|
23
23
|
|
|
24
|
+
var _preferences = require("@wordpress/preferences");
|
|
25
|
+
|
|
24
26
|
var _keyboardShortcutHelpModal = _interopRequireDefault(require("../keyboard-shortcut-help-modal"));
|
|
25
27
|
|
|
26
28
|
/**
|
|
@@ -30,10 +32,6 @@ var _keyboardShortcutHelpModal = _interopRequireDefault(require("../keyboard-sho
|
|
|
30
32
|
/**
|
|
31
33
|
* Internal dependencies
|
|
32
34
|
*/
|
|
33
|
-
const POPOVER_PROPS = {
|
|
34
|
-
className: 'customize-widgets-more-menu__content'
|
|
35
|
-
};
|
|
36
|
-
|
|
37
35
|
function MoreMenu() {
|
|
38
36
|
const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0, _element.useState)(false);
|
|
39
37
|
|
|
@@ -41,14 +39,12 @@ function MoreMenu() {
|
|
|
41
39
|
|
|
42
40
|
(0, _keyboardShortcuts.useShortcut)('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
|
|
43
41
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.MoreMenuDropdown, {
|
|
44
|
-
as: _components.ToolbarDropdownMenu
|
|
45
|
-
className: "customize-widgets-more-menu",
|
|
46
|
-
popoverProps: POPOVER_PROPS
|
|
42
|
+
as: _components.ToolbarDropdownMenu
|
|
47
43
|
}, () => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuGroup, {
|
|
48
44
|
label: (0, _i18n._x)('View', 'noun')
|
|
49
|
-
}, (0, _element.createElement)(
|
|
45
|
+
}, (0, _element.createElement)(_preferences.PreferenceToggleMenuItem, {
|
|
50
46
|
scope: "core/customize-widgets",
|
|
51
|
-
|
|
47
|
+
name: "fixedToolbar",
|
|
52
48
|
label: (0, _i18n.__)('Top toolbar'),
|
|
53
49
|
info: (0, _i18n.__)('Access all block and document tools in a single place'),
|
|
54
50
|
messageActivated: (0, _i18n.__)('Top toolbar activated'),
|
|
@@ -60,9 +56,9 @@ function MoreMenu() {
|
|
|
60
56
|
setIsKeyboardShortcutsModalVisible(true);
|
|
61
57
|
},
|
|
62
58
|
shortcut: _keycodes.displayShortcut.access('h')
|
|
63
|
-
}, (0, _i18n.__)('Keyboard shortcuts')), (0, _element.createElement)(
|
|
59
|
+
}, (0, _i18n.__)('Keyboard shortcuts')), (0, _element.createElement)(_preferences.PreferenceToggleMenuItem, {
|
|
64
60
|
scope: "core/customize-widgets",
|
|
65
|
-
|
|
61
|
+
name: "welcomeGuide",
|
|
66
62
|
label: (0, _i18n.__)('Welcome Guide')
|
|
67
63
|
}), (0, _element.createElement)(_components.MenuItem, {
|
|
68
64
|
role: "menuitem",
|
|
@@ -76,9 +72,9 @@ function MoreMenu() {
|
|
|
76
72
|
/* translators: accessibility text */
|
|
77
73
|
(0, _i18n.__)('(opens in a new tab)')))), (0, _element.createElement)(_components.MenuGroup, {
|
|
78
74
|
label: (0, _i18n.__)('Preferences')
|
|
79
|
-
}, (0, _element.createElement)(
|
|
75
|
+
}, (0, _element.createElement)(_preferences.PreferenceToggleMenuItem, {
|
|
80
76
|
scope: "core/customize-widgets",
|
|
81
|
-
|
|
77
|
+
name: "keepCaretInsideBlock",
|
|
82
78
|
label: (0, _i18n.__)('Contain text cursor inside block'),
|
|
83
79
|
info: (0, _i18n.__)('Aids screen readers by stopping text caret from leaving blocks.'),
|
|
84
80
|
messageActivated: (0, _i18n.__)('Contain text cursor inside block activated'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/more-menu/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/more-menu/index.js"],"names":["MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","ToolbarDropdownMenu","displayShortcut","access","external"],"mappings":";;;;;;;;;AASA;;AANA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AApBA;AACA;AACA;;AAeA;AACA;AACA;AAGe,SAASA,QAAT,GAAoB;AAClC,QAAM,CACLC,8BADK,EAELC,kCAFK,IAGF,uBAAU,KAAV,CAHJ;;AAIA,QAAMC,4BAA4B,GAAG,MACpCD,kCAAkC,CAAE,CAAED,8BAAJ,CADnC;;AAGA,sCACC,2CADD,EAECE,4BAFD;AAKA,SACC,qDACC,4BAAC,2BAAD;AAAkB,IAAA,EAAE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,cACP,kCADO,CAHT;AAMC,IAAA,IAAI,EAAG,cACN,iEADM,CANR;AASC,IAAA,gBAAgB,EAAG,cAClB,4CADkB,CATpB;AAYC,IAAA,kBAAkB,EAAG,cACpB,8CADoB;AAZtB,IADD,CAjDD,CAFF,CADD,EAyEC,4BAAC,kCAAD;AACC,IAAA,aAAa,EAAGN,8BADjB;AAEC,IAAA,WAAW,EAAGE;AAFf,IAzED,CADD;AAgFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tToolbarDropdownMenu,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { MoreMenuDropdown } from '@wordpress/interface';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<MoreMenuDropdown as={ ToolbarDropdownMenu }>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"welcomeGuide\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</MoreMenuDropdown>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -19,7 +19,7 @@ var _blockEditor = require("@wordpress/block-editor");
|
|
|
19
19
|
|
|
20
20
|
var _mediaUtils = require("@wordpress/media-utils");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _preferences = require("@wordpress/preferences");
|
|
23
23
|
|
|
24
24
|
var _blockInspectorButton = _interopRequireDefault(require("../block-inspector-button"));
|
|
25
25
|
|
|
@@ -61,13 +61,13 @@ function SidebarBlockEditor(_ref) {
|
|
|
61
61
|
isWelcomeGuideActive
|
|
62
62
|
} = (0, _data.useSelect)(select => {
|
|
63
63
|
const {
|
|
64
|
-
|
|
65
|
-
} = select(
|
|
64
|
+
get
|
|
65
|
+
} = select(_preferences.store);
|
|
66
66
|
return {
|
|
67
67
|
hasUploadPermissions: (0, _lodash.defaultTo)(select(_coreData.store).canUser('create', 'media'), true),
|
|
68
|
-
isFixedToolbarActive:
|
|
69
|
-
keepCaretInsideBlock:
|
|
70
|
-
isWelcomeGuideActive:
|
|
68
|
+
isFixedToolbarActive: !!get('core/customize-widgets', 'fixedToolbar'),
|
|
69
|
+
keepCaretInsideBlock: !!get('core/customize-widgets', 'keepCaretInsideBlock'),
|
|
70
|
+
isWelcomeGuideActive: !!get('core/customize-widgets', 'welcomeGuide')
|
|
71
71
|
};
|
|
72
72
|
}, []);
|
|
73
73
|
const settings = (0, _element.useMemo)(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"names":["SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"names":["SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","get","preferencesStore","coreStore","canUser","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","undo","redo","save","defaultEditorStyles","BlockAppender","event","preventDefault","contentContainer","onClose"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAK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,wBAAD;AAAa,IAAA,SAAS,EAAC;AAAvB,KACC,4BAAC,0BAAD,QACC,4BAAC,sBAAD;AACC,IAAA,cAAc,EAAGC;AADlB,IADD,CADD,CADD,CAFD,CADD,CAfD,EA8BG,4BACD;AACA;AACA;AAAM,IAAA,QAAQ,EAAKC,KAAF,IAAaA,KAAK,CAACC,cAAN;AAA9B,KACC,4BAAC,2BAAD,OADD,CAHC,EAMD7B,SAAS,CAAC8B,gBAAV,CAA4B,CAA5B,CANC,CA9BH,CAJD,EA4CC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AACC,MAAA,SAAS,EAAG/B,SADb;AAEC,MAAA,SAAS,EAAG+B;AAFb,MADC;AAAA,GADH,CA5CD,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport { defaultTo } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tBlockInspector,\n\tCopyHandler,\n\tObserveTyping,\n\tWritingFlow,\n\tBlockEditorKeyboardShortcuts,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={ isFixedToolbarActive }\n\t\t\t\t/>\n\n\t\t\t\t<CopyHandler>\n\t\t\t\t\t<BlockTools>\n\t\t\t\t\t\t<EditorStyles styles={ settings.defaultEditorStyles } />\n\t\t\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t\t\t<WritingFlow className=\"editor-styles-wrapper\">\n\t\t\t\t\t\t\t\t<ObserveTyping>\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\trenderAppender={ BlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ObserveTyping>\n\t\t\t\t\t\t\t</WritingFlow>\n\t\t\t\t\t\t</BlockSelectionClearer>\n\t\t\t\t\t</BlockTools>\n\t\t\t\t</CopyHandler>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -13,7 +13,7 @@ var _components = require("@wordpress/components");
|
|
|
13
13
|
|
|
14
14
|
var _data = require("@wordpress/data");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _preferences = require("@wordpress/preferences");
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* WordPress dependencies
|
|
@@ -23,8 +23,8 @@ function WelcomeGuide(_ref) {
|
|
|
23
23
|
sidebar
|
|
24
24
|
} = _ref;
|
|
25
25
|
const {
|
|
26
|
-
|
|
27
|
-
} = (0, _data.useDispatch)(
|
|
26
|
+
toggle
|
|
27
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
28
28
|
const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-'));
|
|
29
29
|
return (0, _element.createElement)("div", {
|
|
30
30
|
className: "customize-widgets-welcome-guide"
|
|
@@ -46,7 +46,7 @@ function WelcomeGuide(_ref) {
|
|
|
46
46
|
}, isEntirelyBlockWidgets ? (0, _i18n.__)('Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.') : (0, _i18n.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), (0, _element.createElement)(_components.Button, {
|
|
47
47
|
className: "customize-widgets-welcome-guide__button",
|
|
48
48
|
variant: "primary",
|
|
49
|
-
onClick: () =>
|
|
49
|
+
onClick: () => toggle('core/customize-widgets', 'welcomeGuide')
|
|
50
50
|
}, (0, _i18n.__)('Got it')), (0, _element.createElement)("hr", {
|
|
51
51
|
className: "customize-widgets-welcome-guide__separator"
|
|
52
52
|
}), !isEntirelyBlockWidgets && (0, _element.createElement)("p", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["WelcomeGuide","sidebar","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["WelcomeGuide","sidebar","toggle","preferencesStore","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMe,SAASA,YAAT,OAAqC;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACnD,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AAEA,QAAMC,sBAAsB,GAAGH,OAAO,CACpCI,UAD6B,GAE7BC,KAF6B,CAEpBC,MAAF,IAAcA,MAAM,CAACC,EAAP,CAAUC,UAAV,CAAsB,QAAtB,CAFQ,CAA/B;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,6CACC;AACC,IAAA,MAAM,EAAC,wDADR;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,GAAG,EAAC,wDAFL;AAGC,IAAA,KAAK,EAAC,KAHP;AAIC,IAAA,MAAM,EAAC,KAJR;AAKC,IAAA,GAAG,EAAC;AALL,IALD,CADD,CADD,EAgBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACG,cAAI,0BAAJ,CADH,CAhBD,EAmBC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGL,sBAAsB,GACrB,cACA,0LADA,CADqB,GAIrB,cACA,yHADA,CALJ,CAnBD,EA4BC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,OAAO,EAAG,MACTF,MAAM,CAAE,wBAAF,EAA4B,cAA5B;AAJR,KAOG,cAAI,QAAJ,CAPH,CA5BD,EAqCC;AAAI,IAAA,SAAS,EAAC;AAAd,IArCD,EAsCG,CAAEE,sBAAF,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cAAI,qCAAJ,CADH,EAEC,uCAFD,EAGC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,gDADM;AADR,KAKG,cAAI,iCAAJ,CALH,CAHD,CAvCF,EAmDC;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cAAI,0BAAJ,CADH,EAEC,uCAFD,EAGC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,yDADM;AADR,KAKG,cAAI,0BAAJ,CALH,CAHD,CAnDD,CADD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t ) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"customize-widgets-welcome-guide__button\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggle( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/support/article/wordpress-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var _blocks = require("@wordpress/blocks");
|
|
|
17
17
|
|
|
18
18
|
var _data = require("@wordpress/data");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _preferences = require("@wordpress/preferences");
|
|
21
21
|
|
|
22
22
|
var _customizeWidgets = _interopRequireDefault(require("./components/customize-widgets"));
|
|
23
23
|
|
|
@@ -47,7 +47,7 @@ const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
49
|
function initialize(editorName, blockEditorSettings) {
|
|
50
|
-
(0, _data.dispatch)(
|
|
50
|
+
(0, _data.dispatch)(_preferences.store).setDefaults('core/customize-widgets', {
|
|
51
51
|
fixedToolbar: false,
|
|
52
52
|
welcomeGuide: true
|
|
53
53
|
});
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/index.js"],"names":["wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/index.js"],"names":["wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","preferencesStore","setDefaults","fixedToolbar","welcomeGuide","blocksStore","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","block","includes","name","startsWith","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","SidebarControl","customize","sectionConstructor","sidebar","controlConstructor","sidebar_block_editor","container","document","createElement","body","appendChild","bind","sidebarControls","control","each","push"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AAKA;;AAIA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA3BA;AACA;AACA;;AAmBA;AACA;AACA;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAASC,MAAf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AAGC,QAAQ,CAACC,aAAT,CAAwB,KAAxB,CAAlB;AACAD,EAAAA,QAAQ,CAACE,IAAT,CAAcC,WAAd,CAA2BJ,SAA3B;AAEA7B,EAAAA,EAAE,CAACwB,SAAH,CAAaU,IAAb,CAAmB,OAAnB,EAA4B,MAAM;AACjC,UAAMC,eAAe,GAAG,EAAxB;AACAnC,IAAAA,EAAE,CAACwB,SAAH,CAAaY,OAAb,CAAqBC,IAArB,CAA6BD,OAAF,IAAe;AACzC,UAAKA,OAAO,YAAYb,cAAxB,EAAyC;AACxCY,QAAAA,eAAe,CAACG,IAAhB,CAAsBF,OAAtB;AACA;AACD,KAJD;AAMA,yBACC,4BAAC,yBAAD;AACC,MAAA,GAAG,EAAGpC,EAAE,CAACwB,SADV;AAEC,MAAA,eAAe,EAAGW,eAFnB;AAGC,MAAA,mBAAmB,EAAG7B;AAHvB,MADD,EAMCuB,SAND;AAQA,GAhBD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { render } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport CustomizeWidgets from './components/customize-widgets';\nimport getSidebarSection from './controls/sidebar-section';\nimport getSidebarControl from './controls/sidebar-control';\nimport './filters';\n\nconst { wp } = window;\n\nconst DISABLED_BLOCKS = [\n\t'core/more',\n\t'core/block',\n\t'core/freeform',\n\t'core/template-part',\n];\nconst ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n\n/**\n * Initializes the widgets block editor in the customizer.\n *\n * @param {string} editorName The editor name.\n * @param {Object} blockEditorSettings Block editor settings.\n */\nexport function initialize( editorName, blockEditorSettings ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/customize-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tDISABLED_BLOCKS.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( blockEditorSettings );\n\tregisterWidgetGroupBlock();\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\tconst SidebarControl = getSidebarControl( blockEditorSettings );\n\n\twp.customize.sectionConstructor.sidebar = getSidebarSection();\n\twp.customize.controlConstructor.sidebar_block_editor = SidebarControl;\n\n\tconst container = document.createElement( 'div' );\n\tdocument.body.appendChild( container );\n\n\twp.customize.bind( 'ready', () => {\n\t\tconst sidebarControls = [];\n\t\twp.customize.control.each( ( control ) => {\n\t\t\tif ( control instanceof SidebarControl ) {\n\t\t\t\tsidebarControls.push( control );\n\t\t\t}\n\t\t} );\n\n\t\trender(\n\t\t\t<CustomizeWidgets\n\t\t\t\tapi={ wp.customize }\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t/>,\n\t\t\tcontainer\n\t\t);\n\t} );\n}\n"]}
|
package/build/store/index.js
CHANGED
|
@@ -32,7 +32,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
32
32
|
/**
|
|
33
33
|
* Block editor data store configuration.
|
|
34
34
|
*
|
|
35
|
-
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#
|
|
35
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store
|
|
36
36
|
*
|
|
37
37
|
* @type {Object}
|
|
38
38
|
*/
|
|
@@ -49,9 +49,7 @@ const storeConfig = {
|
|
|
49
49
|
* @type {Object}
|
|
50
50
|
*/
|
|
51
51
|
|
|
52
|
-
const store = (0, _data.createReduxStore)(_constants.STORE_NAME, storeConfig);
|
|
53
|
-
// we'd be able to replace this with a register call.
|
|
54
|
-
|
|
52
|
+
const store = (0, _data.createReduxStore)(_constants.STORE_NAME, storeConfig);
|
|
55
53
|
exports.store = store;
|
|
56
|
-
(0, _data.
|
|
54
|
+
(0, _data.register)(store);
|
|
57
55
|
//# sourceMappingURL=index.js.map
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/index.js"],"names":["storeConfig","reducer","selectors","actions","store","STORE_NAME"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAG;AACnBC,EAAAA,OAAO,EAAPA,gBADmB;AAEnBC,EAAAA,SAFmB;AAGnBC,EAAAA;AAHmB,CAApB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8BL,WAA9B,CAAd,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/index.js"],"names":["storeConfig","reducer","selectors","actions","store","STORE_NAME"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAG;AACnBC,EAAAA,OAAO,EAAPA,gBADmB;AAEnBC,EAAAA,SAFmB;AAGnBC,EAAAA;AAHmB,CAApB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8BL,WAA9B,CAAd;;AACP,oBAAUI,KAAV","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n"]}
|
|
@@ -9,15 +9,13 @@ import { __, _x } from '@wordpress/i18n';
|
|
|
9
9
|
import { external } from '@wordpress/icons';
|
|
10
10
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
11
11
|
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
12
|
-
import { MoreMenuDropdown
|
|
12
|
+
import { MoreMenuDropdown } from '@wordpress/interface';
|
|
13
|
+
import { PreferenceToggleMenuItem } from '@wordpress/preferences';
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
18
|
-
const POPOVER_PROPS = {
|
|
19
|
-
className: 'customize-widgets-more-menu__content'
|
|
20
|
-
};
|
|
21
19
|
export default function MoreMenu() {
|
|
22
20
|
const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = useState(false);
|
|
23
21
|
|
|
@@ -25,14 +23,12 @@ export default function MoreMenu() {
|
|
|
25
23
|
|
|
26
24
|
useShortcut('core/customize-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
|
|
27
25
|
return createElement(Fragment, null, createElement(MoreMenuDropdown, {
|
|
28
|
-
as: ToolbarDropdownMenu
|
|
29
|
-
className: "customize-widgets-more-menu",
|
|
30
|
-
popoverProps: POPOVER_PROPS
|
|
26
|
+
as: ToolbarDropdownMenu
|
|
31
27
|
}, () => createElement(Fragment, null, createElement(MenuGroup, {
|
|
32
28
|
label: _x('View', 'noun')
|
|
33
|
-
}, createElement(
|
|
29
|
+
}, createElement(PreferenceToggleMenuItem, {
|
|
34
30
|
scope: "core/customize-widgets",
|
|
35
|
-
|
|
31
|
+
name: "fixedToolbar",
|
|
36
32
|
label: __('Top toolbar'),
|
|
37
33
|
info: __('Access all block and document tools in a single place'),
|
|
38
34
|
messageActivated: __('Top toolbar activated'),
|
|
@@ -44,9 +40,9 @@ export default function MoreMenu() {
|
|
|
44
40
|
setIsKeyboardShortcutsModalVisible(true);
|
|
45
41
|
},
|
|
46
42
|
shortcut: displayShortcut.access('h')
|
|
47
|
-
}, __('Keyboard shortcuts')), createElement(
|
|
43
|
+
}, __('Keyboard shortcuts')), createElement(PreferenceToggleMenuItem, {
|
|
48
44
|
scope: "core/customize-widgets",
|
|
49
|
-
|
|
45
|
+
name: "welcomeGuide",
|
|
50
46
|
label: __('Welcome Guide')
|
|
51
47
|
}), createElement(MenuItem, {
|
|
52
48
|
role: "menuitem",
|
|
@@ -60,9 +56,9 @@ export default function MoreMenu() {
|
|
|
60
56
|
/* translators: accessibility text */
|
|
61
57
|
__('(opens in a new tab)')))), createElement(MenuGroup, {
|
|
62
58
|
label: __('Preferences')
|
|
63
|
-
}, createElement(
|
|
59
|
+
}, createElement(PreferenceToggleMenuItem, {
|
|
64
60
|
scope: "core/customize-widgets",
|
|
65
|
-
|
|
61
|
+
name: "keepCaretInsideBlock",
|
|
66
62
|
label: __('Contain text cursor inside block'),
|
|
67
63
|
info: __('Aids screen readers by stopping text caret from leaving blocks.'),
|
|
68
64
|
messageActivated: __('Contain text cursor inside block activated'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/more-menu/index.js"],"names":["MenuGroup","MenuItem","ToolbarDropdownMenu","VisuallyHidden","useState","__","_x","external","displayShortcut","useShortcut","MoreMenuDropdown","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/more-menu/index.js"],"names":["MenuGroup","MenuItem","ToolbarDropdownMenu","VisuallyHidden","useState","__","_x","external","displayShortcut","useShortcut","MoreMenuDropdown","PreferenceToggleMenuItem","KeyboardShortcutHelpModal","MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","access"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,SADD,EAECC,QAFD,EAGCC,mBAHD,EAICC,cAJD,QAKO,uBALP;AAMA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,SAASC,wBAAT,QAAyC,wBAAzC;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AAEA,eAAe,SAASC,QAAT,GAAoB;AAClC,QAAM,CACLC,8BADK,EAELC,kCAFK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,cAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,EAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CAdD,CAjBD,EAiDC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAGA,EAAE,CAAE,aAAF;AAArB,KACC,cAAC,wBAAD;AACC,IAAA,KAAK,EAAC,wBADP;AAEC,IAAA,IAAI,EAAC,sBAFN;AAGC,IAAA,KAAK,EAAGA,EAAE,CACT,kCADS,CAHX;AAMC,IAAA,IAAI,EAAGA,EAAE,CACR,iEADQ,CANV;AASC,IAAA,gBAAgB,EAAGA,EAAE,CACpB,4CADoB,CATtB;AAYC,IAAA,kBAAkB,EAAGA,EAAE,CACtB,8CADsB;AAZxB,IADD,CAjDD,CAFF,CADD,EAyEC,cAAC,yBAAD;AACC,IAAA,aAAa,EAAGS,8BADjB;AAEC,IAAA,WAAW,EAAGE;AAFf,IAzED,CADD;AAgFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tToolbarDropdownMenu,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { MoreMenuDropdown } from '@wordpress/interface';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<MoreMenuDropdown as={ ToolbarDropdownMenu }>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"welcomeGuide\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</MoreMenuDropdown>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -13,7 +13,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
13
13
|
import { useMemo, createPortal } from '@wordpress/element';
|
|
14
14
|
import { BlockList, BlockTools, BlockSelectionClearer, BlockInspector, CopyHandler, ObserveTyping, WritingFlow, BlockEditorKeyboardShortcuts, __unstableBlockSettingsMenuFirstItem, __unstableEditorStyles as EditorStyles } from '@wordpress/block-editor';
|
|
15
15
|
import { uploadMedia } from '@wordpress/media-utils';
|
|
16
|
-
import { store as
|
|
16
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
17
17
|
/**
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
@@ -40,13 +40,13 @@ export default function SidebarBlockEditor(_ref) {
|
|
|
40
40
|
isWelcomeGuideActive
|
|
41
41
|
} = useSelect(select => {
|
|
42
42
|
const {
|
|
43
|
-
|
|
44
|
-
} = select(
|
|
43
|
+
get
|
|
44
|
+
} = select(preferencesStore);
|
|
45
45
|
return {
|
|
46
46
|
hasUploadPermissions: defaultTo(select(coreStore).canUser('create', 'media'), true),
|
|
47
|
-
isFixedToolbarActive:
|
|
48
|
-
keepCaretInsideBlock:
|
|
49
|
-
isWelcomeGuideActive:
|
|
47
|
+
isFixedToolbarActive: !!get('core/customize-widgets', 'fixedToolbar'),
|
|
48
|
+
keepCaretInsideBlock: !!get('core/customize-widgets', 'keepCaretInsideBlock'),
|
|
49
|
+
isWelcomeGuideActive: !!get('core/customize-widgets', 'welcomeGuide')
|
|
50
50
|
};
|
|
51
51
|
}, []);
|
|
52
52
|
const settings = useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"names":["defaultTo","store","coreStore","useSelect","useMemo","createPortal","BlockList","BlockTools","BlockSelectionClearer","BlockInspector","CopyHandler","ObserveTyping","WritingFlow","BlockEditorKeyboardShortcuts","__unstableBlockSettingsMenuFirstItem","__unstableEditorStyles","EditorStyles","uploadMedia","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"names":["defaultTo","store","coreStore","useSelect","useMemo","createPortal","BlockList","BlockTools","BlockSelectionClearer","BlockInspector","CopyHandler","ObserveTyping","WritingFlow","BlockEditorKeyboardShortcuts","__unstableBlockSettingsMenuFirstItem","__unstableEditorStyles","EditorStyles","uploadMedia","preferencesStore","BlockInspectorButton","Header","useInserter","SidebarEditorProvider","WelcomeGuide","KeyboardShortcuts","BlockAppender","SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","get","canUser","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","undo","redo","save","defaultEditorStyles","event","preventDefault","contentContainer","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,EAAkBC,YAAlB,QAAsC,oBAAtC;AACA,SACCC,SADD,EAECC,UAFD,EAGCC,qBAHD,EAICC,cAJD,EAKCC,WALD,EAMCC,aAND,EAOCC,WAPD,EAQCC,4BARD,EASCC,oCATD,EAUCC,sBAAsB,IAAIC,YAV3B,QAWO,yBAXP;AAYA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAAShB,KAAK,IAAIiB,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,WAAP,MAAwB,0BAAxB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AAGM,QAAQ,CAACc;AAAhC,IADD,EAEC,cAAC,qBAAD,QACC,cAAC,WAAD;AAAa,IAAA,SAAS,EAAC;AAAvB,KACC,cAAC,aAAD,QACC,cAAC,SAAD;AACC,IAAA,cAAc,EAAG7B;AADlB,IADD,CADD,CADD,CAFD,CADD,CAfD,EA8BGpB,YAAY,EACb;AACA;AACA;AAAM,IAAA,QAAQ,EAAKkD,KAAF,IAAaA,KAAK,CAACC,cAAN;AAA9B,KACC,cAAC,cAAD,OADD,CAHa,EAMb1B,SAAS,CAAC2B,gBAAV,CAA4B,CAA5B,CANa,CA9Bf,CAJD,EA4CC,cAAC,oCAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,oBAAD;AACC,MAAA,SAAS,EAAG5B,SADb;AAEC,MAAA,SAAS,EAAG4B;AAFb,MADC;AAAA,GADH,CA5CD,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport { defaultTo } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tBlockInspector,\n\tCopyHandler,\n\tObserveTyping,\n\tWritingFlow,\n\tBlockEditorKeyboardShortcuts,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={ isFixedToolbarActive }\n\t\t\t\t/>\n\n\t\t\t\t<CopyHandler>\n\t\t\t\t\t<BlockTools>\n\t\t\t\t\t\t<EditorStyles styles={ settings.defaultEditorStyles } />\n\t\t\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t\t\t<WritingFlow className=\"editor-styles-wrapper\">\n\t\t\t\t\t\t\t\t<ObserveTyping>\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\trenderAppender={ BlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ObserveTyping>\n\t\t\t\t\t\t\t</WritingFlow>\n\t\t\t\t\t\t</BlockSelectionClearer>\n\t\t\t\t\t</BlockTools>\n\t\t\t\t</CopyHandler>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -6,14 +6,14 @@ import { createElement } from "@wordpress/element";
|
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { Button, ExternalLink } from '@wordpress/components';
|
|
8
8
|
import { useDispatch } from '@wordpress/data';
|
|
9
|
-
import { store as
|
|
9
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
10
10
|
export default function WelcomeGuide(_ref) {
|
|
11
11
|
let {
|
|
12
12
|
sidebar
|
|
13
13
|
} = _ref;
|
|
14
14
|
const {
|
|
15
|
-
|
|
16
|
-
} = useDispatch(
|
|
15
|
+
toggle
|
|
16
|
+
} = useDispatch(preferencesStore);
|
|
17
17
|
const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-'));
|
|
18
18
|
return createElement("div", {
|
|
19
19
|
className: "customize-widgets-welcome-guide"
|
|
@@ -35,7 +35,7 @@ export default function WelcomeGuide(_ref) {
|
|
|
35
35
|
}, isEntirelyBlockWidgets ? __('Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.') : __('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), createElement(Button, {
|
|
36
36
|
className: "customize-widgets-welcome-guide__button",
|
|
37
37
|
variant: "primary",
|
|
38
|
-
onClick: () =>
|
|
38
|
+
onClick: () => toggle('core/customize-widgets', 'welcomeGuide')
|
|
39
39
|
}, __('Got it')), createElement("hr", {
|
|
40
40
|
className: "customize-widgets-welcome-guide__separator"
|
|
41
41
|
}), !isEntirelyBlockWidgets && createElement("p", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["__","Button","ExternalLink","useDispatch","store","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["__","Button","ExternalLink","useDispatch","store","preferencesStore","WelcomeGuide","sidebar","toggle","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAqC,uBAArC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA,eAAe,SAASC,YAAT,OAAqC;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACnD,QAAM;AAAEC,IAAAA;AAAF,MAAaL,WAAW,CAAEE,gBAAF,CAA9B;AAEA,QAAMI,sBAAsB,GAAGF,OAAO,CACpCG,UAD6B,GAE7BC,KAF6B,CAEpBC,MAAF,IAAcA,MAAM,CAACC,EAAP,CAAUC,UAAV,CAAsB,QAAtB,CAFQ,CAA/B;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,+BACC;AACC,IAAA,MAAM,EAAC,wDADR;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,GAAG,EAAC,wDAFL;AAGC,IAAA,KAAK,EAAC,KAHP;AAIC,IAAA,MAAM,EAAC,KAJR;AAKC,IAAA,GAAG,EAAC;AALL,IALD,CADD,CADD,EAgBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGd,EAAE,CAAE,0BAAF,CADL,CAhBD,EAmBC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGS,sBAAsB,GACrBT,EAAE,CACF,0LADE,CADmB,GAIrBA,EAAE,CACF,yHADE,CALN,CAnBD,EA4BC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,OAAO,EAAG,MACTQ,MAAM,CAAE,wBAAF,EAA4B,cAA5B;AAJR,KAOGR,EAAE,CAAE,QAAF,CAPL,CA5BD,EAqCC;AAAI,IAAA,SAAS,EAAC;AAAd,IArCD,EAsCG,CAAES,sBAAF,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACGT,EAAE,CAAE,qCAAF,CADL,EAEC,yBAFD,EAGC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGA,EAAE,CACR,gDADQ;AADV,KAKGA,EAAE,CAAE,iCAAF,CALL,CAHD,CAvCF,EAmDC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,EAAE,CAAE,0BAAF,CADL,EAEC,yBAFD,EAGC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGA,EAAE,CACR,yDADQ;AADV,KAKGA,EAAE,CAAE,0BAAF,CALL,CAHD,CAnDD,CADD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t ) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"customize-widgets-welcome-guide__button\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggle( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/support/article/wordpress-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegister
|
|
|
8
8
|
import { registerLegacyWidgetBlock, registerLegacyWidgetVariations, registerWidgetGroupBlock } from '@wordpress/widgets';
|
|
9
9
|
import { setFreeformContentHandlerName, store as blocksStore } from '@wordpress/blocks';
|
|
10
10
|
import { dispatch } from '@wordpress/data';
|
|
11
|
-
import { store as
|
|
11
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
@@ -30,7 +30,7 @@ const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
export function initialize(editorName, blockEditorSettings) {
|
|
33
|
-
dispatch(
|
|
33
|
+
dispatch(preferencesStore).setDefaults('core/customize-widgets', {
|
|
34
34
|
fixedToolbar: false,
|
|
35
35
|
welcomeGuide: true
|
|
36
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/index.js"],"names":["render","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","setFreeformContentHandlerName","store","blocksStore","dispatch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/index.js"],"names":["render","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","setFreeformContentHandlerName","store","blocksStore","dispatch","preferencesStore","CustomizeWidgets","getSidebarSection","getSidebarControl","wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","setDefaults","fixedToolbar","welcomeGuide","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","block","includes","name","startsWith","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","SidebarControl","customize","sectionConstructor","sidebar","controlConstructor","sidebar_block_editor","container","document","createElement","body","appendChild","bind","sidebarControls","control","each","push"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,oBAAvB;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC,4CAHD,QAIO,0BAJP;AAKA,SACCC,yBADD,EAECC,8BAFD,EAGCC,wBAHD,QAIO,oBAJP;AAKA,SACCC,6BADD,EAECC,KAAK,IAAIC,WAFV,QAGO,mBAHP;AAIA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SAASF,KAAK,IAAIG,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,gBAAP,MAA6B,gCAA7B;AACA,OAAOC,iBAAP,MAA8B,4BAA9B;AACA,OAAOC,iBAAP,MAA8B,4BAA9B;AACA,OAAO,WAAP;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAASC,MAAf;AAEA,MAAMC,eAAe,GAAG,CACvB,WADuB,EAEvB,YAFuB,EAGvB,eAHuB,EAIvB,oBAJuB,CAAxB;AAMA,MAAMC,8BAA8B,GAAG,KAAvC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,UAAT,CAAqBC,UAArB,EAAiCC,mBAAjC,EAAuD;AAC7DX,EAAAA,QAAQ,CAAEC,gBAAF,CAAR,CAA6BW,WAA7B,CAA0C,wBAA1C,EAAoE;AACnEC,IAAAA,YAAY,EAAE,KADqD;AAEnEC,IAAAA,YAAY,EAAE;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B,OAAnB,EAA4B,MAAM;AACjC,UAAMC,eAAe,GAAG,EAAxB;AACAjC,IAAAA,EAAE,CAACsB,SAAH,CAAaY,OAAb,CAAqBC,IAArB,CAA6BD,OAAF,IAAe;AACzC,UAAKA,OAAO,YAAYb,cAAxB,EAAyC;AACxCY,QAAAA,eAAe,CAACG,IAAhB,CAAsBF,OAAtB;AACA;AACD,KAJD;AAMAjD,IAAAA,MAAM,CACL,cAAC,gBAAD;AACC,MAAA,GAAG,EAAGe,EAAE,CAACsB,SADV;AAEC,MAAA,eAAe,EAAGW,eAFnB;AAGC,MAAA,mBAAmB,EAAG3B;AAHvB,MADK,EAMLqB,SANK,CAAN;AAQA,GAhBD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { render } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport CustomizeWidgets from './components/customize-widgets';\nimport getSidebarSection from './controls/sidebar-section';\nimport getSidebarControl from './controls/sidebar-control';\nimport './filters';\n\nconst { wp } = window;\n\nconst DISABLED_BLOCKS = [\n\t'core/more',\n\t'core/block',\n\t'core/freeform',\n\t'core/template-part',\n];\nconst ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n\n/**\n * Initializes the widgets block editor in the customizer.\n *\n * @param {string} editorName The editor name.\n * @param {Object} blockEditorSettings Block editor settings.\n */\nexport function initialize( editorName, blockEditorSettings ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/customize-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tDISABLED_BLOCKS.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( blockEditorSettings );\n\tregisterWidgetGroupBlock();\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\tconst SidebarControl = getSidebarControl( blockEditorSettings );\n\n\twp.customize.sectionConstructor.sidebar = getSidebarSection();\n\twp.customize.controlConstructor.sidebar_block_editor = SidebarControl;\n\n\tconst container = document.createElement( 'div' );\n\tdocument.body.appendChild( container );\n\n\twp.customize.bind( 'ready', () => {\n\t\tconst sidebarControls = [];\n\t\twp.customize.control.each( ( control ) => {\n\t\t\tif ( control instanceof SidebarControl ) {\n\t\t\t\tsidebarControls.push( control );\n\t\t\t}\n\t\t} );\n\n\t\trender(\n\t\t\t<CustomizeWidgets\n\t\t\t\tapi={ wp.customize }\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t/>,\n\t\t\tcontainer\n\t\t);\n\t} );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { createReduxStore,
|
|
4
|
+
import { createReduxStore, register } from '@wordpress/data';
|
|
5
5
|
/**
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
@@ -13,7 +13,7 @@ import { STORE_NAME } from './constants';
|
|
|
13
13
|
/**
|
|
14
14
|
* Block editor data store configuration.
|
|
15
15
|
*
|
|
16
|
-
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#
|
|
16
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store
|
|
17
17
|
*
|
|
18
18
|
* @type {Object}
|
|
19
19
|
*/
|
|
@@ -31,8 +31,6 @@ const storeConfig = {
|
|
|
31
31
|
* @type {Object}
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
-
export const store = createReduxStore(STORE_NAME, storeConfig);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
registerStore(STORE_NAME, storeConfig);
|
|
34
|
+
export const store = createReduxStore(STORE_NAME, storeConfig);
|
|
35
|
+
register(store);
|
|
38
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/index.js"],"names":["createReduxStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/index.js"],"names":["createReduxStore","register","reducer","selectors","actions","STORE_NAME","storeConfig","store"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,QAA3B,QAA2C,iBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAG;AACnBJ,EAAAA,OADmB;AAEnBC,EAAAA,SAFmB;AAGnBC,EAAAA;AAHmB,CAApB;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMG,KAAK,GAAGP,gBAAgB,CAAEK,UAAF,EAAcC,WAAd,CAA9B;AACPL,QAAQ,CAAEM,KAAF,CAAR","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n"]}
|
|
@@ -232,39 +232,6 @@
|
|
|
232
232
|
margin: 0 0.2rem 0 0;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
.customize-widgets-more-menu {
|
|
236
|
-
margin-right: -4px;
|
|
237
|
-
}
|
|
238
|
-
.customize-widgets-more-menu .components-button {
|
|
239
|
-
width: auto;
|
|
240
|
-
padding: 0 2px;
|
|
241
|
-
}
|
|
242
|
-
@media (min-width: 600px) {
|
|
243
|
-
.customize-widgets-more-menu {
|
|
244
|
-
margin-right: 0;
|
|
245
|
-
}
|
|
246
|
-
.customize-widgets-more-menu .components-button {
|
|
247
|
-
padding: 0 4px;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.customize-widgets-more-menu__content .components-popover__content {
|
|
252
|
-
min-width: 280px;
|
|
253
|
-
}
|
|
254
|
-
@media (min-width: 480px) {
|
|
255
|
-
.customize-widgets-more-menu__content .components-popover__content {
|
|
256
|
-
width: auto;
|
|
257
|
-
max-width: 480px;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
.customize-widgets-more-menu__content .components-popover__content .components-dropdown-menu__menu {
|
|
261
|
-
padding: 0;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.components-popover.customize-widgets-more-menu__content {
|
|
265
|
-
z-index: 99998;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
235
|
.block-editor-block-contextual-toolbar.is-fixed {
|
|
269
236
|
top: 0;
|
|
270
237
|
margin-right: -12px;
|
package/build-style/style.css
CHANGED
|
@@ -232,39 +232,6 @@
|
|
|
232
232
|
margin: 0 0 0 0.2rem;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
.customize-widgets-more-menu {
|
|
236
|
-
margin-left: -4px;
|
|
237
|
-
}
|
|
238
|
-
.customize-widgets-more-menu .components-button {
|
|
239
|
-
width: auto;
|
|
240
|
-
padding: 0 2px;
|
|
241
|
-
}
|
|
242
|
-
@media (min-width: 600px) {
|
|
243
|
-
.customize-widgets-more-menu {
|
|
244
|
-
margin-left: 0;
|
|
245
|
-
}
|
|
246
|
-
.customize-widgets-more-menu .components-button {
|
|
247
|
-
padding: 0 4px;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.customize-widgets-more-menu__content .components-popover__content {
|
|
252
|
-
min-width: 280px;
|
|
253
|
-
}
|
|
254
|
-
@media (min-width: 480px) {
|
|
255
|
-
.customize-widgets-more-menu__content .components-popover__content {
|
|
256
|
-
width: auto;
|
|
257
|
-
max-width: 480px;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
.customize-widgets-more-menu__content .components-popover__content .components-dropdown-menu__menu {
|
|
261
|
-
padding: 0;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.components-popover.customize-widgets-more-menu__content {
|
|
265
|
-
z-index: 99998;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
235
|
.block-editor-block-contextual-toolbar.is-fixed {
|
|
269
236
|
top: 0;
|
|
270
237
|
margin-left: -12px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3-next.a55ed9455a.0",
|
|
4
4
|
"description": "Widgets blocks in Customizer Module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -24,29 +24,34 @@
|
|
|
24
24
|
"react-native": "src/index",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.16.0",
|
|
27
|
-
"@wordpress/block-editor": "^8.2.0",
|
|
28
|
-
"@wordpress/block-library": "^7.0.
|
|
29
|
-
"@wordpress/blocks": "^11.2.
|
|
30
|
-
"@wordpress/components": "^19.
|
|
31
|
-
"@wordpress/compose": "^5.1.
|
|
32
|
-
"@wordpress/core-data": "^4.1.
|
|
33
|
-
"@wordpress/data": "^6.3.0",
|
|
34
|
-
"@wordpress/dom": "^3.3.
|
|
35
|
-
"@wordpress/element": "^4.1.
|
|
36
|
-
"@wordpress/hooks": "^3.3.
|
|
37
|
-
"@wordpress/i18n": "^4.3.
|
|
38
|
-
"@wordpress/icons": "^7.0.
|
|
39
|
-
"@wordpress/interface": "^4.2.
|
|
40
|
-
"@wordpress/is-shallow-equal": "^4.3.
|
|
41
|
-
"@wordpress/keyboard-shortcuts": "^3.1.
|
|
42
|
-
"@wordpress/keycodes": "^3.3.
|
|
43
|
-
"@wordpress/media-utils": "^3.1.
|
|
44
|
-
"@wordpress/
|
|
27
|
+
"@wordpress/block-editor": "^8.2.1-next.a55ed9455a.0",
|
|
28
|
+
"@wordpress/block-library": "^7.0.3-next.a55ed9455a.0",
|
|
29
|
+
"@wordpress/blocks": "^11.2.3-next.a55ed9455a.0",
|
|
30
|
+
"@wordpress/components": "^19.6.1-next.a55ed9455a.0",
|
|
31
|
+
"@wordpress/compose": "^5.1.3-next.a55ed9455a.0",
|
|
32
|
+
"@wordpress/core-data": "^4.1.3-next.a55ed9455a.0",
|
|
33
|
+
"@wordpress/data": "^6.3.1-next.a55ed9455a.0",
|
|
34
|
+
"@wordpress/dom": "^3.3.3-next.a55ed9455a.0",
|
|
35
|
+
"@wordpress/element": "^4.1.3-next.a55ed9455a.0",
|
|
36
|
+
"@wordpress/hooks": "^3.3.2-next.a55ed9455a.0",
|
|
37
|
+
"@wordpress/i18n": "^4.3.2-next.a55ed9455a.0",
|
|
38
|
+
"@wordpress/icons": "^7.0.2-next.a55ed9455a.0",
|
|
39
|
+
"@wordpress/interface": "^4.2.4-next.a55ed9455a.0",
|
|
40
|
+
"@wordpress/is-shallow-equal": "^4.3.2-next.a55ed9455a.0",
|
|
41
|
+
"@wordpress/keyboard-shortcuts": "^3.1.3-next.a55ed9455a.0",
|
|
42
|
+
"@wordpress/keycodes": "^3.3.2-next.a55ed9455a.0",
|
|
43
|
+
"@wordpress/media-utils": "^3.1.2-next.a55ed9455a.0",
|
|
44
|
+
"@wordpress/preferences": "^1.0.0-prerelease",
|
|
45
|
+
"@wordpress/widgets": "^2.1.4-next.a55ed9455a.0",
|
|
45
46
|
"classnames": "^2.3.1",
|
|
46
47
|
"lodash": "^4.17.21"
|
|
47
48
|
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": "^17.0.0",
|
|
51
|
+
"react-dom": "^17.0.0"
|
|
52
|
+
},
|
|
48
53
|
"publishConfig": {
|
|
49
54
|
"access": "public"
|
|
50
55
|
},
|
|
51
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "c5108185851b824d531bce55991a3589947e8551"
|
|
52
57
|
}
|
|
@@ -12,17 +12,14 @@ import { __, _x } from '@wordpress/i18n';
|
|
|
12
12
|
import { external } from '@wordpress/icons';
|
|
13
13
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
14
14
|
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
15
|
-
import { MoreMenuDropdown
|
|
15
|
+
import { MoreMenuDropdown } from '@wordpress/interface';
|
|
16
|
+
import { PreferenceToggleMenuItem } from '@wordpress/preferences';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
19
20
|
*/
|
|
20
21
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
21
22
|
|
|
22
|
-
const POPOVER_PROPS = {
|
|
23
|
-
className: 'customize-widgets-more-menu__content',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
23
|
export default function MoreMenu() {
|
|
27
24
|
const [
|
|
28
25
|
isKeyboardShortcutsModalActive,
|
|
@@ -38,17 +35,13 @@ export default function MoreMenu() {
|
|
|
38
35
|
|
|
39
36
|
return (
|
|
40
37
|
<>
|
|
41
|
-
<MoreMenuDropdown
|
|
42
|
-
as={ ToolbarDropdownMenu }
|
|
43
|
-
className="customize-widgets-more-menu"
|
|
44
|
-
popoverProps={ POPOVER_PROPS }
|
|
45
|
-
>
|
|
38
|
+
<MoreMenuDropdown as={ ToolbarDropdownMenu }>
|
|
46
39
|
{ () => (
|
|
47
40
|
<>
|
|
48
41
|
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
49
|
-
<
|
|
42
|
+
<PreferenceToggleMenuItem
|
|
50
43
|
scope="core/customize-widgets"
|
|
51
|
-
|
|
44
|
+
name="fixedToolbar"
|
|
52
45
|
label={ __( 'Top toolbar' ) }
|
|
53
46
|
info={ __(
|
|
54
47
|
'Access all block and document tools in a single place'
|
|
@@ -70,9 +63,9 @@ export default function MoreMenu() {
|
|
|
70
63
|
>
|
|
71
64
|
{ __( 'Keyboard shortcuts' ) }
|
|
72
65
|
</MenuItem>
|
|
73
|
-
<
|
|
66
|
+
<PreferenceToggleMenuItem
|
|
74
67
|
scope="core/customize-widgets"
|
|
75
|
-
|
|
68
|
+
name="welcomeGuide"
|
|
76
69
|
label={ __( 'Welcome Guide' ) }
|
|
77
70
|
/>
|
|
78
71
|
<MenuItem
|
|
@@ -94,9 +87,9 @@ export default function MoreMenu() {
|
|
|
94
87
|
</MenuItem>
|
|
95
88
|
</MenuGroup>
|
|
96
89
|
<MenuGroup label={ __( 'Preferences' ) }>
|
|
97
|
-
<
|
|
90
|
+
<PreferenceToggleMenuItem
|
|
98
91
|
scope="core/customize-widgets"
|
|
99
|
-
|
|
92
|
+
name="keepCaretInsideBlock"
|
|
100
93
|
label={ __(
|
|
101
94
|
'Contain text cursor inside block'
|
|
102
95
|
) }
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
__unstableEditorStyles as EditorStyles,
|
|
23
23
|
} from '@wordpress/block-editor';
|
|
24
24
|
import { uploadMedia } from '@wordpress/media-utils';
|
|
25
|
-
import { store as
|
|
25
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal dependencies
|
|
@@ -48,21 +48,21 @@ export default function SidebarBlockEditor( {
|
|
|
48
48
|
keepCaretInsideBlock,
|
|
49
49
|
isWelcomeGuideActive,
|
|
50
50
|
} = useSelect( ( select ) => {
|
|
51
|
-
const {
|
|
51
|
+
const { get } = select( preferencesStore );
|
|
52
52
|
return {
|
|
53
53
|
hasUploadPermissions: defaultTo(
|
|
54
54
|
select( coreStore ).canUser( 'create', 'media' ),
|
|
55
55
|
true
|
|
56
56
|
),
|
|
57
|
-
isFixedToolbarActive:
|
|
57
|
+
isFixedToolbarActive: !! get(
|
|
58
58
|
'core/customize-widgets',
|
|
59
59
|
'fixedToolbar'
|
|
60
60
|
),
|
|
61
|
-
keepCaretInsideBlock:
|
|
61
|
+
keepCaretInsideBlock: !! get(
|
|
62
62
|
'core/customize-widgets',
|
|
63
63
|
'keepCaretInsideBlock'
|
|
64
64
|
),
|
|
65
|
-
isWelcomeGuideActive:
|
|
65
|
+
isWelcomeGuideActive: !! get(
|
|
66
66
|
'core/customize-widgets',
|
|
67
67
|
'welcomeGuide'
|
|
68
68
|
),
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { Button, ExternalLink } from '@wordpress/components';
|
|
6
6
|
import { useDispatch } from '@wordpress/data';
|
|
7
|
-
import { store as
|
|
7
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
8
8
|
|
|
9
9
|
export default function WelcomeGuide( { sidebar } ) {
|
|
10
|
-
const {
|
|
10
|
+
const { toggle } = useDispatch( preferencesStore );
|
|
11
11
|
|
|
12
12
|
const isEntirelyBlockWidgets = sidebar
|
|
13
13
|
.getWidgets()
|
|
@@ -46,7 +46,7 @@ export default function WelcomeGuide( { sidebar } ) {
|
|
|
46
46
|
className="customize-widgets-welcome-guide__button"
|
|
47
47
|
variant="primary"
|
|
48
48
|
onClick={ () =>
|
|
49
|
-
|
|
49
|
+
toggle( 'core/customize-widgets', 'welcomeGuide' )
|
|
50
50
|
}
|
|
51
51
|
>
|
|
52
52
|
{ __( 'Got it' ) }
|
package/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
store as blocksStore,
|
|
18
18
|
} from '@wordpress/blocks';
|
|
19
19
|
import { dispatch } from '@wordpress/data';
|
|
20
|
-
import { store as
|
|
20
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
@@ -44,7 +44,7 @@ const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
|
44
44
|
* @param {Object} blockEditorSettings Block editor settings.
|
|
45
45
|
*/
|
|
46
46
|
export function initialize( editorName, blockEditorSettings ) {
|
|
47
|
-
dispatch(
|
|
47
|
+
dispatch( preferencesStore ).setDefaults( 'core/customize-widgets', {
|
|
48
48
|
fixedToolbar: false,
|
|
49
49
|
welcomeGuide: true,
|
|
50
50
|
} );
|
package/src/store/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { createReduxStore,
|
|
4
|
+
import { createReduxStore, register } from '@wordpress/data';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -14,7 +14,7 @@ import { STORE_NAME } from './constants';
|
|
|
14
14
|
/**
|
|
15
15
|
* Block editor data store configuration.
|
|
16
16
|
*
|
|
17
|
-
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#
|
|
17
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store
|
|
18
18
|
*
|
|
19
19
|
* @type {Object}
|
|
20
20
|
*/
|
|
@@ -32,7 +32,4 @@ const storeConfig = {
|
|
|
32
32
|
* @type {Object}
|
|
33
33
|
*/
|
|
34
34
|
export const store = createReduxStore( STORE_NAME, storeConfig );
|
|
35
|
-
|
|
36
|
-
// Once we build a more generic persistence plugin that works across types of stores
|
|
37
|
-
// we'd be able to replace this with a register call.
|
|
38
|
-
registerStore( STORE_NAME, storeConfig );
|
|
35
|
+
register( store );
|
package/src/style.scss
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
@import "./components/header/style.scss";
|
|
3
3
|
@import "./components/inserter/style.scss";
|
|
4
4
|
@import "./components/keyboard-shortcut-help-modal/style.scss";
|
|
5
|
-
@import "./components/more-menu/style.scss";
|
|
6
5
|
@import "./components/sidebar-block-editor/style.scss";
|
|
7
6
|
@import "./components/welcome-guide/style.scss";
|
|
8
7
|
@import "./controls/style.scss";
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
.customize-widgets-more-menu {
|
|
2
|
-
margin-left: -4px;
|
|
3
|
-
|
|
4
|
-
// the padding and margin of the more menu is intentionally non-standard
|
|
5
|
-
.components-button {
|
|
6
|
-
width: auto;
|
|
7
|
-
padding: 0 2px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@include break-small() {
|
|
11
|
-
margin-left: 0;
|
|
12
|
-
|
|
13
|
-
.components-button {
|
|
14
|
-
padding: 0 4px;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.customize-widgets-more-menu__content .components-popover__content {
|
|
20
|
-
min-width: 280px;
|
|
21
|
-
|
|
22
|
-
// Let the menu scale to fit items.
|
|
23
|
-
@include break-mobile() {
|
|
24
|
-
width: auto;
|
|
25
|
-
max-width: $break-mobile;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.components-dropdown-menu__menu {
|
|
29
|
-
padding: 0;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.components-popover.customize-widgets-more-menu__content {
|
|
34
|
-
z-index: z-index(".components-popover.customize-widgets-more-menu__content");
|
|
35
|
-
}
|