@wordpress/block-editor 12.3.1 → 12.3.3

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.
Files changed (102) hide show
  1. package/README.md +1 -0
  2. package/build/components/block-lock/toolbar.js +25 -6
  3. package/build/components/block-lock/toolbar.js.map +1 -1
  4. package/build/components/block-toolbar/index.js +8 -5
  5. package/build/components/block-toolbar/index.js.map +1 -1
  6. package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
  7. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  8. package/build/components/dimensions-tool/index.js +207 -0
  9. package/build/components/dimensions-tool/index.js.map +1 -0
  10. package/build/components/dimensions-tool/scale-tool.js +111 -0
  11. package/build/components/dimensions-tool/scale-tool.js.map +1 -0
  12. package/build/components/dimensions-tool/width-height-tool.js +125 -0
  13. package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
  14. package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
  15. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  16. package/build/components/image-editor/use-save-image.js +1 -2
  17. package/build/components/image-editor/use-save-image.js.map +1 -1
  18. package/build/components/image-size-control/index.js +6 -0
  19. package/build/components/image-size-control/index.js.map +1 -1
  20. package/build/components/link-control/index.js +17 -15
  21. package/build/components/link-control/index.js.map +1 -1
  22. package/build/components/link-control/search-input.js +4 -4
  23. package/build/components/link-control/search-input.js.map +1 -1
  24. package/build/components/link-control/settings-drawer.js +2 -3
  25. package/build/components/link-control/settings-drawer.js.map +1 -1
  26. package/build/components/provider/use-block-sync.js +21 -0
  27. package/build/components/provider/use-block-sync.js.map +1 -1
  28. package/build/components/resolution-tool/index.js +55 -0
  29. package/build/components/resolution-tool/index.js.map +1 -0
  30. package/build/components/url-input/index.js +4 -2
  31. package/build/components/url-input/index.js.map +1 -1
  32. package/build/private-apis.js +7 -1
  33. package/build/private-apis.js.map +1 -1
  34. package/build/store/defaults.js +1 -0
  35. package/build/store/defaults.js.map +1 -1
  36. package/build-module/components/block-lock/toolbar.js +25 -7
  37. package/build-module/components/block-lock/toolbar.js.map +1 -1
  38. package/build-module/components/block-toolbar/index.js +8 -5
  39. package/build-module/components/block-toolbar/index.js.map +1 -1
  40. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
  41. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  42. package/build-module/components/dimensions-tool/index.js +195 -0
  43. package/build-module/components/dimensions-tool/index.js.map +1 -0
  44. package/build-module/components/dimensions-tool/scale-tool.js +103 -0
  45. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
  46. package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
  47. package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
  48. package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
  49. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  50. package/build-module/components/image-editor/use-save-image.js +1 -2
  51. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  52. package/build-module/components/image-size-control/index.js +5 -0
  53. package/build-module/components/image-size-control/index.js.map +1 -1
  54. package/build-module/components/link-control/index.js +17 -15
  55. package/build-module/components/link-control/index.js.map +1 -1
  56. package/build-module/components/link-control/search-input.js +4 -4
  57. package/build-module/components/link-control/search-input.js.map +1 -1
  58. package/build-module/components/link-control/settings-drawer.js +4 -5
  59. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  60. package/build-module/components/provider/use-block-sync.js +21 -0
  61. package/build-module/components/provider/use-block-sync.js.map +1 -1
  62. package/build-module/components/resolution-tool/index.js +45 -0
  63. package/build-module/components/resolution-tool/index.js.map +1 -0
  64. package/build-module/components/url-input/index.js +4 -2
  65. package/build-module/components/url-input/index.js.map +1 -1
  66. package/build-module/private-apis.js +5 -1
  67. package/build-module/private-apis.js.map +1 -1
  68. package/build-module/store/defaults.js +1 -0
  69. package/build-module/store/defaults.js.map +1 -1
  70. package/build-style/style-rtl.css +42 -46
  71. package/build-style/style.css +42 -46
  72. package/package.json +6 -5
  73. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
  74. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
  75. package/src/components/block-lock/toolbar.js +34 -6
  76. package/src/components/block-toolbar/index.js +9 -6
  77. package/src/components/block-tools/style.scss +4 -0
  78. package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
  79. package/src/components/dimensions-tool/index.js +212 -0
  80. package/src/components/dimensions-tool/scale-tool.js +124 -0
  81. package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
  82. package/src/components/dimensions-tool/stories/index.js +54 -0
  83. package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
  84. package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
  85. package/src/components/dimensions-tool/test/index.js +641 -0
  86. package/src/components/dimensions-tool/width-height-tool.js +113 -0
  87. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
  88. package/src/components/image-editor/use-save-image.js +0 -1
  89. package/src/components/image-size-control/index.js +6 -0
  90. package/src/components/link-control/index.js +32 -28
  91. package/src/components/link-control/search-input.js +4 -3
  92. package/src/components/link-control/settings-drawer.js +6 -5
  93. package/src/components/link-control/style.scss +33 -55
  94. package/src/components/link-control/test/index.js +129 -116
  95. package/src/components/media-replace-flow/test/index.js +1 -1
  96. package/src/components/provider/test/use-block-sync.js +21 -6
  97. package/src/components/provider/use-block-sync.js +19 -0
  98. package/src/components/resolution-tool/index.js +56 -0
  99. package/src/components/resolution-tool/stories/index.js +48 -0
  100. package/src/components/url-input/index.js +2 -0
  101. package/src/private-apis.js +4 -0
  102. 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 = {
@@ -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
  } );
@@ -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