@wordpress/customize-widgets 2.0.1-next.5df0cd52b7.0 → 2.0.4
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/README.md +3 -3
- package/build/components/customize-widgets/index.js +4 -2
- package/build/components/customize-widgets/index.js.map +1 -1
- package/build/components/inserter/index.js +1 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/use-inserter.js +1 -1
- package/build/components/inserter/use-inserter.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -6
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/more-menu/index.js +12 -19
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/sidebar-block-editor/index.js +8 -5
- package/build/components/sidebar-block-editor/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +4 -8
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/controls/inspector-section.js +45 -0
- package/build/controls/inspector-section.js.map +1 -1
- package/build/index.js +13 -1
- package/build/index.js.map +1 -1
- package/build/store/actions.js +0 -20
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +1 -2
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +2 -51
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +0 -24
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/customize-widgets/index.js +3 -2
- package/build-module/components/customize-widgets/index.js.map +1 -1
- package/build-module/components/inserter/index.js +1 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/use-inserter.js +1 -1
- package/build-module/components/inserter/use-inserter.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +0 -6
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +14 -21
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/index.js +7 -4
- package/build-module/components/sidebar-block-editor/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +4 -8
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/controls/inspector-section.js +45 -0
- package/build-module/controls/inspector-section.js.map +1 -1
- package/build-module/index.js +13 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +0 -18
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -46
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +0 -21
- package/build-module/store/selectors.js.map +1 -1
- package/package.json +21 -20
- package/src/components/customize-widgets/index.js +17 -11
- package/src/components/inserter/index.js +4 -2
- package/src/components/inserter/style.scss +1 -1
- package/src/components/inserter/use-inserter.js +3 -2
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +15 -12
- package/src/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/src/components/keyboard-shortcuts/index.js +12 -24
- package/src/components/more-menu/index.js +13 -20
- package/src/components/sidebar-block-editor/index.js +14 -10
- package/src/components/welcome-guide/index.js +5 -9
- package/src/controls/inspector-section.js +40 -0
- package/src/index.js +14 -1
- package/src/store/actions.js +0 -18
- package/src/store/index.js +0 -1
- package/src/store/reducer.js +0 -47
- package/src/store/selectors.js +0 -21
- package/build/components/more-menu/feature-toggle.js +0 -62
- package/build/components/more-menu/feature-toggle.js.map +0 -1
- package/build/store/defaults.js +0 -14
- package/build/store/defaults.js.map +0 -1
- package/build-module/components/more-menu/feature-toggle.js +0 -49
- package/build-module/components/more-menu/feature-toggle.js.map +0 -1
- package/build-module/store/defaults.js +0 -7
- package/build-module/store/defaults.js.map +0 -1
- package/src/components/more-menu/feature-toggle.js +0 -56
- package/src/store/defaults.js +0 -6
|
@@ -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":["MenuGroup","MenuItem","ToolbarDropdownMenu","VisuallyHidden","useState","__","_x","external","displayShortcut","useShortcut","MoreMenuDropdown","MoreMenuFeatureToggle","KeyboardShortcutHelpModal","POPOVER_PROPS","className","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,EAA2BC,qBAA3B,QAAwD,sBAAxD;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AAEA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,SAAS,EAAE;AADU,CAAtB;AAIA,eAAe,SAASC,QAAT,GAAoB;AAClC,QAAM,CACLC,8BADK,EAELC,kCAFK,IAGFb,QAAQ,CAAE,KAAF,CAHZ;;AAIA,QAAMc,4BAA4B,GAAG,MACpCD,kCAAkC,CAAE,CAAED,8BAAJ,CADnC;;AAGAP,EAAAA,WAAW,CACV,2CADU,EAEVS,4BAFU,CAAX;AAKA,SACC,8BACC,cAAC,gBAAD;AACC,IA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,KAAK,EAAGA,EAAE,CAAE,aAAF;AAArB,KACC,cAAC,qBAAD;AACC,IAAA,KAAK,EAAC,wBADP;AAEC,IAAA,OAAO,EAAC,sBAFT;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,CANF,CADD,EA6EC,cAAC,yBAAD;AACC,IAAA,aAAa,EAAGW,8BADjB;AAEC,IAAA,WAAW,EAAGE;AAFf,IA7ED,CADD;AAoFA","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, MoreMenuFeatureToggle } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nconst POPOVER_PROPS = {\n\tclassName: 'customize-widgets-more-menu__content',\n};\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\n\t\t\t\tas={ ToolbarDropdownMenu }\n\t\t\t\tclassName=\"customize-widgets-more-menu\"\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t>\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<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"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<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"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<MoreMenuFeatureToggle\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tfeature=\"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,6 +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 } from '@wordpress/block-editor';
|
|
15
15
|
import { uploadMedia } from '@wordpress/media-utils';
|
|
16
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
16
17
|
/**
|
|
17
18
|
* Internal dependencies
|
|
18
19
|
*/
|
|
@@ -21,7 +22,6 @@ import BlockInspectorButton from '../block-inspector-button';
|
|
|
21
22
|
import Header from '../header';
|
|
22
23
|
import useInserter from '../inserter/use-inserter';
|
|
23
24
|
import SidebarEditorProvider from './sidebar-editor-provider';
|
|
24
|
-
import { store as customizeWidgetsStore } from '../../store';
|
|
25
25
|
import WelcomeGuide from '../welcome-guide';
|
|
26
26
|
import KeyboardShortcuts from '../keyboard-shortcuts';
|
|
27
27
|
import BlockAppender from '../block-appender';
|
|
@@ -38,11 +38,14 @@ export default function SidebarBlockEditor({
|
|
|
38
38
|
keepCaretInsideBlock,
|
|
39
39
|
isWelcomeGuideActive
|
|
40
40
|
} = useSelect(select => {
|
|
41
|
+
const {
|
|
42
|
+
isFeatureActive
|
|
43
|
+
} = select(interfaceStore);
|
|
41
44
|
return {
|
|
42
45
|
hasUploadPermissions: defaultTo(select(coreStore).canUser('create', 'media'), true),
|
|
43
|
-
isFixedToolbarActive:
|
|
44
|
-
keepCaretInsideBlock:
|
|
45
|
-
isWelcomeGuideActive:
|
|
46
|
+
isFixedToolbarActive: isFeatureActive('core/customize-widgets', 'fixedToolbar'),
|
|
47
|
+
keepCaretInsideBlock: isFeatureActive('core/customize-widgets', 'keepCaretInsideBlock'),
|
|
48
|
+
isWelcomeGuideActive: isFeatureActive('core/customize-widgets', 'welcomeGuide')
|
|
46
49
|
};
|
|
47
50
|
}, []);
|
|
48
51
|
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","uploadMedia","BlockInspectorButton","Header","useInserter","SidebarEditorProvider","
|
|
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","uploadMedia","interfaceStore","BlockInspectorButton","Header","useInserter","SidebarEditorProvider","WelcomeGuide","KeyboardShortcuts","BlockAppender","SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","isFeatureActive","canUser","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","undo","redo","save","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,4BAR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IC,IAAA,mBAAmB,EAAGC,mBAJvB;AAKC,IAAA,oBAAoB,EAAGE;AALxB,IAPD,EAeC,cAAC,WAAD,QACC,cAAC,UAAD,QACC,cAAC,qBAAD,QACC,cAAC,WAAD,QACC,cAAC,aAAD,QACC,cAAC,SAAD;AACC,IAAA,cAAc,EAAGT;AADlB,IADD,CADD,CADD,CADD,CADD,CAfD,EA6BGlB,YAAY,EACb;AACA;AACA;AAAM,IAAA,QAAQ,EAAK+C,KAAF,IAAaA,KAAK,CAACC,cAAN;AAA9B,KACC,cAAC,cAAD,OADD,CAHa,EAMbzB,SAAS,CAAC0B,gBAAV,CAA4B,CAA5B,CANa,CA7Bf,CAJD,EA2CC,cAAC,oCAAD,QACG,CAAE;AAAEC,IAAAA;AAAF,GAAF,KACD,cAAC,oBAAD;AACC,IAAA,SAAS,EAAG3B,SADb;AAEC,IAAA,SAAS,EAAG2B;AAFb,IAFF,CA3CD,CADD;AAsDA","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} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as interfaceStore } from '@wordpress/interface';\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 { isFeatureActive } = select( interfaceStore );\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: isFeatureActive(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: isFeatureActive(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: isFeatureActive(\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<BlockSelectionClearer>\n\t\t\t\t\t\t\t<WritingFlow>\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,17 +6,13 @@ 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
|
-
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { store as customizeWidgetsStore } from '../../store';
|
|
9
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
14
10
|
export default function WelcomeGuide({
|
|
15
11
|
sidebar
|
|
16
12
|
}) {
|
|
17
13
|
const {
|
|
18
|
-
|
|
19
|
-
} = useDispatch(
|
|
14
|
+
toggleFeature
|
|
15
|
+
} = useDispatch(interfaceStore);
|
|
20
16
|
const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-'));
|
|
21
17
|
return createElement("div", {
|
|
22
18
|
className: "customize-widgets-welcome-guide"
|
|
@@ -38,7 +34,7 @@ export default function WelcomeGuide({
|
|
|
38
34
|
}, 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, {
|
|
39
35
|
className: "customize-widgets-welcome-guide__button",
|
|
40
36
|
variant: "primary",
|
|
41
|
-
onClick: () => toggleFeature('welcomeGuide')
|
|
37
|
+
onClick: () => toggleFeature('core/customize-widgets', 'welcomeGuide')
|
|
42
38
|
}, __('Got it')), createElement("hr", {
|
|
43
39
|
className: "customize-widgets-welcome-guide__separator"
|
|
44
40
|
}), !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","interfaceStore","WelcomeGuide","sidebar","toggleFeature","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,cAAlB,QAAwC,sBAAxC;AAEA,eAAe,SAASC,YAAT,CAAuB;AAAEC,EAAAA;AAAF,CAAvB,EAAqC;AACnD,QAAM;AAAEC,IAAAA;AAAF,MAAoBL,WAAW,CAAEE,cAAF,CAArC;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,aAAa,CAAE,wBAAF,EAA4B,cAA5B;AAJf,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 interfaceStore } from '@wordpress/interface';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggleFeature } = useDispatch( interfaceStore );\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\ttoggleFeature( '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"]}
|
|
@@ -9,12 +9,26 @@ export default function getInspectorSection() {
|
|
|
9
9
|
super(id, options);
|
|
10
10
|
this.parentSection = options.parentSection;
|
|
11
11
|
this.returnFocusWhenClose = null;
|
|
12
|
+
this._isOpen = false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get isOpen() {
|
|
16
|
+
return this._isOpen;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
set isOpen(value) {
|
|
20
|
+
this._isOpen = value;
|
|
21
|
+
this.triggerActiveCallbacks();
|
|
12
22
|
}
|
|
13
23
|
|
|
14
24
|
ready() {
|
|
15
25
|
this.contentContainer[0].classList.add('customize-widgets-layout__inspector');
|
|
16
26
|
}
|
|
17
27
|
|
|
28
|
+
isContextuallyActive() {
|
|
29
|
+
return this.isOpen;
|
|
30
|
+
}
|
|
31
|
+
|
|
18
32
|
onChangeExpanded(expanded, args) {
|
|
19
33
|
super.onChangeExpanded(expanded, args);
|
|
20
34
|
|
|
@@ -40,6 +54,7 @@ export default function getInspectorSection() {
|
|
|
40
54
|
open({
|
|
41
55
|
returnFocusWhenClose
|
|
42
56
|
} = {}) {
|
|
57
|
+
this.isOpen = true;
|
|
43
58
|
this.returnFocusWhenClose = returnFocusWhenClose;
|
|
44
59
|
this.expand({
|
|
45
60
|
allowMultiple: true
|
|
@@ -52,6 +67,36 @@ export default function getInspectorSection() {
|
|
|
52
67
|
});
|
|
53
68
|
}
|
|
54
69
|
|
|
70
|
+
collapse(options) {
|
|
71
|
+
// Overridden collapse() function. Mostly call the parent collapse(), but also
|
|
72
|
+
// move our .isOpen to false.
|
|
73
|
+
// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work
|
|
74
|
+
// because the block settings sidebar is a layer "on top of" the G editor sidebar.
|
|
75
|
+
//
|
|
76
|
+
// For example, when closing the block settings sidebar, the G
|
|
77
|
+
// editor sidebar would display, and onChangeExpanded in
|
|
78
|
+
// inspector-section would run with expanded=true, but I want
|
|
79
|
+
// isOpen to be false when the block settings is closed.
|
|
80
|
+
this.isOpen = false;
|
|
81
|
+
super.collapse(options);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
triggerActiveCallbacks() {
|
|
85
|
+
// Manually fire the callbacks associated with moving this.active
|
|
86
|
+
// from false to true. "active" is always true for this section,
|
|
87
|
+
// and "isContextuallyActive" reflects if the block settings
|
|
88
|
+
// sidebar is currently visible, that is, it has replaced the main
|
|
89
|
+
// Gutenberg view.
|
|
90
|
+
// The WP customizer only checks ".isContextuallyActive()" when
|
|
91
|
+
// ".active" changes values. But our ".active" never changes value.
|
|
92
|
+
// The WP customizer never foresaw a section being used a way we
|
|
93
|
+
// fit the block settings sidebar into a section. By manually
|
|
94
|
+
// triggering the "this.active" callbacks, we force the WP
|
|
95
|
+
// customizer to query our .isContextuallyActive() function and
|
|
96
|
+
// update its view of our status.
|
|
97
|
+
this.active.callbacks.fireWith(this.active, [false, true]);
|
|
98
|
+
}
|
|
99
|
+
|
|
55
100
|
};
|
|
56
101
|
}
|
|
57
102
|
//# sourceMappingURL=inspector-section.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/inspector-section.js"],"names":["getInspectorSection","wp","customize","window","InspectorSection","Section","constructor","id","options","parentSection","returnFocusWhenClose","ready","contentContainer","classList","add","onChangeExpanded","expanded","args","unchanged","collapse","manualTransition","expand","completeCallback","contains","focus","open","allowMultiple","close"],"mappings":"AAAA,eAAe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,SAAO,MAAMC,gBAAN,SAA+BF,SAAS,CAACG,OAAzC,CAAiD;AACvDC,IAAAA,WAAW,CAAEC,EAAF,EAAMC,OAAN,EAAgB;AAC1B,YAAOD,EAAP,EAAWC,OAAX;AAEA,WAAKC,aAAL,GAAqBD,OAAO,CAACC,aAA7B;AAEA,WAAKC,oBAAL,GAA4B,IAA5B;AACA;;AACDC,IAAAA,KAAK,GAAG;AACP,WAAKC,gBAAL,CAAuB,CAAvB,EAA2BC,SAA3B,CAAqCC,GAArC,CACC,qCADD;AAGA;;AACDC,IAAAA,gBAAgB,CAAEC,QAAF,EAAYC,IAAZ,EAAmB;AAClC,YAAMF,gBAAN,CAAwBC,QAAxB,EAAkCC,IAAlC;;AAEA,UAAK,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/inspector-section.js"],"names":["getInspectorSection","wp","customize","window","InspectorSection","Section","constructor","id","options","parentSection","returnFocusWhenClose","_isOpen","isOpen","value","triggerActiveCallbacks","ready","contentContainer","classList","add","isContextuallyActive","onChangeExpanded","expanded","args","unchanged","collapse","manualTransition","expand","completeCallback","contains","focus","open","allowMultiple","close","active","callbacks","fireWith"],"mappings":"AAAA,eAAe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,SAAO,MAAMC,gBAAN,SAA+BF,SAAS,CAACG,OAAzC,CAAiD;AACvDC,IAAAA,WAAW,CAAEC,EAAF,EAAMC,OAAN,EAAgB;AAC1B,YAAOD,EAAP,EAAWC,OAAX;AAEA,WAAKC,aAAL,GAAqBD,OAAO,CAACC,aAA7B;AAEA,WAAKC,oBAAL,GAA4B,IAA5B;AACA,WAAKC,OAAL,GAAe,KAAf;AACA;;AACS,QAANC,MAAM,GAAG;AACZ,aAAO,KAAKD,OAAZ;AACA;;AACS,QAANC,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ACA;AACA;AACA;AACA;AACA;AACA,WAAKI,MAAL,GAAc,KAAd;AACA,YAAMY,QAAN,CAAgBhB,OAAhB;AACA;;AACDM,IAAAA,sBAAsB,GAAG;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAKmB,MAAL,CAAYC,SAAZ,CAAsBC,QAAtB,CAAgC,KAAKF,MAArC,EAA6C,CAAE,KAAF,EAAS,IAAT,CAA7C;AACA;;AA1FsD,GAAxD;AA4FA","sourcesContent":["export default function getInspectorSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class InspectorSection extends customize.Section {\n\t\tconstructor( id, options ) {\n\t\t\tsuper( id, options );\n\n\t\t\tthis.parentSection = options.parentSection;\n\n\t\t\tthis.returnFocusWhenClose = null;\n\t\t\tthis._isOpen = false;\n\t\t}\n\t\tget isOpen() {\n\t\t\treturn this._isOpen;\n\t\t}\n\t\tset isOpen( value ) {\n\t\t\tthis._isOpen = value;\n\t\t\tthis.triggerActiveCallbacks();\n\t\t}\n\t\tready() {\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets-layout__inspector'\n\t\t\t);\n\t\t}\n\t\tisContextuallyActive() {\n\t\t\treturn this.isOpen;\n\t\t}\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tsuper.onChangeExpanded( expanded, args );\n\n\t\t\tif ( this.parentSection && ! args.unchanged ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.parentSection.collapse( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.parentSection.expand( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t\tcompleteCallback: () => {\n\t\t\t\t\t\t\t// Return focus after finishing the transition.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose &&\n\t\t\t\t\t\t\t\t! this.contentContainer[ 0 ].contains(\n\t\t\t\t\t\t\t\t\tthis.returnFocusWhenClose\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose.focus();\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}\n\t\t}\n\t\topen( { returnFocusWhenClose } = {} ) {\n\t\t\tthis.isOpen = true;\n\t\t\tthis.returnFocusWhenClose = returnFocusWhenClose;\n\n\t\t\tthis.expand( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tclose() {\n\t\t\tthis.collapse( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tcollapse( options ) {\n\t\t\t// Overridden collapse() function. Mostly call the parent collapse(), but also\n\t\t\t// move our .isOpen to false.\n\t\t\t// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work\n\t\t\t// because the block settings sidebar is a layer \"on top of\" the G editor sidebar.\n\t\t\t//\n\t\t\t// For example, when closing the block settings sidebar, the G\n\t\t\t// editor sidebar would display, and onChangeExpanded in\n\t\t\t// inspector-section would run with expanded=true, but I want\n\t\t\t// isOpen to be false when the block settings is closed.\n\t\t\tthis.isOpen = false;\n\t\t\tsuper.collapse( options );\n\t\t}\n\t\ttriggerActiveCallbacks() {\n\t\t\t// Manually fire the callbacks associated with moving this.active\n\t\t\t// from false to true. \"active\" is always true for this section,\n\t\t\t// and \"isContextuallyActive\" reflects if the block settings\n\t\t\t// sidebar is currently visible, that is, it has replaced the main\n\t\t\t// Gutenberg view.\n\t\t\t// The WP customizer only checks \".isContextuallyActive()\" when\n\t\t\t// \".active\" changes values. But our \".active\" never changes value.\n\t\t\t// The WP customizer never foresaw a section being used a way we\n\t\t\t// fit the block settings sidebar into a section. By manually\n\t\t\t// triggering the \"this.active\" callbacks, we force the WP\n\t\t\t// customizer to query our .isContextuallyActive() function and\n\t\t\t// update its view of our status.\n\t\t\tthis.active.callbacks.fireWith( this.active, [ false, true ] );\n\t\t}\n\t};\n}\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -5,8 +5,10 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { render } from '@wordpress/element';
|
|
7
7
|
import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
|
|
8
|
-
import { registerLegacyWidgetBlock, registerLegacyWidgetVariations } from '@wordpress/widgets';
|
|
9
|
-
import { setFreeformContentHandlerName } from '@wordpress/blocks';
|
|
8
|
+
import { registerLegacyWidgetBlock, registerLegacyWidgetVariations, registerWidgetGroupBlock } from '@wordpress/widgets';
|
|
9
|
+
import { setFreeformContentHandlerName, store as blocksStore } from '@wordpress/blocks';
|
|
10
|
+
import { dispatch } from '@wordpress/data';
|
|
11
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
10
12
|
/**
|
|
11
13
|
* Internal dependencies
|
|
12
14
|
*/
|
|
@@ -28,6 +30,13 @@ const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
|
28
30
|
*/
|
|
29
31
|
|
|
30
32
|
export function initialize(editorName, blockEditorSettings) {
|
|
33
|
+
dispatch(interfaceStore).setFeatureDefaults('core/customize-widgets', {
|
|
34
|
+
fixedToolbar: false,
|
|
35
|
+
welcomeGuide: true
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
dispatch(blocksStore).__experimentalReapplyBlockTypeFilters();
|
|
39
|
+
|
|
31
40
|
const coreBlocks = __experimentalGetCoreBlocks().filter(block => {
|
|
32
41
|
return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site'));
|
|
33
42
|
});
|
|
@@ -41,7 +50,8 @@ export function initialize(editorName, blockEditorSettings) {
|
|
|
41
50
|
});
|
|
42
51
|
}
|
|
43
52
|
|
|
44
|
-
registerLegacyWidgetVariations(blockEditorSettings);
|
|
53
|
+
registerLegacyWidgetVariations(blockEditorSettings);
|
|
54
|
+
registerWidgetGroupBlock(); // As we are unregistering `core/freeform` to avoid the Classic block, we must
|
|
45
55
|
// replace it with something as the default freeform content handler. Failure to
|
|
46
56
|
// do this will result in errors in the default block parser.
|
|
47
57
|
// see: https://github.com/WordPress/gutenberg/issues/33097
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/index.js"],"names":["render","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","registerLegacyWidgetBlock","registerLegacyWidgetVariations","setFreeformContentHandlerName","CustomizeWidgets","getSidebarSection","getSidebarControl","wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","coreBlocks","filter","block","includes","name","startsWith","process","env","GUTENBERG_PHASE","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,QAGO,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/index.js"],"names":["render","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","setFreeformContentHandlerName","store","blocksStore","dispatch","interfaceStore","CustomizeWidgets","getSidebarSection","getSidebarControl","wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","setFeatureDefaults","fixedToolbar","welcomeGuide","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","block","includes","name","startsWith","process","env","GUTENBERG_PHASE","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,cAAlB,QAAwC,sBAAxC;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,CAAE,WAAF,EAAe,YAAf,EAA6B,eAA7B,CAAxB;AACA,MAAMC,8BAA8B,GAAG,KAAvC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,UAAT,CAAqBC,UAArB,EAAiCC,mBAAjC,EAAuD;AAC7DX,EAAAA,QAAQ,CAAEC,cAAF,CAAR,CAA2BW,kBAA3B,CAA+C,wBAA/C,EAAyE;AACxEC,IAAAA,YAAY,EAAE,KAD0D;AAExEC,IAAAA,YAAY,EAAE;AAF0D,GAAzE;;AAKAd,EAAAA,QAAQ,CAAED,WAAF,CAAR,CAAwBgB,qCAAxB;;AACA,QAAMC,UAAU,GAAGxB,2BAA2B,GAAGyB,MAA9B,CAAwCC,KAAF,IAAa;AACrE,WAAO,EACNX,eAAe,CAACY,QAAhB,CAA0BD,KAAK,CAACE,IAAhC,KACAF,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,WAAvB,CADA,IAEAH,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,YAAvB,CA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AA,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 interfaceStore } from '@wordpress/interface';\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 = [ 'core/more', 'core/block', 'core/freeform' ];\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( interfaceStore ).setFeatureDefaults( '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);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\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,20 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns an action object used to toggle a feature flag.
|
|
3
|
-
*
|
|
4
|
-
* This function is unstable, as it is mostly copied from the edit-post
|
|
5
|
-
* package. Editor features and preferences have a lot of scope for
|
|
6
|
-
* being generalized and refactored.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} feature Feature name.
|
|
9
|
-
*
|
|
10
|
-
* @return {Object} Action object.
|
|
11
|
-
*/
|
|
12
|
-
export function __unstableToggleFeature(feature) {
|
|
13
|
-
return {
|
|
14
|
-
type: 'TOGGLE_FEATURE',
|
|
15
|
-
feature
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
1
|
/**
|
|
19
2
|
* Returns an action object used to open/close the inserter.
|
|
20
3
|
*
|
|
@@ -27,7 +10,6 @@ export function __unstableToggleFeature(feature) {
|
|
|
27
10
|
*
|
|
28
11
|
* @return {Object} Action object.
|
|
29
12
|
*/
|
|
30
|
-
|
|
31
13
|
export function setIsInserterOpened(value) {
|
|
32
14
|
return {
|
|
33
15
|
type: 'SET_IS_INSERTER_OPENED',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/actions.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/actions.js"],"names":["setIsInserterOpened","value","type"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAT,CAA8BC,KAA9B,EAAsC;AAC5C,SAAO;AACNC,IAAAA,IAAI,EAAE,wBADA;AAEND,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/index.js"],"names":["createReduxStore","registerStore","reducer","selectors","actions","STORE_NAME","storeConfig","
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/index.js"],"names":["createReduxStore","registerStore","reducer","selectors","actions","STORE_NAME","storeConfig","store"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,aAA3B,QAAgD,iBAAhD;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,C,CAEP;AACA;;AACAL,aAAa,CAAEI,UAAF,EAAcC,WAAd,CAAb","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } 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#registerStore\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 );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregisterStore( STORE_NAME, storeConfig );\n"]}
|
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { flow } from 'lodash';
|
|
5
1
|
/**
|
|
6
2
|
* WordPress dependencies
|
|
7
3
|
*/
|
|
8
|
-
|
|
9
4
|
import { combineReducers } from '@wordpress/data';
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { PREFERENCES_DEFAULTS } from './defaults';
|
|
15
|
-
/**
|
|
16
|
-
* Higher-order reducer creator which provides the given initial state for the
|
|
17
|
-
* original reducer.
|
|
18
|
-
*
|
|
19
|
-
* @param {*} initialState Initial state to provide to reducer.
|
|
20
|
-
*
|
|
21
|
-
* @return {Function} Higher-order reducer.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const createWithInitialState = initialState => reducer => {
|
|
25
|
-
return (state = initialState, action) => reducer(state, action);
|
|
26
|
-
};
|
|
27
5
|
/**
|
|
28
6
|
* Reducer tracking whether the inserter is open.
|
|
29
7
|
*
|
|
@@ -31,7 +9,6 @@ const createWithInitialState = initialState => reducer => {
|
|
|
31
9
|
* @param {Object} action
|
|
32
10
|
*/
|
|
33
11
|
|
|
34
|
-
|
|
35
12
|
function blockInserterPanel(state = false, action) {
|
|
36
13
|
switch (action.type) {
|
|
37
14
|
case 'SET_IS_INSERTER_OPENED':
|
|
@@ -40,30 +17,8 @@ function blockInserterPanel(state = false, action) {
|
|
|
40
17
|
|
|
41
18
|
return state;
|
|
42
19
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Reducer returning the user preferences.
|
|
45
|
-
*
|
|
46
|
-
* @param {Object} state Current state.
|
|
47
|
-
* @param {Object} action Dispatched action.
|
|
48
|
-
*
|
|
49
|
-
* @return {Object} Updated state.
|
|
50
|
-
*/
|
|
51
20
|
|
|
52
|
-
|
|
53
|
-
export const preferences = flow([combineReducers, createWithInitialState(PREFERENCES_DEFAULTS)])({
|
|
54
|
-
features(state, action) {
|
|
55
|
-
if (action.type === 'TOGGLE_FEATURE') {
|
|
56
|
-
return { ...state,
|
|
57
|
-
[action.feature]: !state[action.feature]
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return state;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
});
|
|
65
21
|
export default combineReducers({
|
|
66
|
-
blockInserterPanel
|
|
67
|
-
preferences
|
|
22
|
+
blockInserterPanel
|
|
68
23
|
});
|
|
69
24
|
//# sourceMappingURL=reducer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["combineReducers","blockInserterPanel","state","action","type","value"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,CAA6BC,KAAK,GAAG,KAArC,EAA4CC,MAA5C,EAAqD;AACpD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,wBAAL;AACC,aAAOD,MAAM,CAACE,KAAd;AAFF;;AAIA,SAAOH,KAAP;AACA;;AAED,eAAeF,eAAe,CAAE;AAC/BC,EAAAA;AAD+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean|Object} state\n * @param {Object} action\n */\nfunction blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n} );\n"]}
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
/**
|
|
6
|
-
* Returns whether the given feature is enabled or not.
|
|
7
|
-
*
|
|
8
|
-
* This function is unstable, as it is mostly copied from the edit-post
|
|
9
|
-
* package. Editor features and preferences have a lot of scope for
|
|
10
|
-
* being generalized and refactored.
|
|
11
|
-
*
|
|
12
|
-
* @param {Object} state Global application state.
|
|
13
|
-
* @param {string} feature Feature slug.
|
|
14
|
-
*
|
|
15
|
-
* @return {boolean} Is active.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
export function __unstableIsFeatureActive(state, feature) {
|
|
19
|
-
return get(state.preferences.features, [feature], false);
|
|
20
|
-
}
|
|
21
1
|
/**
|
|
22
2
|
* Returns true if the inserter is opened.
|
|
23
3
|
*
|
|
@@ -25,7 +5,6 @@ export function __unstableIsFeatureActive(state, feature) {
|
|
|
25
5
|
*
|
|
26
6
|
* @return {boolean} Whether the inserter is opened.
|
|
27
7
|
*/
|
|
28
|
-
|
|
29
8
|
export function isInserterOpened(state) {
|
|
30
9
|
return !!state.blockInserterPanel;
|
|
31
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/selectors.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/selectors.js"],"names":["isInserterOpened","state","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gBAAT,CAA2BC,KAA3B,EAAmC;AACzC,SAAO,CAAC,CAAEA,KAAK,CAACC,kBAAhB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,+BAAT,CAA0CF,KAA1C,EAAkD;AACxD,QAAM;AAAEG,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAAmCJ,KAAK,CAACC,kBAA/C;AACA,SAAO;AAAEE,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAAP;AACA","sourcesContent":["/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID and index to insert at.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex } = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
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,30 @@
|
|
|
24
24
|
"react-native": "src/index",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.11.2",
|
|
27
|
-
"@wordpress/a11y": "^3.2.
|
|
28
|
-
"@wordpress/block-editor": "^7.0.
|
|
29
|
-
"@wordpress/block-library": "^6.0.
|
|
30
|
-
"@wordpress/blocks": "^11.
|
|
31
|
-
"@wordpress/components": "^
|
|
32
|
-
"@wordpress/compose": "^5.0.
|
|
33
|
-
"@wordpress/core-data": "^4.0.
|
|
34
|
-
"@wordpress/data": "^6.
|
|
35
|
-
"@wordpress/dom": "^3.2.
|
|
36
|
-
"@wordpress/element": "^4.0.
|
|
37
|
-
"@wordpress/hooks": "^3.2.1
|
|
38
|
-
"@wordpress/i18n": "^4.2.
|
|
39
|
-
"@wordpress/icons": "^
|
|
40
|
-
"@wordpress/
|
|
41
|
-
"@wordpress/
|
|
42
|
-
"@wordpress/
|
|
43
|
-
"@wordpress/
|
|
44
|
-
"@wordpress/
|
|
27
|
+
"@wordpress/a11y": "^3.2.3",
|
|
28
|
+
"@wordpress/block-editor": "^7.0.4",
|
|
29
|
+
"@wordpress/block-library": "^6.0.2",
|
|
30
|
+
"@wordpress/blocks": "^11.1.2",
|
|
31
|
+
"@wordpress/components": "^19.0.0",
|
|
32
|
+
"@wordpress/compose": "^5.0.4",
|
|
33
|
+
"@wordpress/core-data": "^4.0.4",
|
|
34
|
+
"@wordpress/data": "^6.1.2",
|
|
35
|
+
"@wordpress/dom": "^3.2.5",
|
|
36
|
+
"@wordpress/element": "^4.0.3",
|
|
37
|
+
"@wordpress/hooks": "^3.2.1",
|
|
38
|
+
"@wordpress/i18n": "^4.2.3",
|
|
39
|
+
"@wordpress/icons": "^6.0.1",
|
|
40
|
+
"@wordpress/interface": "^4.1.2",
|
|
41
|
+
"@wordpress/is-shallow-equal": "^4.2.0",
|
|
42
|
+
"@wordpress/keyboard-shortcuts": "^3.0.4",
|
|
43
|
+
"@wordpress/keycodes": "^3.2.3",
|
|
44
|
+
"@wordpress/media-utils": "^3.0.3",
|
|
45
|
+
"@wordpress/widgets": "^2.0.4",
|
|
45
46
|
"classnames": "^2.3.1",
|
|
46
47
|
"lodash": "^4.17.21"
|
|
47
48
|
},
|
|
48
49
|
"publishConfig": {
|
|
49
50
|
"access": "public"
|
|
50
51
|
},
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "157f4ae53ab98e574af01f72213ae5a9613159ff"
|
|
52
53
|
}
|