@atlaskit/editor-plugin-card 0.3.5 → 0.3.7
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 +13 -0
- package/dist/cjs/nodeviews/datasource.js +1 -8
- package/dist/cjs/ui/EditLinkToolbar.js +16 -30
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/nodeviews/datasource.js +2 -9
- package/dist/es2019/ui/EditLinkToolbar.js +6 -17
- package/dist/es2019/version.json +1 -1
- package/dist/esm/nodeviews/datasource.js +2 -9
- package/dist/esm/ui/EditLinkToolbar.js +17 -31
- package/dist/esm/version.json +1 -1
- package/dist/types/nodeviews/datasource.d.ts +0 -2
- package/dist/types/ui/EditLinkToolbar.d.ts +0 -4
- package/dist/types-ts4.5/nodeviews/datasource.d.ts +0 -2
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +0 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 0.3.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`31405891e32`](https://bitbucket.org/atlassian/atlassian-frontend/commits/31405891e32) - Extract editor disabled plugin as separate package.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 0.3.6
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`fd24b65bb62`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fd24b65bb62) - Fix table width bug when layout is undefined for datasource.
|
|
15
|
+
|
|
3
16
|
## 0.3.5
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -122,12 +122,6 @@ var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
122
122
|
var _this2;
|
|
123
123
|
(0, _classCallCheck2.default)(this, Datasource);
|
|
124
124
|
_this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
|
|
125
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "calcTableWidth", function (layout, containerWidth) {
|
|
126
|
-
if (layout === 'center') {
|
|
127
|
-
return 'inherit';
|
|
128
|
-
}
|
|
129
|
-
return (0, _utils.calcBreakoutWidthPx)(layout, containerWidth);
|
|
130
|
-
});
|
|
131
125
|
var sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.dependencies) === null || _props$pluginInjectio2 === void 0 ? void 0 : (_props$pluginInjectio3 = _props$pluginInjectio2.width) === null || _props$pluginInjectio3 === void 0 ? void 0 : _props$pluginInjectio3.sharedState;
|
|
132
126
|
_this2.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
|
|
133
127
|
sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(function (_ref2) {
|
|
@@ -150,11 +144,10 @@ var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
150
144
|
key: "render",
|
|
151
145
|
value: function render() {
|
|
152
146
|
var attrs = this.node.attrs;
|
|
153
|
-
var calculatedWidth = this.calcTableWidth(attrs.layout, this.tableWidth);
|
|
154
147
|
return (0, _react2.jsx)("div", {
|
|
155
148
|
className: _styles.DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
156
149
|
style: {
|
|
157
|
-
minWidth:
|
|
150
|
+
minWidth: (0, _utils.calcBreakoutWidth)(attrs.layout, this.tableWidth)
|
|
158
151
|
}
|
|
159
152
|
}, (0, _react2.jsx)(DatasourceComponent, {
|
|
160
153
|
node: this.node,
|
|
@@ -9,11 +9,9 @@ exports.HyperlinkAddToolbarWithState = HyperlinkAddToolbarWithState;
|
|
|
9
9
|
exports.editLinkToolbarConfig = exports.editLink = exports.editDatasource = exports.buildEditLinkToolbar = void 0;
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
15
|
var _react = _interopRequireDefault(require("react"));
|
|
18
16
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
19
17
|
var _card = require("@atlaskit/editor-common/card");
|
|
@@ -28,7 +26,6 @@ var _doc = require("../pm-plugins/doc");
|
|
|
28
26
|
var _utils = require("../utils");
|
|
29
27
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
30
28
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
-
var HyperLinkToolbarWithListeners = (0, _ui.withOuterListeners)(HyperlinkAddToolbarWithState);
|
|
32
29
|
function HyperlinkAddToolbarWithState(_ref) {
|
|
33
30
|
var _ref$linkPickerOption = _ref.linkPickerOptions,
|
|
34
31
|
linkPickerOptions = _ref$linkPickerOption === void 0 ? {} : _ref$linkPickerOption,
|
|
@@ -68,20 +65,8 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
68
65
|
(0, _inherits2.default)(EditLinkToolbar, _React$Component);
|
|
69
66
|
var _super = _createSuper(EditLinkToolbar);
|
|
70
67
|
function EditLinkToolbar() {
|
|
71
|
-
var _this;
|
|
72
68
|
(0, _classCallCheck2.default)(this, EditLinkToolbar);
|
|
73
|
-
|
|
74
|
-
args[_key] = arguments[_key];
|
|
75
|
-
}
|
|
76
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
77
|
-
/** Focus should move to the 'Edit link' button when the toolbar closes
|
|
78
|
-
* and not close the floating toolbar.
|
|
79
|
-
*/
|
|
80
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEsc", function (e) {
|
|
81
|
-
var _this$props$forceFocu, _this$props;
|
|
82
|
-
(_this$props$forceFocu = (_this$props = _this.props).forceFocusSelector) === null || _this$props$forceFocu === void 0 ? void 0 : _this$props$forceFocu.call(_this$props, "[aria-label=\"".concat(_messages.linkToolbarMessages.editLink.defaultMessage, "\"]"), _this.props.view);
|
|
83
|
-
});
|
|
84
|
-
return _this;
|
|
69
|
+
return _super.apply(this, arguments);
|
|
85
70
|
}
|
|
86
71
|
(0, _createClass2.default)(EditLinkToolbar, [{
|
|
87
72
|
key: "componentDidUpdate",
|
|
@@ -104,31 +89,31 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
104
89
|
}, {
|
|
105
90
|
key: "render",
|
|
106
91
|
value: function render() {
|
|
107
|
-
var
|
|
108
|
-
var _this$
|
|
109
|
-
linkPickerOptions = _this$
|
|
110
|
-
providerFactory = _this$
|
|
111
|
-
url = _this$
|
|
112
|
-
text = _this$
|
|
113
|
-
view = _this$
|
|
114
|
-
featureFlags = _this$
|
|
115
|
-
_onSubmit = _this$
|
|
116
|
-
pluginInjectionApi = _this$
|
|
117
|
-
|
|
92
|
+
var _this = this;
|
|
93
|
+
var _this$props = this.props,
|
|
94
|
+
linkPickerOptions = _this$props.linkPickerOptions,
|
|
95
|
+
providerFactory = _this$props.providerFactory,
|
|
96
|
+
url = _this$props.url,
|
|
97
|
+
text = _this$props.text,
|
|
98
|
+
view = _this$props.view,
|
|
99
|
+
featureFlags = _this$props.featureFlags,
|
|
100
|
+
_onSubmit = _this$props.onSubmit,
|
|
101
|
+
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
102
|
+
forceFocusSelector = _this$props.forceFocusSelector;
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement(HyperlinkAddToolbarWithState, {
|
|
118
104
|
pluginInjectionApi: pluginInjectionApi,
|
|
119
105
|
view: view,
|
|
120
106
|
linkPickerOptions: linkPickerOptions,
|
|
121
107
|
providerFactory: providerFactory,
|
|
122
108
|
displayUrl: url,
|
|
123
|
-
displayText: text
|
|
124
|
-
handleEscapeKeydown: this.handleEsc
|
|
109
|
+
displayText: text
|
|
125
110
|
// Assumes that the smart card link picker can only ever be invoked by clicking "edit"
|
|
126
111
|
// via the floating toolbar
|
|
127
112
|
,
|
|
128
113
|
invokeMethod: _analytics.INPUT_METHOD.FLOATING_TB,
|
|
129
114
|
featureFlags: featureFlags,
|
|
130
115
|
onSubmit: function onSubmit(href, title, displayText, inputMethod, analytic) {
|
|
131
|
-
|
|
116
|
+
_this.hideLinkToolbar();
|
|
132
117
|
if (_onSubmit) {
|
|
133
118
|
_onSubmit(href, displayText || title, inputMethod, analytic);
|
|
134
119
|
}
|
|
@@ -137,6 +122,7 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
137
122
|
var tr = state.tr;
|
|
138
123
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.hyperlink.actions.hideLinkToolbar(tr);
|
|
139
124
|
(0, _actions.hideLinkToolbar)(tr);
|
|
125
|
+
forceFocusSelector === null || forceFocusSelector === void 0 ? void 0 : forceFocusSelector("[aria-label=\"".concat(_messages.linkToolbarMessages.editLink.defaultMessage, "\"]"))(tr);
|
|
140
126
|
if (dispatch) {
|
|
141
127
|
dispatch(tr);
|
|
142
128
|
return true;
|
package/dist/cjs/version.json
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
7
7
|
import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
8
|
-
import {
|
|
8
|
+
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
10
10
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
11
11
|
export class DatasourceComponent extends React.PureComponent {
|
|
@@ -90,12 +90,6 @@ export class Datasource extends ReactNodeView {
|
|
|
90
90
|
constructor(props) {
|
|
91
91
|
var _props$pluginInjectio, _props$pluginInjectio2, _props$pluginInjectio3, _sharedState$currentS;
|
|
92
92
|
super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
|
|
93
|
-
_defineProperty(this, "calcTableWidth", (layout, containerWidth) => {
|
|
94
|
-
if (layout === 'center') {
|
|
95
|
-
return 'inherit';
|
|
96
|
-
}
|
|
97
|
-
return calcBreakoutWidthPx(layout, containerWidth);
|
|
98
|
-
});
|
|
99
93
|
const sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.dependencies) === null || _props$pluginInjectio2 === void 0 ? void 0 : (_props$pluginInjectio3 = _props$pluginInjectio2.width) === null || _props$pluginInjectio3 === void 0 ? void 0 : _props$pluginInjectio3.sharedState;
|
|
100
94
|
this.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
|
|
101
95
|
sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(({
|
|
@@ -117,11 +111,10 @@ export class Datasource extends ReactNodeView {
|
|
|
117
111
|
const {
|
|
118
112
|
attrs
|
|
119
113
|
} = this.node;
|
|
120
|
-
const calculatedWidth = this.calcTableWidth(attrs.layout, this.tableWidth);
|
|
121
114
|
return jsx("div", {
|
|
122
115
|
className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
123
116
|
style: {
|
|
124
|
-
minWidth:
|
|
117
|
+
minWidth: calcBreakoutWidth(attrs.layout, this.tableWidth)
|
|
125
118
|
}
|
|
126
119
|
}, jsx(DatasourceComponent, {
|
|
127
120
|
node: this.node,
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { ACTION, buildEditLinkPayload, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
5
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
5
|
import { HyperlinkAddToolbar as HyperlinkToolbar } from '@atlaskit/editor-common/link';
|
|
7
6
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
8
|
-
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX
|
|
7
|
+
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
9
8
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
9
|
import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
11
10
|
import { hideLinkToolbar, showDatasourceModal, showLinkToolbar } from '../pm-plugins/actions';
|
|
12
11
|
import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
|
|
13
12
|
import { displayInfoForCard, findCardInfo } from '../utils';
|
|
14
|
-
const HyperLinkToolbarWithListeners = withOuterListeners(HyperlinkAddToolbarWithState);
|
|
15
13
|
export function HyperlinkAddToolbarWithState({
|
|
16
14
|
linkPickerOptions = {},
|
|
17
15
|
onSubmit,
|
|
@@ -49,16 +47,6 @@ export function HyperlinkAddToolbarWithState({
|
|
|
49
47
|
|
|
50
48
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
51
49
|
export class EditLinkToolbar extends React.Component {
|
|
52
|
-
constructor(...args) {
|
|
53
|
-
super(...args);
|
|
54
|
-
/** Focus should move to the 'Edit link' button when the toolbar closes
|
|
55
|
-
* and not close the floating toolbar.
|
|
56
|
-
*/
|
|
57
|
-
_defineProperty(this, "handleEsc", e => {
|
|
58
|
-
var _this$props$forceFocu, _this$props;
|
|
59
|
-
(_this$props$forceFocu = (_this$props = this.props).forceFocusSelector) === null || _this$props$forceFocu === void 0 ? void 0 : _this$props$forceFocu.call(_this$props, `[aria-label="${linkToolbarMessages.editLink.defaultMessage}"]`, this.props.view);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
50
|
componentDidUpdate(prevProps) {
|
|
63
51
|
if (prevProps.node !== this.props.node) {
|
|
64
52
|
this.hideLinkToolbar();
|
|
@@ -82,16 +70,16 @@ export class EditLinkToolbar extends React.Component {
|
|
|
82
70
|
view,
|
|
83
71
|
featureFlags,
|
|
84
72
|
onSubmit,
|
|
85
|
-
pluginInjectionApi
|
|
73
|
+
pluginInjectionApi,
|
|
74
|
+
forceFocusSelector
|
|
86
75
|
} = this.props;
|
|
87
|
-
return /*#__PURE__*/React.createElement(
|
|
76
|
+
return /*#__PURE__*/React.createElement(HyperlinkAddToolbarWithState, {
|
|
88
77
|
pluginInjectionApi: pluginInjectionApi,
|
|
89
78
|
view: view,
|
|
90
79
|
linkPickerOptions: linkPickerOptions,
|
|
91
80
|
providerFactory: providerFactory,
|
|
92
81
|
displayUrl: url,
|
|
93
|
-
displayText: text
|
|
94
|
-
handleEscapeKeydown: this.handleEsc
|
|
82
|
+
displayText: text
|
|
95
83
|
// Assumes that the smart card link picker can only ever be invoked by clicking "edit"
|
|
96
84
|
// via the floating toolbar
|
|
97
85
|
,
|
|
@@ -109,6 +97,7 @@ export class EditLinkToolbar extends React.Component {
|
|
|
109
97
|
} = state;
|
|
110
98
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.hyperlink.actions.hideLinkToolbar(tr);
|
|
111
99
|
hideLinkToolbar(tr);
|
|
100
|
+
forceFocusSelector === null || forceFocusSelector === void 0 ? void 0 : forceFocusSelector(`[aria-label="${linkToolbarMessages.editLink.defaultMessage}"]`)(tr);
|
|
112
101
|
if (dispatch) {
|
|
113
102
|
dispatch(tr);
|
|
114
103
|
return true;
|
package/dist/es2019/version.json
CHANGED
|
@@ -15,7 +15,7 @@ import { jsx } from '@emotion/react';
|
|
|
15
15
|
import PropTypes from 'prop-types';
|
|
16
16
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
17
17
|
import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
18
|
-
import {
|
|
18
|
+
import { calcBreakoutWidth } from '@atlaskit/editor-common/utils';
|
|
19
19
|
import { DatasourceTableView } from '@atlaskit/link-datasource';
|
|
20
20
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
21
21
|
export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -115,12 +115,6 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
115
115
|
var _this2;
|
|
116
116
|
_classCallCheck(this, Datasource);
|
|
117
117
|
_this2 = _super2.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, true, undefined, props.hasIntlContext);
|
|
118
|
-
_defineProperty(_assertThisInitialized(_this2), "calcTableWidth", function (layout, containerWidth) {
|
|
119
|
-
if (layout === 'center') {
|
|
120
|
-
return 'inherit';
|
|
121
|
-
}
|
|
122
|
-
return calcBreakoutWidthPx(layout, containerWidth);
|
|
123
|
-
});
|
|
124
118
|
var sharedState = props === null || props === void 0 ? void 0 : (_props$pluginInjectio = props.pluginInjectionApi) === null || _props$pluginInjectio === void 0 ? void 0 : (_props$pluginInjectio2 = _props$pluginInjectio.dependencies) === null || _props$pluginInjectio2 === void 0 ? void 0 : (_props$pluginInjectio3 = _props$pluginInjectio2.width) === null || _props$pluginInjectio3 === void 0 ? void 0 : _props$pluginInjectio3.sharedState;
|
|
125
119
|
_this2.tableWidth = sharedState === null || sharedState === void 0 ? void 0 : (_sharedState$currentS = sharedState.currentState()) === null || _sharedState$currentS === void 0 ? void 0 : _sharedState$currentS.width;
|
|
126
120
|
sharedState === null || sharedState === void 0 ? void 0 : sharedState.onChange(function (_ref2) {
|
|
@@ -143,11 +137,10 @@ export var Datasource = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
143
137
|
key: "render",
|
|
144
138
|
value: function render() {
|
|
145
139
|
var attrs = this.node.attrs;
|
|
146
|
-
var calculatedWidth = this.calcTableWidth(attrs.layout, this.tableWidth);
|
|
147
140
|
return jsx("div", {
|
|
148
141
|
className: DATASOURCE_INNER_CONTAINER_CLASSNAME,
|
|
149
142
|
style: {
|
|
150
|
-
minWidth:
|
|
143
|
+
minWidth: calcBreakoutWidth(attrs.layout, this.tableWidth)
|
|
151
144
|
}
|
|
152
145
|
}, jsx(DatasourceComponent, {
|
|
153
146
|
node: this.node,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
6
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
7
|
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; } }
|
|
10
8
|
import React from 'react';
|
|
@@ -13,13 +11,12 @@ import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
|
13
11
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
14
12
|
import { HyperlinkAddToolbar as HyperlinkToolbar } from '@atlaskit/editor-common/link';
|
|
15
13
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
16
|
-
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX
|
|
14
|
+
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
17
15
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
18
16
|
import { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
19
17
|
import { hideLinkToolbar as _hideLinkToolbar, showDatasourceModal, showLinkToolbar } from '../pm-plugins/actions';
|
|
20
18
|
import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
|
|
21
19
|
import { displayInfoForCard, findCardInfo } from '../utils';
|
|
22
|
-
var HyperLinkToolbarWithListeners = withOuterListeners(HyperlinkAddToolbarWithState);
|
|
23
20
|
export function HyperlinkAddToolbarWithState(_ref) {
|
|
24
21
|
var _ref$linkPickerOption = _ref.linkPickerOptions,
|
|
25
22
|
linkPickerOptions = _ref$linkPickerOption === void 0 ? {} : _ref$linkPickerOption,
|
|
@@ -59,20 +56,8 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
59
56
|
_inherits(EditLinkToolbar, _React$Component);
|
|
60
57
|
var _super = _createSuper(EditLinkToolbar);
|
|
61
58
|
function EditLinkToolbar() {
|
|
62
|
-
var _this;
|
|
63
59
|
_classCallCheck(this, EditLinkToolbar);
|
|
64
|
-
|
|
65
|
-
args[_key] = arguments[_key];
|
|
66
|
-
}
|
|
67
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
68
|
-
/** Focus should move to the 'Edit link' button when the toolbar closes
|
|
69
|
-
* and not close the floating toolbar.
|
|
70
|
-
*/
|
|
71
|
-
_defineProperty(_assertThisInitialized(_this), "handleEsc", function (e) {
|
|
72
|
-
var _this$props$forceFocu, _this$props;
|
|
73
|
-
(_this$props$forceFocu = (_this$props = _this.props).forceFocusSelector) === null || _this$props$forceFocu === void 0 ? void 0 : _this$props$forceFocu.call(_this$props, "[aria-label=\"".concat(linkToolbarMessages.editLink.defaultMessage, "\"]"), _this.props.view);
|
|
74
|
-
});
|
|
75
|
-
return _this;
|
|
60
|
+
return _super.apply(this, arguments);
|
|
76
61
|
}
|
|
77
62
|
_createClass(EditLinkToolbar, [{
|
|
78
63
|
key: "componentDidUpdate",
|
|
@@ -95,31 +80,31 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
95
80
|
}, {
|
|
96
81
|
key: "render",
|
|
97
82
|
value: function render() {
|
|
98
|
-
var
|
|
99
|
-
var _this$
|
|
100
|
-
linkPickerOptions = _this$
|
|
101
|
-
providerFactory = _this$
|
|
102
|
-
url = _this$
|
|
103
|
-
text = _this$
|
|
104
|
-
view = _this$
|
|
105
|
-
featureFlags = _this$
|
|
106
|
-
_onSubmit = _this$
|
|
107
|
-
pluginInjectionApi = _this$
|
|
108
|
-
|
|
83
|
+
var _this = this;
|
|
84
|
+
var _this$props = this.props,
|
|
85
|
+
linkPickerOptions = _this$props.linkPickerOptions,
|
|
86
|
+
providerFactory = _this$props.providerFactory,
|
|
87
|
+
url = _this$props.url,
|
|
88
|
+
text = _this$props.text,
|
|
89
|
+
view = _this$props.view,
|
|
90
|
+
featureFlags = _this$props.featureFlags,
|
|
91
|
+
_onSubmit = _this$props.onSubmit,
|
|
92
|
+
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
93
|
+
forceFocusSelector = _this$props.forceFocusSelector;
|
|
94
|
+
return /*#__PURE__*/React.createElement(HyperlinkAddToolbarWithState, {
|
|
109
95
|
pluginInjectionApi: pluginInjectionApi,
|
|
110
96
|
view: view,
|
|
111
97
|
linkPickerOptions: linkPickerOptions,
|
|
112
98
|
providerFactory: providerFactory,
|
|
113
99
|
displayUrl: url,
|
|
114
|
-
displayText: text
|
|
115
|
-
handleEscapeKeydown: this.handleEsc
|
|
100
|
+
displayText: text
|
|
116
101
|
// Assumes that the smart card link picker can only ever be invoked by clicking "edit"
|
|
117
102
|
// via the floating toolbar
|
|
118
103
|
,
|
|
119
104
|
invokeMethod: INPUT_METHOD.FLOATING_TB,
|
|
120
105
|
featureFlags: featureFlags,
|
|
121
106
|
onSubmit: function onSubmit(href, title, displayText, inputMethod, analytic) {
|
|
122
|
-
|
|
107
|
+
_this.hideLinkToolbar();
|
|
123
108
|
if (_onSubmit) {
|
|
124
109
|
_onSubmit(href, displayText || title, inputMethod, analytic);
|
|
125
110
|
}
|
|
@@ -128,6 +113,7 @@ export var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
128
113
|
var tr = state.tr;
|
|
129
114
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.hyperlink.actions.hideLinkToolbar(tr);
|
|
130
115
|
_hideLinkToolbar(tr);
|
|
116
|
+
forceFocusSelector === null || forceFocusSelector === void 0 ? void 0 : forceFocusSelector("[aria-label=\"".concat(linkToolbarMessages.editLink.defaultMessage, "\"]"))(tr);
|
|
131
117
|
if (dispatch) {
|
|
132
118
|
dispatch(tr);
|
|
133
119
|
return true;
|
package/dist/esm/version.json
CHANGED
|
@@ -9,7 +9,6 @@ import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
9
9
|
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
10
10
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
11
|
import type { cardPlugin } from '../index';
|
|
12
|
-
import { DatasourceTableLayout } from '../ui/LayoutButton/types';
|
|
13
12
|
interface DatasourceProps extends ReactComponentProps {
|
|
14
13
|
node: PMNode;
|
|
15
14
|
view: EditorView;
|
|
@@ -36,7 +35,6 @@ export declare class Datasource extends ReactNodeView<DatasourceProps> {
|
|
|
36
35
|
private tableWidth;
|
|
37
36
|
constructor(props: DatasourceProps);
|
|
38
37
|
createDomRef(): HTMLElement;
|
|
39
|
-
calcTableWidth: (layout: DatasourceTableLayout, containerWidth?: number) => number | 'inherit';
|
|
40
38
|
render(): jsx.JSX.Element;
|
|
41
39
|
}
|
|
42
40
|
export {};
|
|
@@ -27,10 +27,6 @@ export declare function HyperlinkAddToolbarWithState({ linkPickerOptions, onSubm
|
|
|
27
27
|
export declare class EditLinkToolbar extends React.Component<EditLinkToolbarProps> {
|
|
28
28
|
componentDidUpdate(prevProps: EditLinkToolbarProps): void;
|
|
29
29
|
componentWillUnmount(): void;
|
|
30
|
-
/** Focus should move to the 'Edit link' button when the toolbar closes
|
|
31
|
-
* and not close the floating toolbar.
|
|
32
|
-
*/
|
|
33
|
-
private handleEsc;
|
|
34
30
|
private hideLinkToolbar;
|
|
35
31
|
render(): JSX.Element;
|
|
36
32
|
}
|
|
@@ -9,7 +9,6 @@ import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
9
9
|
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
10
10
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
11
|
import type { cardPlugin } from '../index';
|
|
12
|
-
import { DatasourceTableLayout } from '../ui/LayoutButton/types';
|
|
13
12
|
interface DatasourceProps extends ReactComponentProps {
|
|
14
13
|
node: PMNode;
|
|
15
14
|
view: EditorView;
|
|
@@ -36,7 +35,6 @@ export declare class Datasource extends ReactNodeView<DatasourceProps> {
|
|
|
36
35
|
private tableWidth;
|
|
37
36
|
constructor(props: DatasourceProps);
|
|
38
37
|
createDomRef(): HTMLElement;
|
|
39
|
-
calcTableWidth: (layout: DatasourceTableLayout, containerWidth?: number) => number | 'inherit';
|
|
40
38
|
render(): jsx.JSX.Element;
|
|
41
39
|
}
|
|
42
40
|
export {};
|
|
@@ -27,10 +27,6 @@ export declare function HyperlinkAddToolbarWithState({ linkPickerOptions, onSubm
|
|
|
27
27
|
export declare class EditLinkToolbar extends React.Component<EditLinkToolbarProps> {
|
|
28
28
|
componentDidUpdate(prevProps: EditLinkToolbarProps): void;
|
|
29
29
|
componentWillUnmount(): void;
|
|
30
|
-
/** Focus should move to the 'Edit link' button when the toolbar closes
|
|
31
|
-
* and not close the floating toolbar.
|
|
32
|
-
*/
|
|
33
|
-
private handleEsc;
|
|
34
30
|
private hideLinkToolbar;
|
|
35
31
|
render(): JSX.Element;
|
|
36
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^26.4.0",
|
|
35
35
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
|
-
"@atlaskit/editor-common": "^74.
|
|
36
|
+
"@atlaskit/editor-common": "^74.34.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^0.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-decorations": "^0.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-feature-flags": "^0.1.0",
|
|
40
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^0.
|
|
40
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^0.3.0",
|
|
41
41
|
"@atlaskit/editor-plugin-grid": "^0.1.0",
|
|
42
42
|
"@atlaskit/editor-plugin-hyperlink": "^0.2.0",
|
|
43
43
|
"@atlaskit/editor-plugin-width": "^0.1.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
50
50
|
"@atlaskit/smart-card": "^26.14.0",
|
|
51
51
|
"@atlaskit/theme": "^12.5.0",
|
|
52
|
-
"@atlaskit/tokens": "^1.
|
|
52
|
+
"@atlaskit/tokens": "^1.14.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"@emotion/react": "^11.7.1",
|
|
55
55
|
"lodash": "^4.17.21",
|