documentcloud / wordpress-documentcloud

Embed DocumentCloud documents that won't be eaten by the visual editor
https://wordpress.org/plugins/documentcloud/
GNU General Public License v2.0
9 stars 14 forks source link

Shortcode renders the latest embed code #2

Closed eyeseast closed 10 years ago

eyeseast commented 10 years ago

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.

eyeseast commented 10 years ago

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.