@atlaskit/editor-extension-dropbox 0.3.6 → 0.3.8

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,30 +3,24 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  export default /*#__PURE__*/(function () {
4
4
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appKey) {
5
5
  return _regeneratorRuntime.wrap(function _callee$(_context) {
6
- while (1) {
7
- switch (_context.prev = _context.next) {
8
- case 0:
9
- if (window.Dropbox) {
10
- _context.next = 4;
11
- break;
12
- }
13
-
14
- return _context.abrupt("return", import('./dropboxscript').then(function () {
15
- window.Dropbox.appKey = appKey;
16
- }));
17
-
18
- case 4:
6
+ while (1) switch (_context.prev = _context.next) {
7
+ case 0:
8
+ if (window.Dropbox) {
9
+ _context.next = 4;
10
+ break;
11
+ }
12
+ return _context.abrupt("return", import('./dropboxscript').then(function () {
19
13
  window.Dropbox.appKey = appKey;
20
- return _context.abrupt("return", Promise.resolve());
21
-
22
- case 6:
23
- case "end":
24
- return _context.stop();
25
- }
14
+ }));
15
+ case 4:
16
+ window.Dropbox.appKey = appKey;
17
+ return _context.abrupt("return", Promise.resolve());
18
+ case 6:
19
+ case "end":
20
+ return _context.stop();
26
21
  }
27
22
  }, _callee);
28
23
  }));
29
-
30
24
  return function (_x) {
31
25
  return _ref.apply(this, arguments);
32
26
  };
@@ -5,125 +5,102 @@ import ReactDOM from 'react-dom';
5
5
  import { inlineCard } from '@atlaskit/adf-utils/builders';
6
6
  import enableDropbox from './enable-dropbox';
7
7
  import { POPUP_MOUNTPOINT, DROPBOX_IFRAME_NAME } from './constants';
8
-
9
8
  function pickFromDropbox(_x, _x2) {
10
9
  return _pickFromDropbox.apply(this, arguments);
11
10
  }
12
-
13
11
  function _pickFromDropbox() {
14
12
  _pickFromDropbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(appKey, canMountinIframe) {
15
13
  var popupMountPoint, Modal, files, node, newNodes;
16
14
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
17
- while (1) {
18
- switch (_context2.prev = _context2.next) {
19
- case 0:
20
- _context2.next = 2;
21
- return enableDropbox(appKey);
22
-
23
- case 2:
24
- if (!canMountinIframe) {
25
- _context2.next = 9;
26
- break;
27
- }
28
-
29
- _context2.next = 5;
30
- return import('./modal');
31
-
32
- case 5:
33
- Modal = _context2.sent;
34
- // The decision has been made to simply append our modal to the body
35
- // Using the passed in popupMountPoint has the potential to cause
36
- // problems, and several users pass down document.body anyway
37
- //
38
- // We want to append it and attach it to a new div so we have complete control.
39
- popupMountPoint = document.getElementById(POPUP_MOUNTPOINT);
40
-
41
- if (!popupMountPoint) {
42
- popupMountPoint = document.createElement('div');
43
- popupMountPoint.id = POPUP_MOUNTPOINT;
44
- document.body.appendChild(popupMountPoint);
45
- }
46
-
47
- ReactDOM.render( /*#__PURE__*/React.createElement(Modal.default, {
48
- onClose: function onClose() {}
49
- }), popupMountPoint);
50
-
51
- case 9:
52
- _context2.prev = 9;
53
- _context2.next = 12;
54
- return new Promise(function (resolve, reject) {
55
- window.Dropbox.choose({
56
- iframe: canMountinIframe,
57
- windowName: canMountinIframe ? DROPBOX_IFRAME_NAME : undefined,
58
- success: resolve,
59
- cancel: reject
60
- });
15
+ while (1) switch (_context2.prev = _context2.next) {
16
+ case 0:
17
+ _context2.next = 2;
18
+ return enableDropbox(appKey);
19
+ case 2:
20
+ if (!canMountinIframe) {
21
+ _context2.next = 9;
22
+ break;
23
+ }
24
+ _context2.next = 5;
25
+ return import('./modal');
26
+ case 5:
27
+ Modal = _context2.sent;
28
+ // The decision has been made to simply append our modal to the body
29
+ // Using the passed in popupMountPoint has the potential to cause
30
+ // problems, and several users pass down document.body anyway
31
+ //
32
+ // We want to append it and attach it to a new div so we have complete control.
33
+ popupMountPoint = document.getElementById(POPUP_MOUNTPOINT);
34
+ if (!popupMountPoint) {
35
+ popupMountPoint = document.createElement('div');
36
+ popupMountPoint.id = POPUP_MOUNTPOINT;
37
+ document.body.appendChild(popupMountPoint);
38
+ }
39
+ ReactDOM.render( /*#__PURE__*/React.createElement(Modal.default, {
40
+ onClose: function onClose() {}
41
+ }), popupMountPoint);
42
+ case 9:
43
+ _context2.prev = 9;
44
+ _context2.next = 12;
45
+ return new Promise(function (resolve, reject) {
46
+ window.Dropbox.choose({
47
+ iframe: canMountinIframe,
48
+ windowName: canMountinIframe ? DROPBOX_IFRAME_NAME : undefined,
49
+ success: resolve,
50
+ cancel: reject
61
51
  });
62
-
63
- case 12:
64
- files = _context2.sent;
65
- _context2.next = 19;
52
+ });
53
+ case 12:
54
+ files = _context2.sent;
55
+ _context2.next = 19;
56
+ break;
57
+ case 15:
58
+ _context2.prev = 15;
59
+ _context2.t0 = _context2["catch"](9);
60
+ if (popupMountPoint) {
61
+ ReactDOM.unmountComponentAtNode(popupMountPoint);
62
+ }
63
+ return _context2.abrupt("return");
64
+ case 19:
65
+ if (files.length) {
66
+ _context2.next = 22;
66
67
  break;
67
-
68
- case 15:
69
- _context2.prev = 15;
70
- _context2.t0 = _context2["catch"](9);
71
-
72
- if (popupMountPoint) {
73
- ReactDOM.unmountComponentAtNode(popupMountPoint);
74
- }
75
-
76
- return _context2.abrupt("return");
77
-
78
- case 19:
79
- if (files.length) {
80
- _context2.next = 22;
81
- break;
82
- }
83
-
84
- if (popupMountPoint) {
85
- ReactDOM.unmountComponentAtNode(popupMountPoint);
86
- }
87
-
88
- return _context2.abrupt("return");
89
-
90
- case 22:
91
- newNodes = files.map(function (file) {
92
- return inlineCard({
93
- url: file.link
94
- });
68
+ }
69
+ if (popupMountPoint) {
70
+ ReactDOM.unmountComponentAtNode(popupMountPoint);
71
+ }
72
+ return _context2.abrupt("return");
73
+ case 22:
74
+ newNodes = files.map(function (file) {
75
+ return inlineCard({
76
+ url: file.link
95
77
  });
96
-
97
- if (newNodes.length === 1) {
98
- node = newNodes[0];
99
- } else {
100
- // NOTE: we are not currently passing in `multiselect`, so this is not a possible state,
101
- // but we likely want to allow multiselect in the future so doing some future-proofing
102
- node = {
103
- type: 'paragraph',
104
- content: newNodes
105
- };
106
- }
107
-
108
- if (popupMountPoint) {
109
- ReactDOM.unmountComponentAtNode(popupMountPoint);
110
- }
111
-
112
- return _context2.abrupt("return", node);
113
-
114
- case 26:
115
- case "end":
116
- return _context2.stop();
117
- }
78
+ });
79
+ if (newNodes.length === 1) {
80
+ node = newNodes[0];
81
+ } else {
82
+ // NOTE: we are not currently passing in `multiselect`, so this is not a possible state,
83
+ // but we likely want to allow multiselect in the future so doing some future-proofing
84
+ node = {
85
+ type: 'paragraph',
86
+ content: newNodes
87
+ };
88
+ }
89
+ if (popupMountPoint) {
90
+ ReactDOM.unmountComponentAtNode(popupMountPoint);
91
+ }
92
+ return _context2.abrupt("return", node);
93
+ case 26:
94
+ case "end":
95
+ return _context2.stop();
118
96
  }
119
97
  }, _callee2, null, [[9, 15]]);
120
98
  }));
121
99
  return _pickFromDropbox.apply(this, arguments);
122
100
  }
123
-
124
101
  var manifestFunction = function manifestFunction(_ref) {
125
102
  var appKey = _ref.appKey,
126
- canMountinIframe = _ref.canMountinIframe;
103
+ canMountinIframe = _ref.canMountinIframe;
127
104
  return {
128
105
  title: 'Dropbox',
129
106
  type: 'com.dropbox.fabric',
@@ -131,23 +108,17 @@ var manifestFunction = function manifestFunction(_ref) {
131
108
  description: 'Embed Dropbox file to collaborate with your team',
132
109
  icons: {
133
110
  '16': function _() {
134
- return import(
135
- /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */
136
- './icons/DropboxIcon').then(function (mod) {
111
+ return import( /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */'./icons/DropboxIcon').then(function (mod) {
137
112
  return mod.default;
138
113
  });
139
114
  },
140
115
  '24': function _() {
141
- return import(
142
- /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */
143
- './icons/DropboxIcon').then(function (mod) {
116
+ return import( /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */'./icons/DropboxIcon').then(function (mod) {
144
117
  return mod.default;
145
118
  });
146
119
  },
147
120
  '48': function _() {
148
- return import(
149
- /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */
150
- './icons/DropboxIcon').then(function (mod) {
121
+ return import( /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */'./icons/DropboxIcon').then(function (mod) {
151
122
  return mod.default;
152
123
  });
153
124
  }
@@ -160,38 +131,30 @@ var manifestFunction = function manifestFunction(_ref) {
160
131
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve, reject) {
161
132
  var newNode;
162
133
  return _regeneratorRuntime.wrap(function _callee$(_context) {
163
- while (1) {
164
- switch (_context.prev = _context.next) {
165
- case 0:
166
- _context.prev = 0;
167
- _context.next = 3;
168
- return pickFromDropbox(appKey, canMountinIframe);
169
-
170
- case 3:
171
- newNode = _context.sent;
172
-
173
- if (!newNode) {
174
- reject();
175
- } else {
176
- resolve(newNode);
177
- }
178
-
179
- _context.next = 10;
180
- break;
181
-
182
- case 7:
183
- _context.prev = 7;
184
- _context.t0 = _context["catch"](0);
185
- reject(_context.t0);
186
-
187
- case 10:
188
- case "end":
189
- return _context.stop();
190
- }
134
+ while (1) switch (_context.prev = _context.next) {
135
+ case 0:
136
+ _context.prev = 0;
137
+ _context.next = 3;
138
+ return pickFromDropbox(appKey, canMountinIframe);
139
+ case 3:
140
+ newNode = _context.sent;
141
+ if (!newNode) {
142
+ reject();
143
+ } else {
144
+ resolve(newNode);
145
+ }
146
+ _context.next = 10;
147
+ break;
148
+ case 7:
149
+ _context.prev = 7;
150
+ _context.t0 = _context["catch"](0);
151
+ reject(_context.t0);
152
+ case 10:
153
+ case "end":
154
+ return _context.stop();
191
155
  }
192
156
  }, _callee, null, [[0, 7]]);
193
157
  }));
194
-
195
158
  return function (_x3, _x4) {
196
159
  return _ref2.apply(this, arguments);
197
160
  };
@@ -201,5 +164,4 @@ var manifestFunction = function manifestFunction(_ref) {
201
164
  }
202
165
  };
203
166
  };
204
-
205
167
  export default manifestFunction;
package/dist/esm/modal.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
-
3
2
  /** @jsx jsx */
4
3
  import React, { useState } from 'react';
5
4
  import { jsx, css } from '@emotion/react';
@@ -31,12 +30,10 @@ var spacingDivStyle = {
31
30
  var headingStyle = {
32
31
  marginTop: '8px'
33
32
  };
34
-
35
33
  var Header = function Header() {
36
34
  var _useModal = useModal(),
37
- onClose = _useModal.onClose,
38
- titleId = _useModal.titleId;
39
-
35
+ onClose = _useModal.onClose,
36
+ titleId = _useModal.titleId;
40
37
  return jsx("div", {
41
38
  css: bottomShadow
42
39
  }, jsx("div", {
@@ -52,27 +49,22 @@ var Header = function Header() {
52
49
  onClick: onClose
53
50
  })));
54
51
  };
55
-
56
52
  var Modal = function Modal(_ref) {
57
53
  var _onClose = _ref.onClose,
58
- TEST_ONLY_src = _ref.TEST_ONLY_src,
59
- showModal = _ref.showModal;
60
-
54
+ TEST_ONLY_src = _ref.TEST_ONLY_src,
55
+ showModal = _ref.showModal;
61
56
  var _useState = useState(true),
62
- _useState2 = _slicedToArray(_useState, 2),
63
- isOpen = _useState2[0],
64
- setIsOpen = _useState2[1];
65
-
57
+ _useState2 = _slicedToArray(_useState, 2),
58
+ isOpen = _useState2[0],
59
+ setIsOpen = _useState2[1];
66
60
  if (typeof showModal === 'boolean' && isOpen !== showModal) {
67
61
  setIsOpen(showModal);
68
62
  }
69
-
70
63
  return jsx(ModalTransition, null, isOpen && jsx(ModalDialog, {
71
64
  height: "100%",
72
65
  width: "large",
73
66
  onClose: function onClose() {
74
67
  setIsOpen(false);
75
-
76
68
  _onClose();
77
69
  }
78
70
  }, jsx(Header, null), jsx(AKModalBody, null, jsx(ModalBody, null, TEST_ONLY_src ? jsx("iframe", {
@@ -86,5 +78,4 @@ var Modal = function Modal(_ref) {
86
78
  frameBorder: 0
87
79
  })))));
88
80
  };
89
-
90
81
  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.8",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-extension-dropbox",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "A an atlassian editor extension to add a native dropbox picker",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,9 +24,9 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@atlaskit/adf-utils": "^18.0.0",
28
- "@atlaskit/button": "^16.5.0",
29
- "@atlaskit/editor-common": "^72.0.0",
27
+ "@atlaskit/adf-utils": "^18.1.0",
28
+ "@atlaskit/button": "^16.6.0",
29
+ "@atlaskit/editor-common": "^73.0.0",
30
30
  "@atlaskit/icon": "^21.11.0",
31
31
  "@atlaskit/modal-dialog": "^12.4.0",
32
32
  "@babel/runtime": "^7.0.0",
@@ -47,7 +47,9 @@
47
47
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
48
48
  "techstack": {
49
49
  "@repo/internal": {
50
- "theming": "tokens",
50
+ "design-tokens": [
51
+ "color"
52
+ ],
51
53
  "deprecation": "no-deprecated-imports",
52
54
  "styling": [
53
55
  "emotion"
package/report.api.md CHANGED
@@ -8,6 +8,7 @@
8
8
  ### Table of contents
9
9
 
10
10
  - [Main Entry Types](#main-entry-types)
11
+ - [Peer Dependencies](#peer-dependencies)
11
12
 
12
13
  ### Main Entry Types
13
14
 
@@ -30,3 +31,16 @@ export default manifestFunction;
30
31
  ```
31
32
 
32
33
  <!--SECTION END: Main Entry Types-->
34
+
35
+ ### Peer Dependencies
36
+
37
+ <!--SECTION START: Peer Dependencies-->
38
+
39
+ ```json
40
+ {
41
+ "react": "^16.8.0",
42
+ "react-dom": "^16.8.0"
43
+ }
44
+ ```
45
+
46
+ <!--SECTION END: Peer Dependencies-->