@atlaskit/editor-plugin-card 0.1.0
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/.eslintrc.js +15 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE.md +13 -0
- package/README.md +7 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/messages.js +20 -0
- package/dist/cjs/nodeviews/blockCard.js +164 -0
- package/dist/cjs/nodeviews/datasource.js +173 -0
- package/dist/cjs/nodeviews/embedCard.js +398 -0
- package/dist/cjs/nodeviews/genericCard.js +118 -0
- package/dist/cjs/nodeviews/inlineCard.js +132 -0
- package/dist/cjs/plugin.js +138 -0
- package/dist/cjs/pm-plugins/actions.js +122 -0
- package/dist/cjs/pm-plugins/analytics/create-analytics-queue.js +48 -0
- package/dist/cjs/pm-plugins/analytics/events-from-tr.js +359 -0
- package/dist/cjs/pm-plugins/analytics/index.js +19 -0
- package/dist/cjs/pm-plugins/analytics/types.js +5 -0
- package/dist/cjs/pm-plugins/analytics/utils.js +178 -0
- package/dist/cjs/pm-plugins/doc.js +479 -0
- package/dist/cjs/pm-plugins/keymap.js +64 -0
- package/dist/cjs/pm-plugins/main.js +212 -0
- package/dist/cjs/pm-plugins/mountHyperlink.js +47 -0
- package/dist/cjs/pm-plugins/plugin-key.js +9 -0
- package/dist/cjs/pm-plugins/reducers.js +111 -0
- package/dist/cjs/pm-plugins/shouldReplaceLink.js +35 -0
- package/dist/cjs/pm-plugins/util/resolve.js +59 -0
- package/dist/cjs/pm-plugins/util/state.js +49 -0
- package/dist/cjs/toolbar.js +364 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/ui/DatasourceModal/ModalWithState.js +25 -0
- package/dist/cjs/ui/DatasourceModal/index.js +60 -0
- package/dist/cjs/ui/EditLinkToolbar.js +258 -0
- package/dist/cjs/ui/EditorSmartCardEvents.js +21 -0
- package/dist/cjs/ui/EditorSmartCardEventsNext.js +215 -0
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +174 -0
- package/dist/cjs/ui/LayoutButton/index.js +121 -0
- package/dist/cjs/ui/LayoutButton/types.js +5 -0
- package/dist/cjs/ui/LayoutButton/utils.js +19 -0
- package/dist/cjs/ui/LinkToolbarAppearance.js +152 -0
- package/dist/cjs/ui/ResizableEmbedCard.js +364 -0
- package/dist/cjs/ui/SmallerEditIcon.js +22 -0
- package/dist/cjs/utils.js +60 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/messages.js +13 -0
- package/dist/es2019/nodeviews/blockCard.js +131 -0
- package/dist/es2019/nodeviews/datasource.js +137 -0
- package/dist/es2019/nodeviews/embedCard.js +370 -0
- package/dist/es2019/nodeviews/genericCard.js +92 -0
- package/dist/es2019/nodeviews/inlineCard.js +113 -0
- package/dist/es2019/plugin.js +129 -0
- package/dist/es2019/pm-plugins/actions.js +57 -0
- package/dist/es2019/pm-plugins/analytics/create-analytics-queue.js +38 -0
- package/dist/es2019/pm-plugins/analytics/events-from-tr.js +339 -0
- package/dist/es2019/pm-plugins/analytics/index.js +2 -0
- package/dist/es2019/pm-plugins/analytics/types.js +1 -0
- package/dist/es2019/pm-plugins/analytics/utils.js +160 -0
- package/dist/es2019/pm-plugins/doc.js +451 -0
- package/dist/es2019/pm-plugins/keymap.js +59 -0
- package/dist/es2019/pm-plugins/main.js +208 -0
- package/dist/es2019/pm-plugins/mountHyperlink.js +37 -0
- package/dist/es2019/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/pm-plugins/reducers.js +110 -0
- package/dist/es2019/pm-plugins/shouldReplaceLink.js +25 -0
- package/dist/es2019/pm-plugins/util/resolve.js +50 -0
- package/dist/es2019/pm-plugins/util/state.js +26 -0
- package/dist/es2019/toolbar.js +359 -0
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/ui/DatasourceModal/ModalWithState.js +19 -0
- package/dist/es2019/ui/DatasourceModal/index.js +48 -0
- package/dist/es2019/ui/EditLinkToolbar.js +226 -0
- package/dist/es2019/ui/EditorSmartCardEvents.js +15 -0
- package/dist/es2019/ui/EditorSmartCardEventsNext.js +199 -0
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +86 -0
- package/dist/es2019/ui/LayoutButton/index.js +114 -0
- package/dist/es2019/ui/LayoutButton/types.js +1 -0
- package/dist/es2019/ui/LayoutButton/utils.js +15 -0
- package/dist/es2019/ui/LinkToolbarAppearance.js +118 -0
- package/dist/es2019/ui/ResizableEmbedCard.js +335 -0
- package/dist/es2019/ui/SmallerEditIcon.js +14 -0
- package/dist/es2019/utils.js +46 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/messages.js +13 -0
- package/dist/esm/nodeviews/blockCard.js +156 -0
- package/dist/esm/nodeviews/datasource.js +165 -0
- package/dist/esm/nodeviews/embedCard.js +389 -0
- package/dist/esm/nodeviews/genericCard.js +111 -0
- package/dist/esm/nodeviews/inlineCard.js +124 -0
- package/dist/esm/plugin.js +130 -0
- package/dist/esm/pm-plugins/actions.js +102 -0
- package/dist/esm/pm-plugins/analytics/create-analytics-queue.js +41 -0
- package/dist/esm/pm-plugins/analytics/events-from-tr.js +350 -0
- package/dist/esm/pm-plugins/analytics/index.js +2 -0
- package/dist/esm/pm-plugins/analytics/types.js +1 -0
- package/dist/esm/pm-plugins/analytics/utils.js +160 -0
- package/dist/esm/pm-plugins/doc.js +460 -0
- package/dist/esm/pm-plugins/keymap.js +58 -0
- package/dist/esm/pm-plugins/main.js +199 -0
- package/dist/esm/pm-plugins/mountHyperlink.js +39 -0
- package/dist/esm/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/pm-plugins/reducers.js +103 -0
- package/dist/esm/pm-plugins/shouldReplaceLink.js +29 -0
- package/dist/esm/pm-plugins/util/resolve.js +52 -0
- package/dist/esm/pm-plugins/util/state.js +40 -0
- package/dist/esm/toolbar.js +350 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/ui/DatasourceModal/ModalWithState.js +17 -0
- package/dist/esm/ui/DatasourceModal/index.js +49 -0
- package/dist/esm/ui/EditLinkToolbar.js +244 -0
- package/dist/esm/ui/EditorSmartCardEvents.js +14 -0
- package/dist/esm/ui/EditorSmartCardEventsNext.js +203 -0
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +163 -0
- package/dist/esm/ui/LayoutButton/index.js +110 -0
- package/dist/esm/ui/LayoutButton/types.js +1 -0
- package/dist/esm/ui/LayoutButton/utils.js +12 -0
- package/dist/esm/ui/LinkToolbarAppearance.js +141 -0
- package/dist/esm/ui/ResizableEmbedCard.js +358 -0
- package/dist/esm/ui/SmallerEditIcon.js +14 -0
- package/dist/esm/utils.js +48 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/messages.d.ts +12 -0
- package/dist/types/nodeviews/blockCard.d.ts +26 -0
- package/dist/types/nodeviews/datasource.d.ts +42 -0
- package/dist/types/nodeviews/embedCard.d.ts +46 -0
- package/dist/types/nodeviews/genericCard.d.ts +37 -0
- package/dist/types/nodeviews/inlineCard.d.ts +23 -0
- package/dist/types/plugin.d.ts +24 -0
- package/dist/types/pm-plugins/actions.d.ts +23 -0
- package/dist/types/pm-plugins/analytics/create-analytics-queue.d.ts +10 -0
- package/dist/types/pm-plugins/analytics/events-from-tr.d.ts +17 -0
- package/dist/types/pm-plugins/analytics/index.d.ts +2 -0
- package/dist/types/pm-plugins/analytics/types.d.ts +12 -0
- package/dist/types/pm-plugins/analytics/utils.d.ts +32 -0
- package/dist/types/pm-plugins/doc.d.ts +22 -0
- package/dist/types/pm-plugins/keymap.d.ts +3 -0
- package/dist/types/pm-plugins/main.d.ts +6 -0
- package/dist/types/pm-plugins/mountHyperlink.d.ts +5 -0
- package/dist/types/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types/pm-plugins/reducers.d.ts +3 -0
- package/dist/types/pm-plugins/shouldReplaceLink.d.ts +2 -0
- package/dist/types/pm-plugins/util/resolve.d.ts +8 -0
- package/dist/types/pm-plugins/util/state.d.ts +31 -0
- package/dist/types/toolbar.d.ts +9 -0
- package/dist/types/types.d.ts +163 -0
- package/dist/types/ui/DatasourceModal/ModalWithState.d.ts +9 -0
- package/dist/types/ui/DatasourceModal/index.d.ts +11 -0
- package/dist/types/ui/EditLinkToolbar.d.ts +47 -0
- package/dist/types/ui/EditorSmartCardEvents.d.ts +5 -0
- package/dist/types/ui/EditorSmartCardEventsNext.d.ts +18 -0
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +32 -0
- package/dist/types/ui/LayoutButton/index.d.ts +9 -0
- package/dist/types/ui/LayoutButton/types.d.ts +19 -0
- package/dist/types/ui/LayoutButton/utils.d.ts +5 -0
- package/dist/types/ui/LinkToolbarAppearance.d.ts +29 -0
- package/dist/types/ui/ResizableEmbedCard.d.ts +61 -0
- package/dist/types/ui/SmallerEditIcon.d.ts +3 -0
- package/dist/types/utils.d.ts +19 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/messages.d.ts +12 -0
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +26 -0
- package/dist/types-ts4.5/nodeviews/datasource.d.ts +42 -0
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +46 -0
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +37 -0
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +23 -0
- package/dist/types-ts4.5/plugin.d.ts +24 -0
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +23 -0
- package/dist/types-ts4.5/pm-plugins/analytics/create-analytics-queue.d.ts +10 -0
- package/dist/types-ts4.5/pm-plugins/analytics/events-from-tr.d.ts +17 -0
- package/dist/types-ts4.5/pm-plugins/analytics/index.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/analytics/types.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/analytics/utils.d.ts +32 -0
- package/dist/types-ts4.5/pm-plugins/doc.d.ts +22 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +6 -0
- package/dist/types-ts4.5/pm-plugins/mountHyperlink.d.ts +5 -0
- package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/reducers.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/shouldReplaceLink.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/util/resolve.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/util/state.d.ts +31 -0
- package/dist/types-ts4.5/toolbar.d.ts +9 -0
- package/dist/types-ts4.5/types.d.ts +163 -0
- package/dist/types-ts4.5/ui/DatasourceModal/ModalWithState.d.ts +9 -0
- package/dist/types-ts4.5/ui/DatasourceModal/index.d.ts +11 -0
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +47 -0
- package/dist/types-ts4.5/ui/EditorSmartCardEvents.d.ts +5 -0
- package/dist/types-ts4.5/ui/EditorSmartCardEventsNext.d.ts +18 -0
- package/dist/types-ts4.5/ui/HyperlinkToolbarAppearance.d.ts +32 -0
- package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +9 -0
- package/dist/types-ts4.5/ui/LayoutButton/types.d.ts +19 -0
- package/dist/types-ts4.5/ui/LayoutButton/utils.d.ts +5 -0
- package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +29 -0
- package/dist/types-ts4.5/ui/ResizableEmbedCard.d.ts +61 -0
- package/dist/types-ts4.5/ui/SmallerEditIcon.d.ts +3 -0
- package/dist/types-ts4.5/utils.d.ts +19 -0
- package/package.json +126 -0
- package/report.api.md +146 -0
- package/tmp/api-report-tmp.d.ts +117 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.visitCardLink = exports.removeCard = exports.openLinkSettings = exports.floatingToolbar = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
13
|
+
var _prosemirrorUtils = require("prosemirror-utils");
|
|
14
|
+
var _adfSchema = require("@atlaskit/adf-schema");
|
|
15
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
|
+
var _card = require("@atlaskit/editor-common/card");
|
|
17
|
+
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
18
|
+
var _styles = require("@atlaskit/editor-common/styles");
|
|
19
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
20
|
+
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
21
|
+
var _settings = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/settings"));
|
|
22
|
+
var _unlink = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/unlink"));
|
|
23
|
+
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
24
|
+
var _doc = require("./pm-plugins/doc");
|
|
25
|
+
var _main = require("./pm-plugins/main");
|
|
26
|
+
var _EditLinkToolbar = require("./ui/EditLinkToolbar");
|
|
27
|
+
var _LinkToolbarAppearance = require("./ui/LinkToolbarAppearance");
|
|
28
|
+
var _SmallerEditIcon = require("./ui/SmallerEditIcon");
|
|
29
|
+
var _utils2 = require("./utils");
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
34
|
+
var removeCard = function removeCard(editorAnalyticsApi) {
|
|
35
|
+
return (0, _card.commandWithMetadata)(function (state, dispatch) {
|
|
36
|
+
if (!(state.selection instanceof _prosemirrorState.NodeSelection)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
var type = state.selection.node.type.name;
|
|
40
|
+
var payload = {
|
|
41
|
+
action: _analytics.ACTION.DELETED,
|
|
42
|
+
actionSubject: _analytics.ACTION_SUBJECT.SMART_LINK,
|
|
43
|
+
actionSubjectId: type,
|
|
44
|
+
attributes: {
|
|
45
|
+
inputMethod: _analytics.INPUT_METHOD.TOOLBAR,
|
|
46
|
+
displayMode: type
|
|
47
|
+
},
|
|
48
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
49
|
+
};
|
|
50
|
+
if (dispatch) {
|
|
51
|
+
var tr = state.tr;
|
|
52
|
+
(0, _prosemirrorUtils.removeSelectedNode)(tr);
|
|
53
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent(payload)(tr);
|
|
54
|
+
dispatch(tr);
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}, {
|
|
58
|
+
action: _analytics.ACTION.DELETED
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
exports.removeCard = removeCard;
|
|
62
|
+
var visitCardLink = function visitCardLink(editorAnalyticsApi) {
|
|
63
|
+
return function (state, dispatch) {
|
|
64
|
+
if (!(state.selection instanceof _prosemirrorState.NodeSelection)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
var type = state.selection.node.type;
|
|
68
|
+
var _titleUrlPairFromNode = (0, _utils2.titleUrlPairFromNode)(state.selection.node),
|
|
69
|
+
url = _titleUrlPairFromNode.url;
|
|
70
|
+
|
|
71
|
+
// All card links should open in the same tab per https://product-fabric.atlassian.net/browse/MS-1583.
|
|
72
|
+
// We are in edit mode here, open the smart card URL in a new window.
|
|
73
|
+
window.open(url);
|
|
74
|
+
if (dispatch) {
|
|
75
|
+
var tr = state.tr;
|
|
76
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.buildVisitedLinkPayload)(type.name))(tr);
|
|
77
|
+
dispatch(tr);
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
exports.visitCardLink = visitCardLink;
|
|
83
|
+
var openLinkSettings = function openLinkSettings(editorAnalyticsApi) {
|
|
84
|
+
return function (state, dispatch) {
|
|
85
|
+
if (!(state.selection instanceof _prosemirrorState.NodeSelection)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
window.open('https://id.atlassian.com/manage-profile/link-preferences');
|
|
89
|
+
if (dispatch) {
|
|
90
|
+
var tr = state.tr,
|
|
91
|
+
type = state.selection.node.type;
|
|
92
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.buildOpenedSettingsPayload)(type.name))(tr);
|
|
93
|
+
dispatch(tr);
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
exports.openLinkSettings = openLinkSettings;
|
|
99
|
+
var floatingToolbar = function floatingToolbar(cardOptions, featureFlags, platform, linkPickerOptions, pluginInjectionApi) {
|
|
100
|
+
return function (state, intl, providerFactory) {
|
|
101
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
102
|
+
inlineCard = _state$schema$nodes.inlineCard,
|
|
103
|
+
blockCard = _state$schema$nodes.blockCard,
|
|
104
|
+
embedCard = _state$schema$nodes.embedCard;
|
|
105
|
+
var nodeType = [inlineCard, blockCard, embedCard];
|
|
106
|
+
var pluginState = _main.pluginKey.getState(state);
|
|
107
|
+
if (!(state.selection instanceof _prosemirrorState.NodeSelection)) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
var selectedNode = state.selection.node;
|
|
111
|
+
if (!selectedNode) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
var isEmbedCard = (0, _utils2.appearanceForNodeType)(selectedNode.type) === 'embed';
|
|
115
|
+
|
|
116
|
+
/* add an offset to embeds due to extra padding */
|
|
117
|
+
var toolbarOffset = isEmbedCard ? {
|
|
118
|
+
offset: [0, 24]
|
|
119
|
+
} : {};
|
|
120
|
+
|
|
121
|
+
// Applies padding override for when link picker is currently displayed
|
|
122
|
+
var className = pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar ? _styles.FLOATING_TOOLBAR_LINKPICKER_CLASSNAME : undefined;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Enable focus trap only if feature flag is enabled AND for the new version of the picker
|
|
126
|
+
*/
|
|
127
|
+
var lpLinkPicker = featureFlags.lpLinkPicker,
|
|
128
|
+
lpLinkPickerFocusTrap = featureFlags.lpLinkPickerFocusTrap,
|
|
129
|
+
preventPopupOverflow = featureFlags.preventPopupOverflow;
|
|
130
|
+
var shouldEnableFocusTrap = lpLinkPicker && lpLinkPickerFocusTrap;
|
|
131
|
+
var isLinkPickerEnabled = !!lpLinkPicker;
|
|
132
|
+
return _objectSpread(_objectSpread({
|
|
133
|
+
title: intl.formatMessage(_messages.cardMessages.card),
|
|
134
|
+
className: className,
|
|
135
|
+
nodeType: nodeType,
|
|
136
|
+
preventPopupOverflow: preventPopupOverflow
|
|
137
|
+
}, toolbarOffset), {}, {
|
|
138
|
+
getDomRef: function getDomRef(view) {
|
|
139
|
+
var element = (0, _prosemirrorUtils.findDomRefAtPos)(view.state.selection.from, view.domAtPos.bind(view));
|
|
140
|
+
if (!element) {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
if (isEmbedCard) {
|
|
144
|
+
return element.querySelector(".".concat(_styles.richMediaClassName));
|
|
145
|
+
}
|
|
146
|
+
return element;
|
|
147
|
+
},
|
|
148
|
+
items: generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPickerOptions, pluginInjectionApi),
|
|
149
|
+
scrollable: pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar ? false : true,
|
|
150
|
+
focusTrap: shouldEnableFocusTrap && (pluginState === null || pluginState === void 0 ? void 0 : pluginState.showLinkingToolbar)
|
|
151
|
+
}, (0, _EditLinkToolbar.editLinkToolbarConfig)(Boolean(pluginState === null || pluginState === void 0 ? void 0 : pluginState.showLinkingToolbar), isLinkPickerEnabled));
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
exports.floatingToolbar = floatingToolbar;
|
|
155
|
+
var unlinkCard = function unlinkCard(node, state, editorAnalyticsApi) {
|
|
156
|
+
var displayInfo = (0, _utils2.displayInfoForCard)(node, (0, _utils2.findCardInfo)(state));
|
|
157
|
+
var text = displayInfo.title || displayInfo.url;
|
|
158
|
+
if (text) {
|
|
159
|
+
return (0, _card.commandWithMetadata)((0, _doc.changeSelectedCardToText)(text, editorAnalyticsApi), {
|
|
160
|
+
action: _analytics.ACTION.UNLINK
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return function () {
|
|
164
|
+
return false;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, analyticsApi, cardOptions) {
|
|
168
|
+
return (0, _card.buildLayoutButtons)(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
169
|
+
};
|
|
170
|
+
var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
171
|
+
return (0, _card.commandWithMetadata)(command, {
|
|
172
|
+
inputMethod: _analytics.INPUT_METHOD.FLOATING_TB
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
176
|
+
return function (node) {
|
|
177
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs, _node$attrs2, _node$attrs2$datasour;
|
|
178
|
+
var _titleUrlPairFromNode2 = (0, _utils2.titleUrlPairFromNode)(node),
|
|
179
|
+
url = _titleUrlPairFromNode2.url;
|
|
180
|
+
var _ref = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.analytics) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
181
|
+
editorAnalyticsApi = _ref.actions;
|
|
182
|
+
var metadata = {};
|
|
183
|
+
if (url && !(0, _adfSchema.isSafeUrl)(url)) {
|
|
184
|
+
return [];
|
|
185
|
+
} else {
|
|
186
|
+
var _displayInfoForCard = (0, _utils2.displayInfoForCard)(node, (0, _utils2.findCardInfo)(state)),
|
|
187
|
+
title = _displayInfoForCard.title;
|
|
188
|
+
metadata = {
|
|
189
|
+
url: url,
|
|
190
|
+
title: title
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
var pluginState = _main.pluginKey.getState(state);
|
|
194
|
+
var currentAppearance = (0, _utils2.appearanceForNodeType)(node.type);
|
|
195
|
+
var _ref2 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.decorations) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
|
|
196
|
+
hoverDecoration = _ref2.hoverDecoration;
|
|
197
|
+
var isDatasource = currentAppearance === 'block' && (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
|
|
198
|
+
var shouldRenderDatasourceToolbar = isDatasource &&
|
|
199
|
+
// not showing toolbar in mobile for now since not sure what our plans are for it
|
|
200
|
+
platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id);
|
|
201
|
+
|
|
202
|
+
/* mobile builds toolbar natively using toolbarItems */
|
|
203
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
|
|
204
|
+
return [(0, _EditLinkToolbar.buildEditLinkToolbar)({
|
|
205
|
+
providerFactory: providerFactory,
|
|
206
|
+
linkPicker: linkPicker,
|
|
207
|
+
node: node,
|
|
208
|
+
featureFlags: featureFlags,
|
|
209
|
+
pluginInjectionApi: pluginInjectionApi
|
|
210
|
+
})];
|
|
211
|
+
} else if (shouldRenderDatasourceToolbar) {
|
|
212
|
+
return getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration);
|
|
213
|
+
} else {
|
|
214
|
+
var inlineCard = state.schema.nodes.inlineCard;
|
|
215
|
+
var toolbarItems = [{
|
|
216
|
+
id: 'editor.link.edit',
|
|
217
|
+
type: 'button',
|
|
218
|
+
selected: false,
|
|
219
|
+
metadata: metadata,
|
|
220
|
+
title: intl.formatMessage(_messages.linkToolbarMessages.editLink),
|
|
221
|
+
showTitle: true,
|
|
222
|
+
testId: 'link-toolbar-edit-link-button',
|
|
223
|
+
onClick: (0, _EditLinkToolbar.editLink)(editorAnalyticsApi)
|
|
224
|
+
}, {
|
|
225
|
+
type: 'separator'
|
|
226
|
+
}, {
|
|
227
|
+
id: 'editor.link.openLink',
|
|
228
|
+
type: 'button',
|
|
229
|
+
icon: _shortcut.default,
|
|
230
|
+
metadata: metadata,
|
|
231
|
+
className: 'hyperlink-open-link',
|
|
232
|
+
title: intl.formatMessage(_messages.linkMessages.openLink),
|
|
233
|
+
onClick: visitCardLink(editorAnalyticsApi)
|
|
234
|
+
}, {
|
|
235
|
+
type: 'separator'
|
|
236
|
+
}].concat((0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [{
|
|
237
|
+
type: 'copy-button',
|
|
238
|
+
items: [{
|
|
239
|
+
state: state,
|
|
240
|
+
formatMessage: intl.formatMessage,
|
|
241
|
+
nodeType: node.type
|
|
242
|
+
}, {
|
|
243
|
+
type: 'separator'
|
|
244
|
+
}]
|
|
245
|
+
}], (0, _toConsumableArray2.default)(getSettingsButtonGroup(state, featureFlags, intl, editorAnalyticsApi)), [{
|
|
246
|
+
id: 'editor.link.delete',
|
|
247
|
+
focusEditoronEnter: true,
|
|
248
|
+
type: 'button',
|
|
249
|
+
appearance: 'danger',
|
|
250
|
+
icon: _remove.default,
|
|
251
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
252
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
253
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
254
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
255
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
256
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
257
|
+
}]);
|
|
258
|
+
if (currentAppearance === 'embed') {
|
|
259
|
+
var _pluginInjectionApi$d6, _pluginInjectionApi$d7, _pluginInjectionApi$d8;
|
|
260
|
+
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d6 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d6 === void 0 ? void 0 : _pluginInjectionApi$d6.width, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d7 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d7 === void 0 ? void 0 : (_pluginInjectionApi$d8 = _pluginInjectionApi$d7.analytics) === null || _pluginInjectionApi$d8 === void 0 ? void 0 : _pluginInjectionApi$d8.actions, cardOptions);
|
|
261
|
+
if (alignmentOptions.length) {
|
|
262
|
+
alignmentOptions.push({
|
|
263
|
+
type: 'separator'
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
toolbarItems.unshift.apply(toolbarItems, (0, _toConsumableArray2.default)(alignmentOptions));
|
|
267
|
+
}
|
|
268
|
+
var allowBlockCards = cardOptions.allowBlockCards,
|
|
269
|
+
allowEmbeds = cardOptions.allowEmbeds;
|
|
270
|
+
|
|
271
|
+
// This code will be executed only for appearances such as "inline", "block" & "embed"
|
|
272
|
+
// For url appearance, please see HyperlinkToolbarAppearanceProps
|
|
273
|
+
if (currentAppearance) {
|
|
274
|
+
toolbarItems.unshift({
|
|
275
|
+
type: 'custom',
|
|
276
|
+
fallback: [],
|
|
277
|
+
render: function render(editorView) {
|
|
278
|
+
return /*#__PURE__*/_react.default.createElement(_LinkToolbarAppearance.LinkToolbarAppearance, {
|
|
279
|
+
key: "link-appearance",
|
|
280
|
+
url: url,
|
|
281
|
+
intl: intl,
|
|
282
|
+
currentAppearance: currentAppearance,
|
|
283
|
+
editorView: editorView,
|
|
284
|
+
editorState: state,
|
|
285
|
+
allowEmbeds: allowEmbeds,
|
|
286
|
+
allowBlockCards: allowBlockCards,
|
|
287
|
+
platform: platform,
|
|
288
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
289
|
+
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.card.actions
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}, {
|
|
293
|
+
type: 'separator'
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return toolbarItems;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi) {
|
|
301
|
+
return node.type === inlineCard ? [{
|
|
302
|
+
id: 'editor.link.unlink',
|
|
303
|
+
focusEditoronEnter: true,
|
|
304
|
+
type: 'button',
|
|
305
|
+
title: intl.formatMessage(_messages.linkToolbarMessages.unlink),
|
|
306
|
+
icon: _unlink.default,
|
|
307
|
+
onClick: withToolbarMetadata(unlinkCard(node, state, editorAnalyticsApi))
|
|
308
|
+
}, {
|
|
309
|
+
type: 'separator'
|
|
310
|
+
}] : [];
|
|
311
|
+
};
|
|
312
|
+
var getSettingsButtonGroup = function getSettingsButtonGroup(state, featureFlags, intl, editorAnalyticsApi) {
|
|
313
|
+
var floatingToolbarLinkSettingsButton = featureFlags.floatingToolbarLinkSettingsButton;
|
|
314
|
+
return floatingToolbarLinkSettingsButton === 'true' ? [{
|
|
315
|
+
id: 'editor.link.settings',
|
|
316
|
+
type: 'button',
|
|
317
|
+
icon: _settings.default,
|
|
318
|
+
title: intl.formatMessage(_messages.linkToolbarMessages.settingsLink),
|
|
319
|
+
onClick: openLinkSettings(editorAnalyticsApi)
|
|
320
|
+
}, {
|
|
321
|
+
type: 'separator'
|
|
322
|
+
}] : [];
|
|
323
|
+
};
|
|
324
|
+
var getDatasourceButtonGroup = function getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration) {
|
|
325
|
+
var _node$attrs3;
|
|
326
|
+
var toolbarItems = [{
|
|
327
|
+
id: 'editor.edit.datasource',
|
|
328
|
+
type: 'button',
|
|
329
|
+
icon: _SmallerEditIcon.SmallerEditIcon,
|
|
330
|
+
metadata: metadata,
|
|
331
|
+
className: 'datasource-edit',
|
|
332
|
+
title: intl.formatMessage(_messages.linkToolbarMessages.editDatasource),
|
|
333
|
+
onClick: (0, _EditLinkToolbar.editDatasource)(node, editorAnalyticsApi)
|
|
334
|
+
}];
|
|
335
|
+
if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
|
|
336
|
+
toolbarItems.push({
|
|
337
|
+
type: 'separator'
|
|
338
|
+
}, {
|
|
339
|
+
id: 'editor.link.openLink',
|
|
340
|
+
type: 'button',
|
|
341
|
+
icon: _shortcut.default,
|
|
342
|
+
metadata: metadata,
|
|
343
|
+
className: 'hyperlink-open-link',
|
|
344
|
+
title: intl.formatMessage(_messages.linkMessages.openLink),
|
|
345
|
+
onClick: visitCardLink(editorAnalyticsApi)
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
toolbarItems.push({
|
|
349
|
+
type: 'separator'
|
|
350
|
+
}, {
|
|
351
|
+
id: 'editor.link.delete',
|
|
352
|
+
focusEditoronEnter: true,
|
|
353
|
+
type: 'button',
|
|
354
|
+
appearance: 'danger',
|
|
355
|
+
icon: _remove.default,
|
|
356
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
357
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
358
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
359
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
360
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
361
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
362
|
+
});
|
|
363
|
+
return toolbarItems;
|
|
364
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
|
+
var _index = require("./index");
|
|
11
|
+
var ModalWithState = function ModalWithState(_ref) {
|
|
12
|
+
var api = _ref.api,
|
|
13
|
+
editorView = _ref.editorView;
|
|
14
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['card']),
|
|
15
|
+
cardState = _useSharedPluginState.cardState;
|
|
16
|
+
if (!(cardState !== null && cardState !== void 0 && cardState.showDatasourceModal)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_index.DatasourceModal, {
|
|
20
|
+
view: editorView,
|
|
21
|
+
modalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var _default = ModalWithState;
|
|
25
|
+
exports.default = _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.DatasourceModal = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
12
|
+
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
13
|
+
var _actions = require("../../pm-plugins/actions");
|
|
14
|
+
var _doc = require("../../pm-plugins/doc");
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
var DatasourceModal = function DatasourceModal(_ref) {
|
|
18
|
+
var view = _ref.view,
|
|
19
|
+
modalType = _ref.modalType;
|
|
20
|
+
var dispatch = view.dispatch,
|
|
21
|
+
state = view.state;
|
|
22
|
+
var selection = state.selection;
|
|
23
|
+
var existingNode = selection instanceof _prosemirrorState.NodeSelection ? selection.node : undefined;
|
|
24
|
+
var onClose = (0, _react.useCallback)(function () {
|
|
25
|
+
dispatch((0, _actions.hideDatasourceModal)(state.tr));
|
|
26
|
+
}, [dispatch, state.tr]);
|
|
27
|
+
var onInsert = (0, _react.useCallback)(function (newAdf) {
|
|
28
|
+
if (existingNode) {
|
|
29
|
+
(0, _doc.updateExistingDatasource)(state, existingNode, newAdf, view);
|
|
30
|
+
} else {
|
|
31
|
+
(0, _doc.insertDatasource)(state, newAdf, view);
|
|
32
|
+
}
|
|
33
|
+
}, [existingNode, state, view]);
|
|
34
|
+
if (modalType === 'jira') {
|
|
35
|
+
var _existingNode$attrs, _tableView$properties;
|
|
36
|
+
var _ref2 = (existingNode === null || existingNode === void 0 ? void 0 : (_existingNode$attrs = existingNode.attrs) === null || _existingNode$attrs === void 0 ? void 0 : _existingNode$attrs.datasource) || {},
|
|
37
|
+
_ref2$id = _ref2.id,
|
|
38
|
+
datasourceId = _ref2$id === void 0 ? _linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID : _ref2$id,
|
|
39
|
+
parameters = _ref2.parameters,
|
|
40
|
+
_ref2$views = _ref2.views,
|
|
41
|
+
views = _ref2$views === void 0 ? [] : _ref2$views;
|
|
42
|
+
var _ref3 = views,
|
|
43
|
+
_ref4 = (0, _slicedToArray2.default)(_ref3, 1),
|
|
44
|
+
tableView = _ref4[0];
|
|
45
|
+
var visibleColumnKeys = tableView === null || tableView === void 0 ? void 0 : (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (column) {
|
|
46
|
+
return column.key;
|
|
47
|
+
});
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
"data-testid": "jira-config-modal"
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_linkDatasource.JiraIssuesConfigModal, {
|
|
51
|
+
datasourceId: datasourceId,
|
|
52
|
+
visibleColumnKeys: visibleColumnKeys,
|
|
53
|
+
parameters: parameters,
|
|
54
|
+
onCancel: onClose,
|
|
55
|
+
onInsert: onInsert
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
return null; // null for now until we have modal component that handles other datasources
|
|
59
|
+
};
|
|
60
|
+
exports.DatasourceModal = DatasourceModal;
|