@atlaskit/editor-plugin-card 4.5.0 → 4.5.2
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/CHANGELOG.md +17 -0
- package/dist/cjs/{plugin.js → cardPlugin.js} +6 -10
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/nodeviews/blockCard.js +1 -5
- package/dist/cjs/nodeviews/datasource.js +15 -27
- package/dist/cjs/nodeviews/embedCard.js +4 -15
- package/dist/cjs/nodeviews/genericCard.js +18 -20
- package/dist/cjs/nodeviews/inlineCard.js +1 -1
- package/dist/cjs/pm-plugins/doc.js +1 -1
- package/dist/cjs/pm-plugins/main.js +3 -3
- package/dist/cjs/{utils.js → pm-plugins/utils.js} +1 -1
- package/dist/cjs/types/index.js +5 -0
- package/dist/cjs/ui/AwarenessWrapper/index.js +3 -3
- package/dist/cjs/ui/DatasourceAppearanceButton.js +11 -13
- package/dist/cjs/ui/DatasourceModal/ModalWithState.js +17 -11
- package/dist/cjs/ui/EditLinkToolbar.js +1 -1
- package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
- package/dist/cjs/ui/EditToolbarButton/index.js +27 -29
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +1 -1
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/LinkEvents.js +2 -2
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/index.js +5 -25
- package/dist/cjs/ui/LayoutButton/index.js +1 -1
- package/dist/cjs/ui/LayoutButton/utils.js +1 -1
- package/dist/cjs/ui/LinkToolbarAppearance.js +8 -9
- package/dist/cjs/ui/Pulse/index.js +1 -1
- package/dist/cjs/ui/ToolbarViewedEvent.js +8 -10
- package/dist/cjs/ui/WithCardContext.js +14 -0
- package/dist/cjs/{analytics → ui/analytics}/events-from-tr.js +2 -2
- package/dist/cjs/{analytics → ui/analytics}/utils.js +1 -1
- package/dist/cjs/{datasourceErrorBoundary.js → ui/datasourceErrorBoundary.js} +1 -1
- package/dist/cjs/{toolbar.js → ui/toolbar.js} +9 -9
- package/dist/es2019/{plugin.js → cardPlugin.js} +6 -11
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/nodeviews/blockCard.js +1 -5
- package/dist/es2019/nodeviews/datasource.js +15 -27
- package/dist/es2019/nodeviews/embedCard.js +4 -16
- package/dist/es2019/nodeviews/genericCard.js +6 -10
- package/dist/es2019/nodeviews/inlineCard.js +1 -1
- package/dist/es2019/pm-plugins/doc.js +1 -1
- package/dist/es2019/pm-plugins/main.js +3 -3
- package/dist/es2019/{utils.js → pm-plugins/utils.js} +1 -1
- package/dist/es2019/ui/AwarenessWrapper/index.js +3 -3
- package/dist/es2019/ui/DatasourceAppearanceButton.js +4 -5
- package/dist/es2019/ui/DatasourceModal/ModalWithState.js +15 -7
- package/dist/es2019/ui/EditLinkToolbar.js +1 -1
- package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
- package/dist/es2019/ui/EditToolbarButton/index.js +27 -30
- package/dist/es2019/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +1 -1
- package/dist/es2019/ui/EditorLinkingPlatformAnalytics/LinkEvents.js +2 -2
- package/dist/es2019/ui/EditorLinkingPlatformAnalytics/index.js +4 -23
- package/dist/es2019/ui/LayoutButton/index.js +1 -1
- package/dist/es2019/ui/LayoutButton/utils.js +1 -1
- package/dist/es2019/ui/LinkToolbarAppearance.js +6 -9
- package/dist/es2019/ui/Pulse/index.js +1 -1
- package/dist/es2019/ui/ToolbarViewedEvent.js +5 -6
- package/dist/es2019/ui/WithCardContext.js +8 -0
- package/dist/es2019/{analytics → ui/analytics}/events-from-tr.js +2 -2
- package/dist/es2019/{analytics → ui/analytics}/utils.js +1 -1
- package/dist/es2019/{datasourceErrorBoundary.js → ui/datasourceErrorBoundary.js} +1 -1
- package/dist/es2019/{toolbar.js → ui/toolbar.js} +9 -9
- package/dist/esm/{plugin.js → cardPlugin.js} +6 -11
- package/dist/esm/cardPluginType.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/nodeviews/blockCard.js +1 -5
- package/dist/esm/nodeviews/datasource.js +15 -27
- package/dist/esm/nodeviews/embedCard.js +4 -15
- package/dist/esm/nodeviews/genericCard.js +18 -20
- package/dist/esm/nodeviews/inlineCard.js +1 -1
- package/dist/esm/pm-plugins/doc.js +1 -1
- package/dist/esm/pm-plugins/main.js +3 -3
- package/dist/esm/{utils.js → pm-plugins/utils.js} +1 -1
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/ui/AwarenessWrapper/index.js +3 -3
- package/dist/esm/ui/DatasourceAppearanceButton.js +11 -13
- package/dist/esm/ui/DatasourceModal/ModalWithState.js +17 -11
- package/dist/esm/ui/EditLinkToolbar.js +1 -1
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +1 -1
- package/dist/esm/ui/EditToolbarButton/index.js +27 -29
- package/dist/esm/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +1 -1
- package/dist/esm/ui/EditorLinkingPlatformAnalytics/LinkEvents.js +2 -2
- package/dist/esm/ui/EditorLinkingPlatformAnalytics/index.js +5 -25
- package/dist/esm/ui/LayoutButton/index.js +1 -1
- package/dist/esm/ui/LayoutButton/utils.js +1 -1
- package/dist/esm/ui/LinkToolbarAppearance.js +9 -9
- package/dist/esm/ui/Pulse/index.js +1 -1
- package/dist/esm/ui/ToolbarViewedEvent.js +8 -10
- package/dist/esm/ui/WithCardContext.js +7 -0
- package/dist/esm/{analytics → ui/analytics}/events-from-tr.js +2 -2
- package/dist/esm/{analytics → ui/analytics}/utils.js +1 -1
- package/dist/esm/{datasourceErrorBoundary.js → ui/datasourceErrorBoundary.js} +1 -1
- package/dist/esm/{toolbar.js → ui/toolbar.js} +9 -9
- package/dist/types/cardPlugin.d.ts +2 -0
- package/dist/{types-ts4.5/plugin.d.ts → types/cardPluginType.d.ts} +0 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/nodeviews/blockCard.d.ts +0 -4
- package/dist/types/nodeviews/datasource.d.ts +0 -5
- package/dist/types/nodeviews/embedCard.d.ts +0 -5
- package/dist/types/pm-plugins/util/state.d.ts +1 -1
- package/dist/{types-ts4.5 → types/pm-plugins}/utils.d.ts +1 -1
- package/dist/types/{types.d.ts → types/index.d.ts} +3 -3
- package/dist/types/ui/DatasourceAppearanceButton.d.ts +1 -1
- package/dist/types/ui/DatasourceModal/ModalWithState.d.ts +5 -4
- package/dist/types/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types/ui/EditorLinkingPlatformAnalytics/common.d.ts +2 -2
- package/dist/types/ui/EditorLinkingPlatformAnalytics/index.d.ts +1 -6
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +1 -1
- package/dist/types/ui/LayoutButton/utils.d.ts +1 -1
- package/dist/types/ui/LinkToolbarAppearance.d.ts +1 -6
- package/dist/types/ui/WithCardContext.d.ts +5 -0
- package/dist/types/{datasourceErrorBoundary.d.ts → ui/datasourceErrorBoundary.d.ts} +1 -1
- package/dist/{types-ts4.5/common → types/ui}/hooks/useLinkUpgradeDiscoverability.d.ts +1 -1
- package/dist/types/{toolbar.d.ts → ui/toolbar.d.ts} +2 -2
- package/dist/types-ts4.5/cardPlugin.d.ts +2 -0
- package/dist/{types/plugin.d.ts → types-ts4.5/cardPluginType.d.ts} +0 -1
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +0 -4
- package/dist/types-ts4.5/nodeviews/datasource.d.ts +0 -5
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/util/state.d.ts +1 -1
- package/dist/{types → types-ts4.5/pm-plugins}/utils.d.ts +1 -1
- package/dist/types-ts4.5/{types.d.ts → types/index.d.ts} +3 -3
- package/dist/types-ts4.5/ui/DatasourceAppearanceButton.d.ts +1 -1
- package/dist/types-ts4.5/ui/DatasourceModal/ModalWithState.d.ts +5 -4
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/common.d.ts +2 -2
- package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/index.d.ts +1 -6
- package/dist/types-ts4.5/ui/HyperlinkToolbarAppearance.d.ts +1 -1
- package/dist/types-ts4.5/ui/LayoutButton/utils.d.ts +1 -1
- package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +1 -6
- package/dist/types-ts4.5/ui/WithCardContext.d.ts +5 -0
- package/dist/types-ts4.5/{datasourceErrorBoundary.d.ts → ui/datasourceErrorBoundary.d.ts} +1 -1
- package/dist/{types/common → types-ts4.5/ui}/hooks/useLinkUpgradeDiscoverability.d.ts +1 -1
- package/dist/types-ts4.5/{toolbar.d.ts → ui/toolbar.d.ts} +2 -2
- package/package.json +7 -4
- package/dist/cjs/ui/CardContextProvider.js +0 -47
- package/dist/es2019/ui/CardContextProvider.js +0 -22
- package/dist/esm/ui/CardContextProvider.js +0 -40
- package/dist/types/ui/CardContextProvider.d.ts +0 -20
- package/dist/types-ts4.5/ui/CardContextProvider.d.ts +0 -20
- /package/dist/cjs/{types.js → cardPluginType.js} +0 -0
- /package/dist/cjs/{toDOM-fixes → nodeviews/toDOM-fixes}/blockCard.js +0 -0
- /package/dist/cjs/{toDOM-fixes → nodeviews/toDOM-fixes}/embedCard.js +0 -0
- /package/dist/cjs/{toDOM-fixes → nodeviews/toDOM-fixes}/inlineCard.js +0 -0
- /package/dist/cjs/{analytics → ui/analytics}/create-events-queue.js +0 -0
- /package/dist/cjs/{analytics → ui/analytics}/index.js +0 -0
- /package/dist/cjs/{analytics → ui/analytics}/types.js +0 -0
- /package/dist/cjs/{common → ui}/hooks/useLinkUpgradeDiscoverability.js +0 -0
- /package/dist/cjs/{common → ui}/local-storage.js +0 -0
- /package/dist/es2019/{types.js → cardPluginType.js} +0 -0
- /package/dist/es2019/{toDOM-fixes → nodeviews/toDOM-fixes}/blockCard.js +0 -0
- /package/dist/es2019/{toDOM-fixes → nodeviews/toDOM-fixes}/embedCard.js +0 -0
- /package/dist/es2019/{toDOM-fixes → nodeviews/toDOM-fixes}/inlineCard.js +0 -0
- /package/dist/{esm/types.js → es2019/types/index.js} +0 -0
- /package/dist/es2019/{analytics → ui/analytics}/create-events-queue.js +0 -0
- /package/dist/es2019/{analytics → ui/analytics}/index.js +0 -0
- /package/dist/es2019/{analytics → ui/analytics}/types.js +0 -0
- /package/dist/es2019/{common → ui}/hooks/useLinkUpgradeDiscoverability.js +0 -0
- /package/dist/es2019/{common → ui}/local-storage.js +0 -0
- /package/dist/esm/{toDOM-fixes → nodeviews/toDOM-fixes}/blockCard.js +0 -0
- /package/dist/esm/{toDOM-fixes → nodeviews/toDOM-fixes}/embedCard.js +0 -0
- /package/dist/esm/{toDOM-fixes → nodeviews/toDOM-fixes}/inlineCard.js +0 -0
- /package/dist/esm/{analytics → ui/analytics}/create-events-queue.js +0 -0
- /package/dist/esm/{analytics → ui/analytics}/index.js +0 -0
- /package/dist/esm/{analytics → ui/analytics}/types.js +0 -0
- /package/dist/esm/{common → ui}/hooks/useLinkUpgradeDiscoverability.js +0 -0
- /package/dist/esm/{common → ui}/local-storage.js +0 -0
- /package/dist/types/{toDOM-fixes → nodeviews/toDOM-fixes}/blockCard.d.ts +0 -0
- /package/dist/types/{toDOM-fixes → nodeviews/toDOM-fixes}/embedCard.d.ts +0 -0
- /package/dist/types/{toDOM-fixes → nodeviews/toDOM-fixes}/inlineCard.d.ts +0 -0
- /package/dist/types/{analytics → ui/analytics}/create-events-queue.d.ts +0 -0
- /package/dist/types/{analytics → ui/analytics}/events-from-tr.d.ts +0 -0
- /package/dist/types/{analytics → ui/analytics}/index.d.ts +0 -0
- /package/dist/types/{analytics → ui/analytics}/types.d.ts +0 -0
- /package/dist/types/{analytics → ui/analytics}/utils.d.ts +0 -0
- /package/dist/types/{common → ui}/local-storage.d.ts +0 -0
- /package/dist/types-ts4.5/{toDOM-fixes → nodeviews/toDOM-fixes}/blockCard.d.ts +0 -0
- /package/dist/types-ts4.5/{toDOM-fixes → nodeviews/toDOM-fixes}/embedCard.d.ts +0 -0
- /package/dist/types-ts4.5/{toDOM-fixes → nodeviews/toDOM-fixes}/inlineCard.d.ts +0 -0
- /package/dist/types-ts4.5/{analytics → ui/analytics}/create-events-queue.d.ts +0 -0
- /package/dist/types-ts4.5/{analytics → ui/analytics}/events-from-tr.d.ts +0 -0
- /package/dist/types-ts4.5/{analytics → ui/analytics}/index.d.ts +0 -0
- /package/dist/types-ts4.5/{analytics → ui/analytics}/types.d.ts +0 -0
- /package/dist/types-ts4.5/{analytics → ui/analytics}/utils.d.ts +0 -0
- /package/dist/types-ts4.5/{common → ui}/local-storage.d.ts +0 -0
|
@@ -10,9 +10,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
10
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
13
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
var
|
|
14
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
16
15
|
var _EditorAnalyticsContext = require("../EditorAnalyticsContext");
|
|
17
16
|
var _DatasourceEvents = require("./DatasourceEvents");
|
|
18
17
|
var _LinkEvents = require("./LinkEvents");
|
|
@@ -28,30 +27,11 @@ var EditorLinkingPlatformAnalytics = exports.EditorLinkingPlatformAnalytics = /*
|
|
|
28
27
|
}
|
|
29
28
|
(0, _createClass2.default)(EditorLinkingPlatformAnalytics, [{
|
|
30
29
|
key: "render",
|
|
31
|
-
value:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function render() {
|
|
35
|
-
var _this$context;
|
|
36
|
-
var cardContext = (_this$context = this.context) === null || _this$context === void 0 || (_this$context = _this$context.contextAdapter) === null || _this$context === void 0 ? void 0 : _this$context.card;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The analytics hook needs to be able to communicate with the card context
|
|
40
|
-
* If we can't access it, don't mount the event bindings
|
|
41
|
-
* This effectively entirely disables all tracking behaviour
|
|
42
|
-
*/
|
|
43
|
-
if (!(cardContext !== null && cardContext !== void 0 && cardContext.value)) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement(cardContext.Provider, {
|
|
47
|
-
value: cardContext.value
|
|
48
|
-
}, /*#__PURE__*/_react.default.createElement(_EditorAnalyticsContext.EditorAnalyticsContext, {
|
|
30
|
+
value: function render() {
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_linkProvider.EditorSmartCardProvider, null, /*#__PURE__*/_react.default.createElement(_linkProvider.EditorSmartCardProviderValueGuard, null, /*#__PURE__*/_react.default.createElement(_EditorAnalyticsContext.EditorAnalyticsContext, {
|
|
49
32
|
editorView: this.props.editorView
|
|
50
|
-
}, /*#__PURE__*/_react.default.createElement(_LinkEvents.LinkEventsBinding, this.props), /*#__PURE__*/_react.default.createElement(_DatasourceEvents.DatasourceEventsBinding, this.props)));
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement(_LinkEvents.LinkEventsBinding, this.props), /*#__PURE__*/_react.default.createElement(_DatasourceEvents.DatasourceEventsBinding, this.props))));
|
|
51
34
|
}
|
|
52
35
|
}]);
|
|
53
36
|
return EditorLinkingPlatformAnalytics;
|
|
54
|
-
}(_react.default.PureComponent);
|
|
55
|
-
(0, _defineProperty2.default)(EditorLinkingPlatformAnalytics, "contextTypes", {
|
|
56
|
-
contextAdapter: _propTypes.default.object
|
|
57
|
-
});
|
|
37
|
+
}(_react.default.PureComponent);
|
|
@@ -18,7 +18,7 @@ var _expand = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/expand
|
|
|
18
18
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
19
19
|
var _colors = require("@atlaskit/theme/colors");
|
|
20
20
|
var _actions = require("../../pm-plugins/actions");
|
|
21
|
-
var _utils2 = require("../../utils");
|
|
21
|
+
var _utils2 = require("../../pm-plugins/utils");
|
|
22
22
|
var _utils3 = require("./utils");
|
|
23
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.isDatasourceTableLayout = exports.getDatasource = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
|
-
var _utils2 = require("../../utils");
|
|
10
|
+
var _utils2 = require("../../pm-plugins/utils");
|
|
11
11
|
var _types = require("./types");
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -14,18 +14,18 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
17
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
19
18
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
20
19
|
var _card = require("@atlaskit/editor-common/card");
|
|
21
20
|
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
22
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
23
22
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
24
|
-
var _localStorage = require("../common/local-storage");
|
|
25
23
|
var _doc = require("../pm-plugins/doc");
|
|
26
|
-
var
|
|
27
|
-
var
|
|
24
|
+
var _utils2 = require("../pm-plugins/utils");
|
|
25
|
+
var _localStorage = require("./local-storage");
|
|
28
26
|
var _Pulse = require("./Pulse");
|
|
27
|
+
var _toolbar = require("./toolbar");
|
|
28
|
+
var _WithCardContext = require("./WithCardContext");
|
|
29
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
30
30
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
31
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -146,16 +146,15 @@ var LinkToolbarAppearance = exports.LinkToolbarAppearance = /*#__PURE__*/functio
|
|
|
146
146
|
(0, _createClass2.default)(LinkToolbarAppearance, [{
|
|
147
147
|
key: "render",
|
|
148
148
|
value: function render() {
|
|
149
|
-
var
|
|
149
|
+
var _this2 = this;
|
|
150
150
|
var editorView = this.props.editorView;
|
|
151
|
-
return
|
|
151
|
+
return /*#__PURE__*/_react.default.createElement(_WithCardContext.WithCardContext, null, function (cardContext) {
|
|
152
|
+
return _this2.renderDropdown(editorView, cardContext && cardContext.value);
|
|
153
|
+
});
|
|
152
154
|
}
|
|
153
155
|
}]);
|
|
154
156
|
return LinkToolbarAppearance;
|
|
155
157
|
}(_react.default.Component);
|
|
156
|
-
(0, _defineProperty2.default)(LinkToolbarAppearance, "contextTypes", {
|
|
157
|
-
contextAdapter: _propTypes.default.object
|
|
158
|
-
});
|
|
159
158
|
var getUnavailableMessage = function getUnavailableMessage(state, intl) {
|
|
160
159
|
try {
|
|
161
160
|
var parentNode = state.selection.$from.node(1);
|
|
@@ -8,7 +8,7 @@ exports.DiscoveryPulse = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
|
|
10
10
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
11
|
-
var _localStorage = require("
|
|
11
|
+
var _localStorage = require("../local-storage");
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
14
|
var DiscoveryPulse = exports.DiscoveryPulse = function DiscoveryPulse(_ref) {
|
|
@@ -9,8 +9,8 @@ exports.ToolbarViewedEvent = void 0;
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
13
|
+
var _utils = require("../pm-plugins/utils");
|
|
14
14
|
var _EditorAnalyticsContext = require("./EditorAnalyticsContext");
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -47,14 +47,12 @@ var ToolbarViewedEvent = exports.ToolbarViewedEvent = function ToolbarViewedEven
|
|
|
47
47
|
var url = _ref2.url,
|
|
48
48
|
display = _ref2.display,
|
|
49
49
|
editorView = _ref2.editorView;
|
|
50
|
+
var cardContext = (0, _linkProvider.useSmartLinkContext)();
|
|
50
51
|
return /*#__PURE__*/_react.default.createElement(_EditorAnalyticsContext.EditorAnalyticsContext, {
|
|
51
52
|
editorView: editorView
|
|
52
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
cardContext: cardContext
|
|
58
|
-
}) : null;
|
|
59
|
-
}));
|
|
53
|
+
}, url ? /*#__PURE__*/_react.default.createElement(ToolbarViewedEventBase, {
|
|
54
|
+
url: url,
|
|
55
|
+
display: display,
|
|
56
|
+
cardContext: cardContext
|
|
57
|
+
}) : null);
|
|
60
58
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.WithCardContext = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _linkProvider = require("@atlaskit/link-provider");
|
|
10
|
+
var WithCardContext = exports.WithCardContext = function WithCardContext(_ref) {
|
|
11
|
+
var children = _ref.children;
|
|
12
|
+
var cardContext = (0, _linkProvider.useSmartCardContext)();
|
|
13
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children(cardContext));
|
|
14
|
+
};
|
|
@@ -14,8 +14,8 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
14
14
|
var _card = require("@atlaskit/editor-common/card");
|
|
15
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
16
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
17
|
-
var _pluginKey = require("
|
|
18
|
-
var _state = require("
|
|
17
|
+
var _pluginKey = require("../../pm-plugins/plugin-key");
|
|
18
|
+
var _state = require("../../pm-plugins/util/state");
|
|
19
19
|
var _types = require("./types");
|
|
20
20
|
var _utils2 = require("./utils");
|
|
21
21
|
/**
|
|
@@ -9,7 +9,7 @@ exports.getNodeSubject = getNodeSubject;
|
|
|
9
9
|
exports.getUrl = getUrl;
|
|
10
10
|
exports.isDatasourceNode = isDatasourceNode;
|
|
11
11
|
exports.isLinkNode = void 0;
|
|
12
|
-
var _utils = require("
|
|
12
|
+
var _utils = require("../../pm-plugins/utils");
|
|
13
13
|
var _types = require("./types");
|
|
14
14
|
function isDatasourceNode(node) {
|
|
15
15
|
return 'datasource' in node.attrs && !!node.attrs.datasource;
|
|
@@ -15,7 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
17
17
|
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
18
|
-
var _doc = require("
|
|
18
|
+
var _doc = require("../pm-plugins/doc");
|
|
19
19
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
20
20
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @repo/internal/react/no-class-components */
|
|
21
21
|
var DatasourceErrorBoundary = exports.DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
@@ -29,15 +29,15 @@ var _settings2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/set
|
|
|
29
29
|
var _unlink = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/unlink"));
|
|
30
30
|
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
31
31
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
32
|
-
var _doc = require("
|
|
33
|
-
var _main = require("
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
32
|
+
var _doc = require("../pm-plugins/doc");
|
|
33
|
+
var _main = require("../pm-plugins/main");
|
|
34
|
+
var _utils3 = require("../pm-plugins/utils");
|
|
35
|
+
var _DatasourceAppearanceButton = require("./DatasourceAppearanceButton");
|
|
36
|
+
var _EditLinkToolbar = require("./EditLinkToolbar");
|
|
37
|
+
var _EditToolbarButton = require("./EditToolbarButton");
|
|
38
|
+
var _HyperlinkToolbarAppearance = require("./HyperlinkToolbarAppearance");
|
|
39
|
+
var _LinkToolbarAppearance = require("./LinkToolbarAppearance");
|
|
40
|
+
var _ToolbarViewedEvent = require("./ToolbarViewedEvent");
|
|
41
41
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
42
42
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
43
43
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -3,26 +3,21 @@ import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
3
3
|
import { IconDatasourceAssetsObjects, IconDatasourceConfluenceSearch, IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
|
|
4
4
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, CONFLUENCE_SEARCH_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
6
|
-
import {
|
|
6
|
+
import { blockCardSpecWithFixedToDOM } from './nodeviews/toDOM-fixes/blockCard';
|
|
7
|
+
import { embedCardSpecWithFixedToDOM } from './nodeviews/toDOM-fixes/embedCard';
|
|
8
|
+
import { inlineCardSpecWithFixedToDOM } from './nodeviews/toDOM-fixes/inlineCard';
|
|
7
9
|
import { hideLinkToolbar, setProvider, showDatasourceModal } from './pm-plugins/actions';
|
|
8
10
|
import { queueCardsFromChangedTr } from './pm-plugins/doc';
|
|
9
11
|
import { cardKeymap } from './pm-plugins/keymap';
|
|
10
12
|
import { createPlugin } from './pm-plugins/main';
|
|
11
13
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { inlineCardSpecWithFixedToDOM } from './toDOM-fixes/inlineCard';
|
|
15
|
-
import { floatingToolbar, getEndingToolbarItems, getStartingToolbarItems } from './toolbar';
|
|
14
|
+
import { isDatasourceConfigEditable } from './pm-plugins/utils';
|
|
15
|
+
import { createEventsQueue } from './ui/analytics/create-events-queue';
|
|
16
16
|
import DatasourceModalWithState from './ui/DatasourceModal/ModalWithState';
|
|
17
17
|
import { EditorLinkingPlatformAnalytics } from './ui/EditorLinkingPlatformAnalytics';
|
|
18
18
|
import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
|
|
19
19
|
import LayoutButton from './ui/LayoutButton';
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
// Dummpy type of AnnotationPlugin
|
|
23
|
-
// This is used to avoid editor universal preset's inferred type maximum length error
|
|
24
|
-
// TODO: Remove this when the issue is fixed
|
|
25
|
-
|
|
20
|
+
import { floatingToolbar, getEndingToolbarItems, getStartingToolbarItems } from './ui/toolbar';
|
|
26
21
|
export const cardPlugin = ({
|
|
27
22
|
config: options = {},
|
|
28
23
|
api
|
package/dist/es2019/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { cardPlugin } from './
|
|
1
|
+
export { cardPlugin } from './cardPlugin';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import rafSchedule from 'raf-schd';
|
|
5
4
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
6
5
|
import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
@@ -9,7 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
9
8
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
10
9
|
import { Datasource } from '../nodeviews/datasource';
|
|
11
10
|
import { registerCard } from '../pm-plugins/actions';
|
|
12
|
-
import { isDatasourceNode } from '../utils';
|
|
11
|
+
import { isDatasourceNode } from '../pm-plugins/utils';
|
|
13
12
|
import { Card } from './genericCard';
|
|
14
13
|
|
|
15
14
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -94,9 +93,6 @@ export class BlockCardComponent extends React.PureComponent {
|
|
|
94
93
|
}, cardInner) : data ? cardInner : null);
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
|
-
_defineProperty(BlockCardComponent, "contextTypes", {
|
|
98
|
-
contextAdapter: PropTypes.object
|
|
99
|
-
});
|
|
100
96
|
const WrappedBlockCard = Card(BlockCardComponent, UnsupportedBlock);
|
|
101
97
|
export class BlockCard extends ReactNodeView {
|
|
102
98
|
constructor(...args) {
|
|
@@ -7,15 +7,15 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
10
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
12
11
|
import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
13
12
|
import { UnsupportedInline } from '@atlaskit/editor-common/ui';
|
|
14
13
|
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
15
14
|
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
15
|
+
import { EditorSmartCardProvider, EditorSmartCardProviderValueGuard } from '@atlaskit/link-provider';
|
|
16
16
|
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
|
-
import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
|
|
18
|
+
import { DatasourceErrorBoundary } from '../ui/datasourceErrorBoundary';
|
|
19
19
|
import { EditorAnalyticsContext } from '../ui/EditorAnalyticsContext';
|
|
20
20
|
const getPosSafely = pos => {
|
|
21
21
|
if (!pos || typeof pos === 'boolean') {
|
|
@@ -29,8 +29,6 @@ const getPosSafely = pos => {
|
|
|
29
29
|
};
|
|
30
30
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
31
31
|
export class DatasourceComponent extends React.PureComponent {
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
|
|
34
32
|
constructor(props) {
|
|
35
33
|
super(props);
|
|
36
34
|
_defineProperty(this, "getDatasource", () => this.props.node.attrs.datasource);
|
|
@@ -148,7 +146,6 @@ export class DatasourceComponent extends React.PureComponent {
|
|
|
148
146
|
};
|
|
149
147
|
}
|
|
150
148
|
render() {
|
|
151
|
-
const cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
|
|
152
149
|
const datasource = this.getDatasource();
|
|
153
150
|
const attrs = this.props.node.attrs;
|
|
154
151
|
const tableView = this.getTableView();
|
|
@@ -158,32 +155,23 @@ export class DatasourceComponent extends React.PureComponent {
|
|
|
158
155
|
columnCustomSizes,
|
|
159
156
|
wrappedColumnKeys
|
|
160
157
|
} = this.getColumnsInfo();
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
onColumnResize: this.handleColumnResize,
|
|
175
|
-
columnCustomSizes: columnCustomSizes,
|
|
176
|
-
onWrappedColumnChange: this.handleWrappedColumnChange,
|
|
177
|
-
wrappedColumnKeys: wrappedColumnKeys
|
|
178
|
-
})));
|
|
179
|
-
}
|
|
158
|
+
return jsx(EditorSmartCardProviderValueGuard, null, jsx(EditorAnalyticsContext, {
|
|
159
|
+
editorView: this.props.view
|
|
160
|
+
}, jsx(EditorSmartCardProvider, null, jsx(DatasourceTableView, {
|
|
161
|
+
datasourceId: datasource.id,
|
|
162
|
+
parameters: datasource.parameters,
|
|
163
|
+
visibleColumnKeys: visibleColumnKeys,
|
|
164
|
+
onVisibleColumnKeysChange: this.handleColumnChange,
|
|
165
|
+
url: attrs === null || attrs === void 0 ? void 0 : attrs.url,
|
|
166
|
+
onColumnResize: this.handleColumnResize,
|
|
167
|
+
columnCustomSizes: columnCustomSizes,
|
|
168
|
+
onWrappedColumnChange: this.handleWrappedColumnChange,
|
|
169
|
+
wrappedColumnKeys: wrappedColumnKeys
|
|
170
|
+
}))));
|
|
180
171
|
}
|
|
181
172
|
return null;
|
|
182
173
|
}
|
|
183
174
|
}
|
|
184
|
-
_defineProperty(DatasourceComponent, "contextTypes", {
|
|
185
|
-
contextAdapter: PropTypes.object
|
|
186
|
-
});
|
|
187
175
|
export class Datasource extends ReactNodeView {
|
|
188
176
|
constructor(props) {
|
|
189
177
|
var _props$pluginInjectio, _props$pluginInjectio2, _sharedState$currentS;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
4
|
import rafSchedule from 'raf-schd';
|
|
6
5
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
7
6
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
@@ -143,8 +142,9 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
143
142
|
})(view.state.tr));
|
|
144
143
|
})();
|
|
145
144
|
try {
|
|
146
|
-
|
|
147
|
-
const
|
|
145
|
+
var _this$props$cardConte, _this$props$cardConte2;
|
|
146
|
+
const cardContext = (_this$props$cardConte = this.props.cardContext) !== null && _this$props$cardConte !== void 0 && _this$props$cardConte.value ? (_this$props$cardConte2 = this.props.cardContext) === null || _this$props$cardConte2 === void 0 ? void 0 : _this$props$cardConte2.value : undefined;
|
|
147
|
+
const hasPreview = url && cardContext && cardContext.extractors.getPreview(url, 'web');
|
|
148
148
|
if (!hasPreview) {
|
|
149
149
|
this.setState({
|
|
150
150
|
hasPreview: false
|
|
@@ -240,13 +240,9 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
240
240
|
});
|
|
241
241
|
this.scrollContainer = findOverflowScrollParent(props.view.dom) || undefined;
|
|
242
242
|
}
|
|
243
|
-
|
|
244
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
245
|
-
|
|
246
243
|
render() {
|
|
247
244
|
const {
|
|
248
245
|
node,
|
|
249
|
-
cardContext,
|
|
250
246
|
allowResizing,
|
|
251
247
|
fullWidthMode,
|
|
252
248
|
view,
|
|
@@ -298,7 +294,7 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
298
294
|
embedIframeRef: this.embedIframeRef,
|
|
299
295
|
actionOptions: actionOptions
|
|
300
296
|
});
|
|
301
|
-
|
|
297
|
+
return /*#__PURE__*/React.createElement(EmbedResizeMessageListener, {
|
|
302
298
|
embedIframeRef: this.embedIframeRef,
|
|
303
299
|
onHeightUpdate: this.onHeightUpdate
|
|
304
300
|
}, /*#__PURE__*/React.createElement(CardInner, {
|
|
@@ -317,16 +313,8 @@ export class EmbedCardComponent extends React.PureComponent {
|
|
|
317
313
|
cardProps: cardProps,
|
|
318
314
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
319
315
|
}));
|
|
320
|
-
|
|
321
|
-
// [WS-2307]: we only render card wrapped into a Provider when the value is ready
|
|
322
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, cardContext && cardContext.value ? /*#__PURE__*/React.createElement(cardContext.Provider, {
|
|
323
|
-
value: cardContext.value
|
|
324
|
-
}, cardInner) : null);
|
|
325
316
|
}
|
|
326
317
|
}
|
|
327
|
-
_defineProperty(EmbedCardComponent, "contextTypes", {
|
|
328
|
-
contextAdapter: PropTypes.object
|
|
329
|
-
});
|
|
330
318
|
const WrappedBlockCard = Card(EmbedCardComponent, UnsupportedBlock);
|
|
331
319
|
export class EmbedCard extends ReactNodeView {
|
|
332
320
|
constructor(...args) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React, { useCallback } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
4
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
6
5
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
7
6
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
@@ -9,7 +8,8 @@ import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
|
|
|
9
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
|
|
11
10
|
import { getPluginState } from '../pm-plugins/util/state';
|
|
12
|
-
import { titleUrlPairFromNode } from '../utils';
|
|
11
|
+
import { titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
12
|
+
import { WithCardContext } from '../ui/WithCardContext';
|
|
13
13
|
const WithClickHandler = ({
|
|
14
14
|
pluginInjectionApi,
|
|
15
15
|
url,
|
|
@@ -52,8 +52,7 @@ const WithClickHandler = ({
|
|
|
52
52
|
}));
|
|
53
53
|
};
|
|
54
54
|
export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
55
|
-
|
|
56
|
-
return _class = class extends React.Component {
|
|
55
|
+
return class extends React.Component {
|
|
57
56
|
constructor(...args) {
|
|
58
57
|
super(...args);
|
|
59
58
|
_defineProperty(this, "state", {
|
|
@@ -84,7 +83,6 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
84
83
|
return /*#__PURE__*/React.createElement(UnsupportedComponent, null);
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
|
-
const cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
|
|
88
86
|
const editorAppearance = (_getPluginState = getPluginState(this.props.view.state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.editorAppearance;
|
|
89
87
|
const analyticsEditorAppearance = getAnalyticsEditorAppearance(editorAppearance);
|
|
90
88
|
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
@@ -102,12 +100,12 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
102
100
|
__livePage: this.props.__livePage
|
|
103
101
|
}, ({
|
|
104
102
|
onClick
|
|
105
|
-
}) => /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
|
|
103
|
+
}) => /*#__PURE__*/React.createElement(WithCardContext, null, cardContext => /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
|
|
106
104
|
key: url,
|
|
107
105
|
cardContext: cardContext
|
|
108
106
|
}, this.props, {
|
|
109
107
|
onClick: onClick
|
|
110
|
-
}))));
|
|
108
|
+
})))));
|
|
111
109
|
}
|
|
112
110
|
componentDidCatch(error) {
|
|
113
111
|
const maybeAPIError = error;
|
|
@@ -142,7 +140,5 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
142
140
|
});
|
|
143
141
|
}
|
|
144
142
|
}
|
|
145
|
-
}
|
|
146
|
-
contextAdapter: PropTypes.object
|
|
147
|
-
}), _class;
|
|
143
|
+
};
|
|
148
144
|
}
|
|
@@ -8,8 +8,8 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
10
10
|
import { registerCard } from '../pm-plugins/actions';
|
|
11
|
+
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
11
12
|
import OverlayWrapper from '../ui/ConfigureOverlay';
|
|
12
|
-
import { getAwarenessProps } from '../utils';
|
|
13
13
|
import { Card } from './genericCard';
|
|
14
14
|
import { InlineCardWithAwareness } from './inlineCardWithAwareness';
|
|
15
15
|
export const InlineCard = /*#__PURE__*/memo(({
|
|
@@ -6,10 +6,10 @@ import { getAnnotationMarksForPos, getLinkCreationAnalyticsEvent, isFromCurrentD
|
|
|
6
6
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
7
7
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { appearanceForNodeType, isDatasourceConfigEditable, isDatasourceNode, selectedCardAppearance } from '../utils';
|
|
10
9
|
import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
|
|
11
10
|
import { pluginKey } from './plugin-key';
|
|
12
11
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
12
|
+
import { appearanceForNodeType, isDatasourceConfigEditable, isDatasourceNode, selectedCardAppearance } from './utils';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Attempt to replace the link into the respective card.
|
|
@@ -6,19 +6,19 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
6
6
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { eventsFromTransaction } from '../analytics/events-from-tr';
|
|
10
|
-
import { isLocalStorageKeyDiscovered } from '../common/local-storage';
|
|
11
9
|
import { InlineCardNodeView } from '../nodeviews/inlineCard';
|
|
12
10
|
import { lazyBlockCardView } from '../nodeviews/lazy-block-card';
|
|
13
11
|
import { lazyEmbedCardView } from '../nodeviews/lazy-embed-card';
|
|
14
12
|
import { lazyInlineCardView } from '../nodeviews/lazy-inline-card';
|
|
13
|
+
import { eventsFromTransaction } from '../ui/analytics/events-from-tr';
|
|
15
14
|
import { isDatasourceTableLayout } from '../ui/LayoutButton/utils';
|
|
16
|
-
import {
|
|
15
|
+
import { isLocalStorageKeyDiscovered } from '../ui/local-storage';
|
|
17
16
|
import { clearOverlayCandidate, setCardLayoutAndDatasourceTableRef, setDatasourceTableRef } from './actions';
|
|
18
17
|
import { pluginKey } from './plugin-key';
|
|
19
18
|
import reducer from './reducers';
|
|
20
19
|
import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
21
20
|
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
21
|
+
import { isBlockSupportedAtPosition, isEmbedSupportedAtPosition } from './utils';
|
|
22
22
|
export { pluginKey } from './plugin-key';
|
|
23
23
|
const LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
|
|
24
24
|
export const ALLOW_EVENTS_CLASSNAME = 'card-plugin-element-allow-events';
|
|
@@ -2,7 +2,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
|
|
4
4
|
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, CONFLUENCE_SEARCH_DATASOURCE_ID, JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
5
|
-
import { pluginKey } from './
|
|
5
|
+
import { pluginKey } from './plugin-key';
|
|
6
6
|
export const appearanceForNodeType = spec => {
|
|
7
7
|
if (spec.name === 'inlineCard') {
|
|
8
8
|
return 'inline';
|
|
@@ -7,10 +7,10 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { getResolvedAttributesFromStore } from '../../utils';
|
|
10
|
+
import { getResolvedAttributesFromStore } from '../../pm-plugins/utils';
|
|
11
|
+
import useLinkUpgradeDiscoverability from '../hooks/useLinkUpgradeDiscoverability';
|
|
13
12
|
import InlineCardOverlay from '../InlineCardOverlay';
|
|
13
|
+
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../local-storage';
|
|
14
14
|
import { DiscoveryPulse } from '../Pulse';
|
|
15
15
|
// editor adds a standard line-height that is bigger than an inline smart link
|
|
16
16
|
// due to that the link has a bit of white space around it, which doesn't look right when there is pulse around it
|
|
@@ -11,10 +11,10 @@ import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
|
11
11
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
12
12
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { buildDatasourceAdf } from '@atlaskit/link-datasource';
|
|
14
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
14
15
|
import { Flex } from '@atlaskit/primitives';
|
|
15
16
|
import { updateCardViaDatasource } from '../pm-plugins/doc';
|
|
16
17
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
17
|
-
import { CardContextProvider } from './CardContextProvider';
|
|
18
18
|
import { DatasourceIcon } from './DatasourceIcon';
|
|
19
19
|
import { useFetchDatasourceInfo } from './useFetchDatasourceInfo';
|
|
20
20
|
const buttonStyles = css({
|
|
@@ -108,9 +108,8 @@ export const DatasourceAppearanceButton = ({
|
|
|
108
108
|
selected,
|
|
109
109
|
inputMethod
|
|
110
110
|
}) => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}) => jsx(DatasourceAppearanceButtonWithCardContext, {
|
|
111
|
+
const cardContext = useSmartLinkContext();
|
|
112
|
+
return jsx(DatasourceAppearanceButtonWithCardContext, {
|
|
114
113
|
url: url,
|
|
115
114
|
intl: intl,
|
|
116
115
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
@@ -119,5 +118,5 @@ export const DatasourceAppearanceButton = ({
|
|
|
119
118
|
cardContext: cardContext,
|
|
120
119
|
selected: selected,
|
|
121
120
|
inputMethod: inputMethod
|
|
122
|
-
})
|
|
121
|
+
});
|
|
123
122
|
};
|