@wordpress/block-editor 8.3.1 → 8.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +56 -18
- package/build/components/alignment-control/index.js +13 -6
- package/build/components/alignment-control/index.js.map +1 -1
- package/build/components/block-alignment-control/index.js +13 -6
- package/build/components/block-alignment-control/index.js.map +1 -1
- package/build/components/block-content-overlay/index.js +13 -4
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/index.js +2 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-icon/index.js +4 -0
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +4 -1
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block.js +4 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -6
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +22 -6
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js +7 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build/components/block-list-appender/index.js +6 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-lock/index.js +40 -0
- package/build/components/block-lock/index.js.map +1 -0
- package/build/components/block-lock/menu-item.js +52 -0
- package/build/components/block-lock/menu-item.js.map +1 -0
- package/build/components/block-lock/modal.js +155 -0
- package/build/components/block-lock/modal.js.map +1 -0
- package/build/components/block-lock/toolbar.js +65 -0
- package/build/components/block-lock/toolbar.js.map +1 -0
- package/build/components/block-lock/use-block-lock.js +53 -0
- package/build/components/block-lock/use-block-lock.js.map +1 -0
- package/build/components/block-mover/index.js +4 -0
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +37 -22
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -3
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +4 -2
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +75 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +19 -9
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +8 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +2 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +8 -6
- package/build/components/block-title/use-block-display-title.js.map +1 -1
- package/build/components/block-toolbar/block-name-context.js +17 -0
- package/build/components/block-toolbar/block-name-context.js.map +1 -0
- package/build/components/block-toolbar/block-toolbar-last-item.js +20 -0
- package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
- package/build/components/block-toolbar/index.js +24 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +0 -16
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +92 -47
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/index.js +13 -6
- package/build/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build/components/border-radius-control/index.js +0 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +1 -1
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +3 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/contrast-checker/index.js +4 -0
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +8 -0
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +105 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -0
- package/build/components/copy-handler/index.js +4 -0
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +132 -0
- package/build/components/date-format-picker/index.js.map +1 -0
- package/build/components/font-sizes/font-size-picker.js +4 -0
- package/build/components/font-sizes/font-size-picker.js.map +1 -1
- package/build/components/iframe/index.js +6 -9
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +27 -0
- package/build/components/index.js.map +1 -1
- package/build/components/justify-content-control/index.js +13 -6
- package/build/components/justify-content-control/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/line-height-control/index.js +15 -6
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +18 -23
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +38 -13
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +16 -13
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +7 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +9 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-replace-flow/index.js +4 -0
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +1 -1
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/rich-text/index.js +27 -5
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +13 -9
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/split-value.js +12 -2
- package/build/components/rich-text/split-value.js.map +1 -1
- package/build/components/rich-text/use-firefox-compat.js +49 -0
- package/build/components/rich-text/use-firefox-compat.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +34 -2
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -0
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +11 -27
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/index.js +9 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +3 -44
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +68 -0
- package/build/components/writing-flow/use-click-selection.js.map +1 -0
- package/build/components/writing-flow/use-drag-selection.js +134 -0
- package/build/components/writing-flow/use-drag-selection.js.map +1 -0
- package/build/components/writing-flow/use-input.js +116 -0
- package/build/components/writing-flow/use-input.js.map +1 -0
- package/build/components/writing-flow/use-multi-selection.js +18 -38
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +161 -0
- package/build/components/writing-flow/use-selection-observer.js.map +1 -0
- package/build/components/writing-flow/use-tab-nav.js +1 -8
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/anchor.js +7 -6
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border-color.js +3 -3
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border.js +0 -14
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +20 -17
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-family.js +5 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +4 -2
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +77 -5
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/layout.js +7 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +34 -3
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +29 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +82 -15
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +22 -13
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +297 -51
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +25 -13
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +197 -23
- package/build/store/selectors.js.map +1 -1
- package/build/utils/dom.js +2 -1
- package/build/utils/dom.js.map +1 -1
- package/build-module/components/alignment-control/index.js +12 -4
- package/build-module/components/alignment-control/index.js.map +1 -1
- package/build-module/components/block-alignment-control/index.js +12 -4
- package/build-module/components/block-alignment-control/index.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +13 -4
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +2 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -0
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -2
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block.js +5 -2
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -4
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +22 -6
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js +7 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +6 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-lock/index.js +5 -0
- package/build-module/components/block-lock/index.js.map +1 -0
- package/build-module/components/block-lock/menu-item.js +39 -0
- package/build-module/components/block-lock/menu-item.js.map +1 -0
- package/build-module/components/block-lock/modal.js +138 -0
- package/build-module/components/block-lock/modal.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +51 -0
- package/build-module/components/block-lock/toolbar.js.map +1 -0
- package/build-module/components/block-lock/use-block-lock.js +44 -0
- package/build-module/components/block-lock/use-block-lock.js.map +1 -0
- package/build-module/components/block-mover/index.js +4 -0
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +39 -24
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -2
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +75 -12
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +18 -9
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +9 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +2 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +8 -6
- package/build-module/components/block-title/use-block-display-title.js.map +1 -1
- package/build-module/components/block-toolbar/block-name-context.js +9 -0
- package/build-module/components/block-toolbar/block-name-context.js.map +1 -0
- package/build-module/components/block-toolbar/block-toolbar-last-item.js +11 -0
- package/build-module/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +19 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +0 -16
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +95 -49
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/index.js +12 -4
- package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +0 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +1 -1
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +3 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +4 -0
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +2 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +90 -0
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -0
- package/build-module/components/copy-handler/index.js +4 -0
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +122 -0
- package/build-module/components/date-format-picker/index.js.map +1 -0
- package/build-module/components/font-sizes/font-size-picker.js +4 -0
- package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -9
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +3 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/justify-content-control/index.js +12 -4
- package/build-module/components/justify-content-control/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +14 -5
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +19 -23
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +36 -13
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +16 -13
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +7 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +10 -3
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +4 -0
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +26 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +13 -9
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/split-value.js +12 -2
- package/build-module/components/rich-text/split-value.js.map +1 -1
- package/build-module/components/rich-text/use-firefox-compat.js +39 -0
- package/build-module/components/rich-text/use-firefox-compat.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +35 -4
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +4 -0
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +12 -28
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/index.js +5 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +4 -45
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +57 -0
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -0
- package/build-module/components/writing-flow/use-drag-selection.js +124 -0
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -0
- package/build-module/components/writing-flow/use-input.js +104 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -0
- package/build-module/components/writing-flow/use-multi-selection.js +18 -37
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +150 -0
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -0
- package/build-module/components/writing-flow/use-tab-nav.js +1 -9
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/anchor.js +7 -6
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border-color.js +5 -5
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border.js +0 -12
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +19 -18
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +4 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +75 -7
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/layout.js +7 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +33 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +26 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +81 -16
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +20 -13
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +286 -49
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +25 -13
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +186 -22
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/dom.js +2 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-style/style-rtl.css +248 -49
- package/build-style/style.css +248 -49
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +28 -27
- package/src/components/alignment-control/index.js +9 -4
- package/src/components/block-alignment-control/index.js +9 -4
- package/src/components/block-content-overlay/index.js +19 -2
- package/src/components/block-draggable/index.js +2 -5
- package/src/components/block-icon/index.js +3 -0
- package/src/components/block-inspector/index.js +4 -0
- package/src/components/block-list/block-html.js +8 -4
- package/src/components/block-list/block.js +5 -1
- package/src/components/block-list/style.scss +4 -5
- package/src/components/block-list/use-block-props/index.js +0 -5
- package/src/components/block-list/use-block-props/use-focus-first-element.js +27 -6
- package/src/components/block-list/use-block-props/use-focus-handler.js +8 -0
- package/src/components/block-list-appender/index.js +5 -0
- package/src/components/block-lock/index.js +4 -0
- package/src/components/block-lock/menu-item.js +39 -0
- package/src/components/block-lock/modal.js +194 -0
- package/src/components/block-lock/style.scss +70 -0
- package/src/components/block-lock/toolbar.js +51 -0
- package/src/components/block-lock/use-block-lock.js +49 -0
- package/src/components/block-mover/index.js +3 -0
- package/src/components/block-mover/style.scss +4 -0
- package/src/components/block-pattern-setup/index.js +84 -59
- package/src/components/block-pattern-setup/setup-toolbar.js +3 -1
- package/src/components/block-pattern-setup/style.scss +32 -26
- package/src/components/block-preview/auto.js +10 -1
- package/src/components/block-preview/index.js +2 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +109 -9
- package/src/components/block-settings-menu-controls/index.js +33 -12
- package/src/components/block-switcher/index.js +15 -3
- package/src/components/block-switcher/style.scss +15 -4
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +15 -13
- package/src/components/block-switcher/test/index.js +2 -2
- package/src/components/block-title/README.md +6 -1
- package/src/components/block-title/index.js +2 -2
- package/src/components/block-title/test/index.js +43 -1
- package/src/components/block-title/use-block-display-title.js +10 -7
- package/src/components/block-toolbar/block-name-context.js +8 -0
- package/src/components/block-toolbar/block-toolbar-last-item.js +12 -0
- package/src/components/block-toolbar/index.js +24 -2
- package/src/components/block-toolbar/style.scss +10 -0
- package/src/components/block-tools/index.js +0 -19
- package/src/components/block-tools/style.scss +27 -0
- package/src/components/block-variation-transforms/index.js +105 -36
- package/src/components/block-variation-transforms/style.scss +1 -1
- package/src/components/block-vertical-alignment-control/index.js +9 -4
- package/src/components/border-radius-control/index.js +0 -1
- package/src/components/border-radius-control/test/utils.js +4 -0
- package/src/components/border-radius-control/utils.js +2 -1
- package/src/components/button-block-appender/style.scss +5 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +70 -4
- package/src/components/colors-gradients/control.js +1 -1
- package/src/components/colors-gradients/style.scss +6 -0
- package/src/components/contrast-checker/index.js +3 -0
- package/src/components/convert-to-group-buttons/index.js +6 -1
- package/src/components/convert-to-group-buttons/toolbar.js +87 -0
- package/src/components/copy-handler/index.js +3 -0
- package/src/components/date-format-picker/README.md +58 -0
- package/src/components/date-format-picker/index.js +161 -0
- package/src/components/date-format-picker/style.scss +31 -0
- package/src/components/font-sizes/font-size-picker.js +3 -0
- package/src/components/iframe/index.js +5 -7
- package/src/components/index.js +3 -0
- package/src/components/justify-content-control/index.js +9 -4
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/line-height-control/index.js +11 -6
- package/src/components/link-control/README.md +1 -1
- package/src/components/list-view/block-select-button.js +14 -31
- package/src/components/list-view/block.js +55 -13
- package/src/components/list-view/branch.js +37 -15
- package/src/components/list-view/index.js +6 -0
- package/src/components/list-view/style.scss +56 -14
- package/src/components/list-view/use-block-selection.js +15 -2
- package/src/components/media-placeholder/README.md +8 -0
- package/src/components/media-replace-flow/index.js +3 -0
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/rich-text/index.js +25 -2
- package/src/components/rich-text/index.native.js +24 -8
- package/src/components/rich-text/split-value.js +5 -1
- package/src/components/rich-text/use-firefox-compat.js +39 -0
- package/src/components/rich-text/use-input-rules.js +40 -3
- package/src/components/skip-to-selected-block/index.js +3 -0
- package/src/components/url-input/style.scss +3 -2
- package/src/components/url-popover/image-url-input-ui.js +16 -29
- package/src/components/writing-flow/index.js +8 -0
- package/src/components/writing-flow/readme.md +28 -0
- package/src/components/writing-flow/use-arrow-nav.js +4 -53
- package/src/components/writing-flow/use-click-selection.js +65 -0
- package/src/components/writing-flow/use-drag-selection.js +126 -0
- package/src/components/writing-flow/use-input.js +112 -0
- package/src/components/writing-flow/use-multi-selection.js +13 -36
- package/src/components/writing-flow/use-selection-observer.js +153 -0
- package/src/components/writing-flow/use-tab-nav.js +1 -11
- package/src/hooks/anchor.js +8 -6
- package/src/hooks/border-color.js +5 -5
- package/src/hooks/border.js +0 -13
- package/src/hooks/color.js +51 -24
- package/src/hooks/font-family.js +5 -2
- package/src/hooks/font-size.js +10 -7
- package/src/hooks/gap.js +91 -12
- package/src/hooks/layout.js +11 -1
- package/src/hooks/style.js +40 -4
- package/src/hooks/test/gap.js +66 -0
- package/src/hooks/test/style.js +94 -0
- package/src/hooks/test/utils.js +1 -1
- package/src/hooks/utils.js +26 -0
- package/src/layouts/flex.js +93 -6
- package/src/layouts/flow.js +28 -12
- package/src/store/actions.js +349 -32
- package/src/store/defaults.js +7 -1
- package/src/store/reducer.js +25 -10
- package/src/store/selectors.js +229 -27
- package/src/store/test/selectors.js +305 -5
- package/src/style.scss +2 -0
- package/src/utils/dom.js +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +0 -205
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
- package/build/components/block-list/use-block-props/use-scroll-into-view.js +0 -77
- package/build/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +0 -192
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js +0 -63
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
- package/src/components/block-list/use-block-props/use-multi-selection.js +0 -227
- package/src/components/block-list/use-block-props/use-scroll-into-view.js +0 -73
package/src/store/actions.js
CHANGED
|
@@ -100,6 +100,15 @@ export const validateBlocksToTemplate = ( blocks ) => ( {
|
|
|
100
100
|
* text value. See `wp.richText.create`.
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* A selection object.
|
|
105
|
+
*
|
|
106
|
+
* @typedef {Object} WPSelection
|
|
107
|
+
*
|
|
108
|
+
* @property {WPBlockSelection} start The selection start.
|
|
109
|
+
* @property {WPBlockSelection} end The selection end.
|
|
110
|
+
*/
|
|
111
|
+
|
|
103
112
|
/* eslint-disable jsdoc/valid-types */
|
|
104
113
|
/**
|
|
105
114
|
* Returns an action object used in signalling that selection state should be
|
|
@@ -601,7 +610,7 @@ export const insertBlocks = (
|
|
|
601
610
|
* @param {?string} rootClientId Optional root client ID of block list on
|
|
602
611
|
* which to insert.
|
|
603
612
|
* @param {?number} index Index at which block should be inserted.
|
|
604
|
-
* @param {Object} __unstableOptions
|
|
613
|
+
* @param {Object} __unstableOptions Whether or not to show an inserter button.
|
|
605
614
|
*
|
|
606
615
|
* @return {Object} Action object.
|
|
607
616
|
*/
|
|
@@ -658,6 +667,326 @@ export const synchronizeTemplate = () => ( { select, dispatch } ) => {
|
|
|
658
667
|
dispatch.resetBlocks( updatedBlockList );
|
|
659
668
|
};
|
|
660
669
|
|
|
670
|
+
function mapRichTextSettings( attributeDefinition ) {
|
|
671
|
+
const {
|
|
672
|
+
multiline: multilineTag,
|
|
673
|
+
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
674
|
+
__unstablePreserveWhiteSpace: preserveWhiteSpace,
|
|
675
|
+
} = attributeDefinition;
|
|
676
|
+
return {
|
|
677
|
+
multilineTag,
|
|
678
|
+
multilineWrapperTags,
|
|
679
|
+
preserveWhiteSpace,
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Delete the current selection.
|
|
685
|
+
*
|
|
686
|
+
* @param {boolean} isForward
|
|
687
|
+
*/
|
|
688
|
+
export const __unstableDeleteSelection = ( isForward ) => ( {
|
|
689
|
+
registry,
|
|
690
|
+
select,
|
|
691
|
+
dispatch,
|
|
692
|
+
} ) => {
|
|
693
|
+
const selectionAnchor = select.getSelectionStart();
|
|
694
|
+
const selectionFocus = select.getSelectionEnd();
|
|
695
|
+
|
|
696
|
+
if ( selectionAnchor.clientId === selectionFocus.clientId ) return;
|
|
697
|
+
|
|
698
|
+
// It's not mergeable if there's no rich text selection.
|
|
699
|
+
if (
|
|
700
|
+
! selectionAnchor.attributeKey ||
|
|
701
|
+
! selectionFocus.attributeKey ||
|
|
702
|
+
typeof selectionAnchor.offset === 'undefined' ||
|
|
703
|
+
typeof selectionFocus.offset === 'undefined'
|
|
704
|
+
)
|
|
705
|
+
return false;
|
|
706
|
+
|
|
707
|
+
const anchorRootClientId = select.getBlockRootClientId(
|
|
708
|
+
selectionAnchor.clientId
|
|
709
|
+
);
|
|
710
|
+
const focusRootClientId = select.getBlockRootClientId(
|
|
711
|
+
selectionFocus.clientId
|
|
712
|
+
);
|
|
713
|
+
|
|
714
|
+
// It's not mergeable if the selection doesn't start and end in the same
|
|
715
|
+
// block list. Maybe in the future it should be allowed.
|
|
716
|
+
if ( anchorRootClientId !== focusRootClientId ) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
const blockOrder = select.getBlockOrder( anchorRootClientId );
|
|
721
|
+
const anchorIndex = blockOrder.indexOf( selectionAnchor.clientId );
|
|
722
|
+
const focusIndex = blockOrder.indexOf( selectionFocus.clientId );
|
|
723
|
+
|
|
724
|
+
// Reassign selection start and end based on order.
|
|
725
|
+
let selectionStart, selectionEnd;
|
|
726
|
+
|
|
727
|
+
if ( anchorIndex > focusIndex ) {
|
|
728
|
+
selectionStart = selectionFocus;
|
|
729
|
+
selectionEnd = selectionAnchor;
|
|
730
|
+
} else {
|
|
731
|
+
selectionStart = selectionAnchor;
|
|
732
|
+
selectionEnd = selectionFocus;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
const targetSelection = isForward ? selectionEnd : selectionStart;
|
|
736
|
+
const targetBlock = select.getBlock( targetSelection.clientId );
|
|
737
|
+
const targetBlockType = getBlockType( targetBlock.name );
|
|
738
|
+
|
|
739
|
+
if ( ! targetBlockType.merge ) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
const selectionA = selectionStart;
|
|
744
|
+
const selectionB = selectionEnd;
|
|
745
|
+
|
|
746
|
+
const blockA = select.getBlock( selectionA.clientId );
|
|
747
|
+
const blockAType = getBlockType( blockA.name );
|
|
748
|
+
|
|
749
|
+
const blockB = select.getBlock( selectionB.clientId );
|
|
750
|
+
const blockBType = getBlockType( blockB.name );
|
|
751
|
+
|
|
752
|
+
const htmlA = blockA.attributes[ selectionA.attributeKey ];
|
|
753
|
+
const htmlB = blockB.attributes[ selectionB.attributeKey ];
|
|
754
|
+
|
|
755
|
+
const attributeDefinitionA =
|
|
756
|
+
blockAType.attributes[ selectionA.attributeKey ];
|
|
757
|
+
const attributeDefinitionB =
|
|
758
|
+
blockBType.attributes[ selectionB.attributeKey ];
|
|
759
|
+
|
|
760
|
+
let valueA = create( {
|
|
761
|
+
html: htmlA,
|
|
762
|
+
...mapRichTextSettings( attributeDefinitionA ),
|
|
763
|
+
} );
|
|
764
|
+
let valueB = create( {
|
|
765
|
+
html: htmlB,
|
|
766
|
+
...mapRichTextSettings( attributeDefinitionB ),
|
|
767
|
+
} );
|
|
768
|
+
|
|
769
|
+
// A robust way to retain selection position through various transforms
|
|
770
|
+
// is to insert a special character at the position and then recover it.
|
|
771
|
+
const START_OF_SELECTED_AREA = '\u0086';
|
|
772
|
+
|
|
773
|
+
valueA = remove( valueA, selectionA.offset, valueA.text.length );
|
|
774
|
+
valueB = insert( valueB, START_OF_SELECTED_AREA, 0, selectionB.offset );
|
|
775
|
+
|
|
776
|
+
// Clone the blocks so we don't manipulate the original.
|
|
777
|
+
const cloneA = cloneBlock( blockA, {
|
|
778
|
+
[ selectionA.attributeKey ]: toHTMLString( {
|
|
779
|
+
value: valueA,
|
|
780
|
+
...mapRichTextSettings( attributeDefinitionA ),
|
|
781
|
+
} ),
|
|
782
|
+
} );
|
|
783
|
+
const cloneB = cloneBlock( blockB, {
|
|
784
|
+
[ selectionB.attributeKey ]: toHTMLString( {
|
|
785
|
+
value: valueB,
|
|
786
|
+
...mapRichTextSettings( attributeDefinitionB ),
|
|
787
|
+
} ),
|
|
788
|
+
} );
|
|
789
|
+
|
|
790
|
+
const followingBlock = isForward ? cloneA : cloneB;
|
|
791
|
+
|
|
792
|
+
// We can only merge blocks with similar types
|
|
793
|
+
// thus, we transform the block to merge first
|
|
794
|
+
const blocksWithTheSameType =
|
|
795
|
+
blockA.name === blockB.name
|
|
796
|
+
? [ followingBlock ]
|
|
797
|
+
: switchToBlockType( followingBlock, targetBlockType.name );
|
|
798
|
+
|
|
799
|
+
// If the block types can not match, do nothing
|
|
800
|
+
if ( ! blocksWithTheSameType || ! blocksWithTheSameType.length ) {
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
let updatedAttributes;
|
|
805
|
+
|
|
806
|
+
if ( isForward ) {
|
|
807
|
+
const blockToMerge = blocksWithTheSameType.pop();
|
|
808
|
+
updatedAttributes = targetBlockType.merge(
|
|
809
|
+
blockToMerge.attributes,
|
|
810
|
+
cloneB.attributes
|
|
811
|
+
);
|
|
812
|
+
} else {
|
|
813
|
+
const blockToMerge = blocksWithTheSameType.shift();
|
|
814
|
+
updatedAttributes = targetBlockType.merge(
|
|
815
|
+
cloneA.attributes,
|
|
816
|
+
blockToMerge.attributes
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
const newAttributeKey = findKey(
|
|
821
|
+
updatedAttributes,
|
|
822
|
+
( v ) =>
|
|
823
|
+
typeof v === 'string' && v.indexOf( START_OF_SELECTED_AREA ) !== -1
|
|
824
|
+
);
|
|
825
|
+
|
|
826
|
+
const convertedHtml = updatedAttributes[ newAttributeKey ];
|
|
827
|
+
const convertedValue = create( {
|
|
828
|
+
html: convertedHtml,
|
|
829
|
+
...mapRichTextSettings( targetBlockType.attributes[ newAttributeKey ] ),
|
|
830
|
+
} );
|
|
831
|
+
const newOffset = convertedValue.text.indexOf( START_OF_SELECTED_AREA );
|
|
832
|
+
const newValue = remove( convertedValue, newOffset, newOffset + 1 );
|
|
833
|
+
const newHtml = toHTMLString( {
|
|
834
|
+
value: newValue,
|
|
835
|
+
...mapRichTextSettings( targetBlockType.attributes[ newAttributeKey ] ),
|
|
836
|
+
} );
|
|
837
|
+
|
|
838
|
+
updatedAttributes[ newAttributeKey ] = newHtml;
|
|
839
|
+
|
|
840
|
+
const selectedBlockClientIds = select.getSelectedBlockClientIds();
|
|
841
|
+
const replacement = [
|
|
842
|
+
...( isForward ? blocksWithTheSameType : [] ),
|
|
843
|
+
{
|
|
844
|
+
// Preserve the original client ID.
|
|
845
|
+
...targetBlock,
|
|
846
|
+
attributes: {
|
|
847
|
+
...targetBlock.attributes,
|
|
848
|
+
...updatedAttributes,
|
|
849
|
+
},
|
|
850
|
+
},
|
|
851
|
+
...( isForward ? [] : blocksWithTheSameType ),
|
|
852
|
+
];
|
|
853
|
+
|
|
854
|
+
registry.batch( () => {
|
|
855
|
+
dispatch.selectionChange(
|
|
856
|
+
targetBlock.clientId,
|
|
857
|
+
newAttributeKey,
|
|
858
|
+
newOffset,
|
|
859
|
+
newOffset
|
|
860
|
+
);
|
|
861
|
+
|
|
862
|
+
dispatch.replaceBlocks(
|
|
863
|
+
selectedBlockClientIds,
|
|
864
|
+
replacement,
|
|
865
|
+
0, // If we don't pass the `indexToSelect` it will default to the last block.
|
|
866
|
+
select.getSelectedBlocksInitialCaretPosition()
|
|
867
|
+
);
|
|
868
|
+
} );
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* Split the current selection.
|
|
873
|
+
*/
|
|
874
|
+
export const __unstableSplitSelection = () => ( { select, dispatch } ) => {
|
|
875
|
+
const selectionAnchor = select.getSelectionStart();
|
|
876
|
+
const selectionFocus = select.getSelectionEnd();
|
|
877
|
+
|
|
878
|
+
if ( selectionAnchor.clientId === selectionFocus.clientId ) return;
|
|
879
|
+
|
|
880
|
+
// Can't split if the selection is not set.
|
|
881
|
+
if (
|
|
882
|
+
! selectionAnchor.attributeKey ||
|
|
883
|
+
! selectionFocus.attributeKey ||
|
|
884
|
+
typeof selectionAnchor.offset === 'undefined' ||
|
|
885
|
+
typeof selectionFocus.offset === 'undefined'
|
|
886
|
+
)
|
|
887
|
+
return;
|
|
888
|
+
|
|
889
|
+
const anchorRootClientId = select.getBlockRootClientId(
|
|
890
|
+
selectionAnchor.clientId
|
|
891
|
+
);
|
|
892
|
+
const focusRootClientId = select.getBlockRootClientId(
|
|
893
|
+
selectionFocus.clientId
|
|
894
|
+
);
|
|
895
|
+
|
|
896
|
+
// It's not splittable if the selection doesn't start and end in the same
|
|
897
|
+
// block list. Maybe in the future it should be allowed.
|
|
898
|
+
if ( anchorRootClientId !== focusRootClientId ) {
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
const blockOrder = select.getBlockOrder( anchorRootClientId );
|
|
903
|
+
const anchorIndex = blockOrder.indexOf( selectionAnchor.clientId );
|
|
904
|
+
const focusIndex = blockOrder.indexOf( selectionFocus.clientId );
|
|
905
|
+
|
|
906
|
+
// Reassign selection start and end based on order.
|
|
907
|
+
let selectionStart, selectionEnd;
|
|
908
|
+
|
|
909
|
+
if ( anchorIndex > focusIndex ) {
|
|
910
|
+
selectionStart = selectionFocus;
|
|
911
|
+
selectionEnd = selectionAnchor;
|
|
912
|
+
} else {
|
|
913
|
+
selectionStart = selectionAnchor;
|
|
914
|
+
selectionEnd = selectionFocus;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
const selectionA = selectionStart;
|
|
918
|
+
const selectionB = selectionEnd;
|
|
919
|
+
|
|
920
|
+
const blockA = select.getBlock( selectionA.clientId );
|
|
921
|
+
const blockAType = getBlockType( blockA.name );
|
|
922
|
+
|
|
923
|
+
const blockB = select.getBlock( selectionB.clientId );
|
|
924
|
+
const blockBType = getBlockType( blockB.name );
|
|
925
|
+
|
|
926
|
+
const htmlA = blockA.attributes[ selectionA.attributeKey ];
|
|
927
|
+
const htmlB = blockB.attributes[ selectionB.attributeKey ];
|
|
928
|
+
|
|
929
|
+
const attributeDefinitionA =
|
|
930
|
+
blockAType.attributes[ selectionA.attributeKey ];
|
|
931
|
+
const attributeDefinitionB =
|
|
932
|
+
blockBType.attributes[ selectionB.attributeKey ];
|
|
933
|
+
|
|
934
|
+
let valueA = create( {
|
|
935
|
+
html: htmlA,
|
|
936
|
+
...mapRichTextSettings( attributeDefinitionA ),
|
|
937
|
+
} );
|
|
938
|
+
let valueB = create( {
|
|
939
|
+
html: htmlB,
|
|
940
|
+
...mapRichTextSettings( attributeDefinitionB ),
|
|
941
|
+
} );
|
|
942
|
+
|
|
943
|
+
valueA = remove( valueA, selectionA.offset, valueA.text.length );
|
|
944
|
+
valueB = remove( valueB, 0, selectionB.offset );
|
|
945
|
+
|
|
946
|
+
dispatch.replaceBlocks(
|
|
947
|
+
select.getSelectedBlockClientIds(),
|
|
948
|
+
[
|
|
949
|
+
{
|
|
950
|
+
// Preserve the original client ID.
|
|
951
|
+
...blockA,
|
|
952
|
+
attributes: {
|
|
953
|
+
...blockA.attributes,
|
|
954
|
+
[ selectionA.attributeKey ]: toHTMLString( {
|
|
955
|
+
value: valueA,
|
|
956
|
+
...mapRichTextSettings( attributeDefinitionA ),
|
|
957
|
+
} ),
|
|
958
|
+
},
|
|
959
|
+
},
|
|
960
|
+
createBlock( getDefaultBlockName() ),
|
|
961
|
+
{
|
|
962
|
+
// Preserve the original client ID.
|
|
963
|
+
...blockB,
|
|
964
|
+
attributes: {
|
|
965
|
+
...blockB.attributes,
|
|
966
|
+
[ selectionB.attributeKey ]: toHTMLString( {
|
|
967
|
+
value: valueB,
|
|
968
|
+
...mapRichTextSettings( attributeDefinitionB ),
|
|
969
|
+
} ),
|
|
970
|
+
},
|
|
971
|
+
},
|
|
972
|
+
],
|
|
973
|
+
1, // If we don't pass the `indexToSelect` it will default to the last block.
|
|
974
|
+
select.getSelectedBlocksInitialCaretPosition()
|
|
975
|
+
);
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Expand the selection to cover the entire blocks, removing partial selection.
|
|
980
|
+
*/
|
|
981
|
+
export const __unstableExpandSelection = () => ( { select, dispatch } ) => {
|
|
982
|
+
const selectionAnchor = select.getSelectionStart();
|
|
983
|
+
const selectionFocus = select.getSelectionEnd();
|
|
984
|
+
dispatch.selectionChange( {
|
|
985
|
+
start: { clientId: selectionAnchor.clientId },
|
|
986
|
+
end: { clientId: selectionFocus.clientId },
|
|
987
|
+
} );
|
|
988
|
+
};
|
|
989
|
+
|
|
661
990
|
/**
|
|
662
991
|
* Action that merges two blocks.
|
|
663
992
|
*
|
|
@@ -719,17 +1048,10 @@ export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
|
|
|
719
1048
|
if ( canRestoreTextSelection ) {
|
|
720
1049
|
const selectedBlock = clientId === clientIdA ? cloneA : cloneB;
|
|
721
1050
|
const html = selectedBlock.attributes[ attributeKey ];
|
|
722
|
-
const {
|
|
723
|
-
multiline: multilineTag,
|
|
724
|
-
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
725
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace,
|
|
726
|
-
} = attributeDefinition;
|
|
727
1051
|
const value = insert(
|
|
728
1052
|
create( {
|
|
729
1053
|
html,
|
|
730
|
-
|
|
731
|
-
multilineWrapperTags,
|
|
732
|
-
preserveWhiteSpace,
|
|
1054
|
+
...mapRichTextSettings( attributeDefinition ),
|
|
733
1055
|
} ),
|
|
734
1056
|
START_OF_SELECTED_AREA,
|
|
735
1057
|
offset,
|
|
@@ -738,8 +1060,7 @@ export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
|
|
|
738
1060
|
|
|
739
1061
|
selectedBlock.attributes[ attributeKey ] = toHTMLString( {
|
|
740
1062
|
value,
|
|
741
|
-
|
|
742
|
-
preserveWhiteSpace,
|
|
1063
|
+
...mapRichTextSettings( attributeDefinition ),
|
|
743
1064
|
} );
|
|
744
1065
|
}
|
|
745
1066
|
|
|
@@ -769,23 +1090,15 @@ export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
|
|
|
769
1090
|
v.indexOf( START_OF_SELECTED_AREA ) !== -1
|
|
770
1091
|
);
|
|
771
1092
|
const convertedHtml = updatedAttributes[ newAttributeKey ];
|
|
772
|
-
const {
|
|
773
|
-
multiline: multilineTag,
|
|
774
|
-
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
775
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace,
|
|
776
|
-
} = blockAType.attributes[ newAttributeKey ];
|
|
777
1093
|
const convertedValue = create( {
|
|
778
1094
|
html: convertedHtml,
|
|
779
|
-
|
|
780
|
-
multilineWrapperTags,
|
|
781
|
-
preserveWhiteSpace,
|
|
1095
|
+
...mapRichTextSettings( blockAType.attributes[ newAttributeKey ] ),
|
|
782
1096
|
} );
|
|
783
1097
|
const newOffset = convertedValue.text.indexOf( START_OF_SELECTED_AREA );
|
|
784
1098
|
const newValue = remove( convertedValue, newOffset, newOffset + 1 );
|
|
785
1099
|
const newHtml = toHTMLString( {
|
|
786
1100
|
value: newValue,
|
|
787
|
-
|
|
788
|
-
preserveWhiteSpace,
|
|
1101
|
+
...mapRichTextSettings( blockAType.attributes[ newAttributeKey ] ),
|
|
789
1102
|
} );
|
|
790
1103
|
|
|
791
1104
|
updatedAttributes[ newAttributeKey ] = newHtml;
|
|
@@ -978,10 +1291,10 @@ export function exitFormattedText() {
|
|
|
978
1291
|
/**
|
|
979
1292
|
* Action that changes the position of the user caret.
|
|
980
1293
|
*
|
|
981
|
-
* @param {string} clientId The selected block client ID.
|
|
982
|
-
* @param {string}
|
|
983
|
-
* @param {number}
|
|
984
|
-
* @param {number}
|
|
1294
|
+
* @param {string|WPSelection} clientId The selected block client ID.
|
|
1295
|
+
* @param {string} attributeKey The selected block attribute key.
|
|
1296
|
+
* @param {number} startOffset The start offset.
|
|
1297
|
+
* @param {number} endOffset The end offset.
|
|
985
1298
|
*
|
|
986
1299
|
* @return {Object} Action object.
|
|
987
1300
|
*/
|
|
@@ -991,13 +1304,17 @@ export function selectionChange(
|
|
|
991
1304
|
startOffset,
|
|
992
1305
|
endOffset
|
|
993
1306
|
) {
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1307
|
+
if ( typeof clientId === 'string' ) {
|
|
1308
|
+
return {
|
|
1309
|
+
type: 'SELECTION_CHANGE',
|
|
1310
|
+
clientId,
|
|
1311
|
+
attributeKey,
|
|
1312
|
+
startOffset,
|
|
1313
|
+
endOffset,
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
return { type: 'SELECTION_CHANGE', ...clientId };
|
|
1001
1318
|
}
|
|
1002
1319
|
|
|
1003
1320
|
/**
|
package/src/store/defaults.js
CHANGED
|
@@ -23,7 +23,9 @@ export const PREFERENCES_DEFAULTS = {
|
|
|
23
23
|
* @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode
|
|
24
24
|
* @property {string} bodyPlaceholder Empty post placeholder
|
|
25
25
|
* @property {string} titlePlaceholder Empty title placeholder
|
|
26
|
+
* @property {boolean} canLockBlocks Whether the user can manage Block Lock state
|
|
26
27
|
* @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor
|
|
28
|
+
* @property {boolean} generateAnchors Enable/Disable auto anchor generation for Heading blocks
|
|
27
29
|
* @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
|
|
28
30
|
* @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory
|
|
29
31
|
* @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns
|
|
@@ -150,14 +152,18 @@ export const SETTINGS_DEFAULTS = {
|
|
|
150
152
|
// List of allowed mime types and file extensions.
|
|
151
153
|
allowedMimeTypes: null,
|
|
152
154
|
|
|
155
|
+
// Allows to disable block locking interface.
|
|
156
|
+
canLockBlocks: true,
|
|
157
|
+
|
|
153
158
|
__experimentalCanUserUseUnfilteredHTML: false,
|
|
154
159
|
__experimentalBlockDirectory: false,
|
|
155
160
|
__mobileEnablePageTemplates: false,
|
|
156
161
|
__experimentalBlockPatterns: [],
|
|
157
162
|
__experimentalBlockPatternCategories: [],
|
|
158
163
|
__experimentalSpotlightEntityBlocks: [],
|
|
159
|
-
__experimentalGenerateAnchors: false,
|
|
160
164
|
__unstableGalleryWithImageBlocks: false,
|
|
165
|
+
|
|
166
|
+
generateAnchors: false,
|
|
161
167
|
// gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
|
|
162
168
|
// The setting is only kept for backward compatibility purposes.
|
|
163
169
|
gradients: [
|
package/src/store/reducer.js
CHANGED
|
@@ -1278,17 +1278,24 @@ function selectionHelper( state = {}, action ) {
|
|
|
1278
1278
|
export function selection( state = {}, action ) {
|
|
1279
1279
|
switch ( action.type ) {
|
|
1280
1280
|
case 'SELECTION_CHANGE':
|
|
1281
|
+
if ( action.clientId ) {
|
|
1282
|
+
return {
|
|
1283
|
+
selectionStart: {
|
|
1284
|
+
clientId: action.clientId,
|
|
1285
|
+
attributeKey: action.attributeKey,
|
|
1286
|
+
offset: action.startOffset,
|
|
1287
|
+
},
|
|
1288
|
+
selectionEnd: {
|
|
1289
|
+
clientId: action.clientId,
|
|
1290
|
+
attributeKey: action.attributeKey,
|
|
1291
|
+
offset: action.endOffset,
|
|
1292
|
+
},
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1281
1296
|
return {
|
|
1282
|
-
selectionStart:
|
|
1283
|
-
|
|
1284
|
-
attributeKey: action.attributeKey,
|
|
1285
|
-
offset: action.startOffset,
|
|
1286
|
-
},
|
|
1287
|
-
selectionEnd: {
|
|
1288
|
-
clientId: action.clientId,
|
|
1289
|
-
attributeKey: action.attributeKey,
|
|
1290
|
-
offset: action.endOffset,
|
|
1291
|
-
},
|
|
1297
|
+
selectionStart: action.start || state.selectionStart,
|
|
1298
|
+
selectionEnd: action.end || state.selectionEnd,
|
|
1292
1299
|
};
|
|
1293
1300
|
case 'RESET_SELECTION':
|
|
1294
1301
|
const { selectionStart, selectionEnd } = action;
|
|
@@ -1298,6 +1305,14 @@ export function selection( state = {}, action ) {
|
|
|
1298
1305
|
};
|
|
1299
1306
|
case 'MULTI_SELECT':
|
|
1300
1307
|
const { start, end } = action;
|
|
1308
|
+
|
|
1309
|
+
if (
|
|
1310
|
+
start === state.selectionStart?.clientId &&
|
|
1311
|
+
end === state.selectionEnd?.clientId
|
|
1312
|
+
) {
|
|
1313
|
+
return state;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1301
1316
|
return {
|
|
1302
1317
|
selectionStart: { clientId: start },
|
|
1303
1318
|
selectionEnd: { clientId: end },
|