@atlaskit/editor-extension-dropbox 0.3.6 → 0.3.7

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,35 +3,32 @@ import ReactDOM from 'react-dom';
3
3
  import { inlineCard } from '@atlaskit/adf-utils/builders';
4
4
  import enableDropbox from './enable-dropbox';
5
5
  import { POPUP_MOUNTPOINT, DROPBOX_IFRAME_NAME } from './constants';
6
-
7
6
  async function pickFromDropbox(appKey, canMountinIframe) {
8
7
  await enableDropbox(appKey);
9
- let popupMountPoint; // BC - as of 2020-01-21 this does not work, as no dropbox app we have is authorised
8
+ let popupMountPoint;
9
+
10
+ // BC - as of 2020-01-21 this does not work, as no dropbox app we have is authorised
10
11
  // to iframe in the picker - we are currently waiting for permissions.
11
12
  // To test the picker, comment out the ReactDOM render call, and the `iframe` and `winowName` options
12
-
13
13
  if (canMountinIframe) {
14
- let Modal = await import('./modal'); // The decision has been made to simply append our modal to the body
14
+ let Modal = await import('./modal');
15
+
16
+ // The decision has been made to simply append our modal to the body
15
17
  // Using the passed in popupMountPoint has the potential to cause
16
18
  // problems, and several users pass down document.body anyway
17
19
  //
18
20
  // We want to append it and attach it to a new div so we have complete control.
19
-
20
21
  popupMountPoint = document.getElementById(POPUP_MOUNTPOINT);
21
-
22
22
  if (!popupMountPoint) {
23
23
  popupMountPoint = document.createElement('div');
24
24
  popupMountPoint.id = POPUP_MOUNTPOINT;
25
25
  document.body.appendChild(popupMountPoint);
26
26
  }
27
-
28
27
  ReactDOM.render( /*#__PURE__*/React.createElement(Modal.default, {
29
28
  onClose: () => {}
30
29
  }), popupMountPoint);
31
30
  }
32
-
33
31
  let files;
34
-
35
32
  try {
36
33
  files = await new Promise((resolve, reject) => {
37
34
  window.Dropbox.choose({
@@ -45,24 +42,18 @@ async function pickFromDropbox(appKey, canMountinIframe) {
45
42
  if (popupMountPoint) {
46
43
  ReactDOM.unmountComponentAtNode(popupMountPoint);
47
44
  }
48
-
49
45
  return;
50
46
  }
51
-
52
47
  let node;
53
-
54
48
  if (!files.length) {
55
49
  if (popupMountPoint) {
56
50
  ReactDOM.unmountComponentAtNode(popupMountPoint);
57
51
  }
58
-
59
52
  return;
60
53
  }
61
-
62
54
  const newNodes = files.map(file => inlineCard({
63
55
  url: file.link
64
56
  }));
65
-
66
57
  if (newNodes.length === 1) {
67
58
  node = newNodes[0];
68
59
  } else {
@@ -73,14 +64,11 @@ async function pickFromDropbox(appKey, canMountinIframe) {
73
64
  content: newNodes
74
65
  };
75
66
  }
76
-
77
67
  if (popupMountPoint) {
78
68
  ReactDOM.unmountComponentAtNode(popupMountPoint);
79
69
  }
80
-
81
70
  return node;
82
71
  }
83
-
84
72
  const manifestFunction = ({
85
73
  appKey,
86
74
  canMountinIframe
@@ -90,15 +78,9 @@ const manifestFunction = ({
90
78
  key: 'dropbox',
91
79
  description: 'Embed Dropbox file to collaborate with your team',
92
80
  icons: {
93
- '16': () => import(
94
- /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */
95
- './icons/DropboxIcon').then(mod => mod.default),
96
- '24': () => import(
97
- /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */
98
- './icons/DropboxIcon').then(mod => mod.default),
99
- '48': () => import(
100
- /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */
101
- './icons/DropboxIcon').then(mod => mod.default)
81
+ '16': () => import( /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */'./icons/DropboxIcon').then(mod => mod.default),
82
+ '24': () => import( /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */'./icons/DropboxIcon').then(mod => mod.default),
83
+ '48': () => import( /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */'./icons/DropboxIcon').then(mod => mod.default)
102
84
  },
103
85
  modules: {
104
86
  quickInsert: [{
@@ -106,7 +88,6 @@ const manifestFunction = ({
106
88
  action: () => new Promise(async (resolve, reject) => {
107
89
  try {
108
90
  let newNode = await pickFromDropbox(appKey, canMountinIframe);
109
-
110
91
  if (!newNode) {
111
92
  reject();
112
93
  } else {
@@ -119,5 +100,4 @@ const manifestFunction = ({
119
100
  }]
120
101
  }
121
102
  });
122
-
123
103
  export default manifestFunction;
@@ -29,7 +29,6 @@ const spacingDivStyle = {
29
29
  const headingStyle = {
30
30
  marginTop: '8px'
31
31
  };
32
-
33
32
  const Header = () => {
34
33
  const {
35
34
  onClose,
@@ -50,18 +49,15 @@ const Header = () => {
50
49
  onClick: onClose
51
50
  })));
52
51
  };
53
-
54
52
  const Modal = ({
55
53
  onClose,
56
54
  TEST_ONLY_src,
57
55
  showModal
58
56
  }) => {
59
57
  let [isOpen, setIsOpen] = useState(true);
60
-
61
58
  if (typeof showModal === 'boolean' && isOpen !== showModal) {
62
59
  setIsOpen(showModal);
63
60
  }
64
-
65
61
  return jsx(ModalTransition, null, isOpen && jsx(ModalDialog, {
66
62
  height: "100%",
67
63
  width: "large",
@@ -80,5 +76,4 @@ const Modal = ({
80
76
  frameBorder: 0
81
77
  })))));
82
78
  };
83
-
84
79
  export default Modal;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-extension-dropbox",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "sideEffects": false
5
5
  }