@weavy/uikit-react 14.0.1 → 14.0.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavy/uikit-react",
3
- "version": "14.0.1",
3
+ "version": "14.0.3",
4
4
  "author": "Weavy",
5
5
  "description": "React UI-kit for Weavy",
6
6
  "homepage": "https://github.com/weavy/weavy-uikit-react",
@@ -27,7 +27,26 @@ const FileBrowser = ({ onFileAdded }: Props) => {
27
27
  }, []);
28
28
 
29
29
  useEffect(() => {
30
- const origin = window.top?.document.location.origin;
30
+ var origin = "";
31
+
32
+ // Get top origin
33
+ try {
34
+ if (window.location.ancestorOrigins && 0 < window.location.ancestorOrigins.length) {
35
+ // Not available in FF, but Google APIs use this
36
+ origin = window.location.ancestorOrigins[window.location.ancestorOrigins.length - 1];
37
+ } else if (window.top) {
38
+ // This may fail due to cors
39
+ origin = window.top.document.location.origin;
40
+ }
41
+ } catch(e) { /* No worries */}
42
+
43
+ if (!origin) {
44
+ try {
45
+ origin = window.self.document.location.origin;
46
+ } catch(e) {
47
+ console.error("Filebrowser: Could not read current origin.");
48
+ }
49
+ }
31
50
 
32
51
  const filebrowserSrc = fileBrowserUrl + "?origin=" + origin + "&v=X&t=" + Date.now().toString() + "&weavyId=wy-filebrowser";
33
52
 
@@ -249,7 +249,7 @@ const PdfViewer = ({ src, pdfCMapsUrl, pdfWorkerUrl }: Props) => {
249
249
  return (
250
250
  <div className="wy-content-pdf" data-controller="pdf" data-pdf-url-value="">
251
251
  <div className="wy-toolbars-bottom">
252
- <nav className="wy-toolbar">
252
+ <nav className="wy-toolbar wy-toolbar-center">
253
253
  <div className="wy-toolbar-buttons">
254
254
  <input type="text" className="wy-input" ref={pageNumberRef} onChange={updatePage} onClick={select} data-pdf-target="pageNumber"/>
255
255
  <span>/</span>