@wordpress/block-editor 8.0.12-next.33ec3857e2.0 → 8.0.12
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/README.md +0 -4
- package/build/components/block-caption/index.native.js +3 -14
- package/build/components/block-caption/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +33 -12
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -3
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +11 -3
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mover/button.js +2 -2
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +2 -2
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +2 -2
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-preview/auto.js +2 -10
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +1 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +134 -110
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/utils.js +0 -39
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +23 -3
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-tools/back-compat.js +1 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +3 -3
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +1 -11
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/button-block-appender/index.js +1 -2
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +10 -51
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/default-block-appender/index.js +19 -16
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +3 -18
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/iframe/index.js +4 -3
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +9 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +4 -2
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +2 -2
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +2 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +3 -3
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +1 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/tabs.native.js +4 -7
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +1 -2
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +50 -22
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +5 -3
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +0 -2
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +3 -23
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +0 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +0 -2
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +37 -10
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.js +1 -1
- package/build/components/rich-text/file-paste-handler.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +1 -3
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/selection-scroll-into-view/index.js +1 -2
- package/build/components/selection-scroll-into-view/index.js.map +1 -1
- package/build/components/use-canvas-click-redirect/index.js +66 -0
- package/build/components/use-canvas-click-redirect/index.js.map +1 -0
- package/build/components/use-on-block-drop/index.js +4 -8
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-setting/index.js +7 -0
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +1 -3
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/hooks/border-color.js +5 -63
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border-radius.js +0 -47
- package/build/hooks/border-radius.js.map +1 -1
- package/build/hooks/border-style.js +0 -41
- package/build/hooks/border-style.js.map +1 -1
- package/build/hooks/border-width.js +31 -70
- package/build/hooks/border-width.js.map +1 -1
- package/build/hooks/border.js +11 -81
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/letter-spacing.js +1 -1
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/layouts/flex.js +3 -27
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +5 -4
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -5
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +24 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +9 -27
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-paste-event-data.js +1 -1
- package/build/utils/get-paste-event-data.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-caption/index.native.js +3 -13
- package/build-module/components/block-caption/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +33 -12
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +1 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -3
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +10 -3
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +2 -2
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +2 -2
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -10
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +1 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +133 -112
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/utils.js +0 -34
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +21 -3
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -2
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +3 -3
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +1 -11
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +1 -2
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +13 -54
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +18 -15
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +3 -17
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -3
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +4 -2
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +2 -2
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +4 -4
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +1 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +4 -7
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +1 -2
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +50 -22
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +5 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +0 -2
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +3 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +6 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +3 -22
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +0 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +0 -2
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +41 -14
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.js +1 -1
- package/build-module/components/rich-text/file-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +1 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/selection-scroll-into-view/index.js +1 -2
- package/build-module/components/selection-scroll-into-view/index.js.map +1 -1
- package/build-module/components/use-canvas-click-redirect/index.js +54 -0
- package/build-module/components/use-canvas-click-redirect/index.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.js +4 -8
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +7 -0
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +4 -3
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/hooks/border-color.js +7 -61
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border-radius.js +0 -42
- package/build-module/hooks/border-radius.js.map +1 -1
- package/build-module/hooks/border-style.js +0 -36
- package/build-module/hooks/border-style.js.map +1 -1
- package/build-module/hooks/border-width.js +32 -66
- package/build-module/hooks/border-width.js.map +1 -1
- package/build-module/hooks/border.js +12 -80
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +1 -1
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/layouts/flex.js +3 -27
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +5 -4
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -5
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +24 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +9 -26
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-paste-event-data.js +1 -1
- package/build-module/utils/get-paste-event-data.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +180 -212
- package/build-style/style.css +180 -212
- package/package.json +27 -27
- package/src/components/block-caption/index.native.js +4 -22
- package/src/components/block-inspector/index.js +32 -13
- package/src/components/block-list/block.js +1 -1
- package/src/components/block-list/block.native.js +2 -2
- package/src/components/block-list/use-block-props/index.js +1 -3
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-list-appender/index.js +21 -5
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +2 -5
- package/src/components/block-mover/button.js +2 -6
- package/src/components/block-mover/index.js +2 -5
- package/src/components/block-mover/index.native.js +2 -5
- package/src/components/block-preview/auto.js +2 -7
- package/src/components/block-settings/container.native.js +0 -1
- package/src/components/block-styles/index.js +145 -125
- package/src/components/block-styles/style.scss +51 -59
- package/src/components/block-styles/test/{utils.js → index.js} +1 -60
- package/src/components/block-styles/utils.js +0 -39
- package/src/components/block-switcher/block-styles-menu.js +38 -3
- package/src/components/block-tools/back-compat.js +0 -1
- package/src/components/block-tools/block-selection-button.js +3 -9
- package/src/components/block-tools/insertion-point.js +1 -10
- package/src/components/border-style-control/style.scss +1 -0
- package/src/components/button-block-appender/index.js +0 -1
- package/src/components/colors-gradients/panel-color-gradient-settings.js +19 -75
- package/src/components/colors-gradients/style.scss +5 -42
- package/src/components/default-block-appender/index.js +24 -17
- package/src/components/default-block-appender/style.scss +0 -4
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +24 -12
- package/src/components/default-block-appender/test/index.js +14 -4
- package/src/components/default-style-picker/index.js +6 -18
- package/src/components/iframe/index.js +3 -6
- package/src/components/index.js +1 -1
- package/src/components/inner-blocks/README.md +0 -2
- package/src/components/inner-blocks/default-block-appender.js +7 -2
- package/src/components/inserter/hooks/use-insertion-point.js +2 -9
- package/src/components/inserter/index.js +2 -2
- package/src/components/inserter/index.native.js +4 -7
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/tabs.native.js +4 -5
- package/src/components/inspector-controls/block-support-slot-container.js +1 -3
- package/src/components/inspector-controls/block-support-tools-panel.js +57 -21
- package/src/components/inspector-controls/fill.native.js +3 -4
- package/src/components/inspector-controls/groups.js +0 -2
- package/src/components/inspector-controls/slot.js +7 -2
- package/src/components/letter-spacing-control/index.js +6 -6
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/test/index.js +0 -2
- package/src/components/list-view/block-select-button.js +1 -20
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/media-placeholder/index.js +0 -2
- package/src/components/media-replace-flow/index.js +0 -2
- package/src/components/provider/use-block-sync.js +45 -11
- package/src/components/rich-text/file-paste-handler.js +1 -3
- package/src/components/rich-text/use-input-rules.js +1 -2
- package/src/components/selection-scroll-into-view/index.js +0 -1
- package/src/components/url-input/README.md +0 -5
- package/src/components/use-canvas-click-redirect/index.js +57 -0
- package/src/components/use-on-block-drop/index.js +4 -11
- package/src/components/use-setting/index.js +9 -0
- package/src/components/writing-flow/use-multi-selection.js +9 -12
- package/src/hooks/border-color.js +3 -55
- package/src/hooks/border-radius.js +0 -32
- package/src/hooks/border-style.js +0 -26
- package/src/hooks/border-width.js +32 -56
- package/src/hooks/border.js +20 -115
- package/src/hooks/border.scss +17 -3
- package/src/hooks/letter-spacing.js +1 -1
- package/src/hooks/typography.js +1 -1
- package/src/layouts/flex.js +4 -25
- package/src/store/actions.js +5 -5
- package/src/store/defaults.js +0 -2
- package/src/store/reducer.js +23 -1
- package/src/store/selectors.js +9 -39
- package/src/store/test/reducer.js +35 -0
- package/src/store/test/selectors.js +1 -1
- package/src/style.scss +3 -4
- package/src/utils/get-paste-event-data.js +1 -1
- package/src/utils/parse-css-unit-to-px.js +1 -1
- package/src/utils/test/parse-css-unit-to-px.js +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-styles/menu-items.js +0 -63
- package/build/components/block-styles/menu-items.js.map +0 -1
- package/build/components/block-styles/preview-panel.js +0 -45
- package/build/components/block-styles/preview-panel.js.map +0 -1
- package/build/components/block-styles/use-styles-for-block.js +0 -119
- package/build/components/block-styles/use-styles-for-block.js.map +0 -1
- package/build/components/rich-text/prevent-event-discovery.js +0 -33
- package/build/components/rich-text/prevent-event-discovery.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -45
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/components/block-styles/menu-items.js +0 -50
- package/build-module/components/block-styles/menu-items.js.map +0 -1
- package/build-module/components/block-styles/preview-panel.js +0 -35
- package/build-module/components/block-styles/preview-panel.js.map +0 -1
- package/build-module/components/block-styles/use-styles-for-block.js +0 -107
- package/build-module/components/block-styles/use-styles-for-block.js.map +0 -1
- package/build-module/components/rich-text/prevent-event-discovery.js +0 -25
- package/build-module/components/rich-text/prevent-event-discovery.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -34
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/src/components/block-styles/menu-items.js +0 -49
- package/src/components/block-styles/preview-panel.js +0 -36
- package/src/components/block-styles/use-styles-for-block.js +0 -99
- package/src/components/rich-text/prevent-event-discovery.js +0 -23
- package/src/components/use-display-block-controls/index.native.js +0 -38
- package/src/components/writing-flow/test/use-multi-selection.js +0 -36
- package/src/hooks/dimensions.scss +0 -5
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.preventEventDiscovery = preventEventDiscovery;
|
|
7
|
-
|
|
8
|
-
var _richText = require("@wordpress/rich-text");
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
function preventEventDiscovery(value) {
|
|
14
|
-
const searchText = 'tales of gutenberg';
|
|
15
|
-
const addText = ' 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️';
|
|
16
|
-
const {
|
|
17
|
-
start,
|
|
18
|
-
text
|
|
19
|
-
} = value;
|
|
20
|
-
|
|
21
|
-
if (start < searchText.length) {
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const charactersBefore = text.slice(start - searchText.length, start);
|
|
26
|
-
|
|
27
|
-
if (charactersBefore.toLowerCase() !== searchText) {
|
|
28
|
-
return value;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return (0, _richText.insert)(value, addText);
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=prevent-event-discovery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/prevent-event-discovery.js"],"names":["preventEventDiscovery","value","searchText","addText","start","text","length","charactersBefore","slice","toLowerCase"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,SAASA,qBAAT,CAAgCC,KAAhC,EAAwC;AAC9C,QAAMC,UAAU,GAAG,oBAAnB;AACA,QAAMC,OAAO,GACZ,4FADD;AAEA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBJ,KAAxB;;AAEA,MAAKG,KAAK,GAAGF,UAAU,CAACI,MAAxB,EAAiC;AAChC,WAAOL,KAAP;AACA;;AAED,QAAMM,gBAAgB,GAAGF,IAAI,CAACG,KAAL,CAAYJ,KAAK,GAAGF,UAAU,CAACI,MAA/B,EAAuCF,KAAvC,CAAzB;;AAEA,MAAKG,gBAAgB,CAACE,WAAjB,OAAmCP,UAAxC,EAAqD;AACpD,WAAOD,KAAP;AACA;;AAED,SAAO,sBAAQA,KAAR,EAAeE,OAAf,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { insert } from '@wordpress/rich-text';\n\nexport function preventEventDiscovery( value ) {\n\tconst searchText = 'tales of gutenberg';\n\tconst addText =\n\t\t' 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️';\n\tconst { start, text } = value;\n\n\tif ( start < searchText.length ) {\n\t\treturn value;\n\t}\n\n\tconst charactersBefore = text.slice( start - searchText.length, start );\n\n\tif ( charactersBefore.toLowerCase() !== searchText ) {\n\t\treturn value;\n\t}\n\n\treturn insert( value, addText );\n}\n"]}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useDisplayBlockControls;
|
|
7
|
-
|
|
8
|
-
var _data = require("@wordpress/data");
|
|
9
|
-
|
|
10
|
-
var _blocks = require("@wordpress/blocks");
|
|
11
|
-
|
|
12
|
-
var _context = require("../block-edit/context");
|
|
13
|
-
|
|
14
|
-
var _store = require("../../store");
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
function useDisplayBlockControls() {
|
|
24
|
-
const {
|
|
25
|
-
isSelected,
|
|
26
|
-
clientId,
|
|
27
|
-
name
|
|
28
|
-
} = (0, _context.useBlockEditContext)();
|
|
29
|
-
return (0, _data.useSelect)(select => {
|
|
30
|
-
const {
|
|
31
|
-
getBlockName,
|
|
32
|
-
getBlockRootClientId
|
|
33
|
-
} = select(_store.store);
|
|
34
|
-
const parentId = getBlockRootClientId(clientId);
|
|
35
|
-
const parentBlockName = getBlockName(parentId);
|
|
36
|
-
const hideControls = (0, _blocks.hasBlockSupport)(parentBlockName, '__experimentalHideChildBlockControls', false);
|
|
37
|
-
|
|
38
|
-
if (!hideControls && isSelected) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return false;
|
|
43
|
-
}, [clientId, isSelected, name]);
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/use-display-block-controls/index.native.js"],"names":["useDisplayBlockControls","isSelected","clientId","name","select","getBlockName","getBlockRootClientId","blockEditorStore","parentId","parentBlockName","hideControls"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,uBAAT,GAAmC;AACjD,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,QAAd;AAAwBC,IAAAA;AAAxB,MAAiC,mCAAvC;AACA,SAAO,qBACJC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA;AAAhB,QAAyCF,MAAM,CACpDG,YADoD,CAArD;AAIA,UAAMC,QAAQ,GAAGF,oBAAoB,CAAEJ,QAAF,CAArC;AACA,UAAMO,eAAe,GAAGJ,YAAY,CAAEG,QAAF,CAApC;AAEA,UAAME,YAAY,GAAG,6BACpBD,eADoB,EAEpB,sCAFoB,EAGpB,KAHoB,CAArB;;AAMA,QAAK,CAAEC,YAAF,IAAkBT,UAAvB,EAAoC;AACnC,aAAO,IAAP;AACA;;AAED,WAAO,KAAP;AACA,GApBK,EAqBN,CAAEC,QAAF,EAAYD,UAAZ,EAAwBE,IAAxB,CArBM,CAAP;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit/context';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useDisplayBlockControls() {\n\tconst { isSelected, clientId, name } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlockRootClientId } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\n\t\t\tconst parentId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockName = getBlockName( parentId );\n\n\t\t\tconst hideControls = hasBlockSupport(\n\t\t\t\tparentBlockName,\n\t\t\t\t'__experimentalHideChildBlockControls',\n\t\t\t\tfalse\n\t\t\t);\n\n\t\t\tif ( ! hideControls && isSelected ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t\t[ clientId, isSelected, name ]\n\t);\n}\n"]}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { noop } from 'lodash';
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { MenuItem, __experimentalText as Text } from '@wordpress/components';
|
|
12
|
-
import { check } from '@wordpress/icons';
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import useStylesForBlocks from './use-styles-for-block';
|
|
18
|
-
export default function BlockStylesMenuItems(_ref) {
|
|
19
|
-
let {
|
|
20
|
-
clientId,
|
|
21
|
-
onSwitch = noop
|
|
22
|
-
} = _ref;
|
|
23
|
-
const {
|
|
24
|
-
onSelect,
|
|
25
|
-
stylesToRender,
|
|
26
|
-
activeStyle
|
|
27
|
-
} = useStylesForBlocks({
|
|
28
|
-
clientId,
|
|
29
|
-
onSwitch
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if (!stylesToRender || stylesToRender.length === 0) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return createElement(Fragment, null, stylesToRender.map(style => {
|
|
37
|
-
const menuItemText = style.label || style.name;
|
|
38
|
-
return createElement(MenuItem, {
|
|
39
|
-
key: style.name,
|
|
40
|
-
icon: activeStyle.name === style.name ? check : null,
|
|
41
|
-
onClick: () => onSelect(style)
|
|
42
|
-
}, createElement(Text, {
|
|
43
|
-
as: "span",
|
|
44
|
-
limit: 18,
|
|
45
|
-
ellipsizeMode: "tail",
|
|
46
|
-
truncate: true
|
|
47
|
-
}, menuItemText));
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=menu-items.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/menu-items.js"],"names":["noop","MenuItem","__experimentalText","Text","check","useStylesForBlocks","BlockStylesMenuItems","clientId","onSwitch","onSelect","stylesToRender","activeStyle","length","map","style","menuItemText","label","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,kBAAkB,IAAIC,IAAzC,QAAqD,uBAArD;AACA,SAASC,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AAEA,eAAe,SAASC,oBAAT,OAA+D;AAAA,MAAhC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAQ,GAAGR;AAAvB,GAAgC;AAC7E,QAAM;AAAES,IAAAA,QAAF;AAAYC,IAAAA,cAAZ;AAA4BC,IAAAA;AAA5B,MAA4CN,kBAAkB,CAAE;AACrEE,IAAAA,QADqE;AAErEC,IAAAA;AAFqE,GAAF,CAApE;;AAKA,MAAK,CAAEE,cAAF,IAAoBA,cAAc,CAACE,MAAf,KAA0B,CAAnD,EAAuD;AACtD,WAAO,IAAP;AACA;;AACD,SACC,8BACGF,cAAc,CAACG,GAAf,CAAsBC,KAAF,IAAa;AAClC,UAAMC,YAAY,GAAGD,KAAK,CAACE,KAAN,IAAeF,KAAK,CAACG,IAA1C;AACA,WACC,cAAC,QAAD;AACC,MAAA,GAAG,EAAGH,KAAK,CAACG,IADb;AAEC,MAAA,IAAI,EAAGN,WAAW,CAACM,IAAZ,KAAqBH,KAAK,CAACG,IAA3B,GAAkCb,KAAlC,GAA0C,IAFlD;AAGC,MAAA,OAAO,EAAG,MAAMK,QAAQ,CAAEK,KAAF;AAHzB,OAKC,cAAC,IAAD;AACC,MAAA,EAAE,EAAC,MADJ;AAEC,MAAA,KAAK,EAAG,EAFT;AAGC,MAAA,aAAa,EAAC,MAHf;AAIC,MAAA,QAAQ;AAJT,OAMGC,YANH,CALD,CADD;AAgBA,GAlBC,CADH,CADD;AAuBA","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { MenuItem, __experimentalText as Text } from '@wordpress/components';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport useStylesForBlocks from './use-styles-for-block';\n\nexport default function BlockStylesMenuItems( { clientId, onSwitch = noop } ) {\n\tconst { onSelect, stylesToRender, activeStyle } = useStylesForBlocks( {\n\t\tclientId,\n\t\tonSwitch,\n\t} );\n\n\tif ( ! stylesToRender || stylesToRender.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ stylesToRender.map( ( style ) => {\n\t\t\t\tconst menuItemText = style.label || style.name;\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ style.name }\n\t\t\t\t\t\ticon={ activeStyle.name === style.name ? check : null }\n\t\t\t\t\t\tonClick={ () => onSelect( style ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\tlimit={ 18 }\n\t\t\t\t\t\t\tellipsizeMode=\"tail\"\n\t\t\t\t\t\t\ttruncate\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ menuItemText }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { useMemo } from '@wordpress/element';
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import InserterPreviewPanel from '../inserter/preview-panel';
|
|
12
|
-
import { replaceActiveStyle } from './utils';
|
|
13
|
-
export default function BlockStylesPreviewPanel(_ref) {
|
|
14
|
-
let {
|
|
15
|
-
genericPreviewBlock,
|
|
16
|
-
style,
|
|
17
|
-
className,
|
|
18
|
-
activeStyle
|
|
19
|
-
} = _ref;
|
|
20
|
-
const styleClassName = replaceActiveStyle(className, activeStyle, style);
|
|
21
|
-
const previewBlocks = useMemo(() => {
|
|
22
|
-
return { ...genericPreviewBlock,
|
|
23
|
-
title: style.label || style.name,
|
|
24
|
-
description: style.description,
|
|
25
|
-
initialAttributes: { ...genericPreviewBlock.attributes,
|
|
26
|
-
className: styleClassName + ' block-editor-block-styles__block-preview-container'
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}, [genericPreviewBlock, styleClassName]);
|
|
30
|
-
return createElement(InserterPreviewPanel, {
|
|
31
|
-
item: previewBlocks,
|
|
32
|
-
isStylePreview: true
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=preview-panel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/preview-panel.js"],"names":["useMemo","InserterPreviewPanel","replaceActiveStyle","BlockStylesPreviewPanel","genericPreviewBlock","style","className","activeStyle","styleClassName","previewBlocks","title","label","name","description","initialAttributes","attributes"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AACA,SAASC,kBAAT,QAAmC,SAAnC;AAEA,eAAe,SAASC,uBAAT,OAKX;AAAA,MAL6C;AAChDC,IAAAA,mBADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,SAHgD;AAIhDC,IAAAA;AAJgD,GAK7C;AACH,QAAMC,cAAc,GAAGN,kBAAkB,CAAEI,SAAF,EAAaC,WAAb,EAA0BF,KAA1B,CAAzC;AACA,QAAMI,aAAa,GAAGT,OAAO,CAAE,MAAM;AACpC,WAAO,EACN,GAAGI,mBADG;AAENM,MAAAA,KAAK,EAAEL,KAAK,CAACM,KAAN,IAAeN,KAAK,CAACO,IAFtB;AAGNC,MAAAA,WAAW,EAAER,KAAK,CAACQ,WAHb;AAINC,MAAAA,iBAAiB,EAAE,EAClB,GAAGV,mBAAmB,CAACW,UADL;AAElBT,QAAAA,SAAS,EACRE,cAAc,GACd;AAJiB;AAJb,KAAP;AAWA,GAZ4B,EAY1B,CAAEJ,mBAAF,EAAuBI,cAAvB,CAZ0B,CAA7B;AAcA,SACC,cAAC,oBAAD;AAAsB,IAAA,IAAI,EAAGC,aAA7B;AAA6C,IAAA,cAAc,EAAG;AAA9D,IADD;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InserterPreviewPanel from '../inserter/preview-panel';\nimport { replaceActiveStyle } from './utils';\n\nexport default function BlockStylesPreviewPanel( {\n\tgenericPreviewBlock,\n\tstyle,\n\tclassName,\n\tactiveStyle,\n} ) {\n\tconst styleClassName = replaceActiveStyle( className, activeStyle, style );\n\tconst previewBlocks = useMemo( () => {\n\t\treturn {\n\t\t\t...genericPreviewBlock,\n\t\t\ttitle: style.label || style.name,\n\t\t\tdescription: style.description,\n\t\t\tinitialAttributes: {\n\t\t\t\t...genericPreviewBlock.attributes,\n\t\t\t\tclassName:\n\t\t\t\t\tstyleClassName +\n\t\t\t\t\t' block-editor-block-styles__block-preview-container',\n\t\t\t},\n\t\t};\n\t}, [ genericPreviewBlock, styleClassName ] );\n\n\treturn (\n\t\t<InserterPreviewPanel item={ previewBlocks } isStylePreview={ true } />\n\t);\n}\n"]}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
-
import { cloneBlock, getBlockType, getBlockFromExample, store as blocksStore } from '@wordpress/blocks';
|
|
6
|
-
import { useMemo } from '@wordpress/element';
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { getActiveStyle, getRenderedStyles, replaceActiveStyle } from './utils';
|
|
12
|
-
import { store as blockEditorStore } from '../../store';
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @param {WPBlock} block Block object.
|
|
16
|
-
* @param {WPBlockType} type Block type settings.
|
|
17
|
-
* @return {WPBlock} A generic block ready for styles preview.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
function useGenericPreviewBlock(block, type) {
|
|
21
|
-
return useMemo(() => {
|
|
22
|
-
const example = type === null || type === void 0 ? void 0 : type.example;
|
|
23
|
-
const blockName = type === null || type === void 0 ? void 0 : type.name;
|
|
24
|
-
|
|
25
|
-
if (example && blockName) {
|
|
26
|
-
return getBlockFromExample(blockName, {
|
|
27
|
-
attributes: example.attributes,
|
|
28
|
-
innerBlocks: example.innerBlocks
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (block) {
|
|
33
|
-
return cloneBlock(block);
|
|
34
|
-
}
|
|
35
|
-
}, [type !== null && type !== void 0 && type.example ? block === null || block === void 0 ? void 0 : block.name : block, type]);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @typedef useStylesForBlocksArguments
|
|
39
|
-
* @property {string} clientId Block client ID.
|
|
40
|
-
* @property {() => void} onSwitch Block style switch callback function.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param {useStylesForBlocksArguments} useStylesForBlocks arguments.
|
|
46
|
-
* @return {Object} Results of the select methods.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export default function useStylesForBlocks(_ref) {
|
|
51
|
-
let {
|
|
52
|
-
clientId,
|
|
53
|
-
onSwitch
|
|
54
|
-
} = _ref;
|
|
55
|
-
|
|
56
|
-
const selector = select => {
|
|
57
|
-
const {
|
|
58
|
-
getBlock
|
|
59
|
-
} = select(blockEditorStore);
|
|
60
|
-
const block = getBlock(clientId);
|
|
61
|
-
|
|
62
|
-
if (!block) {
|
|
63
|
-
return {};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const blockType = getBlockType(block.name);
|
|
67
|
-
const {
|
|
68
|
-
getBlockStyles
|
|
69
|
-
} = select(blocksStore);
|
|
70
|
-
return {
|
|
71
|
-
block,
|
|
72
|
-
blockType,
|
|
73
|
-
styles: getBlockStyles(block.name),
|
|
74
|
-
className: block.attributes.className || ''
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const {
|
|
79
|
-
styles,
|
|
80
|
-
block,
|
|
81
|
-
blockType,
|
|
82
|
-
className
|
|
83
|
-
} = useSelect(selector, [clientId]);
|
|
84
|
-
const {
|
|
85
|
-
updateBlockAttributes
|
|
86
|
-
} = useDispatch(blockEditorStore);
|
|
87
|
-
const stylesToRender = getRenderedStyles(styles);
|
|
88
|
-
const activeStyle = getActiveStyle(stylesToRender, className);
|
|
89
|
-
const genericPreviewBlock = useGenericPreviewBlock(block, blockType);
|
|
90
|
-
|
|
91
|
-
const onSelect = style => {
|
|
92
|
-
const styleClassName = replaceActiveStyle(className, activeStyle, style);
|
|
93
|
-
updateBlockAttributes(clientId, {
|
|
94
|
-
className: styleClassName
|
|
95
|
-
});
|
|
96
|
-
onSwitch();
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
onSelect,
|
|
101
|
-
stylesToRender,
|
|
102
|
-
activeStyle,
|
|
103
|
-
genericPreviewBlock,
|
|
104
|
-
className
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=use-styles-for-block.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/use-styles-for-block.js"],"names":["useDispatch","useSelect","cloneBlock","getBlockType","getBlockFromExample","store","blocksStore","useMemo","getActiveStyle","getRenderedStyles","replaceActiveStyle","blockEditorStore","useGenericPreviewBlock","block","type","example","blockName","name","attributes","innerBlocks","useStylesForBlocks","clientId","onSwitch","selector","select","getBlock","blockType","getBlockStyles","styles","className","updateBlockAttributes","stylesToRender","activeStyle","genericPreviewBlock","onSelect","style","styleClassName"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,UADD,EAECC,YAFD,EAGCC,mBAHD,EAICC,KAAK,IAAIC,WAJV,QAKO,mBALP;AAMA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,EAAyBC,iBAAzB,EAA4CC,kBAA5C,QAAsE,SAAtE;AACA,SAASL,KAAK,IAAIM,gBAAlB,QAA0C,aAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,KAAjC,EAAwCC,IAAxC,EAA+C;AAC9C,SAAOP,OAAO,CAAE,MAAM;AACrB,UAAMQ,OAAO,GAAGD,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEC,OAAtB;AACA,UAAMC,SAAS,GAAGF,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEG,IAAxB;;AAEA,QAAKF,OAAO,IAAIC,SAAhB,EAA4B;AAC3B,aAAOZ,mBAAmB,CAAEY,SAAF,EAAa;AACtCE,QAAAA,UAAU,EAAEH,OAAO,CAACG,UADkB;AAEtCC,QAAAA,WAAW,EAAEJ,OAAO,CAACI;AAFiB,OAAb,CAA1B;AAIA;;AAED,QAAKN,KAAL,EAAa;AACZ,aAAOX,UAAU,CAAEW,KAAF,CAAjB;AACA;AACD,GAda,EAcX,CAAEC,IAAI,SAAJ,IAAAA,IAAI,WAAJ,IAAAA,IAAI,CAAEC,OAAN,GAAgBF,KAAhB,aAAgBA,KAAhB,uBAAgBA,KAAK,CAAEI,IAAvB,GAA8BJ,KAAhC,EAAuCC,IAAvC,CAdW,CAAd;AAeA;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AACA,eAAe,SAASM,kBAAT,OAAsD;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAyB;;AACpE,QAAMC,QAAQ,GAAKC,MAAF,IAAc;AAC9B,UAAM;AAAEC,MAAAA;AAAF,QAAeD,MAAM,CAAEb,gBAAF,CAA3B;AACA,UAAME,KAAK,GAAGY,QAAQ,CAAEJ,QAAF,CAAtB;;AAEA,QAAK,CAAER,KAAP,EAAe;AACd,aAAO,EAAP;AACA;;AACD,UAAMa,SAAS,GAAGvB,YAAY,CAAEU,KAAK,CAACI,IAAR,CAA9B;AACA,UAAM;AAAEU,MAAAA;AAAF,QAAqBH,MAAM,CAAElB,WAAF,CAAjC;AAEA,WAAO;AACNO,MAAAA,KADM;AAENa,MAAAA,SAFM;AAGNE,MAAAA,MAAM,EAAED,cAAc,CAAEd,KAAK,CAACI,IAAR,CAHhB;AAINY,MAAAA,SAAS,EAAEhB,KAAK,CAACK,UAAN,CAAiBW,SAAjB,IAA8B;AAJnC,KAAP;AAMA,GAhBD;;AAiBA,QAAM;AAAED,IAAAA,MAAF;AAAUf,IAAAA,KAAV;AAAiBa,IAAAA,SAAjB;AAA4BG,IAAAA;AAA5B,MAA0C5B,SAAS,CAAEsB,QAAF,EAAY,CACpEF,QADoE,CAAZ,CAAzD;AAGA,QAAM;AAAES,IAAAA;AAAF,MAA4B9B,WAAW,CAAEW,gBAAF,CAA7C;AACA,QAAMoB,cAAc,GAAGtB,iBAAiB,CAAEmB,MAAF,CAAxC;AACA,QAAMI,WAAW,GAAGxB,cAAc,CAAEuB,cAAF,EAAkBF,SAAlB,CAAlC;AACA,QAAMI,mBAAmB,GAAGrB,sBAAsB,CAAEC,KAAF,EAASa,SAAT,CAAlD;;AAEA,QAAMQ,QAAQ,GAAKC,KAAF,IAAa;AAC7B,UAAMC,cAAc,GAAG1B,kBAAkB,CACxCmB,SADwC,EAExCG,WAFwC,EAGxCG,KAHwC,CAAzC;AAKAL,IAAAA,qBAAqB,CAAET,QAAF,EAAY;AAChCQ,MAAAA,SAAS,EAAEO;AADqB,KAAZ,CAArB;AAGAd,IAAAA,QAAQ;AACR,GAVD;;AAYA,SAAO;AACNY,IAAAA,QADM;AAENH,IAAAA,cAFM;AAGNC,IAAAA,WAHM;AAINC,IAAAA,mBAJM;AAKNJ,IAAAA;AALM,GAAP;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tcloneBlock,\n\tgetBlockType,\n\tgetBlockFromExample,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getActiveStyle, getRenderedStyles, replaceActiveStyle } from './utils';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n *\n * @param {WPBlock} block Block object.\n * @param {WPBlockType} type Block type settings.\n * @return {WPBlock} A generic block ready for styles preview.\n */\nfunction useGenericPreviewBlock( block, type ) {\n\treturn useMemo( () => {\n\t\tconst example = type?.example;\n\t\tconst blockName = type?.name;\n\n\t\tif ( example && blockName ) {\n\t\t\treturn getBlockFromExample( blockName, {\n\t\t\t\tattributes: example.attributes,\n\t\t\t\tinnerBlocks: example.innerBlocks,\n\t\t\t} );\n\t\t}\n\n\t\tif ( block ) {\n\t\t\treturn cloneBlock( block );\n\t\t}\n\t}, [ type?.example ? block?.name : block, type ] );\n}\n\n/**\n * @typedef useStylesForBlocksArguments\n * @property {string} clientId Block client ID.\n * @property {() => void} onSwitch Block style switch callback function.\n */\n\n/**\n *\n * @param {useStylesForBlocksArguments} useStylesForBlocks arguments.\n * @return {Object} Results of the select methods.\n */\nexport default function useStylesForBlocks( { clientId, onSwitch } ) {\n\tconst selector = ( select ) => {\n\t\tconst { getBlock } = select( blockEditorStore );\n\t\tconst block = getBlock( clientId );\n\n\t\tif ( ! block ) {\n\t\t\treturn {};\n\t\t}\n\t\tconst blockType = getBlockType( block.name );\n\t\tconst { getBlockStyles } = select( blocksStore );\n\n\t\treturn {\n\t\t\tblock,\n\t\t\tblockType,\n\t\t\tstyles: getBlockStyles( block.name ),\n\t\t\tclassName: block.attributes.className || '',\n\t\t};\n\t};\n\tconst { styles, block, blockType, className } = useSelect( selector, [\n\t\tclientId,\n\t] );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst stylesToRender = getRenderedStyles( styles );\n\tconst activeStyle = getActiveStyle( stylesToRender, className );\n\tconst genericPreviewBlock = useGenericPreviewBlock( block, blockType );\n\n\tconst onSelect = ( style ) => {\n\t\tconst styleClassName = replaceActiveStyle(\n\t\t\tclassName,\n\t\t\tactiveStyle,\n\t\t\tstyle\n\t\t);\n\t\tupdateBlockAttributes( clientId, {\n\t\t\tclassName: styleClassName,\n\t\t} );\n\t\tonSwitch();\n\t};\n\n\treturn {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName,\n\t};\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { insert } from '@wordpress/rich-text';
|
|
5
|
-
export function preventEventDiscovery(value) {
|
|
6
|
-
const searchText = 'tales of gutenberg';
|
|
7
|
-
const addText = ' 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️';
|
|
8
|
-
const {
|
|
9
|
-
start,
|
|
10
|
-
text
|
|
11
|
-
} = value;
|
|
12
|
-
|
|
13
|
-
if (start < searchText.length) {
|
|
14
|
-
return value;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const charactersBefore = text.slice(start - searchText.length, start);
|
|
18
|
-
|
|
19
|
-
if (charactersBefore.toLowerCase() !== searchText) {
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return insert(value, addText);
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=prevent-event-discovery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/prevent-event-discovery.js"],"names":["insert","preventEventDiscovery","value","searchText","addText","start","text","length","charactersBefore","slice","toLowerCase"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,sBAAvB;AAEA,OAAO,SAASC,qBAAT,CAAgCC,KAAhC,EAAwC;AAC9C,QAAMC,UAAU,GAAG,oBAAnB;AACA,QAAMC,OAAO,GACZ,4FADD;AAEA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBJ,KAAxB;;AAEA,MAAKG,KAAK,GAAGF,UAAU,CAACI,MAAxB,EAAiC;AAChC,WAAOL,KAAP;AACA;;AAED,QAAMM,gBAAgB,GAAGF,IAAI,CAACG,KAAL,CAAYJ,KAAK,GAAGF,UAAU,CAACI,MAA/B,EAAuCF,KAAvC,CAAzB;;AAEA,MAAKG,gBAAgB,CAACE,WAAjB,OAAmCP,UAAxC,EAAqD;AACpD,WAAOD,KAAP;AACA;;AAED,SAAOF,MAAM,CAAEE,KAAF,EAASE,OAAT,CAAb;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { insert } from '@wordpress/rich-text';\n\nexport function preventEventDiscovery( value ) {\n\tconst searchText = 'tales of gutenberg';\n\tconst addText =\n\t\t' 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️';\n\tconst { start, text } = value;\n\n\tif ( start < searchText.length ) {\n\t\treturn value;\n\t}\n\n\tconst charactersBefore = text.slice( start - searchText.length, start );\n\n\tif ( charactersBefore.toLowerCase() !== searchText ) {\n\t\treturn value;\n\t}\n\n\treturn insert( value, addText );\n}\n"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { useBlockEditContext } from '../block-edit/context';
|
|
11
|
-
import { store as blockEditorStore } from '../../store';
|
|
12
|
-
export default function useDisplayBlockControls() {
|
|
13
|
-
const {
|
|
14
|
-
isSelected,
|
|
15
|
-
clientId,
|
|
16
|
-
name
|
|
17
|
-
} = useBlockEditContext();
|
|
18
|
-
return useSelect(select => {
|
|
19
|
-
const {
|
|
20
|
-
getBlockName,
|
|
21
|
-
getBlockRootClientId
|
|
22
|
-
} = select(blockEditorStore);
|
|
23
|
-
const parentId = getBlockRootClientId(clientId);
|
|
24
|
-
const parentBlockName = getBlockName(parentId);
|
|
25
|
-
const hideControls = hasBlockSupport(parentBlockName, '__experimentalHideChildBlockControls', false);
|
|
26
|
-
|
|
27
|
-
if (!hideControls && isSelected) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return false;
|
|
32
|
-
}, [clientId, isSelected, name]);
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/use-display-block-controls/index.native.js"],"names":["useSelect","hasBlockSupport","useBlockEditContext","store","blockEditorStore","useDisplayBlockControls","isSelected","clientId","name","select","getBlockName","getBlockRootClientId","parentId","parentBlockName","hideControls"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,uBAAT,GAAmC;AACjD,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,QAAd;AAAwBC,IAAAA;AAAxB,MAAiCN,mBAAmB,EAA1D;AACA,SAAOF,SAAS,CACbS,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA;AAAhB,QAAyCF,MAAM,CACpDL,gBADoD,CAArD;AAIA,UAAMQ,QAAQ,GAAGD,oBAAoB,CAAEJ,QAAF,CAArC;AACA,UAAMM,eAAe,GAAGH,YAAY,CAAEE,QAAF,CAApC;AAEA,UAAME,YAAY,GAAGb,eAAe,CACnCY,eADmC,EAEnC,sCAFmC,EAGnC,KAHmC,CAApC;;AAMA,QAAK,CAAEC,YAAF,IAAkBR,UAAvB,EAAoC;AACnC,aAAO,IAAP;AACA;;AAED,WAAO,KAAP;AACA,GApBc,EAqBf,CAAEC,QAAF,EAAYD,UAAZ,EAAwBE,IAAxB,CArBe,CAAhB;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit/context';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function useDisplayBlockControls() {\n\tconst { isSelected, clientId, name } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlockRootClientId } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\n\t\t\tconst parentId = getBlockRootClientId( clientId );\n\t\t\tconst parentBlockName = getBlockName( parentId );\n\n\t\t\tconst hideControls = hasBlockSupport(\n\t\t\t\tparentBlockName,\n\t\t\t\t'__experimentalHideChildBlockControls',\n\t\t\t\tfalse\n\t\t\t);\n\n\t\t\tif ( ! hideControls && isSelected ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\t\t[ clientId, isSelected, name ]\n\t);\n}\n"]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { noop } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { MenuItem, __experimentalText as Text } from '@wordpress/components';
|
|
10
|
-
import { check } from '@wordpress/icons';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import useStylesForBlocks from './use-styles-for-block';
|
|
16
|
-
|
|
17
|
-
export default function BlockStylesMenuItems( { clientId, onSwitch = noop } ) {
|
|
18
|
-
const { onSelect, stylesToRender, activeStyle } = useStylesForBlocks( {
|
|
19
|
-
clientId,
|
|
20
|
-
onSwitch,
|
|
21
|
-
} );
|
|
22
|
-
|
|
23
|
-
if ( ! stylesToRender || stylesToRender.length === 0 ) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
{ stylesToRender.map( ( style ) => {
|
|
29
|
-
const menuItemText = style.label || style.name;
|
|
30
|
-
return (
|
|
31
|
-
<MenuItem
|
|
32
|
-
key={ style.name }
|
|
33
|
-
icon={ activeStyle.name === style.name ? check : null }
|
|
34
|
-
onClick={ () => onSelect( style ) }
|
|
35
|
-
>
|
|
36
|
-
<Text
|
|
37
|
-
as="span"
|
|
38
|
-
limit={ 18 }
|
|
39
|
-
ellipsizeMode="tail"
|
|
40
|
-
truncate
|
|
41
|
-
>
|
|
42
|
-
{ menuItemText }
|
|
43
|
-
</Text>
|
|
44
|
-
</MenuItem>
|
|
45
|
-
);
|
|
46
|
-
} ) }
|
|
47
|
-
</>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useMemo } from '@wordpress/element';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import InserterPreviewPanel from '../inserter/preview-panel';
|
|
10
|
-
import { replaceActiveStyle } from './utils';
|
|
11
|
-
|
|
12
|
-
export default function BlockStylesPreviewPanel( {
|
|
13
|
-
genericPreviewBlock,
|
|
14
|
-
style,
|
|
15
|
-
className,
|
|
16
|
-
activeStyle,
|
|
17
|
-
} ) {
|
|
18
|
-
const styleClassName = replaceActiveStyle( className, activeStyle, style );
|
|
19
|
-
const previewBlocks = useMemo( () => {
|
|
20
|
-
return {
|
|
21
|
-
...genericPreviewBlock,
|
|
22
|
-
title: style.label || style.name,
|
|
23
|
-
description: style.description,
|
|
24
|
-
initialAttributes: {
|
|
25
|
-
...genericPreviewBlock.attributes,
|
|
26
|
-
className:
|
|
27
|
-
styleClassName +
|
|
28
|
-
' block-editor-block-styles__block-preview-container',
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
}, [ genericPreviewBlock, styleClassName ] );
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<InserterPreviewPanel item={ previewBlocks } isStylePreview={ true } />
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
-
import {
|
|
6
|
-
cloneBlock,
|
|
7
|
-
getBlockType,
|
|
8
|
-
getBlockFromExample,
|
|
9
|
-
store as blocksStore,
|
|
10
|
-
} from '@wordpress/blocks';
|
|
11
|
-
import { useMemo } from '@wordpress/element';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { getActiveStyle, getRenderedStyles, replaceActiveStyle } from './utils';
|
|
17
|
-
import { store as blockEditorStore } from '../../store';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param {WPBlock} block Block object.
|
|
22
|
-
* @param {WPBlockType} type Block type settings.
|
|
23
|
-
* @return {WPBlock} A generic block ready for styles preview.
|
|
24
|
-
*/
|
|
25
|
-
function useGenericPreviewBlock( block, type ) {
|
|
26
|
-
return useMemo( () => {
|
|
27
|
-
const example = type?.example;
|
|
28
|
-
const blockName = type?.name;
|
|
29
|
-
|
|
30
|
-
if ( example && blockName ) {
|
|
31
|
-
return getBlockFromExample( blockName, {
|
|
32
|
-
attributes: example.attributes,
|
|
33
|
-
innerBlocks: example.innerBlocks,
|
|
34
|
-
} );
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if ( block ) {
|
|
38
|
-
return cloneBlock( block );
|
|
39
|
-
}
|
|
40
|
-
}, [ type?.example ? block?.name : block, type ] );
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @typedef useStylesForBlocksArguments
|
|
45
|
-
* @property {string} clientId Block client ID.
|
|
46
|
-
* @property {() => void} onSwitch Block style switch callback function.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
* @param {useStylesForBlocksArguments} useStylesForBlocks arguments.
|
|
52
|
-
* @return {Object} Results of the select methods.
|
|
53
|
-
*/
|
|
54
|
-
export default function useStylesForBlocks( { clientId, onSwitch } ) {
|
|
55
|
-
const selector = ( select ) => {
|
|
56
|
-
const { getBlock } = select( blockEditorStore );
|
|
57
|
-
const block = getBlock( clientId );
|
|
58
|
-
|
|
59
|
-
if ( ! block ) {
|
|
60
|
-
return {};
|
|
61
|
-
}
|
|
62
|
-
const blockType = getBlockType( block.name );
|
|
63
|
-
const { getBlockStyles } = select( blocksStore );
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
block,
|
|
67
|
-
blockType,
|
|
68
|
-
styles: getBlockStyles( block.name ),
|
|
69
|
-
className: block.attributes.className || '',
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
const { styles, block, blockType, className } = useSelect( selector, [
|
|
73
|
-
clientId,
|
|
74
|
-
] );
|
|
75
|
-
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
76
|
-
const stylesToRender = getRenderedStyles( styles );
|
|
77
|
-
const activeStyle = getActiveStyle( stylesToRender, className );
|
|
78
|
-
const genericPreviewBlock = useGenericPreviewBlock( block, blockType );
|
|
79
|
-
|
|
80
|
-
const onSelect = ( style ) => {
|
|
81
|
-
const styleClassName = replaceActiveStyle(
|
|
82
|
-
className,
|
|
83
|
-
activeStyle,
|
|
84
|
-
style
|
|
85
|
-
);
|
|
86
|
-
updateBlockAttributes( clientId, {
|
|
87
|
-
className: styleClassName,
|
|
88
|
-
} );
|
|
89
|
-
onSwitch();
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
onSelect,
|
|
94
|
-
stylesToRender,
|
|
95
|
-
activeStyle,
|
|
96
|
-
genericPreviewBlock,
|
|
97
|
-
className,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { insert } from '@wordpress/rich-text';
|
|
5
|
-
|
|
6
|
-
export function preventEventDiscovery( value ) {
|
|
7
|
-
const searchText = 'tales of gutenberg';
|
|
8
|
-
const addText =
|
|
9
|
-
' 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️';
|
|
10
|
-
const { start, text } = value;
|
|
11
|
-
|
|
12
|
-
if ( start < searchText.length ) {
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const charactersBefore = text.slice( start - searchText.length, start );
|
|
17
|
-
|
|
18
|
-
if ( charactersBefore.toLowerCase() !== searchText ) {
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return insert( value, addText );
|
|
23
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { useBlockEditContext } from '../block-edit/context';
|
|
11
|
-
import { store as blockEditorStore } from '../../store';
|
|
12
|
-
|
|
13
|
-
export default function useDisplayBlockControls() {
|
|
14
|
-
const { isSelected, clientId, name } = useBlockEditContext();
|
|
15
|
-
return useSelect(
|
|
16
|
-
( select ) => {
|
|
17
|
-
const { getBlockName, getBlockRootClientId } = select(
|
|
18
|
-
blockEditorStore
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const parentId = getBlockRootClientId( clientId );
|
|
22
|
-
const parentBlockName = getBlockName( parentId );
|
|
23
|
-
|
|
24
|
-
const hideControls = hasBlockSupport(
|
|
25
|
-
parentBlockName,
|
|
26
|
-
'__experimentalHideChildBlockControls',
|
|
27
|
-
false
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
if ( ! hideControls && isSelected ) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return false;
|
|
35
|
-
},
|
|
36
|
-
[ clientId, isSelected, name ]
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { toggleRichText } from '../use-multi-selection';
|
|
5
|
-
|
|
6
|
-
describe( 'toggleRichText', () => {
|
|
7
|
-
function getContainer( isContentEditible ) {
|
|
8
|
-
const container = document.createDocumentFragment();
|
|
9
|
-
[
|
|
10
|
-
'rich-text',
|
|
11
|
-
'rich-text editor-post-title__input',
|
|
12
|
-
'some-other-class',
|
|
13
|
-
].forEach( ( className ) => {
|
|
14
|
-
const element = document.createElement( 'div' );
|
|
15
|
-
element.setAttribute( 'class', className );
|
|
16
|
-
if ( isContentEditible ) {
|
|
17
|
-
element.setAttribute( 'contenteditable', true );
|
|
18
|
-
}
|
|
19
|
-
container.appendChild( element );
|
|
20
|
-
} );
|
|
21
|
-
return container;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
it( 'should set the `contenteditable` attribute on eligible rich text nodes', () => {
|
|
25
|
-
const container = getContainer();
|
|
26
|
-
toggleRichText( container, true );
|
|
27
|
-
let nodes = container.querySelectorAll( '[contenteditable=true]' );
|
|
28
|
-
|
|
29
|
-
expect( nodes ).toHaveLength( 1 );
|
|
30
|
-
expect( nodes[ 0 ].className ).toBe( 'rich-text' );
|
|
31
|
-
|
|
32
|
-
toggleRichText( container, false );
|
|
33
|
-
nodes = container.querySelectorAll( '[contenteditable=true]' );
|
|
34
|
-
expect( nodes ).toHaveLength( 0 );
|
|
35
|
-
} );
|
|
36
|
-
} );
|