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

Shortcode renders the latest embed code

eyeseast opened this issue · comments

Here's an example, direct from DC:

<div id="DV-viewer-1011044-redwood-charging-docs" class="DV-container"></div>
<script src="//s3.amazonaws.com/s3.documentcloud.org/viewer/loader.js"></script>
<script>
  DV.load("//www.documentcloud.org/documents/1011044-redwood-charging-docs.js", {
  width: 500,
    height: 600,
    sidebar: false,
    container: "#DV-viewer-1011044-redwood-charging-docs"
  });
</script>
  <noscript>
  <a href="http://s3.documentcloud.org/documents/1011044/redwood-charging-docs.pdf">Redwood Charging Docs (PDF)</a>
  <br />
  <a href="http://s3.documentcloud.org/documents/1011044/redwood-charging-docs.txt">Redwood Charging Docs (Text)</a>
</noscript>

This needs to set width: '100%' like the current version does, to keep it semi-responsive.

Looking at this closer, it looks like the only thing new here is the noscript links, and those use the document's title. We don't have that unless a) the user copies it into the shortcode or b) we fetch it via the API. Either way makes this a bigger change. Going to set this aside for now.