@atlaskit/editor-core 185.15.4 → 185.16.1
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 +16 -0
- package/dist/cjs/plugins/card/index.js +29 -1
- package/dist/cjs/plugins/card/messages.js +20 -0
- package/dist/cjs/plugins/card/pm-plugins/actions.js +7 -4
- package/dist/cjs/plugins/card/pm-plugins/doc.js +27 -8
- package/dist/cjs/plugins/card/pm-plugins/main.js +3 -2
- package/dist/cjs/plugins/card/pm-plugins/reducers.js +11 -3
- package/dist/cjs/plugins/card/toolbar.js +3 -9
- package/dist/cjs/plugins/card/ui/DatasourceModal/ModalWithState.js +25 -0
- package/dist/cjs/plugins/card/ui/DatasourceModal/index.js +60 -0
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +8 -28
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/card/index.js +29 -1
- package/dist/es2019/plugins/card/messages.js +13 -0
- package/dist/es2019/plugins/card/pm-plugins/actions.js +3 -2
- package/dist/es2019/plugins/card/pm-plugins/doc.js +31 -6
- package/dist/es2019/plugins/card/pm-plugins/main.js +3 -2
- package/dist/es2019/plugins/card/pm-plugins/reducers.js +12 -3
- package/dist/es2019/plugins/card/toolbar.js +4 -10
- package/dist/es2019/plugins/card/ui/DatasourceModal/ModalWithState.js +19 -0
- package/dist/es2019/plugins/card/ui/DatasourceModal/index.js +48 -0
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +6 -26
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/card/index.js +30 -1
- package/dist/esm/plugins/card/messages.js +13 -0
- package/dist/esm/plugins/card/pm-plugins/actions.js +7 -4
- package/dist/esm/plugins/card/pm-plugins/doc.js +24 -6
- package/dist/esm/plugins/card/pm-plugins/main.js +3 -2
- package/dist/esm/plugins/card/pm-plugins/reducers.js +11 -3
- package/dist/esm/plugins/card/toolbar.js +4 -10
- package/dist/esm/plugins/card/ui/DatasourceModal/ModalWithState.js +17 -0
- package/dist/esm/plugins/card/ui/DatasourceModal/index.js +49 -0
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +6 -25
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/card/messages.d.ts +12 -0
- package/dist/types/plugins/card/pm-plugins/actions.d.ts +2 -1
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -0
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -0
- package/dist/types/plugins/card/types.d.ts +3 -0
- package/dist/types/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +9 -0
- package/dist/{types-ts4.5/plugins/card/ui/DatasourceModal.d.ts → types/plugins/card/ui/DatasourceModal/index.d.ts} +3 -5
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -7
- package/dist/types-ts4.5/plugins/card/messages.d.ts +12 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/actions.d.ts +2 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +1 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/util/state.d.ts +1 -0
- package/dist/types-ts4.5/plugins/card/types.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/ui/DatasourceModal/ModalWithState.d.ts +9 -0
- package/dist/{types/plugins/card/ui/DatasourceModal.d.ts → types-ts4.5/plugins/card/ui/DatasourceModal/index.d.ts} +3 -5
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -7
- package/package.json +2 -2
- package/dist/cjs/plugins/card/ui/DatasourceModal.js +0 -41
- package/dist/es2019/plugins/card/ui/DatasourceModal.js +0 -30
- package/dist/esm/plugins/card/ui/DatasourceModal.js +0 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 185.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`75520758a9d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/75520758a9d) - Fix layout not persisting on edits of datasource
|
|
8
|
+
|
|
9
|
+
## 185.16.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`5e03045b1a0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5e03045b1a0) - Adds support in /jira command to insert jira datasource table
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 185.15.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -18,6 +18,11 @@ var _EditorSmartCardEventsNext = require("./ui/EditorSmartCardEventsNext");
|
|
|
18
18
|
var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
|
|
19
19
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
20
20
|
var _mountHyperlink = require("./pm-plugins/mountHyperlink");
|
|
21
|
+
var _ModalWithState = _interopRequireDefault(require("./ui/DatasourceModal/ModalWithState"));
|
|
22
|
+
var _messages = require("./messages");
|
|
23
|
+
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
24
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
25
|
+
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
21
26
|
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; }
|
|
22
27
|
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; }
|
|
23
28
|
var cardPlugin = function cardPlugin(options, api) {
|
|
@@ -94,6 +99,9 @@ var cardPlugin = function cardPlugin(options, api) {
|
|
|
94
99
|
mountPoint: popupsMountPoint,
|
|
95
100
|
scrollableElement: popupsScrollableElement,
|
|
96
101
|
boundariesElement: popupsBoundariesElement
|
|
102
|
+
}), /*#__PURE__*/_react.default.createElement(_ModalWithState.default, {
|
|
103
|
+
api: api,
|
|
104
|
+
editorView: editorView
|
|
97
105
|
}));
|
|
98
106
|
},
|
|
99
107
|
actions: {
|
|
@@ -103,7 +111,27 @@ var cardPlugin = function cardPlugin(options, api) {
|
|
|
103
111
|
setSelectedCardAppearance: _doc.setSelectedCardAppearance
|
|
104
112
|
},
|
|
105
113
|
pluginsOptions: {
|
|
106
|
-
floatingToolbar: (0, _toolbar.floatingToolbar)(options, featureFlags, options.platform, options.linkPicker, api)
|
|
114
|
+
floatingToolbar: (0, _toolbar.floatingToolbar)(options, featureFlags, options.platform, options.linkPicker, api),
|
|
115
|
+
quickInsert: function quickInsert(_ref3) {
|
|
116
|
+
var formatMessage = _ref3.formatMessage;
|
|
117
|
+
if ((0, _utils.canRenderDatasource)(_linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
|
|
118
|
+
return [{
|
|
119
|
+
id: 'datasource',
|
|
120
|
+
title: formatMessage(_messages.messages.datasourceJiraIssue),
|
|
121
|
+
description: formatMessage(_messages.messages.datasourceJiraIssueDescription),
|
|
122
|
+
keywords: ['jira'],
|
|
123
|
+
icon: function icon() {
|
|
124
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconDatasourceJiraIssue, null);
|
|
125
|
+
},
|
|
126
|
+
action: function action(insert) {
|
|
127
|
+
var tr = insert(undefined);
|
|
128
|
+
(0, _actions.showDatasourceModal)('jira')(tr);
|
|
129
|
+
return tr;
|
|
130
|
+
}
|
|
131
|
+
}];
|
|
132
|
+
}
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
107
135
|
}
|
|
108
136
|
};
|
|
109
137
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.messages = void 0;
|
|
7
|
+
var _reactIntlNext = require("react-intl-next");
|
|
8
|
+
var messages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
+
datasourceJiraIssue: {
|
|
10
|
+
id: 'fabric.editor.datasource.jiraIssue',
|
|
11
|
+
defaultMessage: 'Jira Issues',
|
|
12
|
+
description: 'Insert a jira datasource table'
|
|
13
|
+
},
|
|
14
|
+
datasourceJiraIssueDescription: {
|
|
15
|
+
id: 'fabric.editor.datasource.jiraIssue.description',
|
|
16
|
+
defaultMessage: 'Insert issues from Jira Cloud with enhanced search, filtering, and configuration',
|
|
17
|
+
description: 'Insert a jira datasource table'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
exports.messages = messages;
|
|
@@ -105,10 +105,13 @@ var hideLinkToolbar = function hideLinkToolbar(tr) {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
exports.hideLinkToolbar = hideLinkToolbar;
|
|
108
|
-
var showDatasourceModal = function showDatasourceModal(
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
var showDatasourceModal = function showDatasourceModal(modalType) {
|
|
109
|
+
return function (tr) {
|
|
110
|
+
return cardAction(tr, {
|
|
111
|
+
type: 'SHOW_DATASOURCE_MODAL',
|
|
112
|
+
modalType: modalType
|
|
113
|
+
});
|
|
114
|
+
};
|
|
112
115
|
};
|
|
113
116
|
exports.showDatasourceModal = showDatasourceModal;
|
|
114
117
|
var hideDatasourceModal = function hideDatasourceModal(tr) {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.updateExistingDatasource = exports.updateCard = exports.setSelectedCardAppearance = exports.replaceQueuedUrlWithCard = exports.queueCardsFromChangedTr = exports.queueCardFromChangedTr = exports.handleFallbackWithAnalytics = exports.convertHyperlinkToSmartCard = exports.changeSelectedCardToText = exports.changeSelectedCardToLinkFallback = exports.changeSelectedCardToLink = void 0;
|
|
7
|
+
exports.updateExistingDatasource = exports.updateCard = exports.setSelectedCardAppearance = exports.replaceQueuedUrlWithCard = exports.queueCardsFromChangedTr = exports.queueCardFromChangedTr = exports.insertDatasource = exports.handleFallbackWithAnalytics = exports.convertHyperlinkToSmartCard = exports.changeSelectedCardToText = exports.changeSelectedCardToLinkFallback = exports.changeSelectedCardToLink = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
@@ -435,19 +435,23 @@ var updateExistingDatasource = function updateExistingDatasource(state, node, ne
|
|
|
435
435
|
|
|
436
436
|
// datasource to datasource
|
|
437
437
|
if (newAdf.type === 'blockCard' && newAdf.attrs.datasource && node.attrs.datasource) {
|
|
438
|
-
var
|
|
439
|
-
var
|
|
440
|
-
|
|
441
|
-
|
|
438
|
+
var _ref3, _ref6, _newViews$properties, _oldViews$properties, _newAdf$attrs, _node$attrs;
|
|
439
|
+
var _ref = (_ref3 = newAdf.attrs.datasource.views) !== null && _ref3 !== void 0 ? _ref3 : [],
|
|
440
|
+
_ref2 = (0, _slicedToArray2.default)(_ref, 1),
|
|
441
|
+
newViews = _ref2[0];
|
|
442
|
+
var _ref4 = (_ref6 = node.attrs.datasource.views) !== null && _ref6 !== void 0 ? _ref6 : [],
|
|
443
|
+
_ref5 = (0, _slicedToArray2.default)(_ref4, 1),
|
|
444
|
+
oldViews = _ref5[0];
|
|
445
|
+
var newColumnKeys = newViews === null || newViews === void 0 ? void 0 : (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns.map(function (column) {
|
|
442
446
|
return column.key;
|
|
443
447
|
});
|
|
444
|
-
var oldColumnKeys =
|
|
448
|
+
var oldColumnKeys = oldViews === null || oldViews === void 0 ? void 0 : (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns.map(function (column) {
|
|
445
449
|
return column.key;
|
|
446
450
|
});
|
|
447
451
|
var isColumnChange = !(0, _isEqual.default)(oldColumnKeys, newColumnKeys);
|
|
448
452
|
var isUrlChange = ((_newAdf$attrs = newAdf.attrs) === null || _newAdf$attrs === void 0 ? void 0 : _newAdf$attrs.url) !== ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.url);
|
|
449
453
|
if (isColumnChange || isUrlChange) {
|
|
450
|
-
tr.setNodeMarkup(from, schemaNodes.blockCard, newAdf.attrs);
|
|
454
|
+
tr.setNodeMarkup(from, schemaNodes.blockCard, _objectSpread(_objectSpread({}, node.attrs), newAdf.attrs));
|
|
451
455
|
}
|
|
452
456
|
} else if (newAdf.type === 'inlineCard') {
|
|
453
457
|
// datasource to inline
|
|
@@ -456,4 +460,19 @@ var updateExistingDatasource = function updateExistingDatasource(state, node, ne
|
|
|
456
460
|
(0, _actions.hideDatasourceModal)(tr);
|
|
457
461
|
view.dispatch(tr.scrollIntoView());
|
|
458
462
|
};
|
|
459
|
-
exports.updateExistingDatasource = updateExistingDatasource;
|
|
463
|
+
exports.updateExistingDatasource = updateExistingDatasource;
|
|
464
|
+
var insertDatasource = function insertDatasource(state, adf, view) {
|
|
465
|
+
var tr = state.tr,
|
|
466
|
+
from = state.selection.from,
|
|
467
|
+
schemaNodes = state.schema.nodes;
|
|
468
|
+
var attrs = adf.attrs,
|
|
469
|
+
type = adf.type;
|
|
470
|
+
var schemaNode = type === 'inlineCard' ? schemaNodes.inlineCard : schemaNodes.blockCard;
|
|
471
|
+
var newNode = schemaNode.createChecked(attrs);
|
|
472
|
+
// in future, if we decide to do datasource insertion from the main toolbar, we should probably consider editor-plugin-content-insertion instead of tr.insert
|
|
473
|
+
// this will allow us to deal with insertions from multiple paths in a more consistent way
|
|
474
|
+
newNode && tr.insert(from, newNode);
|
|
475
|
+
(0, _actions.hideDatasourceModal)(tr);
|
|
476
|
+
view.dispatch(tr.scrollIntoView());
|
|
477
|
+
};
|
|
478
|
+
exports.insertDatasource = insertDatasource;
|
|
@@ -59,6 +59,7 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
59
59
|
smartLinkEventsNext: undefined,
|
|
60
60
|
editorAppearance: editorAppearance,
|
|
61
61
|
showDatasourceModal: false,
|
|
62
|
+
datasourceModalType: undefined,
|
|
62
63
|
datasourceTableRef: undefined,
|
|
63
64
|
layout: undefined
|
|
64
65
|
};
|
|
@@ -170,8 +171,8 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
170
171
|
var hasIntlContext = true;
|
|
171
172
|
var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
|
|
172
173
|
if (isDatasource) {
|
|
173
|
-
var _node$attrs4;
|
|
174
|
-
if (platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.datasource)) {
|
|
174
|
+
var _node$attrs4, _node$attrs4$datasour;
|
|
175
|
+
if (platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
|
|
175
176
|
return new _datasource.Datasource({
|
|
176
177
|
node: node,
|
|
177
178
|
view: view,
|
|
@@ -67,9 +67,16 @@ var setLinkToolbar = function setLinkToolbar(state, action) {
|
|
|
67
67
|
showLinkingToolbar: action.type === 'SHOW_LINK_TOOLBAR'
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
|
-
var
|
|
70
|
+
var showDatasourceModal = function showDatasourceModal(state, action) {
|
|
71
71
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
72
|
-
showDatasourceModal:
|
|
72
|
+
showDatasourceModal: true,
|
|
73
|
+
datasourceModalType: action.type === 'SHOW_DATASOURCE_MODAL' ? action.modalType : undefined
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
var hideDatasourceModal = function hideDatasourceModal(state) {
|
|
77
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
78
|
+
showDatasourceModal: false,
|
|
79
|
+
datasourceModalType: undefined
|
|
73
80
|
});
|
|
74
81
|
};
|
|
75
82
|
var _default = function _default(state, action) {
|
|
@@ -96,8 +103,9 @@ var _default = function _default(state, action) {
|
|
|
96
103
|
case 'HIDE_LINK_TOOLBAR':
|
|
97
104
|
return setLinkToolbar(state, action);
|
|
98
105
|
case 'SHOW_DATASOURCE_MODAL':
|
|
106
|
+
return showDatasourceModal(state, action);
|
|
99
107
|
case 'HIDE_DATASOURCE_MODAL':
|
|
100
|
-
return
|
|
108
|
+
return hideDatasourceModal(state);
|
|
101
109
|
}
|
|
102
110
|
};
|
|
103
111
|
exports.default = _default;
|
|
@@ -174,7 +174,7 @@ var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
|
174
174
|
};
|
|
175
175
|
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
176
176
|
return function (node) {
|
|
177
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs, _node$attrs2;
|
|
177
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs, _node$attrs2, _node$attrs2$datasour;
|
|
178
178
|
var _titleUrlPairFromNode2 = (0, _utils.titleUrlPairFromNode)(node),
|
|
179
179
|
url = _titleUrlPairFromNode2.url;
|
|
180
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 : {},
|
|
@@ -197,7 +197,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
197
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
198
|
var shouldRenderDatasourceToolbar = isDatasource &&
|
|
199
199
|
// not showing toolbar in mobile for now since not sure what our plans are for it
|
|
200
|
-
platform !== 'mobile' && (0, _utils2.canRenderDatasource)(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.datasource);
|
|
200
|
+
platform !== 'mobile' && (0, _utils2.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
201
|
|
|
202
202
|
/* mobile builds toolbar natively using toolbarItems */
|
|
203
203
|
if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
|
|
@@ -208,12 +208,6 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
208
208
|
featureFlags: featureFlags,
|
|
209
209
|
pluginInjectionApi: pluginInjectionApi
|
|
210
210
|
})];
|
|
211
|
-
} else if (pluginState !== null && pluginState !== void 0 && pluginState.showDatasourceModal) {
|
|
212
|
-
return [(0, _EditLinkToolbar.openDatasourceModal)({
|
|
213
|
-
state: state,
|
|
214
|
-
node: node,
|
|
215
|
-
editorAnalyticsApi: editorAnalyticsApi
|
|
216
|
-
})];
|
|
217
211
|
} else if (shouldRenderDatasourceToolbar) {
|
|
218
212
|
return getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration);
|
|
219
213
|
} else {
|
|
@@ -336,7 +330,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(state, metadata
|
|
|
336
330
|
metadata: metadata,
|
|
337
331
|
className: 'datasource-edit',
|
|
338
332
|
title: intl.formatMessage(_messages.linkToolbarMessages.editDatasource),
|
|
339
|
-
onClick: (0, _EditLinkToolbar.editDatasource)(editorAnalyticsApi)
|
|
333
|
+
onClick: (0, _EditLinkToolbar.editDatasource)(node, editorAnalyticsApi)
|
|
340
334
|
}];
|
|
341
335
|
if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
|
|
342
336
|
toolbarItems.push({
|
|
@@ -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 _linkDatasource = require("@atlaskit/link-datasource");
|
|
12
|
+
var _actions = require("../../pm-plugins/actions");
|
|
13
|
+
var _doc = require("../../pm-plugins/doc");
|
|
14
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
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;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.EditLinkToolbar = void 0;
|
|
8
8
|
exports.HyperlinkAddToolbarWithState = HyperlinkAddToolbarWithState;
|
|
9
|
-
exports.
|
|
9
|
+
exports.editLinkToolbarConfig = exports.editLink = exports.editDatasource = exports.buildEditLinkToolbar = void 0;
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
12
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -24,8 +24,8 @@ var _doc = require("../pm-plugins/doc");
|
|
|
24
24
|
var _utils = require("../utils");
|
|
25
25
|
var _prosemirrorState = require("prosemirror-state");
|
|
26
26
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
27
|
-
var _DatasourceModal = require("./DatasourceModal");
|
|
28
27
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
28
|
+
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
29
29
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
30
30
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
31
|
var HyperLinkToolbarWithListeners = (0, _ui.withOuterListeners)(HyperlinkAddToolbarWithState);
|
|
@@ -232,11 +232,13 @@ var editLinkToolbarConfig = function editLinkToolbarConfig(showLinkingToolbar, l
|
|
|
232
232
|
} : {};
|
|
233
233
|
};
|
|
234
234
|
exports.editLinkToolbarConfig = editLinkToolbarConfig;
|
|
235
|
-
var editDatasource = function editDatasource(editorAnalyticsApi) {
|
|
235
|
+
var editDatasource = function editDatasource(node, editorAnalyticsApi) {
|
|
236
236
|
return function (state, dispatch) {
|
|
237
|
-
|
|
237
|
+
var _node$attrs;
|
|
238
|
+
var modalType = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id) === _linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID ? 'jira' : undefined;
|
|
239
|
+
if (dispatch && modalType) {
|
|
238
240
|
var tr = state.tr;
|
|
239
|
-
(0, _actions.showDatasourceModal)(tr);
|
|
241
|
+
(0, _actions.showDatasourceModal)(modalType)(tr);
|
|
240
242
|
// editorAnalyticsApi?.attachAnalyticsEvent(
|
|
241
243
|
// buildEditLinkPayload(
|
|
242
244
|
// type as
|
|
@@ -251,26 +253,4 @@ var editDatasource = function editDatasource(editorAnalyticsApi) {
|
|
|
251
253
|
return false;
|
|
252
254
|
};
|
|
253
255
|
};
|
|
254
|
-
exports.editDatasource = editDatasource;
|
|
255
|
-
var openDatasourceModal = function openDatasourceModal(_ref3) {
|
|
256
|
-
var state = _ref3.state,
|
|
257
|
-
node = _ref3.node,
|
|
258
|
-
editorAnalyticsApi = _ref3.editorAnalyticsApi;
|
|
259
|
-
return {
|
|
260
|
-
type: 'custom',
|
|
261
|
-
disableArrowNavigation: true,
|
|
262
|
-
fallback: [],
|
|
263
|
-
render: function render(view) {
|
|
264
|
-
if (!view) {
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
return /*#__PURE__*/_react.default.createElement(_DatasourceModal.DatasourceModal, {
|
|
268
|
-
state: state,
|
|
269
|
-
view: view,
|
|
270
|
-
node: node,
|
|
271
|
-
editorAnalyticsApi: editorAnalyticsApi
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
exports.openDatasourceModal = openDatasourceModal;
|
|
256
|
+
exports.editDatasource = editDatasource;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "185.
|
|
9
|
+
var version = "185.16.1";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -10,6 +10,12 @@ import { EditorSmartCardEventsNext } from './ui/EditorSmartCardEventsNext';
|
|
|
10
10
|
import LayoutButton from './ui/LayoutButton';
|
|
11
11
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
12
12
|
import { mountHyperlinkPlugin } from './pm-plugins/mountHyperlink';
|
|
13
|
+
import { showDatasourceModal } from './pm-plugins/actions';
|
|
14
|
+
import DatasourceModalWithState from './ui/DatasourceModal/ModalWithState';
|
|
15
|
+
import { messages } from './messages';
|
|
16
|
+
import { IconDatasourceJiraIssue } from '@atlaskit/editor-common/quick-insert';
|
|
17
|
+
import { canRenderDatasource } from '@atlaskit/editor-common/utils';
|
|
18
|
+
import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
13
19
|
const cardPlugin = (options, api) => {
|
|
14
20
|
var _api$dependencies, _api$dependencies$fea;
|
|
15
21
|
const featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
@@ -87,6 +93,9 @@ const cardPlugin = (options, api) => {
|
|
|
87
93
|
mountPoint: popupsMountPoint,
|
|
88
94
|
scrollableElement: popupsScrollableElement,
|
|
89
95
|
boundariesElement: popupsBoundariesElement
|
|
96
|
+
}), /*#__PURE__*/React.createElement(DatasourceModalWithState, {
|
|
97
|
+
api: api,
|
|
98
|
+
editorView: editorView
|
|
90
99
|
}));
|
|
91
100
|
},
|
|
92
101
|
actions: {
|
|
@@ -96,7 +105,26 @@ const cardPlugin = (options, api) => {
|
|
|
96
105
|
setSelectedCardAppearance
|
|
97
106
|
},
|
|
98
107
|
pluginsOptions: {
|
|
99
|
-
floatingToolbar: floatingToolbar(options, featureFlags, options.platform, options.linkPicker, api)
|
|
108
|
+
floatingToolbar: floatingToolbar(options, featureFlags, options.platform, options.linkPicker, api),
|
|
109
|
+
quickInsert: ({
|
|
110
|
+
formatMessage
|
|
111
|
+
}) => {
|
|
112
|
+
if (canRenderDatasource(JIRA_LIST_OF_LINKS_DATASOURCE_ID)) {
|
|
113
|
+
return [{
|
|
114
|
+
id: 'datasource',
|
|
115
|
+
title: formatMessage(messages.datasourceJiraIssue),
|
|
116
|
+
description: formatMessage(messages.datasourceJiraIssueDescription),
|
|
117
|
+
keywords: ['jira'],
|
|
118
|
+
icon: () => /*#__PURE__*/React.createElement(IconDatasourceJiraIssue, null),
|
|
119
|
+
action(insert) {
|
|
120
|
+
const tr = insert(undefined);
|
|
121
|
+
showDatasourceModal('jira')(tr);
|
|
122
|
+
return tr;
|
|
123
|
+
}
|
|
124
|
+
}];
|
|
125
|
+
}
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
100
128
|
}
|
|
101
129
|
};
|
|
102
130
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export const messages = defineMessages({
|
|
3
|
+
datasourceJiraIssue: {
|
|
4
|
+
id: 'fabric.editor.datasource.jiraIssue',
|
|
5
|
+
defaultMessage: 'Jira Issues',
|
|
6
|
+
description: 'Insert a jira datasource table'
|
|
7
|
+
},
|
|
8
|
+
datasourceJiraIssueDescription: {
|
|
9
|
+
id: 'fabric.editor.datasource.jiraIssue.description',
|
|
10
|
+
defaultMessage: 'Insert issues from Jira Cloud with enhanced search, filtering, and configuration',
|
|
11
|
+
description: 'Insert a jira datasource table'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -48,8 +48,9 @@ export const showLinkToolbar = tr => cardAction(tr, {
|
|
|
48
48
|
export const hideLinkToolbar = tr => cardAction(tr, {
|
|
49
49
|
type: 'HIDE_LINK_TOOLBAR'
|
|
50
50
|
});
|
|
51
|
-
export const showDatasourceModal = tr => cardAction(tr, {
|
|
52
|
-
type: 'SHOW_DATASOURCE_MODAL'
|
|
51
|
+
export const showDatasourceModal = modalType => tr => cardAction(tr, {
|
|
52
|
+
type: 'SHOW_DATASOURCE_MODAL',
|
|
53
|
+
modalType
|
|
53
54
|
});
|
|
54
55
|
export const hideDatasourceModal = tr => cardAction(tr, {
|
|
55
56
|
type: 'HIDE_DATASOURCE_MODAL'
|
|
@@ -407,15 +407,18 @@ export const updateExistingDatasource = (state, node, newAdf, view) => {
|
|
|
407
407
|
|
|
408
408
|
// datasource to datasource
|
|
409
409
|
if (newAdf.type === 'blockCard' && newAdf.attrs.datasource && node.attrs.datasource) {
|
|
410
|
-
var _ref, _ref2, _newViews
|
|
411
|
-
const newViews = (_ref = newAdf.attrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
|
|
412
|
-
const oldViews = (_ref2 = node.attrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
413
|
-
const newColumnKeys =
|
|
414
|
-
const oldColumnKeys =
|
|
410
|
+
var _ref, _ref2, _newViews$properties, _oldViews$properties, _newAdf$attrs, _node$attrs;
|
|
411
|
+
const [newViews] = (_ref = newAdf.attrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
|
|
412
|
+
const [oldViews] = (_ref2 = node.attrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
413
|
+
const newColumnKeys = newViews === null || newViews === void 0 ? void 0 : (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns.map(column => column.key);
|
|
414
|
+
const oldColumnKeys = oldViews === null || oldViews === void 0 ? void 0 : (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns.map(column => column.key);
|
|
415
415
|
const isColumnChange = !isEqual(oldColumnKeys, newColumnKeys);
|
|
416
416
|
const isUrlChange = ((_newAdf$attrs = newAdf.attrs) === null || _newAdf$attrs === void 0 ? void 0 : _newAdf$attrs.url) !== ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.url);
|
|
417
417
|
if (isColumnChange || isUrlChange) {
|
|
418
|
-
tr.setNodeMarkup(from, schemaNodes.blockCard,
|
|
418
|
+
tr.setNodeMarkup(from, schemaNodes.blockCard, {
|
|
419
|
+
...node.attrs,
|
|
420
|
+
...newAdf.attrs
|
|
421
|
+
});
|
|
419
422
|
}
|
|
420
423
|
} else if (newAdf.type === 'inlineCard') {
|
|
421
424
|
// datasource to inline
|
|
@@ -423,4 +426,26 @@ export const updateExistingDatasource = (state, node, newAdf, view) => {
|
|
|
423
426
|
}
|
|
424
427
|
hideDatasourceModal(tr);
|
|
425
428
|
view.dispatch(tr.scrollIntoView());
|
|
429
|
+
};
|
|
430
|
+
export const insertDatasource = (state, adf, view) => {
|
|
431
|
+
const {
|
|
432
|
+
tr,
|
|
433
|
+
selection: {
|
|
434
|
+
from
|
|
435
|
+
},
|
|
436
|
+
schema: {
|
|
437
|
+
nodes: schemaNodes
|
|
438
|
+
}
|
|
439
|
+
} = state;
|
|
440
|
+
const {
|
|
441
|
+
attrs,
|
|
442
|
+
type
|
|
443
|
+
} = adf;
|
|
444
|
+
const schemaNode = type === 'inlineCard' ? schemaNodes.inlineCard : schemaNodes.blockCard;
|
|
445
|
+
const newNode = schemaNode.createChecked(attrs);
|
|
446
|
+
// in future, if we decide to do datasource insertion from the main toolbar, we should probably consider editor-plugin-content-insertion instead of tr.insert
|
|
447
|
+
// this will allow us to deal with insertions from multiple paths in a more consistent way
|
|
448
|
+
newNode && tr.insert(from, newNode);
|
|
449
|
+
hideDatasourceModal(tr);
|
|
450
|
+
view.dispatch(tr.scrollIntoView());
|
|
426
451
|
};
|
|
@@ -49,6 +49,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
49
49
|
smartLinkEventsNext: undefined,
|
|
50
50
|
editorAppearance,
|
|
51
51
|
showDatasourceModal: false,
|
|
52
|
+
datasourceModalType: undefined,
|
|
52
53
|
datasourceTableRef: undefined,
|
|
53
54
|
layout: undefined
|
|
54
55
|
};
|
|
@@ -166,8 +167,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
166
167
|
const hasIntlContext = true;
|
|
167
168
|
const isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
|
|
168
169
|
if (isDatasource) {
|
|
169
|
-
var _node$attrs4;
|
|
170
|
-
if (platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.datasource)) {
|
|
170
|
+
var _node$attrs4, _node$attrs4$datasour;
|
|
171
|
+
if (platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$datasour = _node$attrs4.datasource) === null || _node$attrs4$datasour === void 0 ? void 0 : _node$attrs4$datasour.id)) {
|
|
171
172
|
return new Datasource({
|
|
172
173
|
node,
|
|
173
174
|
view,
|
|
@@ -65,10 +65,18 @@ const setLinkToolbar = (state, action) => {
|
|
|
65
65
|
showLinkingToolbar: action.type === 'SHOW_LINK_TOOLBAR'
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
const
|
|
68
|
+
const showDatasourceModal = (state, action) => {
|
|
69
69
|
return {
|
|
70
70
|
...state,
|
|
71
|
-
showDatasourceModal:
|
|
71
|
+
showDatasourceModal: true,
|
|
72
|
+
datasourceModalType: action.type === 'SHOW_DATASOURCE_MODAL' ? action.modalType : undefined
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
const hideDatasourceModal = state => {
|
|
76
|
+
return {
|
|
77
|
+
...state,
|
|
78
|
+
showDatasourceModal: false,
|
|
79
|
+
datasourceModalType: undefined
|
|
72
80
|
};
|
|
73
81
|
};
|
|
74
82
|
export default ((state, action) => {
|
|
@@ -95,7 +103,8 @@ export default ((state, action) => {
|
|
|
95
103
|
case 'HIDE_LINK_TOOLBAR':
|
|
96
104
|
return setLinkToolbar(state, action);
|
|
97
105
|
case 'SHOW_DATASOURCE_MODAL':
|
|
106
|
+
return showDatasourceModal(state, action);
|
|
98
107
|
case 'HIDE_DATASOURCE_MODAL':
|
|
99
|
-
return
|
|
108
|
+
return hideDatasourceModal(state);
|
|
100
109
|
}
|
|
101
110
|
});
|