@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
|
@@ -9,7 +9,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
9
9
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
import React, { useCallback } from 'react';
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
12
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
14
13
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
15
14
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
@@ -17,7 +16,8 @@ import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
|
|
|
17
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
17
|
import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
|
|
19
18
|
import { getPluginState } from '../pm-plugins/util/state';
|
|
20
|
-
import { titleUrlPairFromNode } from '../utils';
|
|
19
|
+
import { titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
20
|
+
import { WithCardContext } from '../ui/WithCardContext';
|
|
21
21
|
var WithClickHandler = function WithClickHandler(_ref) {
|
|
22
22
|
var pluginInjectionApi = _ref.pluginInjectionApi,
|
|
23
23
|
url = _ref.url,
|
|
@@ -58,13 +58,12 @@ var WithClickHandler = function WithClickHandler(_ref) {
|
|
|
58
58
|
}));
|
|
59
59
|
};
|
|
60
60
|
export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
function _class() {
|
|
61
|
+
return /*#__PURE__*/function (_React$Component) {
|
|
62
|
+
_inherits(_class2, _React$Component);
|
|
63
|
+
var _super = _createSuper(_class2);
|
|
64
|
+
function _class2() {
|
|
66
65
|
var _this;
|
|
67
|
-
_classCallCheck(this,
|
|
66
|
+
_classCallCheck(this, _class2);
|
|
68
67
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
69
68
|
args[_key] = arguments[_key];
|
|
70
69
|
}
|
|
@@ -74,7 +73,7 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
74
73
|
});
|
|
75
74
|
return _this;
|
|
76
75
|
}
|
|
77
|
-
_createClass(
|
|
76
|
+
_createClass(_class2, [{
|
|
78
77
|
key: "render",
|
|
79
78
|
value: function render() {
|
|
80
79
|
var _getPluginState,
|
|
@@ -99,7 +98,6 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
99
98
|
return /*#__PURE__*/React.createElement(UnsupportedComponent, null);
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
|
-
var cardContext = this.context.contextAdapter ? this.context.contextAdapter.card : undefined;
|
|
103
101
|
var editorAppearance = (_getPluginState = getPluginState(this.props.view.state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.editorAppearance;
|
|
104
102
|
var analyticsEditorAppearance = getAnalyticsEditorAppearance(editorAppearance);
|
|
105
103
|
return /*#__PURE__*/React.createElement(AnalyticsContext, {
|
|
@@ -117,12 +115,14 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
117
115
|
__livePage: this.props.__livePage
|
|
118
116
|
}, function (_ref2) {
|
|
119
117
|
var onClick = _ref2.onClick;
|
|
120
|
-
return /*#__PURE__*/React.createElement(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
return /*#__PURE__*/React.createElement(WithCardContext, null, function (cardContext) {
|
|
119
|
+
return /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
|
|
120
|
+
key: url,
|
|
121
|
+
cardContext: cardContext
|
|
122
|
+
}, _this2.props, {
|
|
123
|
+
onClick: onClick
|
|
124
|
+
}));
|
|
125
|
+
});
|
|
126
126
|
}));
|
|
127
127
|
}
|
|
128
128
|
}, {
|
|
@@ -159,8 +159,6 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}]);
|
|
162
|
-
return
|
|
163
|
-
}(React.Component)
|
|
164
|
-
contextAdapter: PropTypes.object
|
|
165
|
-
}), _class;
|
|
162
|
+
return _class2;
|
|
163
|
+
}(React.Component);
|
|
166
164
|
}
|
|
@@ -9,8 +9,8 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
11
11
|
import { registerCard } from '../pm-plugins/actions';
|
|
12
|
+
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
12
13
|
import OverlayWrapper from '../ui/ConfigureOverlay';
|
|
13
|
-
import { getAwarenessProps } from '../utils';
|
|
14
14
|
import { Card } from './genericCard';
|
|
15
15
|
import { InlineCardWithAwareness } from './inlineCardWithAwareness';
|
|
16
16
|
export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -10,10 +10,10 @@ import { getAnnotationMarksForPos, getLinkCreationAnalyticsEvent, isFromCurrentD
|
|
|
10
10
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
11
11
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { appearanceForNodeType, isDatasourceConfigEditable, isDatasourceNode, selectedCardAppearance } from '../utils';
|
|
14
13
|
import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
|
|
15
14
|
import { pluginKey } from './plugin-key';
|
|
16
15
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
16
|
+
import { appearanceForNodeType, isDatasourceConfigEditable, isDatasourceNode, selectedCardAppearance } from './utils';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Attempt to replace the link into the respective card.
|
|
@@ -10,19 +10,19 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
10
10
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
11
11
|
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { eventsFromTransaction } from '../analytics/events-from-tr';
|
|
14
|
-
import { isLocalStorageKeyDiscovered } from '../common/local-storage';
|
|
15
13
|
import { InlineCardNodeView } from '../nodeviews/inlineCard';
|
|
16
14
|
import { lazyBlockCardView } from '../nodeviews/lazy-block-card';
|
|
17
15
|
import { lazyEmbedCardView } from '../nodeviews/lazy-embed-card';
|
|
18
16
|
import { lazyInlineCardView } from '../nodeviews/lazy-inline-card';
|
|
17
|
+
import { eventsFromTransaction } from '../ui/analytics/events-from-tr';
|
|
19
18
|
import { isDatasourceTableLayout } from '../ui/LayoutButton/utils';
|
|
20
|
-
import {
|
|
19
|
+
import { isLocalStorageKeyDiscovered } from '../ui/local-storage';
|
|
21
20
|
import { clearOverlayCandidate, setCardLayoutAndDatasourceTableRef, setDatasourceTableRef } from './actions';
|
|
22
21
|
import { pluginKey } from './plugin-key';
|
|
23
22
|
import reducer from './reducers';
|
|
24
23
|
import { handleProvider, resolveWithProvider } from './util/resolve';
|
|
25
24
|
import { getNewRequests, getPluginState, getPluginStateWithUpdatedPos } from './util/state';
|
|
25
|
+
import { isBlockSupportedAtPosition, isEmbedSupportedAtPosition } from './utils';
|
|
26
26
|
export { pluginKey } from './plugin-key';
|
|
27
27
|
var LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK = 'smart-link-upgrade-pulse';
|
|
28
28
|
export var ALLOW_EVENTS_CLASSNAME = 'card-plugin-element-allow-events';
|
|
@@ -3,7 +3,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
|
|
5
5
|
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, CONFLUENCE_SEARCH_DATASOURCE_ID, JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
6
|
-
import { pluginKey } from './
|
|
6
|
+
import { pluginKey } from './plugin-key';
|
|
7
7
|
export var appearanceForNodeType = function appearanceForNodeType(spec) {
|
|
8
8
|
if (spec.name === 'inlineCard') {
|
|
9
9
|
return 'inline';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,10 +8,10 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { getResolvedAttributesFromStore } from '../../utils';
|
|
11
|
+
import { getResolvedAttributesFromStore } from '../../pm-plugins/utils';
|
|
12
|
+
import useLinkUpgradeDiscoverability from '../hooks/useLinkUpgradeDiscoverability';
|
|
14
13
|
import InlineCardOverlay from '../InlineCardOverlay';
|
|
14
|
+
import { isLocalStorageKeyDiscovered, LOCAL_STORAGE_DISCOVERY_KEY_SMART_LINK, LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR, markLocalStorageKeyDiscovered, ONE_DAY_IN_MILLISECONDS } from '../local-storage';
|
|
15
15
|
import { DiscoveryPulse } from '../Pulse';
|
|
16
16
|
// editor adds a standard line-height that is bigger than an inline smart link
|
|
17
17
|
// 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
|
var buttonStyles = css({
|
|
@@ -105,17 +105,15 @@ export var DatasourceAppearanceButton = function DatasourceAppearanceButton(_ref
|
|
|
105
105
|
editorState = _ref2.editorState,
|
|
106
106
|
selected = _ref2.selected,
|
|
107
107
|
inputMethod = _ref2.inputMethod;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
inputMethod: inputMethod
|
|
119
|
-
});
|
|
108
|
+
var cardContext = useSmartLinkContext();
|
|
109
|
+
return jsx(DatasourceAppearanceButtonWithCardContext, {
|
|
110
|
+
url: url,
|
|
111
|
+
intl: intl,
|
|
112
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
113
|
+
editorView: editorView,
|
|
114
|
+
editorState: editorState,
|
|
115
|
+
cardContext: cardContext,
|
|
116
|
+
selected: selected,
|
|
117
|
+
inputMethod: inputMethod
|
|
120
118
|
});
|
|
121
119
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, AssetsConfigModal, CONFLUENCE_SEARCH_DATASOURCE_ID, ConfluenceSearchConfigModal, JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { EditorSmartCardProviderValueGuard, useSmartLinkContext } from '@atlaskit/link-provider';
|
|
5
|
+
import { DatasourceErrorBoundary } from '../datasourceErrorBoundary';
|
|
6
6
|
import { DatasourceModal } from './index';
|
|
7
7
|
var ModalWithState = function ModalWithState(_ref) {
|
|
8
8
|
var api = _ref.api,
|
|
9
9
|
editorView = _ref.editorView;
|
|
10
|
+
var cardContext = useSmartLinkContext();
|
|
10
11
|
var _useSharedPluginState = useSharedPluginState(api, ['card']),
|
|
11
12
|
cardState = _useSharedPluginState.cardState;
|
|
12
13
|
if (!cardState) {
|
|
@@ -23,16 +24,21 @@ var ModalWithState = function ModalWithState(_ref) {
|
|
|
23
24
|
return /*#__PURE__*/React.createElement(DatasourceErrorBoundary, {
|
|
24
25
|
view: editorView,
|
|
25
26
|
datasourceModalType: datasourceModalType
|
|
26
|
-
}, /*#__PURE__*/React.createElement(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
datasourceId: datasourceId,
|
|
32
|
-
componentType: componentType
|
|
33
|
-
});
|
|
27
|
+
}, /*#__PURE__*/React.createElement(DatasourceModal, {
|
|
28
|
+
view: editorView,
|
|
29
|
+
cardContext: cardContext,
|
|
30
|
+
datasourceId: datasourceId,
|
|
31
|
+
componentType: componentType
|
|
34
32
|
}));
|
|
35
33
|
};
|
|
34
|
+
var SafeModalWithState = /*#__PURE__*/React.memo(function (_ref2) {
|
|
35
|
+
var api = _ref2.api,
|
|
36
|
+
editorView = _ref2.editorView;
|
|
37
|
+
return /*#__PURE__*/React.createElement(EditorSmartCardProviderValueGuard, null, /*#__PURE__*/React.createElement(ModalWithState, {
|
|
38
|
+
api: api,
|
|
39
|
+
editorView: editorView
|
|
40
|
+
}));
|
|
41
|
+
});
|
|
36
42
|
export var modalTypeToComponentMap = {
|
|
37
43
|
jira: {
|
|
38
44
|
componentType: JiraIssuesConfigModal,
|
|
@@ -47,4 +53,4 @@ export var modalTypeToComponentMap = {
|
|
|
47
53
|
datasourceId: ASSETS_LIST_OF_LINKS_DATASOURCE_ID
|
|
48
54
|
}
|
|
49
55
|
};
|
|
50
|
-
export default
|
|
56
|
+
export default SafeModalWithState;
|
|
@@ -14,7 +14,7 @@ import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDT
|
|
|
14
14
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
15
15
|
import { hideLinkToolbar as _hideLinkToolbar, showLinkToolbar } from '../pm-plugins/actions';
|
|
16
16
|
import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
|
|
17
|
-
import { displayInfoForCard, findCardInfo } from '../utils';
|
|
17
|
+
import { displayInfoForCard, findCardInfo } from '../pm-plugins/utils';
|
|
18
18
|
export function HyperlinkAddToolbarWithState(_ref) {
|
|
19
19
|
var _ref$linkPickerOption = _ref.linkPickerOptions,
|
|
20
20
|
linkPickerOptions = _ref$linkPickerOption === void 0 ? {} : _ref$linkPickerOption,
|
|
@@ -14,7 +14,7 @@ import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlask
|
|
|
14
14
|
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
15
15
|
import { ButtonItem } from '@atlaskit/menu';
|
|
16
16
|
import { Flex } from '@atlaskit/primitives';
|
|
17
|
-
import { focusEditorView } from '../../utils';
|
|
17
|
+
import { focusEditorView } from '../../pm-plugins/utils';
|
|
18
18
|
import { editDatasource } from '../editDatasourceAction';
|
|
19
19
|
var dropdownExpandContainer = css({
|
|
20
20
|
margin: "0px ".concat("var(--ds-space-negative-050, -4px)")
|
|
@@ -14,10 +14,10 @@ import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-
|
|
|
14
14
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
15
15
|
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
16
16
|
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
17
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
17
18
|
import { ButtonItem } from '@atlaskit/menu';
|
|
18
19
|
import { Flex } from '@atlaskit/primitives';
|
|
19
|
-
import { focusEditorView, isDatasourceConfigEditable } from '../../utils';
|
|
20
|
-
import { CardContextProvider } from '../CardContextProvider';
|
|
20
|
+
import { focusEditorView, isDatasourceConfigEditable } from '../../pm-plugins/utils';
|
|
21
21
|
import { editDatasource } from '../editDatasourceAction';
|
|
22
22
|
import { useFetchDatasourceDataInfo } from '../useFetchDatasourceDataInfo';
|
|
23
23
|
import { useFetchDatasourceInfo } from '../useFetchDatasourceInfo';
|
|
@@ -244,34 +244,11 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
244
244
|
intl = props.intl,
|
|
245
245
|
onLinkEditClick = props.onLinkEditClick,
|
|
246
246
|
url = props.url;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return jsx(EditToolbarButtonWithUrl, {
|
|
251
|
-
datasourceId: datasourceId,
|
|
252
|
-
url: props.url,
|
|
253
|
-
intl: intl,
|
|
254
|
-
editorAnalyticsApi: editorAnalyticsApi,
|
|
255
|
-
editorView: editorView,
|
|
256
|
-
cardContext: cardContext,
|
|
257
|
-
onLinkEditClick: onLinkEditClick,
|
|
258
|
-
currentAppearance: currentAppearance
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
if (props.datasourceId && props.node) {
|
|
262
|
-
return jsx(EditToolbarButtonWithDatasourceId, {
|
|
263
|
-
datasourceId: props.datasourceId,
|
|
264
|
-
node: props.node,
|
|
265
|
-
intl: intl,
|
|
266
|
-
editorAnalyticsApi: editorAnalyticsApi,
|
|
267
|
-
editorView: editorView,
|
|
268
|
-
onLinkEditClick: onLinkEditClick,
|
|
269
|
-
currentAppearance: currentAppearance
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
return jsx(EditToolbarButtonWithCardContext, {
|
|
247
|
+
var cardContext = useSmartLinkContext();
|
|
248
|
+
if (props.url) {
|
|
249
|
+
return jsx(EditToolbarButtonWithUrl, {
|
|
273
250
|
datasourceId: datasourceId,
|
|
274
|
-
url: url,
|
|
251
|
+
url: props.url,
|
|
275
252
|
intl: intl,
|
|
276
253
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
277
254
|
editorView: editorView,
|
|
@@ -279,5 +256,26 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
279
256
|
onLinkEditClick: onLinkEditClick,
|
|
280
257
|
currentAppearance: currentAppearance
|
|
281
258
|
});
|
|
259
|
+
}
|
|
260
|
+
if (props.datasourceId && props.node) {
|
|
261
|
+
return jsx(EditToolbarButtonWithDatasourceId, {
|
|
262
|
+
datasourceId: props.datasourceId,
|
|
263
|
+
node: props.node,
|
|
264
|
+
intl: intl,
|
|
265
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
266
|
+
editorView: editorView,
|
|
267
|
+
onLinkEditClick: onLinkEditClick,
|
|
268
|
+
currentAppearance: currentAppearance
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return jsx(EditToolbarButtonWithCardContext, {
|
|
272
|
+
datasourceId: datasourceId,
|
|
273
|
+
url: url,
|
|
274
|
+
intl: intl,
|
|
275
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
276
|
+
editorView: editorView,
|
|
277
|
+
cardContext: cardContext,
|
|
278
|
+
onLinkEditClick: onLinkEditClick,
|
|
279
|
+
currentAppearance: currentAppearance
|
|
282
280
|
});
|
|
283
281
|
};
|
|
@@ -8,7 +8,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
8
8
|
import { useEffect, useMemo } from 'react';
|
|
9
9
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
10
10
|
import { useDatasourceLifecycleAnalytics } from '@atlaskit/link-analytics';
|
|
11
|
-
import { EVENT, EVENT_SUBJECT } from '
|
|
11
|
+
import { EVENT, EVENT_SUBJECT } from '../analytics/types';
|
|
12
12
|
import { getMethod } from './common';
|
|
13
13
|
function getDatasourceDisplay(datasourceAttrs) {
|
|
14
14
|
var _datasourceAttrs$data;
|
|
@@ -5,8 +5,8 @@ var _excluded = ["node", "nodeContext"],
|
|
|
5
5
|
_excluded3 = ["node", "nodeContext"];
|
|
6
6
|
import { useEffect, useMemo } from 'react';
|
|
7
7
|
import { useSmartLinkLifecycleAnalytics } from '@atlaskit/link-analytics';
|
|
8
|
-
import { EVENT, EVENT_SUBJECT } from '
|
|
9
|
-
import { appearanceForLink, getUrl } from '
|
|
8
|
+
import { EVENT, EVENT_SUBJECT } from '../analytics/types';
|
|
9
|
+
import { appearanceForLink, getUrl } from '../analytics/utils';
|
|
10
10
|
import { getDeleteType, getMethod, getSourceEventFromMetadata, getUpdateType } from './common';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -3,11 +3,10 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
6
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
8
7
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
8
|
import React from 'react';
|
|
10
|
-
import
|
|
9
|
+
import { EditorSmartCardProvider, EditorSmartCardProviderValueGuard } from '@atlaskit/link-provider';
|
|
11
10
|
import { EditorAnalyticsContext } from '../EditorAnalyticsContext';
|
|
12
11
|
import { DatasourceEventsBinding } from './DatasourceEvents';
|
|
13
12
|
import { LinkEventsBinding } from './LinkEvents';
|
|
@@ -22,30 +21,11 @@ export var EditorLinkingPlatformAnalytics = /*#__PURE__*/function (_React$PureCo
|
|
|
22
21
|
}
|
|
23
22
|
_createClass(EditorLinkingPlatformAnalytics, [{
|
|
24
23
|
key: "render",
|
|
25
|
-
value:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function render() {
|
|
29
|
-
var _this$context;
|
|
30
|
-
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;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The analytics hook needs to be able to communicate with the card context
|
|
34
|
-
* If we can't access it, don't mount the event bindings
|
|
35
|
-
* This effectively entirely disables all tracking behaviour
|
|
36
|
-
*/
|
|
37
|
-
if (!(cardContext !== null && cardContext !== void 0 && cardContext.value)) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
return /*#__PURE__*/React.createElement(cardContext.Provider, {
|
|
41
|
-
value: cardContext.value
|
|
42
|
-
}, /*#__PURE__*/React.createElement(EditorAnalyticsContext, {
|
|
24
|
+
value: function render() {
|
|
25
|
+
return /*#__PURE__*/React.createElement(EditorSmartCardProvider, null, /*#__PURE__*/React.createElement(EditorSmartCardProviderValueGuard, null, /*#__PURE__*/React.createElement(EditorAnalyticsContext, {
|
|
43
26
|
editorView: this.props.editorView
|
|
44
|
-
}, /*#__PURE__*/React.createElement(LinkEventsBinding, this.props), /*#__PURE__*/React.createElement(DatasourceEventsBinding, this.props)));
|
|
27
|
+
}, /*#__PURE__*/React.createElement(LinkEventsBinding, this.props), /*#__PURE__*/React.createElement(DatasourceEventsBinding, this.props))));
|
|
45
28
|
}
|
|
46
29
|
}]);
|
|
47
30
|
return EditorLinkingPlatformAnalytics;
|
|
48
|
-
}(React.PureComponent);
|
|
49
|
-
_defineProperty(EditorLinkingPlatformAnalytics, "contextTypes", {
|
|
50
|
-
contextAdapter: PropTypes.object
|
|
51
|
-
});
|
|
31
|
+
}(React.PureComponent);
|
|
@@ -19,7 +19,7 @@ import ExpandIcon from '@atlaskit/icon/glyph/editor/expand';
|
|
|
19
19
|
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
20
20
|
import { B300, N20A, N300 } from '@atlaskit/theme/colors';
|
|
21
21
|
import { setCardLayout } from '../../pm-plugins/actions';
|
|
22
|
-
import { isDatasourceNode } from '../../utils';
|
|
22
|
+
import { isDatasourceNode } from '../../pm-plugins/utils';
|
|
23
23
|
import { getDatasource, isDatasourceTableLayout } from './utils';
|
|
24
24
|
var toolbarButtonWrapperStyles = css({
|
|
25
25
|
background: "".concat("var(--ds-background-neutral, ".concat(N20A, ")")),
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import { findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { isDatasourceNode } from '../../utils';
|
|
5
|
+
import { isDatasourceNode } from '../../pm-plugins/utils';
|
|
6
6
|
import { DATASOURCE_TABLE_LAYOUTS } from './types';
|
|
7
7
|
export var getDatasource = function getDatasource(editorView) {
|
|
8
8
|
var _editorView$state = editorView.state,
|
|
@@ -10,19 +10,20 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
10
10
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
11
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
14
13
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
15
14
|
import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
16
15
|
import { commandWithMetadata, getButtonGroupOption, LinkToolbarButtonGroup } from '@atlaskit/editor-common/card';
|
|
17
16
|
import nodeNames, { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
18
17
|
import { isSupportedInParent } from '@atlaskit/editor-common/utils';
|
|
19
18
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
20
|
-
import { LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from '../common/local-storage';
|
|
21
19
|
import { changeSelectedCardToLink, setSelectedCardAppearance } from '../pm-plugins/doc';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
20
|
+
import { getResolvedAttributesFromStore } from '../pm-plugins/utils';
|
|
21
|
+
import { LOCAL_STORAGE_DISCOVERY_KEY_TOOLBAR } from './local-storage';
|
|
24
22
|
import { DiscoveryPulse } from './Pulse';
|
|
23
|
+
import { shouldRenderToolbarPulse } from './toolbar';
|
|
24
|
+
import { WithCardContext } from './WithCardContext';
|
|
25
25
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
26
|
+
|
|
26
27
|
export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
27
28
|
_inherits(LinkToolbarAppearance, _React$Component);
|
|
28
29
|
var _super = _createSuper(LinkToolbarAppearance);
|
|
@@ -136,16 +137,15 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
|
|
|
136
137
|
_createClass(LinkToolbarAppearance, [{
|
|
137
138
|
key: "render",
|
|
138
139
|
value: function render() {
|
|
139
|
-
var
|
|
140
|
+
var _this2 = this;
|
|
140
141
|
var editorView = this.props.editorView;
|
|
141
|
-
return
|
|
142
|
+
return /*#__PURE__*/React.createElement(WithCardContext, null, function (cardContext) {
|
|
143
|
+
return _this2.renderDropdown(editorView, cardContext && cardContext.value);
|
|
144
|
+
});
|
|
142
145
|
}
|
|
143
146
|
}]);
|
|
144
147
|
return LinkToolbarAppearance;
|
|
145
148
|
}(React.Component);
|
|
146
|
-
_defineProperty(LinkToolbarAppearance, "contextTypes", {
|
|
147
|
-
contextAdapter: PropTypes.object
|
|
148
|
-
});
|
|
149
149
|
var getUnavailableMessage = function getUnavailableMessage(state, intl) {
|
|
150
150
|
try {
|
|
151
151
|
var parentNode = state.selection.$from.node(1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
3
3
|
import { Pulse } from '@atlaskit/linking-common';
|
|
4
|
-
import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '
|
|
4
|
+
import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '../local-storage';
|
|
5
5
|
export var DiscoveryPulse = function DiscoveryPulse(_ref) {
|
|
6
6
|
var children = _ref.children,
|
|
7
7
|
localStorageKey = _ref.localStorageKey,
|
|
@@ -3,8 +3,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import React, { useEffect } from 'react';
|
|
5
5
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
|
+
import { getResolvedAttributesFromStore } from '../pm-plugins/utils';
|
|
8
8
|
import { EditorAnalyticsContext } from './EditorAnalyticsContext';
|
|
9
9
|
/**
|
|
10
10
|
* Handles firing the toolbar viewed event
|
|
@@ -37,14 +37,12 @@ export var ToolbarViewedEvent = function ToolbarViewedEvent(_ref2) {
|
|
|
37
37
|
var url = _ref2.url,
|
|
38
38
|
display = _ref2.display,
|
|
39
39
|
editorView = _ref2.editorView;
|
|
40
|
+
var cardContext = useSmartLinkContext();
|
|
40
41
|
return /*#__PURE__*/React.createElement(EditorAnalyticsContext, {
|
|
41
42
|
editorView: editorView
|
|
42
|
-
}, /*#__PURE__*/React.createElement(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
cardContext: cardContext
|
|
48
|
-
}) : null;
|
|
49
|
-
}));
|
|
43
|
+
}, url ? /*#__PURE__*/React.createElement(ToolbarViewedEventBase, {
|
|
44
|
+
url: url,
|
|
45
|
+
display: display,
|
|
46
|
+
cardContext: cardContext
|
|
47
|
+
}) : null);
|
|
50
48
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSmartCardContext } from '@atlaskit/link-provider';
|
|
3
|
+
export var WithCardContext = function WithCardContext(_ref) {
|
|
4
|
+
var children = _ref.children;
|
|
5
|
+
var cardContext = useSmartCardContext();
|
|
6
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children(cardContext));
|
|
7
|
+
};
|
|
@@ -6,8 +6,8 @@ import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
|
6
6
|
import { getLinkMetadataFromTransaction } from '@atlaskit/editor-common/card';
|
|
7
7
|
import { isLinkMark, pmHistoryPluginKey } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { AddMarkStep, RemoveMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
9
|
-
import { pluginKey } from '
|
|
10
|
-
import { getPluginState } from '
|
|
9
|
+
import { pluginKey } from '../../pm-plugins/plugin-key';
|
|
10
|
+
import { getPluginState } from '../../pm-plugins/util/state';
|
|
11
11
|
import { EVENT, EVENT_SUBJECT } from './types';
|
|
12
12
|
import { appearanceForLink, areSameNodes, findAtPositions, findInNodeRange, getNodeContext, getNodeSubject } from './utils';
|
|
13
13
|
|
|
@@ -11,7 +11,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
13
13
|
import { LazyLoadedDatasourceRenderFailedAnalyticsWrapper } from '@atlaskit/link-datasource';
|
|
14
|
-
import { setSelectedCardAppearance } from '
|
|
14
|
+
import { setSelectedCardAppearance } from '../pm-plugins/doc';
|
|
15
15
|
export var DatasourceErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
16
16
|
_inherits(DatasourceErrorBoundary, _React$Component);
|
|
17
17
|
var _super = _createSuper(DatasourceErrorBoundary);
|
|
@@ -23,15 +23,15 @@ import CogIcon from '@atlaskit/icon/glyph/editor/settings';
|
|
|
23
23
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
24
24
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
25
25
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
26
|
-
import { changeSelectedCardToText } from '
|
|
27
|
-
import { pluginKey } from '
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
26
|
+
import { changeSelectedCardToText } from '../pm-plugins/doc';
|
|
27
|
+
import { pluginKey } from '../pm-plugins/main';
|
|
28
|
+
import { appearanceForNodeType, displayInfoForCard, findCardInfo, isDatasourceNode, titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
29
|
+
import { DatasourceAppearanceButton } from './DatasourceAppearanceButton';
|
|
30
|
+
import { buildEditLinkToolbar, editLinkToolbarConfig, getEditLinkCallback } from './EditLinkToolbar';
|
|
31
|
+
import { EditToolbarButton } from './EditToolbarButton';
|
|
32
|
+
import { HyperlinkToolbarAppearance } from './HyperlinkToolbarAppearance';
|
|
33
|
+
import { LinkToolbarAppearance } from './LinkToolbarAppearance';
|
|
34
|
+
import { ToolbarViewedEvent } from './ToolbarViewedEvent';
|
|
35
35
|
export var removeCard = function removeCard(editorAnalyticsApi) {
|
|
36
36
|
return commandWithMetadata(function (state, dispatch) {
|
|
37
37
|
if (!(state.selection instanceof NodeSelection)) {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { cardPlugin } from './
|
|
2
|
-
export type { CardPlugin } from './
|
|
1
|
+
export { cardPlugin } from './cardPlugin';
|
|
2
|
+
export type { CardPlugin } from './cardPluginType';
|
|
3
3
|
export type { Request, CardPluginOptions, CardPluginState } from './types';
|