@wordpress/block-editor 9.1.0 → 9.4.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 +10 -0
- package/build/autocompleters/block.js +3 -1
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +3 -7
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-context/index.js.map +1 -1
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.native.js +2 -1
- package/build/components/block-draggable/draggable-chip.native.js.map +1 -1
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +7 -3
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -1
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +34 -32
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +2 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +3 -9
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +3 -8
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-popover/inbetween.js +9 -6
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +2 -1
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +21 -5
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-selection-clearer/index.js.map +1 -1
- package/build/components/block-settings-menu/block-edit-visually-button.js +70 -0
- package/build/components/block-settings-menu/block-edit-visually-button.js.map +1 -0
- package/build/components/block-settings-menu/block-mode-toggle.js +3 -7
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +6 -3
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js +6 -2
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +6 -3
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/menu-items.js +3 -7
- package/build/components/block-styles/menu-items.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +3 -10
- package/build/components/block-title/use-block-display-title.js.map +1 -1
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-toolbar/utils.js +5 -8
- package/build/components/block-toolbar/utils.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -0
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +16 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +72 -95
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +35 -60
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +22 -5
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/copy-handler/index.js +17 -1
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-block-appender/index.native.js.map +1 -1
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/duotone/components.js +145 -0
- package/build/components/duotone/components.js.map +1 -0
- package/build/components/duotone/index.js +40 -0
- package/build/components/duotone/index.js.map +1 -0
- package/build/components/duotone/utils.js +38 -0
- package/build/components/duotone/utils.js.map +1 -0
- package/build/components/duotone-control/index.js +17 -5
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-size-control/index.js +3 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +41 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +3 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +3 -7
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/no-results.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +1 -1
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inspector-popover-header/index.js +56 -0
- package/build/components/inspector-popover-header/index.js.map +1 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +4 -4
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-create-button.js +1 -3
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +5 -3
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +3 -7
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/list-view/utils.js +1 -7
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.js +5 -6
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +4 -4
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +23 -14
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +10 -4
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +62 -7
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +4 -0
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +5 -3
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +56 -0
- package/build/components/publish-date-time-picker/index.js.map +1 -0
- package/build/components/rich-text/embed-handler-picker.native.js +4 -8
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +5 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +4 -13
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +20 -5
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/ungroup-button/index.native.js +3 -7
- package/build/components/ungroup-button/index.native.js.map +1 -1
- package/build/components/url-input/index.js +14 -3
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-display-block-controls/index.native.js.map +1 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.native.js.map +1 -1
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +12 -12
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-input.js +15 -0
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/elements/index.js +17 -0
- package/build/elements/index.js.map +1 -0
- package/build/hooks/aria-label.js +71 -0
- package/build/hooks/aria-label.js.map +1 -0
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color-panel.native.js.map +1 -1
- package/build/hooks/color.js +8 -88
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +14 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +33 -160
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +3 -7
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +44 -5
- package/build/hooks/layout.js.map +1 -1
- package/build/index.js +14 -7
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +7 -4
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +24 -14
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +35 -11
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +30 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js.map +1 -1
- package/build/utils/selection.js +34 -0
- package/build/utils/selection.js.map +1 -0
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/autocompleters/block.js +4 -1
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +2 -5
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-context/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +2 -1
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -1
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +7 -3
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -1
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +35 -33
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +2 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +3 -9
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +3 -8
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +9 -6
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +2 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +20 -5
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-selection-clearer/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-edit-visually-button.js +56 -0
- package/build-module/components/block-settings-menu/block-edit-visually-button.js.map +1 -0
- package/build-module/components/block-settings-menu/block-mode-toggle.js +3 -5
- package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +6 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +6 -3
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +5 -2
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +5 -2
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +3 -5
- package/build-module/components/block-styles/menu-items.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +3 -9
- package/build-module/components/block-title/use-block-display-title.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/utils.js +3 -5
- package/build-module/components/block-toolbar/utils.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -0
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +13 -2
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +74 -97
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +36 -64
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +23 -6
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/copy-handler/index.js +18 -2
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.native.js.map +1 -1
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/duotone/components.js +130 -0
- package/build-module/components/duotone/components.js.map +1 -0
- package/build-module/components/duotone/index.js +3 -0
- package/build-module/components/duotone/index.js.map +1 -0
- package/build-module/components/duotone/utils.js +30 -0
- package/build-module/components/duotone/utils.js.map +1 -0
- package/build-module/components/duotone-control/index.js +18 -6
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-size-control/index.js +4 -1
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +4 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -5
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/no-results.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +2 -2
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +46 -0
- package/build-module/components/inspector-popover-header/index.js.map +1 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +2 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +1 -2
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +3 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +2 -5
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/list-view/utils.js +1 -6
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +3 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +5 -3
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +24 -14
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +8 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +63 -8
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +4 -0
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +4 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +42 -0
- package/build-module/components/publish-date-time-picker/index.js.map +1 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js +3 -5
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +5 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +3 -11
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +20 -5
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/ungroup-button/index.native.js +3 -5
- package/build-module/components/ungroup-button/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +11 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-display-block-controls/index.native.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.native.js.map +1 -1
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +12 -11
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +15 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/elements/index.js +8 -0
- package/build-module/elements/index.js.map +1 -0
- package/build-module/hooks/aria-label.js +59 -0
- package/build-module/hooks/aria-label.js.map +1 -0
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color-panel.native.js.map +1 -1
- package/build-module/hooks/color.js +8 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +14 -4
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +22 -140
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +45 -6
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +6 -4
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +18 -11
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +36 -12
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +25 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-module/utils/selection.js +24 -0
- package/build-module/utils/selection.js.map +1 -0
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/style-rtl.css +37 -37
- package/build-style/style.css +37 -37
- package/package.json +30 -30
- package/src/autocompleters/block.js +2 -1
- package/src/components/block-actions/index.js +2 -3
- package/src/components/block-alignment-control/ui.js +4 -6
- package/src/components/block-alignment-matrix-control/index.js +2 -4
- package/src/components/block-breadcrumb/index.js +2 -5
- package/src/components/block-compare/test/block-view.js +2 -1
- package/src/components/block-content-overlay/index.js +2 -5
- package/src/components/block-context/index.js +4 -4
- package/src/components/block-controls/hook.js +2 -3
- package/src/components/block-draggable/draggable-chip.native.js +1 -1
- package/src/components/block-draggable/index.js +6 -13
- package/src/components/block-draggable/index.native.js +10 -14
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +73 -0
- package/src/components/block-draggable/test/helpers.native.js +183 -0
- package/src/components/block-draggable/test/index.native.js +493 -0
- package/src/components/block-edit/test/edit.js +2 -1
- package/src/components/block-list/block-list-item.native.js +4 -12
- package/src/components/block-list/block-selection-button.native.js +2 -3
- package/src/components/block-list/block.js +8 -10
- package/src/components/block-list/block.native.js +11 -15
- package/src/components/block-list/index.js +46 -47
- package/src/components/block-list/index.native.js +12 -21
- package/src/components/block-list/style.scss +1 -1
- package/src/components/block-list/test/block-list-context.native.js +8 -16
- package/src/components/block-list/use-block-props/index.js +6 -3
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +2 -3
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +2 -3
- package/src/components/block-list/use-in-between-inserter.js +2 -3
- package/src/components/block-list-appender/index.js +2 -5
- package/src/components/block-list-appender/index.native.js +2 -3
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
- package/src/components/block-mobile-toolbar/index.native.js +1 -0
- package/src/components/block-mover/button.js +2 -3
- package/src/components/block-mover/index.native.js +4 -6
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +4 -0
- package/src/components/block-parent-selector/index.js +2 -3
- package/src/components/block-pattern-setup/index.js +4 -14
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -9
- package/src/components/block-popover/inbetween.js +12 -7
- package/src/components/block-popover/index.js +1 -0
- package/src/components/block-preview/auto.js +21 -11
- package/src/components/block-selection-clearer/index.js +2 -3
- package/src/components/block-settings-menu/block-edit-visually-button.js +52 -0
- package/src/components/block-settings-menu/block-mode-toggle.js +4 -8
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -8
- package/src/components/block-settings-menu/index.js +15 -11
- package/src/components/block-settings-menu-controls/index.js +3 -2
- package/src/components/block-styles/index.js +3 -1
- package/src/components/block-styles/menu-items.js +2 -5
- package/src/components/block-switcher/block-transformations-menu.js +2 -4
- package/src/components/block-title/use-block-display-title.js +9 -7
- package/src/components/block-toolbar/index.native.js +2 -5
- package/src/components/block-toolbar/utils.js +3 -11
- package/src/components/block-tools/block-contextual-toolbar.js +2 -5
- package/src/components/block-tools/block-selection-button.js +1 -0
- package/src/components/block-tools/index.js +2 -3
- package/src/components/block-types-list/index.native.js +2 -4
- package/src/components/block-variation-transforms/index.js +10 -8
- package/src/components/color-palette/test/control.js +2 -1
- package/src/components/color-style-selector/index.js +27 -28
- package/src/components/colors/test/with-colors.js +14 -14
- package/src/components/colors/with-colors.js +8 -12
- package/src/components/colors-gradients/dropdown.js +49 -69
- package/src/components/colors-gradients/panel-color-gradient-settings.js +30 -76
- package/src/components/colors-gradients/style.scss +11 -37
- package/src/components/colors-gradients/test/control.js +10 -10
- package/src/components/convert-to-group-buttons/toolbar.js +32 -19
- package/src/components/copy-handler/README.md +7 -2
- package/src/components/copy-handler/index.js +26 -6
- package/src/components/default-block-appender/index.js +4 -6
- package/src/components/default-block-appender/index.native.js +4 -9
- package/src/components/default-style-picker/index.js +20 -21
- package/src/components/duotone/components.js +133 -0
- package/src/components/duotone/index.js +7 -0
- package/src/components/duotone/utils.js +25 -0
- package/src/components/duotone-control/index.js +12 -7
- package/src/components/duotone-control/style.scss +5 -0
- package/src/components/font-sizes/with-font-sizes.js +2 -3
- package/src/components/image-editor/aspect-ratio-dropdown.js +2 -6
- package/src/components/image-size-control/index.js +4 -7
- package/src/components/index.js +4 -0
- package/src/components/inner-blocks/use-inner-block-template-sync.js +2 -3
- package/src/components/inner-blocks/use-nested-settings-update.js +6 -9
- package/src/components/inserter/block-types-tab.native.js +2 -3
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -3
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/hooks/use-patterns-state.js +4 -5
- package/src/components/inserter/index.js +7 -11
- package/src/components/inserter/index.native.js +6 -11
- package/src/components/inserter/library.js +2 -5
- package/src/components/inserter/menu.js +14 -19
- package/src/components/inserter/menu.native.js +8 -6
- package/src/components/inserter/no-results.native.js +2 -1
- package/src/components/inserter/quick-inserter.js +2 -3
- package/src/components/inserter/search-items.js +6 -6
- package/src/components/inserter/search-results.native.js +4 -6
- package/src/components/inspector-popover-header/README.md +76 -0
- package/src/components/inspector-popover-header/index.js +56 -0
- package/src/components/inspector-popover-header/style.scss +16 -0
- package/src/components/line-height-control/index.js +1 -2
- package/src/components/link-control/index.js +4 -4
- package/src/components/link-control/search-create-button.js +4 -2
- package/src/components/link-control/search-input.js +3 -1
- package/src/components/link-control/settings-drawer.js +2 -5
- package/src/components/link-control/test/fixtures/index.js +5 -7
- package/src/components/link-control/test/index.js +79 -102
- package/src/components/link-control/use-search-handler.js +2 -2
- package/src/components/list-view/block-contents.js +2 -4
- package/src/components/list-view/branch.js +22 -23
- package/src/components/list-view/index.js +4 -8
- package/src/components/list-view/use-block-selection.js +5 -5
- package/src/components/list-view/use-list-view-drop-zone.js +2 -1
- package/src/components/list-view/utils.js +1 -6
- package/src/components/media-placeholder/index.js +3 -3
- package/src/components/media-placeholder/index.native.js +9 -5
- package/src/components/media-replace-flow/index.js +78 -55
- package/src/components/media-upload/README.md +8 -0
- package/src/components/media-upload/index.native.js +6 -2
- package/src/components/media-upload/test/index.native.js +31 -6
- package/src/components/navigable-toolbar/index.js +1 -2
- package/src/components/panel-color-settings/test/index.js +2 -1
- package/src/components/plain-text/index.native.js +60 -8
- package/src/components/preview-options/index.js +4 -0
- package/src/components/provider/use-block-sync.js +5 -2
- package/src/components/publish-date-time-picker/README.md +52 -0
- package/src/components/publish-date-time-picker/index.js +41 -0
- package/src/components/responsive-block-control/README.md +3 -1
- package/src/components/responsive-block-control/test/index.js +4 -4
- package/src/components/rich-text/embed-handler-picker.native.js +2 -5
- package/src/components/rich-text/index.js +9 -4
- package/src/components/rich-text/index.native.js +4 -0
- package/src/components/rich-text/use-format-types.js +16 -16
- package/src/components/rich-text/use-input-rules.js +6 -15
- package/src/components/rich-text/use-mark-persistent.js +2 -3
- package/src/components/rich-text/use-paste-handler.js +17 -5
- package/src/components/skip-to-selected-block/index.js +2 -3
- package/src/components/ungroup-button/index.native.js +4 -8
- package/src/components/url-input/index.js +21 -20
- package/src/components/use-block-display-information/index.js +4 -6
- package/src/components/use-block-drop-zone/index.js +2 -3
- package/src/components/use-block-drop-zone/index.native.js +2 -4
- package/src/components/use-block-drop-zone/test/index.js +22 -23
- package/src/components/use-display-block-controls/index.native.js +2 -3
- package/src/components/use-no-recursive-renders/test/use-no-recursive-renders.js +2 -3
- package/src/components/use-on-block-drop/index.js +2 -5
- package/src/components/use-on-block-drop/index.native.js +4 -8
- package/src/components/use-setting/index.js +8 -6
- package/src/components/writing-flow/test/index.js +22 -4
- package/src/components/writing-flow/use-arrow-nav.js +22 -10
- package/src/components/writing-flow/use-click-selection.js +2 -5
- package/src/components/writing-flow/use-drag-selection.js +6 -9
- package/src/components/writing-flow/use-input.js +12 -0
- package/src/components/writing-flow/use-multi-selection.js +2 -4
- package/src/components/writing-flow/use-select-all.js +2 -5
- package/src/components/writing-flow/use-selection-observer.js +4 -6
- package/src/components/writing-flow/use-tab-nav.js +2 -5
- package/src/elements/index.js +8 -0
- package/src/elements/test/index.js +18 -0
- package/src/hooks/aria-label.js +67 -0
- package/src/hooks/color-panel.js +4 -4
- package/src/hooks/color-panel.native.js +2 -2
- package/src/hooks/color.js +7 -76
- package/src/hooks/color.scss +9 -0
- package/src/hooks/dimensions.js +11 -3
- package/src/hooks/duotone.js +18 -139
- package/src/hooks/font-family.js +4 -2
- package/src/hooks/gap.js +2 -3
- package/src/hooks/index.js +1 -1
- package/src/hooks/layout.js +74 -13
- package/src/hooks/test/align.js +2 -1
- package/src/hooks/test/generated-class-name.js +2 -5
- package/src/hooks/test/utils.js +2 -5
- package/src/index.js +1 -1
- package/src/layouts/flex.js +13 -5
- package/src/store/actions.js +772 -729
- package/src/store/reducer.js +219 -183
- package/src/store/selectors.js +82 -54
- package/src/store/test/actions.js +2 -1
- package/src/store/test/reducer.js +145 -10
- package/src/store/test/selectors.js +20 -27
- package/src/style.scss +1 -0
- package/src/utils/pasting.js +3 -3
- package/src/utils/selection.js +26 -0
- package/src/utils/test/selection.js +39 -0
- package/src/utils/transform-styles/transforms/wrap.js +30 -28
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/colors/color-panel.js +0 -82
- package/build/components/colors/color-panel.js.map +0 -1
- package/build/components/colors/color-panel.native.js +0 -11
- package/build/components/colors/color-panel.native.js.map +0 -1
- package/build-module/components/colors/color-panel.js +0 -70
- package/build-module/components/colors/color-panel.js.map +0 -1
- package/build-module/components/colors/color-panel.native.js +0 -4
- package/build-module/components/colors/color-panel.native.js.map +0 -1
- package/src/components/colors/color-panel.js +0 -91
- package/src/components/colors/color-panel.native.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/navigable-toolbar/index.js"],"names":["hasOnlyToolbarItem","elements","dataProp","some","element","dataset","getAllToolbarItemsIn","container","Array","from","querySelectorAll","hasFocusWithin","contains","ownerDocument","activeElement","focusFirstTabbableIn","firstTabbable","focus","tabbable","find","preventScroll","useIsAccessibleToolbar","ref","initialAccessibleToolbarState","isAccessibleToolbar","setIsAccessibleToolbar","determineIsAccessibleToolbar","tabbables","current","onlyToolbarItem","since","alternative","link","observer","window","MutationObserver","observe","childList","subtree","disconnect","useToolbarFocus","focusOnMount","defaultIndex","onIndexChange","initialFocusOnMount","initialIndex","focusToolbar","raf","requestAnimationFrame","items","index","cancelAnimationFrame","findIndex","item","tabIndex","NavigableToolbar","children","__experimentalInitialIndex","__experimentalOnIndexChange","props"],"mappings":";;;;;;;;;AAIA;;;;AADA;;AAQA;;AACA;;AACA;;AAbA;AACA;AACA;AAaA,SAASA,kBAAT,CAA6BC,QAA7B,EAAwC;AACvC,QAAMC,QAAQ,GAAG,aAAjB;AACA,SAAO,CAAED,QAAQ,CAACE,IAAT,CAAiBC,OAAF,IAAe,EAAIF,QAAQ,IAAIE,OAAO,CAACC,OAAxB,CAA9B,CAAT;AACA;;AAED,SAASC,oBAAT,CAA+BC,SAA/B,EAA2C;AAC1C,SAAOC,KAAK,CAACC,IAAN,CAAYF,SAAS,CAACG,gBAAV,CAA4B,qBAA5B,CAAZ,CAAP;AACA;;AAED,SAASC,cAAT,CAAyBJ,SAAzB,EAAqC;AACpC,SAAOA,SAAS,CAACK,QAAV,CAAoBL,SAAS,CAACM,aAAV,CAAwBC,aAA5C,CAAP;AACA;;AAED,SAASC,oBAAT,CAA+BR,SAA/B,EAA2C;AAC1C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AoB,CAAEgB,GAAG,CAACM,OAAN,CAAlC;AACA,YAAMsB,KAAK,GAAGD,KAAK,CAACG,SAAN,CAAmBC,IAAF,IAAYA,IAAI,CAACC,QAAL,KAAkB,CAA/C,CAAd;AACAX,MAAAA,aAAa,CAAEO,KAAF,CAAb;AACA,KARD;AASA,GA7BD,EA6BG,CAAEL,YAAF,EAAgBD,mBAAhB,CA7BH;AA8BA;;AAED,SAASW,gBAAT,OAMI;AAAA,MANuB;AAC1BC,IAAAA,QAD0B;AAE1Bf,IAAAA,YAF0B;AAG1BgB,IAAAA,0BAA0B,EAAEZ,YAHF;AAI1Ba,IAAAA,2BAA2B,EAAEf,aAJH;AAK1B,OAAGgB;AALuB,GAMvB;AACH,QAAMrC,GAAG,GAAG,sBAAZ;AACA,QAAME,mBAAmB,GAAGH,sBAAsB,CAAEC,GAAF,CAAlD;AAEAkB,EAAAA,eAAe,CACdlB,GADc,EAEdmB,YAFc,EAGdjB,mBAHc,EAIdqB,YAJc,EAKdF,aALc,CAAf;;AAQA,MAAKnB,mBAAL,EAA2B;AAC1B,WACC,4BAAC,mBAAD;AAAS,MAAA,KAAK,EAAGmC,KAAK,CAAE,YAAF,CAAtB;AAAyC,MAAA,GAAG,EAAGrC;AAA/C,OAA0DqC,KAA1D,GACGH,QADH,CADD;AAKA;;AAED,SACC,4BAAC,yBAAD;AACC,IAAA,WAAW,EAAC,YADb;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,GAAG,EAAGlC;AAHP,KAIMqC,KAJN,GAMGH,QANH,CADD;AAUA;;eAEcD,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NavigableMenu, Toolbar } from '@wordpress/components';\nimport {\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n\tuseEffect,\n\tuseCallback,\n} from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport { focus } from '@wordpress/dom';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n\nfunction hasOnlyToolbarItem( elements ) {\n\tconst dataProp = 'toolbarItem';\n\treturn ! elements.some( ( element ) => ! ( dataProp in element.dataset ) );\n}\n\nfunction getAllToolbarItemsIn( container ) {\n\treturn Array.from( container.querySelectorAll( '[data-toolbar-item]' ) );\n}\n\nfunction hasFocusWithin( container ) {\n\treturn container.contains( container.ownerDocument.activeElement );\n}\n\nfunction focusFirstTabbableIn( container ) {\n\tconst [ firstTabbable ] = focus.tabbable.find( container );\n\tif ( firstTabbable ) {\n\t\tfirstTabbable.focus( {\n\t\t\t// When focusing newly mounted toolbars,\n\t\t\t// the position of the popover is often not right on the first render\n\t\t\t// This prevents the layout shifts when focusing the dialogs.\n\t\t\tpreventScroll: true,\n\t\t} );\n\t}\n}\n\nfunction useIsAccessibleToolbar( ref ) {\n\t/*\n\t * By default, we'll assume the starting accessible state of the Toolbar\n\t * is true, as it seems to be the most common case.\n\t *\n\t * Transitioning from an (initial) false to true state causes the\n\t * <Toolbar /> component to mount twice, which is causing undesired\n\t * side-effects. These side-effects appear to only affect certain\n\t * E2E tests.\n\t *\n\t * This was initial discovered in this pull-request:\n\t * https://github.com/WordPress/gutenberg/pull/23425\n\t */\n\tconst initialAccessibleToolbarState = true;\n\n\t// By default, it's gonna render NavigableMenu. If all the tabbable elements\n\t// inside the toolbar are ToolbarItem components (or derived components like\n\t// ToolbarButton), then we can wrap them with the accessible Toolbar\n\t// component.\n\tconst [ isAccessibleToolbar, setIsAccessibleToolbar ] = useState(\n\t\tinitialAccessibleToolbarState\n\t);\n\n\tconst determineIsAccessibleToolbar = useCallback( () => {\n\t\tconst tabbables = focus.tabbable.find( ref.current );\n\t\tconst onlyToolbarItem = hasOnlyToolbarItem( tabbables );\n\t\tif ( ! onlyToolbarItem ) {\n\t\t\tdeprecated( 'Using custom components as toolbar controls', {\n\t\t\t\tsince: '5.6',\n\t\t\t\talternative:\n\t\t\t\t\t'ToolbarItem, ToolbarButton or ToolbarDropdownMenu components',\n\t\t\t\tlink:\n\t\t\t\t\t'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols',\n\t\t\t} );\n\t\t}\n\t\tsetIsAccessibleToolbar( onlyToolbarItem );\n\t}, [] );\n\n\tuseLayoutEffect( () => {\n\t\t// Toolbar buttons may be rendered asynchronously, so we use\n\t\t// MutationObserver to check if the toolbar subtree has been modified.\n\t\tconst observer = new window.MutationObserver(\n\t\t\tdetermineIsAccessibleToolbar\n\t\t);\n\t\tobserver.observe( ref.current, { childList: true, subtree: true } );\n\t\treturn () => observer.disconnect();\n\t}, [ isAccessibleToolbar ] );\n\n\treturn isAccessibleToolbar;\n}\n\nfunction useToolbarFocus(\n\tref,\n\tfocusOnMount,\n\tisAccessibleToolbar,\n\tdefaultIndex,\n\tonIndexChange\n) {\n\t// Make sure we don't use modified versions of this prop.\n\tconst [ initialFocusOnMount ] = useState( focusOnMount );\n\tconst [ initialIndex ] = useState( defaultIndex );\n\n\tconst focusToolbar = useCallback( () => {\n\t\tfocusFirstTabbableIn( ref.current );\n\t}, [] );\n\n\t// Focus on toolbar when pressing alt+F10 when the toolbar is visible.\n\tuseShortcut( 'core/block-editor/focus-toolbar', focusToolbar );\n\n\tuseEffect( () => {\n\t\tif ( initialFocusOnMount ) {\n\t\t\tfocusToolbar();\n\t\t}\n\t}, [ isAccessibleToolbar, initialFocusOnMount, focusToolbar ] );\n\n\tuseEffect( () => {\n\t\t// If initialIndex is passed, we focus on that toolbar item when the\n\t\t// toolbar gets mounted and initial focus is not forced.\n\t\t// We have to wait for the next browser paint because block controls aren't\n\t\t// rendered right away when the toolbar gets mounted.\n\t\tlet raf = 0;\n\t\tif ( initialIndex && ! initialFocusOnMount ) {\n\t\t\traf = window.requestAnimationFrame( () => {\n\t\t\t\tconst items = getAllToolbarItemsIn( ref.current );\n\t\t\t\tconst index = initialIndex || 0;\n\t\t\t\tif ( items[ index ] && hasFocusWithin( ref.current ) ) {\n\t\t\t\t\titems[ index ].focus( {\n\t\t\t\t\t\t// When focusing newly mounted toolbars,\n\t\t\t\t\t\t// the position of the popover is often not right on the first render\n\t\t\t\t\t\t// This prevents the layout shifts when focusing the dialogs.\n\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\treturn () => {\n\t\t\twindow.cancelAnimationFrame( raf );\n\t\t\tif ( ! onIndexChange || ! ref.current ) return;\n\t\t\t// When the toolbar element is unmounted and onIndexChange is passed, we\n\t\t\t// pass the focused toolbar item index so it can be hydrated later.\n\t\t\tconst items = getAllToolbarItemsIn( ref.current );\n\t\t\tconst index = items.findIndex( ( item ) => item.tabIndex === 0 );\n\t\t\tonIndexChange( index );\n\t\t};\n\t}, [ initialIndex, initialFocusOnMount ] );\n}\n\nfunction NavigableToolbar( {\n\tchildren,\n\tfocusOnMount,\n\t__experimentalInitialIndex: initialIndex,\n\t__experimentalOnIndexChange: onIndexChange,\n\t...props\n} ) {\n\tconst ref = useRef();\n\tconst isAccessibleToolbar = useIsAccessibleToolbar( ref );\n\n\tuseToolbarFocus(\n\t\tref,\n\t\tfocusOnMount,\n\t\tisAccessibleToolbar,\n\t\tinitialIndex,\n\t\tonIndexChange\n\t);\n\n\tif ( isAccessibleToolbar ) {\n\t\treturn (\n\t\t\t<Toolbar label={ props[ 'aria-label' ] } ref={ ref } { ...props }>\n\t\t\t\t{ children }\n\t\t\t</Toolbar>\n\t\t);\n\t}\n\n\treturn (\n\t\t<NavigableMenu\n\t\t\torientation=\"horizontal\"\n\t\t\trole=\"toolbar\"\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</NavigableMenu>\n\t);\n}\n\nexport default NavigableToolbar;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/navigable-toolbar/index.js"],"names":["hasOnlyToolbarItem","elements","dataProp","some","element","dataset","getAllToolbarItemsIn","container","Array","from","querySelectorAll","hasFocusWithin","contains","ownerDocument","activeElement","focusFirstTabbableIn","firstTabbable","focus","tabbable","find","preventScroll","useIsAccessibleToolbar","ref","initialAccessibleToolbarState","isAccessibleToolbar","setIsAccessibleToolbar","determineIsAccessibleToolbar","tabbables","current","onlyToolbarItem","since","alternative","link","observer","window","MutationObserver","observe","childList","subtree","disconnect","useToolbarFocus","focusOnMount","defaultIndex","onIndexChange","initialFocusOnMount","initialIndex","focusToolbar","raf","requestAnimationFrame","items","index","cancelAnimationFrame","findIndex","item","tabIndex","NavigableToolbar","children","__experimentalInitialIndex","__experimentalOnIndexChange","props"],"mappings":";;;;;;;;;AAIA;;;;AADA;;AAQA;;AACA;;AACA;;AAbA;AACA;AACA;AAaA,SAASA,kBAAT,CAA6BC,QAA7B,EAAwC;AACvC,QAAMC,QAAQ,GAAG,aAAjB;AACA,SAAO,CAAED,QAAQ,CAACE,IAAT,CAAiBC,OAAF,IAAe,EAAIF,QAAQ,IAAIE,OAAO,CAACC,OAAxB,CAA9B,CAAT;AACA;;AAED,SAASC,oBAAT,CAA+BC,SAA/B,EAA2C;AAC1C,SAAOC,KAAK,CAACC,IAAN,CAAYF,SAAS,CAACG,gBAAV,CAA4B,qBAA5B,CAAZ,CAAP;AACA;;AAED,SAASC,cAAT,CAAyBJ,SAAzB,EAAqC;AACpC,SAAOA,SAAS,CAACK,QAAV,CAAoBL,SAAS,CAACM,aAAV,CAAwBC,aAA5C,CAAP;AACA;;AAED,SAASC,oBAAT,CAA+BR,SAA/B,EAA2C;AAC1C,QAAM,CAAES,aAAF,IAAoBC,WAAMC,QAAN,CAAeC,IAAf,CAAqBZ,SAArB,CAA1B;;AACA,MAAKS,aAAL,EAAqB;AACpBA,IAAAA,aAAa,CAACC,KAAd,CAAqB;AACpB;AACA;AACA;AACAG,MAAAA,aAAa,EAAE;AAJK,KAArB;AAMA;AACD;;AAED,SAASC,sBAAT,CAAiCC,GAAjC,EAAuC;AACtC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,QAAMC,6BAA6B,GAAG,IAAtC,CAbsC,CA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B,IAAAA,0BAA0B,EAAEZ,YAHF;AAI1Ba,IAAAA,2BAA2B,EAAEf,aAJH;AAK1B,OAAGgB;AALuB,GAMvB;AACH,QAAMrC,GAAG,GAAG,sBAAZ;AACA,QAAME,mBAAmB,GAAGH,sBAAsB,CAAEC,GAAF,CAAlD;AAEAkB,EAAAA,eAAe,CACdlB,GADc,EAEdmB,YAFc,EAGdjB,mBAHc,EAIdqB,YAJc,EAKdF,aALc,CAAf;;AAQA,MAAKnB,mBAAL,EAA2B;AAC1B,WACC,4BAAC,mBAAD;AAAS,MAAA,KAAK,EAAGmC,KAAK,CAAE,YAAF,CAAtB;AAAyC,MAAA,GAAG,EAAGrC;AAA/C,OAA0DqC,KAA1D,GACGH,QADH,CADD;AAKA;;AAED,SACC,4BAAC,yBAAD;AACC,IAAA,WAAW,EAAC,YADb;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,GAAG,EAAGlC;AAHP,KAIMqC,KAJN,GAMGH,QANH,CADD;AAUA;;eAEcD,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NavigableMenu, Toolbar } from '@wordpress/components';\nimport {\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n\tuseEffect,\n\tuseCallback,\n} from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport { focus } from '@wordpress/dom';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n\nfunction hasOnlyToolbarItem( elements ) {\n\tconst dataProp = 'toolbarItem';\n\treturn ! elements.some( ( element ) => ! ( dataProp in element.dataset ) );\n}\n\nfunction getAllToolbarItemsIn( container ) {\n\treturn Array.from( container.querySelectorAll( '[data-toolbar-item]' ) );\n}\n\nfunction hasFocusWithin( container ) {\n\treturn container.contains( container.ownerDocument.activeElement );\n}\n\nfunction focusFirstTabbableIn( container ) {\n\tconst [ firstTabbable ] = focus.tabbable.find( container );\n\tif ( firstTabbable ) {\n\t\tfirstTabbable.focus( {\n\t\t\t// When focusing newly mounted toolbars,\n\t\t\t// the position of the popover is often not right on the first render\n\t\t\t// This prevents the layout shifts when focusing the dialogs.\n\t\t\tpreventScroll: true,\n\t\t} );\n\t}\n}\n\nfunction useIsAccessibleToolbar( ref ) {\n\t/*\n\t * By default, we'll assume the starting accessible state of the Toolbar\n\t * is true, as it seems to be the most common case.\n\t *\n\t * Transitioning from an (initial) false to true state causes the\n\t * <Toolbar /> component to mount twice, which is causing undesired\n\t * side-effects. These side-effects appear to only affect certain\n\t * E2E tests.\n\t *\n\t * This was initial discovered in this pull-request:\n\t * https://github.com/WordPress/gutenberg/pull/23425\n\t */\n\tconst initialAccessibleToolbarState = true;\n\n\t// By default, it's gonna render NavigableMenu. If all the tabbable elements\n\t// inside the toolbar are ToolbarItem components (or derived components like\n\t// ToolbarButton), then we can wrap them with the accessible Toolbar\n\t// component.\n\tconst [ isAccessibleToolbar, setIsAccessibleToolbar ] = useState(\n\t\tinitialAccessibleToolbarState\n\t);\n\n\tconst determineIsAccessibleToolbar = useCallback( () => {\n\t\tconst tabbables = focus.tabbable.find( ref.current );\n\t\tconst onlyToolbarItem = hasOnlyToolbarItem( tabbables );\n\t\tif ( ! onlyToolbarItem ) {\n\t\t\tdeprecated( 'Using custom components as toolbar controls', {\n\t\t\t\tsince: '5.6',\n\t\t\t\talternative:\n\t\t\t\t\t'ToolbarItem, ToolbarButton or ToolbarDropdownMenu components',\n\t\t\t\tlink: 'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols',\n\t\t\t} );\n\t\t}\n\t\tsetIsAccessibleToolbar( onlyToolbarItem );\n\t}, [] );\n\n\tuseLayoutEffect( () => {\n\t\t// Toolbar buttons may be rendered asynchronously, so we use\n\t\t// MutationObserver to check if the toolbar subtree has been modified.\n\t\tconst observer = new window.MutationObserver(\n\t\t\tdetermineIsAccessibleToolbar\n\t\t);\n\t\tobserver.observe( ref.current, { childList: true, subtree: true } );\n\t\treturn () => observer.disconnect();\n\t}, [ isAccessibleToolbar ] );\n\n\treturn isAccessibleToolbar;\n}\n\nfunction useToolbarFocus(\n\tref,\n\tfocusOnMount,\n\tisAccessibleToolbar,\n\tdefaultIndex,\n\tonIndexChange\n) {\n\t// Make sure we don't use modified versions of this prop.\n\tconst [ initialFocusOnMount ] = useState( focusOnMount );\n\tconst [ initialIndex ] = useState( defaultIndex );\n\n\tconst focusToolbar = useCallback( () => {\n\t\tfocusFirstTabbableIn( ref.current );\n\t}, [] );\n\n\t// Focus on toolbar when pressing alt+F10 when the toolbar is visible.\n\tuseShortcut( 'core/block-editor/focus-toolbar', focusToolbar );\n\n\tuseEffect( () => {\n\t\tif ( initialFocusOnMount ) {\n\t\t\tfocusToolbar();\n\t\t}\n\t}, [ isAccessibleToolbar, initialFocusOnMount, focusToolbar ] );\n\n\tuseEffect( () => {\n\t\t// If initialIndex is passed, we focus on that toolbar item when the\n\t\t// toolbar gets mounted and initial focus is not forced.\n\t\t// We have to wait for the next browser paint because block controls aren't\n\t\t// rendered right away when the toolbar gets mounted.\n\t\tlet raf = 0;\n\t\tif ( initialIndex && ! initialFocusOnMount ) {\n\t\t\traf = window.requestAnimationFrame( () => {\n\t\t\t\tconst items = getAllToolbarItemsIn( ref.current );\n\t\t\t\tconst index = initialIndex || 0;\n\t\t\t\tif ( items[ index ] && hasFocusWithin( ref.current ) ) {\n\t\t\t\t\titems[ index ].focus( {\n\t\t\t\t\t\t// When focusing newly mounted toolbars,\n\t\t\t\t\t\t// the position of the popover is often not right on the first render\n\t\t\t\t\t\t// This prevents the layout shifts when focusing the dialogs.\n\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\treturn () => {\n\t\t\twindow.cancelAnimationFrame( raf );\n\t\t\tif ( ! onIndexChange || ! ref.current ) return;\n\t\t\t// When the toolbar element is unmounted and onIndexChange is passed, we\n\t\t\t// pass the focused toolbar item index so it can be hydrated later.\n\t\t\tconst items = getAllToolbarItemsIn( ref.current );\n\t\t\tconst index = items.findIndex( ( item ) => item.tabIndex === 0 );\n\t\t\tonIndexChange( index );\n\t\t};\n\t}, [ initialIndex, initialFocusOnMount ] );\n}\n\nfunction NavigableToolbar( {\n\tchildren,\n\tfocusOnMount,\n\t__experimentalInitialIndex: initialIndex,\n\t__experimentalOnIndexChange: onIndexChange,\n\t...props\n} ) {\n\tconst ref = useRef();\n\tconst isAccessibleToolbar = useIsAccessibleToolbar( ref );\n\n\tuseToolbarFocus(\n\t\tref,\n\t\tfocusOnMount,\n\t\tisAccessibleToolbar,\n\t\tinitialIndex,\n\t\tonIndexChange\n\t);\n\n\tif ( isAccessibleToolbar ) {\n\t\treturn (\n\t\t\t<Toolbar label={ props[ 'aria-label' ] } ref={ ref } { ...props }>\n\t\t\t\t{ children }\n\t\t\t</Toolbar>\n\t\t);\n\t}\n\n\treturn (\n\t\t<NavigableMenu\n\t\t\torientation=\"horizontal\"\n\t\t\trole=\"toolbar\"\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</NavigableMenu>\n\t);\n}\n\nexport default NavigableToolbar;\n"]}
|
|
@@ -32,6 +32,8 @@ class PlainText extends _element.Component {
|
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
34
|
this.isAndroid = _reactNative.Platform.OS === 'android';
|
|
35
|
+
this.onChangeTextInput = this.onChangeTextInput.bind(this);
|
|
36
|
+
this.onChangeRichText = this.onChangeRichText.bind(this);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
componentDidMount() {
|
|
@@ -54,7 +56,9 @@ class PlainText extends _element.Component {
|
|
|
54
56
|
|
|
55
57
|
componentDidUpdate(prevProps) {
|
|
56
58
|
if (!this.props.isSelected && prevProps.isSelected) {
|
|
57
|
-
|
|
59
|
+
var _this$_input;
|
|
60
|
+
|
|
61
|
+
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.blur();
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
|
|
@@ -65,11 +69,15 @@ class PlainText extends _element.Component {
|
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
focus() {
|
|
68
|
-
|
|
72
|
+
var _this$_input2;
|
|
73
|
+
|
|
74
|
+
(_this$_input2 = this._input) === null || _this$_input2 === void 0 ? void 0 : _this$_input2.focus();
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
blur() {
|
|
72
|
-
|
|
78
|
+
var _this$_input3;
|
|
79
|
+
|
|
80
|
+
(_this$_input3 = this._input) === null || _this$_input3 === void 0 ? void 0 : _this$_input3.blur();
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
getFontSize() {
|
|
@@ -95,16 +103,63 @@ class PlainText extends _element.Component {
|
|
|
95
103
|
};
|
|
96
104
|
}
|
|
97
105
|
|
|
106
|
+
replaceLineBreakTags(value) {
|
|
107
|
+
return value === null || value === void 0 ? void 0 : value.replace(RegExp('<br>', 'gim'), '\n');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
onChangeTextInput(event) {
|
|
111
|
+
const {
|
|
112
|
+
onChange
|
|
113
|
+
} = this.props;
|
|
114
|
+
onChange(event.nativeEvent.text);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
onChangeRichText(value) {
|
|
118
|
+
const {
|
|
119
|
+
onChange
|
|
120
|
+
} = this.props; // The <br> tags have to be replaced with new line characters
|
|
121
|
+
// as the content of plain text shouldn't contain HTML tags.
|
|
122
|
+
|
|
123
|
+
onChange(this.replaceLineBreakTags(value));
|
|
124
|
+
}
|
|
125
|
+
|
|
98
126
|
render() {
|
|
99
127
|
const {
|
|
100
|
-
style
|
|
128
|
+
style,
|
|
129
|
+
__experimentalVersion,
|
|
130
|
+
onFocus,
|
|
131
|
+
...otherProps
|
|
101
132
|
} = this.props;
|
|
102
133
|
const textStyles = [style || _style.default['block-editor-plain-text'], this.getFontSize()];
|
|
134
|
+
|
|
135
|
+
if (__experimentalVersion === 2) {
|
|
136
|
+
const disableFormattingProps = {
|
|
137
|
+
withoutInteractiveFormatting: true,
|
|
138
|
+
disableEditingMenu: true,
|
|
139
|
+
__unstableDisableFormats: true,
|
|
140
|
+
disableSuggestions: true
|
|
141
|
+
};
|
|
142
|
+
const forcePlainTextProps = {
|
|
143
|
+
preserveWhiteSpace: true,
|
|
144
|
+
__unstablePastePlainText: true,
|
|
145
|
+
multiline: false
|
|
146
|
+
};
|
|
147
|
+
const fontProps = {
|
|
148
|
+
fontFamily: style === null || style === void 0 ? void 0 : style.fontFamily,
|
|
149
|
+
fontSize: style === null || style === void 0 ? void 0 : style.fontSize,
|
|
150
|
+
fontWeight: style === null || style === void 0 ? void 0 : style.fontWeight
|
|
151
|
+
};
|
|
152
|
+
return (0, _element.createElement)(_blockEditor.RichText, (0, _extends2.default)({}, otherProps, disableFormattingProps, forcePlainTextProps, fontProps, {
|
|
153
|
+
identifier: "content",
|
|
154
|
+
style: style,
|
|
155
|
+
onChange: this.onChangeRichText,
|
|
156
|
+
unstableOnFocus: onFocus
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
|
|
103
160
|
return (0, _element.createElement)(_reactNative.TextInput, (0, _extends2.default)({}, this.props, {
|
|
104
161
|
ref: x => this._input = x,
|
|
105
|
-
onChange:
|
|
106
|
-
this.props.onChange(event.nativeEvent.text);
|
|
107
|
-
},
|
|
162
|
+
onChange: this.onChangeTextInput,
|
|
108
163
|
onFocus: this.props.onFocus // Always assign onFocus as a props.
|
|
109
164
|
,
|
|
110
165
|
onBlur: this.props.onBlur // Always assign onBlur as a props.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/plain-text/index.native.js"],"names":["PlainText","Component","constructor","arguments","isAndroid","Platform","OS","componentDidMount","_input","isFocused","props","isSelected","timeoutID","setTimeout","focus","componentDidUpdate","prevProps","blur","componentWillUnmount","clearTimeout","getFontSize","style","fontSize","width","height","Dimensions","get","cssUnitOptions","parseFloat","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/plain-text/index.native.js"],"names":["PlainText","Component","constructor","arguments","isAndroid","Platform","OS","onChangeTextInput","bind","onChangeRichText","componentDidMount","_input","isFocused","props","isSelected","timeoutID","setTimeout","focus","componentDidUpdate","prevProps","blur","componentWillUnmount","clearTimeout","getFontSize","style","fontSize","width","height","Dimensions","get","cssUnitOptions","parseFloat","replaceLineBreakTags","value","replace","RegExp","event","onChange","nativeEvent","text","render","__experimentalVersion","onFocus","otherProps","textStyles","styles","disableFormattingProps","withoutInteractiveFormatting","disableEditingMenu","__unstableDisableFormats","disableSuggestions","forcePlainTextProps","preserveWhiteSpace","__unstablePastePlainText","multiline","fontProps","fontFamily","fontWeight","x","onBlur"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGe,MAAMA,SAAN,SAAwBC,kBAAxB,CAAkC;AAChDC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,SAAL,GAAiBC,sBAASC,EAAT,KAAgB,SAAjC;AAEA,SAAKC,iBAAL,GAAyB,KAAKA,iBAAL,CAAuBC,IAAvB,CAA6B,IAA7B,CAAzB;AACA,SAAKC,gBAAL,GAAwB,KAAKA,gBAAL,CAAsBD,IAAtB,CAA4B,IAA5B,CAAxB;AACA;;AAEDE,EAAAA,iBAAiB,GAAG;AACnB;AACA,QACC,KAAKC,MAAL,IACA,KAAKA,MAAL,CAAYC,SAAZ,OAA4B,KAD5B,IAEA,KAAKC,KAAL,CAAWC,UAHZ,EAIE;AACD,UAAK,KAAKV,SAAV,EAAsB;AACrB;AACJ;AACA;AACA;AACA;AACI,aAAKW,SAAL,GAAiBC,UAAU,CAAE,MAAM;AAClC,eAAKL,MAAL,CAAYM,KAAZ;AACA,SAF0B,EAExB,GAFwB,CAA3B;AAGA,OATD,MASO;AACN,aAAKN,MAAL,CAAYM,KAAZ;AACA;AACD;AACD;;AAEDC,EAAAA,kB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KAAKf,gBAPjB;AAQC,QAAA,eAAe,EAAGiC;AARnB,SADD;AAYA;;AAED,WACC,4BAAC,sBAAD,6BACM,KAAK7B,KADX;AAEC,MAAA,GAAG,EAAK6C,CAAF,IAAW,KAAK/C,MAAL,GAAc+C,CAFhC;AAGC,MAAA,QAAQ,EAAG,KAAKnD,iBAHjB;AAIC,MAAA,OAAO,EAAG,KAAKM,KAAL,CAAW6B,OAJtB,CAIgC;AAJhC;AAKC,MAAA,MAAM,EAAG,KAAK7B,KAAL,CAAW8C,MALrB,CAK8B;AAL9B;AAMC,MAAA,UAAU,EACP,KAAK9C,KAAL,CAAWW,KAAX,IAAoB,KAAKX,KAAL,CAAWW,KAAX,CAAiBgC,UAAvC,IACAX,eAAQ,yBAAR,EAAoCW,UARtC;AAUC,MAAA,KAAK,EAAGZ,UAVT;AAWC,MAAA,aAAa,EAAG;AAXjB,OADD;AAeA;;AA7I+C","sourcesContent":["/**\n * External dependencies\n */\nimport { TextInput, Platform, Dimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { RichText, getPxFromCssUnit } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport default class PlainText extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.isAndroid = Platform.OS === 'android';\n\n\t\tthis.onChangeTextInput = this.onChangeTextInput.bind( this );\n\t\tthis.onChangeRichText = this.onChangeRichText.bind( this );\n\t}\n\n\tcomponentDidMount() {\n\t\t// If isSelected is true, we should request the focus on this TextInput.\n\t\tif (\n\t\t\tthis._input &&\n\t\t\tthis._input.isFocused() === false &&\n\t\t\tthis.props.isSelected\n\t\t) {\n\t\t\tif ( this.isAndroid ) {\n\t\t\t\t/*\n\t\t\t\t * There seems to be an issue in React Native where the keyboard doesn't show if called shortly after rendering.\n\t\t\t\t * As a common work around this delay is used.\n\t\t\t\t * https://github.com/facebook/react-native/issues/19366#issuecomment-400603928\n\t\t\t\t */\n\t\t\t\tthis.timeoutID = setTimeout( () => {\n\t\t\t\t\tthis._input.focus();\n\t\t\t\t}, 100 );\n\t\t\t} else {\n\t\t\t\tthis._input.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! this.props.isSelected && prevProps.isSelected ) {\n\t\t\tthis._input?.blur();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.isAndroid ) {\n\t\t\tclearTimeout( this.timeoutID );\n\t\t}\n\t}\n\n\tfocus() {\n\t\tthis._input?.focus();\n\t}\n\n\tblur() {\n\t\tthis._input?.blur();\n\t}\n\n\tgetFontSize() {\n\t\tconst { style } = this.props;\n\n\t\tif ( ! style?.fontSize ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { width, height } = Dimensions.get( 'window' );\n\t\tconst cssUnitOptions = { height, width };\n\n\t\treturn {\n\t\t\tfontSize: parseFloat(\n\t\t\t\tgetPxFromCssUnit( style.fontSize, cssUnitOptions )\n\t\t\t),\n\t\t};\n\t}\n\n\treplaceLineBreakTags( value ) {\n\t\treturn value?.replace( RegExp( '<br>', 'gim' ), '\\n' );\n\t}\n\n\tonChangeTextInput( event ) {\n\t\tconst { onChange } = this.props;\n\t\tonChange( event.nativeEvent.text );\n\t}\n\n\tonChangeRichText( value ) {\n\t\tconst { onChange } = this.props;\n\t\t// The <br> tags have to be replaced with new line characters\n\t\t// as the content of plain text shouldn't contain HTML tags.\n\t\tonChange( this.replaceLineBreakTags( value ) );\n\t}\n\n\trender() {\n\t\tconst { style, __experimentalVersion, onFocus, ...otherProps } =\n\t\t\tthis.props;\n\t\tconst textStyles = [\n\t\t\tstyle || styles[ 'block-editor-plain-text' ],\n\t\t\tthis.getFontSize(),\n\t\t];\n\n\t\tif ( __experimentalVersion === 2 ) {\n\t\t\tconst disableFormattingProps = {\n\t\t\t\twithoutInteractiveFormatting: true,\n\t\t\t\tdisableEditingMenu: true,\n\t\t\t\t__unstableDisableFormats: true,\n\t\t\t\tdisableSuggestions: true,\n\t\t\t};\n\n\t\t\tconst forcePlainTextProps = {\n\t\t\t\tpreserveWhiteSpace: true,\n\t\t\t\t__unstablePastePlainText: true,\n\t\t\t\tmultiline: false,\n\t\t\t};\n\n\t\t\tconst fontProps = {\n\t\t\t\tfontFamily: style?.fontFamily,\n\t\t\t\tfontSize: style?.fontSize,\n\t\t\t\tfontWeight: style?.fontWeight,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<RichText\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\t{ ...disableFormattingProps }\n\t\t\t\t\t{ ...forcePlainTextProps }\n\t\t\t\t\t{ ...fontProps }\n\t\t\t\t\tidentifier=\"content\"\n\t\t\t\t\tstyle={ style }\n\t\t\t\t\tonChange={ this.onChangeRichText }\n\t\t\t\t\tunstableOnFocus={ onFocus }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<TextInput\n\t\t\t\t{ ...this.props }\n\t\t\t\tref={ ( x ) => ( this._input = x ) }\n\t\t\t\tonChange={ this.onChangeTextInput }\n\t\t\t\tonFocus={ this.props.onFocus } // Always assign onFocus as a props.\n\t\t\t\tonBlur={ this.props.onBlur } // Always assign onBlur as a props.\n\t\t\t\tfontFamily={\n\t\t\t\t\t( this.props.style && this.props.style.fontFamily ) ||\n\t\t\t\t\tstyles[ 'block-editor-plain-text' ].fontFamily\n\t\t\t\t}\n\t\t\t\tstyle={ textStyles }\n\t\t\t\tscrollEnabled={ false }\n\t\t\t/>\n\t\t);\n\t}\n}\n"]}
|
|
@@ -48,10 +48,14 @@ function PreviewOptions(_ref) {
|
|
|
48
48
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
49
49
|
children: (0, _i18n.__)('Preview')
|
|
50
50
|
};
|
|
51
|
+
const menuProps = {
|
|
52
|
+
'aria-label': (0, _i18n.__)('Preview options')
|
|
53
|
+
};
|
|
51
54
|
return (0, _element.createElement)(_components.DropdownMenu, {
|
|
52
55
|
className: "block-editor-post-preview__dropdown",
|
|
53
56
|
popoverProps: popoverProps,
|
|
54
57
|
toggleProps: toggleProps,
|
|
58
|
+
menuProps: menuProps,
|
|
55
59
|
icon: null
|
|
56
60
|
}, () => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
|
|
57
61
|
className: "block-editor-post-preview__button-resize",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/preview-options/index.js"],"names":["PreviewOptions","children","className","isEnabled","deviceType","setDeviceType","isMobile","popoverProps","position","toggleProps","variant","disabled","check"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMe,SAASA,cAAT,OAMX;AAAA,MANoC;AACvCC,IAAAA,QADuC;AAEvCC,IAAAA,SAFuC;AAGvCC,IAAAA,SAAS,GAAG,IAH2B;AAIvCC,IAAAA,UAJuC;AAKvCC,IAAAA;AALuC,GAMpC;AACH,QAAMC,QAAQ,GAAG,+BAAkB,OAAlB,EAA2B,GAA3B,CAAjB;AACA,MAAKA,QAAL,EAAgB,OAAO,IAAP;AAEhB,QAAMC,YAAY,GAAG;AACpBL,IAAAA,SAAS,EAAE,yBACVA,SADU,EAEV,6CAFU,CADS;AAKpBM,IAAAA,QAAQ,EAAE;AALU,GAArB;AAOA,QAAMC,WAAW,GAAG;AACnBC,IAAAA,OAAO,EAAE,UADU;AAEnBR,IAAAA,SAAS,EAAE,0CAFQ;AAGnBS,IAAAA,QAAQ,EAAE,CAAER,SAHO;;AAInB;AACAF,IAAAA,QAAQ,EAAE,cAAI,SAAJ;AALS,GAApB;AAOA,SACC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,YAAY,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/preview-options/index.js"],"names":["PreviewOptions","children","className","isEnabled","deviceType","setDeviceType","isMobile","popoverProps","position","toggleProps","variant","disabled","menuProps","check"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMe,SAASA,cAAT,OAMX;AAAA,MANoC;AACvCC,IAAAA,QADuC;AAEvCC,IAAAA,SAFuC;AAGvCC,IAAAA,SAAS,GAAG,IAH2B;AAIvCC,IAAAA,UAJuC;AAKvCC,IAAAA;AALuC,GAMpC;AACH,QAAMC,QAAQ,GAAG,+BAAkB,OAAlB,EAA2B,GAA3B,CAAjB;AACA,MAAKA,QAAL,EAAgB,OAAO,IAAP;AAEhB,QAAMC,YAAY,GAAG;AACpBL,IAAAA,SAAS,EAAE,yBACVA,SADU,EAEV,6CAFU,CADS;AAKpBM,IAAAA,QAAQ,EAAE;AALU,GAArB;AAOA,QAAMC,WAAW,GAAG;AACnBC,IAAAA,OAAO,EAAE,UADU;AAEnBR,IAAAA,SAAS,EAAE,0CAFQ;AAGnBS,IAAAA,QAAQ,EAAE,CAAER,SAHO;;AAInB;AACAF,IAAAA,QAAQ,EAAE,cAAI,SAAJ;AALS,GAApB;AAOA,QAAMW,SAAS,GAAG;AACjB,kBAAc,cAAI,iBAAJ;AADG,GAAlB;AAGA,SACC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,YAAY,EAAGL,YAFhB;AAGC,IAAA,WAAW,EAAGE,WAHf;AAIC,IAAA,SAAS,EAAGG,SAJb;AAKC,IAAA,IAAI,EAAG;AALR,KAOG,MACD,qDACC,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMP,aAAa,CAAE,SAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,SAAf,IAA4BS;AAHpC,KAKG,cAAI,SAAJ,CALH,CADD,EAQC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMR,aAAa,CAAE,QAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,QAAf,IAA2BS;AAHnC,KAKG,cAAI,QAAJ,CALH,CARD,EAeC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG,MAAMR,aAAa,CAAE,QAAF,CAF9B;AAGC,IAAA,IAAI,EAAGD,UAAU,KAAK,QAAf,IAA2BS;AAHnC,KAKG,cAAI,QAAJ,CALH,CAfD,CADD,EAwBGZ,QAxBH,CARF,CADD;AAsCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nexport default function PreviewOptions( {\n\tchildren,\n\tclassName,\n\tisEnabled = true,\n\tdeviceType,\n\tsetDeviceType,\n} ) {\n\tconst isMobile = useViewportMatch( 'small', '<' );\n\tif ( isMobile ) return null;\n\n\tconst popoverProps = {\n\t\tclassName: classnames(\n\t\t\tclassName,\n\t\t\t'block-editor-post-preview__dropdown-content'\n\t\t),\n\t\tposition: 'bottom left',\n\t};\n\tconst toggleProps = {\n\t\tvariant: 'tertiary',\n\t\tclassName: 'block-editor-post-preview__button-toggle',\n\t\tdisabled: ! isEnabled,\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\tchildren: __( 'Preview' ),\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'Preview options' ),\n\t};\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-post-preview__dropdown\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ null }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Desktop' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Desktop' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Desktop' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Tablet' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Tablet' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Tablet' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tclassName=\"block-editor-post-preview__button-resize\"\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Mobile' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Mobile' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Mobile' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ children }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
|
|
@@ -26,7 +26,7 @@ var _store = require("../../store");
|
|
|
26
26
|
/**
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
const noop = () => {};
|
|
30
30
|
/**
|
|
31
31
|
* A function to call when the block value has been updated in the block-editor
|
|
32
32
|
* store.
|
|
@@ -78,13 +78,15 @@ var _store = require("../../store");
|
|
|
78
78
|
* for the given clientId. When this is called,
|
|
79
79
|
* controlling sources do not become dirty.
|
|
80
80
|
*/
|
|
81
|
+
|
|
82
|
+
|
|
81
83
|
function useBlockSync(_ref) {
|
|
82
84
|
let {
|
|
83
85
|
clientId = null,
|
|
84
86
|
value: controlledBlocks,
|
|
85
87
|
selection: controlledSelection,
|
|
86
|
-
onChange =
|
|
87
|
-
onInput =
|
|
88
|
+
onChange = noop,
|
|
89
|
+
onInput = noop
|
|
88
90
|
} = _ref;
|
|
89
91
|
const registry = (0, _data.useRegistry)();
|
|
90
92
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/provider/use-block-sync.js"],"names":["useBlockSync","clientId","value","controlledBlocks","selection","controlledSelection","onChange","noop","onInput","registry","resetBlocks","resetSelection","replaceInnerBlocks","setHasControlledInnerBlocks","__unstableMarkNextChangeAsNotPersistent","dispatch","blockEditorStore","getBlockName","getBlocks","select","isControlled","areInnerBlocksControlled","pendingChanges","incoming","outgoing","subscribed","setControlledBlocks","batch","storeBlocks","map","block","current","onInputRef","onChangeRef","includes","selectionStart","selectionEnd","initialPosition","getSelectionStart","getSelectionEnd","getSelectedBlocksInitialCaretPosition","isLastBlockChangePersistent","__unstableIsLastBlockChangeIgnored","blocks","isPersistent","previousAreBlocksDifferent","unsubscribe","subscribe","isStillControlled","newIsPersistent","newBlocks","areBlocksDifferent","didPersistenceChange","push","updateParent"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,YAAT,OAMX;AAAA,MANkC;AACrCC,IAAAA,QAAQ,GAAG,IAD0B;AAErCC,IAAAA,KAAK,EAAEC,gBAF8B;AAGrCC,IAAAA,SAAS,EAAEC,m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AAA,cAAc,CAACS,OAAf,CAAuBR,QAAvB,GAAkC,IAAlC;AACAqB,QAAAA,YAAY,GAAGK,eAAf;AACA;AACA,OAlC4C,CAoC7C;AACA;AACA;;;AACA,YAAMG,oBAAoB,GACzBP,0BAA0B,IAC1B,CAAEM,kBADF,IAEAF,eAFA,IAGA,CAAEL,YAJH;;AAMA,UAAKO,kBAAkB,IAAIC,oBAA3B,EAAkD;AACjDR,QAAAA,YAAY,GAAGK,eAAf,CADiD,CAEjD;AACA;AACA;AACA;;AACA3B,QAAAA,cAAc,CAACS,OAAf,CAAuBP,QAAvB,CAAgC6B,IAAhC,CAAsCV,MAAtC,EANiD,CAQjD;AACA;;AACA,cAAMW,YAAY,GAAGV,YAAY,GAC9BX,WAAW,CAACF,OADkB,GAE9BC,UAAU,CAACD,OAFd;AAGAuB,QAAAA,YAAY,CAAEX,MAAF,EAAU;AACrBvC,UAAAA,SAAS,EAAE;AACV+B,YAAAA,cAAc,EAAEG,iBAAiB,EADvB;AAEVF,YAAAA,YAAY,EAAEG,eAAe,EAFnB;AAGVF,YAAAA,eAAe,EAAEG,qCAAqC;AAH5C;AADU,SAAV,CAAZ;AAOA;;AACDK,MAAAA,0BAA0B,GAAGM,kBAA7B;AACA,KAnEmB,CAApB;AAqEA,WAAO,MAAML,WAAW,EAAxB;AACA,GArFD,EAqFG,CAAErC,QAAF,EAAYR,QAAZ,CArFH;AAsFA","sourcesContent":["/**\n * External dependencies\n */\nimport { last, noop } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * A function to call when the block value has been updated in the block-editor\n * store.\n *\n * @callback onBlockUpdate\n * @param {Object[]} blocks The updated blocks.\n * @param {Object} options The updated block options, such as selectionStart\n * and selectionEnd.\n */\n\n/**\n * useBlockSync is a side effect which handles bidirectional sync between the\n * block-editor store and a controlling data source which provides blocks. This\n * is most commonly used by the BlockEditorProvider to synchronize the contents\n * of the block-editor store with the root entity, like a post.\n *\n * Another example would be the template part block, which provides blocks from\n * a separate entity data source than a root entity. This hook syncs edits to\n * the template part in the block editor back to the entity and vice-versa.\n *\n * Here are some of its basic functions:\n * - Initalizes the block-editor store for the given clientID to the blocks\n * given via props.\n * - Adds incoming changes (like undo) to the block-editor store.\n * - Adds outgoing changes (like editing content) to the controlling entity,\n * determining if a change should be considered persistent or not.\n * - Handles edge cases and race conditions which occur in those operations.\n * - Ignores changes which happen to other entities (like nested inner block\n * controllers.\n * - Passes selection state from the block-editor store to the controlling entity.\n *\n * @param {Object} props Props for the block sync hook\n * @param {string} props.clientId The client ID of the inner block controller.\n * If none is passed, then it is assumed to be a\n * root controller rather than an inner block\n * controller.\n * @param {Object[]} props.value The control value for the blocks. This value\n * is used to initalize the block-editor store\n * and for resetting the blocks to incoming\n * changes like undo.\n * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.\n * @param {onBlockUpdate} props.onChange Function to call when a persistent\n * change has been made in the block-editor blocks\n * for the given clientId. For example, after\n * this function is called, an entity is marked\n * dirty because it has changes to save.\n * @param {onBlockUpdate} props.onInput Function to call when a non-persistent\n * change has been made in the block-editor blocks\n * for the given clientId. When this is called,\n * controlling sources do not become dirty.\n */\nexport default function useBlockSync( {\n\tclientId = null,\n\tvalue: controlledBlocks,\n\tselection: controlledSelection,\n\tonChange = noop,\n\tonInput = noop,\n} ) {\n\tconst registry = useRegistry();\n\n\tconst {\n\t\tresetBlocks,\n\t\tresetSelection,\n\t\treplaceInnerBlocks,\n\t\tsetHasControlledInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = registry.dispatch( blockEditorStore );\n\tconst { getBlockName, getBlocks } = registry.select( blockEditorStore );\n\tconst isControlled = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t! clientId ||\n\t\t\t\tselect( blockEditorStore ).areInnerBlocksControlled( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst pendingChanges = useRef( { incoming: null, outgoing: [] } );\n\tconst subscribed = useRef( false );\n\n\tconst setControlledBlocks = () => {\n\t\tif ( ! controlledBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't need to persist this change because we only replace\n\t\t// controlled inner blocks when the change was caused by an entity,\n\t\t// and so it would already be persisted.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tif ( clientId ) {\n\t\t\t// It is important to batch here because otherwise,\n\t\t\t// as soon as `setHasControlledInnerBlocks` is called\n\t\t\t// the effect to restore might be triggered\n\t\t\t// before the actual blocks get set properly in state.\n\t\t\tregistry.batch( () => {\n\t\t\t\tsetHasControlledInnerBlocks( clientId, true );\n\t\t\t\tconst storeBlocks = controlledBlocks.map( ( block ) =>\n\t\t\t\t\tcloneBlock( block )\n\t\t\t\t);\n\t\t\t\tif ( subscribed.current ) {\n\t\t\t\t\tpendingChanges.current.incoming = storeBlocks;\n\t\t\t\t}\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceInnerBlocks( clientId, storeBlocks );\n\t\t\t} );\n\t\t} else {\n\t\t\tif ( subscribed.current ) {\n\t\t\t\tpendingChanges.current.incoming = controlledBlocks;\n\t\t\t}\n\t\t\tresetBlocks( controlledBlocks );\n\t\t}\n\t};\n\n\t// Add a subscription to the block-editor registry to detect when changes\n\t// have been made. This lets us inform the data source of changes. This\n\t// is an effect so that the subscriber can run synchronously without\n\t// waiting for React renders for changes.\n\tconst onInputRef = useRef( onInput );\n\tconst onChangeRef = useRef( onChange );\n\tuseEffect( () => {\n\t\tonInputRef.current = onInput;\n\t\tonChangeRef.current = onChange;\n\t}, [ onInput, onChange ] );\n\n\t// Determine if blocks need to be reset when they change.\n\tuseEffect( () => {\n\t\tif ( pendingChanges.current.outgoing.includes( controlledBlocks ) ) {\n\t\t\t// Skip block reset if the value matches expected outbound sync\n\t\t\t// triggered by this component by a preceding change detection.\n\t\t\t// Only skip if the value matches expectation, since a reset should\n\t\t\t// still occur if the value is modified (not equal by reference),\n\t\t\t// to allow that the consumer may apply modifications to reflect\n\t\t\t// back on the editor.\n\t\t\tif (\n\t\t\t\tlast( pendingChanges.current.outgoing ) === controlledBlocks\n\t\t\t) {\n\t\t\t\tpendingChanges.current.outgoing = [];\n\t\t\t}\n\t\t} else if ( getBlocks( clientId ) !== controlledBlocks ) {\n\t\t\t// Reset changing value in all other cases than the sync described\n\t\t\t// above. Since this can be reached in an update following an out-\n\t\t\t// bound sync, unset the outbound value to avoid considering it in\n\t\t\t// subsequent renders.\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\n\t\t\tif ( controlledSelection ) {\n\t\t\t\tresetSelection(\n\t\t\t\t\tcontrolledSelection.selectionStart,\n\t\t\t\t\tcontrolledSelection.selectionEnd,\n\t\t\t\t\tcontrolledSelection.initialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}, [ controlledBlocks, clientId ] );\n\n\tuseEffect( () => {\n\t\t// When the block becomes uncontrolled, it means its inner state has been reset\n\t\t// we need to take the blocks again from the external value property.\n\t\tif ( ! isControlled ) {\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\t\t}\n\t}, [ isControlled ] );\n\n\tuseEffect( () => {\n\t\tconst {\n\t\t\tgetSelectionStart,\n\t\t\tgetSelectionEnd,\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisLastBlockChangePersistent,\n\t\t\t__unstableIsLastBlockChangeIgnored,\n\t\t\tareInnerBlocksControlled,\n\t\t} = registry.select( blockEditorStore );\n\n\t\tlet blocks = getBlocks( clientId );\n\t\tlet isPersistent = isLastBlockChangePersistent();\n\t\tlet previousAreBlocksDifferent = false;\n\n\t\tsubscribed.current = true;\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Sometimes, when changing block lists, lingering subscriptions\n\t\t\t// might trigger before they are cleaned up. If the block for which\n\t\t\t// the subscription runs is no longer in the store, this would clear\n\t\t\t// its parent entity's block list. To avoid this, we bail out if\n\t\t\t// the subscription is triggering for a block (`clientId !== null`)\n\t\t\t// and its block name can't be found because it's not on the list.\n\t\t\t// (`getBlockName( clientId ) === null`).\n\t\t\tif ( clientId !== null && getBlockName( clientId ) === null )\n\t\t\t\treturn;\n\n\t\t\t// When RESET_BLOCKS on parent blocks get called, the controlled blocks\n\t\t\t// can reset to uncontrolled, in these situations, it means we need to populate\n\t\t\t// the blocks again from the external blocks (the value property here)\n\t\t\t// and we should stop triggering onChange\n\t\t\tconst isStillControlled =\n\t\t\t\t! clientId || areInnerBlocksControlled( clientId );\n\t\t\tif ( ! isStillControlled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newIsPersistent = isLastBlockChangePersistent();\n\t\t\tconst newBlocks = getBlocks( clientId );\n\t\t\tconst areBlocksDifferent = newBlocks !== blocks;\n\t\t\tblocks = newBlocks;\n\n\t\t\tif (\n\t\t\t\tareBlocksDifferent &&\n\t\t\t\t( pendingChanges.current.incoming ||\n\t\t\t\t\t__unstableIsLastBlockChangeIgnored() )\n\t\t\t) {\n\t\t\t\tpendingChanges.current.incoming = null;\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Since we often dispatch an action to mark the previous action as\n\t\t\t// persistent, we need to make sure that the blocks changed on the\n\t\t\t// previous action before committing the change.\n\t\t\tconst didPersistenceChange =\n\t\t\t\tpreviousAreBlocksDifferent &&\n\t\t\t\t! areBlocksDifferent &&\n\t\t\t\tnewIsPersistent &&\n\t\t\t\t! isPersistent;\n\n\t\t\tif ( areBlocksDifferent || didPersistenceChange ) {\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\t// We know that onChange/onInput will update controlledBlocks.\n\t\t\t\t// We need to be aware that it was caused by an outgoing change\n\t\t\t\t// so that we do not treat it as an incoming change later on,\n\t\t\t\t// which would cause a block reset.\n\t\t\t\tpendingChanges.current.outgoing.push( blocks );\n\n\t\t\t\t// Inform the controlling entity that changes have been made to\n\t\t\t\t// the block-editor store they should be aware about.\n\t\t\t\tconst updateParent = isPersistent\n\t\t\t\t\t? onChangeRef.current\n\t\t\t\t\t: onInputRef.current;\n\t\t\t\tupdateParent( blocks, {\n\t\t\t\t\tselection: {\n\t\t\t\t\t\tselectionStart: getSelectionStart(),\n\t\t\t\t\t\tselectionEnd: getSelectionEnd(),\n\t\t\t\t\t\tinitialPosition: getSelectedBlocksInitialCaretPosition(),\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t\tpreviousAreBlocksDifferent = areBlocksDifferent;\n\t\t} );\n\n\t\treturn () => unsubscribe();\n\t}, [ registry, clientId ] );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/provider/use-block-sync.js"],"names":["noop","useBlockSync","clientId","value","controlledBlocks","selection","controlledSelection","onChange","onInput","registry","resetBlocks","resetSelection","replaceInnerBlocks","setHasControlledInnerBlocks","__unstableMarkNextChangeAsNotPersistent","dispatch","blockEditorStore","getBlockName","getBlocks","select","isControlled","areInnerBlocksControlled","pendingChanges","incoming","outgoing","subscribed","setControlledBlocks","batch","storeBlocks","map","block","current","onInputRef","onChangeRef","includes","selectionStart","selectionEnd","initialPosition","getSelectionStart","getSelectionEnd","getSelectedBlocksInitialCaretPosition","isLastBlockChangePersistent","__unstableIsLastBlockChangeIgnored","blocks","isPersistent","previousAreBlocksDifferent","unsubscribe","subscribe","isStillControlled","newIsPersistent","newBlocks","areBlocksDifferent","didPersistenceChange","push","updateParent"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAGA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;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last } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\n/**\n * A function to call when the block value has been updated in the block-editor\n * store.\n *\n * @callback onBlockUpdate\n * @param {Object[]} blocks The updated blocks.\n * @param {Object} options The updated block options, such as selectionStart\n * and selectionEnd.\n */\n\n/**\n * useBlockSync is a side effect which handles bidirectional sync between the\n * block-editor store and a controlling data source which provides blocks. This\n * is most commonly used by the BlockEditorProvider to synchronize the contents\n * of the block-editor store with the root entity, like a post.\n *\n * Another example would be the template part block, which provides blocks from\n * a separate entity data source than a root entity. This hook syncs edits to\n * the template part in the block editor back to the entity and vice-versa.\n *\n * Here are some of its basic functions:\n * - Initalizes the block-editor store for the given clientID to the blocks\n * given via props.\n * - Adds incoming changes (like undo) to the block-editor store.\n * - Adds outgoing changes (like editing content) to the controlling entity,\n * determining if a change should be considered persistent or not.\n * - Handles edge cases and race conditions which occur in those operations.\n * - Ignores changes which happen to other entities (like nested inner block\n * controllers.\n * - Passes selection state from the block-editor store to the controlling entity.\n *\n * @param {Object} props Props for the block sync hook\n * @param {string} props.clientId The client ID of the inner block controller.\n * If none is passed, then it is assumed to be a\n * root controller rather than an inner block\n * controller.\n * @param {Object[]} props.value The control value for the blocks. This value\n * is used to initalize the block-editor store\n * and for resetting the blocks to incoming\n * changes like undo.\n * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.\n * @param {onBlockUpdate} props.onChange Function to call when a persistent\n * change has been made in the block-editor blocks\n * for the given clientId. For example, after\n * this function is called, an entity is marked\n * dirty because it has changes to save.\n * @param {onBlockUpdate} props.onInput Function to call when a non-persistent\n * change has been made in the block-editor blocks\n * for the given clientId. When this is called,\n * controlling sources do not become dirty.\n */\nexport default function useBlockSync( {\n\tclientId = null,\n\tvalue: controlledBlocks,\n\tselection: controlledSelection,\n\tonChange = noop,\n\tonInput = noop,\n} ) {\n\tconst registry = useRegistry();\n\n\tconst {\n\t\tresetBlocks,\n\t\tresetSelection,\n\t\treplaceInnerBlocks,\n\t\tsetHasControlledInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = registry.dispatch( blockEditorStore );\n\tconst { getBlockName, getBlocks } = registry.select( blockEditorStore );\n\tconst isControlled = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\t! clientId ||\n\t\t\t\tselect( blockEditorStore ).areInnerBlocksControlled( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst pendingChanges = useRef( { incoming: null, outgoing: [] } );\n\tconst subscribed = useRef( false );\n\n\tconst setControlledBlocks = () => {\n\t\tif ( ! controlledBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't need to persist this change because we only replace\n\t\t// controlled inner blocks when the change was caused by an entity,\n\t\t// and so it would already be persisted.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tif ( clientId ) {\n\t\t\t// It is important to batch here because otherwise,\n\t\t\t// as soon as `setHasControlledInnerBlocks` is called\n\t\t\t// the effect to restore might be triggered\n\t\t\t// before the actual blocks get set properly in state.\n\t\t\tregistry.batch( () => {\n\t\t\t\tsetHasControlledInnerBlocks( clientId, true );\n\t\t\t\tconst storeBlocks = controlledBlocks.map( ( block ) =>\n\t\t\t\t\tcloneBlock( block )\n\t\t\t\t);\n\t\t\t\tif ( subscribed.current ) {\n\t\t\t\t\tpendingChanges.current.incoming = storeBlocks;\n\t\t\t\t}\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceInnerBlocks( clientId, storeBlocks );\n\t\t\t} );\n\t\t} else {\n\t\t\tif ( subscribed.current ) {\n\t\t\t\tpendingChanges.current.incoming = controlledBlocks;\n\t\t\t}\n\t\t\tresetBlocks( controlledBlocks );\n\t\t}\n\t};\n\n\t// Add a subscription to the block-editor registry to detect when changes\n\t// have been made. This lets us inform the data source of changes. This\n\t// is an effect so that the subscriber can run synchronously without\n\t// waiting for React renders for changes.\n\tconst onInputRef = useRef( onInput );\n\tconst onChangeRef = useRef( onChange );\n\tuseEffect( () => {\n\t\tonInputRef.current = onInput;\n\t\tonChangeRef.current = onChange;\n\t}, [ onInput, onChange ] );\n\n\t// Determine if blocks need to be reset when they change.\n\tuseEffect( () => {\n\t\tif ( pendingChanges.current.outgoing.includes( controlledBlocks ) ) {\n\t\t\t// Skip block reset if the value matches expected outbound sync\n\t\t\t// triggered by this component by a preceding change detection.\n\t\t\t// Only skip if the value matches expectation, since a reset should\n\t\t\t// still occur if the value is modified (not equal by reference),\n\t\t\t// to allow that the consumer may apply modifications to reflect\n\t\t\t// back on the editor.\n\t\t\tif (\n\t\t\t\tlast( pendingChanges.current.outgoing ) === controlledBlocks\n\t\t\t) {\n\t\t\t\tpendingChanges.current.outgoing = [];\n\t\t\t}\n\t\t} else if ( getBlocks( clientId ) !== controlledBlocks ) {\n\t\t\t// Reset changing value in all other cases than the sync described\n\t\t\t// above. Since this can be reached in an update following an out-\n\t\t\t// bound sync, unset the outbound value to avoid considering it in\n\t\t\t// subsequent renders.\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\n\t\t\tif ( controlledSelection ) {\n\t\t\t\tresetSelection(\n\t\t\t\t\tcontrolledSelection.selectionStart,\n\t\t\t\t\tcontrolledSelection.selectionEnd,\n\t\t\t\t\tcontrolledSelection.initialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}, [ controlledBlocks, clientId ] );\n\n\tuseEffect( () => {\n\t\t// When the block becomes uncontrolled, it means its inner state has been reset\n\t\t// we need to take the blocks again from the external value property.\n\t\tif ( ! isControlled ) {\n\t\t\tpendingChanges.current.outgoing = [];\n\t\t\tsetControlledBlocks();\n\t\t}\n\t}, [ isControlled ] );\n\n\tuseEffect( () => {\n\t\tconst {\n\t\t\tgetSelectionStart,\n\t\t\tgetSelectionEnd,\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisLastBlockChangePersistent,\n\t\t\t__unstableIsLastBlockChangeIgnored,\n\t\t\tareInnerBlocksControlled,\n\t\t} = registry.select( blockEditorStore );\n\n\t\tlet blocks = getBlocks( clientId );\n\t\tlet isPersistent = isLastBlockChangePersistent();\n\t\tlet previousAreBlocksDifferent = false;\n\n\t\tsubscribed.current = true;\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Sometimes, when changing block lists, lingering subscriptions\n\t\t\t// might trigger before they are cleaned up. If the block for which\n\t\t\t// the subscription runs is no longer in the store, this would clear\n\t\t\t// its parent entity's block list. To avoid this, we bail out if\n\t\t\t// the subscription is triggering for a block (`clientId !== null`)\n\t\t\t// and its block name can't be found because it's not on the list.\n\t\t\t// (`getBlockName( clientId ) === null`).\n\t\t\tif ( clientId !== null && getBlockName( clientId ) === null )\n\t\t\t\treturn;\n\n\t\t\t// When RESET_BLOCKS on parent blocks get called, the controlled blocks\n\t\t\t// can reset to uncontrolled, in these situations, it means we need to populate\n\t\t\t// the blocks again from the external blocks (the value property here)\n\t\t\t// and we should stop triggering onChange\n\t\t\tconst isStillControlled =\n\t\t\t\t! clientId || areInnerBlocksControlled( clientId );\n\t\t\tif ( ! isStillControlled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newIsPersistent = isLastBlockChangePersistent();\n\t\t\tconst newBlocks = getBlocks( clientId );\n\t\t\tconst areBlocksDifferent = newBlocks !== blocks;\n\t\t\tblocks = newBlocks;\n\n\t\t\tif (\n\t\t\t\tareBlocksDifferent &&\n\t\t\t\t( pendingChanges.current.incoming ||\n\t\t\t\t\t__unstableIsLastBlockChangeIgnored() )\n\t\t\t) {\n\t\t\t\tpendingChanges.current.incoming = null;\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Since we often dispatch an action to mark the previous action as\n\t\t\t// persistent, we need to make sure that the blocks changed on the\n\t\t\t// previous action before committing the change.\n\t\t\tconst didPersistenceChange =\n\t\t\t\tpreviousAreBlocksDifferent &&\n\t\t\t\t! areBlocksDifferent &&\n\t\t\t\tnewIsPersistent &&\n\t\t\t\t! isPersistent;\n\n\t\t\tif ( areBlocksDifferent || didPersistenceChange ) {\n\t\t\t\tisPersistent = newIsPersistent;\n\t\t\t\t// We know that onChange/onInput will update controlledBlocks.\n\t\t\t\t// We need to be aware that it was caused by an outgoing change\n\t\t\t\t// so that we do not treat it as an incoming change later on,\n\t\t\t\t// which would cause a block reset.\n\t\t\t\tpendingChanges.current.outgoing.push( blocks );\n\n\t\t\t\t// Inform the controlling entity that changes have been made to\n\t\t\t\t// the block-editor store they should be aware about.\n\t\t\t\tconst updateParent = isPersistent\n\t\t\t\t\t? onChangeRef.current\n\t\t\t\t\t: onInputRef.current;\n\t\t\t\tupdateParent( blocks, {\n\t\t\t\t\tselection: {\n\t\t\t\t\t\tselectionStart: getSelectionStart(),\n\t\t\t\t\t\tselectionEnd: getSelectionEnd(),\n\t\t\t\t\t\tinitialPosition:\n\t\t\t\t\t\t\tgetSelectedBlocksInitialCaretPosition(),\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t\tpreviousAreBlocksDifferent = areBlocksDifferent;\n\t\t} );\n\n\t\treturn () => unsubscribe();\n\t}, [ registry, clientId ] );\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _components = require("@wordpress/components");
|
|
15
|
+
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
18
|
+
var _date = require("@wordpress/date");
|
|
19
|
+
|
|
20
|
+
var _inspectorPopoverHeader = _interopRequireDefault(require("../inspector-popover-header"));
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Internal dependencies
|
|
28
|
+
*/
|
|
29
|
+
function PublishDateTimePicker(_ref, ref) {
|
|
30
|
+
let {
|
|
31
|
+
onClose,
|
|
32
|
+
onChange,
|
|
33
|
+
...additionalProps
|
|
34
|
+
} = _ref;
|
|
35
|
+
return (0, _element.createElement)("div", {
|
|
36
|
+
ref: ref,
|
|
37
|
+
className: "block-editor-publish-date-time-picker"
|
|
38
|
+
}, (0, _element.createElement)(_inspectorPopoverHeader.default, {
|
|
39
|
+
title: (0, _i18n.__)('Publish'),
|
|
40
|
+
actions: [{
|
|
41
|
+
label: (0, _i18n.__)('Now'),
|
|
42
|
+
onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange(null)
|
|
43
|
+
}],
|
|
44
|
+
onClose: onClose
|
|
45
|
+
}), (0, _element.createElement)(_components.DateTimePicker, (0, _extends2.default)({
|
|
46
|
+
startOfWeek: (0, _date.__experimentalGetSettings)().l10n.startOfWeek,
|
|
47
|
+
__nextRemoveHelpButton: true,
|
|
48
|
+
__nextRemoveResetButton: true,
|
|
49
|
+
onChange: onChange
|
|
50
|
+
}, additionalProps)));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var _default = (0, _element.forwardRef)(PublishDateTimePicker);
|
|
54
|
+
|
|
55
|
+
exports.default = _default;
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/publish-date-time-picker/index.js"],"names":["PublishDateTimePicker","ref","onClose","onChange","additionalProps","label","onClick","l10n","startOfWeek"],"mappings":";;;;;;;;;AAKA;;;;AAFA;;AACA;;AAEA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,qBAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqB,OAAGC;AAAxB,GAEC;AACD,SACC;AAAK,IAAA,GAAG,EAAGH,GAAX;AAAiB,IAAA,SAAS,EAAC;AAA3B,KACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAG,cAAI,SAAJ,CADT;AAEC,IAAA,OAAO,EAAG,CACT;AACCI,MAAAA,KAAK,EAAE,cAAI,KAAJ,CADR;AAECC,MAAAA,OAAO,EAAE,MAAMH,QAAN,aAAMA,QAAN,uBAAMA,QAAQ,CAAI,IAAJ;AAFxB,KADS,CAFX;AAQC,IAAA,OAAO,EAAGD;AARX,IADD,EAWC,4BAAC,0BAAD;AACC,IAAA,WAAW,EAAG,uCAAcK,IAAd,CAAmBC,WADlC;AAEC,IAAA,sBAAsB,MAFvB;AAGC,IAAA,uBAAuB,MAHxB;AAIC,IAAA,QAAQ,EAAGL;AAJZ,KAKMC,eALN,EAXD,CADD;AAqBA;;eAEc,yBAAYJ,qBAAZ,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DateTimePicker } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef } from '@wordpress/element';\nimport { __experimentalGetSettings as getSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport InspectorPopoverHeader from '../inspector-popover-header';\n\nfunction PublishDateTimePicker(\n\t{ onClose, onChange, ...additionalProps },\n\tref\n) {\n\treturn (\n\t\t<div ref={ ref } className=\"block-editor-publish-date-time-picker\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Publish' ) }\n\t\t\t\tactions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Now' ),\n\t\t\t\t\t\tonClick: () => onChange?.( null ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<DateTimePicker\n\t\t\t\tstartOfWeek={ getSettings().l10n.startOfWeek }\n\t\t\t\t__nextRemoveHelpButton\n\t\t\t\t__nextRemoveResetButton\n\t\t\t\tonChange={ onChange }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( PublishDateTimePicker );\n"]}
|
|
@@ -7,29 +7,25 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
-
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
10
|
var _components = require("@wordpress/components");
|
|
13
11
|
|
|
14
12
|
var _i18n = require("@wordpress/i18n");
|
|
15
13
|
|
|
16
|
-
/**
|
|
17
|
-
* External dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
14
|
/**
|
|
21
15
|
* WordPress dependencies
|
|
22
16
|
*/
|
|
17
|
+
const noop = () => {};
|
|
18
|
+
|
|
23
19
|
const DEFAULT_PICKER_OPTIONS = [{
|
|
24
20
|
id: 'createEmbed',
|
|
25
21
|
label: (0, _i18n.__)('Create embed'),
|
|
26
22
|
value: 'createEmbed',
|
|
27
|
-
onSelect:
|
|
23
|
+
onSelect: noop
|
|
28
24
|
}, {
|
|
29
25
|
id: 'createLink',
|
|
30
26
|
label: (0, _i18n.__)('Create link'),
|
|
31
27
|
value: 'createLink',
|
|
32
|
-
onSelect:
|
|
28
|
+
onSelect: noop
|
|
33
29
|
}];
|
|
34
30
|
const EmbedHandlerPicker = (0, _element.forwardRef)((_ref, ref) => {
|
|
35
31
|
let {} = _ref;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/embed-handler-picker.native.js"],"names":["DEFAULT_PICKER_OPTIONS","id","label","value","onSelect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/embed-handler-picker.native.js"],"names":["noop","DEFAULT_PICKER_OPTIONS","id","label","value","onSelect","EmbedHandlerPicker","ref","pickerRef","pickerOptions","current","onPickerSelect","selectedItem","find","item","presentPicker","createEmbed","createLink"],"mappings":";;;;;;;AAGA;;AAOA;;AACA;;AAXA;AACA;AACA;AAWA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,sBAAsB,GAAG,CAC9B;AACCC,EAAAA,EAAE,EAAE,aADL;AAECC,EAAAA,KAAK,EAAE,cAAI,cAAJ,CAFR;AAGCC,EAAAA,KAAK,EAAE,aAHR;AAICC,EAAAA,QAAQ,EAAEL;AAJX,CAD8B,EAO9B;AACCE,EAAAA,EAAE,EAAE,YADL;AAECC,EAAAA,KAAK,EAAE,cAAI,aAAJ,CAFR;AAGCC,EAAAA,KAAK,EAAE,YAHR;AAICC,EAAAA,QAAQ,EAAEL;AAJX,CAP8B,CAA/B;AAeA,MAAMM,kBAAkB,GAAG,yBAAY,OAAMC,GAAN,KAAe;AAAA,MAAb,EAAa;AACrD,QAAMC,SAAS,GAAG,sBAAlB;AACA,QAAMC,aAAa,GAAG,qBAAQR,sBAAR,EAAiCS,OAAvD;AAEA,QAAMC,cAAc,GAAG,0BACpBP,KAAF,IAAa;AACZ,UAAMQ,YAAY,GAAGH,aAAa,CAACI,IAAd,CAClBC,IAAF,IAAYA,IAAI,CAACV,KAAL,KAAeA,KADP,CAArB;AAGAQ,IAAAA,YAAY,CAACP,QAAb;AACA,GANqB,EAOtB,CAAEI,aAAF,CAPsB,CAAvB;AAUA,oCAAqBF,GAArB,EAA0B,OAAQ;AACjCQ,IAAAA,aAAa,EAAE,SAAmC;AAAA;;AAAA,UAAjC;AAAEC,QAAAA,WAAF;AAAeC,QAAAA;AAAf,OAAiC;AACjDR,MAAAA,aAAa,CAAE,CAAF,CAAb,CAAmBJ,QAAnB,GAA8BW,WAA9B;AACAP,MAAAA,aAAa,CAAE,CAAF,CAAb,CAAmBJ,QAAnB,GAA8BY,UAA9B;AACA,4BAAAT,SAAS,CAACE,OAAV,0EAAmBK,aAAnB;AACA;AALgC,GAAR,CAA1B;AAQA,SACC,4BAAC,kBAAD;AACC,IAAA,GAAG,EAAGP,SADP;AAEC,IAAA,OAAO,EAAGC,aAFX;AAGC,IAAA,QAAQ,EAAGE,cAHZ;AAIC,IAAA,MAAM,EAAC,sBAJR;AAKC,IAAA,gBAAgB,MALjB;AAMC,IAAA,SAAS;AANV,IADD;AAUA,CAhC0B,CAA3B;;eAkCe,mBAAML,kBAAN,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseRef,\n\tuseImperativeHandle,\n\tmemo,\n\tuseCallback,\n} from '@wordpress/element';\nimport { Picker } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst noop = () => {};\n\nconst DEFAULT_PICKER_OPTIONS = [\n\t{\n\t\tid: 'createEmbed',\n\t\tlabel: __( 'Create embed' ),\n\t\tvalue: 'createEmbed',\n\t\tonSelect: noop,\n\t},\n\t{\n\t\tid: 'createLink',\n\t\tlabel: __( 'Create link' ),\n\t\tvalue: 'createLink',\n\t\tonSelect: noop,\n\t},\n];\n\nconst EmbedHandlerPicker = forwardRef( ( {}, ref ) => {\n\tconst pickerRef = useRef();\n\tconst pickerOptions = useRef( DEFAULT_PICKER_OPTIONS ).current;\n\n\tconst onPickerSelect = useCallback(\n\t\t( value ) => {\n\t\t\tconst selectedItem = pickerOptions.find(\n\t\t\t\t( item ) => item.value === value\n\t\t\t);\n\t\t\tselectedItem.onSelect();\n\t\t},\n\t\t[ pickerOptions ]\n\t);\n\n\tuseImperativeHandle( ref, () => ( {\n\t\tpresentPicker: ( { createEmbed, createLink } ) => {\n\t\t\tpickerOptions[ 0 ].onSelect = createEmbed;\n\t\t\tpickerOptions[ 1 ].onSelect = createLink;\n\t\t\tpickerRef.current?.presentPicker();\n\t\t},\n\t} ) );\n\n\treturn (\n\t\t<Picker\n\t\t\tref={ pickerRef }\n\t\t\toptions={ pickerOptions }\n\t\t\tonChange={ onPickerSelect }\n\t\t\ttestID=\"embed-handler-picker\"\n\t\t\thideCancelButton\n\t\t\tleftAlign\n\t\t/>\n\t);\n} );\n\nexport default memo( EmbedHandlerPicker );\n"]}
|
|
@@ -111,7 +111,7 @@ const inputEventContext = (0, _element.createContext)();
|
|
|
111
111
|
exports.inputEventContext = inputEventContext;
|
|
112
112
|
|
|
113
113
|
function removeNativeProps(props) {
|
|
114
|
-
return (0, _lodash.omit)(props, ['__unstableMobileNoFocusOnMount', 'deleteEnter', 'placeholderTextColor', 'textAlign', 'selectionColor', 'tagsToEliminate', 'rootTagsToEliminate', 'disableEditingMenu', 'fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'minWidth', 'maxWidth', 'setRef']);
|
|
114
|
+
return (0, _lodash.omit)(props, ['__unstableMobileNoFocusOnMount', 'deleteEnter', 'placeholderTextColor', 'textAlign', 'selectionColor', 'tagsToEliminate', 'rootTagsToEliminate', 'disableEditingMenu', 'fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'minWidth', 'maxWidth', 'setRef', 'disableSuggestions', 'disableAutocorrection']);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
function RichTextWrapper(_ref, forwardedRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/index.js"],"names":["keyboardShortcutContext","inputEventContext","removeNativeProps","props","RichTextWrapper","forwardedRef","children","tagName","value","originalValue","onChange","originalOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","formattingControls","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitMiddle","onSplitMiddle","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","unstableOnFocus","__unstableAllowPrefixTransformations","instanceId","anchorRef","clientId","selector","select","getSelectionStart","getSelectionEnd","blockEditorStore","selectionStart","selectionEnd","undefined","attributeKey","offset","selectionChange","multilineTag","adjustedAllowedFormats","hasFormats","length","adjustedValue","adjustedOnChange","Array","isArray","childrenSource","toHTML","newValue","fromDOM","document","childNodes","onSelectionChange","start","end","selection","unset","formatTypes","prepareHandlers","valueHandlers","changeHandlers","dependencies","addEditorOnlyFormats","reduce","accumulator","fn","text","formats","removeEditorOnlyFormats","forEach","formatType","__experimentalCreatePrepareEditableTree","name","addInvisibleFormats","ref","richTextRef","html","__unstableFormats","__unstableText","Object","values","changeHandler","__unstableIsSelected","__unstableMultilineTag","__unstableDependencies","__unstableAfterParse","__unstableBeforeSerialize","__unstableAddInvisibleFormats","autocompleteProps","completers","record","keyboardShortcuts","Set","inputEvents","onKeyDown","event","keyCode","defaultPrevented","DELETE","BACKSPACE","isReverse","hasActiveFormats","activeFormats","preventDefault","onFocus","current","focus","TagName","content","className","since","alternative","version","ForwardedRichTextContainer","Content","Tag","MultilineTag","isEmpty"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;;;AANA;;AACA;;AAYA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA2ZA;;AACA;;AACA;;AA7cA;AACA;AACA;;AAIA;AACA;AACA;;AAsBA;AACA;AACA;AAkBO,MAAMA,uBAAuB,GAAG,6BAAhC;;AACA,MAAMC,iBAAiB,GAAG,6BAA1B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASC,iBAAT,CAA4BC,KAA5B,EAAoC;AACnC,SAAO,kBAAMA,KAAN,EAAa,CACnB,gCADmB,EAEnB,aAFmB,EAGnB,sBAHmB,EAInB,WAJmB,EAKnB,gBALmB,EAMnB,iBANmB,EA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CAACI,OAA3B,GAAuC7H,KAAF,IAAa;AACjD,SAAO,CAAEA,KAAF,IAAWA,KAAK,CAACiD,MAAN,KAAiB,CAAnC;AACA,CAFD;AAIA;AACA;AACA;;;eACewE,0B","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRawHTML,\n\tuseRef,\n\tuseCallback,\n\tforwardRef,\n\tcreateContext,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { children as childrenSource } from '@wordpress/blocks';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\nimport {\n\t__unstableUseRichText as useRichText,\n\t__unstableCreateElement,\n\tisEmpty,\n\tisCollapsed,\n\tremoveFormat,\n} from '@wordpress/rich-text';\nimport deprecated from '@wordpress/deprecated';\nimport { BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { Popover } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useUndoAutomaticChange } from './use-undo-automatic-change';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { usePasteHandler } from './use-paste-handler';\nimport { useInputRules } from './use-input-rules';\nimport { useEnter } from './use-enter';\nimport { useFormatTypes } from './use-format-types';\nimport { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';\nimport { useShortcuts } from './use-shortcuts';\nimport { useInputEvents } from './use-input-events';\nimport { useFirefoxCompat } from './use-firefox-compat';\nimport FormatEdit from './format-edit';\nimport { getMultilineTag, getAllowedFormats } from './utils';\n\nexport const keyboardShortcutContext = createContext();\nexport const inputEventContext = createContext();\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\treturn omit( props, [\n\t\t'__unstableMobileNoFocusOnMount',\n\t\t'deleteEnter',\n\t\t'placeholderTextColor',\n\t\t'textAlign',\n\t\t'selectionColor',\n\t\t'tagsToEliminate',\n\t\t'rootTagsToEliminate',\n\t\t'disableEditingMenu',\n\t\t'fontSize',\n\t\t'fontFamily',\n\t\t'fontWeight',\n\t\t'fontStyle',\n\t\t'minWidth',\n\t\t'maxWidth',\n\t\t'setRef',\n\t] );\n}\n\nfunction RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: originalValue = '',\n\t\tonChange: originalOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\tformattingControls,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitMiddle: onSplitMiddle,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\tunstableOnFocus,\n\t\t__unstableAllowPrefixTransformations,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tconst instanceId = useInstanceId( RichTextWrapper );\n\n\tidentifier = identifier || instanceId;\n\tprops = removeNativeProps( props );\n\n\tconst anchorRef = useRef();\n\tconst { clientId } = useBlockEditContext();\n\tconst selector = ( select ) => {\n\t\tconst { getSelectionStart, getSelectionEnd } = select(\n\t\t\tblockEditorStore\n\t\t);\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\treturn {\n\t\t\tselectionStart: isSelected ? selectionStart.offset : undefined,\n\t\t\tselectionEnd: isSelected ? selectionEnd.offset : undefined,\n\t\t\tisSelected,\n\t\t};\n\t};\n\t// This selector must run on every render so the right selection state is\n\t// retreived from the store on merge.\n\t// To do: fix this somehow.\n\tconst { selectionStart, selectionEnd, isSelected } = useSelect( selector );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst multilineTag = getMultilineTag( multiline );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tformattingControls,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\tlet adjustedValue = originalValue;\n\tlet adjustedOnChange = originalOnChange;\n\n\t// Handle deprecated format.\n\tif ( Array.isArray( originalValue ) ) {\n\t\tadjustedValue = childrenSource.toHTML( originalValue );\n\t\tadjustedOnChange = ( newValue ) =>\n\t\t\toriginalOnChange(\n\t\t\t\tchildrenSource.fromDOM(\n\t\t\t\t\t__unstableCreateElement( document, newValue ).childNodes\n\t\t\t\t)\n\t\t\t);\n\t}\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\tselection.start = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tselection.end = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst {\n\t\tformatTypes,\n\t\tprepareHandlers,\n\t\tvalueHandlers,\n\t\tchangeHandlers,\n\t\tdependencies,\n\t} = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats: adjustedAllowedFormats,\n\t} );\n\n\tfunction addEditorOnlyFormats( value ) {\n\t\treturn valueHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tfunction removeEditorOnlyFormats( value ) {\n\t\tformatTypes.forEach( ( formatType ) => {\n\t\t\t// Remove formats created by prepareEditableTree, because they are editor only.\n\t\t\tif ( formatType.__experimentalCreatePrepareEditableTree ) {\n\t\t\t\tvalue = removeFormat(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformatType.name,\n\t\t\t\t\t0,\n\t\t\t\t\tvalue.text.length\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn value.formats;\n\t}\n\n\tfunction addInvisibleFormats( value ) {\n\t\treturn prepareHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tconst { value, onChange, ref: richTextRef } = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange( html, { __unstableFormats, __unstableText } ) {\n\t\t\tadjustedOnChange( html );\n\t\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\t\tchangeHandler( __unstableFormats, __unstableText );\n\t\t\t} );\n\t\t},\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableMultilineTag: multilineTag,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ ...dependencies, tagName ],\n\t\t__unstableAfterParse: addEditorOnlyFormats,\n\t\t__unstableBeforeSerialize: removeEditorOnlyFormats,\n\t\t__unstableAddInvisibleFormats: addInvisibleFormats,\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onKeyDown( event ) {\n\t\tconst { keyCode } = event;\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( keyCode === DELETE || keyCode === BACKSPACE ) {\n\t\t\tconst { start, end, text } = value;\n\t\t\tconst isReverse = keyCode === BACKSPACE;\n\t\t\tconst hasActiveFormats =\n\t\t\t\tvalue.activeFormats && !! value.activeFormats.length;\n\n\t\t\t// Only process delete if the key press occurs at an uncollapsed edge.\n\t\t\tif (\n\t\t\t\t! isCollapsed( value ) ||\n\t\t\t\thasActiveFormats ||\n\t\t\t\t( isReverse && start !== 0 ) ||\n\t\t\t\t( ! isReverse && end !== text.length )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( onMerge ) {\n\t\t\t\tonMerge( ! isReverse );\n\t\t\t}\n\n\t\t\t// Only handle remove on Backspace. This serves dual-purpose of being\n\t\t\t// an intentional user interaction distinguishing between Backspace and\n\t\t\t// Delete to remove the empty field, but also to avoid merge & remove\n\t\t\t// causing destruction of two fields (merge, then removed merged).\n\t\t\tif ( onRemove && isEmpty( value ) && isReverse ) {\n\t\t\t\tonRemove( ! isReverse );\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n\n\tfunction onFocus() {\n\t\tanchorRef.current.focus();\n\t}\n\n\tconst TagName = tagName;\n\tconst content = (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\tanchorRef={ anchorRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-label={ placeholder }\n\t\t\t\t{ ...props }\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tuseInputRules( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseRemoveBrowserShortcuts(),\n\t\t\t\t\tuseShortcuts( keyboardShortcuts ),\n\t\t\t\t\tuseInputEvents( inputEvents ),\n\t\t\t\t\tuseUndoAutomaticChange(),\n\t\t\t\t\tusePasteHandler( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonSplitMiddle,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseEnter( {\n\t\t\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonSplitMiddle,\n\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseFirefoxCompat(),\n\t\t\t\t\tanchorRef,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ true }\n\t\t\t\tsuppressContentEditableWarning={ true }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\tonFocus={ unstableOnFocus }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t/>\n\t\t</>\n\t);\n\n\tif ( ! wrapperClassName ) {\n\t\treturn content;\n\t}\n\n\tdeprecated( 'wp.blockEditor.RichText wrapperClassName prop', {\n\t\tsince: '5.4',\n\t\talternative: 'className prop or create your own wrapper div',\n\t\tversion: '6.2',\n\t} );\n\n\tconst className = classnames( 'block-editor-rich-text', wrapperClassName );\n\treturn <div className={ className }>{ content }</div>;\n}\n\nconst ForwardedRichTextContainer = forwardRef( RichTextWrapper );\n\nForwardedRichTextContainer.Content = ( {\n\tvalue,\n\ttagName: Tag,\n\tmultiline,\n\t...props\n} ) => {\n\t// Handle deprecated `children` and `node` sources.\n\tif ( Array.isArray( value ) ) {\n\t\tvalue = childrenSource.toHTML( value );\n\t}\n\n\tconst MultilineTag = getMultilineTag( multiline );\n\n\tif ( ! value && MultilineTag ) {\n\t\tvalue = `<${ MultilineTag }></${ MultilineTag }>`;\n\t}\n\n\tconst content = <RawHTML>{ value }</RawHTML>;\n\n\tif ( Tag ) {\n\t\treturn <Tag { ...omit( props, [ 'format' ] ) }>{ content }</Tag>;\n\t}\n\n\treturn content;\n};\n\nForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nexport default ForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { __unstableRichTextInputEvent } from './input-event';\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/index.js"],"names":["keyboardShortcutContext","inputEventContext","removeNativeProps","props","RichTextWrapper","forwardedRef","children","tagName","value","originalValue","onChange","originalOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","formattingControls","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitMiddle","onSplitMiddle","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","unstableOnFocus","__unstableAllowPrefixTransformations","instanceId","anchorRef","clientId","selector","select","getSelectionStart","getSelectionEnd","blockEditorStore","selectionStart","selectionEnd","undefined","attributeKey","offset","selectionChange","multilineTag","adjustedAllowedFormats","hasFormats","length","adjustedValue","adjustedOnChange","Array","isArray","childrenSource","toHTML","newValue","fromDOM","document","childNodes","onSelectionChange","start","end","selection","unset","formatTypes","prepareHandlers","valueHandlers","changeHandlers","dependencies","addEditorOnlyFormats","reduce","accumulator","fn","text","formats","removeEditorOnlyFormats","forEach","formatType","__experimentalCreatePrepareEditableTree","name","addInvisibleFormats","ref","richTextRef","html","__unstableFormats","__unstableText","Object","values","changeHandler","__unstableIsSelected","__unstableMultilineTag","__unstableDependencies","__unstableAfterParse","__unstableBeforeSerialize","__unstableAddInvisibleFormats","autocompleteProps","completers","record","keyboardShortcuts","Set","inputEvents","onKeyDown","event","keyCode","defaultPrevented","DELETE","BACKSPACE","isReverse","hasActiveFormats","activeFormats","preventDefault","onFocus","current","focus","TagName","content","className","since","alternative","version","ForwardedRichTextContainer","Content","Tag","MultilineTag","isEmpty"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;;;AANA;;AACA;;AAYA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAgaA;;AACA;;AACA;;AAldA;AACA;AACA;;AAIA;AACA;AACA;;AAsBA;AACA;AACA;AAkBO,MAAMA,uBAAuB,GAAG,6BAAhC;;AACA,MAAMC,iBAAiB,GAAG,6BAA1B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASC,iBAAT,CAA4BC,KAA5B,EAAoC;AACnC,SAAO,kBAAMA,KAAN,EAAa,CACnB,gCADmB,EAEnB,aAFmB,EAGnB,sBAHmB,EAInB,WAJmB,EAKnB,gBALmB,EAMnB,iBANmB,EAOnB,qBAPmB,EAQnB,oBARmB,EASnB,UATmB,EAUnB,YAVmB,EAWnB,YAXmB,EAYnB,WAZmB,EAanB,UAbmB,EAcnB,UAdmB,EAenB,QAfmB,EAgBnB,oBAhBmB,EAiBnB,uBAjBmB,CAAb,CAAP;AAmBA;;AAED,SAASC,eAAT,O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 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRawHTML,\n\tuseRef,\n\tuseCallback,\n\tforwardRef,\n\tcreateContext,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { children as childrenSource } from '@wordpress/blocks';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\nimport {\n\t__unstableUseRichText as useRichText,\n\t__unstableCreateElement,\n\tisEmpty,\n\tisCollapsed,\n\tremoveFormat,\n} from '@wordpress/rich-text';\nimport deprecated from '@wordpress/deprecated';\nimport { BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { Popover } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useUndoAutomaticChange } from './use-undo-automatic-change';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { usePasteHandler } from './use-paste-handler';\nimport { useInputRules } from './use-input-rules';\nimport { useEnter } from './use-enter';\nimport { useFormatTypes } from './use-format-types';\nimport { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';\nimport { useShortcuts } from './use-shortcuts';\nimport { useInputEvents } from './use-input-events';\nimport { useFirefoxCompat } from './use-firefox-compat';\nimport FormatEdit from './format-edit';\nimport { getMultilineTag, getAllowedFormats } from './utils';\n\nexport const keyboardShortcutContext = createContext();\nexport const inputEventContext = createContext();\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\treturn omit( props, [\n\t\t'__unstableMobileNoFocusOnMount',\n\t\t'deleteEnter',\n\t\t'placeholderTextColor',\n\t\t'textAlign',\n\t\t'selectionColor',\n\t\t'tagsToEliminate',\n\t\t'rootTagsToEliminate',\n\t\t'disableEditingMenu',\n\t\t'fontSize',\n\t\t'fontFamily',\n\t\t'fontWeight',\n\t\t'fontStyle',\n\t\t'minWidth',\n\t\t'maxWidth',\n\t\t'setRef',\n\t\t'disableSuggestions',\n\t\t'disableAutocorrection',\n\t] );\n}\n\nfunction RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: originalValue = '',\n\t\tonChange: originalOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\tformattingControls,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitMiddle: onSplitMiddle,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\tunstableOnFocus,\n\t\t__unstableAllowPrefixTransformations,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tconst instanceId = useInstanceId( RichTextWrapper );\n\n\tidentifier = identifier || instanceId;\n\tprops = removeNativeProps( props );\n\n\tconst anchorRef = useRef();\n\tconst { clientId } = useBlockEditContext();\n\tconst selector = ( select ) => {\n\t\tconst { getSelectionStart, getSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\treturn {\n\t\t\tselectionStart: isSelected ? selectionStart.offset : undefined,\n\t\t\tselectionEnd: isSelected ? selectionEnd.offset : undefined,\n\t\t\tisSelected,\n\t\t};\n\t};\n\t// This selector must run on every render so the right selection state is\n\t// retreived from the store on merge.\n\t// To do: fix this somehow.\n\tconst { selectionStart, selectionEnd, isSelected } = useSelect( selector );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst multilineTag = getMultilineTag( multiline );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tformattingControls,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\tlet adjustedValue = originalValue;\n\tlet adjustedOnChange = originalOnChange;\n\n\t// Handle deprecated format.\n\tif ( Array.isArray( originalValue ) ) {\n\t\tadjustedValue = childrenSource.toHTML( originalValue );\n\t\tadjustedOnChange = ( newValue ) =>\n\t\t\toriginalOnChange(\n\t\t\t\tchildrenSource.fromDOM(\n\t\t\t\t\t__unstableCreateElement( document, newValue ).childNodes\n\t\t\t\t)\n\t\t\t);\n\t}\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\tselection.start = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tselection.end = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst {\n\t\tformatTypes,\n\t\tprepareHandlers,\n\t\tvalueHandlers,\n\t\tchangeHandlers,\n\t\tdependencies,\n\t} = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats: adjustedAllowedFormats,\n\t} );\n\n\tfunction addEditorOnlyFormats( value ) {\n\t\treturn valueHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tfunction removeEditorOnlyFormats( value ) {\n\t\tformatTypes.forEach( ( formatType ) => {\n\t\t\t// Remove formats created by prepareEditableTree, because they are editor only.\n\t\t\tif ( formatType.__experimentalCreatePrepareEditableTree ) {\n\t\t\t\tvalue = removeFormat(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformatType.name,\n\t\t\t\t\t0,\n\t\t\t\t\tvalue.text.length\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn value.formats;\n\t}\n\n\tfunction addInvisibleFormats( value ) {\n\t\treturn prepareHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tconst {\n\t\tvalue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t} = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange( html, { __unstableFormats, __unstableText } ) {\n\t\t\tadjustedOnChange( html );\n\t\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\t\tchangeHandler( __unstableFormats, __unstableText );\n\t\t\t} );\n\t\t},\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableMultilineTag: multilineTag,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ ...dependencies, tagName ],\n\t\t__unstableAfterParse: addEditorOnlyFormats,\n\t\t__unstableBeforeSerialize: removeEditorOnlyFormats,\n\t\t__unstableAddInvisibleFormats: addInvisibleFormats,\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onKeyDown( event ) {\n\t\tconst { keyCode } = event;\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( keyCode === DELETE || keyCode === BACKSPACE ) {\n\t\t\tconst { start, end, text } = value;\n\t\t\tconst isReverse = keyCode === BACKSPACE;\n\t\t\tconst hasActiveFormats =\n\t\t\t\tvalue.activeFormats && !! value.activeFormats.length;\n\n\t\t\t// Only process delete if the key press occurs at an uncollapsed edge.\n\t\t\tif (\n\t\t\t\t! isCollapsed( value ) ||\n\t\t\t\thasActiveFormats ||\n\t\t\t\t( isReverse && start !== 0 ) ||\n\t\t\t\t( ! isReverse && end !== text.length )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( onMerge ) {\n\t\t\t\tonMerge( ! isReverse );\n\t\t\t}\n\n\t\t\t// Only handle remove on Backspace. This serves dual-purpose of being\n\t\t\t// an intentional user interaction distinguishing between Backspace and\n\t\t\t// Delete to remove the empty field, but also to avoid merge & remove\n\t\t\t// causing destruction of two fields (merge, then removed merged).\n\t\t\tif ( onRemove && isEmpty( value ) && isReverse ) {\n\t\t\t\tonRemove( ! isReverse );\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n\n\tfunction onFocus() {\n\t\tanchorRef.current.focus();\n\t}\n\n\tconst TagName = tagName;\n\tconst content = (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\tanchorRef={ anchorRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-label={ placeholder }\n\t\t\t\t{ ...props }\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tuseInputRules( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseRemoveBrowserShortcuts(),\n\t\t\t\t\tuseShortcuts( keyboardShortcuts ),\n\t\t\t\t\tuseInputEvents( inputEvents ),\n\t\t\t\t\tuseUndoAutomaticChange(),\n\t\t\t\t\tusePasteHandler( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonSplitMiddle,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseEnter( {\n\t\t\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonSplitMiddle,\n\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseFirefoxCompat(),\n\t\t\t\t\tanchorRef,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ true }\n\t\t\t\tsuppressContentEditableWarning={ true }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\tonFocus={ unstableOnFocus }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t/>\n\t\t</>\n\t);\n\n\tif ( ! wrapperClassName ) {\n\t\treturn content;\n\t}\n\n\tdeprecated( 'wp.blockEditor.RichText wrapperClassName prop', {\n\t\tsince: '5.4',\n\t\talternative: 'className prop or create your own wrapper div',\n\t\tversion: '6.2',\n\t} );\n\n\tconst className = classnames( 'block-editor-rich-text', wrapperClassName );\n\treturn <div className={ className }>{ content }</div>;\n}\n\nconst ForwardedRichTextContainer = forwardRef( RichTextWrapper );\n\nForwardedRichTextContainer.Content = ( {\n\tvalue,\n\ttagName: Tag,\n\tmultiline,\n\t...props\n} ) => {\n\t// Handle deprecated `children` and `node` sources.\n\tif ( Array.isArray( value ) ) {\n\t\tvalue = childrenSource.toHTML( value );\n\t}\n\n\tconst MultilineTag = getMultilineTag( multiline );\n\n\tif ( ! value && MultilineTag ) {\n\t\tvalue = `<${ MultilineTag }></${ MultilineTag }>`;\n\t}\n\n\tconst content = <RawHTML>{ value }</RawHTML>;\n\n\tif ( Tag ) {\n\t\treturn <Tag { ...omit( props, [ 'format' ] ) }>{ content }</Tag>;\n\t}\n\n\treturn content;\n};\n\nForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nexport default ForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { __unstableRichTextInputEvent } from './input-event';\n"]}
|