@atlaskit/editor-core 185.5.7 → 185.6.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 +18 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +21 -8
- 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/create-editor/ReactEditorViewInternal.js +21 -8
- 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/create-editor/ReactEditorViewInternal.js +21 -8
- 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/create-editor/ReactEditorViewInternal.d.ts +1 -0
- 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/plugins/collab-edit/participants.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.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/dist/types-ts4.5/plugins/collab-edit/participants.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 185.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a1a0ac82bce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a1a0ac82bce) - ED-18861 Update editor wrapper div when assistiveLabel prop change.
|
|
8
|
+
- [`8d460228bf3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d460228bf3) - NONE: fix collabparticipant import
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 185.6.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`a1b70608039`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a1b70608039) - [ux] Adds editor toolbar to link datasource component
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 185.5.7
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -486,14 +486,24 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
488
|
});
|
|
489
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
489
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createEditor", function (assistiveLabel) {
|
|
490
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
491
|
+
className: getUAPrefix(),
|
|
492
|
+
key: "ProseMirror",
|
|
493
|
+
ref: _this.handleEditorViewRef,
|
|
494
|
+
"aria-label": assistiveLabel || _this.props.intl.formatMessage(_messages.editorMessages.editorAssistiveLabel)
|
|
495
|
+
// setting aria-multiline to true when not mobile appearance.
|
|
496
|
+
// because somehow mobile tests are failing when it set.
|
|
497
|
+
// don't know why that is happening.
|
|
498
|
+
// Created https://product-fabric.atlassian.net/jira/servicedesk/projects/DTR/queues/issue/DTR-1675
|
|
499
|
+
// to investigate further.
|
|
500
|
+
,
|
|
501
|
+
"aria-multiline": _this.props.editorProps.appearance !== 'mobile' ? true : false,
|
|
502
|
+
role: "textbox",
|
|
503
|
+
id: EDIT_AREA_ID
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "editor", _this.createEditor(_this.props.editorProps.assistiveLabel));
|
|
497
507
|
_this.pluginInjectionAPI = new _preset.EditorPluginInjectionAPI({
|
|
498
508
|
getEditorState: _this.getEditorState
|
|
499
509
|
});
|
|
@@ -622,6 +632,9 @@ var ReactEditorView = /*#__PURE__*/function (_React$Component) {
|
|
|
622
632
|
if (!this.transactionTracking.enabled) {
|
|
623
633
|
this.pluginPerformanceObserver.disconnect();
|
|
624
634
|
}
|
|
635
|
+
if (nextProps.editorProps.assistiveLabel !== this.props.editorProps.assistiveLabel) {
|
|
636
|
+
this.editor = this.createEditor(nextProps.editorProps.assistiveLabel);
|
|
637
|
+
}
|
|
625
638
|
}
|
|
626
639
|
}, {
|
|
627
640
|
key: "reconfigureState",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.showLinkToolbar = exports.setProvider = exports.setDatasourceTableRef = exports.setCardLayoutAndDatasourceTableRef = exports.setCardLayout = exports.resolveCard = exports.registerSmartCardEventsNext = exports.registerSmartCardEvents = exports.registerCard = exports.queueCards = exports.hideLinkToolbar = exports.cardAction = void 0;
|
|
6
|
+
exports.showLinkToolbar = exports.showDatasourceModal = exports.setProvider = exports.setDatasourceTableRef = exports.setCardLayoutAndDatasourceTableRef = exports.setCardLayout = exports.resolveCard = exports.registerSmartCardEventsNext = exports.registerSmartCardEvents = exports.registerCard = exports.queueCards = exports.hideLinkToolbar = exports.hideDatasourceModal = exports.cardAction = void 0;
|
|
7
7
|
var _pluginKey = require("./plugin-key");
|
|
8
8
|
var cardAction = function cardAction(tr, action) {
|
|
9
9
|
return tr.setMeta(_pluginKey.pluginKey, action);
|
|
@@ -104,4 +104,16 @@ var hideLinkToolbar = function hideLinkToolbar(tr) {
|
|
|
104
104
|
type: 'HIDE_LINK_TOOLBAR'
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
|
-
exports.hideLinkToolbar = hideLinkToolbar;
|
|
107
|
+
exports.hideLinkToolbar = hideLinkToolbar;
|
|
108
|
+
var showDatasourceModal = function showDatasourceModal(tr) {
|
|
109
|
+
return cardAction(tr, {
|
|
110
|
+
type: 'SHOW_DATASOURCE_MODAL'
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
exports.showDatasourceModal = showDatasourceModal;
|
|
114
|
+
var hideDatasourceModal = function hideDatasourceModal(tr) {
|
|
115
|
+
return cardAction(tr, {
|
|
116
|
+
type: 'HIDE_DATASOURCE_MODAL'
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
exports.hideDatasourceModal = hideDatasourceModal;
|
|
@@ -4,9 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
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.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
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
10
11
|
var _prosemirrorState = require("prosemirror-state");
|
|
11
12
|
var _prosemirrorHistory = require("prosemirror-history");
|
|
12
13
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
@@ -424,4 +425,35 @@ var getLinkNodeType = function getLinkNodeType(appearance, linkNodes) {
|
|
|
424
425
|
case 'embed':
|
|
425
426
|
return linkNodes.embedCard;
|
|
426
427
|
}
|
|
427
|
-
};
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
// Apply an update to a datasource (aka blockCard) node
|
|
431
|
+
var updateExistingDatasource = function updateExistingDatasource(state, node, newAdf, view) {
|
|
432
|
+
var tr = state.tr,
|
|
433
|
+
from = state.selection.from,
|
|
434
|
+
schemaNodes = state.schema.nodes;
|
|
435
|
+
|
|
436
|
+
// datasource to datasource
|
|
437
|
+
if (newAdf.type === 'blockCard' && newAdf.attrs.datasource && node.attrs.datasource) {
|
|
438
|
+
var _ref, _ref2, _newViews$, _newViews$$properties, _oldViews$, _oldViews$$properties, _newAdf$attrs, _node$attrs;
|
|
439
|
+
var newViews = (_ref = newAdf.attrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
|
|
440
|
+
var oldViews = (_ref2 = node.attrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
441
|
+
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) {
|
|
442
|
+
return column.key;
|
|
443
|
+
});
|
|
444
|
+
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) {
|
|
445
|
+
return column.key;
|
|
446
|
+
});
|
|
447
|
+
var isColumnChange = !(0, _isEqual.default)(oldColumnKeys, newColumnKeys);
|
|
448
|
+
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
|
+
if (isColumnChange || isUrlChange) {
|
|
450
|
+
tr.setNodeMarkup(from, schemaNodes.blockCard, newAdf.attrs);
|
|
451
|
+
}
|
|
452
|
+
} else if (newAdf.type === 'inlineCard') {
|
|
453
|
+
// datasource to inline
|
|
454
|
+
tr.setNodeMarkup(from, schemaNodes.inlineCard, newAdf.attrs);
|
|
455
|
+
}
|
|
456
|
+
(0, _actions.hideDatasourceModal)(tr);
|
|
457
|
+
view.dispatch(tr.scrollIntoView());
|
|
458
|
+
};
|
|
459
|
+
exports.updateExistingDatasource = updateExistingDatasource;
|
|
@@ -50,6 +50,7 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
50
50
|
smartLinkEventsNext: undefined,
|
|
51
51
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
52
52
|
editorAppearance: editorAppearance,
|
|
53
|
+
showDatasourceModal: false,
|
|
53
54
|
datasourceTableRef: undefined,
|
|
54
55
|
layout: undefined
|
|
55
56
|
};
|
|
@@ -67,6 +67,11 @@ var setLinkToolbar = function setLinkToolbar(state, action) {
|
|
|
67
67
|
showLinkingToolbar: action.type === 'SHOW_LINK_TOOLBAR'
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
|
+
var setDatasourceModal = function setDatasourceModal(state, action) {
|
|
71
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
72
|
+
showDatasourceModal: action.type === 'SHOW_DATASOURCE_MODAL'
|
|
73
|
+
});
|
|
74
|
+
};
|
|
70
75
|
var _default = function _default(state, action) {
|
|
71
76
|
switch (action.type) {
|
|
72
77
|
case 'QUEUE':
|
|
@@ -90,6 +95,9 @@ var _default = function _default(state, action) {
|
|
|
90
95
|
case 'SHOW_LINK_TOOLBAR':
|
|
91
96
|
case 'HIDE_LINK_TOOLBAR':
|
|
92
97
|
return setLinkToolbar(state, action);
|
|
98
|
+
case 'SHOW_DATASOURCE_MODAL':
|
|
99
|
+
case 'HIDE_DATASOURCE_MODAL':
|
|
100
|
+
return setDatasourceModal(state, action);
|
|
93
101
|
}
|
|
94
102
|
};
|
|
95
103
|
exports.default = _default;
|
|
@@ -10,8 +10,9 @@ var _react = require("@emotion/react");
|
|
|
10
10
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
12
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
13
|
+
var _datasource = require("./nodeviews/datasource");
|
|
13
14
|
var _templateObject;
|
|
14
15
|
var FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = 'card-floating-toolbar--link-picker';
|
|
15
16
|
exports.FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = FLOATING_TOOLBAR_LINKPICKER_CLASSNAME;
|
|
16
|
-
var smartCardStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])), _styles.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N20, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _styles.SmartCardSharedCssClassName.DATASOURCE_CONTAINER, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
|
|
17
|
+
var smartCardStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])), _styles.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-background-neutral-subtle-hovered, ".concat(_colors.N20, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _styles.SmartCardSharedCssClassName.DATASOURCE_CONTAINER, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _datasource.DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-background-neutral-subtle, ".concat(_colors.N0, ")"), "var(--ds-border-radius-100, ".concat(_editorSharedStyles.akEditorRuleBorderRadius, ")"), "var(--ds-border, ".concat(_colors.N40, ")"), _editorSharedStyles.akEditorSelectedNodeClassName, _datasource.DATASOURCE_INNER_CONTAINER_CLASSNAME, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _datasource.DATASOURCE_INNER_CONTAINER_CLASSNAME, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _styles.SmartCardSharedCssClassName.EMBED_CARD_CONTAINER, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _styles.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), "var(--ds-background-danger, ".concat(_editorSharedStyles.akEditorDeleteBackground, ")"), "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), FLOATING_TOOLBAR_LINKPICKER_CLASSNAME);
|
|
17
18
|
exports.smartCardStyles = smartCardStyles;
|
|
@@ -27,6 +27,7 @@ var _LinkToolbarAppearance = require("./ui/LinkToolbarAppearance");
|
|
|
27
27
|
var _messages2 = require("./messages");
|
|
28
28
|
var _styles2 = require("./styles");
|
|
29
29
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
30
|
+
var _SmallerEditIcon = require("./ui/SmallerEditIcon");
|
|
30
31
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
33
|
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; }
|
|
@@ -174,7 +175,7 @@ var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
|
174
175
|
};
|
|
175
176
|
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
176
177
|
return function (node) {
|
|
177
|
-
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5;
|
|
178
|
+
var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4, _pluginInjectionApi$d5, _node$attrs;
|
|
178
179
|
var _titleUrlPairFromNode2 = (0, _utils.titleUrlPairFromNode)(node),
|
|
179
180
|
url = _titleUrlPairFromNode2.url;
|
|
180
181
|
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 : {},
|
|
@@ -194,6 +195,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
194
195
|
var currentAppearance = (0, _utils.appearanceForNodeType)(node.type);
|
|
195
196
|
var _ref2 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d4 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : (_pluginInjectionApi$d5 = _pluginInjectionApi$d4.decorations) === null || _pluginInjectionApi$d5 === void 0 ? void 0 : _pluginInjectionApi$d5.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
|
|
196
197
|
hoverDecoration = _ref2.hoverDecoration;
|
|
198
|
+
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);
|
|
197
199
|
|
|
198
200
|
/* mobile builds toolbar natively using toolbarItems */
|
|
199
201
|
if (pluginState.showLinkingToolbar && platform !== 'mobile') {
|
|
@@ -204,6 +206,15 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
204
206
|
featureFlags: featureFlags,
|
|
205
207
|
pluginInjectionApi: pluginInjectionApi
|
|
206
208
|
})];
|
|
209
|
+
} else if (pluginState.showDatasourceModal) {
|
|
210
|
+
return [(0, _EditLinkToolbar.openDatasourceModal)({
|
|
211
|
+
state: state,
|
|
212
|
+
node: node,
|
|
213
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
214
|
+
})];
|
|
215
|
+
// not showing toolbar in mobile for now since not sure what our plans are for it
|
|
216
|
+
} else if (isDatasource && platform !== 'mobile') {
|
|
217
|
+
return getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration);
|
|
207
218
|
} else {
|
|
208
219
|
var inlineCard = state.schema.nodes.inlineCard;
|
|
209
220
|
var toolbarItems = [{
|
|
@@ -313,4 +324,45 @@ var getSettingsButtonGroup = function getSettingsButtonGroup(state, featureFlags
|
|
|
313
324
|
}, {
|
|
314
325
|
type: 'separator'
|
|
315
326
|
}] : [];
|
|
327
|
+
};
|
|
328
|
+
var getDatasourceButtonGroup = function getDatasourceButtonGroup(state, metadata, intl, editorAnalyticsApi, node, hoverDecoration) {
|
|
329
|
+
var _node$attrs2;
|
|
330
|
+
var toolbarItems = [{
|
|
331
|
+
id: 'editor.edit.datasource',
|
|
332
|
+
type: 'button',
|
|
333
|
+
icon: _SmallerEditIcon.SmallerEditIcon,
|
|
334
|
+
metadata: metadata,
|
|
335
|
+
className: 'datasource-edit',
|
|
336
|
+
title: intl.formatMessage(_messages.linkToolbarMessages.editDatasource),
|
|
337
|
+
onClick: (0, _EditLinkToolbar.editDatasource)(editorAnalyticsApi)
|
|
338
|
+
}];
|
|
339
|
+
if (node !== null && node !== void 0 && (_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.url) {
|
|
340
|
+
toolbarItems.push({
|
|
341
|
+
type: 'separator'
|
|
342
|
+
}, {
|
|
343
|
+
id: 'editor.link.openLink',
|
|
344
|
+
type: 'button',
|
|
345
|
+
icon: _shortcut.default,
|
|
346
|
+
metadata: metadata,
|
|
347
|
+
className: 'hyperlink-open-link',
|
|
348
|
+
title: intl.formatMessage(_messages.linkMessages.openLink),
|
|
349
|
+
onClick: visitCardLink(editorAnalyticsApi)
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
toolbarItems.push({
|
|
353
|
+
type: 'separator'
|
|
354
|
+
}, {
|
|
355
|
+
id: 'editor.link.delete',
|
|
356
|
+
focusEditoronEnter: true,
|
|
357
|
+
type: 'button',
|
|
358
|
+
appearance: 'danger',
|
|
359
|
+
icon: _remove.default,
|
|
360
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
361
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
362
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
|
|
363
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
|
|
364
|
+
title: intl.formatMessage(_messages.default.remove),
|
|
365
|
+
onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
|
|
366
|
+
});
|
|
367
|
+
return toolbarItems;
|
|
316
368
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DatasourceModal = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
10
|
+
var _actions = require("../pm-plugins/actions");
|
|
11
|
+
var _doc = require("../pm-plugins/doc");
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
var DatasourceModal = function DatasourceModal(_ref) {
|
|
15
|
+
var state = _ref.state,
|
|
16
|
+
view = _ref.view,
|
|
17
|
+
node = _ref.node;
|
|
18
|
+
var isJiraDatasource = node.attrs.datasource.parameters.jql;
|
|
19
|
+
var onClose = (0, _react.useCallback)(function () {
|
|
20
|
+
view.dispatch((0, _actions.hideDatasourceModal)(view.state.tr));
|
|
21
|
+
}, [view]);
|
|
22
|
+
var onInsert = (0, _react.useCallback)(function (newAdf) {
|
|
23
|
+
(0, _doc.updateExistingDatasource)(state, node, newAdf, view);
|
|
24
|
+
}, [state, node, view]);
|
|
25
|
+
if (isJiraDatasource) {
|
|
26
|
+
var _node$attrs$datasourc, _node$attrs$datasourc2;
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
28
|
+
"data-testId": "jira-config-modal"
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(_linkDatasource.JiraIssuesConfigModal, {
|
|
30
|
+
datasourceId: node.attrs.datasource.id,
|
|
31
|
+
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) {
|
|
32
|
+
return column.key;
|
|
33
|
+
}),
|
|
34
|
+
parameters: node.attrs.datasource.parameters,
|
|
35
|
+
onCancel: onClose,
|
|
36
|
+
onInsert: onInsert
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
return null; // null for now until we have modal component that handles other datasources
|
|
40
|
+
};
|
|
41
|
+
exports.DatasourceModal = DatasourceModal;
|
|
@@ -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.editLinkToolbarConfig = exports.editLink = exports.buildEditLinkToolbar = exports.EditLinkToolbar = void 0;
|
|
7
|
+
exports.openDatasourceModal = exports.editLinkToolbarConfig = exports.editLink = exports.editDatasource = exports.buildEditLinkToolbar = exports.EditLinkToolbar = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -22,6 +22,7 @@ var _doc = require("../pm-plugins/doc");
|
|
|
22
22
|
var _utils = require("../utils");
|
|
23
23
|
var _prosemirrorState = require("prosemirror-state");
|
|
24
24
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
25
|
+
var _DatasourceModal = require("./DatasourceModal");
|
|
25
26
|
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); }; }
|
|
26
27
|
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; } }
|
|
27
28
|
var HyperLinkToolbarWithListeners = (0, _ui.withOuterListeners)(_HyperlinkAddToolbar.default);
|
|
@@ -171,4 +172,46 @@ var editLinkToolbarConfig = function editLinkToolbarConfig(showLinkingToolbar, l
|
|
|
171
172
|
forcePlacement: true
|
|
172
173
|
} : {};
|
|
173
174
|
};
|
|
174
|
-
exports.editLinkToolbarConfig = editLinkToolbarConfig;
|
|
175
|
+
exports.editLinkToolbarConfig = editLinkToolbarConfig;
|
|
176
|
+
var editDatasource = function editDatasource(editorAnalyticsApi) {
|
|
177
|
+
return function (state, dispatch) {
|
|
178
|
+
if (dispatch) {
|
|
179
|
+
var tr = state.tr;
|
|
180
|
+
(0, _actions.showDatasourceModal)(tr);
|
|
181
|
+
// editorAnalyticsApi?.attachAnalyticsEvent(
|
|
182
|
+
// buildEditLinkPayload(
|
|
183
|
+
// type as
|
|
184
|
+
// | ACTION_SUBJECT_ID.CARD_INLINE
|
|
185
|
+
// | ACTION_SUBJECT_ID.CARD_BLOCK
|
|
186
|
+
// | ACTION_SUBJECT_ID.EMBEDS,
|
|
187
|
+
// ),
|
|
188
|
+
// )(tr);
|
|
189
|
+
dispatch(tr);
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
exports.editDatasource = editDatasource;
|
|
196
|
+
var openDatasourceModal = function openDatasourceModal(_ref2) {
|
|
197
|
+
var state = _ref2.state,
|
|
198
|
+
node = _ref2.node,
|
|
199
|
+
editorAnalyticsApi = _ref2.editorAnalyticsApi;
|
|
200
|
+
return {
|
|
201
|
+
type: 'custom',
|
|
202
|
+
disableArrowNavigation: true,
|
|
203
|
+
fallback: [],
|
|
204
|
+
render: function render(view) {
|
|
205
|
+
if (!view) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
return /*#__PURE__*/_react.default.createElement(_DatasourceModal.DatasourceModal, {
|
|
209
|
+
state: state,
|
|
210
|
+
view: view,
|
|
211
|
+
node: node,
|
|
212
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
exports.openDatasourceModal = openDatasourceModal;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SmallerEditIcon = void 0;
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
var _edit = _interopRequireDefault(require("@atlaskit/icon/glyph/edit"));
|
|
10
|
+
var _styled = require("./styled");
|
|
11
|
+
/** @jsx jsx */
|
|
12
|
+
|
|
13
|
+
var SmallerEditIcon = function SmallerEditIcon() {
|
|
14
|
+
return (0, _react.jsx)("div", {
|
|
15
|
+
css: _styled.editIconStyles
|
|
16
|
+
}, (0, _react.jsx)(_edit.default, {
|
|
17
|
+
label: "edit"
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
exports.SmallerEditIcon = SmallerEditIcon;
|
|
@@ -4,11 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.embedSpacingStyles = exports.embedCardStyles = void 0;
|
|
7
|
+
exports.embedSpacingStyles = exports.embedCardStyles = exports.editIconStyles = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
-
var _templateObject, _templateObject2;
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
11
11
|
var embedCardStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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"])));
|
|
12
12
|
exports.embedCardStyles = embedCardStyles;
|
|
13
13
|
var embedSpacingStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 10px;\n"])));
|
|
14
|
-
exports.embedSpacingStyles = embedSpacingStyles;
|
|
14
|
+
exports.embedSpacingStyles = embedSpacingStyles;
|
|
15
|
+
var editIconStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n width: 20px;\n"])));
|
|
16
|
+
exports.editIconStyles = editIconStyles;
|
|
@@ -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.6.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
|
@@ -486,14 +486,24 @@ export class ReactEditorView extends React.Component {
|
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
488
|
});
|
|
489
|
-
_defineProperty(this, "
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
489
|
+
_defineProperty(this, "createEditor", assistiveLabel => {
|
|
490
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
491
|
+
className: getUAPrefix(),
|
|
492
|
+
key: "ProseMirror",
|
|
493
|
+
ref: this.handleEditorViewRef,
|
|
494
|
+
"aria-label": assistiveLabel || this.props.intl.formatMessage(editorMessages.editorAssistiveLabel)
|
|
495
|
+
// setting aria-multiline to true when not mobile appearance.
|
|
496
|
+
// because somehow mobile tests are failing when it set.
|
|
497
|
+
// don't know why that is happening.
|
|
498
|
+
// Created https://product-fabric.atlassian.net/jira/servicedesk/projects/DTR/queues/issue/DTR-1675
|
|
499
|
+
// to investigate further.
|
|
500
|
+
,
|
|
501
|
+
"aria-multiline": this.props.editorProps.appearance !== 'mobile' ? true : false,
|
|
502
|
+
role: "textbox",
|
|
503
|
+
id: EDIT_AREA_ID
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
_defineProperty(this, "editor", this.createEditor(this.props.editorProps.assistiveLabel));
|
|
497
507
|
this.pluginInjectionAPI = new EditorPluginInjectionAPI({
|
|
498
508
|
getEditorState: this.getEditorState
|
|
499
509
|
});
|
|
@@ -582,6 +592,9 @@ export class ReactEditorView extends React.Component {
|
|
|
582
592
|
if (!this.transactionTracking.enabled) {
|
|
583
593
|
this.pluginPerformanceObserver.disconnect();
|
|
584
594
|
}
|
|
595
|
+
if (nextProps.editorProps.assistiveLabel !== this.props.editorProps.assistiveLabel) {
|
|
596
|
+
this.editor = this.createEditor(nextProps.editorProps.assistiveLabel);
|
|
597
|
+
}
|
|
585
598
|
}
|
|
586
599
|
reconfigureState(props) {
|
|
587
600
|
if (!this.view) {
|
|
@@ -47,4 +47,10 @@ export const showLinkToolbar = tr => cardAction(tr, {
|
|
|
47
47
|
});
|
|
48
48
|
export const hideLinkToolbar = tr => cardAction(tr, {
|
|
49
49
|
type: 'HIDE_LINK_TOOLBAR'
|
|
50
|
+
});
|
|
51
|
+
export const showDatasourceModal = tr => cardAction(tr, {
|
|
52
|
+
type: 'SHOW_DATASOURCE_MODAL'
|
|
53
|
+
});
|
|
54
|
+
export const hideDatasourceModal = tr => cardAction(tr, {
|
|
55
|
+
type: 'HIDE_DATASOURCE_MODAL'
|
|
50
56
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import isEqual from 'lodash/isEqual';
|
|
1
2
|
import { NodeSelection, TextSelection } from 'prosemirror-state';
|
|
2
3
|
import { closeHistory } from 'prosemirror-history';
|
|
3
4
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
@@ -6,7 +7,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SM
|
|
|
6
7
|
import { nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import { isFromCurrentDomain, getLinkCreationAnalyticsEvent } from '@atlaskit/editor-common/utils';
|
|
8
9
|
import { appearanceForNodeType, selectedCardAppearance } from '../utils';
|
|
9
|
-
import { queueCards, resolveCard } from './actions';
|
|
10
|
+
import { queueCards, resolveCard, hideDatasourceModal } from './actions';
|
|
10
11
|
import { pluginKey } from './plugin-key';
|
|
11
12
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
12
13
|
|
|
@@ -391,4 +392,36 @@ const getLinkNodeType = (appearance, linkNodes) => {
|
|
|
391
392
|
case 'embed':
|
|
392
393
|
return linkNodes.embedCard;
|
|
393
394
|
}
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
// Apply an update to a datasource (aka blockCard) node
|
|
398
|
+
export const updateExistingDatasource = (state, node, newAdf, view) => {
|
|
399
|
+
const {
|
|
400
|
+
tr,
|
|
401
|
+
selection: {
|
|
402
|
+
from
|
|
403
|
+
},
|
|
404
|
+
schema: {
|
|
405
|
+
nodes: schemaNodes
|
|
406
|
+
}
|
|
407
|
+
} = state;
|
|
408
|
+
|
|
409
|
+
// datasource to datasource
|
|
410
|
+
if (newAdf.type === 'blockCard' && newAdf.attrs.datasource && node.attrs.datasource) {
|
|
411
|
+
var _ref, _ref2, _newViews$, _newViews$$properties, _oldViews$, _oldViews$$properties, _newAdf$attrs, _node$attrs;
|
|
412
|
+
const newViews = (_ref = newAdf.attrs.datasource.views) !== null && _ref !== void 0 ? _ref : [];
|
|
413
|
+
const oldViews = (_ref2 = node.attrs.datasource.views) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
414
|
+
const 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(column => column.key);
|
|
415
|
+
const 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(column => column.key);
|
|
416
|
+
const isColumnChange = !isEqual(oldColumnKeys, newColumnKeys);
|
|
417
|
+
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);
|
|
418
|
+
if (isColumnChange || isUrlChange) {
|
|
419
|
+
tr.setNodeMarkup(from, schemaNodes.blockCard, newAdf.attrs);
|
|
420
|
+
}
|
|
421
|
+
} else if (newAdf.type === 'inlineCard') {
|
|
422
|
+
// datasource to inline
|
|
423
|
+
tr.setNodeMarkup(from, schemaNodes.inlineCard, newAdf.attrs);
|
|
424
|
+
}
|
|
425
|
+
hideDatasourceModal(tr);
|
|
426
|
+
view.dispatch(tr.scrollIntoView());
|
|
394
427
|
};
|
|
@@ -65,6 +65,12 @@ const setLinkToolbar = (state, action) => {
|
|
|
65
65
|
showLinkingToolbar: action.type === 'SHOW_LINK_TOOLBAR'
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
+
const setDatasourceModal = (state, action) => {
|
|
69
|
+
return {
|
|
70
|
+
...state,
|
|
71
|
+
showDatasourceModal: action.type === 'SHOW_DATASOURCE_MODAL'
|
|
72
|
+
};
|
|
73
|
+
};
|
|
68
74
|
export default ((state, action) => {
|
|
69
75
|
switch (action.type) {
|
|
70
76
|
case 'QUEUE':
|
|
@@ -88,5 +94,8 @@ export default ((state, action) => {
|
|
|
88
94
|
case 'SHOW_LINK_TOOLBAR':
|
|
89
95
|
case 'HIDE_LINK_TOOLBAR':
|
|
90
96
|
return setLinkToolbar(state, action);
|
|
97
|
+
case 'SHOW_DATASOURCE_MODAL':
|
|
98
|
+
case 'HIDE_DATASOURCE_MODAL':
|
|
99
|
+
return setDatasourceModal(state, action);
|
|
91
100
|
}
|
|
92
101
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { SelectionStyle, getSelectionStyles, akEditorDeleteBorder, akEditorDeleteBackground } from '@atlaskit/editor-shared-styles';
|
|
3
|
-
import { N20 } from '@atlaskit/theme/colors';
|
|
2
|
+
import { SelectionStyle, getSelectionStyles, akEditorDeleteBorder, akEditorDeleteBackground, akEditorRuleBorderRadius } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { N0, N20, N40 } from '@atlaskit/theme/colors';
|
|
4
4
|
import { SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
|
|
6
|
+
import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from './nodeviews/datasource';
|
|
6
7
|
export const FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = 'card-floating-toolbar--link-picker';
|
|
7
8
|
export const smartCardStyles = css`
|
|
8
9
|
.${SmartCardSharedCssClassName.INLINE_CARD_CONTAINER} {
|
|
@@ -71,6 +72,26 @@ export const smartCardStyles = css`
|
|
|
71
72
|
max-width: 100%;
|
|
72
73
|
display: flex;
|
|
73
74
|
justify-content: center;
|
|
75
|
+
|
|
76
|
+
.${DATASOURCE_INNER_CONTAINER_CLASSNAME} {
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
background-color: ${`var(--ds-background-neutral-subtle, ${N0})`};
|
|
79
|
+
border-radius: ${`var(--ds-border-radius-100, ${akEditorRuleBorderRadius})`};
|
|
80
|
+
border: 1px solid ${`var(--ds-border, ${N40})`};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&.${akEditorSelectedNodeClassName} {
|
|
84
|
+
.${DATASOURCE_INNER_CONTAINER_CLASSNAME} {
|
|
85
|
+
${getSelectionStyles([SelectionStyle.BoxShadow])}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.danger {
|
|
90
|
+
.${DATASOURCE_INNER_CONTAINER_CLASSNAME} {
|
|
91
|
+
box-shadow: 0 0 0 1px
|
|
92
|
+
${`var(--ds-border-danger, ${akEditorDeleteBorder})`};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
74
95
|
}
|
|
75
96
|
|
|
76
97
|
.${SmartCardSharedCssClassName.EMBED_CARD_CONTAINER} {
|