Skip to content

Conversation

@allanlasser
Copy link
Member

@allanlasser allanlasser commented May 29, 2025

These changes update the DocumentCloud Wordpress to version 0.6.0:

  • A new DocumentCloud block is available for the Gutenberg editor, enabling document embedding within current publishing workflows.
  • Adds DocumentCloud to the oEmbed whitelist, allowing pasted links to transform into embeds.
  • Fixes and enhancements when using the [documentcloud] shortcode in the Classic Editor.
  • Testing and environment enhancements to ensure compatibility across PHP and Wordpress versions.

To Test

  1. Clone the repo and follow the Docker installation instructions in README.md
  2. With the plugin enabled in your local environment:
    1. Test the Gutenberg block by adding it to a new post, then pasting in a link to a document, note, and project. Use the block's settings to customize the height and settings of the embed.
    2. Test the oEmbed support by pasting in links to documents, notes, pages, and projects.
    3. Test the shortcode by adding a Classic Block to your post, then using source URLs for documents, pages, and projects. You can also download the plugin as a .zip file and install it manually to enable the Classic Editor for a post.
  3. Run the tests locally following the instructions in README.md

rtCamp provided:
1. Gutenberg support, provided by the JS files in the `block` directory
2. Unit testing of the plugin with `phpunit`
3. Updates to the Docker configuration
4. Updates to the README
@allanlasser allanlasser marked this pull request as ready for review June 2, 2025 13:07
@allanlasser allanlasser self-assigned this Jun 2, 2025
@duckduckgrayduck
Copy link

duckduckgrayduck commented Jun 4, 2025

Few issues:

  • In the dev environment, Classic Editor isn't included, so I can't enable it to test it.
  • The DocumentCloud plugin is still listed as 0.5.1 when I go to activate it.
  • In the Gutenberg editor, when I paste a DocumentCloud document, page or note link, it doesn't pre-load the embed in the editor, so I can't edit anything visually. When I click "Save" and then "View Post" it does show me the embed.
  • When I paste a link to a project, it fails to load the embed:
    https://www.documentcloud.org/projects/215178-ocr-reprise
    it only accepts https://www.documentcloud.org/projects/215178 I think there is an open issue for this. Oddly enough, this project link does load in the Gutenberg editor.

@allanlasser allanlasser added this to the Wordpress Plugin milestone Jun 16, 2025
@allanlasser
Copy link
Member Author

In the dev environment, Classic Editor isn't included, so I can't enable it to test it.

There's a "Classic Editor" block available in the Gutenberg editor that simulates the Classic Editor. You can also download the plugin as a .zip file and install it manually.

I'll update test steps with these details.

In the Gutenberg editor, when I paste a DocumentCloud document, page or note link, it doesn't pre-load the embed in the editor, so I can't edit anything visually. When I click "Save" and then "View Post" it does show me the embed.

In my testing the embed is rendered as an "embed" block a few seconds after pasting in the URL. Can you check your console for any potential errors here?

When I paste a link to a project, it fails to load the embed:
https://www.documentcloud.org/projects/215178-ocr-reprise
it only accepts https://www.documentcloud.org/projects/215178 I think there is an open issue for this. Oddly enough, this project link does load in the Gutenberg editor.

This is expected, as the DocumentCloud block parses the URL for the ID, but our oEmbed endpoint doesn't handle it as well: MuckRock/documentcloud#308

@duckduckgrayduck
Copy link

No errors in the console.
wordpress | 172.20.0.1 - - [16/Jun/2025:18:24:36 +0000] "GET /?p=1 HTTP/1.1" 200 15180 "http://localhost:8000/wp-admin/post.php?post=1&action=edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
wordpress | 172.20.0.1 - - [16/Jun/2025:18:24:35 +0000] "POST /index.php?rest_route=%2Fwp%2Fv2%2Fposts%2F1%2Fautosaves&_locale=user HTTP/1.1" 200 3896 "http://localhost:8000/wp-admin/post.php?post=1&action=edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
wordpress | 172.20.0.1 - - [16/Jun/2025:18:24:45 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 582 "http://localhost:8000/wp-admin/post.php?post=1&action=edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
wordpress | 172.20.0.1 - - [16/Jun/2025:18:24:55 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 582 "http://localhost:8000/wp-admin/post.php?post=1&action=edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"

This is what I see in both Chrome and Firefox. It loads a line. When I open to view it in a preview, the embed works.
FailedEmbed

@duckduckgrayduck
Copy link

In the classic editor block /classic, when I paste the link, it indeed loads right away.
CorrectlyLoads

@allanlasser
Copy link
Member Author

@duckduckgrayduck I think the issue you're encountering is MuckRock/documentcloud#301. If you inspect the "line", it should be a 0 height iframe.

@duckduckgrayduck
Copy link

@allanlasser that is correct. The calculated height is the issue. Not an unknown issue.
CalculatedHeight

@allanlasser allanlasser merged commit 27f6917 into master Jun 23, 2025
16 checks passed
@allanlasser allanlasser deleted the rtcamp branch June 27, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants