@wordpress/block-editor 13.2.0 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +0 -1
- package/build/components/block-breadcrumb/index.js +12 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-lock/toolbar.js +0 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/button.js +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +1 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +5 -7
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +20 -17
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/modal.js +4 -12
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +1 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +7 -58
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build/components/block-tools/index.js +14 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +4 -2
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +57 -0
- package/build/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build/components/block-tools/zoom-out-toolbar.js +138 -0
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build/components/button-block-appender/index.js +3 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +26 -18
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +10 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/dimensions-tool/index.js +6 -4
- package/build/components/dimensions-tool/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +26 -61
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +178 -116
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +8 -0
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +50 -12
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +50 -0
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +23 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +17 -7
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +11 -14
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +2 -2
- package/build/components/grid/grid-item-resizer.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +116 -36
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +29 -22
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/media-placeholder/index.js +19 -23
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +3 -1
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +66 -0
- package/build/components/tabbed-sidebar/index.js.map +1 -0
- package/build/components/url-popover/index.js +3 -0
- package/build/components/url-popover/index.js.map +1 -1
- package/build/hooks/background.js +26 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +11 -17
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +169 -4
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/duotone.js +16 -11
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/grid-visualizer.js +65 -0
- package/build/hooks/grid-visualizer.js.map +1 -0
- package/build/hooks/index.js +15 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +39 -22
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +2 -9
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +16 -6
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/utils.js +2 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +44 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +90 -51
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/defaults.js +0 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +0 -3
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/utils/format-font-style.js +45 -0
- package/build/utils/format-font-style.js.map +1 -0
- package/build/utils/format-font-weight.js +68 -0
- package/build/utils/format-font-weight.js.map +1 -0
- package/build/utils/get-editor-region.js +34 -0
- package/build/utils/get-editor-region.js.map +1 -0
- package/build/utils/get-font-styles-and-weights.js +167 -0
- package/build/utils/get-font-styles-and-weights.js.map +1 -0
- package/build/utils/pasting.js +5 -13
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +12 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +0 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +5 -7
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +20 -17
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +5 -13
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +1 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +10 -61
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build-module/components/block-tools/index.js +14 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +4 -2
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +48 -0
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js +131 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build-module/components/button-block-appender/index.js +3 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +27 -19
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +11 -3
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +6 -4
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +28 -63
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +181 -119
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +3 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +8 -0
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +3 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +52 -14
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +48 -0
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +23 -8
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +15 -6
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +11 -14
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +2 -2
- package/build-module/components/grid/grid-item-resizer.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +117 -37
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +29 -22
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -4
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +19 -23
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +3 -1
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +60 -0
- package/build-module/components/tabbed-sidebar/index.js.map +1 -0
- package/build-module/components/url-popover/index.js +3 -0
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/hooks/background.js +26 -4
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +11 -17
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +168 -4
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/duotone.js +16 -11
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +64 -0
- package/build-module/hooks/grid-visualizer.js.map +1 -0
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +39 -22
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +2 -9
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +16 -6
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/utils.js +2 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +44 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +90 -51
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +8 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/defaults.js +0 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +0 -3
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/utils/format-font-style.js +39 -0
- package/build-module/utils/format-font-style.js.map +1 -0
- package/build-module/utils/format-font-weight.js +62 -0
- package/build-module/utils/format-font-weight.js.map +1 -0
- package/build-module/utils/get-editor-region.js +28 -0
- package/build-module/utils/get-editor-region.js.map +1 -0
- package/build-module/utils/get-font-styles-and-weights.js +160 -0
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -0
- package/build-module/utils/pasting.js +5 -13
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +1 -0
- package/build-style/content.css +1 -0
- package/build-style/style-rtl.css +207 -96
- package/build-style/style.css +207 -96
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +16 -1
- package/src/components/block-lock/toolbar.js +0 -1
- package/src/components/block-mover/button.js +1 -1
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/src/components/block-patterns-paging/index.js +8 -11
- package/src/components/block-patterns-paging/style.scss +18 -0
- package/src/components/block-quick-navigation/index.js +21 -28
- package/src/components/block-rename/modal.js +2 -8
- package/src/components/block-switcher/test/index.js +6 -6
- package/src/components/block-toolbar/shuffle.js +1 -0
- package/src/components/block-toolbar/style.scss +1 -11
- package/src/components/block-tools/block-selection-button.js +11 -83
- package/src/components/block-tools/block-toolbar-breadcrumb.js +9 -4
- package/src/components/block-tools/index.js +21 -1
- package/src/components/block-tools/style.scss +15 -0
- package/src/components/block-tools/use-show-block-tools.js +14 -6
- package/src/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/src/components/block-tools/zoom-out-popover.js +49 -0
- package/src/components/block-tools/zoom-out-toolbar.js +140 -0
- package/src/components/button-block-appender/index.js +2 -1
- package/src/components/child-layout-control/index.js +41 -23
- package/src/components/date-format-picker/index.js +10 -1
- package/src/components/date-format-picker/style.scss +0 -9
- package/src/components/dimensions-tool/index.js +97 -89
- package/src/components/font-appearance-control/index.js +29 -83
- package/src/components/font-appearance-control/style.scss +3 -5
- package/src/components/global-styles/background-panel.js +249 -170
- package/src/components/global-styles/border-panel.js +3 -2
- package/src/components/global-styles/color-panel.js +3 -2
- package/src/components/global-styles/dimensions-panel.js +3 -2
- package/src/components/global-styles/filters-panel.js +3 -2
- package/src/components/global-styles/hooks.js +9 -0
- package/src/components/global-styles/image-settings-panel.js +3 -2
- package/src/components/global-styles/style.scss +105 -20
- package/src/components/global-styles/test/typography-utils.js +269 -0
- package/src/components/global-styles/typography-panel.js +49 -12
- package/src/components/global-styles/typography-utils.js +63 -0
- package/src/components/global-styles/use-global-styles-output.js +23 -8
- package/src/components/global-styles/utils.js +17 -6
- package/src/components/grid/grid-item-movers.js +11 -27
- package/src/components/grid/grid-item-resizer.js +3 -2
- package/src/components/grid/grid-visualizer.js +171 -54
- package/src/components/grid/style.scss +43 -8
- package/src/components/grid/use-grid-layout-sync.js +31 -28
- package/src/components/iframe/content.scss +1 -0
- package/src/components/inner-blocks/index.js +2 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -16
- package/src/components/inserter/menu.js +47 -13
- package/src/components/inserter/quick-inserter.js +6 -1
- package/src/components/inserter/style.scss +1 -49
- package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
- package/src/components/link-control/link-preview.js +1 -1
- package/src/components/media-placeholder/index.js +22 -32
- package/src/components/navigable-toolbar/index.js +3 -1
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -1
- package/src/components/tabbed-sidebar/README.md +76 -0
- package/src/components/tabbed-sidebar/index.js +70 -0
- package/src/components/tabbed-sidebar/style.scss +53 -0
- package/src/components/url-popover/index.js +3 -0
- package/src/hooks/background.js +25 -10
- package/src/hooks/block-hooks.js +9 -16
- package/src/hooks/block-style-variation.js +202 -3
- package/src/hooks/duotone.js +16 -12
- package/src/hooks/grid-visualizer.js +64 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +53 -37
- package/src/hooks/position.js +3 -10
- package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
- package/src/hooks/use-bindings-attributes.js +18 -4
- package/src/hooks/utils.js +2 -0
- package/src/layouts/constrained.js +43 -2
- package/src/layouts/grid.js +146 -51
- package/src/private-apis.js +12 -1
- package/src/store/defaults.js +0 -2
- package/src/store/defaults.native.js +0 -3
- package/src/store/private-keys.js +1 -0
- package/src/style.scss +1 -1
- package/src/utils/format-font-style.js +40 -0
- package/src/utils/format-font-weight.js +63 -0
- package/src/utils/get-editor-region.js +31 -0
- package/src/utils/get-font-styles-and-weights.js +191 -0
- package/src/utils/pasting.js +5 -12
- package/src/utils/test/format-font-style.js +34 -0
- package/src/utils/test/format-font-weight.js +66 -0
- package/src/utils/test/get-font-styles-and-weights.js +513 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/hooks/position.scss +0 -18
package/src/store/defaults.js
CHANGED
|
@@ -33,7 +33,6 @@ export const PREFERENCES_DEFAULTS = {
|
|
|
33
33
|
* @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory
|
|
34
34
|
* @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns
|
|
35
35
|
* @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories
|
|
36
|
-
* @property {boolean} __unstableGalleryWithImageBlocks Whether the user has enabled the refactored gallery block which uses InnerBlocks
|
|
37
36
|
*/
|
|
38
37
|
export const SETTINGS_DEFAULTS = {
|
|
39
38
|
alignWide: false,
|
|
@@ -168,7 +167,6 @@ export const SETTINGS_DEFAULTS = {
|
|
|
168
167
|
__mobileEnablePageTemplates: false,
|
|
169
168
|
__experimentalBlockPatterns: [],
|
|
170
169
|
__experimentalBlockPatternCategories: [],
|
|
171
|
-
__unstableGalleryWithImageBlocks: false,
|
|
172
170
|
__unstableIsPreviewMode: false,
|
|
173
171
|
|
|
174
172
|
// These settings will be completely revamped in the future.
|
|
@@ -10,9 +10,6 @@ const SETTINGS_DEFAULTS = {
|
|
|
10
10
|
...SETTINGS,
|
|
11
11
|
// Don't add the default font sizes for standard themes
|
|
12
12
|
fontSizes: undefined,
|
|
13
|
-
// FOR TESTING ONLY - Later, this will come from a REST API
|
|
14
|
-
// eslint-disable-next-line no-undef
|
|
15
|
-
__unstableGalleryWithImageBlocks: __DEV__,
|
|
16
13
|
alignWide: true,
|
|
17
14
|
supportsLayout: false,
|
|
18
15
|
__experimentalFeatures: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export const globalStylesDataKey = Symbol( 'globalStylesDataKey' );
|
|
2
|
+
export const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );
|
|
2
3
|
export const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );
|
|
3
4
|
export const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );
|
package/src/style.scss
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
@import "./components/rich-text/style.scss";
|
|
43
43
|
@import "./components/segmented-text-control/style.scss";
|
|
44
44
|
@import "./components/skip-to-selected-block/style.scss";
|
|
45
|
+
@import "./components/tabbed-sidebar/style.scss";
|
|
45
46
|
@import "./components/tool-selector/style.scss";
|
|
46
47
|
@import "./components/url-input/style.scss";
|
|
47
48
|
@import "./components/url-popover/style.scss";
|
|
@@ -51,7 +52,6 @@
|
|
|
51
52
|
@import "./hooks/color.scss";
|
|
52
53
|
@import "./hooks/dimensions.scss";
|
|
53
54
|
@import "./hooks/layout.scss";
|
|
54
|
-
@import "./hooks/position.scss";
|
|
55
55
|
@import "./hooks/spacing.scss";
|
|
56
56
|
@import "./hooks/typography.scss";
|
|
57
57
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { _x } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Formats font styles to human readable names.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} fontStyle font style string
|
|
10
|
+
* @return {Object} new object with formatted font style
|
|
11
|
+
*/
|
|
12
|
+
export function formatFontStyle( fontStyle ) {
|
|
13
|
+
if ( ! fontStyle ) {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if ( typeof fontStyle === 'object' ) {
|
|
18
|
+
return fontStyle;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let name;
|
|
22
|
+
|
|
23
|
+
switch ( fontStyle ) {
|
|
24
|
+
case 'normal':
|
|
25
|
+
name = _x( 'Regular', 'font style' );
|
|
26
|
+
break;
|
|
27
|
+
case 'italic':
|
|
28
|
+
name = _x( 'Italic', 'font style' );
|
|
29
|
+
break;
|
|
30
|
+
case 'oblique':
|
|
31
|
+
name = _x( 'Oblique', 'font style' );
|
|
32
|
+
break;
|
|
33
|
+
|
|
34
|
+
default:
|
|
35
|
+
name = fontStyle;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return { name, value: fontStyle };
|
|
40
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { _x } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Formats font weights to human readable names.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} fontWeight font weight string
|
|
10
|
+
* @return {Object} new object with formatted font weight
|
|
11
|
+
*/
|
|
12
|
+
export function formatFontWeight( fontWeight ) {
|
|
13
|
+
if ( ! fontWeight ) {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if ( typeof fontWeight === 'object' ) {
|
|
18
|
+
return fontWeight;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let name;
|
|
22
|
+
|
|
23
|
+
switch ( fontWeight ) {
|
|
24
|
+
case 'normal':
|
|
25
|
+
case '400':
|
|
26
|
+
name = _x( 'Regular', 'font weight' );
|
|
27
|
+
break;
|
|
28
|
+
case 'bold':
|
|
29
|
+
case '700':
|
|
30
|
+
name = _x( 'Bold', 'font weight' );
|
|
31
|
+
break;
|
|
32
|
+
case '100':
|
|
33
|
+
name = _x( 'Thin', 'font weight' );
|
|
34
|
+
break;
|
|
35
|
+
case '200':
|
|
36
|
+
name = _x( 'Extra Light', 'font weight' );
|
|
37
|
+
break;
|
|
38
|
+
case '300':
|
|
39
|
+
name = _x( 'Light', 'font weight' );
|
|
40
|
+
break;
|
|
41
|
+
case '500':
|
|
42
|
+
name = _x( 'Medium', 'font weight' );
|
|
43
|
+
break;
|
|
44
|
+
case '600':
|
|
45
|
+
name = _x( 'Semi Bold', 'font weight' );
|
|
46
|
+
break;
|
|
47
|
+
case '800':
|
|
48
|
+
name = _x( 'Extra Bold', 'font weight' );
|
|
49
|
+
break;
|
|
50
|
+
case '900':
|
|
51
|
+
name = _x( 'Black', 'font weight' );
|
|
52
|
+
break;
|
|
53
|
+
case '1000':
|
|
54
|
+
name = _x( 'Extra Black', 'font weight' );
|
|
55
|
+
break;
|
|
56
|
+
|
|
57
|
+
default:
|
|
58
|
+
name = fontWeight;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return { name, value: fontWeight };
|
|
63
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the editor region for a given editor canvas element or
|
|
3
|
+
* returns the passed element if no region is found
|
|
4
|
+
*
|
|
5
|
+
* @param { Object } editor The editor canvas element.
|
|
6
|
+
* @return { Object } The editor region or given editor element
|
|
7
|
+
*/
|
|
8
|
+
export default function getEditorRegion( editor ) {
|
|
9
|
+
if ( ! editor ) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// If there are multiple editors, we need to find the iframe that contains our contentRef to make sure
|
|
14
|
+
// we're focusing the region that contains this editor.
|
|
15
|
+
const editorCanvas =
|
|
16
|
+
Array.from(
|
|
17
|
+
document.querySelectorAll( 'iframe[name="editor-canvas"]' ).values()
|
|
18
|
+
).find( ( iframe ) => {
|
|
19
|
+
// Find the iframe that contains our contentRef
|
|
20
|
+
const iframeDocument =
|
|
21
|
+
iframe.contentDocument || iframe.contentWindow.document;
|
|
22
|
+
|
|
23
|
+
return iframeDocument === editor.ownerDocument;
|
|
24
|
+
} ) ?? editor;
|
|
25
|
+
|
|
26
|
+
// The region is provivided by the editor, not the block-editor.
|
|
27
|
+
// We should send focus to the region if one is available to reuse the
|
|
28
|
+
// same interface for navigating landmarks. If no region is available,
|
|
29
|
+
// use the canvas instead.
|
|
30
|
+
return editorCanvas?.closest( '[role="region"]' ) ?? editorCanvas;
|
|
31
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { _x, __, sprintf } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { formatFontStyle } from './format-font-style';
|
|
10
|
+
import { formatFontWeight } from './format-font-weight';
|
|
11
|
+
|
|
12
|
+
const FONT_STYLES = [
|
|
13
|
+
{
|
|
14
|
+
name: _x( 'Regular', 'font style' ),
|
|
15
|
+
value: 'normal',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: _x( 'Italic', 'font style' ),
|
|
19
|
+
value: 'italic',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const FONT_WEIGHTS = [
|
|
24
|
+
{
|
|
25
|
+
name: _x( 'Thin', 'font weight' ),
|
|
26
|
+
value: '100',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: _x( 'Extra Light', 'font weight' ),
|
|
30
|
+
value: '200',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: _x( 'Light', 'font weight' ),
|
|
34
|
+
value: '300',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: _x( 'Regular', 'font weight' ),
|
|
38
|
+
value: '400',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: _x( 'Medium', 'font weight' ),
|
|
42
|
+
value: '500',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: _x( 'Semi Bold', 'font weight' ),
|
|
46
|
+
value: '600',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: _x( 'Bold', 'font weight' ),
|
|
50
|
+
value: '700',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: _x( 'Extra Bold', 'font weight' ),
|
|
54
|
+
value: '800',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: _x( 'Black', 'font weight' ),
|
|
58
|
+
value: '900',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: _x( 'Extra Black', 'font weight' ),
|
|
62
|
+
value: '1000',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Builds a list of font style and weight options based on font family faces.
|
|
68
|
+
* Defaults to the standard font styles and weights if no font family faces are provided.
|
|
69
|
+
*
|
|
70
|
+
* @param {Array} fontFamilyFaces font family faces array
|
|
71
|
+
* @return {Object} new object with combined and separated font style and weight properties
|
|
72
|
+
*/
|
|
73
|
+
export function getFontStylesAndWeights( fontFamilyFaces ) {
|
|
74
|
+
let fontStyles = [];
|
|
75
|
+
let fontWeights = [];
|
|
76
|
+
const combinedStyleAndWeightOptions = [];
|
|
77
|
+
const isSystemFont = ! fontFamilyFaces || fontFamilyFaces?.length === 0;
|
|
78
|
+
let isVariableFont = false;
|
|
79
|
+
|
|
80
|
+
fontFamilyFaces?.forEach( ( face ) => {
|
|
81
|
+
// Check for variable font by looking for a space in the font weight value. e.g. "100 900"
|
|
82
|
+
if ( /\s/.test( face.fontWeight.trim() ) ) {
|
|
83
|
+
isVariableFont = true;
|
|
84
|
+
|
|
85
|
+
// Find font weight start and end values.
|
|
86
|
+
let [ startValue, endValue ] = face.fontWeight.split( ' ' );
|
|
87
|
+
startValue = parseInt( startValue.slice( 0, 1 ) );
|
|
88
|
+
if ( endValue === '1000' ) {
|
|
89
|
+
endValue = 10;
|
|
90
|
+
} else {
|
|
91
|
+
endValue = parseInt( endValue.slice( 0, 1 ) );
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Create font weight options for available variable weights.
|
|
95
|
+
for ( let i = startValue; i <= endValue; i++ ) {
|
|
96
|
+
const fontWeightValue = `${ i.toString() }00`;
|
|
97
|
+
if (
|
|
98
|
+
! fontWeights.some(
|
|
99
|
+
( weight ) => weight.value === fontWeightValue
|
|
100
|
+
)
|
|
101
|
+
) {
|
|
102
|
+
fontWeights.push( formatFontWeight( fontWeightValue ) );
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Format font style and weight values.
|
|
108
|
+
const fontWeight = formatFontWeight( face.fontWeight );
|
|
109
|
+
const fontStyle = formatFontStyle( face.fontStyle );
|
|
110
|
+
|
|
111
|
+
// Create font style and font weight lists without duplicates.
|
|
112
|
+
if ( fontStyle ) {
|
|
113
|
+
if (
|
|
114
|
+
! fontStyles.some(
|
|
115
|
+
( style ) => style.value === fontStyle.value
|
|
116
|
+
)
|
|
117
|
+
) {
|
|
118
|
+
fontStyles.push( fontStyle );
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if ( fontWeight ) {
|
|
122
|
+
if (
|
|
123
|
+
! fontWeights.some(
|
|
124
|
+
( weight ) => weight.value === fontWeight.value
|
|
125
|
+
)
|
|
126
|
+
) {
|
|
127
|
+
if ( ! isVariableFont ) {
|
|
128
|
+
fontWeights.push( fontWeight );
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
} );
|
|
133
|
+
|
|
134
|
+
// If there is no font weight of 600 or above, then include faux bold as an option.
|
|
135
|
+
if ( ! fontWeights.some( ( weight ) => weight.value >= '600' ) ) {
|
|
136
|
+
fontWeights.push( {
|
|
137
|
+
name: _x( 'Bold', 'font weight' ),
|
|
138
|
+
value: '700',
|
|
139
|
+
} );
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// If there is no italic font style, then include faux italic as an option.
|
|
143
|
+
if ( ! fontStyles.some( ( style ) => style.value === 'italic' ) ) {
|
|
144
|
+
fontStyles.push( {
|
|
145
|
+
name: _x( 'Italic', 'font style' ),
|
|
146
|
+
value: 'italic',
|
|
147
|
+
} );
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Use default font styles and weights for system fonts.
|
|
151
|
+
if ( isSystemFont ) {
|
|
152
|
+
fontStyles = FONT_STYLES;
|
|
153
|
+
fontWeights = FONT_WEIGHTS;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Use default styles and weights if there are no available styles or weights from the provided font faces.
|
|
157
|
+
fontStyles = fontStyles.length === 0 ? FONT_STYLES : fontStyles;
|
|
158
|
+
fontWeights = fontWeights.length === 0 ? FONT_WEIGHTS : fontWeights;
|
|
159
|
+
|
|
160
|
+
// Generate combined font style and weight options for available fonts.
|
|
161
|
+
fontStyles.forEach( ( { name: styleName, value: styleValue } ) => {
|
|
162
|
+
fontWeights.forEach( ( { name: weightName, value: weightValue } ) => {
|
|
163
|
+
const optionName =
|
|
164
|
+
styleValue === 'normal'
|
|
165
|
+
? weightName
|
|
166
|
+
: sprintf(
|
|
167
|
+
/* translators: 1: Font weight name. 2: Font style name. */
|
|
168
|
+
__( '%1$s %2$s' ),
|
|
169
|
+
weightName,
|
|
170
|
+
styleName
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
combinedStyleAndWeightOptions.push( {
|
|
174
|
+
key: `${ styleValue }-${ weightValue }`,
|
|
175
|
+
name: optionName,
|
|
176
|
+
style: {
|
|
177
|
+
fontStyle: styleValue,
|
|
178
|
+
fontWeight: weightValue,
|
|
179
|
+
},
|
|
180
|
+
} );
|
|
181
|
+
} );
|
|
182
|
+
} );
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
fontStyles,
|
|
186
|
+
fontWeights,
|
|
187
|
+
combinedStyleAndWeightOptions,
|
|
188
|
+
isSystemFont,
|
|
189
|
+
isVariableFont,
|
|
190
|
+
};
|
|
191
|
+
}
|
package/src/utils/pasting.js
CHANGED
|
@@ -52,21 +52,14 @@ export function getPasteEventData( { clipboardData } ) {
|
|
|
52
52
|
let plainText = '';
|
|
53
53
|
let html = '';
|
|
54
54
|
|
|
55
|
-
// IE11 only supports `Text` as an argument for `getData` and will
|
|
56
|
-
// otherwise throw an invalid argument error, so we try the standard
|
|
57
|
-
// arguments first, then fallback to `Text` if they fail.
|
|
58
55
|
try {
|
|
59
56
|
plainText = clipboardData.getData( 'text/plain' );
|
|
60
57
|
html = clipboardData.getData( 'text/html' );
|
|
61
|
-
} catch (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// don't support clipboardData at all, so allow default
|
|
67
|
-
// behaviour.
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
58
|
+
} catch ( error ) {
|
|
59
|
+
// Some browsers like UC Browser paste plain text by default and
|
|
60
|
+
// don't support clipboardData at all, so allow default
|
|
61
|
+
// behaviour.
|
|
62
|
+
return;
|
|
70
63
|
}
|
|
71
64
|
|
|
72
65
|
// Remove Windows-specific metadata appended within copied HTML text.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { formatFontStyle } from '../format-font-style';
|
|
5
|
+
|
|
6
|
+
describe( 'formatFontStyle', () => {
|
|
7
|
+
it( 'should return empty object if style is not available', () => {
|
|
8
|
+
expect( formatFontStyle() ).toEqual( {} );
|
|
9
|
+
} );
|
|
10
|
+
|
|
11
|
+
it( 'should return the same object if style is already an object', () => {
|
|
12
|
+
const fontStyle = { name: 'Italic', value: 'italic' };
|
|
13
|
+
expect( formatFontStyle( fontStyle ) ).toEqual( fontStyle );
|
|
14
|
+
} );
|
|
15
|
+
|
|
16
|
+
it( 'should return the formatted font style', () => {
|
|
17
|
+
expect( formatFontStyle( 'normal' ) ).toEqual( {
|
|
18
|
+
name: 'Regular',
|
|
19
|
+
value: 'normal',
|
|
20
|
+
} );
|
|
21
|
+
expect( formatFontStyle( 'italic' ) ).toEqual( {
|
|
22
|
+
name: 'Italic',
|
|
23
|
+
value: 'italic',
|
|
24
|
+
} );
|
|
25
|
+
expect( formatFontStyle( 'oblique' ) ).toEqual( {
|
|
26
|
+
name: 'Oblique',
|
|
27
|
+
value: 'oblique',
|
|
28
|
+
} );
|
|
29
|
+
expect( formatFontStyle( 'oblique 40deg' ) ).toEqual( {
|
|
30
|
+
name: 'oblique 40deg',
|
|
31
|
+
value: 'oblique 40deg',
|
|
32
|
+
} );
|
|
33
|
+
} );
|
|
34
|
+
} );
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { formatFontWeight } from '../format-font-weight';
|
|
5
|
+
|
|
6
|
+
describe( 'formatFontWeight', () => {
|
|
7
|
+
it( 'should return empty object if weight is not available', () => {
|
|
8
|
+
expect( formatFontWeight() ).toEqual( {} );
|
|
9
|
+
} );
|
|
10
|
+
|
|
11
|
+
it( 'should return the same object if weight is already an object', () => {
|
|
12
|
+
const fontWeight = { name: 'Thin', value: '100' };
|
|
13
|
+
expect( formatFontWeight( fontWeight ) ).toEqual( fontWeight );
|
|
14
|
+
} );
|
|
15
|
+
|
|
16
|
+
it( 'should return the formatted font weight', () => {
|
|
17
|
+
expect( formatFontWeight( '100' ) ).toEqual( {
|
|
18
|
+
name: 'Thin',
|
|
19
|
+
value: '100',
|
|
20
|
+
} );
|
|
21
|
+
expect( formatFontWeight( '200' ) ).toEqual( {
|
|
22
|
+
name: 'Extra Light',
|
|
23
|
+
value: '200',
|
|
24
|
+
} );
|
|
25
|
+
expect( formatFontWeight( '300' ) ).toEqual( {
|
|
26
|
+
name: 'Light',
|
|
27
|
+
value: '300',
|
|
28
|
+
} );
|
|
29
|
+
expect( formatFontWeight( '400' ) ).toEqual( {
|
|
30
|
+
name: 'Regular',
|
|
31
|
+
value: '400',
|
|
32
|
+
} );
|
|
33
|
+
expect( formatFontWeight( '500' ) ).toEqual( {
|
|
34
|
+
name: 'Medium',
|
|
35
|
+
value: '500',
|
|
36
|
+
} );
|
|
37
|
+
expect( formatFontWeight( '600' ) ).toEqual( {
|
|
38
|
+
name: 'Semi Bold',
|
|
39
|
+
value: '600',
|
|
40
|
+
} );
|
|
41
|
+
expect( formatFontWeight( '700' ) ).toEqual( {
|
|
42
|
+
name: 'Bold',
|
|
43
|
+
value: '700',
|
|
44
|
+
} );
|
|
45
|
+
expect( formatFontWeight( '800' ) ).toEqual( {
|
|
46
|
+
name: 'Extra Bold',
|
|
47
|
+
value: '800',
|
|
48
|
+
} );
|
|
49
|
+
expect( formatFontWeight( '900' ) ).toEqual( {
|
|
50
|
+
name: 'Black',
|
|
51
|
+
value: '900',
|
|
52
|
+
} );
|
|
53
|
+
expect( formatFontWeight( '1000' ) ).toEqual( {
|
|
54
|
+
name: 'Extra Black',
|
|
55
|
+
value: '1000',
|
|
56
|
+
} );
|
|
57
|
+
expect( formatFontWeight( 'normal' ) ).toEqual( {
|
|
58
|
+
name: 'Regular',
|
|
59
|
+
value: 'normal',
|
|
60
|
+
} );
|
|
61
|
+
expect( formatFontWeight( 'bold' ) ).toEqual( {
|
|
62
|
+
name: 'Bold',
|
|
63
|
+
value: 'bold',
|
|
64
|
+
} );
|
|
65
|
+
} );
|
|
66
|
+
} );
|