@wordpress/block-editor 12.3.1 → 12.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/build/components/block-lock/toolbar.js +25 -6
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-toolbar/index.js +8 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build/components/dimensions-tool/index.js +207 -0
- package/build/components/dimensions-tool/index.js.map +1 -0
- package/build/components/dimensions-tool/scale-tool.js +111 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build/components/dimensions-tool/width-height-tool.js +125 -0
- package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -2
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/link-control/index.js +17 -15
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +4 -4
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +2 -3
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/provider/use-block-sync.js +21 -0
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/resolution-tool/index.js +55 -0
- package/build/components/resolution-tool/index.js.map +1 -0
- package/build/components/url-input/index.js +4 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/private-apis.js +7 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/defaults.js +1 -0
- package/build/store/defaults.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +25 -7
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -5
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/index.js +195 -0
- package/build-module/components/dimensions-tool/index.js.map +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js +103 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -2
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-size-control/index.js +5 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +17 -15
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -4
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -5
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +21 -0
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +45 -0
- package/build-module/components/resolution-tool/index.js.map +1 -0
- package/build-module/components/url-input/index.js +4 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/private-apis.js +5 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/defaults.js +1 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-style/style-rtl.css +42 -46
- package/build-style/style.css +42 -46
- package/package.json +6 -5
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
- package/src/components/block-lock/toolbar.js +34 -6
- package/src/components/block-toolbar/index.js +9 -6
- package/src/components/block-tools/style.scss +4 -0
- package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
- package/src/components/dimensions-tool/index.js +212 -0
- package/src/components/dimensions-tool/scale-tool.js +124 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
- package/src/components/dimensions-tool/stories/index.js +54 -0
- package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
- package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
- package/src/components/dimensions-tool/test/index.js +641 -0
- package/src/components/dimensions-tool/width-height-tool.js +113 -0
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/src/components/image-editor/use-save-image.js +0 -1
- package/src/components/image-size-control/index.js +6 -0
- package/src/components/link-control/index.js +32 -28
- package/src/components/link-control/search-input.js +4 -3
- package/src/components/link-control/settings-drawer.js +6 -5
- package/src/components/link-control/style.scss +33 -55
- package/src/components/link-control/test/index.js +129 -116
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/provider/test/use-block-sync.js +21 -6
- package/src/components/provider/use-block-sync.js +19 -0
- package/src/components/resolution-tool/index.js +56 -0
- package/src/components/resolution-tool/stories/index.js +48 -0
- package/src/components/url-input/index.js +2 -0
- package/src/private-apis.js +4 -0
- package/src/store/defaults.js +1 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
SelectControl,
|
|
6
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
7
|
+
} from '@wordpress/components';
|
|
8
|
+
import { __, _x } from '@wordpress/i18n';
|
|
9
|
+
|
|
10
|
+
const DEFAULT_SIZE_OPTIONS = [
|
|
11
|
+
{
|
|
12
|
+
label: _x( 'Thumbnail', 'Image size option for resolution control' ),
|
|
13
|
+
value: 'thumbnail',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: _x( 'Medium', 'Image size option for resolution control' ),
|
|
17
|
+
value: 'medium',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: _x( 'Large', 'Image size option for resolution control' ),
|
|
21
|
+
value: 'large',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: _x( 'Full Size', 'Image size option for resolution control' ),
|
|
25
|
+
value: 'full',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export default function ResolutionTool( {
|
|
30
|
+
panelId,
|
|
31
|
+
value,
|
|
32
|
+
onChange,
|
|
33
|
+
options = DEFAULT_SIZE_OPTIONS,
|
|
34
|
+
defaultValue = DEFAULT_SIZE_OPTIONS[ 0 ].value,
|
|
35
|
+
isShownByDefault = true,
|
|
36
|
+
} ) {
|
|
37
|
+
const displayValue = value ?? defaultValue;
|
|
38
|
+
return (
|
|
39
|
+
<ToolsPanelItem
|
|
40
|
+
hasValue={ () => displayValue !== defaultValue }
|
|
41
|
+
label={ __( 'Resolution' ) }
|
|
42
|
+
onDeselect={ () => onChange( defaultValue ) }
|
|
43
|
+
isShownByDefault={ isShownByDefault }
|
|
44
|
+
panelId={ panelId }
|
|
45
|
+
>
|
|
46
|
+
<SelectControl
|
|
47
|
+
label={ __( 'Resolution' ) }
|
|
48
|
+
value={ displayValue }
|
|
49
|
+
options={ options }
|
|
50
|
+
onChange={ onChange }
|
|
51
|
+
help={ __( 'Select the size of the source image.' ) }
|
|
52
|
+
size={ '__unstable-large' }
|
|
53
|
+
/>
|
|
54
|
+
</ToolsPanelItem>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
import {
|
|
6
|
+
Panel,
|
|
7
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
8
|
+
} from '@wordpress/components';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import ResolutionTool from '..';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
title: 'BlockEditor (Private APIs)/ResolutionControl',
|
|
17
|
+
component: ResolutionTool,
|
|
18
|
+
argTypes: {
|
|
19
|
+
panelId: { control: { type: null } },
|
|
20
|
+
onChange: { action: 'changed' },
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Default = ( { panelId, onChange: onChangeProp, ...props } ) => {
|
|
25
|
+
const [ resolution, setResolution ] = useState( undefined );
|
|
26
|
+
const resetAll = () => {
|
|
27
|
+
setResolution( undefined );
|
|
28
|
+
onChangeProp( undefined );
|
|
29
|
+
};
|
|
30
|
+
return (
|
|
31
|
+
<Panel>
|
|
32
|
+
<ToolsPanel panelId={ panelId } resetAll={ resetAll }>
|
|
33
|
+
<ResolutionTool
|
|
34
|
+
panelId={ panelId }
|
|
35
|
+
onChange={ ( newValue ) => {
|
|
36
|
+
setResolution( newValue );
|
|
37
|
+
onChangeProp( newValue );
|
|
38
|
+
} }
|
|
39
|
+
value={ resolution }
|
|
40
|
+
{ ...props }
|
|
41
|
+
/>
|
|
42
|
+
</ToolsPanel>
|
|
43
|
+
</Panel>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
Default.args = {
|
|
47
|
+
panelId: 'panel-id',
|
|
48
|
+
};
|
|
@@ -434,6 +434,7 @@ class URLInput extends Component {
|
|
|
434
434
|
placeholder = __( 'Paste URL or type to search' ),
|
|
435
435
|
__experimentalRenderControl: renderControl,
|
|
436
436
|
value = '',
|
|
437
|
+
hideLabelFromVision = false,
|
|
437
438
|
} = this.props;
|
|
438
439
|
|
|
439
440
|
const {
|
|
@@ -452,6 +453,7 @@ class URLInput extends Component {
|
|
|
452
453
|
className: classnames( 'block-editor-url-input', className, {
|
|
453
454
|
'is-full-width': isFullWidth,
|
|
454
455
|
} ),
|
|
456
|
+
hideLabelFromVision,
|
|
455
457
|
};
|
|
456
458
|
|
|
457
459
|
const inputProps = {
|
package/src/private-apis.js
CHANGED
|
@@ -16,6 +16,8 @@ import BlockQuickNavigation from './components/block-quick-navigation';
|
|
|
16
16
|
import { LayoutStyle } from './components/block-list/layout';
|
|
17
17
|
import { BlockRemovalWarningModal } from './components/block-removal-warning-modal';
|
|
18
18
|
import { useLayoutClasses, useLayoutStyles } from './hooks';
|
|
19
|
+
import DimensionsTool from './components/dimensions-tool';
|
|
20
|
+
import ResolutionTool from './components/resolution-tool';
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Private @wordpress/block-editor APIs.
|
|
@@ -37,4 +39,6 @@ lock( privateApis, {
|
|
|
37
39
|
BlockRemovalWarningModal,
|
|
38
40
|
useLayoutClasses,
|
|
39
41
|
useLayoutStyles,
|
|
42
|
+
DimensionsTool,
|
|
43
|
+
ResolutionTool,
|
|
40
44
|
} );
|
package/src/store/defaults.js
CHANGED
|
@@ -18,6 +18,7 @@ export const PREFERENCES_DEFAULTS = {
|
|
|
18
18
|
* @property {number} maxWidth Max width to constraint resizing
|
|
19
19
|
* @property {boolean|Array} allowedBlockTypes Allowed block types
|
|
20
20
|
* @property {boolean} hasFixedToolbar Whether or not the editor toolbar is fixed
|
|
21
|
+
* @property {boolean} distractionFree Whether or not the editor UI is distraction free
|
|
21
22
|
* @property {boolean} focusMode Whether the focus mode is enabled or not
|
|
22
23
|
* @property {Array} styles Editor Styles
|
|
23
24
|
* @property {boolean} keepCaretInsideBlock Whether caret should move between blocks in edit mode
|