@atlaskit/editor-core 185.5.7 → 185.6.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 +10 -0
- package/dist/cjs/plugins/card/pm-plugins/actions.js +14 -2
- package/dist/cjs/plugins/card/pm-plugins/doc.js +34 -2
- package/dist/cjs/plugins/card/pm-plugins/main.js +1 -0
- package/dist/cjs/plugins/card/pm-plugins/reducers.js +8 -0
- package/dist/cjs/plugins/card/styles.js +2 -1
- package/dist/cjs/plugins/card/toolbar.js +53 -1
- package/dist/cjs/plugins/card/ui/DatasourceModal.js +41 -0
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +45 -2
- package/dist/cjs/plugins/card/ui/SmallerEditIcon.js +20 -0
- package/dist/cjs/plugins/card/ui/styled.js +5 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/card/pm-plugins/actions.js +6 -0
- package/dist/es2019/plugins/card/pm-plugins/doc.js +34 -1
- package/dist/es2019/plugins/card/pm-plugins/main.js +1 -0
- package/dist/es2019/plugins/card/pm-plugins/reducers.js +9 -0
- package/dist/es2019/plugins/card/styles.js +23 -2
- package/dist/es2019/plugins/card/toolbar.js +54 -2
- package/dist/es2019/plugins/card/ui/DatasourceModal.js +30 -0
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +43 -1
- package/dist/es2019/plugins/card/ui/SmallerEditIcon.js +11 -0
- package/dist/es2019/plugins/card/ui/styled.js +3 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/card/pm-plugins/actions.js +10 -0
- package/dist/esm/plugins/card/pm-plugins/doc.js +32 -1
- package/dist/esm/plugins/card/pm-plugins/main.js +1 -0
- package/dist/esm/plugins/card/pm-plugins/reducers.js +8 -0
- package/dist/esm/plugins/card/styles.js +4 -3
- package/dist/esm/plugins/card/toolbar.js +54 -2
- package/dist/esm/plugins/card/ui/DatasourceModal.js +31 -0
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +42 -1
- package/dist/esm/plugins/card/ui/SmallerEditIcon.js +11 -0
- package/dist/esm/plugins/card/ui/styled.js +3 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/card/pm-plugins/actions.d.ts +2 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +3 -0
- package/dist/types/plugins/card/pm-plugins/util/state.d.ts +1 -0
- package/dist/types/plugins/card/types.d.ts +8 -1
- package/dist/types/plugins/card/ui/DatasourceModal.d.ts +13 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +8 -1
- package/dist/types/plugins/card/ui/SmallerEditIcon.d.ts +3 -0
- package/dist/types/plugins/card/ui/styled.d.ts +1 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/actions.d.ts +2 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +3 -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 +8 -1
- package/dist/types-ts4.5/plugins/card/ui/DatasourceModal.d.ts +13 -0
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +8 -1
- package/dist/types-ts4.5/plugins/card/ui/SmallerEditIcon.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/ui/styled.d.ts +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { JiraIssuesConfigModal } from '@atlaskit/link-datasource';
|
|
3
|
+
import { hideDatasourceModal } from '../pm-plugins/actions';
|
|
4
|
+
import { updateExistingDatasource } from '../pm-plugins/doc';
|
|
5
|
+
export const DatasourceModal = ({
|
|
6
|
+
state,
|
|
7
|
+
view,
|
|
8
|
+
node
|
|
9
|
+
}) => {
|
|
10
|
+
const isJiraDatasource = node.attrs.datasource.parameters.jql;
|
|
11
|
+
const onClose = useCallback(() => {
|
|
12
|
+
view.dispatch(hideDatasourceModal(view.state.tr));
|
|
13
|
+
}, [view]);
|
|
14
|
+
const onInsert = useCallback(newAdf => {
|
|
15
|
+
updateExistingDatasource(state, node, newAdf, view);
|
|
16
|
+
}, [state, node, view]);
|
|
17
|
+
if (isJiraDatasource) {
|
|
18
|
+
var _node$attrs$datasourc, _node$attrs$datasourc2;
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
"data-testId": "jira-config-modal"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(JiraIssuesConfigModal, {
|
|
22
|
+
datasourceId: node.attrs.datasource.id,
|
|
23
|
+
visibleColumnKeys: (_node$attrs$datasourc = node.attrs.datasource.views[0]) === null || _node$attrs$datasourc === void 0 ? void 0 : (_node$attrs$datasourc2 = _node$attrs$datasourc.properties) === null || _node$attrs$datasourc2 === void 0 ? void 0 : _node$attrs$datasourc2.columns.map(column => column.key),
|
|
24
|
+
parameters: node.attrs.datasource.parameters,
|
|
25
|
+
onCancel: onClose,
|
|
26
|
+
onInsert: onInsert
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
return null; // null for now until we have modal component that handles other datasources
|
|
30
|
+
};
|
|
@@ -3,13 +3,14 @@ import React from 'react';
|
|
|
3
3
|
import { withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
4
4
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
5
5
|
import HyperlinkToolbar from '../../hyperlink/ui/HyperlinkAddToolbar';
|
|
6
|
-
import { showLinkToolbar, hideLinkToolbar } from '../pm-plugins/actions';
|
|
6
|
+
import { showLinkToolbar, hideLinkToolbar, showDatasourceModal } from '../pm-plugins/actions';
|
|
7
7
|
import { INPUT_METHOD, ACTION, buildEditLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
9
9
|
import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
|
|
10
10
|
import { findCardInfo, displayInfoForCard } from '../utils';
|
|
11
11
|
import { NodeSelection } from 'prosemirror-state';
|
|
12
12
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
13
|
+
import { DatasourceModal } from './DatasourceModal';
|
|
13
14
|
const HyperLinkToolbarWithListeners = withOuterListeners(HyperlinkToolbar);
|
|
14
15
|
export class EditLinkToolbar extends React.Component {
|
|
15
16
|
constructor(...args) {
|
|
@@ -138,4 +139,45 @@ export const editLinkToolbarConfig = (showLinkingToolbar, lpLinkPicker) => {
|
|
|
138
139
|
width: RECENT_SEARCH_WIDTH_IN_PX,
|
|
139
140
|
forcePlacement: true
|
|
140
141
|
} : {};
|
|
142
|
+
};
|
|
143
|
+
export const editDatasource = editorAnalyticsApi => (state, dispatch) => {
|
|
144
|
+
if (dispatch) {
|
|
145
|
+
const {
|
|
146
|
+
tr
|
|
147
|
+
} = state;
|
|
148
|
+
showDatasourceModal(tr);
|
|
149
|
+
// editorAnalyticsApi?.attachAnalyticsEvent(
|
|
150
|
+
// buildEditLinkPayload(
|
|
151
|
+
// type as
|
|
152
|
+
// | ACTION_SUBJECT_ID.CARD_INLINE
|
|
153
|
+
// | ACTION_SUBJECT_ID.CARD_BLOCK
|
|
154
|
+
// | ACTION_SUBJECT_ID.EMBEDS,
|
|
155
|
+
// ),
|
|
156
|
+
// )(tr);
|
|
157
|
+
dispatch(tr);
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
};
|
|
162
|
+
export const openDatasourceModal = ({
|
|
163
|
+
state,
|
|
164
|
+
node,
|
|
165
|
+
editorAnalyticsApi
|
|
166
|
+
}) => {
|
|
167
|
+
return {
|
|
168
|
+
type: 'custom',
|
|
169
|
+
disableArrowNavigation: true,
|
|
170
|
+
fallback: [],
|
|
171
|
+
render: view => {
|
|
172
|
+
if (!view) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
return /*#__PURE__*/React.createElement(DatasourceModal, {
|
|
176
|
+
state: state,
|
|
177
|
+
view: view,
|
|
178
|
+
node: node,
|
|
179
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
};
|
|
141
183
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import EditIcon from '@atlaskit/icon/glyph/edit';
|
|
4
|
+
import { editIconStyles } from './styled';
|
|
5
|
+
export const SmallerEditIcon = () => {
|
|
6
|
+
return jsx("div", {
|
|
7
|
+
css: editIconStyles
|
|
8
|
+
}, jsx(EditIcon, {
|
|
9
|
+
label: "edit"
|
|
10
|
+
}));
|
|
11
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -86,4 +86,14 @@ export var hideLinkToolbar = function hideLinkToolbar(tr) {
|
|
|
86
86
|
return cardAction(tr, {
|
|
87
87
|
type: 'HIDE_LINK_TOOLBAR'
|
|
88
88
|
});
|
|
89
|
+
};
|
|
90
|
+
export var showDatasourceModal = function showDatasourceModal(tr) {
|
|
91
|
+
return cardAction(tr, {
|
|
92
|
+
type: 'SHOW_DATASOURCE_MODAL'
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
export var hideDatasourceModal = function hideDatasourceModal(tr) {
|
|
96
|
+
return cardAction(tr, {
|
|
97
|
+
type: 'HIDE_DATASOURCE_MODAL'
|
|
98
|
+
});
|
|
89
99
|
};
|
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
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; }
|
|
4
4
|
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) { _defineProperty(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; }
|
|
5
|
+
import isEqual from 'lodash/isEqual';
|
|
5
6
|
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
6
7
|
import { closeHistory } from 'prosemirror-history';
|
|
7
8
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
@@ -10,7 +11,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SM
|
|
|
10
11
|
import { nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
|
|
11
12
|
import { isFromCurrentDomain, getLinkCreationAnalyticsEvent } from '@atlaskit/editor-common/utils';
|
|
12
13
|
import { appearanceForNodeType, selectedCardAppearance } from '../utils';
|
|
13
|
-
import { queueCards, resolveCard } from './actions';
|
|
14
|
+
import { queueCards, resolveCard, hideDatasourceModal } from './actions';
|
|
14
15
|
import { pluginKey } from './plugin-key';
|
|
15
16
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
16
17
|
|
|
@@ -409,4 +410,34 @@ var getLinkNodeType = function getLinkNodeType(appearance, linkNodes) {
|
|
|
409
410
|
case 'embed':
|
|
410
411
|
return linkNodes.embedCard;
|
|
411
412
|
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
// Apply an update to a datasource (aka blockCard) node
|
|
416
|
+
export var updateExistingDatasource = function updateExistingDatasource(state, node, newAdf, view) {
|
|
417
|
+
var tr = state.tr,
|
|
418
|
+
from = state.selection.from,
|
|
419
|
+
schemaNodes = state.schema.nodes;
|
|
420
|
+
|
|
421
|
+
// datasource to datasource
|
|
422
|
+
if (newAdf.type === 'blockCard' && newAdf.attrs.datasource && node.attrs.datasource) {
|
|
423
|
+
var _ref, _ref2, _newViews$, _newViews$$properties, _oldViews$, _oldViews$$properties, _newAdf$attrs, _node$attrs;
|
|
424
|
+
var newViews = (_ref = newAdf.attrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
|
|
425
|
+
var oldViews = (_ref2 = node.attrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
426
|
+
var newColumnKeys = (_newViews$ = newViews[0]) === null || _newViews$ === void 0 ? void 0 : (_newViews$$properties = _newViews$.properties) === null || _newViews$$properties === void 0 ? void 0 : _newViews$$properties.columns.map(function (column) {
|
|
427
|
+
return column.key;
|
|
428
|
+
});
|
|
429
|
+
var oldColumnKeys = (_oldViews$ = oldViews[0]) === null || _oldViews$ === void 0 ? void 0 : (_oldViews$$properties = _oldViews$.properties) === null || _oldViews$$properties === void 0 ? void 0 : _oldViews$$properties.columns.map(function (column) {
|
|
430
|
+
return column.key;
|
|
431
|
+
});
|
|
432
|
+
var isColumnChange = !isEqual(oldColumnKeys, newColumnKeys);
|
|
433
|
+
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);
|
|
434
|
+
if (isColumnChange || isUrlChange) {
|
|
435
|
+
tr.setNodeMarkup(from, schemaNodes.blockCard, newAdf.attrs);
|
|
436
|
+
}
|
|
437
|
+
} else if (newAdf.type === 'inlineCard') {
|
|
438
|
+
// datasource to inline
|
|
439
|
+
tr.setNodeMarkup(from, schemaNodes.inlineCard, newAdf.attrs);
|
|
440
|
+
}
|
|
441
|
+
hideDatasourceModal(tr);
|
|
442
|
+
view.dispatch(tr.scrollIntoView());
|
|
412
443
|
};
|
|
@@ -38,6 +38,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
38
38
|
smartLinkEventsNext: undefined,
|
|
39
39
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
40
40
|
editorAppearance: editorAppearance,
|
|
41
|
+
showDatasourceModal: false,
|
|
41
42
|
datasourceTableRef: undefined,
|
|
42
43
|
layout: undefined
|
|
43
44
|
};
|
|
@@ -60,6 +60,11 @@ var setLinkToolbar = function setLinkToolbar(state, action) {
|
|
|
60
60
|
showLinkingToolbar: action.type === 'SHOW_LINK_TOOLBAR'
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
|
+
var setDatasourceModal = function setDatasourceModal(state, action) {
|
|
64
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
65
|
+
showDatasourceModal: action.type === 'SHOW_DATASOURCE_MODAL'
|
|
66
|
+
});
|
|
67
|
+
};
|
|
63
68
|
export default (function (state, action) {
|
|
64
69
|
switch (action.type) {
|
|
65
70
|
case 'QUEUE':
|
|
@@ -83,5 +88,8 @@ export default (function (state, action) {
|
|
|
83
88
|
case 'SHOW_LINK_TOOLBAR':
|
|
84
89
|
case 'HIDE_LINK_TOOLBAR':
|
|
85
90
|
return setLinkToolbar(state, action);
|
|
91
|
+
case 'SHOW_DATASOURCE_MODAL':
|
|
92
|
+
case 'HIDE_DATASOURCE_MODAL':
|
|
93
|
+
return setDatasourceModal(state, action);
|
|
86
94
|
}
|
|
87
95
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { SelectionStyle, getSelectionStyles, akEditorDeleteBorder, akEditorDeleteBackground } from '@atlaskit/editor-shared-styles';
|
|
5
|
-
import { N20 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { SelectionStyle, getSelectionStyles, akEditorDeleteBorder, akEditorDeleteBackground, akEditorRuleBorderRadius } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { N0, N20, N40 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
7
7
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from './nodeviews/datasource';
|
|
8
9
|
export var FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = 'card-floating-toolbar--link-picker';
|
|
9
|
-
export var smartCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n max-width: calc(100% - 20px);\n vertical-align: top;\n word-break: break-all;\n\n .card {\n padding-left: 2px;\n padding-right: 2px;\n padding-top: 0.5em;\n padding-bottom: 0.5em;\n margin-bottom: -0.5em;\n\n .", " > a:focus {\n ", "\n }\n }\n\n &.", "\n .", "\n > a {\n ", "\n }\n .", " > a {\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 1;\n position: relative;\n /* EDM-1717: box-shadow Safari fix end */\n }\n\n &.danger {\n .", " > a {\n box-shadow: 0 0 0 1px\n ", ";\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 2;\n /* EDM-1717: box-shadow Safari fix end */\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.danger {\n .", " > div {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n }\n }\n\n .", ".", " {\n max-width: 100%;\n display: flex;\n justify-content: center;\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &::after {\n transition: box-shadow 0s;\n }\n }\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.", "\n .", "\n > div::after {\n ", "\n }\n\n &.danger {\n .media-card-frame::after {\n box-shadow: 0 0 0 1px\n ", " !important;\n background: ", " !important;\n }\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n }\n }\n\n .", " {\n padding: 0;\n }\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-background-neutral-subtle-hovered, ".concat(N20, ")"), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.DATASOURCE_CONTAINER, SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
|
|
10
|
+
export var smartCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n max-width: calc(100% - 20px);\n vertical-align: top;\n word-break: break-all;\n\n .card {\n padding-left: 2px;\n padding-right: 2px;\n padding-top: 0.5em;\n padding-bottom: 0.5em;\n margin-bottom: -0.5em;\n\n .", " > a:focus {\n ", "\n }\n }\n\n &.", "\n .", "\n > a {\n ", "\n }\n .", " > a {\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 1;\n position: relative;\n /* EDM-1717: box-shadow Safari fix end */\n }\n\n &.danger {\n .", " > a {\n box-shadow: 0 0 0 1px\n ", ";\n /* EDM-1717: box-shadow Safari fix start */\n z-index: 2;\n /* EDM-1717: box-shadow Safari fix end */\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &:hover {\n background-color: ", ";\n }\n }\n\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.danger {\n .", " > div {\n box-shadow: 0 0 0 1px\n ", " !important;\n }\n }\n }\n\n .", ".", " {\n max-width: 100%;\n display: flex;\n justify-content: center;\n\n .", " {\n cursor: pointer;\n background-color: ", ";\n border-radius: ", ";\n border: 1px solid ", ";\n }\n\n &.", " {\n .", " {\n ", "\n }\n }\n\n &.danger {\n .", " {\n box-shadow: 0 0 0 1px\n ", ";\n }\n }\n }\n\n .", " {\n .", " > div {\n cursor: pointer;\n &::after {\n transition: box-shadow 0s;\n }\n }\n &.", "\n .", "\n > div {\n ", "\n }\n\n &.", "\n .", "\n > div::after {\n ", "\n }\n\n &.danger {\n .media-card-frame::after {\n box-shadow: 0 0 0 1px\n ", " !important;\n background: ", " !important;\n }\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n }\n }\n\n .", " {\n padding: 0;\n }\n"])), SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-background-neutral-subtle-hovered, ".concat(N20, ")"), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.DATASOURCE_CONTAINER, SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-background-neutral-subtle, ".concat(N0, ")"), "var(--ds-border-radius-100, ".concat(akEditorRuleBorderRadius, ")"), "var(--ds-border, ".concat(N40, ")"), akEditorSelectedNodeClassName, DATASOURCE_INNER_CONTAINER_CLASSNAME, getSelectionStyles([SelectionStyle.BoxShadow]), DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, SmartCardSharedCssClassName.LOADER_WRAPPER, akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedNodeClassName, SmartCardSharedCssClassName.LOADER_WRAPPER, getSelectionStyles([SelectionStyle.BoxShadow]), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(akEditorDeleteBorder, ")"), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
|
|
@@ -15,13 +15,14 @@ import { changeSelectedCardToText } from './pm-plugins/doc';
|
|
|
15
15
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
16
16
|
import { pluginKey } from './pm-plugins/main';
|
|
17
17
|
import { richMediaClassName } from '@atlaskit/editor-common/styles';
|
|
18
|
-
import { buildEditLinkToolbar, editLink, editLinkToolbarConfig } from './ui/EditLinkToolbar';
|
|
18
|
+
import { editDatasource, buildEditLinkToolbar, editLink, editLinkToolbarConfig, openDatasourceModal } from './ui/EditLinkToolbar';
|
|
19
19
|
import { displayInfoForCard, findCardInfo, titleUrlPairFromNode, appearanceForNodeType } from './utils';
|
|
20
20
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
21
21
|
import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
|
|
22
22
|
import { messages } from './messages';
|
|
23
23
|
import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from './styles';
|
|
24
24
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, buildOpenedSettingsPayload, buildVisitedLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
25
|
+
import { SmallerEditIcon } from './ui/SmallerEditIcon';
|
|
25
26
|
export var removeCard = function removeCard(editorAnalyticsApi) {
|
|
26
27
|
return commandWithMetadata(function (state, dispatch) {
|
|
27
28
|
if (!(state.selection instanceof NodeSelection)) {
|
|
@@ -161,7 +162,7 @@ var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
|
161
162
|
};
|
|
162
163
|
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
163
164
|
return function (node) {
|
|
164
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5;
|
|
165
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs;
|
|
165
166
|
var _titleUrlPairFromNode2 = titleUrlPairFromNode(node),
|
|
166
167
|
url = _titleUrlPairFromNode2.url;
|
|
167
168
|
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,6 +182,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
181
182
|
var currentAppearance = appearanceForNodeType(node.type);
|
|
182
183
|
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 : {},
|
|
183
184
|
hoverDecoration = _ref2.hoverDecoration;
|
|
185
|
+
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);
|
|
184
186
|
|
|
185
187
|
/* mobile builds toolbar natively using toolbarItems */
|
|
186
188
|
if (pluginState.showLinkingToolbar && platform !== 'mobile') {
|
|
@@ -191,6 +193,15 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
191
193
|
featureFlags: featureFlags,
|
|
192
194
|
pluginInjectionApi: pluginInjectionApi
|
|
193
195
|
})];
|
|
196
|
+
} else if (pluginState.showDatasourceModal) {
|
|
197
|
+
return [openDatasourceModal({
|
|
198
|
+
state: state,
|
|
199
|
+
node: node,
|
|
200
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
201
|
+
})];
|
|
202
|
+
// not showing toolbar in mobile for now since not sure what our plans are for it
|
|
203
|
+
} else if (isDatasource && platform !== 'mobile') {
|
|
204
|
+
return getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration);
|
|
194
205
|
} else {
|
|
195
206
|
var inlineCard = state.schema.nodes.inlineCard;
|
|
196
207
|
var toolbarItems = [{
|
|
@@ -300,4 +311,45 @@ var getSettingsButtonGroup = function getSettingsButtonGroup(state, featureFlags
|
|
|
300
311
|
}, {
|
|
301
312
|
type: 'separator'
|
|
302
313
|
}] : [];
|
|
314
|
+
};
|
|
315
|
+
var getDatasourceButtonGroup = function getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration) {
|
|
316
|
+
var _node$attrs2;
|
|
317
|
+
var toolbarItems = [{
|
|
318
|
+
id: 'editor.edit.datasource',
|
|
319
|
+
type: 'button',
|
|
320
|
+
icon: SmallerEditIcon,
|
|
321
|
+
metadata: metadata,
|
|
322
|
+
className: 'datasource-edit',
|
|
323
|
+
title: intl.formatMessage(linkToolbarMessages.editDatasource),
|
|
324
|
+
onClick: editDatasource(editorAnalyticsApi)
|
|
325
|
+
}];
|
|
326
|
+
if (node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.url) {
|
|
327
|
+
toolbarItems.push({
|
|
328
|
+
type: 'separator'
|
|
329
|
+
}, {
|
|
330
|
+
id: 'editor.link.openLink',
|
|
331
|
+
type: 'button',
|
|
332
|
+
icon: OpenIcon,
|
|
333
|
+
metadata: metadata,
|
|
334
|
+
className: 'hyperlink-open-link',
|
|
335
|
+
title: intl.formatMessage(linkMessages.openLink),
|
|
336
|
+
onClick: visitCardLink(editorAnalyticsApi)
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
toolbarItems.push({
|
|
340
|
+
type: 'separator'
|
|
341
|
+
}, {
|
|
342
|
+
id: 'editor.link.delete',
|
|
343
|
+
focusEditoronEnter: true,
|
|
344
|
+
type: 'button',
|
|
345
|
+
appearance: 'danger',
|
|
346
|
+
icon: RemoveIcon,
|
|
347
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
348
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
349
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
350
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
351
|
+
title: intl.formatMessage(commonMessages.remove),
|
|
352
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
353
|
+
});
|
|
354
|
+
return toolbarItems;
|
|
303
355
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { JiraIssuesConfigModal } from '@atlaskit/link-datasource';
|
|
3
|
+
import { hideDatasourceModal } from '../pm-plugins/actions';
|
|
4
|
+
import { updateExistingDatasource } from '../pm-plugins/doc';
|
|
5
|
+
export var DatasourceModal = function DatasourceModal(_ref) {
|
|
6
|
+
var state = _ref.state,
|
|
7
|
+
view = _ref.view,
|
|
8
|
+
node = _ref.node;
|
|
9
|
+
var isJiraDatasource = node.attrs.datasource.parameters.jql;
|
|
10
|
+
var onClose = useCallback(function () {
|
|
11
|
+
view.dispatch(hideDatasourceModal(view.state.tr));
|
|
12
|
+
}, [view]);
|
|
13
|
+
var onInsert = useCallback(function (newAdf) {
|
|
14
|
+
updateExistingDatasource(state, node, newAdf, view);
|
|
15
|
+
}, [state, node, view]);
|
|
16
|
+
if (isJiraDatasource) {
|
|
17
|
+
var _node$attrs$datasourc, _node$attrs$datasourc2;
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
"data-testId": "jira-config-modal"
|
|
20
|
+
}, /*#__PURE__*/React.createElement(JiraIssuesConfigModal, {
|
|
21
|
+
datasourceId: node.attrs.datasource.id,
|
|
22
|
+
visibleColumnKeys: (_node$attrs$datasourc = node.attrs.datasource.views[0]) === null || _node$attrs$datasourc === void 0 ? void 0 : (_node$attrs$datasourc2 = _node$attrs$datasourc.properties) === null || _node$attrs$datasourc2 === void 0 ? void 0 : _node$attrs$datasourc2.columns.map(function (column) {
|
|
23
|
+
return column.key;
|
|
24
|
+
}),
|
|
25
|
+
parameters: node.attrs.datasource.parameters,
|
|
26
|
+
onCancel: onClose,
|
|
27
|
+
onInsert: onInsert
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
return null; // null for now until we have modal component that handles other datasources
|
|
31
|
+
};
|
|
@@ -11,13 +11,14 @@ import React from 'react';
|
|
|
11
11
|
import { withOuterListeners } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
13
13
|
import HyperlinkToolbar from '../../hyperlink/ui/HyperlinkAddToolbar';
|
|
14
|
-
import { showLinkToolbar, hideLinkToolbar as _hideLinkToolbar } from '../pm-plugins/actions';
|
|
14
|
+
import { showLinkToolbar, hideLinkToolbar as _hideLinkToolbar, showDatasourceModal } from '../pm-plugins/actions';
|
|
15
15
|
import { INPUT_METHOD, ACTION, buildEditLinkPayload } from '@atlaskit/editor-common/analytics';
|
|
16
16
|
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
17
17
|
import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
|
|
18
18
|
import { findCardInfo, displayInfoForCard } from '../utils';
|
|
19
19
|
import { NodeSelection } from 'prosemirror-state';
|
|
20
20
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
21
|
+
import { DatasourceModal } from './DatasourceModal';
|
|
21
22
|
var HyperLinkToolbarWithListeners = withOuterListeners(HyperlinkToolbar);
|
|
22
23
|
export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
23
24
|
_inherits(EditLinkToolbar, _React$Component);
|
|
@@ -161,4 +162,44 @@ export var editLinkToolbarConfig = function editLinkToolbarConfig(showLinkingToo
|
|
|
161
162
|
width: RECENT_SEARCH_WIDTH_IN_PX,
|
|
162
163
|
forcePlacement: true
|
|
163
164
|
} : {};
|
|
165
|
+
};
|
|
166
|
+
export var editDatasource = function editDatasource(editorAnalyticsApi) {
|
|
167
|
+
return function (state, dispatch) {
|
|
168
|
+
if (dispatch) {
|
|
169
|
+
var tr = state.tr;
|
|
170
|
+
showDatasourceModal(tr);
|
|
171
|
+
// editorAnalyticsApi?.attachAnalyticsEvent(
|
|
172
|
+
// buildEditLinkPayload(
|
|
173
|
+
// type as
|
|
174
|
+
// | ACTION_SUBJECT_ID.CARD_INLINE
|
|
175
|
+
// | ACTION_SUBJECT_ID.CARD_BLOCK
|
|
176
|
+
// | ACTION_SUBJECT_ID.EMBEDS,
|
|
177
|
+
// ),
|
|
178
|
+
// )(tr);
|
|
179
|
+
dispatch(tr);
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
export var openDatasourceModal = function openDatasourceModal(_ref2) {
|
|
186
|
+
var state = _ref2.state,
|
|
187
|
+
node = _ref2.node,
|
|
188
|
+
editorAnalyticsApi = _ref2.editorAnalyticsApi;
|
|
189
|
+
return {
|
|
190
|
+
type: 'custom',
|
|
191
|
+
disableArrowNavigation: true,
|
|
192
|
+
fallback: [],
|
|
193
|
+
render: function render(view) {
|
|
194
|
+
if (!view) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return /*#__PURE__*/React.createElement(DatasourceModal, {
|
|
198
|
+
state: state,
|
|
199
|
+
view: view,
|
|
200
|
+
node: node,
|
|
201
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
};
|
|
164
205
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import EditIcon from '@atlaskit/icon/glyph/edit';
|
|
4
|
+
import { editIconStyles } from './styled';
|
|
5
|
+
export var SmallerEditIcon = function SmallerEditIcon() {
|
|
6
|
+
return jsx("div", {
|
|
7
|
+
css: editIconStyles
|
|
8
|
+
}, jsx(EditIcon, {
|
|
9
|
+
label: "edit"
|
|
10
|
+
}));
|
|
11
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
export var embedCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n .embedCardView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n }\n\n .embedCardView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .embedCardView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .embedCardView-content-wrap[layout='wrap-right']\n + .embedCardView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n }\n"])));
|
|
5
|
-
export var embedSpacingStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0 10px;\n"])));
|
|
5
|
+
export var embedSpacingStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0 10px;\n"])));
|
|
6
|
+
export var editIconStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 20px;\n"])));
|
package/dist/esm/version.json
CHANGED
|
@@ -18,3 +18,5 @@ export declare const setCardLayoutAndDatasourceTableRef: ({ layout, datasourceTa
|
|
|
18
18
|
}) => (tr: Transaction) => Transaction<any>;
|
|
19
19
|
export declare const showLinkToolbar: (tr: Transaction) => Transaction<any>;
|
|
20
20
|
export declare const hideLinkToolbar: (tr: Transaction) => Transaction<any>;
|
|
21
|
+
export declare const showDatasourceModal: (tr: Transaction) => Transaction<any>;
|
|
22
|
+
export declare const hideDatasourceModal: (tr: Transaction) => Transaction<any>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
2
2
|
import { Node } from 'prosemirror-model';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
4
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
5
|
import { CardAdf, DatasourceAdf, CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
5
6
|
import { ACTION, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
7
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
8
|
+
import type { InlineCardAdf } from '@atlaskit/smart-card';
|
|
7
9
|
import { CardReplacementInputMethod, Request } from '../types';
|
|
8
10
|
export declare const replaceQueuedUrlWithCard: (url: string, cardData: CardAdf | DatasourceAdf, analyticsAction?: ACTION, editorAnalyticsApi?: EditorAnalyticsAPI) => Command;
|
|
9
11
|
export declare const handleFallbackWithAnalytics: (request: Request, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -15,3 +17,4 @@ export declare const changeSelectedCardToLinkFallback: (text?: string, href?: st
|
|
|
15
17
|
export declare const updateCard: (href: string, sourceEvent?: UIAnalyticsEvent | null | undefined) => Command;
|
|
16
18
|
export declare const changeSelectedCardToText: (text: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
17
19
|
export declare const setSelectedCardAppearance: (appearance: CardAppearance, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
20
|
+
export declare const updateExistingDatasource: (state: EditorState, node: Node<any>, newAdf: DatasourceAdf | InlineCardAdf, view: EditorView) => void;
|
|
@@ -24,6 +24,7 @@ export declare const getPluginStateWithUpdatedPos: (pluginState: CardPluginState
|
|
|
24
24
|
smartLinkEventsNext?: import("../../types").SmartLinkEventsNext | undefined;
|
|
25
25
|
createAnalyticsEvent?: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | undefined;
|
|
26
26
|
editorAppearance?: import("@atlaskit/editor-common/types").EditorAppearance | undefined;
|
|
27
|
+
showDatasourceModal: boolean;
|
|
27
28
|
datasourceTableRef?: HTMLElement | undefined;
|
|
28
29
|
layout?: import("../../ui/LayoutButton/types").DatasourceTableLayout | undefined;
|
|
29
30
|
};
|
|
@@ -101,6 +101,7 @@ export type CardPluginState = {
|
|
|
101
101
|
smartLinkEventsNext?: SmartLinkEventsNext;
|
|
102
102
|
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
103
103
|
editorAppearance?: EditorAppearance;
|
|
104
|
+
showDatasourceModal: boolean;
|
|
104
105
|
datasourceTableRef?: HTMLElement;
|
|
105
106
|
layout?: DatasourceTableLayout;
|
|
106
107
|
};
|
|
@@ -133,6 +134,12 @@ export type ShowLinkToolbar = {
|
|
|
133
134
|
export type HideLinkToolbar = {
|
|
134
135
|
type: 'HIDE_LINK_TOOLBAR';
|
|
135
136
|
};
|
|
137
|
+
export type ShowDatasourceModal = {
|
|
138
|
+
type: 'SHOW_DATASOURCE_MODAL';
|
|
139
|
+
};
|
|
140
|
+
export type HideDatasourceModal = {
|
|
141
|
+
type: 'HIDE_DATASOURCE_MODAL';
|
|
142
|
+
};
|
|
136
143
|
export type RegisterSmartCardEvents = {
|
|
137
144
|
type: 'REGISTER_EVENTS';
|
|
138
145
|
smartLinkEvents: SmartLinkEvents;
|
|
@@ -154,6 +161,6 @@ export type SetCardLayoutAndDatasourceTableRef = {
|
|
|
154
161
|
layout: DatasourceTableLayout;
|
|
155
162
|
datasourceTableRef?: HTMLElement;
|
|
156
163
|
};
|
|
157
|
-
export type CardPluginAction = SetProvider | Queue | Resolve | Register | ShowLinkToolbar | HideLinkToolbar | RegisterSmartCardEvents | RegisterSmartCardEventsNext | SetDatasourceTableRef | SetCardLayout | SetCardLayoutAndDatasourceTableRef;
|
|
164
|
+
export type CardPluginAction = SetProvider | Queue | Resolve | Register | ShowLinkToolbar | HideLinkToolbar | ShowDatasourceModal | HideDatasourceModal | RegisterSmartCardEvents | RegisterSmartCardEventsNext | SetDatasourceTableRef | SetCardLayout | SetCardLayoutAndDatasourceTableRef;
|
|
158
165
|
export type CardReplacementInputMethod = INPUT_METHOD.CLIPBOARD | INPUT_METHOD.AUTO_DETECT | INPUT_METHOD.FORMATTING | INPUT_METHOD.MANUAL | INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.FLOATING_TB;
|
|
159
166
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Node } from 'prosemirror-model';
|
|
3
|
+
import { EditorState } from 'prosemirror-state';
|
|
4
|
+
import { EditorView } from 'prosemirror-view';
|
|
5
|
+
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
type DatasourceModalProps = {
|
|
7
|
+
state: EditorState;
|
|
8
|
+
view: EditorView;
|
|
9
|
+
node: Node<any>;
|
|
10
|
+
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
11
|
+
};
|
|
12
|
+
export declare const DatasourceModal: ({ state, view, node, }: DatasourceModalProps) => JSX.Element | null;
|
|
13
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { EditorView } from 'prosemirror-view';
|
|
3
2
|
import { Node } from 'prosemirror-model';
|
|
3
|
+
import { EditorState } from 'prosemirror-state';
|
|
4
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
5
|
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
5
6
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
6
7
|
import type { LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
@@ -39,3 +40,9 @@ export declare const buildEditLinkToolbar: ({ providerFactory, node, linkPicker,
|
|
|
39
40
|
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
40
41
|
}) => FloatingToolbarItem<Command>;
|
|
41
42
|
export declare const editLinkToolbarConfig: (showLinkingToolbar: boolean, lpLinkPicker: boolean) => Partial<FloatingToolbarConfig>;
|
|
43
|
+
export declare const editDatasource: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
44
|
+
export declare const openDatasourceModal: ({ state, node, editorAnalyticsApi, }: {
|
|
45
|
+
state: EditorState;
|
|
46
|
+
node: Node<any>;
|
|
47
|
+
editorAnalyticsApi?: EditorAnalyticsAPI | undefined;
|
|
48
|
+
}) => FloatingToolbarItem<Command>;
|
|
@@ -18,3 +18,5 @@ export declare const setCardLayoutAndDatasourceTableRef: ({ layout, datasourceTa
|
|
|
18
18
|
}) => (tr: Transaction) => Transaction<any>;
|
|
19
19
|
export declare const showLinkToolbar: (tr: Transaction) => Transaction<any>;
|
|
20
20
|
export declare const hideLinkToolbar: (tr: Transaction) => Transaction<any>;
|
|
21
|
+
export declare const showDatasourceModal: (tr: Transaction) => Transaction<any>;
|
|
22
|
+
export declare const hideDatasourceModal: (tr: Transaction) => Transaction<any>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
2
2
|
import { Node } from 'prosemirror-model';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
4
|
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
5
|
import { CardAdf, DatasourceAdf, CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
5
6
|
import { ACTION, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
7
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
8
|
+
import type { InlineCardAdf } from '@atlaskit/smart-card';
|
|
7
9
|
import { CardReplacementInputMethod, Request } from '../types';
|
|
8
10
|
export declare const replaceQueuedUrlWithCard: (url: string, cardData: CardAdf | DatasourceAdf, analyticsAction?: ACTION, editorAnalyticsApi?: EditorAnalyticsAPI) => Command;
|
|
9
11
|
export declare const handleFallbackWithAnalytics: (request: Request, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -15,3 +17,4 @@ export declare const changeSelectedCardToLinkFallback: (text?: string, href?: st
|
|
|
15
17
|
export declare const updateCard: (href: string, sourceEvent?: UIAnalyticsEvent | null | undefined) => Command;
|
|
16
18
|
export declare const changeSelectedCardToText: (text: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
17
19
|
export declare const setSelectedCardAppearance: (appearance: CardAppearance, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
20
|
+
export declare const updateExistingDatasource: (state: EditorState, node: Node<any>, newAdf: DatasourceAdf | InlineCardAdf, view: EditorView) => void;
|
|
@@ -24,6 +24,7 @@ export declare const getPluginStateWithUpdatedPos: (pluginState: CardPluginState
|
|
|
24
24
|
smartLinkEventsNext?: import("../../types").SmartLinkEventsNext | undefined;
|
|
25
25
|
createAnalyticsEvent?: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | undefined;
|
|
26
26
|
editorAppearance?: import("@atlaskit/editor-common/types").EditorAppearance | undefined;
|
|
27
|
+
showDatasourceModal: boolean;
|
|
27
28
|
datasourceTableRef?: HTMLElement | undefined;
|
|
28
29
|
layout?: import("../../ui/LayoutButton/types").DatasourceTableLayout | undefined;
|
|
29
30
|
};
|