@ewc-lib/ewc-popovers 2.0.3-beta → 2.0.4-beta

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.
@@ -3,6 +3,7 @@
3
3
  "main": "src/main.js",
4
4
  "license": "EUPL v.1.1",
5
5
  "peerDependencies": {
6
- "@ewc-lib/ewc-css-common": "0.1.0"
6
+ "@ewc-lib/ewc-css-common": "0.1.0",
7
+ "@ewc-lib/ewc-dialogs": "5.0.8-beta"
7
8
  }
8
9
  }
@@ -14,7 +14,7 @@ export default class Element extends HTMLElement {
14
14
 
15
15
  connectedCallback(ignoreCheck) {
16
16
  if(this.#isInitialized) { return } else { this.#isInitialized=true }
17
- this.setAttribute("ewc-version", "2.0.3-beta") // please always keep in sync with version in package.json
17
+ this.setAttribute("ewc-version", "2.0.4-beta") // please always keep in sync with version in package.json
18
18
  if(ignoreCheck || this.childElementCount===2) {
19
19
  // please see also comment in html.js
20
20
 
@@ -47,10 +47,11 @@ export function buildURLx(text, hashtags) {
47
47
  let retVal = 'https://twitter.com/intent/tweet'
48
48
  retVal += '?hashtags=' + encodeURIComponent(hashtags)
49
49
  retVal += '&text=' + encodeURIComponent(text)
50
+ const currentLocation = window.location;
50
51
  let rootPath = window.location.protocol + '//' + window.location.host + window.location.pathname
51
52
  const locale = getLocale()
52
53
  if(locale) {
53
- rootPath += '&lang=' + locale
54
+ rootPath += (currentLocation.href.indexOf('?') !== -1 ? "&"+locale : "?"+locale)
54
55
  } else {
55
56
  console.error("ewc-popover-sharing opener: locale not detectable (for X)")
56
57
  }
@@ -83,7 +84,9 @@ export function socialMediaShareEmbedCallback(url, ewcDialog) {
83
84
  }
84
85
  }
85
86
  if(typeof ewcDialog==="object") {
86
- ewcDialog.title = "Embed visualisation"
87
+ const title = document.createElement('template');
88
+ title.innerHTML="Embed visualisation"
89
+ ewcDialog.title = title
87
90
  ewcDialog.bodyHtml = `use this code to embed: iframe width="100%" height="800" src="${url}/index.html" /iframe`
88
91
  ewcDialog.clipboardContent = currentLocation;
89
92
  ewcDialog.visible = true