@wordpress/block-editor 11.0.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/README.md +2 -1
- package/build/components/alignment-control/ui.js +1 -7
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-icon/index.js +4 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +55 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +46 -34
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +39 -34
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +1 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +14 -7
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +1 -3
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/utils.js +7 -10
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +6 -8
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-variation-picker/index.js +1 -1
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/colors/utils.js +2 -6
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +0 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +0 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/copy-handler/index.js +37 -9
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +5 -2
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -4
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +11 -6
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/gradients/use-gradient.js +2 -8
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/iframe/index.js +13 -95
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +93 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build/components/inner-blocks/index.js +6 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +13 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +8 -5
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +6 -3
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +15 -14
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +21 -26
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-select-button.js +3 -2
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/block.js +57 -45
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +5 -1
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
- package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/format-edit.js +12 -10
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +21 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +0 -1
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -2
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +0 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-family.js +4 -4
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +5 -3
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/use-typography-props.js +11 -8
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/store/reducer.js +21 -7
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js +6 -11
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +56 -5
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +46 -34
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +39 -32
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +14 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +1 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-styles/utils.js +7 -9
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +6 -8
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -2
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -1
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/colors/utils.js +3 -7
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +0 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +0 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/copy-handler/index.js +38 -10
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +5 -2
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +11 -5
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +12 -7
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +2 -7
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/iframe/index.js +12 -95
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +85 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build-module/components/inner-blocks/index.js +6 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +13 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +8 -5
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +6 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +15 -13
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +21 -27
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/block.js +58 -46
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +5 -1
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build-module/components/responsive-block-control/label.js +1 -2
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +12 -9
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +22 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +0 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/hooks/border.js +0 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +0 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-family.js +5 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +5 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +11 -8
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/store/reducer.js +21 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js +6 -10
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +3 -3
- package/build-style/content.css +3 -3
- package/build-style/default-editor-styles-rtl.css +3 -3
- package/build-style/default-editor-styles.css +3 -3
- package/build-style/style-rtl.css +35 -11
- package/build-style/style.css +35 -11
- package/package.json +29 -29
- package/src/components/alignment-control/test/index.js +2 -0
- package/src/components/alignment-control/ui.js +1 -7
- package/src/components/block-alignment-control/test/index.js +2 -0
- package/src/components/block-alignment-control/use-available-alignments.js +4 -3
- package/src/components/block-icon/index.js +4 -2
- package/src/components/block-icon/test/index.js +9 -5
- package/src/components/block-inspector/index.js +77 -4
- package/src/components/block-inspector/style.scss +7 -0
- package/src/components/block-list-appender/index.js +65 -54
- package/src/components/block-list-appender/index.native.js +45 -34
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +18 -22
- package/src/components/block-mobile-toolbar/index.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -0
- package/src/components/block-mover/test/index.native.js +157 -1
- package/src/components/block-pattern-setup/index.js +15 -6
- package/src/components/block-pattern-setup/style.scss +29 -1
- package/src/components/block-styles/index.native.js +1 -2
- package/src/components/block-styles/utils.js +5 -7
- package/src/components/block-switcher/test/index.js +3 -2
- package/src/components/block-toolbar/index.native.js +8 -11
- package/src/components/block-tools/selected-block-popover.js +1 -3
- package/src/components/block-variation-picker/index.js +5 -1
- package/src/components/block-vertical-alignment-control/test/index.js +2 -0
- package/src/components/colors/test/with-colors.js +2 -0
- package/src/components/colors/utils.js +5 -3
- package/src/components/colors-gradients/control.js +0 -7
- package/src/components/colors-gradients/dropdown.js +0 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/src/components/copy-handler/index.js +53 -7
- package/src/components/default-block-appender/test/index.js +2 -0
- package/src/components/font-sizes/fluid-utils.js +7 -1
- package/src/components/font-sizes/utils.js +5 -3
- package/src/components/font-sizes/with-font-sizes.js +4 -4
- package/src/components/gradients/use-gradient.js +2 -7
- package/src/components/iframe/index.js +8 -103
- package/src/components/iframe/use-compatibility-styles.js +95 -0
- package/src/components/image-size-control/test/index.js +147 -79
- package/src/components/inner-blocks/index.js +4 -2
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/index.js +15 -2
- package/src/components/inserter/media-tab/hooks.js +5 -4
- package/src/components/inserter/quick-inserter.js +3 -0
- package/src/components/inserter/search-items.js +1 -2
- package/src/components/inserter/search-results.js +2 -0
- package/src/components/link-control/test/index.js +18 -4
- package/src/components/list-view/block-select-button.js +1 -1
- package/src/components/list-view/style.scss +1 -7
- package/src/components/media-replace-flow/test/index.js +2 -0
- package/src/components/off-canvas-editor/appender.js +30 -25
- package/src/components/off-canvas-editor/block-select-button.js +6 -2
- package/src/components/off-canvas-editor/block.js +93 -76
- package/src/components/off-canvas-editor/index.js +9 -0
- package/src/components/off-canvas-editor/style.scss +5 -1
- package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
- package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/src/components/responsive-block-control/label.js +2 -3
- package/src/components/responsive-block-control/test/index.js +4 -2
- package/src/components/rich-text/format-edit.js +6 -10
- package/src/components/rich-text/index.js +1 -0
- package/src/components/rich-text/use-paste-handler.js +33 -14
- package/src/components/spacing-sizes-control/index.js +0 -1
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/typewriter/index.js +3 -1
- package/src/components/url-input/test/button.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +5 -4
- package/src/components/url-popover/test/index.js +21 -5
- package/src/components/warning/test/index.js +2 -0
- package/src/components/writing-flow/index.js +1 -1
- package/src/hooks/border.js +0 -1
- package/src/hooks/color-panel.js +0 -1
- package/src/hooks/color.js +0 -2
- package/src/hooks/font-family.js +3 -5
- package/src/hooks/font-size.js +13 -4
- package/src/hooks/test/use-typography-props.js +26 -0
- package/src/hooks/use-typography-props.js +15 -7
- package/src/store/reducer.js +13 -6
- package/src/store/selectors.js +2 -3
- package/src/utils/pasting.js +3 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
- package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build/components/rich-text/file-paste-handler.js +0 -21
- package/build/components/rich-text/file-paste-handler.js.map +0 -1
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build-module/components/rich-text/file-paste-handler.js +0 -13
- package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
- package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/src/components/rich-text/file-paste-handler.js +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/font-family.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/font-family.js"],"names":["kebabCase","addFilter","hasBlockSupport","TokenList","useSetting","FontFamilyControl","shouldSkipSerialization","TYPOGRAPHY_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","addAttributes","settings","attributes","fontFamily","Object","assign","type","addSaveProps","props","blockType","classes","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontFamilyEdit","setAttributes","fontFamilies","find","slug","onChange","newValue","predefinedFontFamily","f","useIsFontFamilyDisabled","name","length","hasFontFamilyValue","resetFontFamily"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,iBAAP,MAA8B,2BAA9B;AACA,SAASC,uBAAT,QAAwC,SAAxC;AACA,SAASC,sBAAT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AEH;AADpB,KAAF,CAAb;AAGA;;AAED,SACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,YAAY,EAAGF,YAFhB;AAGC,IAAA,KAAK,EAAGP,KAHT;AAIC,IAAA,QAAQ,EAAGU,QAJZ;AAKC,IAAA,IAAI,EAAC,kBALN;AAMC,IAAA,uBAAuB;AANxB,IADD;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,uBAAT,QAA6C;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACnD,QAAMR,YAAY,GAAG1B,UAAU,CAAE,yBAAF,CAA/B;AACA,SACC,CAAE0B,YAAF,IACAA,YAAY,CAACS,MAAb,KAAwB,CADxB,IAEA,CAAErC,eAAe,CAAEoC,IAAF,EAAQ9B,uBAAR,CAHlB;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASgC,kBAAT,CAA6BvB,KAA7B,EAAqC;AAC3C,SAAO,CAAC,CAAEA,KAAK,CAACN,UAAN,CAAiBC,UAA3B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS6B,eAAT,QAA8C;AAAA,MAApB;AAAEZ,IAAAA;AAAF,GAAoB;AACpDA,EAAAA,aAAa,CAAE;AAAEjB,IAAAA,UAAU,EAAEY;AAAd,GAAF,CAAb;AACA;AAEDvB,SAAS,CACR,0BADQ,EAER,8BAFQ,EAGRQ,aAHQ,CAAT;AAMAR,SAAS,CACR,kCADQ,EAER,8BAFQ,EAGRe,YAHQ,CAAT;AAMAf,SAAS,CACR,0BADQ,EAER,8BAFQ,EAGRwB,YAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport FontFamilyControl from '../components/font-family';\nimport { shouldSkipSerialization } from './utils';\nimport { TYPOGRAPHY_SUPPORT_KEY } from './typography';\n\nexport const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `fontFamily` attribute.\n *\n * @param {Object} settings Original block settings\n * @return {Object} Filtered block settings\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontFamily ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontFamily: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font family.\n *\n * @param {Object} props Additional props applied to save element\n * @param {Object} blockType Block type\n * @param {Object} attributes Block attributes\n * @return {Object} Filtered props applied to save element\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\tshouldSkipSerialization(\n\t\t\tblockType,\n\t\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t\t'fontFamily'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\tif ( ! attributes?.fontFamily ) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( `has-${ kebabCase( attributes?.fontFamily ) }-font-family` );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nexport function FontFamilyEdit( {\n\tsetAttributes,\n\tattributes: { fontFamily },\n} ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\n\tconst value = fontFamilies?.find(\n\t\t( { slug } ) => fontFamily === slug\n\t)?.fontFamily;\n\n\tfunction onChange( newValue ) {\n\t\tconst predefinedFontFamily = fontFamilies?.find(\n\t\t\t( { fontFamily: f } ) => f === newValue\n\t\t);\n\t\tsetAttributes( {\n\t\t\tfontFamily: predefinedFontFamily?.slug,\n\t\t} );\n\t}\n\n\treturn (\n\t\t<FontFamilyControl\n\t\t\tclassName=\"block-editor-hooks-font-family-control\"\n\t\t\tfontFamilies={ fontFamilies }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if font-family functionality is disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontFamilyDisabled( { name } ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\treturn (\n\t\t! fontFamilies ||\n\t\tfontFamilies.length === 0 ||\n\t\t! hasBlockSupport( name, FONT_FAMILY_SUPPORT_KEY )\n\t);\n}\n\n/**\n * Checks if there is a current value set for the font family block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a font family value set.\n */\nexport function hasFontFamilyValue( props ) {\n\treturn !! props.attributes.fontFamily;\n}\n\n/**\n * Resets the font family block support attribute. This can be used when\n * disabling the font family support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetFontFamily( { setAttributes } ) {\n\tsetAttributes( { fontFamily: undefined } );\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/fontFamily/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addEditProps',\n\taddEditProps\n);\n"]}
|
|
@@ -286,9 +286,11 @@ function addEditPropsForFluidCustomFontSizes(blockType) {
|
|
|
286
286
|
// BlockListBlock instead of using getEditWrapperProps then the value is
|
|
287
287
|
// clobbered when the core/style/addEditProps filter runs.
|
|
288
288
|
|
|
289
|
-
const
|
|
290
|
-
const
|
|
291
|
-
|
|
289
|
+
const fluidTypographyConfig = (_select$getSettings$_ = select(blockEditorStore).getSettings().__experimentalFeatures) === null || _select$getSettings$_ === void 0 ? void 0 : (_select$getSettings$_2 = _select$getSettings$_.typography) === null || _select$getSettings$_2 === void 0 ? void 0 : _select$getSettings$_2.fluid;
|
|
290
|
+
const fluidTypographySettings = typeof fluidTypographyConfig === 'object' ? fluidTypographyConfig : {};
|
|
291
|
+
const newFontSize = fontSize && !!fluidTypographyConfig ? getComputedFluidTypographyValue({
|
|
292
|
+
fontSize,
|
|
293
|
+
minimumFontSizeLimit: fluidTypographySettings === null || fluidTypographySettings === void 0 ? void 0 : fluidTypographySettings.minFontSize
|
|
292
294
|
}) : null;
|
|
293
295
|
|
|
294
296
|
if (newFontSize === null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/font-size.js"],"names":["addFilter","hasBlockSupport","TokenList","createHigherOrderComponent","select","getFontSize","getFontSizeClass","getFontSizeObjectByValue","FontSizePicker","getComputedFluidTypographyValue","TYPOGRAPHY_SUPPORT_KEY","cleanEmptyObject","transformStyles","shouldSkipSerialization","useSetting","store","blockEditorStore","FONT_SIZE_SUPPORT_KEY","addAttributes","settings","attributes","fontSize","Object","assign","type","addSaveProps","props","blockType","classes","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontSizeEdit","style","setAttributes","fontSizes","onChange","fontSizeSlug","slug","typography","fontSizeObject","fontSizeValue","size","hasFontSizeValue","resetFontSize","useIsFontSizeDisabled","name","blockName","hasFontSizes","length","withFontSizeInlineStyles","BlockListBlock","wrapperProps","newProps","MIGRATION_PATHS","addTransforms","result","source","index","results","destinationBlockType","activeSupports","addEditPropsForFluidCustomFontSizes","isFluidTypographyEnabled","getSettings","__experimentalFeatures","fluid","newFontSize"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,MAAT,QAAuB,iBAAvB;AAEA;AACA;AACA;;AACA,SACCC,WADD,EAECC,gBAFD,EAGCC,wBAHD,EAICC,cAJD,EAKCC,+BALD,QAMO,0BANP;AAOA,SAASC,sBAAT,QAAuC,cAAvC;AACA,SACCC,gBADD,EAECC,eAFD,EAGCC,uBAHD,QAIO,SAJP;AAKA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AAEA,OAAO,MAAMC,qBAAqB,GAAG,qBAA9B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,MAAK,CAAElB,eAAe,CAAEkB,QAAF,EAAYF,qBAAZ,CAAtB,EAA4D;AAC3D,WAAOE,QAAP;AACA,GAHiC,CAKlC;;;AACA,MAAK,CAAEA,QAAQ,CAACC,UAAT,CAAoBC,QAA3B,EAAsC;AACrCC,IAAAA,MAAM,CAACC,MAAP,CAAeJ,QAAQ,CAAC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AZ,GACG3D,+BAA+B,CAAE;AAAEY,MAAAA;AAAF,KAAF,CADlC,GAEG,IAHJ;;AAKA,QAAKmD,WAAW,KAAK,IAArB,EAA4B;AAC3B,aAAOf,YAAP;AACA;;AAED,WAAO,EACN,GAAGA,YADG;AAENnB,MAAAA,KAAK,EAAE,EACN,IAAGmB,YAAH,aAAGA,YAAH,uBAAGA,YAAY,CAAEnB,KAAjB,CADM;AAENjB,QAAAA,QAAQ,EAAEmD;AAFJ;AAFD,KAAP;AAOA,GAlCD;;AAoCA,SAAO7C,SAAP;AACA;;AAED3B,SAAS,CACR,0BADQ,EAER,wBAFQ,EAGRkB,aAHQ,CAAT;AAMAlB,SAAS,CACR,kCADQ,EAER,wBAFQ,EAGRyB,YAHQ,CAAT;AAMAzB,SAAS,CAAE,0BAAF,EAA8B,wBAA9B,EAAwDkC,YAAxD,CAAT;AAEAlC,SAAS,CACR,uBADQ,EAER,6CAFQ,EAGRuD,wBAHQ,CAAT;AAMAvD,SAAS,CACR,2CADQ,EAER,8BAFQ,EAGR4D,aAHQ,CAAT;AAMA5D,SAAS,CACR,0BADQ,EAER,oDAFQ,EAGRmE,mCAHQ,EAIR;AACA;AACA,EANQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { select } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetFontSize,\n\tgetFontSizeClass,\n\tgetFontSizeObjectByValue,\n\tFontSizePicker,\n\tgetComputedFluidTypographyValue,\n} from '../components/font-sizes';\nimport { TYPOGRAPHY_SUPPORT_KEY } from './typography';\nimport {\n\tcleanEmptyObject,\n\ttransformStyles,\n\tshouldSkipSerialization,\n} from './utils';\nimport useSetting from '../components/use-setting';\nimport { store as blockEditorStore } from '../store';\n\nexport const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\n\n/**\n * Filters registered block settings, extending attributes to include\n * `fontSize` and `fontWeight` attributes.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontSize ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontSize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font size.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\tshouldSkipSerialization( blockType, TYPOGRAPHY_SUPPORT_KEY, 'fontSize' )\n\t) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( getFontSizeClass( attributes.fontSize ) );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\n/**\n * Inspector control panel containing the font size related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Font size edit element.\n */\nexport function FontSizeEdit( props ) {\n\tconst {\n\t\tattributes: { fontSize, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\n\tconst onChange = ( value ) => {\n\t\tconst fontSizeSlug = getFontSizeObjectByValue( fontSizes, value ).slug;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\tfontSize: fontSizeSlug ? undefined : value,\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tconst fontSizeObject = getFontSize(\n\t\tfontSizes,\n\t\tfontSize,\n\t\tstyle?.typography?.fontSize\n\t);\n\n\tconst fontSizeValue =\n\t\tfontSizeObject?.size || style?.typography?.fontSize || fontSize;\n\n\treturn (\n\t\t<FontSizePicker\n\t\t\tonChange={ onChange }\n\t\t\tvalue={ fontSizeValue }\n\t\t\twithReset={ false }\n\t\t\twithSlider\n\t\t\tsize=\"__unstable-large\"\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t);\n}\n\n/**\n * Checks if there is a current value set for the font size block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a font size value set.\n */\nexport function hasFontSizeValue( props ) {\n\tconst { fontSize, style } = props.attributes;\n\treturn !! fontSize || !! style?.typography?.fontSize;\n}\n\n/**\n * Resets the font size block support attribute. This can be used when\n * disabling the font size support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetFontSize( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tfontSize: undefined,\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tfontSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if font-size settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontSizeDisabled( { name: blockName } = {} ) {\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst hasFontSizes = !! fontSizes?.length;\n\n\treturn (\n\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || ! hasFontSizes\n\t);\n}\n\n/**\n * Add inline styles for font sizes.\n * Ideally, this is not needed and themes load the font-size classes on the\n * editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withFontSizeInlineStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\t\tconst {\n\t\t\tname: blockName,\n\t\t\tattributes: { fontSize, style },\n\t\t\twrapperProps,\n\t\t} = props;\n\n\t\t// Only add inline styles if the block supports font sizes,\n\t\t// doesn't skip serialization of font sizes,\n\t\t// doesn't already have an inline font size,\n\t\t// and does have a class to extract the font size from.\n\t\tif (\n\t\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) ||\n\t\t\tshouldSkipSerialization(\n\t\t\t\tblockName,\n\t\t\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t\t\t'fontSize'\n\t\t\t) ||\n\t\t\t! fontSize ||\n\t\t\tstyle?.typography?.fontSize\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst fontSizeValue = getFontSize(\n\t\t\tfontSizes,\n\t\t\tfontSize,\n\t\t\tstyle?.typography?.fontSize\n\t\t).size;\n\n\t\tconst newProps = {\n\t\t\t...props,\n\t\t\twrapperProps: {\n\t\t\t\t...wrapperProps,\n\t\t\t\tstyle: {\n\t\t\t\t\tfontSize: fontSizeValue,\n\t\t\t\t\t...wrapperProps?.style,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...newProps } />;\n\t},\n\t'withFontSizeInlineStyles'\n);\n\nconst MIGRATION_PATHS = {\n\tfontSize: [ [ 'fontSize' ], [ 'style', 'typography', 'fontSize' ] ],\n};\n\nexport function addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tfontSize: hasBlockSupport(\n\t\t\tdestinationBlockType,\n\t\t\tFONT_SIZE_SUPPORT_KEY\n\t\t),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\n/**\n * Allow custom font sizes to appear fluid when fluid typography is enabled at\n * the theme level.\n *\n * Adds a custom getEditWrapperProps() callback to all block types that support\n * font sizes. Then, if fluid typography is enabled, this callback will swap any\n * custom font size in style.fontSize with a fluid font size (i.e. one that uses\n * clamp()).\n *\n * It's important that this hook runs after 'core/style/addEditProps' sets\n * style.fontSize as otherwise fontSize will be overwritten.\n *\n * @param {Object} blockType Block settings object.\n */\nfunction addEditPropsForFluidCustomFontSizes( blockType ) {\n\tif (\n\t\t! hasBlockSupport( blockType, FONT_SIZE_SUPPORT_KEY ) ||\n\t\tshouldSkipSerialization( blockType, TYPOGRAPHY_SUPPORT_KEY, 'fontSize' )\n\t) {\n\t\treturn blockType;\n\t}\n\n\tconst existingGetEditWrapperProps = blockType.getEditWrapperProps;\n\n\tblockType.getEditWrapperProps = ( attributes ) => {\n\t\tconst wrapperProps = existingGetEditWrapperProps\n\t\t\t? existingGetEditWrapperProps( attributes )\n\t\t\t: {};\n\n\t\tconst fontSize = wrapperProps?.style?.fontSize;\n\n\t\t// TODO: This sucks! We should be using useSetting( 'typography.fluid' )\n\t\t// or even useSelect( blockEditorStore ). We can't do either here\n\t\t// because getEditWrapperProps is a plain JavaScript function called by\n\t\t// BlockListBlock and not a React component rendered within\n\t\t// BlockListContext.Provider. If we set fontSize using editor.\n\t\t// BlockListBlock instead of using getEditWrapperProps then the value is\n\t\t// clobbered when the core/style/addEditProps filter runs.\n\t\tconst isFluidTypographyEnabled =\n\t\t\t!! select( blockEditorStore ).getSettings().__experimentalFeatures\n\t\t\t\t?.typography?.fluid;\n\n\t\tconst newFontSize =\n\t\t\tfontSize && isFluidTypographyEnabled\n\t\t\t\t? getComputedFluidTypographyValue( { fontSize } )\n\t\t\t\t: null;\n\n\t\tif ( newFontSize === null ) {\n\t\t\treturn wrapperProps;\n\t\t}\n\n\t\treturn {\n\t\t\t...wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...wrapperProps?.style,\n\t\t\t\tfontSize: newFontSize,\n\t\t\t},\n\t\t};\n\t};\n\n\treturn blockType;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/font/addSaveProps',\n\taddSaveProps\n);\n\naddFilter( 'blocks.registerBlockType', 'core/font/addEditProps', addEditProps );\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/font-size/with-font-size-inline-styles',\n\twithFontSizeInlineStyles\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/font-size/addTransforms',\n\taddTransforms\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font-size/addEditPropsForFluidCustomFontSizes',\n\taddEditPropsForFluidCustomFontSizes,\n\t// Run after 'core/style/addEditProps' so that the style object has already\n\t// been translated into inline CSS.\n\t11\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/font-size.js"],"names":["addFilter","hasBlockSupport","TokenList","createHigherOrderComponent","select","getFontSize","getFontSizeClass","getFontSizeObjectByValue","FontSizePicker","getComputedFluidTypographyValue","TYPOGRAPHY_SUPPORT_KEY","cleanEmptyObject","transformStyles","shouldSkipSerialization","useSetting","store","blockEditorStore","FONT_SIZE_SUPPORT_KEY","addAttributes","settings","attributes","fontSize","Object","assign","type","addSaveProps","props","blockType","classes","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontSizeEdit","style","setAttributes","fontSizes","onChange","fontSizeSlug","slug","typography","fontSizeObject","fontSizeValue","size","hasFontSizeValue","resetFontSize","useIsFontSizeDisabled","name","blockName","hasFontSizes","length","withFontSizeInlineStyles","BlockListBlock","wrapperProps","newProps","MIGRATION_PATHS","addTransforms","result","source","index","results","destinationBlockType","activeSupports","addEditPropsForFluidCustomFontSizes","fluidTypographyConfig","getSettings","__experimentalFeatures","fluid","fluidTypographySettings","newFontSize","minimumFontSizeLimit","minFontSize"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,MAAT,QAAuB,iBAAvB;AAEA;AACA;AACA;;AACA,SACCC,WADD,EAECC,gBAFD,EAGCC,wBAHD,EAICC,cAJD,EAKCC,+BALD,QAMO,0BANP;AAOA,SAASC,sBAAT,QAAuC,cAAvC;AACA,SACCC,gBADD,EAECC,eAFD,EAGCC,uBAHD,QAIO,SAJP;AAKA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AAEA,OAAO,MAAMC,qBAAqB,GAAG,qBAA9B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,MAAK,CAAElB,eAAe,CAAEkB,QAAF,EAAYF,qBAAZ,CAAtB,EAA4D;AAC3D,WAAOE,QAAP;AACA,GAHiC,CAKlC;;;AACA,MAAK,CAAEA,QAAQ,CAACC,UAAT,CAAoBC,QAA3B,EAAsC;AAC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MC,uBAAuB,GAC5B,OAAOJ,qBAAP,KAAiC,QAAjC,GACGA,qBADH,GAEG,EAHJ;AAKA,UAAMK,WAAW,GAChBpD,QAAQ,IAAI,CAAC,CAAE+C,qBAAf,GACG3D,+BAA+B,CAAE;AACjCY,MAAAA,QADiC;AAEjCqD,MAAAA,oBAAoB,EACnBF,uBADmB,aACnBA,uBADmB,uBACnBA,uBAAuB,CAAEG;AAHO,KAAF,CADlC,GAMG,IAPJ;;AASA,QAAKF,WAAW,KAAK,IAArB,EAA4B;AAC3B,aAAOhB,YAAP;AACA;;AAED,WAAO,EACN,GAAGA,YADG;AAENnB,MAAAA,KAAK,EAAE,EACN,IAAGmB,YAAH,aAAGA,YAAH,uBAAGA,YAAY,CAAEnB,KAAjB,CADM;AAENjB,QAAAA,QAAQ,EAAEoD;AAFJ;AAFD,KAAP;AAOA,GA3CD;;AA6CA,SAAO9C,SAAP;AACA;;AAED3B,SAAS,CACR,0BADQ,EAER,wBAFQ,EAGRkB,aAHQ,CAAT;AAMAlB,SAAS,CACR,kCADQ,EAER,wBAFQ,EAGRyB,YAHQ,CAAT;AAMAzB,SAAS,CAAE,0BAAF,EAA8B,wBAA9B,EAAwDkC,YAAxD,CAAT;AAEAlC,SAAS,CACR,uBADQ,EAER,6CAFQ,EAGRuD,wBAHQ,CAAT;AAMAvD,SAAS,CACR,2CADQ,EAER,8BAFQ,EAGR4D,aAHQ,CAAT;AAMA5D,SAAS,CACR,0BADQ,EAER,oDAFQ,EAGRmE,mCAHQ,EAIR;AACA;AACA,EANQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { select } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetFontSize,\n\tgetFontSizeClass,\n\tgetFontSizeObjectByValue,\n\tFontSizePicker,\n\tgetComputedFluidTypographyValue,\n} from '../components/font-sizes';\nimport { TYPOGRAPHY_SUPPORT_KEY } from './typography';\nimport {\n\tcleanEmptyObject,\n\ttransformStyles,\n\tshouldSkipSerialization,\n} from './utils';\nimport useSetting from '../components/use-setting';\nimport { store as blockEditorStore } from '../store';\n\nexport const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\n\n/**\n * Filters registered block settings, extending attributes to include\n * `fontSize` and `fontWeight` attributes.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontSize ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontSize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font size.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\tshouldSkipSerialization( blockType, TYPOGRAPHY_SUPPORT_KEY, 'fontSize' )\n\t) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( getFontSizeClass( attributes.fontSize ) );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\n/**\n * Inspector control panel containing the font size related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Font size edit element.\n */\nexport function FontSizeEdit( props ) {\n\tconst {\n\t\tattributes: { fontSize, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\n\tconst onChange = ( value ) => {\n\t\tconst fontSizeSlug = getFontSizeObjectByValue( fontSizes, value ).slug;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\tfontSize: fontSizeSlug ? undefined : value,\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tconst fontSizeObject = getFontSize(\n\t\tfontSizes,\n\t\tfontSize,\n\t\tstyle?.typography?.fontSize\n\t);\n\n\tconst fontSizeValue =\n\t\tfontSizeObject?.size || style?.typography?.fontSize || fontSize;\n\n\treturn (\n\t\t<FontSizePicker\n\t\t\tonChange={ onChange }\n\t\t\tvalue={ fontSizeValue }\n\t\t\twithReset={ false }\n\t\t\twithSlider\n\t\t\tsize=\"__unstable-large\"\n\t\t\t__nextHasNoMarginBottom\n\t\t/>\n\t);\n}\n\n/**\n * Checks if there is a current value set for the font size block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a font size value set.\n */\nexport function hasFontSizeValue( props ) {\n\tconst { fontSize, style } = props.attributes;\n\treturn !! fontSize || !! style?.typography?.fontSize;\n}\n\n/**\n * Resets the font size block support attribute. This can be used when\n * disabling the font size support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetFontSize( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tfontSize: undefined,\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tfontSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if font-size settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontSizeDisabled( { name: blockName } = {} ) {\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst hasFontSizes = !! fontSizes?.length;\n\n\treturn (\n\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || ! hasFontSizes\n\t);\n}\n\n/**\n * Add inline styles for font sizes.\n * Ideally, this is not needed and themes load the font-size classes on the\n * editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withFontSizeInlineStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\t\tconst {\n\t\t\tname: blockName,\n\t\t\tattributes: { fontSize, style },\n\t\t\twrapperProps,\n\t\t} = props;\n\n\t\t// Only add inline styles if the block supports font sizes,\n\t\t// doesn't skip serialization of font sizes,\n\t\t// doesn't already have an inline font size,\n\t\t// and does have a class to extract the font size from.\n\t\tif (\n\t\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) ||\n\t\t\tshouldSkipSerialization(\n\t\t\t\tblockName,\n\t\t\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t\t\t'fontSize'\n\t\t\t) ||\n\t\t\t! fontSize ||\n\t\t\tstyle?.typography?.fontSize\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst fontSizeValue = getFontSize(\n\t\t\tfontSizes,\n\t\t\tfontSize,\n\t\t\tstyle?.typography?.fontSize\n\t\t).size;\n\n\t\tconst newProps = {\n\t\t\t...props,\n\t\t\twrapperProps: {\n\t\t\t\t...wrapperProps,\n\t\t\t\tstyle: {\n\t\t\t\t\tfontSize: fontSizeValue,\n\t\t\t\t\t...wrapperProps?.style,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...newProps } />;\n\t},\n\t'withFontSizeInlineStyles'\n);\n\nconst MIGRATION_PATHS = {\n\tfontSize: [ [ 'fontSize' ], [ 'style', 'typography', 'fontSize' ] ],\n};\n\nexport function addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tfontSize: hasBlockSupport(\n\t\t\tdestinationBlockType,\n\t\t\tFONT_SIZE_SUPPORT_KEY\n\t\t),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\n/**\n * Allow custom font sizes to appear fluid when fluid typography is enabled at\n * the theme level.\n *\n * Adds a custom getEditWrapperProps() callback to all block types that support\n * font sizes. Then, if fluid typography is enabled, this callback will swap any\n * custom font size in style.fontSize with a fluid font size (i.e. one that uses\n * clamp()).\n *\n * It's important that this hook runs after 'core/style/addEditProps' sets\n * style.fontSize as otherwise fontSize will be overwritten.\n *\n * @param {Object} blockType Block settings object.\n */\nfunction addEditPropsForFluidCustomFontSizes( blockType ) {\n\tif (\n\t\t! hasBlockSupport( blockType, FONT_SIZE_SUPPORT_KEY ) ||\n\t\tshouldSkipSerialization( blockType, TYPOGRAPHY_SUPPORT_KEY, 'fontSize' )\n\t) {\n\t\treturn blockType;\n\t}\n\n\tconst existingGetEditWrapperProps = blockType.getEditWrapperProps;\n\n\tblockType.getEditWrapperProps = ( attributes ) => {\n\t\tconst wrapperProps = existingGetEditWrapperProps\n\t\t\t? existingGetEditWrapperProps( attributes )\n\t\t\t: {};\n\n\t\tconst fontSize = wrapperProps?.style?.fontSize;\n\n\t\t// TODO: This sucks! We should be using useSetting( 'typography.fluid' )\n\t\t// or even useSelect( blockEditorStore ). We can't do either here\n\t\t// because getEditWrapperProps is a plain JavaScript function called by\n\t\t// BlockListBlock and not a React component rendered within\n\t\t// BlockListContext.Provider. If we set fontSize using editor.\n\t\t// BlockListBlock instead of using getEditWrapperProps then the value is\n\t\t// clobbered when the core/style/addEditProps filter runs.\n\t\tconst fluidTypographyConfig =\n\t\t\tselect( blockEditorStore ).getSettings().__experimentalFeatures\n\t\t\t\t?.typography?.fluid;\n\n\t\tconst fluidTypographySettings =\n\t\t\ttypeof fluidTypographyConfig === 'object'\n\t\t\t\t? fluidTypographyConfig\n\t\t\t\t: {};\n\n\t\tconst newFontSize =\n\t\t\tfontSize && !! fluidTypographyConfig\n\t\t\t\t? getComputedFluidTypographyValue( {\n\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\tminimumFontSizeLimit:\n\t\t\t\t\t\t\tfluidTypographySettings?.minFontSize,\n\t\t\t\t } )\n\t\t\t\t: null;\n\n\t\tif ( newFontSize === null ) {\n\t\t\treturn wrapperProps;\n\t\t}\n\n\t\treturn {\n\t\t\t...wrapperProps,\n\t\t\tstyle: {\n\t\t\t\t...wrapperProps?.style,\n\t\t\t\tfontSize: newFontSize,\n\t\t\t},\n\t\t};\n\t};\n\n\treturn blockType;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/font/addSaveProps',\n\taddSaveProps\n);\n\naddFilter( 'blocks.registerBlockType', 'core/font/addEditProps', addEditProps );\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/font-size/with-font-size-inline-styles',\n\twithFontSizeInlineStyles\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/font-size/addTransforms',\n\taddTransforms\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font-size/addEditPropsForFluidCustomFontSizes',\n\taddEditPropsForFluidCustomFontSizes,\n\t// Run after 'core/style/addEditProps' so that the style object has already\n\t// been translated into inline CSS.\n\t11\n);\n"]}
|
|
@@ -17,24 +17,27 @@ import { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-
|
|
|
17
17
|
* Provides the CSS class names and inline styles for a block's typography support
|
|
18
18
|
* attributes.
|
|
19
19
|
*
|
|
20
|
-
* @param {Object}
|
|
21
|
-
* @param {boolean}
|
|
20
|
+
* @param {Object} attributes Block attributes.
|
|
21
|
+
* @param {Object|boolean} fluidTypographySettings If boolean, whether the function should try to convert font sizes to fluid values,
|
|
22
|
+
* otherwise an object containing theme fluid typography settings.
|
|
22
23
|
*
|
|
23
24
|
* @return {Object} Typography block support derived CSS classes & styles.
|
|
24
25
|
*/
|
|
25
26
|
|
|
26
|
-
export function getTypographyClassesAndStyles(attributes,
|
|
27
|
+
export function getTypographyClassesAndStyles(attributes, fluidTypographySettings) {
|
|
27
28
|
var _attributes$style;
|
|
28
29
|
|
|
29
30
|
let typographyStyles = (attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.typography) || {};
|
|
30
31
|
|
|
31
|
-
if (
|
|
32
|
-
var _attributes$style2, _attributes$style2$ty;
|
|
32
|
+
if (!!fluidTypographySettings && (true === fluidTypographySettings || Object.keys(fluidTypographySettings).length !== 0)) {
|
|
33
|
+
var _attributes$style2, _attributes$style2$ty, _attributes$style3, _attributes$style3$ty;
|
|
33
34
|
|
|
35
|
+
const newFontSize = getComputedFluidTypographyValue({
|
|
36
|
+
fontSize: attributes === null || attributes === void 0 ? void 0 : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : (_attributes$style2$ty = _attributes$style2.typography) === null || _attributes$style2$ty === void 0 ? void 0 : _attributes$style2$ty.fontSize,
|
|
37
|
+
minimumFontSizeLimit: fluidTypographySettings === null || fluidTypographySettings === void 0 ? void 0 : fluidTypographySettings.minFontSize
|
|
38
|
+
}) || (attributes === null || attributes === void 0 ? void 0 : (_attributes$style3 = attributes.style) === null || _attributes$style3 === void 0 ? void 0 : (_attributes$style3$ty = _attributes$style3.typography) === null || _attributes$style3$ty === void 0 ? void 0 : _attributes$style3$ty.fontSize);
|
|
34
39
|
typographyStyles = { ...typographyStyles,
|
|
35
|
-
fontSize:
|
|
36
|
-
fontSize: attributes === null || attributes === void 0 ? void 0 : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : (_attributes$style2$ty = _attributes$style2.typography) === null || _attributes$style2$ty === void 0 ? void 0 : _attributes$style2$ty.fontSize
|
|
37
|
-
})
|
|
40
|
+
fontSize: newFontSize
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/use-typography-props.js"],"names":["kebabCase","classnames","getInlineStyles","getFontSizeClass","getComputedFluidTypographyValue","getTypographyClassesAndStyles","attributes","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/use-typography-props.js"],"names":["kebabCase","classnames","getInlineStyles","getFontSizeClass","getComputedFluidTypographyValue","getTypographyClassesAndStyles","attributes","fluidTypographySettings","typographyStyles","style","typography","Object","keys","length","newFontSize","fontSize","minimumFontSizeLimit","minFontSize","fontFamilyClassName","fontFamily","className"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,SAAhC;AACA,SAASC,gBAAT,QAAiC,0BAAjC;AACA,SAASC,+BAAT,QAAgD,sCAAhD,C,CAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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A","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport { getFontSizeClass } from '../components/font-sizes';\nimport { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils';\n\n// This utility is intended to assist where the serialization of the typography\n// block support is being skipped for a block but the typography related CSS\n// styles still need to be generated so they can be applied to inner elements.\n\n/**\n * Provides the CSS class names and inline styles for a block's typography support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @param {Object|boolean} fluidTypographySettings If boolean, whether the function should try to convert font sizes to fluid values,\n * otherwise an object containing theme fluid typography settings.\n *\n * @return {Object} Typography block support derived CSS classes & styles.\n */\nexport function getTypographyClassesAndStyles(\n\tattributes,\n\tfluidTypographySettings\n) {\n\tlet typographyStyles = attributes?.style?.typography || {};\n\n\tif (\n\t\t!! fluidTypographySettings &&\n\t\t( true === fluidTypographySettings ||\n\t\t\tObject.keys( fluidTypographySettings ).length !== 0 )\n\t) {\n\t\tconst newFontSize =\n\t\t\tgetComputedFluidTypographyValue( {\n\t\t\t\tfontSize: attributes?.style?.typography?.fontSize,\n\t\t\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\t\t} ) || attributes?.style?.typography?.fontSize;\n\t\ttypographyStyles = {\n\t\t\t...typographyStyles,\n\t\t\tfontSize: newFontSize,\n\t\t};\n\t}\n\n\tconst style = getInlineStyles( { typography: typographyStyles } );\n\tconst fontFamilyClassName = !! attributes?.fontFamily\n\t\t? `has-${ kebabCase( attributes.fontFamily ) }-font-family`\n\t\t: '';\n\n\tconst className = classnames(\n\t\tfontFamilyClassName,\n\t\tgetFontSizeClass( attributes?.fontSize )\n\t);\n\n\treturn {\n\t\tclassName,\n\t\tstyle,\n\t};\n}\n"]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import fastDeepEqual from 'fast-deep-equal/es6';
|
|
5
|
-
import { omit, isEmpty } from 'lodash';
|
|
6
5
|
/**
|
|
7
6
|
* WordPress dependencies
|
|
8
7
|
*/
|
|
@@ -136,7 +135,13 @@ function getFlattenedClientIds(blocks) {
|
|
|
136
135
|
|
|
137
136
|
|
|
138
137
|
function getFlattenedBlocksWithoutAttributes(blocks) {
|
|
139
|
-
return flattenBlocks(blocks, block =>
|
|
138
|
+
return flattenBlocks(blocks, block => {
|
|
139
|
+
const {
|
|
140
|
+
attributes,
|
|
141
|
+
...restBlock
|
|
142
|
+
} = block;
|
|
143
|
+
return restBlock;
|
|
144
|
+
});
|
|
140
145
|
}
|
|
141
146
|
/**
|
|
142
147
|
* Given an array of blocks, returns an object containing all block attributes,
|
|
@@ -735,9 +740,12 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
|
|
|
735
740
|
} // Do nothing if only attributes change.
|
|
736
741
|
|
|
737
742
|
|
|
738
|
-
const
|
|
743
|
+
const {
|
|
744
|
+
attributes,
|
|
745
|
+
...changes
|
|
746
|
+
} = action.updates;
|
|
739
747
|
|
|
740
|
-
if (
|
|
748
|
+
if (Object.values(changes).length === 0) {
|
|
741
749
|
return state;
|
|
742
750
|
}
|
|
743
751
|
|
|
@@ -1631,7 +1639,10 @@ export const blockListSettings = function () {
|
|
|
1631
1639
|
case 'REPLACE_BLOCKS':
|
|
1632
1640
|
case 'REMOVE_BLOCKS':
|
|
1633
1641
|
{
|
|
1634
|
-
return
|
|
1642
|
+
return Object.fromEntries(Object.entries(state).filter(_ref10 => {
|
|
1643
|
+
let [id] = _ref10;
|
|
1644
|
+
return !action.clientIds.includes(id);
|
|
1645
|
+
}));
|
|
1635
1646
|
}
|
|
1636
1647
|
|
|
1637
1648
|
case 'UPDATE_BLOCK_LIST_SETTINGS':
|
|
@@ -1642,7 +1653,11 @@ export const blockListSettings = function () {
|
|
|
1642
1653
|
|
|
1643
1654
|
if (!action.settings) {
|
|
1644
1655
|
if (state.hasOwnProperty(clientId)) {
|
|
1645
|
-
|
|
1656
|
+
const {
|
|
1657
|
+
[clientId]: removedBlock,
|
|
1658
|
+
...restBlocks
|
|
1659
|
+
} = state;
|
|
1660
|
+
return restBlocks;
|
|
1646
1661
|
}
|
|
1647
1662
|
|
|
1648
1663
|
return state;
|