@atlaskit/editor-plugin-card 1.4.3 → 1.5.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/CHANGELOG.md +18 -0
- package/dist/cjs/plugin.js +21 -1
- package/dist/cjs/ui/DatasourceModal/index.js +57 -0
- package/dist/cjs/utils.js +4 -0
- package/dist/es2019/plugin.js +21 -3
- package/dist/es2019/ui/DatasourceModal/index.js +47 -1
- package/dist/es2019/utils.js +5 -1
- package/dist/esm/plugin.js +23 -3
- package/dist/esm/ui/DatasourceModal/index.js +58 -1
- package/dist/esm/utils.js +5 -1
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#87262](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87262) [`a30a91a62f03`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a30a91a62f03) - Add slash command for confluence search datasource creation
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 1.4.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#88295](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88295) [`6b703183b847`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6b703183b847) - [ux] Remove (Beta) from the /Assets and + Assets elements description for GA
|
|
18
|
+
- [#88531](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88531) [`2362c633e4e9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2362c633e4e9) - Adds confluence-search modal integration
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 1.4.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -12,6 +12,7 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
12
12
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
13
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
14
|
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _createEventsQueue = require("./analytics/create-events-queue");
|
|
16
17
|
var _actions = require("./pm-plugins/actions");
|
|
17
18
|
var _doc = require("./pm-plugins/doc");
|
|
@@ -24,6 +25,7 @@ var _ModalWithState = _interopRequireDefault(require("./ui/DatasourceModal/Modal
|
|
|
24
25
|
var _EditorLinkingPlatformAnalytics = require("./ui/EditorLinkingPlatformAnalytics");
|
|
25
26
|
var _EditorSmartCardEvents = require("./ui/EditorSmartCardEvents");
|
|
26
27
|
var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
|
|
28
|
+
var _utils2 = require("./utils");
|
|
27
29
|
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; }
|
|
28
30
|
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; }
|
|
29
31
|
/**
|
|
@@ -150,7 +152,7 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
150
152
|
if ((0, _utils.canRenderDatasource)(_linkDatasource.ASSETS_LIST_OF_LINKS_DATASOURCE_ID)) {
|
|
151
153
|
quickInsertArray.push({
|
|
152
154
|
id: 'datasource',
|
|
153
|
-
title: formatMessage(_messages.cardMessages.datasourceAssetsObjects),
|
|
155
|
+
title: (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource-assets_objects_remove_beta') ? formatMessage(_messages.cardMessages.datasourceAssetsObjectsGeneralAvailability) : formatMessage(_messages.cardMessages.datasourceAssetsObjects),
|
|
154
156
|
description: formatMessage(_messages.cardMessages.datasourceAssetsObjectsDescription),
|
|
155
157
|
categories: ['external-content', 'development'],
|
|
156
158
|
keywords: ['assets'],
|
|
@@ -164,6 +166,24 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
164
166
|
}
|
|
165
167
|
});
|
|
166
168
|
}
|
|
169
|
+
if ((0, _utils2.isDatasourceConfigEditable)(_linkDatasource.CONFLUENCE_SEARCH_DATASOURCE_ID)) {
|
|
170
|
+
quickInsertArray.push({
|
|
171
|
+
id: 'datasource',
|
|
172
|
+
title: formatMessage(_messages.cardMessages.datasourceConfluenceSearch),
|
|
173
|
+
description: formatMessage(_messages.cardMessages.datasourceConfluenceSearchDescription),
|
|
174
|
+
categories: ['external-content', 'development'],
|
|
175
|
+
keywords: ['confluence'],
|
|
176
|
+
featured: true,
|
|
177
|
+
icon: function icon() {
|
|
178
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconDatasourceConfluenceSearch, null);
|
|
179
|
+
},
|
|
180
|
+
action: function action(insert) {
|
|
181
|
+
var tr = insert(undefined);
|
|
182
|
+
(0, _actions.showDatasourceModal)('confluence-search')(tr);
|
|
183
|
+
return tr;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
167
187
|
return quickInsertArray;
|
|
168
188
|
}
|
|
169
189
|
}
|
|
@@ -162,5 +162,62 @@ var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
|
|
|
162
162
|
onInsert: onInsert
|
|
163
163
|
}));
|
|
164
164
|
}
|
|
165
|
+
|
|
166
|
+
// TODO: further refactor in https://product-fabric.atlassian.net/browse/EDM-9637
|
|
167
|
+
if (modalType === 'confluence-search') {
|
|
168
|
+
var _existingNode7, _tableView2$propertie, _existingNode8;
|
|
169
|
+
if (!ready) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
var _ref8 = ((_existingNode7 = existingNode) === null || _existingNode7 === void 0 || (_existingNode7 = _existingNode7.attrs) === null || _existingNode7 === void 0 ? void 0 : _existingNode7.datasource) || {},
|
|
173
|
+
_ref8$id = _ref8.id,
|
|
174
|
+
_datasourceId2 = _ref8$id === void 0 ? _linkDatasource.CONFLUENCE_SEARCH_DATASOURCE_ID : _ref8$id,
|
|
175
|
+
_parameters2 = _ref8.parameters,
|
|
176
|
+
_ref8$views = _ref8.views,
|
|
177
|
+
_views2 = _ref8$views === void 0 ? [] : _ref8$views;
|
|
178
|
+
var _ref9 = _views2,
|
|
179
|
+
_ref10 = (0, _slicedToArray2.default)(_ref9, 1),
|
|
180
|
+
_tableView2 = _ref10[0];
|
|
181
|
+
var _visibleColumnKeys2 = [];
|
|
182
|
+
var _wrappedColumnKeys = [];
|
|
183
|
+
var _columnCustomSizes;
|
|
184
|
+
var _columns = _tableView2 === null || _tableView2 === void 0 || (_tableView2$propertie = _tableView2.properties) === null || _tableView2$propertie === void 0 ? void 0 : _tableView2$propertie.columns;
|
|
185
|
+
if (_columns) {
|
|
186
|
+
_columnCustomSizes = {};
|
|
187
|
+
var _iterator2 = _createForOfIteratorHelper(_columns),
|
|
188
|
+
_step2;
|
|
189
|
+
try {
|
|
190
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
191
|
+
var _step2$value = _step2.value,
|
|
192
|
+
_key2 = _step2$value.key,
|
|
193
|
+
_width = _step2$value.width,
|
|
194
|
+
_isWrapped = _step2$value.isWrapped;
|
|
195
|
+
_visibleColumnKeys2.push(_key2);
|
|
196
|
+
if (_width) {
|
|
197
|
+
_columnCustomSizes[_key2] = _width;
|
|
198
|
+
}
|
|
199
|
+
if (_isWrapped) {
|
|
200
|
+
_wrappedColumnKeys.push(_key2);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
} catch (err) {
|
|
204
|
+
_iterator2.e(err);
|
|
205
|
+
} finally {
|
|
206
|
+
_iterator2.f();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
210
|
+
"data-testid": "confluence-search-config-modal"
|
|
211
|
+
}, /*#__PURE__*/_react.default.createElement(_linkDatasource.ConfluenceSearchConfigModal, {
|
|
212
|
+
datasourceId: _datasourceId2,
|
|
213
|
+
visibleColumnKeys: _visibleColumnKeys2,
|
|
214
|
+
parameters: _parameters2,
|
|
215
|
+
url: (_existingNode8 = existingNode) === null || _existingNode8 === void 0 ? void 0 : _existingNode8.attrs.url,
|
|
216
|
+
columnCustomSizes: _columnCustomSizes,
|
|
217
|
+
wrappedColumnKeys: _wrappedColumnKeys,
|
|
218
|
+
onCancel: onClose,
|
|
219
|
+
onInsert: onInsert
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
165
222
|
return null; // null for now until we have modal component that handles other datasources
|
|
166
223
|
};
|
package/dist/cjs/utils.js
CHANGED
|
@@ -8,6 +8,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _resolvedAttributes = require("@atlaskit/link-analytics/resolved-attributes");
|
|
10
10
|
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
12
13
|
var appearanceForNodeType = exports.appearanceForNodeType = function appearanceForNodeType(spec) {
|
|
13
14
|
if (spec.name === 'inlineCard') {
|
|
@@ -79,5 +80,8 @@ var getResolvedAttributesFromStore = exports.getResolvedAttributesFromStore = fu
|
|
|
79
80
|
};
|
|
80
81
|
var isDatasourceConfigEditable = exports.isDatasourceConfigEditable = function isDatasourceConfigEditable(datasourceId) {
|
|
81
82
|
var datasourcesWithConfigModal = [_linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID, _linkDatasource.ASSETS_LIST_OF_LINKS_DATASOURCE_ID];
|
|
83
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource.enable-confluence-search-modal')) {
|
|
84
|
+
datasourcesWithConfigModal.push(_linkDatasource.CONFLUENCE_SEARCH_DATASOURCE_ID);
|
|
85
|
+
}
|
|
82
86
|
return datasourcesWithConfigModal.includes(datasourceId);
|
|
83
87
|
};
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { blockCard, embedCard, inlineCard } from '@atlaskit/adf-schema';
|
|
3
3
|
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { IconDatasourceAssetsObjects, IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
|
|
4
|
+
import { IconDatasourceAssetsObjects, IconDatasourceConfluenceSearch, IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
|
|
5
5
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
6
|
-
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
6
|
+
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, CONFLUENCE_SEARCH_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
7
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { createEventsQueue } from './analytics/create-events-queue';
|
|
8
9
|
import { hideLinkToolbar, showDatasourceModal } from './pm-plugins/actions';
|
|
9
10
|
import { changeSelectedCardToLink, queueCardsFromChangedTr, setSelectedCardAppearance } from './pm-plugins/doc';
|
|
@@ -16,6 +17,7 @@ import DatasourceModalWithState from './ui/DatasourceModal/ModalWithState';
|
|
|
16
17
|
import { EditorLinkingPlatformAnalytics } from './ui/EditorLinkingPlatformAnalytics';
|
|
17
18
|
import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
|
|
18
19
|
import LayoutButton from './ui/LayoutButton';
|
|
20
|
+
import { isDatasourceConfigEditable } from './utils';
|
|
19
21
|
/**
|
|
20
22
|
* Card plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
21
23
|
* from `@atlaskit/editor-core`.
|
|
@@ -141,7 +143,7 @@ export const cardPlugin = ({
|
|
|
141
143
|
if (canRenderDatasource(ASSETS_LIST_OF_LINKS_DATASOURCE_ID)) {
|
|
142
144
|
quickInsertArray.push({
|
|
143
145
|
id: 'datasource',
|
|
144
|
-
title: formatMessage(messages.datasourceAssetsObjects),
|
|
146
|
+
title: getBooleanFF('platform.linking-platform.datasource-assets_objects_remove_beta') ? formatMessage(messages.datasourceAssetsObjectsGeneralAvailability) : formatMessage(messages.datasourceAssetsObjects),
|
|
145
147
|
description: formatMessage(messages.datasourceAssetsObjectsDescription),
|
|
146
148
|
categories: ['external-content', 'development'],
|
|
147
149
|
keywords: ['assets'],
|
|
@@ -153,6 +155,22 @@ export const cardPlugin = ({
|
|
|
153
155
|
}
|
|
154
156
|
});
|
|
155
157
|
}
|
|
158
|
+
if (isDatasourceConfigEditable(CONFLUENCE_SEARCH_DATASOURCE_ID)) {
|
|
159
|
+
quickInsertArray.push({
|
|
160
|
+
id: 'datasource',
|
|
161
|
+
title: formatMessage(messages.datasourceConfluenceSearch),
|
|
162
|
+
description: formatMessage(messages.datasourceConfluenceSearchDescription),
|
|
163
|
+
categories: ['external-content', 'development'],
|
|
164
|
+
keywords: ['confluence'],
|
|
165
|
+
featured: true,
|
|
166
|
+
icon: () => /*#__PURE__*/React.createElement(IconDatasourceConfluenceSearch, null),
|
|
167
|
+
action(insert) {
|
|
168
|
+
const tr = insert(undefined);
|
|
169
|
+
showDatasourceModal('confluence-search')(tr);
|
|
170
|
+
return tr;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
156
174
|
return quickInsertArray;
|
|
157
175
|
}
|
|
158
176
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, AssetsConfigModal, JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
|
|
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
4
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { hideDatasourceModal } from '../../pm-plugins/actions';
|
|
6
6
|
import { insertDatasource, updateCardViaDatasource } from '../../pm-plugins/doc';
|
|
@@ -133,5 +133,51 @@ export const DatasourceModal = ({
|
|
|
133
133
|
onInsert: onInsert
|
|
134
134
|
}));
|
|
135
135
|
}
|
|
136
|
+
|
|
137
|
+
// TODO: further refactor in https://product-fabric.atlassian.net/browse/EDM-9637
|
|
138
|
+
if (modalType === 'confluence-search') {
|
|
139
|
+
var _existingNode7, _existingNode7$attrs, _tableView$properties3, _existingNode8;
|
|
140
|
+
if (!ready) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
const {
|
|
144
|
+
id: datasourceId = CONFLUENCE_SEARCH_DATASOURCE_ID,
|
|
145
|
+
parameters,
|
|
146
|
+
views = []
|
|
147
|
+
} = ((_existingNode7 = existingNode) === null || _existingNode7 === void 0 ? void 0 : (_existingNode7$attrs = _existingNode7.attrs) === null || _existingNode7$attrs === void 0 ? void 0 : _existingNode7$attrs.datasource) || {};
|
|
148
|
+
const [tableView] = views;
|
|
149
|
+
const visibleColumnKeys = [];
|
|
150
|
+
const wrappedColumnKeys = [];
|
|
151
|
+
let columnCustomSizes;
|
|
152
|
+
const columns = tableView === null || tableView === void 0 ? void 0 : (_tableView$properties3 = tableView.properties) === null || _tableView$properties3 === void 0 ? void 0 : _tableView$properties3.columns;
|
|
153
|
+
if (columns) {
|
|
154
|
+
columnCustomSizes = {};
|
|
155
|
+
for (const {
|
|
156
|
+
key,
|
|
157
|
+
width,
|
|
158
|
+
isWrapped
|
|
159
|
+
} of columns) {
|
|
160
|
+
visibleColumnKeys.push(key);
|
|
161
|
+
if (width) {
|
|
162
|
+
columnCustomSizes[key] = width;
|
|
163
|
+
}
|
|
164
|
+
if (isWrapped) {
|
|
165
|
+
wrappedColumnKeys.push(key);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
170
|
+
"data-testid": "confluence-search-config-modal"
|
|
171
|
+
}, /*#__PURE__*/React.createElement(ConfluenceSearchConfigModal, {
|
|
172
|
+
datasourceId: datasourceId,
|
|
173
|
+
visibleColumnKeys: visibleColumnKeys,
|
|
174
|
+
parameters: parameters,
|
|
175
|
+
url: (_existingNode8 = existingNode) === null || _existingNode8 === void 0 ? void 0 : _existingNode8.attrs.url,
|
|
176
|
+
columnCustomSizes: columnCustomSizes,
|
|
177
|
+
wrappedColumnKeys: wrappedColumnKeys,
|
|
178
|
+
onCancel: onClose,
|
|
179
|
+
onInsert: onInsert
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
136
182
|
return null; // null for now until we have modal component that handles other datasources
|
|
137
183
|
};
|
package/dist/es2019/utils.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
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
|
-
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
4
|
+
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, CONFLUENCE_SEARCH_DATASOURCE_ID, JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
6
7
|
export const appearanceForNodeType = spec => {
|
|
7
8
|
if (spec.name === 'inlineCard') {
|
|
@@ -67,5 +68,8 @@ export const getResolvedAttributesFromStore = (url, display, store) => {
|
|
|
67
68
|
};
|
|
68
69
|
export const isDatasourceConfigEditable = datasourceId => {
|
|
69
70
|
const datasourcesWithConfigModal = [JIRA_LIST_OF_LINKS_DATASOURCE_ID, ASSETS_LIST_OF_LINKS_DATASOURCE_ID];
|
|
71
|
+
if (getBooleanFF('platform.linking-platform.datasource.enable-confluence-search-modal')) {
|
|
72
|
+
datasourcesWithConfigModal.push(CONFLUENCE_SEARCH_DATASOURCE_ID);
|
|
73
|
+
}
|
|
70
74
|
return datasourcesWithConfigModal.includes(datasourceId);
|
|
71
75
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -4,9 +4,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { blockCard, embedCard, inlineCard } from '@atlaskit/adf-schema';
|
|
6
6
|
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
-
import { IconDatasourceAssetsObjects, IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
+
import { IconDatasourceAssetsObjects, IconDatasourceConfluenceSearch, IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
|
|
8
8
|
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
9
|
-
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
9
|
+
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, CONFLUENCE_SEARCH_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
10
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { createEventsQueue } from './analytics/create-events-queue';
|
|
11
12
|
import { hideLinkToolbar, showDatasourceModal } from './pm-plugins/actions';
|
|
12
13
|
import { changeSelectedCardToLink, queueCardsFromChangedTr, setSelectedCardAppearance } from './pm-plugins/doc';
|
|
@@ -19,6 +20,7 @@ import DatasourceModalWithState from './ui/DatasourceModal/ModalWithState';
|
|
|
19
20
|
import { EditorLinkingPlatformAnalytics } from './ui/EditorLinkingPlatformAnalytics';
|
|
20
21
|
import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
|
|
21
22
|
import LayoutButton from './ui/LayoutButton';
|
|
23
|
+
import { isDatasourceConfigEditable } from './utils';
|
|
22
24
|
/**
|
|
23
25
|
* Card plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
24
26
|
* from `@atlaskit/editor-core`.
|
|
@@ -143,7 +145,7 @@ export var cardPlugin = function cardPlugin(_ref) {
|
|
|
143
145
|
if (canRenderDatasource(ASSETS_LIST_OF_LINKS_DATASOURCE_ID)) {
|
|
144
146
|
quickInsertArray.push({
|
|
145
147
|
id: 'datasource',
|
|
146
|
-
title: formatMessage(messages.datasourceAssetsObjects),
|
|
148
|
+
title: getBooleanFF('platform.linking-platform.datasource-assets_objects_remove_beta') ? formatMessage(messages.datasourceAssetsObjectsGeneralAvailability) : formatMessage(messages.datasourceAssetsObjects),
|
|
147
149
|
description: formatMessage(messages.datasourceAssetsObjectsDescription),
|
|
148
150
|
categories: ['external-content', 'development'],
|
|
149
151
|
keywords: ['assets'],
|
|
@@ -157,6 +159,24 @@ export var cardPlugin = function cardPlugin(_ref) {
|
|
|
157
159
|
}
|
|
158
160
|
});
|
|
159
161
|
}
|
|
162
|
+
if (isDatasourceConfigEditable(CONFLUENCE_SEARCH_DATASOURCE_ID)) {
|
|
163
|
+
quickInsertArray.push({
|
|
164
|
+
id: 'datasource',
|
|
165
|
+
title: formatMessage(messages.datasourceConfluenceSearch),
|
|
166
|
+
description: formatMessage(messages.datasourceConfluenceSearchDescription),
|
|
167
|
+
categories: ['external-content', 'development'],
|
|
168
|
+
keywords: ['confluence'],
|
|
169
|
+
featured: true,
|
|
170
|
+
icon: function icon() {
|
|
171
|
+
return /*#__PURE__*/React.createElement(IconDatasourceConfluenceSearch, null);
|
|
172
|
+
},
|
|
173
|
+
action: function action(insert) {
|
|
174
|
+
var tr = insert(undefined);
|
|
175
|
+
showDatasourceModal('confluence-search')(tr);
|
|
176
|
+
return tr;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
160
180
|
return quickInsertArray;
|
|
161
181
|
}
|
|
162
182
|
}
|
|
@@ -7,7 +7,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
7
7
|
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; }
|
|
8
8
|
import React, { useCallback } from 'react';
|
|
9
9
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
|
-
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, AssetsConfigModal, JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
|
|
10
|
+
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, AssetsConfigModal, CONFLUENCE_SEARCH_DATASOURCE_ID, ConfluenceSearchConfigModal, JIRA_LIST_OF_LINKS_DATASOURCE_ID, JiraIssuesConfigModal } from '@atlaskit/link-datasource';
|
|
11
11
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { hideDatasourceModal } from '../../pm-plugins/actions';
|
|
13
13
|
import { insertDatasource, updateCardViaDatasource } from '../../pm-plugins/doc';
|
|
@@ -152,5 +152,62 @@ export var DatasourceModal = function DatasourceModal(_ref) {
|
|
|
152
152
|
onInsert: onInsert
|
|
153
153
|
}));
|
|
154
154
|
}
|
|
155
|
+
|
|
156
|
+
// TODO: further refactor in https://product-fabric.atlassian.net/browse/EDM-9637
|
|
157
|
+
if (modalType === 'confluence-search') {
|
|
158
|
+
var _existingNode7, _tableView2$propertie, _existingNode8;
|
|
159
|
+
if (!ready) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
var _ref8 = ((_existingNode7 = existingNode) === null || _existingNode7 === void 0 || (_existingNode7 = _existingNode7.attrs) === null || _existingNode7 === void 0 ? void 0 : _existingNode7.datasource) || {},
|
|
163
|
+
_ref8$id = _ref8.id,
|
|
164
|
+
_datasourceId2 = _ref8$id === void 0 ? CONFLUENCE_SEARCH_DATASOURCE_ID : _ref8$id,
|
|
165
|
+
_parameters2 = _ref8.parameters,
|
|
166
|
+
_ref8$views = _ref8.views,
|
|
167
|
+
_views2 = _ref8$views === void 0 ? [] : _ref8$views;
|
|
168
|
+
var _ref9 = _views2,
|
|
169
|
+
_ref10 = _slicedToArray(_ref9, 1),
|
|
170
|
+
_tableView2 = _ref10[0];
|
|
171
|
+
var _visibleColumnKeys2 = [];
|
|
172
|
+
var _wrappedColumnKeys = [];
|
|
173
|
+
var _columnCustomSizes;
|
|
174
|
+
var _columns = _tableView2 === null || _tableView2 === void 0 || (_tableView2$propertie = _tableView2.properties) === null || _tableView2$propertie === void 0 ? void 0 : _tableView2$propertie.columns;
|
|
175
|
+
if (_columns) {
|
|
176
|
+
_columnCustomSizes = {};
|
|
177
|
+
var _iterator2 = _createForOfIteratorHelper(_columns),
|
|
178
|
+
_step2;
|
|
179
|
+
try {
|
|
180
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
181
|
+
var _step2$value = _step2.value,
|
|
182
|
+
_key2 = _step2$value.key,
|
|
183
|
+
_width = _step2$value.width,
|
|
184
|
+
_isWrapped = _step2$value.isWrapped;
|
|
185
|
+
_visibleColumnKeys2.push(_key2);
|
|
186
|
+
if (_width) {
|
|
187
|
+
_columnCustomSizes[_key2] = _width;
|
|
188
|
+
}
|
|
189
|
+
if (_isWrapped) {
|
|
190
|
+
_wrappedColumnKeys.push(_key2);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
} catch (err) {
|
|
194
|
+
_iterator2.e(err);
|
|
195
|
+
} finally {
|
|
196
|
+
_iterator2.f();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
200
|
+
"data-testid": "confluence-search-config-modal"
|
|
201
|
+
}, /*#__PURE__*/React.createElement(ConfluenceSearchConfigModal, {
|
|
202
|
+
datasourceId: _datasourceId2,
|
|
203
|
+
visibleColumnKeys: _visibleColumnKeys2,
|
|
204
|
+
parameters: _parameters2,
|
|
205
|
+
url: (_existingNode8 = existingNode) === null || _existingNode8 === void 0 ? void 0 : _existingNode8.attrs.url,
|
|
206
|
+
columnCustomSizes: _columnCustomSizes,
|
|
207
|
+
wrappedColumnKeys: _wrappedColumnKeys,
|
|
208
|
+
onCancel: onClose,
|
|
209
|
+
onInsert: onInsert
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
155
212
|
return null; // null for now until we have modal component that handles other datasources
|
|
156
213
|
};
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
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
|
-
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
4
|
+
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, CONFLUENCE_SEARCH_DATASOURCE_ID, JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
5
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
6
7
|
export var appearanceForNodeType = function appearanceForNodeType(spec) {
|
|
7
8
|
if (spec.name === 'inlineCard') {
|
|
@@ -73,5 +74,8 @@ export var getResolvedAttributesFromStore = function getResolvedAttributesFromSt
|
|
|
73
74
|
};
|
|
74
75
|
export var isDatasourceConfigEditable = function isDatasourceConfigEditable(datasourceId) {
|
|
75
76
|
var datasourcesWithConfigModal = [JIRA_LIST_OF_LINKS_DATASOURCE_ID, ASSETS_LIST_OF_LINKS_DATASOURCE_ID];
|
|
77
|
+
if (getBooleanFF('platform.linking-platform.datasource.enable-confluence-search-modal')) {
|
|
78
|
+
datasourcesWithConfigModal.push(CONFLUENCE_SEARCH_DATASOURCE_ID);
|
|
79
|
+
}
|
|
76
80
|
return datasourcesWithConfigModal.includes(datasourceId);
|
|
77
81
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@atlaskit/adf-schema": "^35.8.0",
|
|
36
36
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
37
37
|
"@atlaskit/custom-steps": "^0.0.17",
|
|
38
|
-
"@atlaskit/editor-common": "^78.
|
|
38
|
+
"@atlaskit/editor-common": "^78.25.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^1.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/icon": "^22.1.0",
|
|
50
50
|
"@atlaskit/link-analytics": "^8.3.0",
|
|
51
51
|
"@atlaskit/link-client-extension": "^1.8.0",
|
|
52
|
-
"@atlaskit/link-datasource": "^1.
|
|
52
|
+
"@atlaskit/link-datasource": "^1.26.0",
|
|
53
53
|
"@atlaskit/linking-common": "^5.6.0",
|
|
54
54
|
"@atlaskit/linking-types": "^8.8.0",
|
|
55
55
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
@@ -118,6 +118,12 @@
|
|
|
118
118
|
},
|
|
119
119
|
"platform.editor.card.fix-embed-card-select-all": {
|
|
120
120
|
"type": "boolean"
|
|
121
|
+
},
|
|
122
|
+
"platform.linking-platform.datasource.enable-confluence-search-modal": {
|
|
123
|
+
"type": "boolean"
|
|
124
|
+
},
|
|
125
|
+
"platform.linking-platform.datasource-assets_objects_remove_beta": {
|
|
126
|
+
"type": "boolean"
|
|
121
127
|
}
|
|
122
128
|
},
|
|
123
129
|
"stricter": {
|