@wordpress/block-editor 14.8.0 → 14.8.1-next.a9f418477.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/build/autocompleters/block.js +2 -4
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -4
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/block-canvas/index.js +3 -6
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-list/block.js +6 -5
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.js +0 -1
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +6 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +87 -0
- package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +98 -5
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-lock/modal.js +4 -4
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-parent-selector/index.js +2 -15
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +13 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +4 -0
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +12 -22
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-switcher/utils.js +0 -1
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-toolbar/index.js +7 -6
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +0 -1
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +10 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +17 -16
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +0 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/iframe/use-scale-canvas.js +68 -47
- package/build/components/iframe/use-scale-canvas.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +0 -10
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/menu.js +2 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +19 -10
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +2 -13
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +10 -0
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +1 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +18 -18
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +9 -25
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/observe-typing/index.js +0 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/recursion-provider/index.js +0 -1
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/rich-text/index.js +5 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +0 -1
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +0 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +0 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +0 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +11 -2
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +15 -2
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/warning/index.js +2 -3
- package/build/components/warning/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +11 -0
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +6 -2
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/block-bindings.js +4 -3
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/gap.js +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/generated-class-name.js +0 -1
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/use-zoom-out.js +47 -14
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/store/private-selectors.js +1 -7
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +478 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +12 -55
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +0 -1
- package/build/utils/object.js.map +1 -1
- package/build-module/autocompleters/block.js +2 -4
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +2 -4
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/block-canvas/index.js +3 -6
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-list/block.js +8 -7
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.js +0 -1
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +6 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +80 -0
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +97 -5
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-lock/modal.js +4 -4
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +2 -15
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +13 -4
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +4 -0
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +13 -23
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +0 -1
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +7 -6
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +0 -1
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +10 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +17 -16
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +0 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/iframe/use-scale-canvas.js +68 -47
- package/build-module/components/iframe/use-scale-canvas.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -11
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +20 -11
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +3 -14
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +9 -0
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +1 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +18 -18
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +9 -25
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +0 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +0 -1
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +5 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +0 -1
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +0 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +0 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +0 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +11 -2
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +15 -2
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/warning/index.js +2 -3
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +11 -0
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +6 -2
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/block-bindings.js +4 -3
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/gap.js +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +0 -1
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +48 -15
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +479 -3
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +12 -55
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +0 -1
- package/build-module/utils/object.js.map +1 -1
- package/build-style/content-rtl.css +18 -5
- package/build-style/content.css +18 -5
- package/build-style/style-rtl.css +25 -64
- package/build-style/style.css +25 -64
- package/package.json +32 -32
- package/src/autocompleters/block.js +2 -4
- package/src/autocompleters/link.js +2 -4
- package/src/components/alignment-control/stories/aliginment-toolbar.story.js +47 -0
- package/src/components/alignment-control/stories/index.story.js +51 -0
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +5 -5
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +4 -4
- package/src/components/block-canvas/index.js +3 -5
- package/src/components/block-draggable/content.scss +11 -5
- package/src/components/block-list/block.js +7 -13
- package/src/components/block-list/content.scss +6 -0
- package/src/components/block-list/use-block-props/index.js +5 -0
- package/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +83 -0
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +112 -8
- package/src/components/block-lock/modal.js +4 -6
- package/src/components/block-parent-selector/index.js +1 -19
- package/src/components/block-patterns-list/index.js +12 -1
- package/src/components/block-patterns-list/stories/fixtures.js +1 -0
- package/src/components/block-patterns-list/style.scss +16 -5
- package/src/components/block-popover/inbetween.js +4 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +6 -1
- package/src/components/block-settings-menu-controls/index.js +2 -1
- package/src/components/block-switcher/index.js +19 -21
- package/src/components/block-switcher/style.scss +0 -9
- package/src/components/block-title/test/index.js +2 -0
- package/src/components/block-toolbar/index.js +9 -6
- package/src/components/block-tools/style.scss +5 -0
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +1 -1
- package/src/components/dimensions-tool/stories/index.story.js +1 -1
- package/src/components/dimensions-tool/stories/scale-tool.story.js +1 -1
- package/src/components/dimensions-tool/stories/width-height-tool.story.js +1 -1
- package/src/components/font-appearance-control/index.js +1 -0
- package/src/components/font-family/index.js +10 -0
- package/src/components/font-family/style.scss +5 -0
- package/src/components/global-styles/dimensions-panel.js +16 -16
- package/src/components/iframe/content.scss +6 -1
- package/src/components/iframe/use-scale-canvas.js +103 -81
- package/src/components/inserter/block-patterns-tab/index.js +1 -17
- package/src/components/inserter/menu.js +8 -1
- package/src/components/inserter-draggable-blocks/index.js +19 -29
- package/src/components/inspector-controls/slot.js +3 -22
- package/src/components/letter-spacing-control/README.md +2 -1
- package/src/components/letter-spacing-control/index.js +17 -0
- package/src/components/line-height-control/index.js +1 -0
- package/src/components/media-placeholder/index.js +25 -28
- package/src/components/multi-selection-inspector/index.js +17 -27
- package/src/components/multi-selection-inspector/style.scss +0 -12
- package/src/components/resolution-tool/stories/index.story.js +1 -1
- package/src/components/rich-text/index.js +5 -0
- package/src/components/spacing-sizes-control/style.scss +0 -29
- package/src/components/text-alignment-control/stories/index.story.js +1 -1
- package/src/components/use-block-drop-zone/index.js +18 -1
- package/src/components/use-moving-animation/index.js +15 -0
- package/src/components/use-resize-canvas/index.js +1 -1
- package/src/components/warning/index.js +3 -4
- package/src/components/warning/test/index.js +3 -1
- package/src/components/writing-flow/use-drag-selection.js +11 -0
- package/src/components/writing-flow/use-tab-nav.js +9 -6
- package/src/hooks/block-bindings.js +8 -4
- package/src/hooks/gap.js +1 -1
- package/src/hooks/use-zoom-out.js +48 -16
- package/src/store/private-selectors.js +2 -17
- package/src/store/reducer.js +639 -2
- package/src/store/selectors.js +19 -69
- package/src/store/test/private-selectors.js +1 -0
- package/src/store/test/reducer.js +849 -0
- package/src/store/test/selectors.js +4 -110
- package/src/style.scss +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_utils","_jsxRuntime","LineHeightControl","__next40pxDefaultSize","value","lineHeight","onChange","__unstableInputWidth","otherProps","isDefined","isLineHeightDefined","adjustNextValue","nextValue","wasTypedOrPasted","spin","STEP","SPIN_FACTOR","BASE_DEFAULT_VALUE","stateReducer","state","action","includes","payload","event","nativeEvent","inputType","RESET_VALUE","handleOnChange","type","jsx","className","children","__experimentalNumberControl","__unstableStateReducer","label","__","placeholder","step","spinFactor","min","spinControls","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/line-height-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\tvalue: lineHeight,\n\tonChange,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) {\n\t\t\treturn nextValue;\n\t\t}\n\n\t\t/**\n\t\t * The following logic handles the initial spin up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first spin up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Spin up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * dragging the input or by clicking the spin buttons.\n\t\t */\n\t\tconst spin = STEP * SPIN_FACTOR;\n\t\tswitch ( `${ nextValue }` ) {\n\t\t\tcase `${ spin }`:\n\t\t\t\t// Increment by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + spin;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than using the\n\t\t\t\t// spin down action from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) {\n\t\t\t\t\treturn nextValue;\n\t\t\t\t}\n\t\t\t\t// Decrement by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - spin;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this — cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tconst handleOnChange = ( nextValue, { event } ) => {\n\t\tif ( nextValue === '' ) {\n\t\t\tonChange();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.type === 'click' ) {\n\t\t\tonChange( adjustNextValue( `${ nextValue }`, false ) );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( `${ nextValue }` );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-line-height-control\">\n\t\t\t<NumberControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tspinFactor={ SPIN_FACTOR }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t\tspinControls=\"custom\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAMiB,IAAAG,WAAA,GAAAH,OAAA;AAfjB;AACA;AACA;;AAIA;AACA;AACA;;AASA,MAAMI,iBAAiB,GAAGA,CAAE;EAC3B;EACAC,qBAAqB,GAAG,KAAK;EAC7BC,KAAK,EAAEC,UAAU;EACjBC,QAAQ;EACRC,oBAAoB,GAAG,MAAM;EAC7B,GAAGC;AACJ,CAAC,KAAM;EACN,MAAMC,SAAS,GAAG,IAAAC,0BAAmB,EAAEL,UAAW,CAAC;EAEnD,MAAMM,eAAe,GAAGA,CAAEC,SAAS,EAAEC,gBAAgB,KAAM;IAC1D;IACA,IAAKJ,SAAS,EAAG;MAChB,OAAOG,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AS,EAAC,kCAAkC;IAAAC,QAAA,eAChD,IAAA9B,WAAA,CAAA4B,GAAA,EAAC9B,WAAA,CAAAiC,2BAAa;MAAA,GACRxB,UAAU;
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_utils","_jsxRuntime","LineHeightControl","__next40pxDefaultSize","value","lineHeight","onChange","__unstableInputWidth","otherProps","isDefined","isLineHeightDefined","adjustNextValue","nextValue","wasTypedOrPasted","spin","STEP","SPIN_FACTOR","BASE_DEFAULT_VALUE","stateReducer","state","action","includes","payload","event","nativeEvent","inputType","RESET_VALUE","handleOnChange","type","jsx","className","children","__experimentalNumberControl","__shouldNotWarnDeprecated36pxSize","__unstableStateReducer","label","__","placeholder","step","spinFactor","min","spinControls","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/line-height-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\tvalue: lineHeight,\n\tonChange,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) {\n\t\t\treturn nextValue;\n\t\t}\n\n\t\t/**\n\t\t * The following logic handles the initial spin up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first spin up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Spin up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * dragging the input or by clicking the spin buttons.\n\t\t */\n\t\tconst spin = STEP * SPIN_FACTOR;\n\t\tswitch ( `${ nextValue }` ) {\n\t\t\tcase `${ spin }`:\n\t\t\t\t// Increment by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + spin;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than using the\n\t\t\t\t// spin down action from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) {\n\t\t\t\t\treturn nextValue;\n\t\t\t\t}\n\t\t\t\t// Decrement by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - spin;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this — cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tconst handleOnChange = ( nextValue, { event } ) => {\n\t\tif ( nextValue === '' ) {\n\t\t\tonChange();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.type === 'click' ) {\n\t\t\tonChange( adjustNextValue( `${ nextValue }`, false ) );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( `${ nextValue }` );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-line-height-control\">\n\t\t\t<NumberControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tspinFactor={ SPIN_FACTOR }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t\tspinControls=\"custom\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAMiB,IAAAG,WAAA,GAAAH,OAAA;AAfjB;AACA;AACA;;AAIA;AACA;AACA;;AASA,MAAMI,iBAAiB,GAAGA,CAAE;EAC3B;EACAC,qBAAqB,GAAG,KAAK;EAC7BC,KAAK,EAAEC,UAAU;EACjBC,QAAQ;EACRC,oBAAoB,GAAG,MAAM;EAC7B,GAAGC;AACJ,CAAC,KAAM;EACN,MAAMC,SAAS,GAAG,IAAAC,0BAAmB,EAAEL,UAAW,CAAC;EAEnD,MAAMM,eAAe,GAAGA,CAAEC,SAAS,EAAEC,gBAAgB,KAAM;IAC1D;IACA,IAAKJ,SAAS,EAAG;MAChB,OAAOG,SAAS;IACjB;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACE,MAAME,IAAI,GAAGC,WAAI,GAAGC,kBAAW;IAC/B,QAAS,GAAIJ,SAAS,EAAG;MACxB,KAAK,GAAIE,IAAI,EAAG;QACf;QACA,OAAOG,yBAAkB,GAAGH,IAAI;MACjC,KAAK,GAAG;QAAE;UACT;UACA;UACA,IAAKD,gBAAgB,EAAG;YACvB,OAAOD,SAAS;UACjB;UACA;UACA,OAAOK,yBAAkB,GAAGH,IAAI;QACjC;MACA,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oB;MAClCqB,IAAI,EAAGvB,WAAM;MACbwB,UAAU,EAAGvB,kBAAa;MAC1BZ,KAAK,EAAGA,KAAO;MACfoC,GAAG,EAAG,CAAG;MACTC,YAAY,EAAC;IAAQ,CACrB;EAAC,CACE,CAAC;AAER,CAAC;;AAED;AACA;AACA;AAFA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGe1C,iBAAiB","ignoreList":[]}
|
|
@@ -12,12 +12,12 @@ var _i18n = require("@wordpress/i18n");
|
|
|
12
12
|
var _element = require("@wordpress/element");
|
|
13
13
|
var _data = require("@wordpress/data");
|
|
14
14
|
var _icons = require("@wordpress/icons");
|
|
15
|
-
var _blocks2 = require("@wordpress/blocks");
|
|
16
15
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
17
16
|
var _mediaUpload = _interopRequireDefault(require("../media-upload"));
|
|
18
17
|
var _check = _interopRequireDefault(require("../media-upload/check"));
|
|
19
18
|
var _urlPopover = _interopRequireDefault(require("../url-popover"));
|
|
20
19
|
var _store = require("../../store");
|
|
20
|
+
var _useOnBlockDrop = require("../use-on-block-drop");
|
|
21
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
/**
|
|
23
23
|
* External dependencies
|
|
@@ -216,18 +216,14 @@ function MediaPlaceholder({
|
|
|
216
216
|
onError
|
|
217
217
|
});
|
|
218
218
|
};
|
|
219
|
-
async function handleBlocksDrop(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return _blocks.flatMap(block => (block.name === 'core/image' || block.name === 'core/audio' || block.name === 'core/video') && (block.attributes.url || block.attributes.src) ? [block] : recursivelyFindMediaFromBlocks(block.innerBlocks));
|
|
225
|
-
}
|
|
226
|
-
const mediaBlocks = recursivelyFindMediaFromBlocks(blocks);
|
|
227
|
-
if (!mediaBlocks.length) {
|
|
219
|
+
async function handleBlocksDrop(event) {
|
|
220
|
+
const {
|
|
221
|
+
blocks
|
|
222
|
+
} = (0, _useOnBlockDrop.parseDropEvent)(event);
|
|
223
|
+
if (!blocks?.length) {
|
|
228
224
|
return;
|
|
229
225
|
}
|
|
230
|
-
const uploadedMediaList = await Promise.all(
|
|
226
|
+
const uploadedMediaList = await Promise.all(blocks.map(block => {
|
|
231
227
|
const blockType = block.name.split('/')[1];
|
|
232
228
|
if (block.attributes.id) {
|
|
233
229
|
block.attributes.type = blockType;
|
|
@@ -258,12 +254,6 @@ function MediaPlaceholder({
|
|
|
258
254
|
onSelect(uploadedMediaList[0]);
|
|
259
255
|
}
|
|
260
256
|
}
|
|
261
|
-
async function onDrop(event) {
|
|
262
|
-
const blocks = (0, _blocks2.pasteHandler)({
|
|
263
|
-
HTML: event.dataTransfer?.getData('default')
|
|
264
|
-
});
|
|
265
|
-
return await handleBlocksDrop(blocks);
|
|
266
|
-
}
|
|
267
257
|
const onUpload = event => {
|
|
268
258
|
onFilesUpload(event.target.files);
|
|
269
259
|
};
|
|
@@ -325,7 +315,17 @@ function MediaPlaceholder({
|
|
|
325
315
|
}
|
|
326
316
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropZone, {
|
|
327
317
|
onFilesDrop: onFilesUpload,
|
|
328
|
-
onDrop:
|
|
318
|
+
onDrop: handleBlocksDrop,
|
|
319
|
+
isEligible: dataTransfer => {
|
|
320
|
+
const prefix = 'wp-block:core/';
|
|
321
|
+
const types = [];
|
|
322
|
+
for (const type of dataTransfer.types) {
|
|
323
|
+
if (type.startsWith(prefix)) {
|
|
324
|
+
types.push(type.slice(prefix.length));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return types.every(type => allowedTypes.includes(type)) && (multiple ? true : types.length === 1);
|
|
328
|
+
}
|
|
329
329
|
});
|
|
330
330
|
};
|
|
331
331
|
const renderCancelLink = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_element","_data","_icons","_blocks2","_deprecated","_mediaUpload","_check","_urlPopover","_store","_jsxRuntime","noop","InsertFromURLPopover","src","onChange","onSubmit","onClose","popoverAnchor","jsx","default","anchor","children","className","__experimentalInputControl","__next40pxDefaultSize","label","__","hideLabelFromVision","placeholder","value","suffix","__experimentalInputControlSuffixWrapper","variant","Button","size","icon","keyboardReturn","type","URLSelectionUI","onChangeSrc","onSelectURL","setPopoverAnchor","useState","isURLInputVisible","setIsURLInputVisible","openURLInput","closeURLInput","focus","onSubmitSrc","event","preventDefault","jsxs","onClick","isPressed","ref","MediaPlaceholder","allowedTypes","labels","mediaPreview","notices","isAppender","accept","addToGallery","multiple","handleUpload","disableDropZone","disableMediaButtons","onError","onSelect","onCancel","onToggleFeaturedImage","onDoubleClick","onFilesPreUpload","onHTMLDrop","deprecatedOnHTMLDrop","mediaLibraryButton","style","deprecated","since","version","mediaUpload","useSelect","select","getSettings","blockEditorStore","setSrc","useEffect","_value$src","onlyAllowsImages","length","every","allowedType","startsWith","onFilesUpload","files","setMedia","lastMediaPassed","newMedia","filteredMedia","filter","item","id","some","Number","urlSlug","url","includes","concat","map","media","cutOffIndex","lastIndexOf","slice","filesList","onFileChange","handleBlocksDrop","blocks","Array","isArray","recursivelyFindMediaFromBlocks","_blocks","flatMap","block","name","attributes","innerBlocks","mediaBlocks","uploadedMediaList","Promise","all","blockType","split","resolve","reject","window","fetch","then","response","blob","additionalData","title","alt_text","alt","caption","catch","err","onDrop","pasteHandler","HTML","dataTransfer","getData","onUpload","target","defaultRenderPlaceholder","content","instructions","undefined","typesAllowed","firstAllowedType","isOneType","isAudio","isImage","isVideo","placeholderClassName","clsx","Placeholder","preview","renderPlaceholder","renderDropZone","DropZone","onFilesDrop","renderCancelLink","renderUrlSelectionUI","renderFeaturedImageToggle","renderMediaUploadChecked","defaultButton","open","libraryButton","uploadMediaLibraryButton","gallery","mode","render","Fragment","FormFileUpload","openFileDialog","fallback","_default","exports","withFilters"],"sources":["@wordpress/block-editor/src/components/media-placeholder/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFormFileUpload,\n\tPlaceholder,\n\tDropZone,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\twithFilters,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { keyboardReturn } from '@wordpress/icons';\nimport { pasteHandler } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport MediaUpload from '../media-upload';\nimport MediaUploadCheck from '../media-upload/check';\nimport URLPopover from '../url-popover';\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\nconst InsertFromURLPopover = ( {\n\tsrc,\n\tonChange,\n\tonSubmit,\n\tonClose,\n\tpopoverAnchor,\n} ) => (\n\t<URLPopover anchor={ popoverAnchor } onClose={ onClose }>\n\t\t<form\n\t\t\tclassName=\"block-editor-media-placeholder__url-input-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t>\n\t\t\t<InputControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'URL' ) }\n\t\t\t\thideLabelFromVision\n\t\t\t\tplaceholder={ __( 'Paste or type URL' ) }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ src }\n\t\t\t\tsuffix={\n\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</form>\n\t</URLPopover>\n);\n\nconst URLSelectionUI = ( { src, onChangeSrc, onSelectURL } ) => {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst [ isURLInputVisible, setIsURLInputVisible ] = useState( false );\n\n\tconst openURLInput = () => {\n\t\tsetIsURLInputVisible( true );\n\t};\n\tconst closeURLInput = () => {\n\t\tsetIsURLInputVisible( false );\n\t\tpopoverAnchor?.focus();\n\t};\n\n\tconst onSubmitSrc = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( src && onSelectURL ) {\n\t\t\tonSelectURL( src );\n\t\t\tcloseURLInput();\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\tonClick={ openURLInput }\n\t\t\t\tisPressed={ isURLInputVisible }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t>\n\t\t\t\t{ __( 'Insert from URL' ) }\n\t\t\t</Button>\n\t\t\t{ isURLInputVisible && (\n\t\t\t\t<InsertFromURLPopover\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChange={ onChangeSrc }\n\t\t\t\t\tonSubmit={ onSubmitSrc }\n\t\t\t\t\tonClose={ closeURLInput }\n\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport function MediaPlaceholder( {\n\tvalue = {},\n\tallowedTypes,\n\tclassName,\n\ticon,\n\tlabels = {},\n\tmediaPreview,\n\tnotices,\n\tisAppender,\n\taccept,\n\taddToGallery,\n\tmultiple = false,\n\thandleUpload = true,\n\tdisableDropZone,\n\tdisableMediaButtons,\n\tonError,\n\tonSelect,\n\tonCancel,\n\tonSelectURL,\n\tonToggleFeaturedImage,\n\tonDoubleClick,\n\tonFilesPreUpload = noop,\n\tonHTMLDrop: deprecatedOnHTMLDrop,\n\tchildren,\n\tmediaLibraryButton,\n\tplaceholder,\n\tstyle,\n} ) {\n\tif ( deprecatedOnHTMLDrop ) {\n\t\tdeprecated( 'wp.blockEditor.MediaPlaceholder onHTMLDrop prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t} );\n\t}\n\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().mediaUpload;\n\t}, [] );\n\tconst [ src, setSrc ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tsetSrc( value?.src ?? '' );\n\t}, [ value?.src ] );\n\n\tconst onlyAllowsImages = () => {\n\t\tif ( ! allowedTypes || allowedTypes.length === 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn allowedTypes.every(\n\t\t\t( allowedType ) =>\n\t\t\t\tallowedType === 'image' || allowedType.startsWith( 'image/' )\n\t\t);\n\t};\n\n\tconst onFilesUpload = ( files ) => {\n\t\tif (\n\t\t\t! handleUpload ||\n\t\t\t( typeof handleUpload === 'function' && ! handleUpload( files ) )\n\t\t) {\n\t\t\treturn onSelect( files );\n\t\t}\n\t\tonFilesPreUpload( files );\n\t\tlet setMedia;\n\t\tif ( multiple ) {\n\t\t\tif ( addToGallery ) {\n\t\t\t\t// Since the setMedia function runs multiple times per upload group\n\t\t\t\t// and is passed newMedia containing every item in its group each time, we must\n\t\t\t\t// filter out whatever this upload group had previously returned to the\n\t\t\t\t// gallery before adding and returning the image array with replacement newMedia\n\t\t\t\t// values.\n\n\t\t\t\t// Define an array to store urls from newMedia between subsequent function calls.\n\t\t\t\tlet lastMediaPassed = [];\n\t\t\t\tsetMedia = ( newMedia ) => {\n\t\t\t\t\t// Remove any images this upload group is responsible for (lastMediaPassed).\n\t\t\t\t\t// Their replacements are contained in newMedia.\n\t\t\t\t\tconst filteredMedia = ( value ?? [] ).filter( ( item ) => {\n\t\t\t\t\t\t// If Item has id, only remove it if lastMediaPassed has an item with that id.\n\t\t\t\t\t\tif ( item.id ) {\n\t\t\t\t\t\t\treturn ! lastMediaPassed.some(\n\t\t\t\t\t\t\t\t// Be sure to convert to number for comparison.\n\t\t\t\t\t\t\t\t( { id } ) => Number( id ) === Number( item.id )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compare transient images via .includes since gallery may append extra info onto the url.\n\t\t\t\t\t\treturn ! lastMediaPassed.some( ( { urlSlug } ) =>\n\t\t\t\t\t\t\titem.url.includes( urlSlug )\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t\t// Return the filtered media array along with newMedia.\n\t\t\t\t\tonSelect( filteredMedia.concat( newMedia ) );\n\t\t\t\t\t// Reset lastMediaPassed and set it with ids and urls from newMedia.\n\t\t\t\t\tlastMediaPassed = newMedia.map( ( media ) => {\n\t\t\t\t\t\t// Add everything up to '.fileType' to compare via .includes.\n\t\t\t\t\t\tconst cutOffIndex = media.url.lastIndexOf( '.' );\n\t\t\t\t\t\tconst urlSlug = media.url.slice( 0, cutOffIndex );\n\t\t\t\t\t\treturn { id: media.id, urlSlug };\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tsetMedia = onSelect;\n\t\t\t}\n\t\t} else {\n\t\t\tsetMedia = ( [ media ] ) => onSelect( media );\n\t\t}\n\t\tmediaUpload( {\n\t\t\tallowedTypes,\n\t\t\tfilesList: files,\n\t\t\tonFileChange: setMedia,\n\t\t\tonError,\n\t\t} );\n\t};\n\n\tasync function handleBlocksDrop( blocks ) {\n\t\tif ( ! blocks || ! Array.isArray( blocks ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction recursivelyFindMediaFromBlocks( _blocks ) {\n\t\t\treturn _blocks.flatMap( ( block ) =>\n\t\t\t\t( block.name === 'core/image' ||\n\t\t\t\t\tblock.name === 'core/audio' ||\n\t\t\t\t\tblock.name === 'core/video' ) &&\n\t\t\t\t( block.attributes.url || block.attributes.src )\n\t\t\t\t\t? [ block ]\n\t\t\t\t\t: recursivelyFindMediaFromBlocks( block.innerBlocks )\n\t\t\t);\n\t\t}\n\n\t\tconst mediaBlocks = recursivelyFindMediaFromBlocks( blocks );\n\n\t\tif ( ! mediaBlocks.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst uploadedMediaList = await Promise.all(\n\t\t\tmediaBlocks.map( ( block ) => {\n\t\t\t\tconst blockType = block.name.split( '/' )[ 1 ];\n\t\t\t\tif ( block.attributes.id ) {\n\t\t\t\t\tblock.attributes.type = blockType;\n\t\t\t\t\treturn block.attributes;\n\t\t\t\t}\n\t\t\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\t\t\twindow\n\t\t\t\t\t\t.fetch( block.attributes.url )\n\t\t\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t\t\t.then( ( blob ) =>\n\t\t\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\t\t\tadditionalData: {\n\t\t\t\t\t\t\t\t\ttitle: block.attributes.title,\n\t\t\t\t\t\t\t\t\talt_text: block.attributes.alt,\n\t\t\t\t\t\t\t\t\tcaption: block.attributes.caption,\n\t\t\t\t\t\t\t\t\ttype: blockType,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\t\t\t\t\t\tif ( media.id ) {\n\t\t\t\t\t\t\t\t\t\tresolve( media );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tallowedTypes,\n\t\t\t\t\t\t\t\tonError: reject,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.catch( () => resolve( block.attributes.url ) );\n\t\t\t\t} );\n\t\t\t} )\n\t\t).catch( ( err ) => onError( err ) );\n\n\t\tif ( multiple ) {\n\t\t\tonSelect( uploadedMediaList );\n\t\t} else {\n\t\t\tonSelect( uploadedMediaList[ 0 ] );\n\t\t}\n\t}\n\n\tasync function onDrop( event ) {\n\t\tconst blocks = pasteHandler( {\n\t\t\tHTML: event.dataTransfer?.getData( 'default' ),\n\t\t} );\n\t\treturn await handleBlocksDrop( blocks );\n\t}\n\n\tconst onUpload = ( event ) => {\n\t\tonFilesUpload( event.target.files );\n\t};\n\n\tconst defaultRenderPlaceholder = ( content ) => {\n\t\tlet { instructions, title } = labels;\n\n\t\tif ( ! mediaUpload && ! onSelectURL ) {\n\t\t\tinstructions = __(\n\t\t\t\t'To edit this block, you need permission to upload media.'\n\t\t\t);\n\t\t}\n\n\t\tif ( instructions === undefined || title === undefined ) {\n\t\t\tconst typesAllowed = allowedTypes ?? [];\n\n\t\t\tconst [ firstAllowedType ] = typesAllowed;\n\t\t\tconst isOneType = 1 === typesAllowed.length;\n\t\t\tconst isAudio = isOneType && 'audio' === firstAllowedType;\n\t\t\tconst isImage = isOneType && 'image' === firstAllowedType;\n\t\t\tconst isVideo = isOneType && 'video' === firstAllowedType;\n\n\t\t\tif ( instructions === undefined && mediaUpload ) {\n\t\t\t\tinstructions = __(\n\t\t\t\t\t'Drag and drop an image or video, upload, or choose from your library.'\n\t\t\t\t);\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop an audio file, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop an image, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop a video, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( title === undefined ) {\n\t\t\t\ttitle = __( 'Media' );\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\ttitle = __( 'Audio' );\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\ttitle = __( 'Image' );\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\ttitle = __( 'Video' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst placeholderClassName = clsx(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName,\n\t\t\t{\n\t\t\t\t'is-appender': isAppender,\n\t\t\t}\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ title }\n\t\t\t\tinstructions={ instructions }\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tnotices={ notices }\n\t\t\t\tonDoubleClick={ onDoubleClick }\n\t\t\t\tpreview={ mediaPreview }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t\t{ children }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\tconst renderPlaceholder = placeholder ?? defaultRenderPlaceholder;\n\n\tconst renderDropZone = () => {\n\t\tif ( disableDropZone ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn <DropZone onFilesDrop={ onFilesUpload } onDrop={ onDrop } />;\n\t};\n\n\tconst renderCancelLink = () => {\n\t\treturn (\n\t\t\tonCancel && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"block-editor-media-placeholder__cancel-button\"\n\t\t\t\t\ttitle={ __( 'Cancel' ) }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderUrlSelectionUI = () => {\n\t\treturn (\n\t\t\tonSelectURL && (\n\t\t\t\t<URLSelectionUI\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChangeSrc={ setSrc }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t/>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderFeaturedImageToggle = () => {\n\t\treturn (\n\t\t\tonToggleFeaturedImage && (\n\t\t\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\t\t\tonClick={ onToggleFeaturedImage }\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Use featured image' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderMediaUploadChecked = () => {\n\t\tconst defaultButton = ( { open } ) => {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\topen();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Media Library' ) }\n\t\t\t\t</Button>\n\t\t\t);\n\t\t};\n\t\tconst libraryButton = mediaLibraryButton ?? defaultButton;\n\t\tconst uploadMediaLibraryButton = (\n\t\t\t<MediaUpload\n\t\t\t\taddToGallery={ addToGallery }\n\t\t\t\tgallery={ multiple && onlyAllowsImages() }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tmode=\"browse\"\n\t\t\t\tvalue={\n\t\t\t\t\tArray.isArray( value )\n\t\t\t\t\t\t? value.map( ( { id } ) => id )\n\t\t\t\t\t\t: value.id\n\t\t\t\t}\n\t\t\t\trender={ libraryButton }\n\t\t\t/>\n\t\t);\n\n\t\tif ( mediaUpload && isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ !! multiple }\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => {\n\t\t\t\t\t\t\tconst content = (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn renderPlaceholder( content );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\tif ( mediaUpload ) {\n\t\t\tconst content = (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ !! multiple }\n\t\t\t\t\t/>\n\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t</>\n\t\t\t);\n\t\t\treturn renderPlaceholder( content );\n\t\t}\n\n\t\treturn renderPlaceholder( uploadMediaLibraryButton );\n\t};\n\n\tif ( disableMediaButtons ) {\n\t\treturn <MediaUploadCheck>{ renderDropZone() }</MediaUploadCheck>;\n\t}\n\n\treturn (\n\t\t<MediaUploadCheck\n\t\t\tfallback={ renderPlaceholder( renderUrlSelectionUI() ) }\n\t\t>\n\t\t\t{ renderMediaUploadChecked() }\n\t\t</MediaUploadCheck>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md\n */\nexport default withFilters( 'editor.MediaPlaceholder' )( MediaPlaceholder );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AAKA,IAAAQ,YAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,MAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,WAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW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AEW,wBAAyB,CAAC;EACrD,CAAC;EAED,IAAKhH,mBAAmB,EAAG;IAC1B,oBAAO,IAAAxD,WAAA,CAAAQ,GAAA,EAACX,MAAA,CAAAY,OAAgB;MAAAE,QAAA,EAAGmJ,cAAc,CAAC;IAAC,CAAoB,CAAC;EACjE;EAEA,oBACC,IAAA9J,WAAA,CAAAQ,GAAA,EAACX,MAAA,CAAAY,OAAgB;IAChBsK,QAAQ,EAAGlB,iBAAiB,CAAEK,oBAAoB,CAAC,CAAE,CAAG;IAAAvJ,QAAA,EAEtDyJ,wBAAwB,CAAC;EAAC,CACX,CAAC;AAErB;;AAEA;AACA;AACA;AAFA,IAAAY,QAAA,GAAAC,OAAA,CAAAxK,OAAA,GAGe,IAAAyK,uBAAW,EAAE,yBAA0B,CAAC,CAAErI,gBAAiB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_element","_data","_icons","_deprecated","_mediaUpload","_check","_urlPopover","_store","_useOnBlockDrop","_jsxRuntime","noop","InsertFromURLPopover","src","onChange","onSubmit","onClose","popoverAnchor","jsx","default","anchor","children","className","__experimentalInputControl","__next40pxDefaultSize","label","__","hideLabelFromVision","placeholder","value","suffix","__experimentalInputControlSuffixWrapper","variant","Button","size","icon","keyboardReturn","type","URLSelectionUI","onChangeSrc","onSelectURL","setPopoverAnchor","useState","isURLInputVisible","setIsURLInputVisible","openURLInput","closeURLInput","focus","onSubmitSrc","event","preventDefault","jsxs","onClick","isPressed","ref","MediaPlaceholder","allowedTypes","labels","mediaPreview","notices","isAppender","accept","addToGallery","multiple","handleUpload","disableDropZone","disableMediaButtons","onError","onSelect","onCancel","onToggleFeaturedImage","onDoubleClick","onFilesPreUpload","onHTMLDrop","deprecatedOnHTMLDrop","mediaLibraryButton","style","deprecated","since","version","mediaUpload","useSelect","select","getSettings","blockEditorStore","setSrc","useEffect","_value$src","onlyAllowsImages","length","every","allowedType","startsWith","onFilesUpload","files","setMedia","lastMediaPassed","newMedia","filteredMedia","filter","item","id","some","Number","urlSlug","url","includes","concat","map","media","cutOffIndex","lastIndexOf","slice","filesList","onFileChange","handleBlocksDrop","blocks","parseDropEvent","uploadedMediaList","Promise","all","block","blockType","name","split","attributes","resolve","reject","window","fetch","then","response","blob","additionalData","title","alt_text","alt","caption","catch","err","onUpload","target","defaultRenderPlaceholder","content","instructions","undefined","typesAllowed","firstAllowedType","isOneType","isAudio","isImage","isVideo","placeholderClassName","clsx","Placeholder","preview","renderPlaceholder","renderDropZone","DropZone","onFilesDrop","onDrop","isEligible","dataTransfer","prefix","types","push","renderCancelLink","renderUrlSelectionUI","renderFeaturedImageToggle","renderMediaUploadChecked","defaultButton","open","libraryButton","uploadMediaLibraryButton","gallery","mode","Array","isArray","render","Fragment","FormFileUpload","openFileDialog","fallback","_default","exports","withFilters"],"sources":["@wordpress/block-editor/src/components/media-placeholder/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFormFileUpload,\n\tPlaceholder,\n\tDropZone,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\twithFilters,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { keyboardReturn } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport MediaUpload from '../media-upload';\nimport MediaUploadCheck from '../media-upload/check';\nimport URLPopover from '../url-popover';\nimport { store as blockEditorStore } from '../../store';\nimport { parseDropEvent } from '../use-on-block-drop';\n\nconst noop = () => {};\n\nconst InsertFromURLPopover = ( {\n\tsrc,\n\tonChange,\n\tonSubmit,\n\tonClose,\n\tpopoverAnchor,\n} ) => (\n\t<URLPopover anchor={ popoverAnchor } onClose={ onClose }>\n\t\t<form\n\t\t\tclassName=\"block-editor-media-placeholder__url-input-form\"\n\t\t\tonSubmit={ onSubmit }\n\t\t>\n\t\t\t<InputControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'URL' ) }\n\t\t\t\thideLabelFromVision\n\t\t\t\tplaceholder={ __( 'Paste or type URL' ) }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ src }\n\t\t\t\tsuffix={\n\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</form>\n\t</URLPopover>\n);\n\nconst URLSelectionUI = ( { src, onChangeSrc, onSelectURL } ) => {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst [ isURLInputVisible, setIsURLInputVisible ] = useState( false );\n\n\tconst openURLInput = () => {\n\t\tsetIsURLInputVisible( true );\n\t};\n\tconst closeURLInput = () => {\n\t\tsetIsURLInputVisible( false );\n\t\tpopoverAnchor?.focus();\n\t};\n\n\tconst onSubmitSrc = ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( src && onSelectURL ) {\n\t\t\tonSelectURL( src );\n\t\t\tcloseURLInput();\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\tonClick={ openURLInput }\n\t\t\t\tisPressed={ isURLInputVisible }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t>\n\t\t\t\t{ __( 'Insert from URL' ) }\n\t\t\t</Button>\n\t\t\t{ isURLInputVisible && (\n\t\t\t\t<InsertFromURLPopover\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChange={ onChangeSrc }\n\t\t\t\t\tonSubmit={ onSubmitSrc }\n\t\t\t\t\tonClose={ closeURLInput }\n\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport function MediaPlaceholder( {\n\tvalue = {},\n\tallowedTypes,\n\tclassName,\n\ticon,\n\tlabels = {},\n\tmediaPreview,\n\tnotices,\n\tisAppender,\n\taccept,\n\taddToGallery,\n\tmultiple = false,\n\thandleUpload = true,\n\tdisableDropZone,\n\tdisableMediaButtons,\n\tonError,\n\tonSelect,\n\tonCancel,\n\tonSelectURL,\n\tonToggleFeaturedImage,\n\tonDoubleClick,\n\tonFilesPreUpload = noop,\n\tonHTMLDrop: deprecatedOnHTMLDrop,\n\tchildren,\n\tmediaLibraryButton,\n\tplaceholder,\n\tstyle,\n} ) {\n\tif ( deprecatedOnHTMLDrop ) {\n\t\tdeprecated( 'wp.blockEditor.MediaPlaceholder onHTMLDrop prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t} );\n\t}\n\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().mediaUpload;\n\t}, [] );\n\tconst [ src, setSrc ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tsetSrc( value?.src ?? '' );\n\t}, [ value?.src ] );\n\n\tconst onlyAllowsImages = () => {\n\t\tif ( ! allowedTypes || allowedTypes.length === 0 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn allowedTypes.every(\n\t\t\t( allowedType ) =>\n\t\t\t\tallowedType === 'image' || allowedType.startsWith( 'image/' )\n\t\t);\n\t};\n\n\tconst onFilesUpload = ( files ) => {\n\t\tif (\n\t\t\t! handleUpload ||\n\t\t\t( typeof handleUpload === 'function' && ! handleUpload( files ) )\n\t\t) {\n\t\t\treturn onSelect( files );\n\t\t}\n\t\tonFilesPreUpload( files );\n\t\tlet setMedia;\n\t\tif ( multiple ) {\n\t\t\tif ( addToGallery ) {\n\t\t\t\t// Since the setMedia function runs multiple times per upload group\n\t\t\t\t// and is passed newMedia containing every item in its group each time, we must\n\t\t\t\t// filter out whatever this upload group had previously returned to the\n\t\t\t\t// gallery before adding and returning the image array with replacement newMedia\n\t\t\t\t// values.\n\n\t\t\t\t// Define an array to store urls from newMedia between subsequent function calls.\n\t\t\t\tlet lastMediaPassed = [];\n\t\t\t\tsetMedia = ( newMedia ) => {\n\t\t\t\t\t// Remove any images this upload group is responsible for (lastMediaPassed).\n\t\t\t\t\t// Their replacements are contained in newMedia.\n\t\t\t\t\tconst filteredMedia = ( value ?? [] ).filter( ( item ) => {\n\t\t\t\t\t\t// If Item has id, only remove it if lastMediaPassed has an item with that id.\n\t\t\t\t\t\tif ( item.id ) {\n\t\t\t\t\t\t\treturn ! lastMediaPassed.some(\n\t\t\t\t\t\t\t\t// Be sure to convert to number for comparison.\n\t\t\t\t\t\t\t\t( { id } ) => Number( id ) === Number( item.id )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compare transient images via .includes since gallery may append extra info onto the url.\n\t\t\t\t\t\treturn ! lastMediaPassed.some( ( { urlSlug } ) =>\n\t\t\t\t\t\t\titem.url.includes( urlSlug )\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t\t// Return the filtered media array along with newMedia.\n\t\t\t\t\tonSelect( filteredMedia.concat( newMedia ) );\n\t\t\t\t\t// Reset lastMediaPassed and set it with ids and urls from newMedia.\n\t\t\t\t\tlastMediaPassed = newMedia.map( ( media ) => {\n\t\t\t\t\t\t// Add everything up to '.fileType' to compare via .includes.\n\t\t\t\t\t\tconst cutOffIndex = media.url.lastIndexOf( '.' );\n\t\t\t\t\t\tconst urlSlug = media.url.slice( 0, cutOffIndex );\n\t\t\t\t\t\treturn { id: media.id, urlSlug };\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tsetMedia = onSelect;\n\t\t\t}\n\t\t} else {\n\t\t\tsetMedia = ( [ media ] ) => onSelect( media );\n\t\t}\n\t\tmediaUpload( {\n\t\t\tallowedTypes,\n\t\t\tfilesList: files,\n\t\t\tonFileChange: setMedia,\n\t\t\tonError,\n\t\t} );\n\t};\n\n\tasync function handleBlocksDrop( event ) {\n\t\tconst { blocks } = parseDropEvent( event );\n\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst uploadedMediaList = await Promise.all(\n\t\t\tblocks.map( ( block ) => {\n\t\t\t\tconst blockType = block.name.split( '/' )[ 1 ];\n\t\t\t\tif ( block.attributes.id ) {\n\t\t\t\t\tblock.attributes.type = blockType;\n\t\t\t\t\treturn block.attributes;\n\t\t\t\t}\n\t\t\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\t\t\twindow\n\t\t\t\t\t\t.fetch( block.attributes.url )\n\t\t\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t\t\t.then( ( blob ) =>\n\t\t\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\t\t\tadditionalData: {\n\t\t\t\t\t\t\t\t\ttitle: block.attributes.title,\n\t\t\t\t\t\t\t\t\talt_text: block.attributes.alt,\n\t\t\t\t\t\t\t\t\tcaption: block.attributes.caption,\n\t\t\t\t\t\t\t\t\ttype: blockType,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\t\t\t\t\t\tif ( media.id ) {\n\t\t\t\t\t\t\t\t\t\tresolve( media );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tallowedTypes,\n\t\t\t\t\t\t\t\tonError: reject,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.catch( () => resolve( block.attributes.url ) );\n\t\t\t\t} );\n\t\t\t} )\n\t\t).catch( ( err ) => onError( err ) );\n\n\t\tif ( multiple ) {\n\t\t\tonSelect( uploadedMediaList );\n\t\t} else {\n\t\t\tonSelect( uploadedMediaList[ 0 ] );\n\t\t}\n\t}\n\n\tconst onUpload = ( event ) => {\n\t\tonFilesUpload( event.target.files );\n\t};\n\n\tconst defaultRenderPlaceholder = ( content ) => {\n\t\tlet { instructions, title } = labels;\n\n\t\tif ( ! mediaUpload && ! onSelectURL ) {\n\t\t\tinstructions = __(\n\t\t\t\t'To edit this block, you need permission to upload media.'\n\t\t\t);\n\t\t}\n\n\t\tif ( instructions === undefined || title === undefined ) {\n\t\t\tconst typesAllowed = allowedTypes ?? [];\n\n\t\t\tconst [ firstAllowedType ] = typesAllowed;\n\t\t\tconst isOneType = 1 === typesAllowed.length;\n\t\t\tconst isAudio = isOneType && 'audio' === firstAllowedType;\n\t\t\tconst isImage = isOneType && 'image' === firstAllowedType;\n\t\t\tconst isVideo = isOneType && 'video' === firstAllowedType;\n\n\t\t\tif ( instructions === undefined && mediaUpload ) {\n\t\t\t\tinstructions = __(\n\t\t\t\t\t'Drag and drop an image or video, upload, or choose from your library.'\n\t\t\t\t);\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop an audio file, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop an image, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\tinstructions = __(\n\t\t\t\t\t\t'Drag and drop a video, upload, or choose from your library.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( title === undefined ) {\n\t\t\t\ttitle = __( 'Media' );\n\n\t\t\t\tif ( isAudio ) {\n\t\t\t\t\ttitle = __( 'Audio' );\n\t\t\t\t} else if ( isImage ) {\n\t\t\t\t\ttitle = __( 'Image' );\n\t\t\t\t} else if ( isVideo ) {\n\t\t\t\t\ttitle = __( 'Video' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst placeholderClassName = clsx(\n\t\t\t'block-editor-media-placeholder',\n\t\t\tclassName,\n\t\t\t{\n\t\t\t\t'is-appender': isAppender,\n\t\t\t}\n\t\t);\n\n\t\treturn (\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ title }\n\t\t\t\tinstructions={ instructions }\n\t\t\t\tclassName={ placeholderClassName }\n\t\t\t\tnotices={ notices }\n\t\t\t\tonDoubleClick={ onDoubleClick }\n\t\t\t\tpreview={ mediaPreview }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t{ content }\n\t\t\t\t{ children }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\tconst renderPlaceholder = placeholder ?? defaultRenderPlaceholder;\n\n\tconst renderDropZone = () => {\n\t\tif ( disableDropZone ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<DropZone\n\t\t\t\tonFilesDrop={ onFilesUpload }\n\t\t\t\tonDrop={ handleBlocksDrop }\n\t\t\t\tisEligible={ ( dataTransfer ) => {\n\t\t\t\t\tconst prefix = 'wp-block:core/';\n\t\t\t\t\tconst types = [];\n\t\t\t\t\tfor ( const type of dataTransfer.types ) {\n\t\t\t\t\t\tif ( type.startsWith( prefix ) ) {\n\t\t\t\t\t\t\ttypes.push( type.slice( prefix.length ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\ttypes.every( ( type ) =>\n\t\t\t\t\t\t\tallowedTypes.includes( type )\n\t\t\t\t\t\t) && ( multiple ? true : types.length === 1 )\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderCancelLink = () => {\n\t\treturn (\n\t\t\tonCancel && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"block-editor-media-placeholder__cancel-button\"\n\t\t\t\t\ttitle={ __( 'Cancel' ) }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderUrlSelectionUI = () => {\n\t\treturn (\n\t\t\tonSelectURL && (\n\t\t\t\t<URLSelectionUI\n\t\t\t\t\tsrc={ src }\n\t\t\t\t\tonChangeSrc={ setSrc }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t/>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderFeaturedImageToggle = () => {\n\t\treturn (\n\t\t\tonToggleFeaturedImage && (\n\t\t\t\t<div className=\"block-editor-media-placeholder__url-input-container\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tclassName=\"block-editor-media-placeholder__button\"\n\t\t\t\t\t\tonClick={ onToggleFeaturedImage }\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Use featured image' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)\n\t\t);\n\t};\n\n\tconst renderMediaUploadChecked = () => {\n\t\tconst defaultButton = ( { open } ) => {\n\t\t\treturn (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\topen();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Media Library' ) }\n\t\t\t\t</Button>\n\t\t\t);\n\t\t};\n\t\tconst libraryButton = mediaLibraryButton ?? defaultButton;\n\t\tconst uploadMediaLibraryButton = (\n\t\t\t<MediaUpload\n\t\t\t\taddToGallery={ addToGallery }\n\t\t\t\tgallery={ multiple && onlyAllowsImages() }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tallowedTypes={ allowedTypes }\n\t\t\t\tmode=\"browse\"\n\t\t\t\tvalue={\n\t\t\t\t\tArray.isArray( value )\n\t\t\t\t\t\t? value.map( ( { id } ) => id )\n\t\t\t\t\t\t: value.id\n\t\t\t\t}\n\t\t\t\trender={ libraryButton }\n\t\t\t/>\n\t\t);\n\n\t\tif ( mediaUpload && isAppender ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ !! multiple }\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => {\n\t\t\t\t\t\t\tconst content = (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn renderPlaceholder( content );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\tif ( mediaUpload ) {\n\t\t\tconst content = (\n\t\t\t\t<>\n\t\t\t\t\t{ renderDropZone() }\n\t\t\t\t\t<FormFileUpload\n\t\t\t\t\t\trender={ ( { openFileDialog } ) => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tonClick={ openFileDialog }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__button',\n\t\t\t\t\t\t\t\t\t'block-editor-media-placeholder__upload-button'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ onUpload }\n\t\t\t\t\t\taccept={ accept }\n\t\t\t\t\t\tmultiple={ !! multiple }\n\t\t\t\t\t/>\n\t\t\t\t\t{ uploadMediaLibraryButton }\n\t\t\t\t\t{ renderUrlSelectionUI() }\n\t\t\t\t\t{ renderFeaturedImageToggle() }\n\t\t\t\t\t{ renderCancelLink() }\n\t\t\t\t</>\n\t\t\t);\n\t\t\treturn renderPlaceholder( content );\n\t\t}\n\n\t\treturn renderPlaceholder( uploadMediaLibraryButton );\n\t};\n\n\tif ( disableMediaButtons ) {\n\t\treturn <MediaUploadCheck>{ renderDropZone() }</MediaUploadCheck>;\n\t}\n\n\treturn (\n\t\t<MediaUploadCheck\n\t\t\tfallback={ renderPlaceholder( renderUrlSelectionUI() ) }\n\t\t>\n\t\t\t{ renderMediaUploadChecked() }\n\t\t</MediaUploadCheck>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/media-placeholder/README.md\n */\nexport default withFilters( 'editor.MediaPlaceholder' )( MediaPlaceholder );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAP,sBAAA,CAAAC,OAAA;AAKA,IAAAO,YAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,MAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,eAAA,GAAAX,OAAA;AAAsD,IAAAY,WAAA,GAAAZ,OAAA;AA9BtD;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;;AAOA,MAAMa,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,MAAMC,oBAAoB,GAAGA,CAAE;EAC9BC,GAAG;EACHC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC;AACD,CAAC,kBACA,IAAAP,WAAA,CAAAQ,GAAA,EAACX,WAAA,CAAAY,OAAU;EAACC,MAAM,EAAGH,aAAe;EAACD,OAAO,EAAGA,OAAS;EAAAK,QAAA,eACvD,IAAAX,WAAA,CAAAQ,GAAA;IACCI,SAAS,EAAC,gDAAgD;IAC1DP,QAAQ,EAAGA,QAAU;IAAAM,QAAA,eAErB,IAAAX,WAAA,CAAAQ,GAAA,EAACnB,WAAA,CAAAwB,0BAAY;MACZC,qBAAqB;MACrBC,KAAK,EAAG,IAAAC,QAAE,EAAE,KAAM,CAAG;MACrBC,mBAAmB;MACnBC,WAAW,EAAG,IAAAF,QAAE,EAAE,mBAAoB,CAAG;MACzCZ,QAAQ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,EAED,IAAAK,QAAE,EAAE,QAAS;UAAC,CACT,CACN;UACHZ,QAAQ,EAAG8H,QAAU;UACrB/E,MAAM,EAAGA,MAAQ;UACjBE,QAAQ,EAAG,CAAC,CAAEA;QAAU,CACxB,CAAC,EACA8G,wBAAwB,EACxBN,oBAAoB,CAAC,CAAC,EACtBC,yBAAyB,CAAC,CAAC,EAC3BF,gBAAgB,CAAC,CAAC;MAAA,CACnB,CACF;MACD,OAAOV,iBAAiB,CAAEb,OAAQ,CAAC;IACpC;IAEA,OAAOa,iBAAiB,CAAEiB,wBAAyB,CAAC;EACrD,CAAC;EAED,IAAK3G,mBAAmB,EAAG;IAC1B,oBAAO,IAAAxD,WAAA,CAAAQ,GAAA,EAACZ,MAAA,CAAAa,OAAgB;MAAAE,QAAA,EAAGwI,cAAc,CAAC;IAAC,CAAoB,CAAC;EACjE;EAEA,oBACC,IAAAnJ,WAAA,CAAAQ,GAAA,EAACZ,MAAA,CAAAa,OAAgB;IAChBmK,QAAQ,EAAG1B,iBAAiB,CAAEW,oBAAoB,CAAC,CAAE,CAAG;IAAAlJ,QAAA,EAEtDoJ,wBAAwB,CAAC;EAAC,CACX,CAAC;AAErB;;AAEA;AACA;AACA;AAFA,IAAAc,QAAA,GAAAC,OAAA,CAAArK,OAAA,GAGe,IAAAsK,uBAAW,EAAE,yBAA0B,CAAC,CAAElI,gBAAiB,CAAC","ignoreList":[]}
|
|
@@ -7,9 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = MultiSelectionInspector;
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
|
-
var _blocks = require("@wordpress/blocks");
|
|
11
|
-
var _wordcount = require("@wordpress/wordcount");
|
|
12
10
|
var _icons = require("@wordpress/icons");
|
|
11
|
+
var _components = require("@wordpress/components");
|
|
13
12
|
var _blockIcon = _interopRequireDefault(require("../block-icon"));
|
|
14
13
|
var _store = require("../../store");
|
|
15
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -22,33 +21,18 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
21
|
*/
|
|
23
22
|
|
|
24
23
|
function MultiSelectionInspector() {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
getMultiSelectedBlocks
|
|
30
|
-
} = select(_store.store);
|
|
31
|
-
return {
|
|
32
|
-
blocks: getMultiSelectedBlocks()
|
|
33
|
-
};
|
|
34
|
-
}, []);
|
|
35
|
-
const words = (0, _wordcount.count)((0, _blocks.serialize)(blocks), 'words');
|
|
36
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
24
|
+
const selectedBlockCount = (0, _data.useSelect)(select => select(_store.store).getSelectedBlockCount(), []);
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
26
|
+
justify: "flex-start",
|
|
27
|
+
spacing: 2,
|
|
37
28
|
className: "block-editor-multi-selection-inspector__card",
|
|
38
29
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockIcon.default, {
|
|
39
30
|
icon: _icons.copy,
|
|
40
31
|
showColors: true
|
|
41
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
42
|
-
className: "block-editor-multi-selection-inspector__card-
|
|
43
|
-
children:
|
|
44
|
-
|
|
45
|
-
children: (0, _i18n.sprintf)(/* translators: %d: number of blocks */
|
|
46
|
-
(0, _i18n._n)('%d Block', '%d Blocks', blocks.length), blocks.length)
|
|
47
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
48
|
-
className: "block-editor-multi-selection-inspector__card-description",
|
|
49
|
-
children: (0, _i18n.sprintf)(/* translators: %d: number of words */
|
|
50
|
-
(0, _i18n._n)('%d word selected.', '%d words selected.', words), words)
|
|
51
|
-
})]
|
|
32
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
33
|
+
className: "block-editor-multi-selection-inspector__card-title",
|
|
34
|
+
children: (0, _i18n.sprintf)(/* translators: %d: number of blocks */
|
|
35
|
+
(0, _i18n._n)('%d Block', '%d Blocks', selectedBlockCount), selectedBlockCount)
|
|
52
36
|
})]
|
|
53
37
|
});
|
|
54
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_data","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_icons","_components","_blockIcon","_interopRequireDefault","_store","_jsxRuntime","MultiSelectionInspector","selectedBlockCount","useSelect","select","blockEditorStore","getSelectedBlockCount","jsxs","__experimentalHStack","justify","spacing","className","children","jsx","default","icon","copy","showColors","sprintf","_n"],"sources":["@wordpress/block-editor/src/components/multi-selection-inspector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, _n } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { copy } from '@wordpress/icons';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function MultiSelectionInspector() {\n\tconst selectedBlockCount = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSelectedBlockCount(),\n\t\t[]\n\t);\n\treturn (\n\t\t<HStack\n\t\t\tjustify=\"flex-start\"\n\t\t\tspacing={ 2 }\n\t\t\tclassName=\"block-editor-multi-selection-inspector__card\"\n\t\t>\n\t\t\t<BlockIcon icon={ copy } showColors />\n\t\t\t<div className=\"block-editor-multi-selection-inspector__card-title\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: number of blocks */\n\t\t\t\t\t_n( '%d Block', '%d Blocks', selectedBlockCount ),\n\t\t\t\t\tselectedBlockCount\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</HStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAwD,IAAAO,WAAA,GAAAP,OAAA;AAZxD;AACA;AACA;;AAMA;AACA;AACA;;AAIe,SAASQ,uBAAuBA,CAAA,EAAG;EACjD,MAAMC,kBAAkB,GAAG,IAAAC,eAAS,EACjCC,MAAM,IAAMA,MAAM,CAAEC,YAAiB,CAAC,CAACC,qBAAqB,CAAC,CAAC,EAChE,EACD,CAAC;EACD,oBACC,IAAAN,WAAA,CAAAO,IAAA,EAACX,WAAA,CAAAY,oBAAM;IACNC,OAAO,EAAC,YAAY;IACpBC,OAAO,EAAG,CAAG;IACbC,SAAS,EAAC,8CAA8C;IAAAC,QAAA,gBAExD,IAAAZ,WAAA,CAAAa,GAAA,EAAChB,UAAA,CAAAiB,OAAS;MAACC,IAAI,EAAGC,WAAM;MAACC,UAAU;IAAA,CAAE,CAAC,eACtC,IAAAjB,WAAA,CAAAa,GAAA;MAAKF,SAAS,EAAC,oDAAoD;MAAAC,QAAA,EAChE,IAAAM,aAAO,EACR;MACA,IAAAC,QAAE,EAAE,UAAU,EAAE,WAAW,EAAEjB,kBAAmB,CAAC,EACjDA,kBACD;IAAC,CACG,CAAC;EAAA,CACC,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_data","_dom","_keycodes","_store","_jsxRuntime","KEY_DOWN_ELIGIBLE_KEY_CODES","Set","UP","RIGHT","DOWN","LEFT","ENTER","BACKSPACE","isKeyDownEligibleForStartTyping","event","keyCode","shiftKey","has","useMouseMoveTypingReset","isTyping","useSelect","select","blockEditorStore","stopTyping","useDispatch","useRefEffect","node","ownerDocument","lastClientX","lastClientY","stopTypingOnMouseMove","clientX","clientY","addEventListener","removeEventListener","useTypingObserver","_isTyping","startTyping","ref1","ref2","defaultView","selection","getSelection","timerId","stopTypingOnNonTextField","target","setTimeout","isTextField","stopTypingOnEscapeKey","ESCAPE","TAB","stopTypingOnSelectionUncollapse","isCollapsed","clearTimeout","startTypingInTextField","type","contains","useMergeRefs","ObserveTyping","children","jsx","ref","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/observe-typing/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport {\n\tUP,\n\tRIGHT,\n\tDOWN,\n\tLEFT,\n\tENTER,\n\tBACKSPACE,\n\tESCAPE,\n\tTAB,\n} from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Set of key codes upon which typing is to be initiated on a keydown event.\n *\n * @type {Set<number>}\n */\nconst KEY_DOWN_ELIGIBLE_KEY_CODES = new Set( [\n\tUP,\n\tRIGHT,\n\tDOWN,\n\tLEFT,\n\tENTER,\n\tBACKSPACE,\n] );\n\n/**\n * Returns true if a given keydown event can be inferred as intent to start\n * typing, or false otherwise. A keydown is considered eligible if it is a\n * text navigation without shift active.\n *\n * @param {KeyboardEvent} event Keydown event to test.\n *\n * @return {boolean} Whether event is eligible to start typing.\n */\nfunction isKeyDownEligibleForStartTyping( event ) {\n\tconst { keyCode, shiftKey } = event;\n\treturn ! shiftKey && KEY_DOWN_ELIGIBLE_KEY_CODES.has( keyCode );\n}\n\n/**\n * Removes the `isTyping` flag when the mouse moves in the document of the given\n * element.\n */\nexport function useMouseMoveTypingReset() {\n\tconst isTyping = useSelect(\n\t\t( select ) => select( blockEditorStore ).isTyping(),\n\t\t[]\n\t);\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( ! isTyping ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { ownerDocument } = node;\n\t\t\tlet lastClientX;\n\t\t\tlet lastClientY;\n\n\t\t\t/**\n\t\t\t * On mouse move, unset typing flag if user has moved cursor.\n\t\t\t *\n\t\t\t * @param {MouseEvent} event Mousemove event.\n\t\t\t */\n\t\t\tfunction stopTypingOnMouseMove( event ) {\n\t\t\t\tconst { clientX, clientY } = event;\n\n\t\t\t\t// We need to check that the mouse really moved because Safari\n\t\t\t\t// triggers mousemove events when shift or ctrl are pressed.\n\t\t\t\tif (\n\t\t\t\t\tlastClientX &&\n\t\t\t\t\tlastClientY &&\n\t\t\t\t\t( lastClientX !== clientX || lastClientY !== clientY )\n\t\t\t\t) {\n\t\t\t\t\tstopTyping();\n\t\t\t\t}\n\n\t\t\t\tlastClientX = clientX;\n\t\t\t\tlastClientY = clientY;\n\t\t\t}\n\n\t\t\townerDocument.addEventListener(\n\t\t\t\t'mousemove',\n\t\t\t\tstopTypingOnMouseMove\n\t\t\t);\n\n\t\t\treturn () => {\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'mousemove',\n\t\t\t\t\tstopTypingOnMouseMove\n\t\t\t\t);\n\t\t\t};\n\t\t},\n\t\t[ isTyping, stopTyping ]\n\t);\n}\n\n/**\n * Sets and removes the `isTyping` flag based on user actions:\n *\n * - Sets the flag if the user types within the given element.\n * - Removes the flag when the user selects some text, focusses a non-text\n * field, presses ESC or TAB, or moves the mouse in the document.\n */\nexport function useTypingObserver() {\n\tconst { isTyping } = useSelect( ( select ) => {\n\t\tconst { isTyping: _isTyping } = select( blockEditorStore );\n\t\treturn {\n\t\t\tisTyping: _isTyping(),\n\t\t};\n\t}, [] );\n\tconst { startTyping, stopTyping } = useDispatch( blockEditorStore );\n\n\tconst ref1 = useMouseMoveTypingReset();\n\tconst ref2 = useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t// Listeners to stop typing should only be added when typing.\n\t\t\t// Listeners to start typing should only be added when not typing.\n\t\t\tif ( isTyping ) {\n\t\t\t\tlet timerId;\n\n\t\t\t\t/**\n\t\t\t\t * Stops typing when focus transitions to a non-text field element.\n\t\t\t\t *\n\t\t\t\t * @param {FocusEvent} event Focus event.\n\t\t\t\t */\n\t\t\t\tfunction stopTypingOnNonTextField( event ) {\n\t\t\t\t\tconst { target } = event;\n\n\t\t\t\t\t// Since focus to a non-text field via arrow key will trigger\n\t\t\t\t\t// before the keydown event, wait until after current stack\n\t\t\t\t\t// before evaluating whether typing is to be stopped. Otherwise,\n\t\t\t\t\t// typing will re-start.\n\t\t\t\t\ttimerId = defaultView.setTimeout( () => {\n\t\t\t\t\t\tif ( ! isTextField( target ) ) {\n\t\t\t\t\t\t\tstopTyping();\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * Unsets typing flag if user presses Escape while typing flag is\n\t\t\t\t * active.\n\t\t\t\t *\n\t\t\t\t * @param {KeyboardEvent} event Keypress or keydown event to\n\t\t\t\t * interpret.\n\t\t\t\t */\n\t\t\t\tfunction stopTypingOnEscapeKey( event ) {\n\t\t\t\t\tconst { keyCode } = event;\n\n\t\t\t\t\tif ( keyCode === ESCAPE || keyCode === TAB ) {\n\t\t\t\t\t\tstopTyping();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * On selection change, unset typing flag if user has made an\n\t\t\t\t * uncollapsed (shift) selection.\n\t\t\t\t */\n\t\t\t\tfunction stopTypingOnSelectionUncollapse() {\n\t\t\t\t\tif ( ! selection.isCollapsed ) {\n\t\t\t\t\t\tstopTyping();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnode.addEventListener( 'focus', stopTypingOnNonTextField );\n\t\t\t\tnode.addEventListener( 'keydown', stopTypingOnEscapeKey );\n\n\t\t\t\townerDocument.addEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tstopTypingOnSelectionUncollapse\n\t\t\t\t);\n\n\t\t\t\treturn () => {\n\t\t\t\t\tdefaultView.clearTimeout( timerId );\n\t\t\t\t\tnode.removeEventListener(\n\t\t\t\t\t\t'focus',\n\t\t\t\t\t\tstopTypingOnNonTextField\n\t\t\t\t\t);\n\t\t\t\t\tnode.removeEventListener(\n\t\t\t\t\t\t'keydown',\n\t\t\t\t\t\tstopTypingOnEscapeKey\n\t\t\t\t\t);\n\t\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t\t'selectionchange',\n\t\t\t\t\t\tstopTypingOnSelectionUncollapse\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles a keypress or keydown event to infer intention to start\n\t\t\t * typing.\n\t\t\t *\n\t\t\t * @param {KeyboardEvent} event Keypress or keydown event to interpret.\n\t\t\t */\n\t\t\tfunction startTypingInTextField( event ) {\n\t\t\t\tconst { type, target } = event;\n\n\t\t\t\t// Abort early if already typing, or key press is incurred outside a\n\t\t\t\t// text field (e.g. arrow-ing through toolbar buttons).\n\t\t\t\t// Ignore typing if outside the current DOM container\n\t\t\t\tif ( ! isTextField( target ) || ! node.contains( target ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Special-case keydown because certain keys do not emit a keypress\n\t\t\t\t// event. Conversely avoid keydown as the canonical event since\n\t\t\t\t// there are many keydown which are explicitly not targeted for\n\t\t\t\t// typing.\n\t\t\t\tif (\n\t\t\t\t\ttype === 'keydown' &&\n\t\t\t\t\t! isKeyDownEligibleForStartTyping( event )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tstartTyping();\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'keypress', startTypingInTextField );\n\t\t\tnode.addEventListener( 'keydown', startTypingInTextField );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'keypress', startTypingInTextField );\n\t\t\t\tnode.removeEventListener( 'keydown', startTypingInTextField );\n\t\t\t};\n\t\t},\n\t\t[ isTyping, startTyping, stopTyping ]\n\t);\n\n\treturn useMergeRefs( [ ref1, ref2 ] );\n}\n\nfunction ObserveTyping( { children } ) {\n\treturn <div ref={ useTypingObserver() }>{ children }</div>;\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/observe-typing/README.md\n */\nexport default ObserveTyping;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAcA,IAAAI,MAAA,GAAAJ,OAAA;AAAwD,IAAAK,WAAA,GAAAL,OAAA;AApBxD;AACA;AACA;;AAeA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,GACA,MAAMM,2BAA2B,GAAG,IAAIC,GAAG,CAAE,CAC5CC,YAAE,EACFC,eAAK,EACLC,cAAI,EACJC,cAAI,EACJC,eAAK,EACLC,mBAAS,CACR,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CAAEC,KAAK,EAAG;EACjD,MAAM;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAGF,KAAK;EACnC,OAAO,CAAEE,QAAQ,IAAIX,2BAA2B,CAACY,GAAG,CAAEF,OAAQ,CAAC;AAChE;;AAEA;AACA;AACA;AACA;AACO,SAASG,uBAAuBA,CAAA,EAAG;EACzC,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EACvBC,MAAM,IAAMA,MAAM,CAAEC,YAAiB,CAAC,CAACH,QAAQ,CAAC,CAAC,EACnD,EACD,CAAC;EACD,MAAM;IAAEI;EAAW,CAAC,GAAG,IAAAC,iBAAW,EAAEF,YAAiB,CAAC;EAEtD,OAAO,IAAAG,qBAAY,EAChBC,IAAI,IAAM;IACX,IAAK,CAAEP,QAAQ,EAAG;MACjB;IACD;IAEA,MA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;IACG,SAASG,sBAAsBA,CAAExC,KAAK,EAAG;MACxC,MAAM;QAAEyC,IAAI;QAAEV;MAAO,CAAC,GAAG/B,KAAK;;MAE9B;MACA;MACA;MACA,IAAK,CAAE,IAAAiC,gBAAW,EAAEF,MAAO,CAAC,IAAI,CAAEnB,IAAI,CAAC8B,QAAQ,CAAEX,MAAO,CAAC,EAAG;QAC3D;MACD;;MAEA;MACA;MACA;MACA;MACA,IACCU,IAAI,KAAK,SAAS,IAClB,CAAE1C,+BAA+B,CAAEC,KAAM,CAAC,EACzC;QACD;MACD;MAEAuB,WAAW,CAAC,CAAC;IACd;IAEAX,IAAI,CAACO,gBAAgB,CAAE,UAAU,EAAEqB,sBAAuB,CAAC;IAC3D5B,IAAI,CAACO,gBAAgB,CAAE,SAAS,EAAEqB,sBAAuB,CAAC;IAE1D,OAAO,MAAM;MACZ5B,IAAI,CAACQ,mBAAmB,CAAE,UAAU,EAAEoB,sBAAuB,CAAC;MAC9D5B,IAAI,CAACQ,mBAAmB,CAAE,SAAS,EAAEoB,sBAAuB,CAAC;IAC9D,CAAC;EACF,CAAC,EACD,CAAEnC,QAAQ,EAAEkB,WAAW,EAAEd,UAAU,CACpC,CAAC;EAED,OAAO,IAAAkC,qBAAY,EAAE,CAAEnB,IAAI,EAAEC,IAAI,CAAG,CAAC;AACtC;AAEA,SAASmB,aAAaA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtC,oBAAO,IAAAvD,WAAA,CAAAwD,GAAA;IAAKC,GAAG,EAAG1B,iBAAiB,CAAC,CAAG;IAAAwB,QAAA,EAAGA;EAAQ,CAAO,CAAC;AAC3D;;AAEA;AACA;AACA;AAFA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGeN,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_compose","require","_data","_dom","_keycodes","_store","_jsxRuntime","KEY_DOWN_ELIGIBLE_KEY_CODES","Set","UP","RIGHT","DOWN","LEFT","ENTER","BACKSPACE","isKeyDownEligibleForStartTyping","event","keyCode","shiftKey","has","useMouseMoveTypingReset","isTyping","useSelect","select","blockEditorStore","stopTyping","useDispatch","useRefEffect","node","ownerDocument","lastClientX","lastClientY","stopTypingOnMouseMove","clientX","clientY","addEventListener","removeEventListener","useTypingObserver","_isTyping","startTyping","ref1","ref2","defaultView","selection","getSelection","timerId","stopTypingOnNonTextField","target","setTimeout","isTextField","stopTypingOnEscapeKey","ESCAPE","TAB","stopTypingOnSelectionUncollapse","isCollapsed","clearTimeout","startTypingInTextField","type","contains","useMergeRefs","ObserveTyping","children","jsx","ref","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/observe-typing/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport {\n\tUP,\n\tRIGHT,\n\tDOWN,\n\tLEFT,\n\tENTER,\n\tBACKSPACE,\n\tESCAPE,\n\tTAB,\n} from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Set of key codes upon which typing is to be initiated on a keydown event.\n *\n * @type {Set<number>}\n */\nconst KEY_DOWN_ELIGIBLE_KEY_CODES = new Set( [\n\tUP,\n\tRIGHT,\n\tDOWN,\n\tLEFT,\n\tENTER,\n\tBACKSPACE,\n] );\n\n/**\n * Returns true if a given keydown event can be inferred as intent to start\n * typing, or false otherwise. A keydown is considered eligible if it is a\n * text navigation without shift active.\n *\n * @param {KeyboardEvent} event Keydown event to test.\n *\n * @return {boolean} Whether event is eligible to start typing.\n */\nfunction isKeyDownEligibleForStartTyping( event ) {\n\tconst { keyCode, shiftKey } = event;\n\treturn ! shiftKey && KEY_DOWN_ELIGIBLE_KEY_CODES.has( keyCode );\n}\n\n/**\n * Removes the `isTyping` flag when the mouse moves in the document of the given\n * element.\n */\nexport function useMouseMoveTypingReset() {\n\tconst isTyping = useSelect(\n\t\t( select ) => select( blockEditorStore ).isTyping(),\n\t\t[]\n\t);\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( ! isTyping ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { ownerDocument } = node;\n\t\t\tlet lastClientX;\n\t\t\tlet lastClientY;\n\n\t\t\t/**\n\t\t\t * On mouse move, unset typing flag if user has moved cursor.\n\t\t\t *\n\t\t\t * @param {MouseEvent} event Mousemove event.\n\t\t\t */\n\t\t\tfunction stopTypingOnMouseMove( event ) {\n\t\t\t\tconst { clientX, clientY } = event;\n\n\t\t\t\t// We need to check that the mouse really moved because Safari\n\t\t\t\t// triggers mousemove events when shift or ctrl are pressed.\n\t\t\t\tif (\n\t\t\t\t\tlastClientX &&\n\t\t\t\t\tlastClientY &&\n\t\t\t\t\t( lastClientX !== clientX || lastClientY !== clientY )\n\t\t\t\t) {\n\t\t\t\t\tstopTyping();\n\t\t\t\t}\n\n\t\t\t\tlastClientX = clientX;\n\t\t\t\tlastClientY = clientY;\n\t\t\t}\n\n\t\t\townerDocument.addEventListener(\n\t\t\t\t'mousemove',\n\t\t\t\tstopTypingOnMouseMove\n\t\t\t);\n\n\t\t\treturn () => {\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'mousemove',\n\t\t\t\t\tstopTypingOnMouseMove\n\t\t\t\t);\n\t\t\t};\n\t\t},\n\t\t[ isTyping, stopTyping ]\n\t);\n}\n\n/**\n * Sets and removes the `isTyping` flag based on user actions:\n *\n * - Sets the flag if the user types within the given element.\n * - Removes the flag when the user selects some text, focusses a non-text\n * field, presses ESC or TAB, or moves the mouse in the document.\n */\nexport function useTypingObserver() {\n\tconst { isTyping } = useSelect( ( select ) => {\n\t\tconst { isTyping: _isTyping } = select( blockEditorStore );\n\t\treturn {\n\t\t\tisTyping: _isTyping(),\n\t\t};\n\t}, [] );\n\tconst { startTyping, stopTyping } = useDispatch( blockEditorStore );\n\n\tconst ref1 = useMouseMoveTypingReset();\n\tconst ref2 = useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t// Listeners to stop typing should only be added when typing.\n\t\t\t// Listeners to start typing should only be added when not typing.\n\t\t\tif ( isTyping ) {\n\t\t\t\tlet timerId;\n\n\t\t\t\t/**\n\t\t\t\t * Stops typing when focus transitions to a non-text field element.\n\t\t\t\t *\n\t\t\t\t * @param {FocusEvent} event Focus event.\n\t\t\t\t */\n\t\t\t\tfunction stopTypingOnNonTextField( event ) {\n\t\t\t\t\tconst { target } = event;\n\n\t\t\t\t\t// Since focus to a non-text field via arrow key will trigger\n\t\t\t\t\t// before the keydown event, wait until after current stack\n\t\t\t\t\t// before evaluating whether typing is to be stopped. Otherwise,\n\t\t\t\t\t// typing will re-start.\n\t\t\t\t\ttimerId = defaultView.setTimeout( () => {\n\t\t\t\t\t\tif ( ! isTextField( target ) ) {\n\t\t\t\t\t\t\tstopTyping();\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * Unsets typing flag if user presses Escape while typing flag is\n\t\t\t\t * active.\n\t\t\t\t *\n\t\t\t\t * @param {KeyboardEvent} event Keypress or keydown event to\n\t\t\t\t * interpret.\n\t\t\t\t */\n\t\t\t\tfunction stopTypingOnEscapeKey( event ) {\n\t\t\t\t\tconst { keyCode } = event;\n\n\t\t\t\t\tif ( keyCode === ESCAPE || keyCode === TAB ) {\n\t\t\t\t\t\tstopTyping();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * On selection change, unset typing flag if user has made an\n\t\t\t\t * uncollapsed (shift) selection.\n\t\t\t\t */\n\t\t\t\tfunction stopTypingOnSelectionUncollapse() {\n\t\t\t\t\tif ( ! selection.isCollapsed ) {\n\t\t\t\t\t\tstopTyping();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnode.addEventListener( 'focus', stopTypingOnNonTextField );\n\t\t\t\tnode.addEventListener( 'keydown', stopTypingOnEscapeKey );\n\n\t\t\t\townerDocument.addEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tstopTypingOnSelectionUncollapse\n\t\t\t\t);\n\n\t\t\t\treturn () => {\n\t\t\t\t\tdefaultView.clearTimeout( timerId );\n\t\t\t\t\tnode.removeEventListener(\n\t\t\t\t\t\t'focus',\n\t\t\t\t\t\tstopTypingOnNonTextField\n\t\t\t\t\t);\n\t\t\t\t\tnode.removeEventListener(\n\t\t\t\t\t\t'keydown',\n\t\t\t\t\t\tstopTypingOnEscapeKey\n\t\t\t\t\t);\n\t\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t\t'selectionchange',\n\t\t\t\t\t\tstopTypingOnSelectionUncollapse\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles a keypress or keydown event to infer intention to start\n\t\t\t * typing.\n\t\t\t *\n\t\t\t * @param {KeyboardEvent} event Keypress or keydown event to interpret.\n\t\t\t */\n\t\t\tfunction startTypingInTextField( event ) {\n\t\t\t\tconst { type, target } = event;\n\n\t\t\t\t// Abort early if already typing, or key press is incurred outside a\n\t\t\t\t// text field (e.g. arrow-ing through toolbar buttons).\n\t\t\t\t// Ignore typing if outside the current DOM container\n\t\t\t\tif ( ! isTextField( target ) || ! node.contains( target ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Special-case keydown because certain keys do not emit a keypress\n\t\t\t\t// event. Conversely avoid keydown as the canonical event since\n\t\t\t\t// there are many keydown which are explicitly not targeted for\n\t\t\t\t// typing.\n\t\t\t\tif (\n\t\t\t\t\ttype === 'keydown' &&\n\t\t\t\t\t! isKeyDownEligibleForStartTyping( event )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tstartTyping();\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'keypress', startTypingInTextField );\n\t\t\tnode.addEventListener( 'keydown', startTypingInTextField );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'keypress', startTypingInTextField );\n\t\t\t\tnode.removeEventListener( 'keydown', startTypingInTextField );\n\t\t\t};\n\t\t},\n\t\t[ isTyping, startTyping, stopTyping ]\n\t);\n\n\treturn useMergeRefs( [ ref1, ref2 ] );\n}\n\nfunction ObserveTyping( { children } ) {\n\treturn <div ref={ useTypingObserver() }>{ children }</div>;\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/observe-typing/README.md\n */\nexport default ObserveTyping;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAcA,IAAAI,MAAA,GAAAJ,OAAA;AAAwD,IAAAK,WAAA,GAAAL,OAAA;AApBxD;AACA;AACA;;AAeA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,GACA,MAAMM,2BAA2B,GAAG,IAAIC,GAAG,CAAE,CAC5CC,YAAE,EACFC,eAAK,EACLC,cAAI,EACJC,cAAI,EACJC,eAAK,EACLC,mBAAS,CACR,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CAAEC,KAAK,EAAG;EACjD,MAAM;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAGF,KAAK;EACnC,OAAO,CAAEE,QAAQ,IAAIX,2BAA2B,CAACY,GAAG,CAAEF,OAAQ,CAAC;AAChE;;AAEA;AACA;AACA;AACA;AACO,SAASG,uBAAuBA,CAAA,EAAG;EACzC,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EACvBC,MAAM,IAAMA,MAAM,CAAEC,YAAiB,CAAC,CAACH,QAAQ,CAAC,C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A,GAAAC,OAAA,CAAAC,OAAA,GAGeN,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_deprecated","_interopRequireDefault","_context","_jsxRuntime","RenderedRefsContext","createContext","addToBlockType","renderedBlocks","blockName","uniqueId","result","Set","add","RecursionProvider","children","previouslyRenderedBlocks","useContext","name","useBlockEditContext","newRenderedBlocks","useMemo","jsx","Provider","value","useHasRecursion","Boolean","has","DeprecatedExperimentalRecursionProvider","props","deprecated","since","alternative","exports","DeprecatedExperimentalUseHasRecursion","args"],"sources":["@wordpress/block-editor/src/components/recursion-provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit/context';\n\nconst RenderedRefsContext = createContext( {} );\n\n/**\n * Immutably adds an unique identifier to a set scoped for a given block type.\n *\n * @param {Object} renderedBlocks Rendered blocks grouped by block name\n * @param {string} blockName Name of the block.\n * @param {*} uniqueId Any value that acts as a unique identifier for a block instance.\n *\n * @return {Object} The list of rendered blocks grouped by block name.\n */\nfunction addToBlockType( renderedBlocks, blockName, uniqueId ) {\n\tconst result = {\n\t\t...renderedBlocks,\n\t\t[ blockName ]: renderedBlocks[ blockName ]\n\t\t\t? new Set( renderedBlocks[ blockName ] )\n\t\t\t: new Set(),\n\t};\n\tresult[ blockName ].add( uniqueId );\n\n\treturn result;\n}\n\n/**\n * A React context provider for use with the `useHasRecursion` hook to prevent recursive\n * renders.\n *\n * Wrap block content with this provider and provide the same `uniqueId` prop as used\n * with `useHasRecursion`.\n *\n * @param {Object} props\n * @param {*} props.uniqueId Any value that acts as a unique identifier for a block instance.\n * @param {string} props.blockName Optional block name.\n * @param {JSX.Element} props.children React children.\n *\n * @return {JSX.Element} A React element.\n */\nexport function RecursionProvider( { children, uniqueId, blockName = '' } ) {\n\tconst previouslyRenderedBlocks = useContext( RenderedRefsContext );\n\tconst { name } = useBlockEditContext();\n\n\tblockName = blockName || name;\n\n\tconst newRenderedBlocks = useMemo(\n\t\t() => addToBlockType( previouslyRenderedBlocks, blockName, uniqueId ),\n\t\t[ previouslyRenderedBlocks, blockName, uniqueId ]\n\t);\n\n\treturn (\n\t\t<RenderedRefsContext.Provider value={ newRenderedBlocks }>\n\t\t\t{ children }\n\t\t</RenderedRefsContext.Provider>\n\t);\n}\n\n/**\n * A React hook for keeping track of blocks previously rendered up in the block\n * tree. Blocks susceptible to recursion can use this hook in their `Edit`\n * function to prevent said recursion.\n *\n * Use this with the `RecursionProvider` component, using the same `uniqueId` value\n * for both the hook and the provider.\n *\n * @param {*} uniqueId Any value that acts as a unique identifier for a block instance.\n * @param {string} blockName Optional block name.\n *\n * @return {boolean} A boolean describing whether the provided id has already been rendered.\n */\nexport function useHasRecursion( uniqueId, blockName = '' ) {\n\tconst previouslyRenderedBlocks = useContext( RenderedRefsContext );\n\tconst { name } = useBlockEditContext();\n\tblockName = blockName || name;\n\treturn Boolean( previouslyRenderedBlocks[ blockName ]?.has( uniqueId ) );\n}\n\nexport const DeprecatedExperimentalRecursionProvider = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalRecursionProvider', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.RecursionProvider',\n\t} );\n\treturn <RecursionProvider { ...props } />;\n};\n\nexport const DeprecatedExperimentalUseHasRecursion = ( ...args ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalUseHasRecursion', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useHasRecursion',\n\t} );\n\treturn useHasRecursion( ...args );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_element","require","_deprecated","_interopRequireDefault","_context","_jsxRuntime","RenderedRefsContext","createContext","addToBlockType","renderedBlocks","blockName","uniqueId","result","Set","add","RecursionProvider","children","previouslyRenderedBlocks","useContext","name","useBlockEditContext","newRenderedBlocks","useMemo","jsx","Provider","value","useHasRecursion","Boolean","has","DeprecatedExperimentalRecursionProvider","props","deprecated","since","alternative","exports","DeprecatedExperimentalUseHasRecursion","args"],"sources":["@wordpress/block-editor/src/components/recursion-provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit/context';\n\nconst RenderedRefsContext = createContext( {} );\n\n/**\n * Immutably adds an unique identifier to a set scoped for a given block type.\n *\n * @param {Object} renderedBlocks Rendered blocks grouped by block name\n * @param {string} blockName Name of the block.\n * @param {*} uniqueId Any value that acts as a unique identifier for a block instance.\n *\n * @return {Object} The list of rendered blocks grouped by block name.\n */\nfunction addToBlockType( renderedBlocks, blockName, uniqueId ) {\n\tconst result = {\n\t\t...renderedBlocks,\n\t\t[ blockName ]: renderedBlocks[ blockName ]\n\t\t\t? new Set( renderedBlocks[ blockName ] )\n\t\t\t: new Set(),\n\t};\n\tresult[ blockName ].add( uniqueId );\n\n\treturn result;\n}\n\n/**\n * A React context provider for use with the `useHasRecursion` hook to prevent recursive\n * renders.\n *\n * Wrap block content with this provider and provide the same `uniqueId` prop as used\n * with `useHasRecursion`.\n *\n * @param {Object} props\n * @param {*} props.uniqueId Any value that acts as a unique identifier for a block instance.\n * @param {string} props.blockName Optional block name.\n * @param {JSX.Element} props.children React children.\n *\n * @return {JSX.Element} A React element.\n */\nexport function RecursionProvider( { children, uniqueId, blockName = '' } ) {\n\tconst previouslyRenderedBlocks = useContext( RenderedRefsContext );\n\tconst { name } = useBlockEditContext();\n\n\tblockName = blockName || name;\n\n\tconst newRenderedBlocks = useMemo(\n\t\t() => addToBlockType( previouslyRenderedBlocks, blockName, uniqueId ),\n\t\t[ previouslyRenderedBlocks, blockName, uniqueId ]\n\t);\n\n\treturn (\n\t\t<RenderedRefsContext.Provider value={ newRenderedBlocks }>\n\t\t\t{ children }\n\t\t</RenderedRefsContext.Provider>\n\t);\n}\n\n/**\n * A React hook for keeping track of blocks previously rendered up in the block\n * tree. Blocks susceptible to recursion can use this hook in their `Edit`\n * function to prevent said recursion.\n *\n * Use this with the `RecursionProvider` component, using the same `uniqueId` value\n * for both the hook and the provider.\n *\n * @param {*} uniqueId Any value that acts as a unique identifier for a block instance.\n * @param {string} blockName Optional block name.\n *\n * @return {boolean} A boolean describing whether the provided id has already been rendered.\n */\nexport function useHasRecursion( uniqueId, blockName = '' ) {\n\tconst previouslyRenderedBlocks = useContext( RenderedRefsContext );\n\tconst { name } = useBlockEditContext();\n\tblockName = blockName || name;\n\treturn Boolean( previouslyRenderedBlocks[ blockName ]?.has( uniqueId ) );\n}\n\nexport const DeprecatedExperimentalRecursionProvider = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalRecursionProvider', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.RecursionProvider',\n\t} );\n\treturn <RecursionProvider { ...props } />;\n};\n\nexport const DeprecatedExperimentalUseHasRecursion = ( ...args ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalUseHasRecursion', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useHasRecursion',\n\t} );\n\treturn useHasRecursion( ...args );\n};\n"],"mappings":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAA4D,IAAAI,WAAA,GAAAJ,OAAA;AAT5D;AACA;AACA;;AAIA;AACA;AACA;;AAGA,MAAMK,mBAAmB,GAAG,IAAAC,sBAAa,EAAE,CAAC,CAAE,CAAC;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CAAEC,cAAc,EAAEC,SAAS,EAAEC,QAAQ,EAAG;EAC9D,MAAMC,MAAM,GAAG;IACd,GAAGH,cAAc;IACjB,CAAEC,SAAS,GAAID,cA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QAAS,CAAE,CAAC;AACzE;AAEO,MAAMkB,uCAAuC,GAAKC,KAAK,IAAM;EACnE,IAAAC,mBAAU,EAAE,gDAAgD,EAAE;IAC7DC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE;EACd,CAAE,CAAC;EACH,oBAAO,IAAA5B,WAAA,CAAAkB,GAAA,EAACR,iBAAiB;IAAA,GAAMe;EAAK,CAAI,CAAC;AAC1C,CAAC;AAACI,OAAA,CAAAL,uCAAA,GAAAA,uCAAA;AAEK,MAAMM,qCAAqC,GAAGA,CAAE,GAAGC,IAAI,KAAM;EACnE,IAAAL,mBAAU,EAAE,8CAA8C,EAAE;IAC3DC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE;EACd,CAAE,CAAC;EACH,OAAOP,eAAe,CAAE,GAAGU,IAAK,CAAC;AAClC,CAAC;AAACF,OAAA,CAAAC,qCAAA,GAAAA,qCAAA","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* wp:polyfill */
|
|
2
1
|
"use strict";
|
|
3
2
|
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -373,6 +372,11 @@ function RichTextWrapper({
|
|
|
373
372
|
"aria-multiline": !disableLineBreaks,
|
|
374
373
|
"aria-readonly": shouldDisableEditing,
|
|
375
374
|
...props,
|
|
375
|
+
// Unset draggable (coming from block props) for contentEditable
|
|
376
|
+
// elements because it will interfere with multi block selection
|
|
377
|
+
// when the contentEditable and draggable elements are the same
|
|
378
|
+
// element.
|
|
379
|
+
draggable: undefined,
|
|
376
380
|
"aria-label": bindingsLabel || props['aria-label'] || placeholder,
|
|
377
381
|
...autocompleteProps,
|
|
378
382
|
ref: (0, _compose.useMergeRefs)([
|