@wordpress/block-editor 17.0.2-next.v.202608281122.0 → 17.1.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 +29 -1
- package/build/components/background-image-control/index.cjs +18 -1
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-allowed-blocks/modal.cjs +2 -1
- package/build/components/block-allowed-blocks/modal.cjs.map +3 -3
- package/build/components/block-edit/edit.cjs.map +1 -1
- package/build/components/block-inspector/index.cjs +3 -12
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-is-hovered.cjs +17 -4
- package/build/components/block-list/use-block-props/use-is-hovered.cjs.map +2 -2
- package/build/components/block-preview/index.cjs +1 -2
- package/build/components/block-preview/index.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs +2 -1
- package/build/components/block-switcher/index.cjs.map +3 -3
- package/build/components/block-toolbar/pattern-overrides-dropdown.cjs +2 -1
- package/build/components/block-toolbar/pattern-overrides-dropdown.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +19 -42
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/image-settings-panel.cjs.map +1 -1
- package/build/components/iframe/index.cjs.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.cjs.map +1 -1
- package/build/components/inserter-draggable-blocks/index.cjs.map +1 -1
- package/build/components/inspector-controls-tabs/content-tab.cjs +2 -3
- package/build/components/inspector-controls-tabs/content-tab.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +1 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/inspector-popover-header/index.cjs +5 -4
- package/build/components/inspector-popover-header/index.cjs.map +3 -3
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/link-control/search-input.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs +9 -1
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/list-view/use-list-view-drop-zone.cjs.map +1 -1
- package/build/components/media-replace-flow/index.cjs +4 -1
- package/build/components/media-replace-flow/index.cjs.map +2 -2
- package/build/components/navigable-toolbar/index.cjs +3 -0
- package/build/components/navigable-toolbar/index.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/enter.cjs +23 -11
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/index.cjs +0 -2
- package/build/components/rich-text/event-listeners/index.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +4 -2
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +2 -2
- package/build/components/use-block-drop-zone/index.cjs.map +1 -1
- package/build/components/writing-flow/index.cjs +5 -0
- package/build/components/writing-flow/index.cjs.map +3 -3
- package/build/components/writing-flow/use-arrow-nav.cjs.map +1 -1
- package/build/components/writing-flow/use-input.cjs +12 -2
- package/build/components/writing-flow/use-input.cjs.map +2 -2
- package/build/components/writing-flow/use-tab-nav.cjs +84 -41
- package/build/components/writing-flow/use-tab-nav.cjs.map +3 -3
- package/build/components/{rich-text/event-listeners/undo-automatic-change.cjs → writing-flow/use-undo-automatic-change.cjs} +18 -15
- package/build/components/writing-flow/use-undo-automatic-change.cjs.map +7 -0
- package/build/hooks/border.cjs +2 -46
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/generate-fields-from-attributes.cjs.map +1 -1
- package/build/hooks/index.cjs +0 -2
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/style.cjs +2 -2
- package/build/hooks/style.cjs.map +2 -2
- package/build/layouts/flex.cjs +3 -0
- package/build/layouts/flex.cjs.map +2 -2
- package/build/store/actions.cjs +12 -9
- package/build/store/actions.cjs.map +3 -3
- package/build-module/components/background-image-control/index.mjs +18 -1
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-allowed-blocks/modal.mjs +2 -2
- package/build-module/components/block-allowed-blocks/modal.mjs.map +2 -2
- package/build-module/components/block-edit/edit.mjs.map +1 -1
- package/build-module/components/block-inspector/index.mjs +3 -12
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-is-hovered.mjs +17 -4
- package/build-module/components/block-list/use-block-props/use-is-hovered.mjs.map +2 -2
- package/build-module/components/block-preview/index.mjs +1 -2
- package/build-module/components/block-preview/index.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +2 -2
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs +3 -6
- package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +19 -42
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/image-settings-panel.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.mjs.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.mjs.map +1 -1
- package/build-module/components/inspector-controls-tabs/content-tab.mjs +3 -4
- package/build-module/components/inspector-controls-tabs/content-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -3
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +1 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/inspector-popover-header/index.mjs +6 -7
- package/build-module/components/inspector-popover-header/index.mjs.map +2 -2
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/link-control/search-input.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs +9 -1
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/use-list-view-drop-zone.mjs.map +1 -1
- package/build-module/components/media-replace-flow/index.mjs +4 -1
- package/build-module/components/media-replace-flow/index.mjs.map +2 -2
- package/build-module/components/navigable-toolbar/index.mjs +3 -0
- package/build-module/components/navigable-toolbar/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +23 -11
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/index.mjs +0 -2
- package/build-module/components/rich-text/event-listeners/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +4 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/use-block-drop-zone/index.mjs.map +1 -1
- package/build-module/components/writing-flow/index.mjs +5 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +1 -1
- package/build-module/components/writing-flow/use-input.mjs +12 -2
- package/build-module/components/writing-flow/use-input.mjs.map +2 -2
- package/build-module/components/writing-flow/use-tab-nav.mjs +86 -43
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +3 -3
- package/build-module/components/writing-flow/use-undo-automatic-change.mjs +36 -0
- package/build-module/components/writing-flow/use-undo-automatic-change.mjs.map +7 -0
- package/build-module/hooks/border.mjs +1 -45
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/generate-fields-from-attributes.mjs.map +1 -1
- package/build-module/hooks/index.mjs +0 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/style.mjs +3 -2
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +3 -0
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/store/actions.mjs +12 -9
- package/build-module/store/actions.mjs.map +2 -2
- package/build-style/content-rtl.css +9 -20
- package/build-style/content.css +9 -20
- package/build-style/style-rtl.css +100 -221
- package/build-style/style.css +100 -221
- package/package.json +42 -41
- package/src/autocompleters/test/block.js +1 -0
- package/src/components/alignment-control/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +34 -16
- package/src/components/alignment-control/test/{index.jsx → index.jsdom.test.jsx} +2 -1
- package/src/components/background-image-control/index.jsx +32 -1
- package/src/components/background-image-control/style.scss +5 -3
- package/src/components/background-image-control/test/{index.js → index.jsdom.test.js} +1 -0
- package/src/components/block-alignment-control/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +68 -13
- package/src/components/block-alignment-control/test/{index.jsx → index.jsdom.test.jsx} +2 -1
- package/src/components/block-allowed-blocks/modal.jsx +3 -3
- package/src/components/block-bindings/test/{use-block-bindings-utils.js → use-block-bindings-utils.jsdom.test.js} +2 -1
- package/src/components/block-breadcrumb/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +2 -2
- package/src/components/block-breadcrumb/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/block-compare/test/__snapshots__/{block-view.jsx.snap → block-view.jsdom.test.jsx.snap} +2 -2
- package/src/components/block-compare/test/{block-view.jsx → block-view.jsdom.test.jsx} +1 -0
- package/src/components/block-controls/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/block-edit/edit.jsx +1 -1
- package/src/components/block-edit/test/{edit.jsx → edit.jsdom.test.jsx} +1 -0
- package/src/components/block-icon/content.scss +0 -6
- package/src/components/block-icon/style.scss +0 -6
- package/src/components/block-icon/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +6 -2
- package/src/components/block-inspector/index.jsx +3 -11
- package/src/components/block-list/content.scss +4 -1
- package/src/components/block-list/use-block-props/use-is-hovered.js +24 -5
- package/src/components/block-manager/style.scss +2 -0
- package/src/components/block-mover/test/mover-description.js +1 -0
- package/src/components/block-preview/index.jsx +1 -2
- package/src/components/block-preview/test/{index.jsx → index.jsdom.test.jsx} +10 -6
- package/src/components/block-selection-clearer/test/{index.jsx → index.jsdom.test.jsx} +24 -19
- package/src/components/block-settings-menu/test/{block-mode-toggle.jsx → block-mode-toggle.jsdom.test.jsx} +5 -1
- package/src/components/block-styles/test/utils.js +1 -0
- package/src/components/block-switcher/index.jsx +3 -3
- package/src/components/block-switcher/test/{index.jsx → index.jsdom.test.jsx} +8 -4
- package/src/components/block-switcher/test/use-transformed.patterns.js +1 -0
- package/src/components/block-switcher/test/utils.js +1 -0
- package/src/components/block-title/test/{index.jsx → index.jsdom.test.jsx} +7 -3
- package/src/components/block-toolbar/pattern-overrides-dropdown.jsx +3 -6
- package/src/components/block-toolbar/style.scss +1 -1
- package/src/components/block-toolbar/test/{block-toolbar-icon.jsx → block-toolbar-icon.jsdom.test.jsx} +25 -21
- package/src/components/block-variation-picker/content.scss +5 -3
- package/src/components/block-vertical-alignment-control/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +55 -11
- package/src/components/block-vertical-alignment-control/test/{index.jsx → index.jsdom.test.jsx} +2 -1
- package/src/components/block-visibility/test/{use-block-visibility.js → use-block-visibility.jsdom.test.js} +6 -5
- package/src/components/block-visibility/test/utils.js +2 -1
- package/src/components/border-radius-control/test/{index.jsx → index.jsdom.test.jsx} +8 -1
- package/src/components/border-radius-control/test/utils.js +1 -0
- package/src/components/button-block-appender/content.scss +1 -1
- package/src/components/child-layout-control/test/{index.jsx → index.jsdom.test.jsx} +18 -15
- package/src/components/color-palette/test/{control.jsx → control.jsdom.test.jsx} +15 -4
- package/src/components/colors/test/utils.js +1 -0
- package/src/components/colors/test/{with-colors.jsx → with-colors.jsdom.test.jsx} +4 -3
- package/src/components/colors-gradients/test/{control.jsx → control.jsdom.test.jsx} +8 -3
- package/src/components/contrast-checker/test/{index.jsx → index.jsdom.test.jsx} +2 -1
- package/src/components/default-block-appender/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +4 -4
- package/src/components/default-block-appender/test/{index.jsx → index.jsdom.test.jsx} +8 -7
- package/src/components/dimensions-tool/test/{index.jsx → index.jsdom.test.jsx} +27 -22
- package/src/components/dimensions-tool/test/utils.js +1 -0
- package/src/components/duotone-control/test/{index.jsx → index.jsdom.test.jsx} +6 -3
- package/src/components/font-sizes/test/fluid-utils.js +1 -0
- package/src/components/font-sizes/test/utils.js +1 -0
- package/src/components/global-styles/border-panel.jsx +17 -40
- package/src/components/global-styles/image-settings-panel.jsx +1 -1
- package/src/components/global-styles/inheritance/test/{index.jsx → index.jsdom.test.jsx} +5 -2
- package/src/components/global-styles/test/{background-panel.jsx → background-panel.jsdom.test.jsx} +10 -5
- package/src/components/global-styles/test/{border-panel.jsx → border-panel.jsdom.test.jsx} +113 -13
- package/src/components/global-styles/test/{color-panel.jsx → color-panel.jsdom.test.jsx} +5 -0
- package/src/components/global-styles/test/{dimensions-panel.jsx → dimensions-panel.jsdom.test.jsx} +14 -14
- package/src/components/global-styles/test/{filters-panel.jsx → filters-panel.jsdom.test.jsx} +7 -4
- package/src/components/global-styles/test/{inherited-value-context-core.js → inherited-value-context-core.jsdom.test.js} +10 -9
- package/src/components/global-styles/test/{inherited-value-context.jsx → inherited-value-context.jsdom.test.jsx} +18 -17
- package/src/components/global-styles/test/{state-control-badges.jsx → state-control-badges.jsdom.test.jsx} +3 -2
- package/src/components/global-styles/test/{typography-panel-core.jsx → typography-panel-core.jsdom.test.jsx} +5 -2
- package/src/components/global-styles/test/{typography-panel.jsx → typography-panel.jsdom.test.jsx} +17 -12
- package/src/components/global-styles/test/typography-utils.js +1 -0
- package/src/components/global-styles/test/utils.js +1 -0
- package/src/components/grid/style.scss +0 -10
- package/src/components/iframe/index.jsx +3 -3
- package/src/components/image-editor/test/index.js +1 -0
- package/src/components/image-size-control/test/{index.jsx → index.jsdom.test.jsx} +8 -3
- package/src/components/inner-blocks/test/__snapshots__/index.jsdom.test.jsx.snap +15 -0
- package/src/components/inner-blocks/test/{index.jsx → index.jsdom.test.jsx} +2 -0
- package/src/components/inner-content/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/inserter/hooks/use-patterns-paging.js +1 -1
- package/src/components/inserter/media-tab/test/{hooks.js → hooks.jsdom.test.js} +12 -11
- package/src/components/inserter/media-tab/test/{media-panel.jsx → media-panel.jsdom.test.jsx} +15 -12
- package/src/components/inserter/style.scss +2 -2
- package/src/components/inserter/test/get-appender-label.js +12 -11
- package/src/components/inserter/test/search-items.js +1 -0
- package/src/components/inserter-draggable-blocks/index.jsx +1 -1
- package/src/components/inserter-list-item/style.scss +1 -0
- package/src/components/inspector-controls-tabs/content-tab.jsx +7 -14
- package/src/components/inspector-controls-tabs/styles-tab.jsx +1 -4
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -8
- package/src/components/inspector-popover-header/index.jsx +6 -7
- package/src/components/line-height-control/test/{index.jsx → index.jsdom.test.jsx} +3 -0
- package/src/components/link-control/index.jsx +3 -0
- package/src/components/link-control/search-input.jsx +1 -1
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/{index.jsx → index.jsdom.test.jsx} +52 -42
- package/src/components/link-control/test/is-url-like.js +1 -0
- package/src/components/link-control/test/{url-normalization.test.jsx → url-normalization.jsdom.test.jsx} +21 -20
- package/src/components/link-picker/test/{index.jsx → index.jsdom.test.jsx} +31 -30
- package/src/components/list-view/block-select-button.jsx +6 -1
- package/src/components/list-view/block.jsx +6 -4
- package/src/components/list-view/style.scss +55 -35
- package/src/components/list-view/test/use-list-view-drop-zone.js +1 -0
- package/src/components/list-view/test/utils.js +1 -0
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/media-placeholder/test/get-computed-accept-attribute.js +1 -0
- package/src/components/media-placeholder/test/{index.jsx → index.jsdom.test.jsx} +8 -2
- package/src/components/media-replace-flow/index.jsx +6 -1
- package/src/components/media-replace-flow/test/{index.jsx → index.jsdom.test.jsx} +3 -0
- package/src/components/navigable-toolbar/index.jsx +4 -0
- package/src/components/navigable-toolbar/test/index.browser.test.js +50 -0
- package/src/components/panel-color-settings/test/{index.jsx → index.jsdom.test.jsx} +3 -0
- package/src/components/preset-input-control/test/{index.jsx → index.jsdom.test.jsx} +8 -2
- package/src/components/preset-input-control/test/utils.js +1 -0
- package/src/components/provider/test/{experimental-provider.jsx → experimental-provider.jsdom.test.jsx} +3 -2
- package/src/components/provider/test/{use-block-sync.jsx → use-block-sync.jsdom.test.jsx} +45 -44
- package/src/components/recursion-provider/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/responsive-block-control/style.scss +1 -0
- package/src/components/responsive-block-control/test/{index.jsx → index.jsdom.test.jsx} +6 -3
- package/src/components/rich-text/event-listeners/enter.js +29 -14
- package/src/components/rich-text/event-listeners/index.js +0 -2
- package/src/components/rich-text/event-listeners/input-rules.js +7 -2
- package/src/components/spacing-sizes-control/test/{index.jsx → index.jsdom.test.jsx} +23 -20
- package/src/components/spacing-sizes-control/test/utils.js +1 -0
- package/src/components/url-input/test/{button.jsx → button.jsdom.test.jsx} +4 -1
- package/src/components/url-input/test/fixtures/validated-input-control-deprecation.js +2 -0
- package/src/components/url-input/test/{index.jsx → index.jsdom.test.jsx} +23 -13
- package/src/components/use-block-display-information/test/{index.jsx → index.jsdom.test.jsx} +14 -10
- package/src/components/use-block-drop-zone/index.js +2 -2
- package/src/components/use-block-drop-zone/test/index.js +1 -0
- package/src/components/use-on-block-drop/test/index.js +28 -31
- package/src/components/warning/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +2 -2
- package/src/components/warning/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/writing-flow/index.jsx +5 -0
- package/src/components/writing-flow/style.scss +48 -0
- package/src/components/writing-flow/test/{index.js → index.jsdom.test.js} +1 -0
- package/src/components/writing-flow/use-arrow-nav.js +2 -2
- package/src/components/writing-flow/use-input.js +29 -2
- package/src/components/writing-flow/use-tab-nav.jsx +155 -70
- package/src/components/writing-flow/use-undo-automatic-change.js +40 -0
- package/src/elements/test/{index.js → index.jsdom.test.js} +1 -0
- package/src/hooks/border.jsx +0 -53
- package/src/hooks/generate-fields-from-attributes.js +1 -1
- package/src/hooks/index.js +0 -2
- package/src/hooks/style.jsx +3 -2
- package/src/hooks/test/{align.jsx → align.jsdom.test.jsx} +1 -0
- package/src/hooks/test/allowed-blocks.js +1 -0
- package/src/hooks/test/{anchor.js → anchor.jsdom.test.js} +1 -0
- package/src/hooks/test/{auto-inspector-controls.js → auto-inspector-controls.jsdom.test.js} +1 -0
- package/src/hooks/test/{background.jsx → background.jsdom.test.jsx} +5 -2
- package/src/hooks/test/{block-style-state.js → block-style-state.jsdom.test.js} +4 -3
- package/src/hooks/test/{cross-origin-isolation.js → cross-origin-isolation.jsdom.test.js} +18 -25
- package/src/hooks/test/{custom-class-name.jsx → custom-class-name.jsdom.test.jsx} +1 -0
- package/src/hooks/test/{dimensions.js → dimensions.jsdom.test.js} +1 -0
- package/src/hooks/test/{duotone.js → duotone.jsdom.test.js} +1 -0
- package/src/hooks/test/{font-size.js → font-size.jsdom.test.js} +1 -0
- package/src/hooks/test/gap.js +1 -0
- package/src/hooks/test/generate-fields-from-attributes.js +1 -0
- package/src/hooks/test/generated-class-name.js +1 -0
- package/src/hooks/test/{inherited-value-wiring.jsx → inherited-value-wiring.jsdom.test.jsx} +49 -51
- package/src/hooks/test/{layout-child.js → layout-child.jsdom.test.js} +1 -0
- package/src/hooks/test/{layout.js → layout.jsdom.test.js} +1 -0
- package/src/hooks/test/metadata.js +1 -0
- package/src/hooks/test/preset-round-trip.js +2 -0
- package/src/hooks/test/settings.jsx +1 -0
- package/src/hooks/test/state-utils.js +1 -0
- package/src/hooks/test/{style.jsx → style.jsdom.test.jsx} +1 -0
- package/src/hooks/test/{text-align.jsx → text-align.jsdom.test.jsx} +1 -0
- package/src/hooks/test/{use-typography-props.js → use-typography-props.jsdom.test.js} +1 -0
- package/src/hooks/test/{utils.js → utils.jsdom.test.js} +1 -0
- package/src/layouts/flex.jsx +7 -0
- package/src/layouts/test/{constrained.jsx → constrained.jsdom.test.jsx} +6 -3
- package/src/layouts/test/{flex.jsx → flex.jsdom.test.jsx} +52 -2
- package/src/layouts/test/{flow.js → flow.jsdom.test.js} +1 -0
- package/src/layouts/test/{grid.jsx → grid.jsdom.test.jsx} +5 -2
- package/src/layouts/test/utils.js +1 -0
- package/src/store/actions.js +14 -12
- package/src/store/test/{actions.js → actions.jsdom.test.js} +50 -49
- package/src/store/test/array.js +1 -0
- package/src/store/test/get-block-settings.js +1 -0
- package/src/store/test/performance.js +2 -1
- package/src/store/test/private-actions.js +1 -0
- package/src/store/test/private-selectors.js +13 -3
- package/src/store/test/reducer.js +37 -8
- package/src/store/test/{registry-selectors.js → registry-selectors.jsdom.test.js} +9 -0
- package/src/store/test/{selectors.jsx → selectors.jsdom.test.jsx} +13 -3
- package/src/style.scss +1 -1
- package/src/utils/test/block-bindings.js +1 -0
- package/src/utils/test/color-values.js +1 -0
- package/src/utils/test/{dom.jsx → dom.jsdom.test.jsx} +38 -43
- package/src/utils/test/format-font-style.js +1 -0
- package/src/utils/test/format-font-weight.js +1 -0
- package/src/utils/test/get-font-styles-and-weights.js +1 -0
- package/src/utils/test/math.js +1 -0
- package/src/utils/test/object.js +1 -0
- package/src/utils/test/pasting.js +1 -0
- package/src/utils/test/selection.js +1 -0
- package/src/utils/test/sorting.js +1 -0
- package/src/utils/test/transform-styles.js +2 -1
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +0 -7
- package/build/hooks/block-fields/fields-dropdown-menu.cjs +0 -67
- package/build/hooks/block-fields/fields-dropdown-menu.cjs.map +0 -7
- package/build/hooks/block-fields/index.cjs +0 -238
- package/build/hooks/block-fields/index.cjs.map +0 -7
- package/build/hooks/block-fields/link/index.cjs +0 -174
- package/build/hooks/block-fields/link/index.cjs.map +0 -7
- package/build/hooks/block-fields/media/index.cjs +0 -262
- package/build/hooks/block-fields/media/index.cjs.map +0 -7
- package/build/hooks/block-fields/rich-text/index.cjs +0 -146
- package/build/hooks/block-fields/rich-text/index.cjs.map +0 -7
- package/build/hooks/block-fields/use-inspector-popover-placement.cjs +0 -41
- package/build/hooks/block-fields/use-inspector-popover-placement.cjs.map +0 -7
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +0 -33
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +0 -7
- package/build-module/hooks/block-fields/fields-dropdown-menu.mjs +0 -46
- package/build-module/hooks/block-fields/fields-dropdown-menu.mjs.map +0 -7
- package/build-module/hooks/block-fields/index.mjs +0 -210
- package/build-module/hooks/block-fields/index.mjs.map +0 -7
- package/build-module/hooks/block-fields/link/index.mjs +0 -141
- package/build-module/hooks/block-fields/link/index.mjs.map +0 -7
- package/build-module/hooks/block-fields/media/index.mjs +0 -241
- package/build-module/hooks/block-fields/media/index.mjs.map +0 -7
- package/build-module/hooks/block-fields/rich-text/index.mjs +0 -115
- package/build-module/hooks/block-fields/rich-text/index.mjs.map +0 -7
- package/build-module/hooks/block-fields/use-inspector-popover-placement.mjs +0 -16
- package/build-module/hooks/block-fields/use-inspector-popover-placement.mjs.map +0 -7
- package/src/components/color-palette/test/__snapshots__/control.jsx.snap +0 -143
- package/src/components/inner-blocks/test/__snapshots__/index.jsx.snap +0 -15
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +0 -39
- package/src/hooks/block-fields/fields-dropdown-menu.jsx +0 -47
- package/src/hooks/block-fields/index.jsx +0 -302
- package/src/hooks/block-fields/link/index.jsx +0 -155
- package/src/hooks/block-fields/link/styles.scss +0 -18
- package/src/hooks/block-fields/media/index.jsx +0 -269
- package/src/hooks/block-fields/media/styles.scss +0 -77
- package/src/hooks/block-fields/rich-text/index.jsx +0 -123
- package/src/hooks/block-fields/rich-text/styles.scss +0 -24
- package/src/hooks/block-fields/styles.scss +0 -33
- package/src/hooks/block-fields/use-inspector-popover-placement.js +0 -16
- /package/src/components/block-icon/test/{index.jsx → index.jsdom.test.jsx} +0 -0
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
// packages/block-editor/src/hooks/block-fields/media/index.jsx
|
|
2
|
-
import {
|
|
3
|
-
Button,
|
|
4
|
-
Icon as WCIcon,
|
|
5
|
-
__experimentalGrid as Grid
|
|
6
|
-
} from "@wordpress/components";
|
|
7
|
-
import { useSelect } from "@wordpress/data";
|
|
8
|
-
import { focus } from "@wordpress/dom";
|
|
9
|
-
import { useRef } from "@wordpress/element";
|
|
10
|
-
import { __ } from "@wordpress/i18n";
|
|
11
|
-
import {
|
|
12
|
-
audio as audioIcon,
|
|
13
|
-
image as imageIcon,
|
|
14
|
-
media as mediaIcon,
|
|
15
|
-
video as videoIcon,
|
|
16
|
-
reset as resetIcon
|
|
17
|
-
} from "@wordpress/icons";
|
|
18
|
-
import MediaReplaceFlow from "../../../components/media-replace-flow/index.mjs";
|
|
19
|
-
import MediaUploadCheck from "../../../components/media-upload/check.mjs";
|
|
20
|
-
import { useInspectorPopoverPlacement } from "../use-inspector-popover-placement.mjs";
|
|
21
|
-
import { getMediaSelectKey } from "../../../store/private-keys.mjs";
|
|
22
|
-
import { store as blockEditorStore } from "../../../store/index.mjs";
|
|
23
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
-
var focusToggleButton = (containerRef) => {
|
|
25
|
-
window.requestAnimationFrame(() => {
|
|
26
|
-
const [toggleButton] = focus.tabbable.find(containerRef?.current);
|
|
27
|
-
if (!toggleButton) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
toggleButton.focus();
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
function MediaThumbnail({ data, field, attachment, config }) {
|
|
34
|
-
const { allowedTypes = [], multiple = false } = config || {};
|
|
35
|
-
if (multiple) {
|
|
36
|
-
return "todo multiple";
|
|
37
|
-
}
|
|
38
|
-
if (attachment?.media_type === "image" || attachment?.poster) {
|
|
39
|
-
return /* @__PURE__ */ jsx("div", { className: "block-editor-content-only-controls__media-thumbnail", children: /* @__PURE__ */ jsx(
|
|
40
|
-
"img",
|
|
41
|
-
{
|
|
42
|
-
alt: "",
|
|
43
|
-
width: 20,
|
|
44
|
-
height: 20,
|
|
45
|
-
src: attachment.media_type === "image" ? attachment.source_url : attachment.poster
|
|
46
|
-
}
|
|
47
|
-
) });
|
|
48
|
-
}
|
|
49
|
-
if (allowedTypes.length === 1) {
|
|
50
|
-
const value = field.getValue({ item: data });
|
|
51
|
-
const url = value?.url;
|
|
52
|
-
if (allowedTypes[0] === "image" && url) {
|
|
53
|
-
return /* @__PURE__ */ jsx("div", { className: "block-editor-content-only-controls__media-thumbnail", children: /* @__PURE__ */ jsx("img", { alt: "", width: 20, height: 20, src: url }) });
|
|
54
|
-
}
|
|
55
|
-
let icon;
|
|
56
|
-
if (allowedTypes[0] === "image") {
|
|
57
|
-
icon = imageIcon;
|
|
58
|
-
} else if (allowedTypes[0] === "video") {
|
|
59
|
-
icon = videoIcon;
|
|
60
|
-
} else if (allowedTypes[0] === "audio") {
|
|
61
|
-
icon = audioIcon;
|
|
62
|
-
} else {
|
|
63
|
-
icon = mediaIcon;
|
|
64
|
-
}
|
|
65
|
-
if (icon) {
|
|
66
|
-
return /* @__PURE__ */ jsx(WCIcon, { icon, size: 20 });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return /* @__PURE__ */ jsx(WCIcon, { icon: mediaIcon, size: 20 });
|
|
70
|
-
}
|
|
71
|
-
function Media({ data, field, onChange, config = {} }) {
|
|
72
|
-
const { popoverProps } = useInspectorPopoverPlacement({
|
|
73
|
-
isControl: true
|
|
74
|
-
});
|
|
75
|
-
const value = field.getValue({ item: data });
|
|
76
|
-
const {
|
|
77
|
-
allowedTypes = [],
|
|
78
|
-
multiple = false,
|
|
79
|
-
useFeaturedImage = false
|
|
80
|
-
} = config;
|
|
81
|
-
const id = value?.id;
|
|
82
|
-
const url = value?.url;
|
|
83
|
-
const attachment = useSelect(
|
|
84
|
-
(select) => {
|
|
85
|
-
if (!id) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
const settings = select(blockEditorStore).getSettings();
|
|
89
|
-
const getMedia = settings[getMediaSelectKey];
|
|
90
|
-
if (!getMedia) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
return getMedia(select, id);
|
|
94
|
-
},
|
|
95
|
-
[id]
|
|
96
|
-
);
|
|
97
|
-
let chooseItemLabel;
|
|
98
|
-
if (allowedTypes.length === 1) {
|
|
99
|
-
const allowedType = allowedTypes[0];
|
|
100
|
-
if (allowedType === "image") {
|
|
101
|
-
chooseItemLabel = __("Image");
|
|
102
|
-
} else if (allowedType === "video") {
|
|
103
|
-
chooseItemLabel = __("Video");
|
|
104
|
-
} else if (allowedType === "application") {
|
|
105
|
-
chooseItemLabel = __("File");
|
|
106
|
-
} else {
|
|
107
|
-
chooseItemLabel = __("Media");
|
|
108
|
-
}
|
|
109
|
-
} else {
|
|
110
|
-
chooseItemLabel = __("Media");
|
|
111
|
-
}
|
|
112
|
-
const containerRef = useRef();
|
|
113
|
-
return /* @__PURE__ */ jsx(MediaUploadCheck, { children: /* @__PURE__ */ jsxs(
|
|
114
|
-
"div",
|
|
115
|
-
{
|
|
116
|
-
ref: containerRef,
|
|
117
|
-
className: "block-editor-content-only-controls",
|
|
118
|
-
children: [
|
|
119
|
-
/* @__PURE__ */ jsx(
|
|
120
|
-
MediaReplaceFlow,
|
|
121
|
-
{
|
|
122
|
-
className: "block-editor-content-only-controls__media-replace-flow",
|
|
123
|
-
allowedTypes,
|
|
124
|
-
mediaId: id,
|
|
125
|
-
mediaURL: url,
|
|
126
|
-
multiple,
|
|
127
|
-
popoverProps,
|
|
128
|
-
onReset: () => {
|
|
129
|
-
onChange(
|
|
130
|
-
field.setValue({
|
|
131
|
-
item: data,
|
|
132
|
-
value: {}
|
|
133
|
-
})
|
|
134
|
-
);
|
|
135
|
-
},
|
|
136
|
-
...useFeaturedImage && {
|
|
137
|
-
useFeaturedImage: !!value?.featuredImage,
|
|
138
|
-
onToggleFeaturedImage: () => {
|
|
139
|
-
onChange(
|
|
140
|
-
field.setValue({
|
|
141
|
-
item: data,
|
|
142
|
-
value: {
|
|
143
|
-
featuredImage: !value?.featuredImage
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
onSelect: (selectedMedia) => {
|
|
150
|
-
if (selectedMedia.id && selectedMedia.url) {
|
|
151
|
-
const newValue = {
|
|
152
|
-
...selectedMedia,
|
|
153
|
-
mediaType: selectedMedia.media_type
|
|
154
|
-
};
|
|
155
|
-
if (useFeaturedImage) {
|
|
156
|
-
newValue.featuredImage = false;
|
|
157
|
-
}
|
|
158
|
-
onChange(
|
|
159
|
-
field.setValue({
|
|
160
|
-
item: data,
|
|
161
|
-
value: newValue
|
|
162
|
-
})
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
renderToggle: (buttonProps) => /* @__PURE__ */ jsx(
|
|
167
|
-
Button,
|
|
168
|
-
{
|
|
169
|
-
__next40pxDefaultSize: true,
|
|
170
|
-
className: "block-editor-content-only-controls__media",
|
|
171
|
-
...buttonProps,
|
|
172
|
-
children: /* @__PURE__ */ jsxs(
|
|
173
|
-
Grid,
|
|
174
|
-
{
|
|
175
|
-
rowGap: 0,
|
|
176
|
-
columnGap: 8,
|
|
177
|
-
templateColumns: "20px 1fr",
|
|
178
|
-
className: "block-editor-content-only-controls__media-row",
|
|
179
|
-
children: [
|
|
180
|
-
url && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
181
|
-
/* @__PURE__ */ jsx(
|
|
182
|
-
MediaThumbnail,
|
|
183
|
-
{
|
|
184
|
-
attachment,
|
|
185
|
-
field,
|
|
186
|
-
data,
|
|
187
|
-
config
|
|
188
|
-
}
|
|
189
|
-
),
|
|
190
|
-
/* @__PURE__ */ jsx("span", {
|
|
191
|
-
className: "block-editor-content-only-controls__media-title",
|
|
192
|
-
// TODO - truncate long titles or url smartly (e.g. show filename).
|
|
193
|
-
children: attachment?.title?.raw && attachment?.title?.raw !== "" ? attachment?.title?.raw : url
|
|
194
|
-
})
|
|
195
|
-
] }),
|
|
196
|
-
!url && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
197
|
-
/* @__PURE__ */ jsx(
|
|
198
|
-
"span",
|
|
199
|
-
{
|
|
200
|
-
className: "block-editor-content-only-controls__media-placeholder",
|
|
201
|
-
style: {
|
|
202
|
-
width: "20px",
|
|
203
|
-
height: "20px"
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
),
|
|
207
|
-
/* @__PURE__ */ jsx("span", { className: "block-editor-content-only-controls__media-title", children: chooseItemLabel })
|
|
208
|
-
] })
|
|
209
|
-
]
|
|
210
|
-
}
|
|
211
|
-
)
|
|
212
|
-
}
|
|
213
|
-
)
|
|
214
|
-
}
|
|
215
|
-
),
|
|
216
|
-
url && /* @__PURE__ */ jsx(
|
|
217
|
-
Button,
|
|
218
|
-
{
|
|
219
|
-
label: __("Reset"),
|
|
220
|
-
className: "block-editor-content-only-controls__media-reset",
|
|
221
|
-
size: "small",
|
|
222
|
-
icon: resetIcon,
|
|
223
|
-
onClick: () => {
|
|
224
|
-
onChange(
|
|
225
|
-
field.setValue({
|
|
226
|
-
item: data,
|
|
227
|
-
value: {}
|
|
228
|
-
})
|
|
229
|
-
);
|
|
230
|
-
focusToggleButton(containerRef);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
)
|
|
234
|
-
]
|
|
235
|
-
}
|
|
236
|
-
) });
|
|
237
|
-
}
|
|
238
|
-
export {
|
|
239
|
-
Media as default
|
|
240
|
-
};
|
|
241
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/hooks/block-fields/media/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import {\n\tButton,\n\tIcon as WCIcon,\n\t__experimentalGrid as Grid,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\taudio as audioIcon,\n\timage as imageIcon,\n\tmedia as mediaIcon,\n\tvideo as videoIcon,\n\treset as resetIcon,\n} from '@wordpress/icons';\nimport MediaReplaceFlow from '../../../components/media-replace-flow';\nimport MediaUploadCheck from '../../../components/media-upload/check';\nimport { useInspectorPopoverPlacement } from '../use-inspector-popover-placement';\nimport { getMediaSelectKey } from '../../../store/private-keys';\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Focuses the toggle button.\n *\n * @param {Object} containerRef - ref object containing current element\n */\nconst focusToggleButton = ( containerRef ) => {\n\t// Use requestAnimationFrame to ensure DOM updates are complete.\n\twindow.requestAnimationFrame( () => {\n\t\tconst [ toggleButton ] = focus.tabbable.find( containerRef?.current );\n\t\tif ( ! toggleButton ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttoggleButton.focus();\n\t} );\n};\n\nfunction MediaThumbnail( { data, field, attachment, config } ) {\n\tconst { allowedTypes = [], multiple = false } = config || {};\n\n\tif ( multiple ) {\n\t\treturn 'todo multiple';\n\t}\n\n\tif ( attachment?.media_type === 'image' || attachment?.poster ) {\n\t\treturn (\n\t\t\t<div className=\"block-editor-content-only-controls__media-thumbnail\">\n\t\t\t\t<img\n\t\t\t\t\talt=\"\"\n\t\t\t\t\twidth={ 20 }\n\t\t\t\t\theight={ 20 }\n\t\t\t\t\tsrc={\n\t\t\t\t\t\tattachment.media_type === 'image'\n\t\t\t\t\t\t\t? attachment.source_url\n\t\t\t\t\t\t\t: attachment.poster\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( allowedTypes.length === 1 ) {\n\t\tconst value = field.getValue( { item: data } );\n\t\tconst url = value?.url;\n\n\t\tif ( allowedTypes[ 0 ] === 'image' && url ) {\n\t\t\treturn (\n\t\t\t\t<div className=\"block-editor-content-only-controls__media-thumbnail\">\n\t\t\t\t\t<img alt=\"\" width={ 20 } height={ 20 } src={ url } />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tlet icon;\n\t\tif ( allowedTypes[ 0 ] === 'image' ) {\n\t\t\ticon = imageIcon;\n\t\t} else if ( allowedTypes[ 0 ] === 'video' ) {\n\t\t\ticon = videoIcon;\n\t\t} else if ( allowedTypes[ 0 ] === 'audio' ) {\n\t\t\ticon = audioIcon;\n\t\t} else {\n\t\t\ticon = mediaIcon;\n\t\t}\n\n\t\tif ( icon ) {\n\t\t\treturn <WCIcon icon={ icon } size={ 20 } />;\n\t\t}\n\t}\n\n\treturn <WCIcon icon={ mediaIcon } size={ 20 } />;\n}\n\nexport default function Media( { data, field, onChange, config = {} } ) {\n\tconst { popoverProps } = useInspectorPopoverPlacement( {\n\t\tisControl: true,\n\t} );\n\tconst value = field.getValue( { item: data } );\n\tconst {\n\t\tallowedTypes = [],\n\t\tmultiple = false,\n\t\tuseFeaturedImage = false,\n\t} = config;\n\n\tconst id = value?.id;\n\tconst url = value?.url;\n\n\tconst attachment = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\tconst getMedia = settings[ getMediaSelectKey ];\n\n\t\t\tif ( ! getMedia ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treturn getMedia( select, id );\n\t\t},\n\t\t[ id ]\n\t);\n\n\t// TODO - pluralize when multiple.\n\tlet chooseItemLabel;\n\tif ( allowedTypes.length === 1 ) {\n\t\tconst allowedType = allowedTypes[ 0 ];\n\t\tif ( allowedType === 'image' ) {\n\t\t\tchooseItemLabel = __( 'Image' );\n\t\t} else if ( allowedType === 'video' ) {\n\t\t\tchooseItemLabel = __( 'Video' );\n\t\t} else if ( allowedType === 'application' ) {\n\t\t\tchooseItemLabel = __( 'File' );\n\t\t} else {\n\t\t\tchooseItemLabel = __( 'Media' );\n\t\t}\n\t} else {\n\t\tchooseItemLabel = __( 'Media' );\n\t}\n\tconst containerRef = useRef();\n\n\treturn (\n\t\t<MediaUploadCheck>\n\t\t\t<div\n\t\t\t\tref={ containerRef }\n\t\t\t\tclassName=\"block-editor-content-only-controls\"\n\t\t\t>\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tclassName=\"block-editor-content-only-controls__media-replace-flow\"\n\t\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tonReset={ () => {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tfield.setValue( {\n\t\t\t\t\t\t\t\titem: data,\n\t\t\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\t{ ...( useFeaturedImage && {\n\t\t\t\t\t\tuseFeaturedImage: !! value?.featuredImage,\n\t\t\t\t\t\tonToggleFeaturedImage: () => {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tfield.setValue( {\n\t\t\t\t\t\t\t\t\titem: data,\n\t\t\t\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t\t\t\tfeaturedImage: ! value?.featuredImage,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t} ) }\n\t\t\t\t\tonSelect={ ( selectedMedia ) => {\n\t\t\t\t\t\tif ( selectedMedia.id && selectedMedia.url ) {\n\t\t\t\t\t\t\tconst newValue = {\n\t\t\t\t\t\t\t\t...selectedMedia,\n\t\t\t\t\t\t\t\tmediaType: selectedMedia.media_type,\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t// Turn off featured image when manually selecting media\n\t\t\t\t\t\t\tif ( useFeaturedImage ) {\n\t\t\t\t\t\t\t\tnewValue.featuredImage = false;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tfield.setValue( {\n\t\t\t\t\t\t\t\t\titem: data,\n\t\t\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\trenderToggle={ ( buttonProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-content-only-controls__media\"\n\t\t\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\t\trowGap={ 0 }\n\t\t\t\t\t\t\t\tcolumnGap={ 8 }\n\t\t\t\t\t\t\t\ttemplateColumns=\"20px 1fr\"\n\t\t\t\t\t\t\t\tclassName=\"block-editor-content-only-controls__media-row\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ url && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<MediaThumbnail\n\t\t\t\t\t\t\t\t\t\t\tattachment={ attachment }\n\t\t\t\t\t\t\t\t\t\t\tfield={ field }\n\t\t\t\t\t\t\t\t\t\t\tdata={ data }\n\t\t\t\t\t\t\t\t\t\t\tconfig={ config }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<span className=\"block-editor-content-only-controls__media-title\">\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO - truncate long titles or url smartly (e.g. show filename).\n\t\t\t\t\t\t\t\t\t\t\t\tattachment?.title?.raw &&\n\t\t\t\t\t\t\t\t\t\t\t\tattachment?.title?.raw !== ''\n\t\t\t\t\t\t\t\t\t\t\t\t\t? attachment?.title?.raw\n\t\t\t\t\t\t\t\t\t\t\t\t\t: url\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ! url && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-content-only-controls__media-placeholder\"\n\t\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: '20px',\n\t\t\t\t\t\t\t\t\t\t\t\theight: '20px',\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<span className=\"block-editor-content-only-controls__media-title\">\n\t\t\t\t\t\t\t\t\t\t\t{ chooseItemLabel }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Grid>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t{ url && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\tclassName=\"block-editor-content-only-controls__media-reset\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\ticon={ resetIcon }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tfield.setValue( {\n\t\t\t\t\t\t\t\t\titem: data,\n\t\t\t\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tfocusToggleButton( containerRef );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</MediaUploadCheck>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAA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ACT,WAAY;AAAA,oBACZ,iBAAgB;AAAA,oBAChB,WAAU;AAAA,oBAER;AAAA,6BACD,iCACC;AAAA;AAAA,0BAAC;AAAA;AAAA,4BACA;AAAA,4BACA;AAAA,4BACA;AAAA,4BACA;AAAA;AAAA,wBACD;AAAA,wBACA,oBAAC;AAAA,0BAAK,WAAU;AAAA;AAAA,0BAGd,sBAAY,OAAO,OACnB,YAAY,OAAO,QAAQ,KACxB,YAAY,OAAO,MACnB;AAAA,yBAEL;AAAA,yBACD;AAAA,sBAEC,CAAE,OACH,iCACC;AAAA;AAAA,0BAAC;AAAA;AAAA,4BACA,WAAU;AAAA,4BACV,OAAQ;AAAA,8BACP,OAAO;AAAA,8BACP,QAAQ;AAAA,4BACT;AAAA;AAAA,wBACD;AAAA,wBACA,oBAAC,UAAK,WAAU,mDACb,2BACH;AAAA,yBACD;AAAA;AAAA;AAAA,gBAEF;AAAA;AAAA,YACD;AAAA;AAAA,QAEF;AAAA,QACE,OACD;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,OAAQ;AAAA,YACpB,WAAU;AAAA,YACV,MAAK;AAAA,YACL,MAAO;AAAA,YACP,SAAU,MAAM;AACf;AAAA,gBACC,MAAM,SAAU;AAAA,kBACf,MAAM;AAAA,kBACN,OAAO,CAAC;AAAA,gBACT,CAAE;AAAA,cACH;AAEA,gCAAmB,YAAa;AAAA,YACjC;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF,GACD;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
// packages/block-editor/src/hooks/block-fields/rich-text/index.jsx
|
|
2
|
-
import { BaseControl, useBaseControlProps } from "@wordpress/components";
|
|
3
|
-
import { useMergeRefs } from "@wordpress/compose";
|
|
4
|
-
import { useRegistry } from "@wordpress/data";
|
|
5
|
-
import { useMemo, useRef, useState } from "@wordpress/element";
|
|
6
|
-
import { privateApis as richTextPrivateApis } from "@wordpress/rich-text";
|
|
7
|
-
import { getAllowedFormats } from "../../../components/rich-text/utils.mjs";
|
|
8
|
-
import { useEventListeners } from "../../../components/rich-text/event-listeners/index.mjs";
|
|
9
|
-
import FormatEdit from "../../../components/rich-text/format-edit.mjs";
|
|
10
|
-
import { unlock } from "../../../lock-unlock.mjs";
|
|
11
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
var { useRichText, KeyboardShortcutContext, InputEventContext } = unlock(richTextPrivateApis);
|
|
13
|
-
function RichTextControl({
|
|
14
|
-
data,
|
|
15
|
-
field,
|
|
16
|
-
hideLabelFromVision,
|
|
17
|
-
onChange,
|
|
18
|
-
config = {}
|
|
19
|
-
}) {
|
|
20
|
-
const registry = useRegistry();
|
|
21
|
-
const attrValue = field.getValue({ item: data });
|
|
22
|
-
const fieldConfig = field.config || {};
|
|
23
|
-
const { clientId } = config;
|
|
24
|
-
const [selection, setSelection] = useState({
|
|
25
|
-
start: void 0,
|
|
26
|
-
end: void 0
|
|
27
|
-
});
|
|
28
|
-
const [isSelected, setIsSelected] = useState(false);
|
|
29
|
-
const anchorRef = useRef();
|
|
30
|
-
const inputEvents = useRef(/* @__PURE__ */ new Set());
|
|
31
|
-
const keyboardShortcuts = useRef(/* @__PURE__ */ new Set());
|
|
32
|
-
const adjustedAllowedFormats = getAllowedFormats({
|
|
33
|
-
allowedFormats: fieldConfig?.allowedFormats,
|
|
34
|
-
disableFormats: fieldConfig?.disableFormats
|
|
35
|
-
});
|
|
36
|
-
function onFocus() {
|
|
37
|
-
anchorRef.current?.focus();
|
|
38
|
-
}
|
|
39
|
-
const {
|
|
40
|
-
value,
|
|
41
|
-
getValue,
|
|
42
|
-
onChange: onRichTextChange,
|
|
43
|
-
ref: richTextRef,
|
|
44
|
-
formatTypes
|
|
45
|
-
} = useRichText({
|
|
46
|
-
value: attrValue,
|
|
47
|
-
onChange(html) {
|
|
48
|
-
onChange(field.setValue({ item: data, value: html }));
|
|
49
|
-
},
|
|
50
|
-
selectionStart: selection.start,
|
|
51
|
-
selectionEnd: selection.end,
|
|
52
|
-
onSelectionChange: (start, end) => setSelection({ start, end }),
|
|
53
|
-
__unstableIsSelected: isSelected,
|
|
54
|
-
preserveWhiteSpace: !!fieldConfig?.preserveWhiteSpace,
|
|
55
|
-
placeholder: fieldConfig?.placeholder,
|
|
56
|
-
__unstableDisableFormats: fieldConfig?.disableFormats,
|
|
57
|
-
allowedFormats: adjustedAllowedFormats,
|
|
58
|
-
withoutInteractiveFormatting: fieldConfig?.withoutInteractiveFormatting,
|
|
59
|
-
__unstableFormatTypeHandlerContext: useMemo(
|
|
60
|
-
() => ({ richTextIdentifier: field.id, blockClientId: clientId }),
|
|
61
|
-
[field.id, clientId]
|
|
62
|
-
)
|
|
63
|
-
});
|
|
64
|
-
const { baseControlProps, controlProps } = useBaseControlProps({
|
|
65
|
-
hideLabelFromVision: hideLabelFromVision ?? field.hideLabelFromVision,
|
|
66
|
-
label: field.label
|
|
67
|
-
});
|
|
68
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
-
isSelected && /* @__PURE__ */ jsx(KeyboardShortcutContext.Provider, { value: keyboardShortcuts, children: /* @__PURE__ */ jsx(InputEventContext.Provider, { value: inputEvents, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
70
|
-
FormatEdit,
|
|
71
|
-
{
|
|
72
|
-
value,
|
|
73
|
-
onChange: onRichTextChange,
|
|
74
|
-
onFocus,
|
|
75
|
-
formatTypes,
|
|
76
|
-
forwardedRef: anchorRef,
|
|
77
|
-
isVisible: false
|
|
78
|
-
}
|
|
79
|
-
) }) }) }),
|
|
80
|
-
/* @__PURE__ */ jsx(BaseControl, { ...baseControlProps, children: /* @__PURE__ */ jsx(
|
|
81
|
-
"div",
|
|
82
|
-
{
|
|
83
|
-
className: "block-editor-content-only-controls__rich-text",
|
|
84
|
-
role: "textbox",
|
|
85
|
-
"aria-multiline": !fieldConfig?.disableLineBreaks,
|
|
86
|
-
ref: useMergeRefs([
|
|
87
|
-
richTextRef,
|
|
88
|
-
useEventListeners({
|
|
89
|
-
registry,
|
|
90
|
-
getValue,
|
|
91
|
-
onChange: onRichTextChange,
|
|
92
|
-
formatTypes,
|
|
93
|
-
selectionChange: setSelection,
|
|
94
|
-
isSelected,
|
|
95
|
-
disableFormats: fieldConfig?.disableFormats,
|
|
96
|
-
value,
|
|
97
|
-
tagName: "div",
|
|
98
|
-
disableLineBreaks: fieldConfig?.disableLineBreaks,
|
|
99
|
-
keyboardShortcuts,
|
|
100
|
-
inputEvents
|
|
101
|
-
}),
|
|
102
|
-
anchorRef
|
|
103
|
-
]),
|
|
104
|
-
onFocus: () => setIsSelected(true),
|
|
105
|
-
onBlur: () => setIsSelected(false),
|
|
106
|
-
contentEditable: true,
|
|
107
|
-
...controlProps
|
|
108
|
-
}
|
|
109
|
-
) })
|
|
110
|
-
] });
|
|
111
|
-
}
|
|
112
|
-
export {
|
|
113
|
-
RichTextControl as default
|
|
114
|
-
};
|
|
115
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/hooks/block-fields/rich-text/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { BaseControl, useBaseControlProps } from '@wordpress/components';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { useRegistry } from '@wordpress/data';\nimport { useMemo, useRef, useState } from '@wordpress/element';\nimport { privateApis as richTextPrivateApis } from '@wordpress/rich-text';\nimport { getAllowedFormats } from '../../../components/rich-text/utils';\nimport { useEventListeners } from '../../../components/rich-text/event-listeners';\nimport FormatEdit from '../../../components/rich-text/format-edit';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useRichText, KeyboardShortcutContext, InputEventContext } =\n\tunlock( richTextPrivateApis );\n\nexport default function RichTextControl( {\n\tdata,\n\tfield,\n\thideLabelFromVision,\n\tonChange,\n\tconfig = {},\n} ) {\n\tconst registry = useRegistry();\n\tconst attrValue = field.getValue( { item: data } );\n\tconst fieldConfig = field.config || {};\n\tconst { clientId } = config;\n\tconst [ selection, setSelection ] = useState( {\n\t\tstart: undefined,\n\t\tend: undefined,\n\t} );\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst anchorRef = useRef();\n\tconst inputEvents = useRef( new Set() );\n\tconst keyboardShortcuts = useRef( new Set() );\n\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats: fieldConfig?.allowedFormats,\n\t\tdisableFormats: fieldConfig?.disableFormats,\n\t} );\n\n\tfunction onFocus() {\n\t\tanchorRef.current?.focus();\n\t}\n\n\tconst {\n\t\tvalue,\n\t\tgetValue,\n\t\tonChange: onRichTextChange,\n\t\tref: richTextRef,\n\t\tformatTypes,\n\t} = useRichText( {\n\t\tvalue: attrValue,\n\t\tonChange( html ) {\n\t\t\tonChange( field.setValue( { item: data, value: html } ) );\n\t\t},\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange: ( start, end ) => setSelection( { start, end } ),\n\t\t__unstableIsSelected: isSelected,\n\t\tpreserveWhiteSpace: !! fieldConfig?.preserveWhiteSpace,\n\t\tplaceholder: fieldConfig?.placeholder,\n\t\t__unstableDisableFormats: fieldConfig?.disableFormats,\n\t\tallowedFormats: adjustedAllowedFormats,\n\t\twithoutInteractiveFormatting: fieldConfig?.withoutInteractiveFormatting,\n\t\t__unstableFormatTypeHandlerContext: useMemo(\n\t\t\t() => ( { richTextIdentifier: field.id, blockClientId: clientId } ),\n\t\t\t[ field.id, clientId ]\n\t\t),\n\t} );\n\n\tconst { baseControlProps, controlProps } = useBaseControlProps( {\n\t\thideLabelFromVision: hideLabelFromVision ?? field.hideLabelFromVision,\n\t\tlabel: field.label,\n\t} );\n\n\treturn (\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<div>\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={ onRichTextChange }\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\tisVisible={ false }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</InputEventContext.Provider>\n\t\t\t\t</KeyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t<BaseControl { ...baseControlProps }>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"block-editor-content-only-controls__rich-text\"\n\t\t\t\t\trole=\"textbox\"\n\t\t\t\t\taria-multiline={ ! fieldConfig?.disableLineBreaks }\n\t\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t\trichTextRef,\n\t\t\t\t\t\tuseEventListeners( {\n\t\t\t\t\t\t\tregistry,\n\t\t\t\t\t\t\tgetValue,\n\t\t\t\t\t\t\tonChange: onRichTextChange,\n\t\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\t\tselectionChange: setSelection,\n\t\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\t\tdisableFormats: fieldConfig?.disableFormats,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\ttagName: 'div',\n\t\t\t\t\t\t\tdisableLineBreaks: fieldConfig?.disableLineBreaks,\n\t\t\t\t\t\t\tkeyboardShortcuts,\n\t\t\t\t\t\t\tinputEvents,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\tanchorRef,\n\t\t\t\t\t] ) }\n\t\t\t\t\tonFocus={ () => setIsSelected( true ) }\n\t\t\t\t\tonBlur={ () => setIsSelected( false ) }\n\t\t\t\t\tcontentEditable\n\t\t\t\t\t{ ...controlProps }\n\t\t\t\t/>\n\t\t\t</BaseControl>\n\t\t</>\n\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,QAAS,MAAM,cAAe,KAAM;AAAA,QACpC,iBAAe;AAAA,QACb,GAAG;AAAA;AAAA,IACN,GACD;AAAA,KACD;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// packages/block-editor/src/hooks/block-fields/use-inspector-popover-placement.js
|
|
2
|
-
import { useViewportMatch } from "@wordpress/compose";
|
|
3
|
-
function useInspectorPopoverPlacement({ isControl } = { isControl: false }) {
|
|
4
|
-
const isMobile = useViewportMatch("medium", "<");
|
|
5
|
-
return !isMobile ? {
|
|
6
|
-
popoverProps: {
|
|
7
|
-
placement: "left-start",
|
|
8
|
-
// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
|
|
9
|
-
offset: isControl ? 35 : 259
|
|
10
|
-
}
|
|
11
|
-
} : {};
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
useInspectorPopoverPlacement
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=use-inspector-popover-placement.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/block-fields/use-inspector-popover-placement.js"],
|
|
4
|
-
"sourcesContent": ["import { useViewportMatch } from '@wordpress/compose';\n\nexport function useInspectorPopoverPlacement(\n\t{ isControl } = { isControl: false }\n) {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: isControl ? 35 : 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,wBAAwB;AAE1B,SAAS,6BACf,EAAE,UAAU,IAAI,EAAE,WAAW,MAAM,GAClC;AACD,QAAM,WAAW,iBAAkB,UAAU,GAAI;AACjD,SAAO,CAAE,WACN;AAAA,IACA,cAAc;AAAA,MACb,WAAW;AAAA;AAAA,MAEX,QAAQ,YAAY,KAAK;AAAA,IAC1B;AAAA,EACA,IACA,CAAC;AACL;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
-
|
|
3
|
-
exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
class="style-wrapper components-base-control block-editor-color-gradient-control"
|
|
7
|
-
>
|
|
8
|
-
<div
|
|
9
|
-
class="style-field components-base-control__field"
|
|
10
|
-
>
|
|
11
|
-
<fieldset
|
|
12
|
-
class="block-editor-color-gradient-control__fieldset"
|
|
13
|
-
>
|
|
14
|
-
<div
|
|
15
|
-
class="style-flex style-items-column components-flex components-h-stack components-v-stack"
|
|
16
|
-
data-wp-c16t="true"
|
|
17
|
-
data-wp-component="VStack"
|
|
18
|
-
style="--wp-components-flex-align: stretch; --wp-components-flex-direction: column; --wp-components-flex-wrap: nowrap; --wp-components-flex-gap: calc(4px * 1); --wp-components-flex-justify: center;"
|
|
19
|
-
>
|
|
20
|
-
<legend>
|
|
21
|
-
<div
|
|
22
|
-
class="block-editor-color-gradient-control__color-indicator"
|
|
23
|
-
>
|
|
24
|
-
<span
|
|
25
|
-
class="style-label components-base-control__label"
|
|
26
|
-
>
|
|
27
|
-
Test Color
|
|
28
|
-
</span>
|
|
29
|
-
</div>
|
|
30
|
-
</legend>
|
|
31
|
-
<div
|
|
32
|
-
class="block-editor-color-gradient-control__panel"
|
|
33
|
-
>
|
|
34
|
-
<div
|
|
35
|
-
class="style-flex style-items-column components-flex components-h-stack components-v-stack"
|
|
36
|
-
data-wp-c16t="true"
|
|
37
|
-
data-wp-component="VStack"
|
|
38
|
-
style="--wp-components-flex-align: stretch; --wp-components-flex-direction: column; --wp-components-flex-wrap: nowrap; --wp-components-flex-gap: calc(4px * 3); --wp-components-flex-justify: center;"
|
|
39
|
-
>
|
|
40
|
-
<div
|
|
41
|
-
class="components-dropdown"
|
|
42
|
-
tabindex="-1"
|
|
43
|
-
>
|
|
44
|
-
<div
|
|
45
|
-
class="style-flex style-items-column components-flex components-h-stack components-v-stack components-color-palette__custom-color-wrapper"
|
|
46
|
-
data-wp-c16t="true"
|
|
47
|
-
data-wp-component="VStack"
|
|
48
|
-
style="--wp-components-flex-align: stretch; --wp-components-flex-direction: column; --wp-components-flex-wrap: nowrap; --wp-components-flex-gap: 0; --wp-components-flex-justify: center;"
|
|
49
|
-
>
|
|
50
|
-
<button
|
|
51
|
-
aria-expanded="false"
|
|
52
|
-
aria-haspopup="true"
|
|
53
|
-
aria-label="Custom color picker. The currently selected color is called "red" and has a value of "#f00"."
|
|
54
|
-
class="components-color-palette__custom-color-button"
|
|
55
|
-
style="background: rgb(255, 0, 0);"
|
|
56
|
-
type="button"
|
|
57
|
-
/>
|
|
58
|
-
<div
|
|
59
|
-
class="style-flex style-items-column components-flex components-h-stack components-v-stack components-color-palette__custom-color-text-wrapper"
|
|
60
|
-
data-wp-c16t="true"
|
|
61
|
-
data-wp-component="VStack"
|
|
62
|
-
style="--wp-components-flex-align: stretch; --wp-components-flex-direction: column; --wp-components-flex-wrap: nowrap; --wp-components-flex-gap: calc(4px * 0.5); --wp-components-flex-justify: center;"
|
|
63
|
-
>
|
|
64
|
-
<span
|
|
65
|
-
class="style-truncate components-truncate components-color-palette__custom-color-name"
|
|
66
|
-
data-wp-c16t="true"
|
|
67
|
-
data-wp-component="Truncate"
|
|
68
|
-
>
|
|
69
|
-
red
|
|
70
|
-
</span>
|
|
71
|
-
<span
|
|
72
|
-
class="style-truncate components-truncate components-color-palette__custom-color-value components-color-palette__custom-color-value--is-hex"
|
|
73
|
-
data-wp-c16t="true"
|
|
74
|
-
data-wp-component="Truncate"
|
|
75
|
-
>
|
|
76
|
-
#f00
|
|
77
|
-
</span>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
<div
|
|
82
|
-
class="components-circular-option-picker"
|
|
83
|
-
>
|
|
84
|
-
<div
|
|
85
|
-
aria-label="Custom color picker"
|
|
86
|
-
id="components-circular-option-picker-0"
|
|
87
|
-
role="listbox"
|
|
88
|
-
>
|
|
89
|
-
<div
|
|
90
|
-
class="components-circular-option-picker__swatches"
|
|
91
|
-
>
|
|
92
|
-
<div
|
|
93
|
-
class="components-circular-option-picker__option-group components-circular-option-picker__swatches"
|
|
94
|
-
>
|
|
95
|
-
<div
|
|
96
|
-
class="components-circular-option-picker__option-wrapper"
|
|
97
|
-
>
|
|
98
|
-
<button
|
|
99
|
-
aria-label="red"
|
|
100
|
-
aria-selected="true"
|
|
101
|
-
class="components-button components-circular-option-picker__option is-next-40px-default-size"
|
|
102
|
-
data-active-item="true"
|
|
103
|
-
id="components-circular-option-picker-0-0"
|
|
104
|
-
role="option"
|
|
105
|
-
style="background-color: rgb(255, 0, 0); color: rgb(255, 0, 0);"
|
|
106
|
-
type="button"
|
|
107
|
-
/>
|
|
108
|
-
<svg
|
|
109
|
-
aria-hidden="true"
|
|
110
|
-
fill="#000"
|
|
111
|
-
focusable="false"
|
|
112
|
-
height="24"
|
|
113
|
-
viewBox="0 0 24 24"
|
|
114
|
-
width="24"
|
|
115
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
116
|
-
>
|
|
117
|
-
<path
|
|
118
|
-
d="M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z"
|
|
119
|
-
/>
|
|
120
|
-
</svg>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
<div
|
|
126
|
-
class="components-circular-option-picker__custom-clear-wrapper"
|
|
127
|
-
>
|
|
128
|
-
<button
|
|
129
|
-
class="components-button components-circular-option-picker__clear is-next-40px-default-size is-tertiary"
|
|
130
|
-
type="button"
|
|
131
|
-
>
|
|
132
|
-
Clear
|
|
133
|
-
</button>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
</fieldset>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
`;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
|
-
|
|
3
|
-
exports[`InnerBlocks should force serialize for invalid block with inner blocks 1`] = `
|
|
4
|
-
"<!-- wp:test-block -->
|
|
5
|
-
<p>Invalid<!-- wp:test-block -->
|
|
6
|
-
<p></p>
|
|
7
|
-
<!-- /wp:test-block --></p>
|
|
8
|
-
<!-- /wp:test-block -->"
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
exports[`InnerBlocks should return element as string, with inner blocks 1`] = `
|
|
12
|
-
"<div>Bananas<!-- wp:fruit {"fruit":"Apples"} -->
|
|
13
|
-
<div>Apples</div>
|
|
14
|
-
<!-- /wp:fruit --></div>"
|
|
15
|
-
`;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { BACKSPACE, ESCAPE } from '@wordpress/keycodes';
|
|
2
|
-
import { privateApis as richTextPrivateApis } from '@wordpress/rich-text';
|
|
3
|
-
import { store as blockEditorStore } from '../../../store';
|
|
4
|
-
import { unlock } from '../../../lock-unlock';
|
|
5
|
-
|
|
6
|
-
const { subscribeOwnedListener } = unlock( richTextPrivateApis );
|
|
7
|
-
|
|
8
|
-
export default ( props ) => ( element ) => {
|
|
9
|
-
function onKeyDown( event ) {
|
|
10
|
-
const { keyCode } = event;
|
|
11
|
-
|
|
12
|
-
if ( event.defaultPrevented ) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if ( keyCode !== BACKSPACE && keyCode !== ESCAPE ) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const { registry } = props.current;
|
|
21
|
-
const { didAutomaticChange, getSettings } =
|
|
22
|
-
registry.select( blockEditorStore );
|
|
23
|
-
|
|
24
|
-
const { __experimentalUndo } = getSettings();
|
|
25
|
-
|
|
26
|
-
if ( ! __experimentalUndo ) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if ( ! didAutomaticChange() ) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
event.preventDefault();
|
|
35
|
-
__experimentalUndo();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return subscribeOwnedListener( element, 'keydown', onKeyDown );
|
|
39
|
-
};
|