19 lines
5.3 KiB
JavaScript
19 lines
5.3 KiB
JavaScript
import{S as $,i as C,s as x,j as m,m as p,b as f,t as g,n as h,w as R,Q as D,x as d,C as w,a as y,d as b,p as v,D as k,k as A,l as S}from"./index-25af778d.js";import{p as M,M as V,T as j,S as B}from"./collect-stories-cce06d4a.js";import{B as E}from"./Block-9c89ee1a.js";import{w as H}from"./withParams-90715500.js";const P=`Embed a document hosted by [DocumentCloud](https://documentcloud.org)
|
|
|
|
---
|
|
|
|
The document must have its access level set to public before it can be embedded. The \`slug\` argument can be found after the final slash in the document's URL. For instance, the document included in the example is found at [documentcloud.org/documents/3259984-Trump-Intelligence-Allegations](https://www.documentcloud.org/documents/3259984-Trump-Intelligence-Allegations). The slug is "3259984-Trump-Intelligence-Allegations".
|
|
|
|
\`\`\`html
|
|
<script>
|
|
import { DocumentCloud } from '@reuters-graphics/graphics-components';
|
|
<\/script>
|
|
|
|
<DocumentCloud
|
|
slug="3259984-Trump-Intelligence-Allegations"
|
|
altText="These Reports Allege Trump Has Deep Ties To Russia"
|
|
width="normal"
|
|
/>
|
|
\`\`\`
|
|
`;function F(a){let e,o;return{c(){e=R("iframe"),D(e.src,o="https://embed.documentcloud.org/documents/"+a[1]+"/?embed=1&responsive=1&title=1")||d(e,"src",o),d(e,"title",a[2]),d(e,"width","700"),d(e,"height","540"),w(e,"border","1px solid #aaa"),w(e,"width","100%"),w(e,"height","800px"),w(e,"height","calc(100vh - 100px)"),d(e,"sandbox","allow-scripts allow-same-origin allow-popups allow-forms allow-popups-to-escape-sandbox")},m(t,l){y(t,e,l)},p(t,l){l&2&&!D(e.src,o="https://embed.documentcloud.org/documents/"+t[1]+"/?embed=1&responsive=1&title=1")&&d(e,"src",o),l&4&&d(e,"title",t[2])},d(t){t&&b(e)}}}function L(a){let e,o;return e=new E({props:{width:a[0],id:a[3],cls:"photo "+a[4],$$slots:{default:[F]},$$scope:{ctx:a}}}),{c(){m(e.$$.fragment)},m(t,l){p(e,t,l),o=!0},p(t,[l]){const n={};l&1&&(n.width=t[0]),l&8&&(n.id=t[3]),l&16&&(n.cls="photo "+t[4]),l&38&&(n.$$scope={dirty:l,ctx:t}),e.$set(n)},i(t){o||(f(e.$$.fragment,t),o=!0)},o(t){g(e.$$.fragment,t),o=!1},d(t){h(e,t)}}}function O(a,e,o){let{width:t="normal"}=e,{slug:l}=e,{altText:n}=e,{id:r=""}=e,{cls:c=""}=e;return a.$$set=i=>{"width"in i&&o(0,t=i.width),"slug"in i&&o(1,l=i.slug),"altText"in i&&o(2,n=i.altText),"id"in i&&o(3,r=i.id),"cls"in i&&o(4,c=i.cls)},[t,l,n,r,c]}class _ extends ${constructor(e){super(),C(this,e,O,L,x,{width:0,slug:1,altText:2,id:3,cls:4})}}_.__docgen={version:3,name:"DocumentCloud.svelte",data:[{keywords:[],visibility:"public",description:"Width of the container, one of: normal, wide, wider, widest or fluid",name:"width",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"normal"},{keywords:[{name:"required",description:""}],visibility:"public",description:"The unique identifier for the document.",name:"slug",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}},{keywords:[{name:"required",description:""}],visibility:"public",description:"Alt text for the document.",name:"altText",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}},{keywords:[],visibility:"public",description:"Add an ID to target with SCSS.",name:"id",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:""},{keywords:[],visibility:"public",description:"Add a class to target with SCSS.",name:"cls",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:""}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};function Q(a){let e,o;const t=[a[1]];let l={};for(let n=0;n<t.length;n+=1)l=v(l,t[n]);return e=new _({props:l}),{c(){m(e.$$.fragment)},m(n,r){p(e,n,r),o=!0},p(n,r){const c=r&2?A(t,[S(n[1])]):{};e.$set(c)},i(n){o||(f(e.$$.fragment,n),o=!0)},o(n){g(e.$$.fragment,n),o=!1},d(n){h(e,n)}}}function U(a){let e,o,t,l,n,r;const c=[{title:"Components/DocumentCloud"},{component:_},a[0]];let i={};for(let s=0;s<c.length;s+=1)i=v(i,c[s]);return e=new V({props:i}),t=new j({props:{$$slots:{default:[Q,({args:s})=>({1:s}),({args:s})=>s?2:0]},$$scope:{ctx:a}}}),n=new B({props:{name:"Default",args:{width:"normal",slug:"3259984-Trump-Intelligence-Allegations",altText:"These Reports Allege Trump Has Deep Ties To Russia"}}}),{c(){m(e.$$.fragment),o=k(),m(t.$$.fragment),l=k(),m(n.$$.fragment)},m(s,u){p(e,s,u),y(s,o,u),p(t,s,u),y(s,l,u),p(n,s,u),r=!0},p(s,[u]){const q=u&1?A(c,[c[0],u&0&&{component:_},u&1&&S(s[0])]):{};e.$set(q);const T={};u&6&&(T.$$scope={dirty:u,ctx:s}),t.$set(T)},i(s){r||(f(e.$$.fragment,s),f(t.$$.fragment,s),f(n.$$.fragment,s),r=!0)},o(s){g(e.$$.fragment,s),g(t.$$.fragment,s),g(n.$$.fragment,s),r=!1},d(s){h(e,s),s&&b(o),h(t,s),s&&b(l),h(n,s)}}}function W(a){return[{...H(P),argTypes:{width:{control:"select",options:["normal","wide","wider","widest","fluid"]}}}]}class z extends ${constructor(e){super(),C(this,e,W,U,x,{})}}const I=M(z,{meta:{title:"Components/DocumentCloud"},stories:{"tpl:default":{storyId:"components-documentcloud--default",name:"default",template:!0,source:"<DocumentCloud {...args} />",hasArgs:!0},Default:{storyId:"components-documentcloud--default",name:"Default",template:!1,hasArgs:!1}},allocatedIds:["default","Meta","Template","Story","componentDocs","DocumentCloud","withComponentDocs"]}),X=I.meta,Y=["Default"],Z=I.stories.Default;export{Z as Default,Y as __namedExportsOrder,X as default};
|
|
//# sourceMappingURL=DocumentCloud.stories-3407d178.js.map
|