@atlaskit/editor-plugin-card 0.3.6 → 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 CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## 0.3.6
4
11
 
5
12
  ### Patch Changes
@@ -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
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
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 _this2 = this;
108
- var _this$props2 = this.props,
109
- linkPickerOptions = _this$props2.linkPickerOptions,
110
- providerFactory = _this$props2.providerFactory,
111
- url = _this$props2.url,
112
- text = _this$props2.text,
113
- view = _this$props2.view,
114
- featureFlags = _this$props2.featureFlags,
115
- _onSubmit = _this$props2.onSubmit,
116
- pluginInjectionApi = _this$props2.pluginInjectionApi;
117
- return /*#__PURE__*/_react.default.createElement(HyperLinkToolbarWithListeners, {
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
- _this2.hideLinkToolbar();
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;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -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, withOuterListeners } from '@atlaskit/editor-common/ui';
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(HyperLinkToolbarWithListeners, {
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;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -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, withOuterListeners } from '@atlaskit/editor-common/ui';
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
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
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 _this2 = this;
99
- var _this$props2 = this.props,
100
- linkPickerOptions = _this$props2.linkPickerOptions,
101
- providerFactory = _this$props2.providerFactory,
102
- url = _this$props2.url,
103
- text = _this$props2.text,
104
- view = _this$props2.view,
105
- featureFlags = _this$props2.featureFlags,
106
- _onSubmit = _this$props2.onSubmit,
107
- pluginInjectionApi = _this$props2.pluginInjectionApi;
108
- return /*#__PURE__*/React.createElement(HyperLinkToolbarWithListeners, {
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
- _this2.hideLinkToolbar();
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;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -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
  }
@@ -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.6",
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",
@@ -37,7 +37,7 @@
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.2.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",