@reuters-graphics/graphics-components 0.0.8 → 0.0.11
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.
|
@@ -14,7 +14,15 @@
|
|
|
14
14
|
export let minFrameWidth = 320;
|
|
15
15
|
export let maxFrameWidth = 1200;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const getDefaultEmbed = () => {
|
|
18
|
+
if (typeof window === 'undefined') return embeds[0];
|
|
19
|
+
const lastActiveEmbed = window.localStorage.getItem('framer-active-embed');
|
|
20
|
+
if (!lastActiveEmbed) return embeds[0];
|
|
21
|
+
if (embeds.indexOf(lastActiveEmbed) > -1) return lastActiveEmbed;
|
|
22
|
+
return embeds[0];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
let activeEmbed = getDefaultEmbed();
|
|
18
26
|
|
|
19
27
|
$: embedTitles = getUniqNames(embeds);
|
|
20
28
|
|
|
@@ -60,12 +68,18 @@
|
|
|
60
68
|
</div>
|
|
61
69
|
<Typeahead
|
|
62
70
|
label="Select an embed"
|
|
63
|
-
value="{embedTitles[
|
|
71
|
+
value="{embedTitles[embeds.indexOf(activeEmbed)]}"
|
|
64
72
|
extract="{(d) => embedTitles[d.index]}"
|
|
65
73
|
data="{embeds.map((embed, index) => ({ index, embed }))}"
|
|
66
74
|
placeholder="{'Search'}"
|
|
67
75
|
showDropdownOnFocus="{true}"
|
|
68
76
|
on:select="{({ detail }) => {
|
|
77
|
+
if (typeof window !== 'undefined') {
|
|
78
|
+
window.localStorage.setItem(
|
|
79
|
+
'framer-active-embed',
|
|
80
|
+
detail.original.embed
|
|
81
|
+
);
|
|
82
|
+
}
|
|
69
83
|
activeEmbed = detail.original.embed;
|
|
70
84
|
}}"
|
|
71
85
|
/>
|