-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add link classes and rel attribute to image block (see #7504) * Make labels consistent with classic editor. * Fix coding standards error * Add tests * Consolidate check for presence of image link * Rebase, incorporate upstream changes * Changes as per review * Fix tests * Resolve final review comment * Update CONTRIBUTORS.md
- Loading branch information
Showing
11 changed files
with
197 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/integration/full-content/fixtures/core__image__custom-link-class.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- wp:core/image {"linkDestination":"custom"} --> | ||
<figure class="wp-block-image"><a class="custom-link" href="https://wordpress.org/"><img src="https://cldup.com/uuUqE_dXzy.jpg" alt="" /></a></figure> | ||
<!-- /wp:core/image --> |
17 changes: 17 additions & 0 deletions
17
test/integration/full-content/fixtures/core__image__custom-link-class.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[ | ||
{ | ||
"clientId": "_clientId_0", | ||
"name": "core/image", | ||
"isValid": true, | ||
"attributes": { | ||
"url": "https://cldup.com/uuUqE_dXzy.jpg", | ||
"alt": "", | ||
"caption": "", | ||
"href": "https://wordpress.org/", | ||
"linkDestination": "custom", | ||
"linkClass": "custom-link" | ||
}, | ||
"innerBlocks": [], | ||
"originalContent": "<figure class=\"wp-block-image\"><a class=\"custom-link\" href=\"https://wordpress.org/\"><img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"\" /></a></figure>" | ||
} | ||
] |
22 changes: 22 additions & 0 deletions
22
test/integration/full-content/fixtures/core__image__custom-link-class.parsed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"blockName": "core/image", | ||
"attrs": { | ||
"linkDestination": "custom" | ||
}, | ||
"innerBlocks": [], | ||
"innerHTML": "\n<figure class=\"wp-block-image\"><a class=\"custom-link\" href=\"https://wordpress.org/\"><img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"\" /></a></figure>\n", | ||
"innerContent": [ | ||
"\n<figure class=\"wp-block-image\"><a class=\"custom-link\" href=\"https://wordpress.org/\"><img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"\" /></a></figure>\n" | ||
] | ||
}, | ||
{ | ||
"attrs": {}, | ||
"blockName": null, | ||
"innerBlocks": [], | ||
"innerHTML": "\n", | ||
"innerContent": [ | ||
"\n" | ||
] | ||
} | ||
] |
3 changes: 3 additions & 0 deletions
3
test/integration/full-content/fixtures/core__image__custom-link-class.serialized.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- wp:image {"linkDestination":"custom"} --> | ||
<figure class="wp-block-image"><a class="custom-link" href="https://wordpress.org/"><img src="https://cldup.com/uuUqE_dXzy.jpg" alt=""/></a></figure> | ||
<!-- /wp:image --> |
3 changes: 3 additions & 0 deletions
3
test/integration/full-content/fixtures/core__image__custom-link-rel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- wp:core/image {"linkDestination":"custom"} --> | ||
<figure class="wp-block-image"><a href="https://wordpress.org/" rel="external"><img src="https://cldup.com/uuUqE_dXzy.jpg" alt="" /></a></figure> | ||
<!-- /wp:core/image --> |
17 changes: 17 additions & 0 deletions
17
test/integration/full-content/fixtures/core__image__custom-link-rel.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[ | ||
{ | ||
"clientId": "_clientId_0", | ||
"name": "core/image", | ||
"isValid": true, | ||
"attributes": { | ||
"url": "https://cldup.com/uuUqE_dXzy.jpg", | ||
"alt": "", | ||
"caption": "", | ||
"href": "https://wordpress.org/", | ||
"linkDestination": "custom", | ||
"rel": "external" | ||
}, | ||
"innerBlocks": [], | ||
"originalContent": "<figure class=\"wp-block-image\"><a href=\"https://wordpress.org/\" rel=\"external\"><img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"\" /></a></figure>" | ||
} | ||
] |
22 changes: 22 additions & 0 deletions
22
test/integration/full-content/fixtures/core__image__custom-link-rel.parsed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"blockName": "core/image", | ||
"attrs": { | ||
"linkDestination": "custom" | ||
}, | ||
"innerBlocks": [], | ||
"innerHTML": "\n<figure class=\"wp-block-image\"><a href=\"https://wordpress.org/\" rel=\"external\"><img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"\" /></a></figure>\n", | ||
"innerContent": [ | ||
"\n<figure class=\"wp-block-image\"><a href=\"https://wordpress.org/\" rel=\"external\"><img src=\"https://cldup.com/uuUqE_dXzy.jpg\" alt=\"\" /></a></figure>\n" | ||
] | ||
}, | ||
{ | ||
"attrs": {}, | ||
"blockName": null, | ||
"innerBlocks": [], | ||
"innerHTML": "\n", | ||
"innerContent": [ | ||
"\n" | ||
] | ||
} | ||
] |
3 changes: 3 additions & 0 deletions
3
test/integration/full-content/fixtures/core__image__custom-link-rel.serialized.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- wp:image {"linkDestination":"custom"} --> | ||
<figure class="wp-block-image"><a href="https://wordpress.org/" rel="external"><img src="https://cldup.com/uuUqE_dXzy.jpg" alt=""/></a></figure> | ||
<!-- /wp:image --> |