@wordpress/block-editor 12.4.0 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +5 -0
- package/build/components/block-heading-level-dropdown/heading-level-icon.js +10 -2
- package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-lock/toolbar.js +25 -6
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -6
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-parent-selector/index.js +8 -5
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +18 -25
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +8 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +7 -11
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build/components/dimensions-tool/index.js +207 -0
- package/build/components/dimensions-tool/index.js.map +1 -0
- package/build/components/dimensions-tool/scale-tool.js +111 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build/components/dimensions-tool/width-height-tool.js +125 -0
- package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build/components/global-styles/color-panel.js +1 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +1 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +34 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -2
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +19 -1
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +7 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +3 -4
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +9 -3
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +2 -21
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +62 -0
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build/components/inserter/reusable-blocks-tab.js +6 -2
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/tabs.native.js +1 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +9 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/link-control/constants.js +1 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/index.js +17 -15
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-create-button.js +5 -21
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +4 -4
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-item.js +13 -30
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -2
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +2 -3
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/appender.js +2 -6
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/provider/index.js +5 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +21 -0
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/resolution-tool/index.js +55 -0
- package/build/components/resolution-tool/index.js.map +1 -0
- package/build/components/url-input/index.js +4 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +10 -27
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-mode-control/index.js +70 -0
- package/build/components/writing-mode-control/index.js.map +1 -0
- package/build/hooks/behaviors.js +25 -20
- package/build/hooks/behaviors.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +2 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +4 -2
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +10 -1
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +3 -0
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +195 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +10 -1
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +46 -40
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +22 -8
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +33 -15
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +9 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +25 -7
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +7 -5
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +20 -24
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -5
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/index.js +195 -0
- package/build-module/components/dimensions-tool/index.js.map +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js +103 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +1 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +2 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +33 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -2
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-size-control/index.js +5 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +6 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +7 -33
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +2 -21
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +48 -0
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +1 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +9 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/link-control/constants.js +1 -1
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/index.js +17 -15
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +7 -20
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -4
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-item.js +14 -28
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -3
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -5
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/appender.js +2 -6
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/provider/index.js +5 -2
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +21 -0
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +45 -0
- package/build-module/components/resolution-tool/index.js.map +1 -0
- package/build-module/components/url-input/index.js +4 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +8 -26
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +57 -0
- package/build-module/components/writing-mode-control/index.js.map +1 -0
- package/build-module/hooks/behaviors.js +26 -20
- package/build-module/hooks/behaviors.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +2 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +4 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +7 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +2 -0
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +191 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +10 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +45 -36
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +22 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +33 -15
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/content-rtl.css +3 -0
- package/build-style/content.css +3 -0
- package/build-style/style-rtl.css +131 -129
- package/build-style/style.css +131 -129
- package/package.json +32 -31
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
- package/src/components/block-draggable/style.scss +1 -0
- package/src/components/block-heading-level-dropdown/heading-level-icon.js +6 -1
- package/src/components/block-heading-level-dropdown/index.native.js +8 -4
- package/src/components/block-inspector/style.scss +2 -1
- package/src/components/block-lock/toolbar.js +34 -6
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -8
- package/src/components/block-parent-selector/index.js +13 -8
- package/src/components/block-removal-warning-modal/index.js +20 -33
- package/src/components/block-toolbar/index.js +9 -6
- package/src/components/block-tools/block-contextual-toolbar.js +5 -11
- package/src/components/block-tools/style.scss +73 -26
- package/src/components/default-block-appender/content.scss +11 -0
- package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
- package/src/components/dimensions-tool/index.js +212 -0
- package/src/components/dimensions-tool/scale-tool.js +124 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
- package/src/components/dimensions-tool/stories/index.js +54 -0
- package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
- package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
- package/src/components/dimensions-tool/test/index.js +641 -0
- package/src/components/dimensions-tool/width-height-tool.js +113 -0
- package/src/components/font-family/README.md +71 -0
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/filters-panel.js +2 -2
- package/src/components/global-styles/hooks.js +2 -0
- package/src/components/global-styles/typography-panel.js +40 -0
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/src/components/image-editor/use-save-image.js +0 -1
- package/src/components/image-size-control/index.js +6 -0
- package/src/components/index.js +6 -0
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
- package/src/components/inserter/block-patterns-tab.js +8 -56
- package/src/components/inserter/hooks/use-block-types-state.js +3 -4
- package/src/components/inserter/hooks/use-patterns-state.js +35 -19
- package/src/components/inserter/media-tab/hooks.js +2 -22
- package/src/components/inserter/reusable-block-rename-hint.js +52 -0
- package/src/components/inserter/reusable-blocks-tab.js +5 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/src/components/inserter/style.scss +28 -0
- package/src/components/inserter/tabs.native.js +5 -1
- package/src/components/inserter-draggable-blocks/index.js +13 -2
- package/src/components/link-control/constants.js +1 -1
- package/src/components/link-control/index.js +32 -28
- package/src/components/link-control/search-create-button.js +8 -26
- package/src/components/link-control/search-input.js +4 -3
- package/src/components/link-control/search-item.js +21 -43
- package/src/components/link-control/search-results.js +48 -46
- package/src/components/link-control/settings-drawer.js +6 -5
- package/src/components/link-control/style.scss +51 -123
- package/src/components/link-control/test/index.js +135 -123
- package/src/components/list-view/appender.js +5 -6
- package/src/components/list-view/style.scss +1 -2
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/panel-color-settings/README.md +98 -0
- package/src/components/provider/index.js +9 -2
- package/src/components/provider/test/use-block-sync.js +21 -6
- package/src/components/provider/use-block-sync.js +19 -0
- package/src/components/recursion-provider/README.md +101 -0
- package/src/components/resolution-tool/index.js +56 -0
- package/src/components/resolution-tool/stories/index.js +48 -0
- package/src/components/url-input/index.js +2 -0
- package/src/components/writing-flow/use-tab-nav.js +10 -33
- package/src/components/writing-mode-control/index.js +68 -0
- package/src/components/writing-mode-control/style.scss +18 -0
- package/src/hooks/behaviors.js +25 -16
- package/src/hooks/supports.js +7 -0
- package/src/hooks/typography.js +2 -0
- package/src/hooks/utils.js +3 -0
- package/src/private-apis.js +6 -0
- package/src/private-apis.native.js +2 -0
- package/src/store/actions.js +194 -1
- package/src/store/defaults.js +1 -0
- package/src/store/index.js +10 -0
- package/src/store/private-actions.js +39 -39
- package/src/store/private-selectors.js +2 -2
- package/src/store/reducer.js +22 -8
- package/src/store/selectors.js +54 -20
- package/src/store/test/actions.js +111 -0
- package/src/store/test/private-actions.js +56 -0
|
@@ -5,6 +5,7 @@ import * as globalStyles from './components/global-styles';
|
|
|
5
5
|
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
6
|
import { lock } from './lock-unlock';
|
|
7
7
|
import { getRichTextValues } from './components/rich-text/content';
|
|
8
|
+
import { kebabCase } from './utils/object';
|
|
8
9
|
import ResizableBoxPopover from './components/resizable-box-popover';
|
|
9
10
|
import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
|
|
10
11
|
import { PrivateListView } from './components/list-view';
|
|
@@ -16,6 +17,8 @@ import BlockQuickNavigation from './components/block-quick-navigation';
|
|
|
16
17
|
import { LayoutStyle } from './components/block-list/layout';
|
|
17
18
|
import { BlockRemovalWarningModal } from './components/block-removal-warning-modal';
|
|
18
19
|
import { useLayoutClasses, useLayoutStyles } from './hooks';
|
|
20
|
+
import DimensionsTool from './components/dimensions-tool';
|
|
21
|
+
import ResolutionTool from './components/resolution-tool';
|
|
19
22
|
/**
|
|
20
23
|
* Private @wordpress/block-editor APIs.
|
|
21
24
|
*/
|
|
@@ -24,6 +27,7 @@ export const privateApis = {};
|
|
|
24
27
|
lock(privateApis, { ...globalStyles,
|
|
25
28
|
ExperimentalBlockEditorProvider,
|
|
26
29
|
getRichTextValues,
|
|
30
|
+
kebabCase,
|
|
27
31
|
PrivateInserter,
|
|
28
32
|
PrivateListView,
|
|
29
33
|
ResizableBoxPopover,
|
|
@@ -35,6 +39,8 @@ lock(privateApis, { ...globalStyles,
|
|
|
35
39
|
LayoutStyle,
|
|
36
40
|
BlockRemovalWarningModal,
|
|
37
41
|
useLayoutClasses,
|
|
38
|
-
useLayoutStyles
|
|
42
|
+
useLayoutStyles,
|
|
43
|
+
DimensionsTool,
|
|
44
|
+
ResolutionTool
|
|
39
45
|
});
|
|
40
46
|
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","getRichTextValues","ResizableBoxPopover","ComposedPrivateInserter","PrivateInserter","PrivateListView","BlockInfo","useShouldContextualToolbarShow","cleanEmptyObject","useBlockEditingMode","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","useLayoutClasses","useLayoutStyles","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,iBAAT,QAAkC,gCAAlC;AACA,OAAOC,mBAAP,MAAgC,oCAAhC;AACA,SAASC,uBAAuB,IAAIC,eAApC,QAA2D,uBAA3D;AACA,SAASC,eAAT,QAAgC,wBAAhC;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,8BAAT,QAA+C,4CAA/C;AACA,SAASC,gBAAT,QAAiC,eAAjC;AACA,SAASC,mBAAT,QAAoC,iCAApC;AACA,OAAOC,oBAAP,MAAiC,qCAAjC;AACA,SAASC,WAAT,QAA4B,gCAA5B;AACA,SAASC,wBAAT,QAAyC,0CAAzC;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,SAAlD;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","getRichTextValues","kebabCase","ResizableBoxPopover","ComposedPrivateInserter","PrivateInserter","PrivateListView","BlockInfo","useShouldContextualToolbarShow","cleanEmptyObject","useBlockEditingMode","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","useLayoutClasses","useLayoutStyles","DimensionsTool","ResolutionTool","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,iBAAT,QAAkC,gCAAlC;AACA,SAASC,SAAT,QAA0B,gBAA1B;AACA,OAAOC,mBAAP,MAAgC,oCAAhC;AACA,SAASC,uBAAuB,IAAIC,eAApC,QAA2D,uBAA3D;AACA,SAASC,eAAT,QAAgC,wBAAhC;AACA,OAAOC,SAAP,MAAsB,mCAAtB;AACA,SAASC,8BAAT,QAA+C,4CAA/C;AACA,SAASC,gBAAT,QAAiC,eAAjC;AACA,SAASC,mBAAT,QAAoC,iCAApC;AACA,OAAOC,oBAAP,MAAiC,qCAAjC;AACA,SAASC,WAAT,QAA4B,gCAA5B;AACA,SAASC,wBAAT,QAAyC,0CAAzC;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,SAAlD;AACA,OAAOC,cAAP,MAA2B,8BAA3B;AACA,OAAOC,cAAP,MAA2B,8BAA3B;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPlB,IAAI,CAAEkB,WAAF,EAAe,EAClB,GAAGpB,YADe;AAElBC,EAAAA,+BAFkB;AAGlBE,EAAAA,iBAHkB;AAIlBC,EAAAA,SAJkB;AAKlBG,EAAAA,eALkB;AAMlBC,EAAAA,eANkB;AAOlBH,EAAAA,mBAPkB;AAQlBI,EAAAA,SARkB;AASlBC,EAAAA,8BATkB;AAUlBC,EAAAA,gBAVkB;AAWlBC,EAAAA,mBAXkB;AAYlBC,EAAAA,oBAZkB;AAalBC,EAAAA,WAbkB;AAclBC,EAAAA,wBAdkB;AAelBC,EAAAA,gBAfkB;AAgBlBC,EAAAA,eAhBkB;AAiBlBC,EAAAA,cAjBkB;AAkBlBC,EAAAA;AAlBkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/content';\nimport { kebabCase } from './utils/object';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';\nimport { cleanEmptyObject } from './hooks/utils';\nimport { useBlockEditingMode } from './components/block-editing-mode';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport { useLayoutClasses, useLayoutStyles } from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tgetRichTextValues,\n\tkebabCase,\n\tPrivateInserter,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseShouldContextualToolbarShow,\n\tcleanEmptyObject,\n\tuseBlockEditingMode,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n} );\n"]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as globalStyles from './components/global-styles';
|
|
5
5
|
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
|
+
import { kebabCase } from './utils/object';
|
|
6
7
|
import { lock } from './lock-unlock';
|
|
7
8
|
/**
|
|
8
9
|
* Private @wordpress/block-editor APIs.
|
|
@@ -10,6 +11,7 @@ import { lock } from './lock-unlock';
|
|
|
10
11
|
|
|
11
12
|
export const privateApis = {};
|
|
12
13
|
lock(privateApis, { ...globalStyles,
|
|
14
|
+
kebabCase,
|
|
13
15
|
ExperimentalBlockEditorProvider
|
|
14
16
|
});
|
|
15
17
|
//# sourceMappingURL=private-apis.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.native.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","lock","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,IAAT,QAAqB,eAArB;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPD,IAAI,CAAEC,WAAF,EAAe,EAClB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.native.js"],"names":["globalStyles","ExperimentalBlockEditorProvider","kebabCase","lock","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAZ,MAA8B,4BAA9B;AACA,SAASC,+BAAT,QAAgD,uBAAhD;AACA,SAASC,SAAT,QAA0B,gBAA1B;AACA,SAASC,IAAT,QAAqB,eAArB;AAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPD,IAAI,CAAEC,WAAF,EAAe,EAClB,GAAGJ,YADe;AAElBE,EAAAA,SAFkB;AAGlBD,EAAAA;AAHkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { kebabCase } from './utils/object';\nimport { lock } from './lock-unlock';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tkebabCase,\n\tExperimentalBlockEditorProvider,\n} );\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* WordPress dependencies
|
|
3
5
|
*/
|
|
@@ -1183,7 +1185,9 @@ export function updateBlockListSettings(clientId, settings) {
|
|
|
1183
1185
|
*/
|
|
1184
1186
|
|
|
1185
1187
|
export function updateSettings(settings) {
|
|
1186
|
-
return __experimentalUpdateSettings(settings,
|
|
1188
|
+
return __experimentalUpdateSettings(settings, {
|
|
1189
|
+
stripExperimentalSettings: true
|
|
1190
|
+
});
|
|
1187
1191
|
}
|
|
1188
1192
|
/**
|
|
1189
1193
|
* Action that signals that a temporary reusable block has been saved
|
|
@@ -1466,4 +1470,190 @@ export function __unstableSetTemporarilyEditingAsBlocks(temporarilyEditingAsBloc
|
|
|
1466
1470
|
temporarilyEditingAsBlocks
|
|
1467
1471
|
};
|
|
1468
1472
|
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Interface for inserter media requests.
|
|
1475
|
+
*
|
|
1476
|
+
* @typedef {Object} InserterMediaRequest
|
|
1477
|
+
* @property {number} per_page How many items to fetch per page.
|
|
1478
|
+
* @property {string} search The search term to use for filtering the results.
|
|
1479
|
+
*/
|
|
1480
|
+
|
|
1481
|
+
/**
|
|
1482
|
+
* Interface for inserter media responses. Any media resource should
|
|
1483
|
+
* map their response to this interface, in order to create the core
|
|
1484
|
+
* WordPress media blocks (image, video, audio).
|
|
1485
|
+
*
|
|
1486
|
+
* @typedef {Object} InserterMediaItem
|
|
1487
|
+
* @property {string} title The title of the media item.
|
|
1488
|
+
* @property {string} url The source url of the media item.
|
|
1489
|
+
* @property {string} [previewUrl] The preview source url of the media item to display in the media list.
|
|
1490
|
+
* @property {number} [id] The WordPress id of the media item.
|
|
1491
|
+
* @property {number|string} [sourceId] The id of the media item from external source.
|
|
1492
|
+
* @property {string} [alt] The alt text of the media item.
|
|
1493
|
+
* @property {string} [caption] The caption of the media item.
|
|
1494
|
+
*/
|
|
1495
|
+
|
|
1496
|
+
/**
|
|
1497
|
+
* Registers a new inserter media category. Once registered, the media category is
|
|
1498
|
+
* available in the inserter's media tab.
|
|
1499
|
+
*
|
|
1500
|
+
* The following interfaces are used:
|
|
1501
|
+
*
|
|
1502
|
+
* _Type Definition_
|
|
1503
|
+
*
|
|
1504
|
+
* - _InserterMediaRequest_ `Object`: Interface for inserter media requests.
|
|
1505
|
+
*
|
|
1506
|
+
* _Properties_
|
|
1507
|
+
*
|
|
1508
|
+
* - _per_page_ `number`: How many items to fetch per page.
|
|
1509
|
+
* - _search_ `string`: The search term to use for filtering the results.
|
|
1510
|
+
*
|
|
1511
|
+
* _Type Definition_
|
|
1512
|
+
*
|
|
1513
|
+
* - _InserterMediaItem_ `Object`: Interface for inserter media responses. Any media resource should
|
|
1514
|
+
* map their response to this interface, in order to create the core
|
|
1515
|
+
* WordPress media blocks (image, video, audio).
|
|
1516
|
+
*
|
|
1517
|
+
* _Properties_
|
|
1518
|
+
*
|
|
1519
|
+
* - _title_ `string`: The title of the media item.
|
|
1520
|
+
* - _url_ `string: The source url of the media item.
|
|
1521
|
+
* - _previewUrl_ `[string]`: The preview source url of the media item to display in the media list.
|
|
1522
|
+
* - _id_ `[number]`: The WordPress id of the media item.
|
|
1523
|
+
* - _sourceId_ `[number|string]`: The id of the media item from external source.
|
|
1524
|
+
* - _alt_ `[string]`: The alt text of the media item.
|
|
1525
|
+
* - _caption_ `[string]`: The caption of the media item.
|
|
1526
|
+
*
|
|
1527
|
+
* @param {InserterMediaCategory} category The inserter media category to register.
|
|
1528
|
+
*
|
|
1529
|
+
* @example
|
|
1530
|
+
* ```js
|
|
1531
|
+
*
|
|
1532
|
+
* wp.data.dispatch('core/block-editor').registerInserterMediaCategory( {
|
|
1533
|
+
* name: 'openverse',
|
|
1534
|
+
* labels: {
|
|
1535
|
+
* name: 'Openverse',
|
|
1536
|
+
* search_items: 'Search Openverse',
|
|
1537
|
+
* },
|
|
1538
|
+
* mediaType: 'image',
|
|
1539
|
+
* async fetch( query = {} ) {
|
|
1540
|
+
* const defaultArgs = {
|
|
1541
|
+
* mature: false,
|
|
1542
|
+
* excluded_source: 'flickr,inaturalist,wikimedia',
|
|
1543
|
+
* license: 'pdm,cc0',
|
|
1544
|
+
* };
|
|
1545
|
+
* const finalQuery = { ...query, ...defaultArgs };
|
|
1546
|
+
* // Sometimes you might need to map the supported request params according to `InserterMediaRequest`.
|
|
1547
|
+
* // interface. In this example the `search` query param is named `q`.
|
|
1548
|
+
* const mapFromInserterMediaRequest = {
|
|
1549
|
+
* per_page: 'page_size',
|
|
1550
|
+
* search: 'q',
|
|
1551
|
+
* };
|
|
1552
|
+
* const url = new URL( 'https://api.openverse.engineering/v1/images/' );
|
|
1553
|
+
* Object.entries( finalQuery ).forEach( ( [ key, value ] ) => {
|
|
1554
|
+
* const queryKey = mapFromInserterMediaRequest[ key ] || key;
|
|
1555
|
+
* url.searchParams.set( queryKey, value );
|
|
1556
|
+
* } );
|
|
1557
|
+
* const response = await window.fetch( url, {
|
|
1558
|
+
* headers: {
|
|
1559
|
+
* 'User-Agent': 'WordPress/inserter-media-fetch',
|
|
1560
|
+
* },
|
|
1561
|
+
* } );
|
|
1562
|
+
* const jsonResponse = await response.json();
|
|
1563
|
+
* const results = jsonResponse.results;
|
|
1564
|
+
* return results.map( ( result ) => ( {
|
|
1565
|
+
* ...result,
|
|
1566
|
+
* // If your response result includes an `id` prop that you want to access later, it should
|
|
1567
|
+
* // be mapped to `InserterMediaItem`'s `sourceId` prop. This can be useful if you provide
|
|
1568
|
+
* // a report URL getter.
|
|
1569
|
+
* // Additionally you should always clear the `id` value of your response results because
|
|
1570
|
+
* // it is used to identify WordPress media items.
|
|
1571
|
+
* sourceId: result.id,
|
|
1572
|
+
* id: undefined,
|
|
1573
|
+
* caption: result.caption,
|
|
1574
|
+
* previewUrl: result.thumbnail,
|
|
1575
|
+
* } ) );
|
|
1576
|
+
* },
|
|
1577
|
+
* getReportUrl: ( { sourceId } ) =>
|
|
1578
|
+
* `https://wordpress.org/openverse/image/${ sourceId }/report/`,
|
|
1579
|
+
* isExternalResource: true,
|
|
1580
|
+
* } );
|
|
1581
|
+
* ```
|
|
1582
|
+
*
|
|
1583
|
+
* @typedef {Object} InserterMediaCategory Interface for inserter media category.
|
|
1584
|
+
* @property {string} name The name of the media category, that should be unique among all media categories.
|
|
1585
|
+
* @property {Object} labels Labels for the media category.
|
|
1586
|
+
* @property {string} labels.name General name of the media category. It's used in the inserter media items list.
|
|
1587
|
+
* @property {string} [labels.search_items='Search'] Label for searching items. Default is ‘Search Posts’ / ‘Search Pages’.
|
|
1588
|
+
* @property {('image'|'audio'|'video')} mediaType The media type of the media category.
|
|
1589
|
+
* @property {(InserterMediaRequest) => Promise<InserterMediaItem[]>} fetch The function to fetch media items for the category.
|
|
1590
|
+
* @property {(InserterMediaItem) => string} [getReportUrl] If the media category supports reporting media items, this function should return
|
|
1591
|
+
* the report url for the media item. It accepts the `InserterMediaItem` as an argument.
|
|
1592
|
+
* @property {boolean} [isExternalResource] If the media category is an external resource, this should be set to true.
|
|
1593
|
+
* This is used to avoid making a request to the external resource when the user
|
|
1594
|
+
*
|
|
1595
|
+
*/
|
|
1596
|
+
|
|
1597
|
+
export const registerInserterMediaCategory = category => ({
|
|
1598
|
+
select,
|
|
1599
|
+
dispatch
|
|
1600
|
+
}) => {
|
|
1601
|
+
if (!category || typeof category !== 'object') {
|
|
1602
|
+
console.error('Category should be an `InserterMediaCategory` object.');
|
|
1603
|
+
return;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
if (!category.name) {
|
|
1607
|
+
console.error('Category should have a `name` that should be unique among all media categories.');
|
|
1608
|
+
return;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
if (!category.labels?.name) {
|
|
1612
|
+
console.error('Category should have a `labels.name`.');
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
if (!['image', 'audio', 'video'].includes(category.mediaType)) {
|
|
1617
|
+
console.error('Category should have `mediaType` property that is one of `image|audio|video`.');
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
if (!category.fetch || typeof category.fetch !== 'function') {
|
|
1622
|
+
console.error('Category should have a `fetch` function defined with the following signature `(InserterMediaRequest) => Promise<InserterMediaItem[]>`.');
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
const {
|
|
1627
|
+
inserterMediaCategories = []
|
|
1628
|
+
} = select.getSettings();
|
|
1629
|
+
|
|
1630
|
+
if (inserterMediaCategories.some(({
|
|
1631
|
+
name
|
|
1632
|
+
}) => name === category.name)) {
|
|
1633
|
+
console.error(`A category is already registered with the same name: "${category.name}".`);
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
if (inserterMediaCategories.some(({
|
|
1638
|
+
labels: {
|
|
1639
|
+
name
|
|
1640
|
+
}
|
|
1641
|
+
}) => name === category.labels?.name)) {
|
|
1642
|
+
console.error(`A category is already registered with the same labels.name: "${category.labels.name}".`);
|
|
1643
|
+
return;
|
|
1644
|
+
} // `inserterMediaCategories` is a private block editor setting, which means it cannot
|
|
1645
|
+
// be updated through the public `updateSettings` action. We preserve this setting as
|
|
1646
|
+
// private, so extenders can only add new inserter media categories and don't have any
|
|
1647
|
+
// control over the core media categories.
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
dispatch({
|
|
1651
|
+
type: 'UPDATE_SETTINGS',
|
|
1652
|
+
settings: {
|
|
1653
|
+
inserterMediaCategories: [...inserterMediaCategories, { ...category,
|
|
1654
|
+
isExternalResource: true
|
|
1655
|
+
}]
|
|
1656
|
+
}
|
|
1657
|
+
});
|
|
1658
|
+
};
|
|
1469
1659
|
//# sourceMappingURL=actions.js.map
|