Skip to content

Commit

Permalink
keep width and height as attributes too, keep the attributes as numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu committed Jul 5, 2023
1 parent 20b9223 commit fa4c8ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 82 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/image/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
"__experimentalRole": "content"
},
"width": {
"type": "string"
"type": "number"
},
"height": {
"type": "string"
"type": "number"
},
"aspectRatio": {
"type": "string"
Expand Down
80 changes: 0 additions & 80 deletions packages/block-library/src/image/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,86 +550,6 @@ const v5 = {
* @see https://github.com/WordPress/gutenberg/pull/31366
*/
const v6 = {
attributes: {
align: {
type: 'string',
},
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src',
__experimentalRole: 'content',
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: '',
__experimentalRole: 'content',
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption',
__experimentalRole: 'content',
},
title: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'title',
__experimentalRole: 'content',
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'href',
__experimentalRole: 'content',
},
rel: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'rel',
},
linkClass: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'class',
},
id: {
type: 'number',
__experimentalRole: 'content',
},
width: {
type: 'number',
},
height: {
type: 'number',
},
aspectRatio: {
type: 'string',
},
scale: {
type: 'string',
},
sizeSlug: {
type: 'string',
},
linkDestination: {
type: 'string',
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'target',
},
},
save( { attributes } ) {
const {
url,
Expand Down
2 changes: 2 additions & 0 deletions packages/block-library/src/image/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export default function save( { attributes } ) {
width,
height,
} }
width={ width }
height={ height }
title={ title }
/>
);
Expand Down

0 comments on commit fa4c8ac

Please sign in to comment.