@wordpress/block-editor 12.13.0 → 12.15.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 +4 -0
- package/README.md +1 -1
- package/build/components/block-heading-level-dropdown/index.js +1 -1
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -0
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +2 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +16 -3
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-parent-selector/index.js +1 -1
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +25 -16
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js +36 -19
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +6 -4
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/index.js +28 -0
- package/build/components/block-rename/index.js.map +1 -0
- package/build/components/block-rename/is-empty-string.js +10 -0
- package/build/components/block-rename/is-empty-string.js.map +1 -0
- package/build/components/block-rename/modal.js +87 -0
- package/build/components/block-rename/modal.js.map +1 -0
- package/build/components/block-rename/rename-control.js +74 -0
- package/build/components/block-rename/rename-control.js.map +1 -0
- package/build/components/block-rename/use-block-rename.js +17 -0
- package/build/components/block-rename/use-block-rename.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +33 -20
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +7 -0
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +0 -8
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +18 -14
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +11 -81
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +56 -0
- package/build/components/block-tools/empty-block-inserter.js.map +1 -0
- package/build/components/block-tools/index.js +48 -9
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/selected-block-tools.js +113 -0
- package/build/components/block-tools/selected-block-tools.js.map +1 -0
- package/build/components/block-tools/use-selected-block-tool-props.js +56 -0
- package/build/components/block-tools/use-selected-block-tool-props.js.map +1 -0
- package/build/components/block-types-list/index.js +6 -2
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +8 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/editable-text/index.js +1 -2
- package/build/components/editable-text/index.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +1 -1
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/iframe/index.js +4 -3
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-size-control/index.js +0 -5
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +29 -31
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/{explorer.js → index.js} +7 -7
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +4 -4
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/index.js +75 -0
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +108 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
- package/build/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +18 -34
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +55 -0
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/utils.js +69 -0
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -0
- package/build/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +9 -5
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +15 -12
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +3 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter-listbox/index.js +11 -6
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +24 -23
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +5 -5
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/link-control/index.js +6 -5
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +39 -0
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +16 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +3 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +69 -18
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/preview-options/index.js +4 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +1 -14
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/index.js +0 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +4 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/format-edit.js +45 -0
- package/build/components/rich-text/native/format-edit.js.map +1 -0
- package/build/components/rich-text/native/get-format-colors.native.js +41 -0
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -0
- package/build/components/rich-text/native/index.js +9 -0
- package/build/components/rich-text/native/index.js.map +1 -0
- package/build/components/rich-text/native/index.native.js +1189 -0
- package/build/components/rich-text/native/index.native.js.map +1 -0
- package/build/components/rich-text/native/toolbar-button-with-options.native.js +58 -0
- package/build/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
- package/build/components/rich-text/native/use-format-types.js +111 -0
- package/build/components/rich-text/native/use-format-types.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +30 -1
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +2 -5
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +4 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +2 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-settings/index.js +2 -2
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +7 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +10 -10
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +2 -2
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +7 -6
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +16 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +7 -8
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +42 -0
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/content-lock-ui.js +5 -5
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +8 -7
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-fields.js +57 -52
- package/build/hooks/custom-fields.js.map +1 -1
- package/build/hooks/duotone.js +9 -20
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +103 -93
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +10 -9
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +10 -13
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +30 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +4 -3
- package/build/layouts/constrained.js.map +1 -1
- package/build/private-apis.js +3 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +30 -37
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +18 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +18 -13
- package/build/store/selectors.js.map +1 -1
- package/build/utils/transform-styles/index.js +26 -6
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -0
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +3 -10
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +16 -3
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +1 -1
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +24 -15
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +36 -19
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +7 -5
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-rename/index.js +4 -0
- package/build-module/components/block-rename/index.js.map +1 -0
- package/build-module/components/block-rename/is-empty-string.js +4 -0
- package/build-module/components/block-rename/is-empty-string.js.map +1 -0
- package/build-module/components/block-rename/modal.js +79 -0
- package/build-module/components/block-rename/modal.js.map +1 -0
- package/build-module/components/block-rename/rename-control.js +66 -0
- package/build-module/components/block-rename/rename-control.js.map +1 -0
- package/build-module/components/block-rename/use-block-rename.js +10 -0
- package/build-module/components/block-rename/use-block-rename.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +34 -21
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +7 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +0 -8
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +17 -13
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +11 -80
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +48 -0
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -0
- package/build-module/components/block-tools/index.js +48 -9
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/selected-block-tools.js +105 -0
- package/build-module/components/block-tools/selected-block-tools.js.map +1 -0
- package/build-module/components/block-tools/use-selected-block-tool-props.js +50 -0
- package/build-module/components/block-tools/use-selected-block-tool-props.js.map +1 -0
- package/build-module/components/block-types-list/index.js +6 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +8 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/editable-text/index.js +1 -2
- package/build-module/components/editable-text/index.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -1
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -3
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +0 -5
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +30 -32
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/{explorer.js → index.js} +5 -5
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +3 -3
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/index.js +66 -0
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +42 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +100 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
- package/build-module/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +7 -20
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +47 -0
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/utils.js +57 -0
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -0
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +9 -5
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +15 -12
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +4 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +13 -8
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +25 -23
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +6 -5
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/link-control/index.js +7 -6
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +39 -0
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +16 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +3 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +69 -17
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +4 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +1 -14
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/index.js +0 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +4 -2
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/format-edit.js +38 -0
- package/build-module/components/rich-text/native/format-edit.js.map +1 -0
- package/build-module/components/rich-text/native/get-format-colors.native.js +34 -0
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -0
- package/build-module/components/rich-text/native/index.js +2 -0
- package/build-module/components/rich-text/native/index.js.map +1 -0
- package/build-module/components/rich-text/native/index.native.js +1179 -0
- package/build-module/components/rich-text/native/index.native.js.map +1 -0
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +51 -0
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
- package/build-module/components/rich-text/native/use-format-types.js +104 -0
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +31 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +2 -5
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +2 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +4 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +2 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +2 -2
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +7 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +8 -8
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +2 -2
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +5 -4
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +17 -5
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +5 -6
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +40 -0
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +3 -3
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +6 -5
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-fields.js +57 -52
- package/build-module/hooks/custom-fields.js.map +1 -1
- package/build-module/hooks/duotone.js +10 -21
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +103 -93
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +11 -10
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +10 -13
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +30 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +4 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/private-apis.js +4 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +29 -37
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +17 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +17 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +24 -7
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +6 -6
- package/build-style/content.css +6 -6
- package/build-style/style-rtl.css +26 -20
- package/build-style/style.css +26 -20
- package/package.json +31 -31
- package/src/components/block-heading-level-dropdown/index.js +1 -1
- package/src/components/block-list/block.native.js +2 -0
- package/src/components/block-list/index.js +4 -18
- package/src/components/block-list-appender/index.js +20 -4
- package/src/components/block-parent-selector/index.js +1 -1
- package/src/components/block-pattern-setup/index.js +38 -22
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -0
- package/src/components/block-pattern-setup/style.scss +4 -1
- package/src/components/block-patterns-list/README.md +4 -4
- package/src/components/block-patterns-list/index.js +60 -34
- package/src/components/block-patterns-list/style.scss +7 -0
- package/src/components/block-quick-navigation/index.js +11 -5
- package/src/components/block-rename/index.js +3 -0
- package/src/components/block-rename/is-empty-string.js +3 -0
- package/src/components/block-rename/modal.js +115 -0
- package/src/components/block-rename/rename-control.js +80 -0
- package/src/components/block-rename/use-block-rename.js +10 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +38 -34
- package/src/components/block-settings-menu-controls/index.js +9 -0
- package/src/components/block-styles/index.js +0 -10
- package/src/components/block-switcher/pattern-transformations-menu.js +20 -14
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -4
- package/src/components/block-toolbar/style.scss +8 -0
- package/src/components/block-tools/back-compat.js +1 -1
- package/src/components/block-tools/block-contextual-toolbar.js +11 -134
- package/src/components/block-tools/empty-block-inserter.js +56 -0
- package/src/components/block-tools/index.js +72 -16
- package/src/components/block-tools/selected-block-tools.js +127 -0
- package/src/components/block-tools/style.scss +0 -10
- package/src/components/block-tools/use-selected-block-tool-props.js +66 -0
- package/src/components/block-types-list/index.js +5 -4
- package/src/components/button-block-appender/content.scss +2 -2
- package/src/components/date-format-picker/index.js +7 -0
- package/src/components/editable-text/README.md +0 -36
- package/src/components/editable-text/index.js +1 -8
- package/src/components/global-styles/advanced-panel.js +1 -1
- package/src/components/iframe/index.js +4 -3
- package/src/components/image-size-control/index.js +0 -6
- package/src/components/inner-blocks/index.js +6 -2
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +57 -33
- package/src/components/inserter/block-patterns-explorer/{explorer.js → index.js} +4 -4
- package/src/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +9 -2
- package/src/components/inserter/block-patterns-tab/index.js +118 -0
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +179 -0
- package/src/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +15 -21
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +101 -0
- package/src/components/inserter/block-patterns-tab/utils.js +78 -0
- package/src/components/inserter/hooks/use-patterns-state.js +3 -1
- package/src/components/inserter/media-tab/media-list.js +7 -7
- package/src/components/inserter/media-tab/media-preview.js +27 -22
- package/src/components/inserter/menu.js +4 -5
- package/src/components/inserter-listbox/index.js +11 -7
- package/src/components/inserter-listbox/item.js +11 -12
- package/src/components/inserter-listbox/row.js +6 -12
- package/src/components/link-control/README.md +2 -2
- package/src/components/link-control/index.js +15 -6
- package/src/components/link-control/style.scss +8 -5
- package/src/components/list-view/block-select-button.js +44 -1
- package/src/components/list-view/block.js +11 -11
- package/src/components/list-view/index.js +2 -0
- package/src/components/list-view/use-list-view-expand-selected-item.js +7 -8
- package/src/components/media-replace-flow/style.scss +2 -2
- package/src/components/navigable-toolbar/index.js +71 -25
- package/src/components/plain-text/README.md +2 -30
- package/src/components/preview-options/index.js +2 -0
- package/src/components/provider/use-block-sync.js +2 -21
- package/src/components/rich-text/README.md +6 -63
- package/src/components/rich-text/index.js +0 -1
- package/src/components/rich-text/index.native.js +4 -2
- package/src/components/rich-text/native/format-edit.js +44 -0
- package/src/components/rich-text/native/get-format-colors.native.js +54 -0
- package/src/components/rich-text/native/index.js +1 -0
- package/src/components/rich-text/native/index.native.js +1406 -0
- package/src/components/rich-text/native/style.native.scss +28 -0
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +79 -0
- package/src/components/rich-text/native/test/index.native.js +278 -0
- package/src/components/rich-text/native/test/performance/rich-text.native.js +44 -0
- package/src/components/rich-text/native/toolbar-button-with-options.native.js +61 -0
- package/src/components/rich-text/native/use-format-types.js +146 -0
- package/src/components/rich-text/use-input-rules.js +30 -2
- package/src/components/rich-text/use-paste-handler.js +1 -6
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/url-input/README.md +1 -74
- package/src/components/url-popover/image-url-input-ui.js +1 -0
- package/src/components/use-block-drop-zone/index.js +4 -1
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-settings/index.js +2 -2
- package/src/components/use-settings/test/index.js +1 -1
- package/src/components/writing-flow/use-tab-nav.js +8 -3
- package/src/hooks/align.js +8 -8
- package/src/hooks/align.native.js +2 -2
- package/src/hooks/anchor.js +21 -23
- package/src/hooks/background.js +28 -6
- package/src/hooks/block-hooks.js +20 -16
- package/src/hooks/block-renaming.js +47 -0
- package/src/hooks/content-lock-ui.js +3 -3
- package/src/hooks/custom-class-name.js +7 -6
- package/src/hooks/custom-fields.js +73 -70
- package/src/hooks/duotone.js +23 -33
- package/src/hooks/index.js +0 -1
- package/src/hooks/layout.js +126 -113
- package/src/hooks/position.js +8 -21
- package/src/hooks/style.js +17 -31
- package/src/hooks/test/__snapshots__/align.native.js.snap +5 -5
- package/src/hooks/test/align.js +4 -4
- package/src/hooks/utils.js +33 -1
- package/src/layouts/constrained.js +57 -50
- package/src/private-apis.js +4 -1
- package/src/store/actions.js +26 -72
- package/src/store/reducer.js +19 -0
- package/src/store/selectors.js +15 -19
- package/src/style.scss +1 -1
- package/src/utils/test/transform-styles.js +49 -0
- package/src/utils/transform-styles/index.js +39 -13
- package/build/components/block-tools/selected-block-popover.js +0 -221
- package/build/components/block-tools/selected-block-popover.js.map +0 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
- package/build/components/inserter/block-patterns-filter.js.map +0 -1
- package/build/components/inserter/block-patterns-tab.js +0 -270
- package/build/components/inserter/block-patterns-tab.js.map +0 -1
- package/build/hooks/block-rename-ui.js +0 -165
- package/build/hooks/block-rename-ui.js.map +0 -1
- package/build/store/utils.js +0 -22
- package/build/store/utils.js.map +0 -1
- package/build-module/components/block-tools/selected-block-popover.js +0 -213
- package/build-module/components/block-tools/selected-block-popover.js.map +0 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
- package/build-module/components/inserter/block-patterns-filter.js.map +0 -1
- package/build-module/components/inserter/block-patterns-tab.js +0 -254
- package/build-module/components/inserter/block-patterns-tab.js.map +0 -1
- package/build-module/hooks/block-rename-ui.js +0 -157
- package/build-module/hooks/block-rename-ui.js.map +0 -1
- package/build-module/store/utils.js +0 -16
- package/build-module/store/utils.js.map +0 -1
- package/src/components/block-tools/selected-block-popover.js +0 -265
- package/src/components/inserter/block-patterns-tab.js +0 -448
- package/src/hooks/block-rename-ui.js +0 -226
- package/src/store/utils.js +0 -12
- /package/src/{hooks/block-rename-ui.scss → components/block-rename/style.scss} +0 -0
- /package/src/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_compose","_components","_keyboardShortcuts","_element","_insertionPoint","_interopRequireWildcard","_selectedBlockPopover","_interopRequireDefault","_store","_blockContextualToolbar","_usePopoverScroll","_zoomOutModeInserters","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","selector","select","__unstableGetEditorMode","getSettings","isTyping","blockEditorStore","isZoomOutMode","hasFixedToolbar","BlockTools","children","__unstableContentRef","props","isLargeViewport","useViewportMatch","useSelect","isMatch","useShortcutEventMatch","getSelectedBlockClientIds","getBlockRootClientId","duplicateBlocks","removeBlocks","insertAfterBlock","insertBeforeBlock","clearSelectedBlock","selectBlock","moveBlocksUp","moveBlocksDown","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","ownerDocument","defaultView","getSelection","removeAllRanges","current","focus","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","_react","createElement","InsertionPointOpenRef","Provider","value","useRef","isFixed","Popover","Slot","name","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport SelectedBlockPopover from './selected-block-popover';\nimport { store as blockEditorStore } from '../../store';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\n\nfunction selector( select ) {\n\tconst { __unstableGetEditorMode, getSettings, isTyping } =\n\t\tselect( blockEditorStore );\n\n\treturn {\n\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { hasFixedToolbar, isZoomOutMode, isTyping } = useSelect(\n\t\tselector,\n\t\t[]\n\t);\n\tconst isMatch = useShortcutEventMatch();\n\tconst { getSelectedBlockClientIds, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tclearSelectedBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t} = useDispatch( blockEditorStore );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) return;\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t\t} else {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t}\n\t\t\t\tevent.target.ownerDocument.defaultView\n\t\t\t\t\t.getSelection()\n\t\t\t\t\t.removeAllRanges();\n\t\t\t\t__unstableContentRef?.current.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isZoomOutMode &&\n\t\t\t\t\t( hasFixedToolbar || ! isLargeViewport ) && (\n\t\t\t\t\t\t<BlockContextualToolbar isFixed />\n\t\t\t\t\t) }\n\t\t\t\t{ /* Even if the toolbar is fixed, the block popover is still\n\t\t\t\t\tneeded for navigation and zoom-out mode. */ }\n\t\t\t\t<SelectedBlockPopover\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t/>\n\t\t\t\t{ /* Used for the inline rich text toolbar. */ }\n\t\t\t\t<Popover.Slot name=\"block-toolbar\" ref={ blockToolbarRef } />\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,eAAA,GAAAC,uBAAA,CAAAN,OAAA;AAIA,IAAAO,qBAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,iBAAA,GAAAH,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AsB;MAACkE,OAAO;IAAA,CAAE,CACjC,EAGF,IAAAN,MAAA,CAAAC,aAAA,EAAC1E,qBAAA,CAAAa,OAAoB;MACpByB,oBAAoB,EAAGA;IAAsB,CAC7C,CAAC,EAEF,IAAAmC,MAAA,CAAAC,aAAA,EAAC/E,WAAA,CAAAqF,OAAO,CAACC,IAAI;MAACC,IAAI,EAAC,eAAe;MAACC,GAAG,EAAGb;IAAiB,CAAE,CAAC,EAC3DjC,QAAQ,EAEV,IAAAoC,MAAA,CAAAC,aAAA,EAAC/E,WAAA,CAAAqF,OAAO,CAACC,IAAI;MACZC,IAAI,EAAC,8BAA8B;MACnCC,GAAG,EAAGX;IAAsB,CAC5B,CAAC,EACAtC,aAAa,IACd,IAAAuC,MAAA,CAAAC,aAAA,EAACrE,qBAAA,CAAAQ,OAAoB;MACpByB,oBAAoB,EAAGA;IAAsB,CAC7C,CAE6B,CAC5B;EAAC;AAER"}
|
|
1
|
+
{"version":3,"names":["_data","require","_compose","_components","_keyboardShortcuts","_element","_blocks","_emptyBlockInserter","_interopRequireDefault","_insertionPoint","_interopRequireWildcard","_selectedBlockTools","_store","_blockContextualToolbar","_usePopoverScroll","_zoomOutModeInserters","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getSettings","__unstableGetEditorMode","isTyping","blockEditorStore","clientId","name","attributes","hasFixedToolbar","hasSelectedBlock","isZoomOutMode","showEmptyBlockSideInserter","isUnmodifiedDefaultBlock","BlockTools","children","__unstableContentRef","props","isLargeViewport","useViewportMatch","useSelect","isMatch","useShortcutEventMatch","getSelectedBlockClientIds","getBlockRootClientId","duplicateBlocks","removeBlocks","insertAfterBlock","insertBeforeBlock","clearSelectedBlock","selectBlock","moveBlocksUp","moveBlocksDown","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","closest","ownerDocument","defaultView","getSelection","removeAllRanges","current","focus","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","isTopToolbar","_react","createElement","InsertionPointOpenRef","Provider","value","useRef","isFixed","Popover","Slot","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport SelectedBlockTools from './selected-block-tools';\nimport { store as blockEditorStore } from '../../store';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlock,\n\t\tgetSettings,\n\t\t__unstableGetEditorMode,\n\t\tisTyping,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tconst { name = '', attributes = {} } = getBlock( clientId ) || {};\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\thasSelectedBlock: clientId && name,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\tshowEmptyBlockSideInserter:\n\t\t\tclientId &&\n\t\t\t! isTyping() &&\n\t\t\t__unstableGetEditorMode() === 'edit' &&\n\t\t\tisUnmodifiedDefaultBlock( { name, attributes } ),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tclientId,\n\t\thasFixedToolbar,\n\t\thasSelectedBlock,\n\t\tisTyping,\n\t\tisZoomOutMode,\n\t\tshowEmptyBlockSideInserter,\n\t} = useSelect( selector, [] );\n\tconst isMatch = useShortcutEventMatch();\n\tconst { getSelectedBlockClientIds, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tclearSelectedBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t} = useDispatch( blockEditorStore );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) return;\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t\t} else {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t}\n\t\t\t\tevent.target.ownerDocument.defaultView\n\t\t\t\t\t.getSelection()\n\t\t\t\t\t.removeAllRanges();\n\t\t\t\t__unstableContentRef?.current.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\t// Conditions for fixed toolbar\n\t// 1. Not zoom out mode\n\t// 2. It's a large viewport. If it's a smaller viewport, let the floating toolbar handle it as it already has styles attached to make it render that way.\n\t// 3. Fixed toolbar is enabled\n\tconst isTopToolbar = ! isZoomOutMode && hasFixedToolbar && isLargeViewport;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ /* If there is no slot available, such as in the standalone block editor, render within the editor */ }\n\n\t\t\t\t{ ! isLargeViewport && ( // Small viewports always get a fixed toolbar\n\t\t\t\t\t<BlockContextualToolbar isFixed />\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ /* Even if the toolbar is fixed, the block popover is still\n\t\t\t\t\tneeded for navigation and zoom-out mode. */ }\n\t\t\t\t{ ! showEmptyBlockSideInserter && hasSelectedBlock && (\n\t\t\t\t\t<SelectedBlockTools\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. */ }\n\t\t\t\t{ ! isTopToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,mBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAC,uBAAA,CAAAT,OAAA;AAIA,IAAAU,mBAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,uBAAA,GAAAL,sBAAA,CAAAP,OAAA;AACA,IAAAa,iBAAA,GAAAN,sBAAA,CAAAP,OAAA;AACA,IAAAc,qBAAA,GAAAP,sBAAA,CAAAP,OAAA;AAA6D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B;MACnCuD,GAAG,EAAGX;IAAsB,CAC5B,CAAC,EACAxC,aAAa,IACd,IAAA0C,MAAA,CAAAC,aAAA,EAAChF,qBAAA,CAAAQ,OAAoB;MACpBkC,oBAAoB,EAAGA;IAAsB,CAC7C,CAE6B,CAC5B;EAAC;AAER"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = SelectedBlockTools;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
var _data = require("@wordpress/data");
|
|
12
|
+
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
13
|
+
var _blockSelectionButton = _interopRequireDefault(require("./block-selection-button"));
|
|
14
|
+
var _blockContextualToolbar = _interopRequireDefault(require("./block-contextual-toolbar"));
|
|
15
|
+
var _store = require("../../store");
|
|
16
|
+
var _blockPopover = _interopRequireDefault(require("../block-popover"));
|
|
17
|
+
var _useBlockToolbarPopoverProps = _interopRequireDefault(require("./use-block-toolbar-popover-props"));
|
|
18
|
+
var _useSelectedBlockToolProps = _interopRequireDefault(require("./use-selected-block-tool-props"));
|
|
19
|
+
var _useShouldContextualToolbarShow = require("../../utils/use-should-contextual-toolbar-show");
|
|
20
|
+
/**
|
|
21
|
+
* External dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
function SelectedBlockTools({
|
|
33
|
+
clientId,
|
|
34
|
+
showEmptyBlockSideInserter,
|
|
35
|
+
__unstableContentRef
|
|
36
|
+
}) {
|
|
37
|
+
const {
|
|
38
|
+
capturingClientId,
|
|
39
|
+
isInsertionPointVisible,
|
|
40
|
+
lastClientId,
|
|
41
|
+
rootClientId
|
|
42
|
+
} = (0, _useSelectedBlockToolProps.default)(clientId);
|
|
43
|
+
const {
|
|
44
|
+
shouldShowBreadcrumb
|
|
45
|
+
} = (0, _data.useSelect)(select => {
|
|
46
|
+
const {
|
|
47
|
+
hasMultiSelection,
|
|
48
|
+
__unstableGetEditorMode
|
|
49
|
+
} = select(_store.store);
|
|
50
|
+
const editorMode = __unstableGetEditorMode();
|
|
51
|
+
return {
|
|
52
|
+
shouldShowBreadcrumb: !hasMultiSelection() && (editorMode === 'navigation' || editorMode === 'zoom-out')
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
const isToolbarForced = (0, _element.useRef)(false);
|
|
56
|
+
const {
|
|
57
|
+
shouldShowContextualToolbar,
|
|
58
|
+
canFocusHiddenToolbar
|
|
59
|
+
} = (0, _useShouldContextualToolbarShow.useShouldContextualToolbarShow)();
|
|
60
|
+
const {
|
|
61
|
+
stopTyping
|
|
62
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
63
|
+
(0, _keyboardShortcuts.useShortcut)('core/block-editor/focus-toolbar', () => {
|
|
64
|
+
isToolbarForced.current = true;
|
|
65
|
+
stopTyping(true);
|
|
66
|
+
}, {
|
|
67
|
+
isDisabled: !canFocusHiddenToolbar
|
|
68
|
+
});
|
|
69
|
+
(0, _element.useEffect)(() => {
|
|
70
|
+
isToolbarForced.current = false;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Stores the active toolbar item index so the block toolbar can return focus
|
|
74
|
+
// to it when re-mounting.
|
|
75
|
+
const initialToolbarItemIndexRef = (0, _element.useRef)();
|
|
76
|
+
(0, _element.useEffect)(() => {
|
|
77
|
+
// Resets the index whenever the active block changes so this is not
|
|
78
|
+
// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
79
|
+
initialToolbarItemIndexRef.current = undefined;
|
|
80
|
+
}, [clientId]);
|
|
81
|
+
const popoverProps = (0, _useBlockToolbarPopoverProps.default)({
|
|
82
|
+
contentElement: __unstableContentRef?.current,
|
|
83
|
+
clientId
|
|
84
|
+
});
|
|
85
|
+
if (showEmptyBlockSideInserter) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
if (shouldShowBreadcrumb || shouldShowContextualToolbar) {
|
|
89
|
+
return (0, _react.createElement)(_blockPopover.default, {
|
|
90
|
+
clientId: capturingClientId || clientId,
|
|
91
|
+
bottomClientId: lastClientId,
|
|
92
|
+
className: (0, _classnames.default)('block-editor-block-list__block-popover', {
|
|
93
|
+
'is-insertion-point-visible': isInsertionPointVisible
|
|
94
|
+
}),
|
|
95
|
+
resize: false,
|
|
96
|
+
...popoverProps
|
|
97
|
+
}, shouldShowContextualToolbar && (0, _react.createElement)(_blockContextualToolbar.default
|
|
98
|
+
// If the toolbar is being shown because of being forced
|
|
99
|
+
// it should focus the toolbar right after the mount.
|
|
100
|
+
, {
|
|
101
|
+
focusOnMount: isToolbarForced.current,
|
|
102
|
+
__experimentalInitialIndex: initialToolbarItemIndexRef.current,
|
|
103
|
+
__experimentalOnIndexChange: index => {
|
|
104
|
+
initialToolbarItemIndexRef.current = index;
|
|
105
|
+
}
|
|
106
|
+
}), shouldShowBreadcrumb && (0, _react.createElement)(_blockSelectionButton.default, {
|
|
107
|
+
clientId: clientId,
|
|
108
|
+
rootClientId: rootClientId
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=selected-block-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_keyboardShortcuts","_blockSelectionButton","_blockContextualToolbar","_store","_blockPopover","_useBlockToolbarPopoverProps","_useSelectedBlockToolProps","_useShouldContextualToolbarShow","SelectedBlockTools","clientId","showEmptyBlockSideInserter","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","rootClientId","useSelectedBlockToolProps","shouldShowBreadcrumb","useSelect","select","hasMultiSelection","__unstableGetEditorMode","blockEditorStore","editorMode","isToolbarForced","useRef","shouldShowContextualToolbar","canFocusHiddenToolbar","useShouldContextualToolbarShow","stopTyping","useDispatch","useShortcut","current","isDisabled","useEffect","initialToolbarItemIndexRef","undefined","popoverProps","useBlockToolbarPopoverProps","contentElement","_react","createElement","default","bottomClientId","className","classnames","resize","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","index"],"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-tools.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport { useShouldContextualToolbarShow } from '../../utils/use-should-contextual-toolbar-show';\n\nexport default function SelectedBlockTools( {\n\tclientId,\n\tshowEmptyBlockSideInserter,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\tcapturingClientId,\n\t\tisInsertionPointVisible,\n\t\tlastClientId,\n\t\trootClientId,\n\t} = useSelectedBlockToolProps( clientId );\n\n\tconst { shouldShowBreadcrumb } = useSelect( ( select ) => {\n\t\tconst { hasMultiSelection, __unstableGetEditorMode } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst editorMode = __unstableGetEditorMode();\n\n\t\treturn {\n\t\t\tshouldShowBreadcrumb:\n\t\t\t\t! hasMultiSelection() &&\n\t\t\t\t( editorMode === 'navigation' || editorMode === 'zoom-out' ),\n\t\t};\n\t}, [] );\n\n\tconst isToolbarForced = useRef( false );\n\tconst { shouldShowContextualToolbar, canFocusHiddenToolbar } =\n\t\tuseShouldContextualToolbarShow();\n\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tisToolbarForced.current = true;\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tuseEffect( () => {\n\t\t// Resets the index whenever the active block changes so this is not\n\t\t// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\tinitialToolbarItemIndexRef.current = undefined;\n\t}, [ clientId ] );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\tif ( showEmptyBlockSideInserter ) {\n\t\treturn null;\n\t}\n\n\tif ( shouldShowBreadcrumb || shouldShowContextualToolbar ) {\n\t\treturn (\n\t\t\t<BlockPopover\n\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tresize={ false }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t{ shouldShowContextualToolbar && (\n\t\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t\t<BlockSelectionButton\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPopover>\n\t\t);\n\t}\n\n\treturn null;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAKA,IAAAI,qBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,uBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,4BAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,0BAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,+BAAA,GAAAV,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AASe,SAASW,kBAAkBA,CAAE;EAC3CC,QAAQ;EACRC,0BAA0B;EAC1BC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,iBAAiB;IACjBC,uBAAuB;IACvBC,YAAY;IACZC;EACD,CAAC,GAAG,IAAAC,kCAAyB,EAAEP,QAAS,CAAC;EAEzC,MAAM;IAAEQ;EAAqB,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzD,MAAM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QAAQ,EAAGG,iBAAiB,IAAIH,QAAU;MAC1CkC,cAAc,EAAG7B,YAAc;MAC/B8B,SAAS,EAAG,IAAAC,mBAAU,EACrB,wCAAwC,EACxC;QACC,4BAA4B,EAAEhC;MAC/B,CACD,CAAG;MACHiC,MAAM,EAAG,KAAO;MAAA,GACXT;IAAY,GAEfX,2BAA2B,IAC5B,IAAAc,MAAA,CAAAC,aAAA,EAACvC,uBAAA,CAAAwC;IACA;IACA;IAAA;MACAK,YAAY,EAAGvB,eAAe,CAACQ,OAAS;MACxCgB,0BAA0B,EACzBb,0BAA0B,CAACH,OAC3B;MACDiB,2BAA2B,EAAKC,KAAK,IAAM;QAC1Cf,0BAA0B,CAACH,OAAO,GAAGkB,KAAK;MAC3C;IAAG,CACH,CACD,EACCjC,oBAAoB,IACrB,IAAAuB,MAAA,CAAAC,aAAA,EAACxC,qBAAA,CAAAyC,OAAoB;MACpBjC,QAAQ,EAAGA,QAAU;MACrBM,YAAY,EAAGA;IAAc,CAC7B,CAEW,CAAC;EAEjB;EAEA,OAAO,IAAI;AACZ"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useSelectedBlockToolProps;
|
|
7
|
+
var _data = require("@wordpress/data");
|
|
8
|
+
var _store = require("../../store");
|
|
9
|
+
/**
|
|
10
|
+
* WordPress dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns props for the selected block tools and empty block inserter.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} clientId Selected block client ID.
|
|
21
|
+
*/
|
|
22
|
+
function useSelectedBlockToolProps(clientId) {
|
|
23
|
+
const selectedBlockProps = (0, _data.useSelect)(select => {
|
|
24
|
+
const {
|
|
25
|
+
getBlockRootClientId,
|
|
26
|
+
getBlockParents,
|
|
27
|
+
__experimentalGetBlockListSettingsForBlocks,
|
|
28
|
+
isBlockInsertionPointVisible,
|
|
29
|
+
getBlockInsertionPoint,
|
|
30
|
+
getBlockOrder,
|
|
31
|
+
hasMultiSelection,
|
|
32
|
+
getLastMultiSelectedBlockClientId
|
|
33
|
+
} = select(_store.store);
|
|
34
|
+
const blockParentsClientIds = getBlockParents(clientId);
|
|
35
|
+
|
|
36
|
+
// Get Block List Settings for all ancestors of the current Block clientId.
|
|
37
|
+
const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds);
|
|
38
|
+
|
|
39
|
+
// Get the clientId of the topmost parent with the capture toolbars setting.
|
|
40
|
+
const capturingClientId = blockParentsClientIds.find(parentClientId => parentBlockListSettings[parentClientId]?.__experimentalCaptureToolbars);
|
|
41
|
+
let isInsertionPointVisible = false;
|
|
42
|
+
if (isBlockInsertionPointVisible()) {
|
|
43
|
+
const insertionPoint = getBlockInsertionPoint();
|
|
44
|
+
const order = getBlockOrder(insertionPoint.rootClientId);
|
|
45
|
+
isInsertionPointVisible = order[insertionPoint.index] === clientId;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
capturingClientId,
|
|
49
|
+
isInsertionPointVisible,
|
|
50
|
+
lastClientId: hasMultiSelection() ? getLastMultiSelectedBlockClientId() : null,
|
|
51
|
+
rootClientId: getBlockRootClientId(clientId)
|
|
52
|
+
};
|
|
53
|
+
}, [clientId]);
|
|
54
|
+
return selectedBlockProps;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=use-selected-block-tool-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_store","useSelectedBlockToolProps","clientId","selectedBlockProps","useSelect","select","getBlockRootClientId","getBlockParents","__experimentalGetBlockListSettingsForBlocks","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","hasMultiSelection","getLastMultiSelectedBlockClientId","blockEditorStore","blockParentsClientIds","parentBlockListSettings","capturingClientId","find","parentClientId","__experimentalCaptureToolbars","isInsertionPointVisible","insertionPoint","order","rootClientId","index","lastClientId"],"sources":["@wordpress/block-editor/src/components/block-tools/use-selected-block-tool-props.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns props for the selected block tools and empty block inserter.\n *\n * @param {string} clientId Selected block client ID.\n */\nexport default function useSelectedBlockToolProps( clientId ) {\n\tconst selectedBlockProps = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockParents,\n\t\t\t\t__experimentalGetBlockListSettingsForBlocks,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t\thasMultiSelection,\n\t\t\t\tgetLastMultiSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t\t\t// Get Block List Settings for all ancestors of the current Block clientId.\n\t\t\tconst parentBlockListSettings =\n\t\t\t\t__experimentalGetBlockListSettingsForBlocks(\n\t\t\t\t\tblockParentsClientIds\n\t\t\t\t);\n\n\t\t\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\t\t\tconst capturingClientId = blockParentsClientIds.find(\n\t\t\t\t( parentClientId ) =>\n\t\t\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t\t\t?.__experimentalCaptureToolbars\n\t\t\t);\n\n\t\t\tlet isInsertionPointVisible = false;\n\t\t\tif ( isBlockInsertionPointVisible() ) {\n\t\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\t\tisInsertionPointVisible =\n\t\t\t\t\torder[ insertionPoint.index ] === clientId;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcapturingClientId,\n\t\t\t\tisInsertionPointVisible,\n\t\t\t\tlastClientId: hasMultiSelection()\n\t\t\t\t\t? getLastMultiSelectedBlockClientId()\n\t\t\t\t\t: null,\n\t\t\t\trootClientId: getBlockRootClientId( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\treturn selectedBlockProps;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACe,SAASE,yBAAyBA,CAAEC,QAAQ,EAAG;EAC7D,MAAMC,kBAAkB,GAAG,IAAAC,eAAS,EACjCC,MAAM,IAAM;IACb,MAAM;MACLC,oBAAoB;MACpBC,eAAe;MACfC,2CAA2C;MAC3CC,4BAA4B;MAC5BC,sBAAsB;MACtBC,aAAa;MACbC,iBAAiB;MACjBC;IACD,CAAC,GAAGR,MAAM,CAAES,YAAiB,CAAC;IAE9B,MAAMC,qBAAqB,GAAGR,eAAe,CAAEL,QAAS,CAAC;;IAEzD;IACA,MAAMc,uBAAuB,GAC5BR,2CAA2C,CAC1CO,qBACD,CAAC;;IAEF;IACA,MAAME,iBAAiB,GAAGF,qBAAqB,CAACG,IAAI,CACjDC,cAAc,IACfH,uBAAuB,CAAEG,cAAc,CAAE,EACtCC,6BACL,CAAC;IAED,IAAIC,uBAAuB,GAAG,KAAK;IACnC,IAAKZ,4BAA4B,CAAC,CAAC,EAAG;MACrC,MAAMa,cAAc,GAAGZ,sBAAsB,CAAC,CAAC;MAC/C,MAAMa,KAAK,GAAGZ,aAAa,CAAEW,cAAc,CAACE,YAAa,CAAC;MAC1DH,uBAAuB,GACtBE,KAAK,CAAED,cAAc,CAACG,KAAK,CAAE,KAAKvB,QAAQ;IAC5C;IAEA,OAAO;MACNe,iBAAiB;MACjBI,uBAAuB;MACvBK,YAAY,EAAEd,iBAAiB,CAAC,CAAC,GAC9BC,iCAAiC,CAAC,CAAC,GACnC,IAAI;MACPW,YAAY,EAAElB,oBAAoB,CAAEJ,QAAS;IAC9C,CAAC;EACF,CAAC,EACD,CAAEA,QAAQ,CACX,CAAC;EAED,OAAOC,kBAAkB;AAC1B"}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _blocks = require("@wordpress/blocks");
|
|
10
|
+
var _compose = require("@wordpress/compose");
|
|
10
11
|
var _inserterListItem = _interopRequireDefault(require("../inserter-list-item"));
|
|
11
12
|
var _inserterListbox = require("../inserter-listbox");
|
|
12
13
|
/**
|
|
@@ -32,8 +33,10 @@ function BlockTypesList({
|
|
|
32
33
|
label,
|
|
33
34
|
isDraggable = true
|
|
34
35
|
}) {
|
|
36
|
+
const className = 'block-editor-block-types-list';
|
|
37
|
+
const listId = (0, _compose.useInstanceId)(BlockTypesList, className);
|
|
35
38
|
return (0, _react.createElement)(_inserterListbox.InserterListboxGroup, {
|
|
36
|
-
className:
|
|
39
|
+
className: className,
|
|
37
40
|
"aria-label": label
|
|
38
41
|
}, chunk(items, 3).map((row, i) => (0, _react.createElement)(_inserterListbox.InserterListboxRow, {
|
|
39
42
|
key: i
|
|
@@ -44,7 +47,8 @@ function BlockTypesList({
|
|
|
44
47
|
onSelect: onSelect,
|
|
45
48
|
onHover: onHover,
|
|
46
49
|
isDraggable: isDraggable && !item.isDisabled,
|
|
47
|
-
isFirst: i === 0 && j === 0
|
|
50
|
+
isFirst: i === 0 && j === 0,
|
|
51
|
+
rowId: `${listId}-${i}`
|
|
48
52
|
})))), children);
|
|
49
53
|
}
|
|
50
54
|
var _default = BlockTypesList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_inserterListItem","_interopRequireDefault","_inserterListbox","chunk","array","size","chunks","i","j","length","push","slice","BlockTypesList","items","onSelect","onHover","children","label","isDraggable","_react","createElement","InserterListboxGroup","
|
|
1
|
+
{"version":3,"names":["_blocks","require","_compose","_inserterListItem","_interopRequireDefault","_inserterListbox","chunk","array","size","chunks","i","j","length","push","slice","BlockTypesList","items","onSelect","onHover","children","label","isDraggable","className","listId","useInstanceId","_react","createElement","InserterListboxGroup","map","row","InserterListboxRow","key","item","default","id","getBlockMenuDefaultClassName","isDisabled","isFirst","rowId","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-types-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockMenuDefaultClassName } from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport InserterListItem from '../inserter-list-item';\nimport { InserterListboxGroup, InserterListboxRow } from '../inserter-listbox';\n\nfunction chunk( array, size ) {\n\tconst chunks = [];\n\tfor ( let i = 0, j = array.length; i < j; i += size ) {\n\t\tchunks.push( array.slice( i, i + size ) );\n\t}\n\treturn chunks;\n}\n\nfunction BlockTypesList( {\n\titems = [],\n\tonSelect,\n\tonHover = () => {},\n\tchildren,\n\tlabel,\n\tisDraggable = true,\n} ) {\n\tconst className = 'block-editor-block-types-list';\n\tconst listId = useInstanceId( BlockTypesList, className );\n\treturn (\n\t\t<InserterListboxGroup className={ className } aria-label={ label }>\n\t\t\t{ chunk( items, 3 ).map( ( row, i ) => (\n\t\t\t\t<InserterListboxRow key={ i }>\n\t\t\t\t\t{ row.map( ( item, j ) => (\n\t\t\t\t\t\t<InserterListItem\n\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tclassName={ getBlockMenuDefaultClassName(\n\t\t\t\t\t\t\t\titem.id\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\tisDraggable={ isDraggable && ! item.isDisabled }\n\t\t\t\t\t\t\tisFirst={ i === 0 && j === 0 }\n\t\t\t\t\t\t\trowId={ `${ listId }-${ i }` }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</InserterListboxRow>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</InserterListboxGroup>\n\t);\n}\n\nexport default BlockTypesList;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,SAASK,KAAKA,CAAEC,KAAK,EAAEC,IAAI,EAAG;EAC7B,MAAMC,MAAM,GAAG,EAAE;EACjB,KAAM,IAAIC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAGJ,KAAK,CAACK,MAAM,EAAEF,CAAC,GAAGC,CAAC,EAAED,CAAC,IAAIF,IAAI,EAAG;IACrDC,MAAM,CAACI,IAAI,CAAEN,KAAK,CAACO,KAAK,CAAEJ,CAAC,EAAEA,CAAC,GAAGF,IAAK,CAAE,CAAC;EAC1C;EACA,OAAOC,MAAM;AACd;AAEA,SAASM,cAAcA,CAAE;EACxBC,KAAK,GAAG,EAAE;EACVC,QAAQ;EACRC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClBC,QAAQ;EACRC,KAAK;EACLC,WAAW,GAAG;AACf,CAAC,EAAG;EACH,MAAMC,SAAS,GAAG,+BAA+B;EACjD,MAAMC,MAAM,GAAG,IAAAC,sBAAa,EAAET,cAAc,EAAEO,SAAU,CAAC;EACzD,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACrB,gBAAA,CAAAsB,oBAAoB;IAACL,SAAS,EAAGA,SAAW;IAAC,cAAaF;EAAO,GAC/Dd,KAAK,CAAEU,KAAK,EAAE,CAAE,CAAC,CAACY,GAAG,CAAE,CAAEC,GAAG,EAAEnB,CAAC,KAChC,IAAAe,MAAA,CAAAC,aAAA,EAACrB,gBAAA,CAAAyB,kBAAkB;IAACC,GAAG,EAAGrB;EAAG,GAC1BmB,GAAG,CAACD,GAAG,CAAE,CAAEI,IAAI,EAAErB,CAAC,KACnB,IAAAc,MAAA,CAAAC,aAAA,EAACvB,iBAAA,CAAA8B,OAAgB;IAChBF,GAAG,EAAGC,IAAI,CAACE,EAAI;IACfF,IAAI,EAAGA,IAAM;IACbV,SAAS,EAAG,IAAAa,oCAA4B,EACvCH,IAAI,CAACE,EACN,CAAG;IACHjB,QAAQ,EAAGA,QAAU;IACrBC,OAAO,EAAGA,OAAS;IACnBG,WAAW,EAAGA,WAAW,IAAI,CAAEW,IAAI,CAACI,UAAY;IAChDC,OAAO,EAAG3B,CAAC,KAAK,CAAC,IAAIC,CAAC,KAAK,CAAG;IAC9B2B,KAAK,EAAI,GAAGf,MAAQ,IAAIb,CAAG;EAAG,CAC9B,CACA,CACiB,CACnB,CAAC,EACDS,QACmB,CAAC;AAEzB;AAAC,IAAAoB,QAAA,GAEcxB,cAAc;AAAAyB,OAAA,CAAAP,OAAA,GAAAM,QAAA"}
|
|
@@ -73,7 +73,14 @@ function NonDefaultControls({
|
|
|
73
73
|
// 2022) in German (de). The resultant array is de-duplicated as some
|
|
74
74
|
// languages will use the same format string for short, medium, and long
|
|
75
75
|
// formats.
|
|
76
|
-
const suggestedFormats = [...new Set([
|
|
76
|
+
const suggestedFormats = [...new Set([/* translators: See https://www.php.net/manual/datetime.format.php */
|
|
77
|
+
'Y-m-d', /* translators: See https://www.php.net/manual/datetime.format.php */
|
|
78
|
+
(0, _i18n._x)('n/j/Y', 'short date format'), /* translators: See https://www.php.net/manual/datetime.format.php */
|
|
79
|
+
(0, _i18n._x)('n/j/Y g:i A', 'short date format with time'), /* translators: See https://www.php.net/manual/datetime.format.php */
|
|
80
|
+
(0, _i18n._x)('M j, Y', 'medium date format'), /* translators: See https://www.php.net/manual/datetime.format.php */
|
|
81
|
+
(0, _i18n._x)('M j, Y g:i A', 'medium date format with time'), /* translators: See https://www.php.net/manual/datetime.format.php */
|
|
82
|
+
(0, _i18n._x)('F j, Y', 'long date format'), /* translators: See https://www.php.net/manual/datetime.format.php */
|
|
83
|
+
(0, _i18n._x)('M j', 'short date format without the year')])];
|
|
77
84
|
const suggestedOptions = suggestedFormats.map((suggestedFormat, index) => ({
|
|
78
85
|
key: `suggested-${index}`,
|
|
79
86
|
name: (0, _date.dateI18n)(suggestedFormat, EXAMPLE_DATE),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_date","_element","_components","EXAMPLE_DATE","Date","DateFormatPicker","format","defaultFormat","onChange","_react","createElement","className","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","customOption","__experimentalHint","isCustom","setIsCustom","useState","includes","__experimentalVStack","CustomSelectControl","__nextUnconstrainedWidth","options","value","find","option","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tCustomSelectControl,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n// So that we can illustrate the different formats in the dropdown properly,\n// show a date that has a day greater than 12 and a month with more than three\n// letters. Here we're using 2022-01-25 which is when WordPress 5.9 was\n// released.\nconst EXAMPLE_DATE = new Date( 2022, 0, 25 );\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\tEXAMPLE_DATE\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t'Y-m-d',\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = suggestedFormats.map(\n\t\t( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, EXAMPLE_DATE ),\n\t\t\tformat: suggestedFormat,\n\t\t} )\n\t);\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\t__experimentalHint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() => !! format && ! suggestedFormats.includes( format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\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\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA,MAAMI,YAAY,GAAG,IAAIC,IAAI,CAAE,IAAI,EAAE,CAAC,EAAE,EAAG,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,gBAAgBA,CAAE;EACzCC,MAAM;EACNC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAUC,SAAS,EAAC;EAAiC,GACpD,IAAAF,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAU,cAAc;IAACC,EAAE,EAAC;EAAQ,GAAG,IAAAC,QAAE,EAAE,aAAc,CAAmB,CAAC,EACpE,IAAAL,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAa,aAAa;IACbC,uBAAuB;IACvBC,KAAK,EAAG,IAAAH,QAAE,EAAE,gBAAiB,CAAG;IAChCI,IAAI,EAAI,GAAG,IAAAJ,QAAE,EAAE,UAAW,CAAG,KAAK,IAAAK,cAAQ,EACzCZ,aAAa,EACbJ,YACD,CAAG,EAAG;IACNiB,OAAO,EAAG,CAAEd,MAAQ;IACpB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KAAK,IAAMlC,QAAQ,CAAEkC,KAAM;EAAG,CAC3C,CAEK,CAAC;AAEX"}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_date","_element","_components","EXAMPLE_DATE","Date","DateFormatPicker","format","defaultFormat","onChange","_react","createElement","className","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","customOption","__experimentalHint","isCustom","setIsCustom","useState","includes","__experimentalVStack","CustomSelectControl","__nextUnconstrainedWidth","options","value","find","option","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tCustomSelectControl,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n// So that we can illustrate the different formats in the dropdown properly,\n// show a date that has a day greater than 12 and a month with more than three\n// letters. Here we're using 2022-01-25 which is when WordPress 5.9 was\n// released.\nconst EXAMPLE_DATE = new Date( 2022, 0, 25 );\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\tEXAMPLE_DATE\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = suggestedFormats.map(\n\t\t( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, EXAMPLE_DATE ),\n\t\t\tformat: suggestedFormat,\n\t\t} )\n\t);\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\t__experimentalHint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() => !! format && ! suggestedFormats.includes( format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\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\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA,MAAMI,YAAY,GAAG,IAAIC,IAAI,CAAE,IAAI,EAAE,CAAC,EAAE,EAAG,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,gBAAgBA,CAAE;EACzCC,MAAM;EACNC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAUC,SAAS,EAAC;EAAiC,GACpD,IAAAF,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAU,cAAc;IAACC,EAAE,EAAC;EAAQ,GAAG,IAAAC,QAAE,EAAE,aAAc,CAAmB,CAAC,EACpE,IAAAL,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAa,aAAa;IACbC,uBAAuB;IACvBC,KAAK,EAAG,IAAAH,QAAE,EAAE,gBAAiB,CAAG;IAChCI,IAAI,EAAI,GAAG,IAAAJ,QAAE,EAAE,UAAW,CAAG,KAAK,IAAAK,cAAQ,EACzCZ,aAAa,EACbJ,YACD,CAAG,EAAG;IACNiB,OAAO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D,CAAG;IACH4B,KAAK,EAAGpC,MAAQ;IAChBE,QAAQ,EAAKkC,KAAK,IAAMlC,QAAQ,CAAEkC,KAAM;EAAG,CAC3C,CAEK,CAAC;AAEX"}
|
|
@@ -20,8 +20,7 @@ const EditableText = (0, _element.forwardRef)((props, ref) => {
|
|
|
20
20
|
return (0, _react.createElement)(_richText.default, {
|
|
21
21
|
ref: ref,
|
|
22
22
|
...props,
|
|
23
|
-
__unstableDisableFormats: true
|
|
24
|
-
preserveWhiteSpace: true
|
|
23
|
+
__unstableDisableFormats: true
|
|
25
24
|
});
|
|
26
25
|
});
|
|
27
26
|
EditableText.Content = ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_richText","_interopRequireDefault","EditableText","forwardRef","props","ref","_react","createElement","default","__unstableDisableFormats","
|
|
1
|
+
{"version":3,"names":["_element","require","_richText","_interopRequireDefault","EditableText","forwardRef","props","ref","_react","createElement","default","__unstableDisableFormats","Content","value","tagName","Tag","_default","exports"],"sources":["@wordpress/block-editor/src/components/editable-text/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport RichText from '../rich-text';\n\nconst EditableText = forwardRef( ( props, ref ) => {\n\treturn <RichText ref={ ref } { ...props } __unstableDisableFormats />;\n} );\n\nEditableText.Content = ( { value = '', tagName: Tag = 'div', ...props } ) => {\n\treturn <Tag { ...props }>{ value }</Tag>;\n};\n\n/**\n * Renders an editable text input in which text formatting is not allowed.\n */\nexport default EditableText;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMG,YAAY,GAAG,IAAAC,mBAAU,EAAE,CAAEC,KAAK,EAAEC,GAAG,KAAM;EAClD,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACP,SAAA,CAAAQ,OAAQ;IAACH,GAAG,EAAGA,GAAK;IAAA,GAAMD,KAAK;IAAGK,wBAAwB;EAAA,CAAE,CAAC;AACtE,CAAE,CAAC;AAEHP,YAAY,CAACQ,OAAO,GAAG,CAAE;EAAEC,KAAK,GAAG,EAAE;EAAEC,OAAO,EAAEC,GAAG,GAAG,KAAK;EAAE,GAAGT;AAAM,CAAC,KAAM;EAC5E,OAAO,IAAAE,MAAA,CAAAC,aAAA,EAACM,GAAG;IAAA,GAAMT;EAAK,GAAKO,KAAY,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AAFA,IAAAG,QAAA,GAGeZ,YAAY;AAAAa,OAAA,CAAAP,OAAA,GAAAM,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_i18n","_icons","_transformStyles","_interopRequireDefault","AdvancedPanel","value","onChange","inheritedValue","cssError","setCSSError","useState","customCSS","css","handleOnChange","newValue","transformed","transformStyles","handleOnBlur","event","target","__","_react","createElement","__experimentalVStack","spacing","TextareaControl","label","__nextHasNoMarginBottom","onBlur","className","spellCheck","Tooltip","text","Icon","icon","info"],"sources":["@wordpress/block-editor/src/components/global-styles/advanced-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tTextareaControl,\n\tTooltip,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, info } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { default as transformStyles } from '../../utils/transform-styles';\n\nexport default function AdvancedPanel( {\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n} ) {\n\t// Custom CSS\n\tconst [ cssError, setCSSError ] = useState( null );\n\tconst customCSS = inheritedValue?.css;\n\tfunction handleOnChange( newValue ) {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\tcss: newValue,\n\t\t} );\n\t\tif ( cssError ) {\n\t\t\tconst [ transformed ] = transformStyles(\n\t\t\t\t[ { css:
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_i18n","_icons","_transformStyles","_interopRequireDefault","AdvancedPanel","value","onChange","inheritedValue","cssError","setCSSError","useState","customCSS","css","handleOnChange","newValue","transformed","transformStyles","handleOnBlur","event","target","__","_react","createElement","__experimentalVStack","spacing","TextareaControl","label","__nextHasNoMarginBottom","onBlur","className","spellCheck","Tooltip","text","Icon","icon","info"],"sources":["@wordpress/block-editor/src/components/global-styles/advanced-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tTextareaControl,\n\tTooltip,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, info } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { default as transformStyles } from '../../utils/transform-styles';\n\nexport default function AdvancedPanel( {\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n} ) {\n\t// Custom CSS\n\tconst [ cssError, setCSSError ] = useState( null );\n\tconst customCSS = inheritedValue?.css;\n\tfunction handleOnChange( newValue ) {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\tcss: newValue,\n\t\t} );\n\t\tif ( cssError ) {\n\t\t\tconst [ transformed ] = transformStyles(\n\t\t\t\t[ { css: newValue } ],\n\t\t\t\t'.editor-styles-wrapper'\n\t\t\t);\n\t\t\tif ( transformed ) {\n\t\t\t\tsetCSSError( null );\n\t\t\t}\n\t\t}\n\t}\n\tfunction handleOnBlur( event ) {\n\t\tif ( ! event?.target?.value ) {\n\t\t\tsetCSSError( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ transformed ] = transformStyles(\n\t\t\t[ { css: event.target.value } ],\n\t\t\t'.editor-styles-wrapper'\n\t\t);\n\n\t\tsetCSSError(\n\t\t\ttransformed === null\n\t\t\t\t? __( 'There is an error with your CSS structure.' )\n\t\t\t\t: null\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<TextareaControl\n\t\t\t\tlabel={ __( 'Additional CSS' ) }\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ customCSS }\n\t\t\t\tonChange={ ( newValue ) => handleOnChange( newValue ) }\n\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\tclassName=\"block-editor-global-styles-advanced-panel__custom-css-input\"\n\t\t\t\tspellCheck={ false }\n\t\t\t/>\n\t\t\t{ cssError && (\n\t\t\t\t<Tooltip text={ cssError }>\n\t\t\t\t\t<div className=\"block-editor-global-styles-advanced-panel__custom-css-validation-wrapper\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ info }\n\t\t\t\t\t\t\tclassName=\"block-editor-global-styles-advanced-panel__custom-css-validation-icon\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Tooltip>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,gBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAfA;AACA;AACA;;AAUA;AACA;AACA;;AAGe,SAASM,aAAaA,CAAE;EACtCC,KAAK;EACLC,QAAQ;EACRC,cAAc,GAAGF;AAClB,CAAC,EAAG;EACH;EACA,MAAM,CAAEG,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAC,iBAAQ,EAAE,IAAK,CAAC;EAClD,MAAMC,SAAS,GAAGJ,cAAc,EAAEK,GAAG;EACrC,SAASC,cAAcA,CAAEC,QAAQ,EAAG;IACnCR,QAAQ,CAAE;MACT,GAAGD,KAAK;MACRO,GAAG,EAAEE;IACN,CAAE,CAAC;IACH,IAAKN,QAAQ,EAAG;MACf,MAAM,CAAEO,WAAW,CAAE,GAAG,IAAAC,wBAAe,EACtC,CAAE;QAAEJ,G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@@ function bubbleEvent(event, Constructor, frame) {
|
|
|
67
67
|
* @param {Document} iframeDocument Document to attach listeners to.
|
|
68
68
|
*/
|
|
69
69
|
function useBubbleEvents(iframeDocument) {
|
|
70
|
-
return (0, _compose.useRefEffect)(
|
|
70
|
+
return (0, _compose.useRefEffect)(() => {
|
|
71
71
|
const {
|
|
72
72
|
defaultView
|
|
73
73
|
} = iframeDocument;
|
|
@@ -77,6 +77,7 @@ function useBubbleEvents(iframeDocument) {
|
|
|
77
77
|
const {
|
|
78
78
|
frameElement
|
|
79
79
|
} = defaultView;
|
|
80
|
+
const html = iframeDocument.documentElement;
|
|
80
81
|
const eventTypes = ['dragover', 'mousemove'];
|
|
81
82
|
const handlers = {};
|
|
82
83
|
for (const name of eventTypes) {
|
|
@@ -86,11 +87,11 @@ function useBubbleEvents(iframeDocument) {
|
|
|
86
87
|
const Constructor = window[constructorName];
|
|
87
88
|
bubbleEvent(event, Constructor, frameElement);
|
|
88
89
|
};
|
|
89
|
-
|
|
90
|
+
html.addEventListener(name, handlers[name]);
|
|
90
91
|
}
|
|
91
92
|
return () => {
|
|
92
93
|
for (const name of eventTypes) {
|
|
93
|
-
|
|
94
|
+
html.removeEventListener(name, handlers[name]);
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
97
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_useCompatibilityStyles","_store","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","useRefEffect","body","frameElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","useSelect","select","settings","blockEditorStore","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","useState","bodyClasses","setBodyClasses","compatStyles","useCompatibilityStyles","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","contentResizeListener","height","contentHeight","useResizeObserver","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","documentElement","Array","from","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","html","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","useEffect","marginFromScaling","_react","createElement","Fragment","style","border","marginTop","marginBottom","transform","transition","title","__","onKeyDown","currentTarget","target","stopPropagation","KeyboardEvent","createPortal","className","classnames","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( ( body ) => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\tbody.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\tbody.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of compatStyles ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborder: 0,\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\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\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAMA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,uBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;;AAMA,SAASU,WAAWA,CAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAG;EACjD,MAAMC,IAAI,GAAG,CAAC,CAAC;EAEf,KAAM,MAAMC,GAAG,IAAIJ,KAAK,EAAG;IAC1BG,IAAI,CAAEC,GAAG,CAAE,GAAGJ,KAAK,CAAEI,GAAG,CAAE;EAC3B;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAKJ,KAAK,YAAYE,KAAK,CAACG,eAAe,CAACC,WAAW,CAACC,UAAU,EAAG;IACpE,MAAMC,IAAI,GAAGN,KAAK,CAACO,qBAAqB,CAAC,CAAC;IAC1CN,IAAI,CAACO,OAAO,IAAIF,IAAI,CAACG,IAAI;IACzBR,IAAI,CAACS,OAAO,IAAIJ,IAAI,CAACK,GAAG;EACzB;EAEA,MAAMC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A;IACCpE,GAAG,EAAGsD,OAAS;IACf8B,SAAS,EAAG,IAAAC,mBAAU,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,GAAGtE,WACJ;EAAG,GAEDU,qBAAqB,EACvB,IAAA0C,MAAA,CAAAC,aAAA,EAACxH,WAAA,CAAA0I,2BAAa;IAACC,QAAQ,EAAG/G;EAAgB,GACvCiB,QACY,CACV,CAAC,EACPjB,cAAc,CAAC4D,eAChB,CACM,CAAC,EACP1C,QAAQ,IAAI,CAAC,IAAI6B,KAClB,CAAC;AAEL;AAEA,SAASiE,aAAaA,CAAEvF,KAAK,EAAED,GAAG,EAAG;EACpC,MAAMyF,aAAa,GAAG,IAAArF,eAAS,EAC5BC,MAAM,IACPA,MAAM,CAAEE,YAAiB,CAAC,CAACC,WAAW,CAAC,CAAC,CAACkF,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAtB,MAAA,CAAAC,aAAA,EAAC7E,MAAM;IAAA,GAAMU,KAAK;IAAGF,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAAC,IAAA2F,QAAA,GAEc,IAAAC,mBAAU,EAAEJ,aAAc,CAAC;AAAAK,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_useCompatibilityStyles","_store","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","useRefEffect","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","useSelect","select","settings","blockEditorStore","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","useState","bodyClasses","setBodyClasses","compatStyles","useCompatibilityStyles","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","contentResizeListener","height","contentHeight","useResizeObserver","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","Array","from","body","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","useEffect","marginFromScaling","_react","createElement","Fragment","style","border","marginTop","marginBottom","transform","transition","title","__","onKeyDown","currentTarget","target","stopPropagation","KeyboardEvent","createPortal","className","classnames","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of compatStyles ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborder: 0,\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\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\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAMA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,uBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;;AAMA,SAASU,WAAWA,CAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAG;EACjD,MAAMC,IAAI,GAAG,CAAC,CAAC;EAEf,KAAM,MAAMC,GAAG,IAAIJ,KAAK,EAAG;IAC1BG,IAAI,CAAEC,GAAG,CAAE,GAAGJ,KAAK,CAAEI,GAAG,CAAE;EAC3B;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAKJ,KAAK,YAAYE,KAAK,CAACG,eAAe,CAACC,WAAW,CAACC,UAAU,EAAG;IACpE,MAAMC,IAAI,GAAGN,KAAK,CAACO,qBAAqB,CAAC,CAAC;IAC1CN,IAAI,CAACO,OAAO,IAAIF,IAAI,CAACG,IAAI;IACzBR,IAAI,CAACS,OAAO,IAAI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