@reuters-graphics/graphics-components 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,7 @@
23
23
  };
24
24
 
25
25
  let activeEmbed = getDefaultEmbed();
26
+ let activeEmbedIndex = embeds.indexOf(activeEmbed);
26
27
 
27
28
  $: embedTitles = getUniqNames(embeds);
28
29
 
@@ -30,11 +31,17 @@
30
31
  let pymParent;
31
32
 
32
33
  const reframe = (embed) => {
34
+ // Bit of hack for handling adding query strings dynamically to embeds.
35
+ // cf. also the value prop on the Typeahead component...
36
+ const activeEmbed =
37
+ embeds.indexOf(embed) > -1
38
+ ? embed
39
+ : embeds[activeEmbedIndex] || embeds[0];
33
40
  pymParent = new pym.Parent(
34
41
  'frame-parent',
35
- /^http/.test(embed)
36
- ? embed
37
- : urljoin(window.location.origin, embed, { trailingSlash: true })
42
+ /^http/.test(activeEmbed)
43
+ ? activeEmbed
44
+ : urljoin(window.location.origin, activeEmbed, { trailingSlash: true })
38
45
  );
39
46
  };
40
47
 
@@ -68,7 +75,9 @@
68
75
  </div>
69
76
  <Typeahead
70
77
  label="Select an embed"
71
- value="{embedTitles[embeds.indexOf(activeEmbed)]}"
78
+ value="{embedTitles[embeds.indexOf(activeEmbed)] ||
79
+ embedTitles[activeEmbedIndex] ||
80
+ embedTitles[0]}"
72
81
  extract="{(d) => embedTitles[d.index]}"
73
82
  data="{embeds.map((embed, index) => ({ index, embed }))}"
74
83
  placeholder="{'Search'}"
@@ -81,6 +90,7 @@
81
90
  );
82
91
  }
83
92
  activeEmbed = detail.original.embed;
93
+ activeEmbedIndex = detail.original.index;
84
94
  }}"
85
95
  />
86
96
  </div>
@@ -117,6 +127,7 @@ div#typeahead-container {
117
127
  margin: 0 auto 15px;
118
128
  position: relative;
119
129
  }
130
+
120
131
  div#typeahead-container div.embed-link {
121
132
  position: absolute;
122
133
  top: 0;
@@ -124,12 +135,14 @@ div#typeahead-container div.embed-link {
124
135
  display: inline-block;
125
136
  z-index: 2;
126
137
  }
138
+
127
139
  div#typeahead-container div.embed-link a {
128
140
  font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
129
141
  color: #bbb;
130
142
  font-size: 12px;
131
143
  text-decoration: none !important;
132
144
  }
145
+
133
146
  div#typeahead-container div.embed-link a:hover {
134
147
  color: #666;
135
148
  }
@@ -137,6 +150,7 @@ div#typeahead-container div.embed-link a:hover {
137
150
  div#preview-label {
138
151
  margin: 0 auto;
139
152
  }
153
+
140
154
  div#preview-label p {
141
155
  font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
142
156
  color: #aaa;
@@ -149,6 +163,9 @@ div#preview-label p {
149
163
  margin: 0 auto;
150
164
  width: var(--width);
151
165
  }
166
+ #frame-parent :global(iframe) {
167
+ display: block;
168
+ }
152
169
 
153
170
  div#home-link {
154
171
  position: fixed;
@@ -156,9 +173,11 @@ div#home-link {
156
173
  left: 10px;
157
174
  font-size: 18px;
158
175
  }
176
+
159
177
  div#home-link a {
160
178
  color: #ccc;
161
179
  }
180
+
162
181
  div#home-link a:hover {
163
182
  color: #666;
164
183
  }</style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",