documentcloud / wordpress-documentcloud

Embed DocumentCloud documents that won't be eaten by the visual editor

Home Page:https://wordpress.org/plugins/documentcloud/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some shortcode parameters are not working for some documents

jaredcobb opened this issue · comments

It seems that some of the shortcode parameters (for example height, width, zoom, page, and a few others) are not consistently working on some documents.

Steps to reproduce:

  1. Add the following shortcode to a post:
[documentcloud url="https://www.documentcloud.org/documents/2746909-ABCC-List.html" responsive="false" width="400" height="400" page="3" zoom="false" /]
  1. The plugin will make an API call like so:
https://www.documentcloud.org/api/oembed.json?maxwidth=400&maxheight=400&url=https://www.documentcloud.org/documents/2746909-ABCC-List.html?page=3&zoom=false&responsive=false
  1. The API response will be:
{
    "type": "rich",
    "version": "1.0",
    "provider_name": "DocumentCloud",
    "provider_url": "https://www.documentcloud.org",
    "cache_age": 300,
    "height": 400,
    "width": 400,
    "html": "<div class=\"DC-embed DC-embed-document DV-container\"> <div style=\"position:relative;padding-bottom:141.2857142857142%;height:0;overflow:hidden;max-width:100%;\"> <iframe src=\"//www.documentcloud.org/documents/2746909-ABCC-List.html?embed=true&amp;notes=false&amp;page=3&amp;pdf=false&amp;responsive=false&amp;search=false&amp;sidebar=false&amp;text=false&amp;zoom=false\" title=\"ABCC-List (Hosted by DocumentCloud)\" sandbox=\"allow-scripts allow-same-origin allow-popups\" frameborder=\"0\" style=\"position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid #aaa;border-bottom:0;box-sizing:border-box;\"></iframe> </div> </div>"
}
  1. Note a few things about the html value...
  • The inline style attribute is set at 100% width and 100% height (even though the JSON response shows 400 x 400.
  • The iframe src value properly renders zoom=false however the Zoom slider control will still show up.
  • The iframe src value properly renders page=3 however the document will not default to Page 3.

Confirmed this is happening for me too on a fresh WP install.