@atlaskit/editor-plugin-card 1.4.3 → 1.4.4

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 1.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+ - [#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
9
+ - Updated dependencies
10
+
3
11
  ## 1.4.3
4
12
 
5
13
  ### Patch Changes
@@ -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");
@@ -150,7 +151,7 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
150
151
  if ((0, _utils.canRenderDatasource)(_linkDatasource.ASSETS_LIST_OF_LINKS_DATASOURCE_ID)) {
151
152
  quickInsertArray.push({
152
153
  id: 'datasource',
153
- title: formatMessage(_messages.cardMessages.datasourceAssetsObjects),
154
+ title: (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.datasource-assets_objects_remove_beta') ? formatMessage(_messages.cardMessages.datasourceAssetsObjectsGeneralAvailability) : formatMessage(_messages.cardMessages.datasourceAssetsObjects),
154
155
  description: formatMessage(_messages.cardMessages.datasourceAssetsObjectsDescription),
155
156
  categories: ['external-content', 'development'],
156
157
  keywords: ['assets'],
@@ -162,5 +162,61 @@ var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
162
162
  onInsert: onInsert
163
163
  }));
164
164
  }
165
+ if (modalType === 'confluence-search') {
166
+ var _existingNode7, _tableView2$propertie, _existingNode8;
167
+ if (!ready) {
168
+ return null;
169
+ }
170
+ var _ref8 = ((_existingNode7 = existingNode) === null || _existingNode7 === void 0 || (_existingNode7 = _existingNode7.attrs) === null || _existingNode7 === void 0 ? void 0 : _existingNode7.datasource) || {},
171
+ _ref8$id = _ref8.id,
172
+ _datasourceId2 = _ref8$id === void 0 ? _linkDatasource.CONFLUENCE_SEARCH_DATASOURCE_ID : _ref8$id,
173
+ _parameters2 = _ref8.parameters,
174
+ _ref8$views = _ref8.views,
175
+ _views2 = _ref8$views === void 0 ? [] : _ref8$views;
176
+ var _ref9 = _views2,
177
+ _ref10 = (0, _slicedToArray2.default)(_ref9, 1),
178
+ _tableView2 = _ref10[0];
179
+ var _visibleColumnKeys2 = [];
180
+ var _wrappedColumnKeys = [];
181
+ var _columnCustomSizes;
182
+ var _columns = _tableView2 === null || _tableView2 === void 0 || (_tableView2$propertie = _tableView2.properties) === null || _tableView2$propertie === void 0 ? void 0 : _tableView2$propertie.columns;
183
+ if (_columns) {
184
+ _columnCustomSizes = {};
185
+ var _iterator2 = _createForOfIteratorHelper(_columns),
186
+ _step2;
187
+ try {
188
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
189
+ var _step2$value = _step2.value,
190
+ _key2 = _step2$value.key,
191
+ _width = _step2$value.width,
192
+ _isWrapped = _step2$value.isWrapped;
193
+ _visibleColumnKeys2.push(_key2);
194
+ if (_width) {
195
+ _columnCustomSizes[_key2] = _width;
196
+ }
197
+ if (_isWrapped) {
198
+ _wrappedColumnKeys.push(_key2);
199
+ }
200
+ }
201
+ } catch (err) {
202
+ _iterator2.e(err);
203
+ } finally {
204
+ _iterator2.f();
205
+ }
206
+ }
207
+ return /*#__PURE__*/_react.default.createElement("div", {
208
+ "data-testid": "confluence-search-config-modal"
209
+ }, /*#__PURE__*/_react.default.createElement(_linkDatasource.ConfluenceSearchConfigModal, {
210
+ datasourceId: _datasourceId2,
211
+ viewMode: 'issue',
212
+ visibleColumnKeys: _visibleColumnKeys2,
213
+ parameters: _parameters2,
214
+ url: (_existingNode8 = existingNode) === null || _existingNode8 === void 0 ? void 0 : _existingNode8.attrs.url,
215
+ columnCustomSizes: _columnCustomSizes,
216
+ wrappedColumnKeys: _wrappedColumnKeys,
217
+ onCancel: onClose,
218
+ onInsert: onInsert
219
+ }));
220
+ }
165
221
  return null; // null for now until we have modal component that handles other datasources
166
222
  };
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
  };
@@ -4,6 +4,7 @@ import { cardMessages as messages } from '@atlaskit/editor-common/messages';
4
4
  import { IconDatasourceAssetsObjects, IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
5
5
  import { canRenderDatasource } from '@atlaskit/editor-common/utils';
6
6
  import { ASSETS_LIST_OF_LINKS_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';
@@ -141,7 +142,7 @@ export const cardPlugin = ({
141
142
  if (canRenderDatasource(ASSETS_LIST_OF_LINKS_DATASOURCE_ID)) {
142
143
  quickInsertArray.push({
143
144
  id: 'datasource',
144
- title: formatMessage(messages.datasourceAssetsObjects),
145
+ title: getBooleanFF('platform.linking-platform.datasource-assets_objects_remove_beta') ? formatMessage(messages.datasourceAssetsObjectsGeneralAvailability) : formatMessage(messages.datasourceAssetsObjects),
145
146
  description: formatMessage(messages.datasourceAssetsObjectsDescription),
146
147
  categories: ['external-content', 'development'],
147
148
  keywords: ['assets'],
@@ -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,50 @@ export const DatasourceModal = ({
133
133
  onInsert: onInsert
134
134
  }));
135
135
  }
136
+ if (modalType === 'confluence-search') {
137
+ var _existingNode7, _existingNode7$attrs, _tableView$properties3, _existingNode8;
138
+ if (!ready) {
139
+ return null;
140
+ }
141
+ const {
142
+ id: datasourceId = CONFLUENCE_SEARCH_DATASOURCE_ID,
143
+ parameters,
144
+ views = []
145
+ } = ((_existingNode7 = existingNode) === null || _existingNode7 === void 0 ? void 0 : (_existingNode7$attrs = _existingNode7.attrs) === null || _existingNode7$attrs === void 0 ? void 0 : _existingNode7$attrs.datasource) || {};
146
+ const [tableView] = views;
147
+ const visibleColumnKeys = [];
148
+ const wrappedColumnKeys = [];
149
+ let columnCustomSizes;
150
+ const columns = tableView === null || tableView === void 0 ? void 0 : (_tableView$properties3 = tableView.properties) === null || _tableView$properties3 === void 0 ? void 0 : _tableView$properties3.columns;
151
+ if (columns) {
152
+ columnCustomSizes = {};
153
+ for (const {
154
+ key,
155
+ width,
156
+ isWrapped
157
+ } of columns) {
158
+ visibleColumnKeys.push(key);
159
+ if (width) {
160
+ columnCustomSizes[key] = width;
161
+ }
162
+ if (isWrapped) {
163
+ wrappedColumnKeys.push(key);
164
+ }
165
+ }
166
+ }
167
+ return /*#__PURE__*/React.createElement("div", {
168
+ "data-testid": "confluence-search-config-modal"
169
+ }, /*#__PURE__*/React.createElement(ConfluenceSearchConfigModal, {
170
+ datasourceId: datasourceId,
171
+ viewMode: 'issue',
172
+ visibleColumnKeys: visibleColumnKeys,
173
+ parameters: parameters,
174
+ url: (_existingNode8 = existingNode) === null || _existingNode8 === void 0 ? void 0 : _existingNode8.attrs.url,
175
+ columnCustomSizes: columnCustomSizes,
176
+ wrappedColumnKeys: wrappedColumnKeys,
177
+ onCancel: onClose,
178
+ onInsert: onInsert
179
+ }));
180
+ }
136
181
  return null; // null for now until we have modal component that handles other datasources
137
182
  };
@@ -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
  };
@@ -7,6 +7,7 @@ import { cardMessages as messages } from '@atlaskit/editor-common/messages';
7
7
  import { IconDatasourceAssetsObjects, IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
8
8
  import { canRenderDatasource } from '@atlaskit/editor-common/utils';
9
9
  import { ASSETS_LIST_OF_LINKS_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';
@@ -143,7 +144,7 @@ export var cardPlugin = function cardPlugin(_ref) {
143
144
  if (canRenderDatasource(ASSETS_LIST_OF_LINKS_DATASOURCE_ID)) {
144
145
  quickInsertArray.push({
145
146
  id: 'datasource',
146
- title: formatMessage(messages.datasourceAssetsObjects),
147
+ title: getBooleanFF('platform.linking-platform.datasource-assets_objects_remove_beta') ? formatMessage(messages.datasourceAssetsObjectsGeneralAvailability) : formatMessage(messages.datasourceAssetsObjects),
147
148
  description: formatMessage(messages.datasourceAssetsObjectsDescription),
148
149
  categories: ['external-content', 'development'],
149
150
  keywords: ['assets'],
@@ -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,61 @@ export var DatasourceModal = function DatasourceModal(_ref) {
152
152
  onInsert: onInsert
153
153
  }));
154
154
  }
155
+ if (modalType === 'confluence-search') {
156
+ var _existingNode7, _tableView2$propertie, _existingNode8;
157
+ if (!ready) {
158
+ return null;
159
+ }
160
+ var _ref8 = ((_existingNode7 = existingNode) === null || _existingNode7 === void 0 || (_existingNode7 = _existingNode7.attrs) === null || _existingNode7 === void 0 ? void 0 : _existingNode7.datasource) || {},
161
+ _ref8$id = _ref8.id,
162
+ _datasourceId2 = _ref8$id === void 0 ? CONFLUENCE_SEARCH_DATASOURCE_ID : _ref8$id,
163
+ _parameters2 = _ref8.parameters,
164
+ _ref8$views = _ref8.views,
165
+ _views2 = _ref8$views === void 0 ? [] : _ref8$views;
166
+ var _ref9 = _views2,
167
+ _ref10 = _slicedToArray(_ref9, 1),
168
+ _tableView2 = _ref10[0];
169
+ var _visibleColumnKeys2 = [];
170
+ var _wrappedColumnKeys = [];
171
+ var _columnCustomSizes;
172
+ var _columns = _tableView2 === null || _tableView2 === void 0 || (_tableView2$propertie = _tableView2.properties) === null || _tableView2$propertie === void 0 ? void 0 : _tableView2$propertie.columns;
173
+ if (_columns) {
174
+ _columnCustomSizes = {};
175
+ var _iterator2 = _createForOfIteratorHelper(_columns),
176
+ _step2;
177
+ try {
178
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
179
+ var _step2$value = _step2.value,
180
+ _key2 = _step2$value.key,
181
+ _width = _step2$value.width,
182
+ _isWrapped = _step2$value.isWrapped;
183
+ _visibleColumnKeys2.push(_key2);
184
+ if (_width) {
185
+ _columnCustomSizes[_key2] = _width;
186
+ }
187
+ if (_isWrapped) {
188
+ _wrappedColumnKeys.push(_key2);
189
+ }
190
+ }
191
+ } catch (err) {
192
+ _iterator2.e(err);
193
+ } finally {
194
+ _iterator2.f();
195
+ }
196
+ }
197
+ return /*#__PURE__*/React.createElement("div", {
198
+ "data-testid": "confluence-search-config-modal"
199
+ }, /*#__PURE__*/React.createElement(ConfluenceSearchConfigModal, {
200
+ datasourceId: _datasourceId2,
201
+ viewMode: 'issue',
202
+ visibleColumnKeys: _visibleColumnKeys2,
203
+ parameters: _parameters2,
204
+ url: (_existingNode8 = existingNode) === null || _existingNode8 === void 0 ? void 0 : _existingNode8.attrs.url,
205
+ columnCustomSizes: _columnCustomSizes,
206
+ wrappedColumnKeys: _wrappedColumnKeys,
207
+ onCancel: onClose,
208
+ onInsert: onInsert
209
+ }));
210
+ }
155
211
  return null; // null for now until we have modal component that handles other datasources
156
212
  };
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.4.3",
3
+ "version": "1.4.4",
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.23.0",
38
+ "@atlaskit/editor-common": "^78.24.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.25.0",
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": {