@atlaskit/editor-plugin-status 1.4.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @atlaskit/editor-plugin-status
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#117356](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117356)
8
+ [`9d772a51e5663`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9d772a51e5663) -
9
+ [ux] Fix inserting status from insert block dropdown.
10
+
11
+ Introduces new command on status plugin "insertStatus" which can be used by toolbars to insert a
12
+ status node.
13
+
14
+ Example:
15
+
16
+ ```ts
17
+ return pluginInjectionApi?.core?.actions.execute(
18
+ pluginInjectionApi?.status?.commands?.insertStatus(inputMethod),
19
+ );
20
+ ```
21
+
22
+ ## 2.0.0
23
+
24
+ ### Major Changes
25
+
26
+ - [`d9b562bd66f8e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d9b562bd66f8e) -
27
+ [ux] [ED-23947] restoring the original order of the typeahead menu so that actions, media,
28
+ mentions and emojis are above the fold (in the top 5 results). this change is a major because it
29
+ removes the `getEditorFeatureFlags prop` for plugins. if any consumers who have adopted these
30
+ changes to the public API, they should remove them on their side too.
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies
35
+
3
36
  ## 1.4.1
4
37
 
5
38
  ### Patch Changes
@@ -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.verifyAndInsertStatus = exports.updateStatusWithAnalytics = exports.updateStatus = exports.setStatusPickerAt = exports.setFocusOnStatusInput = exports.removeStatus = exports.createStatus = exports.commitStatusPicker = exports.DEFAULT_STATUS = void 0;
7
+ exports.verifyAndInsertStatus = exports.updateStatusWithAnalytics = exports.updateStatus = exports.setStatusPickerAt = exports.setFocusOnStatusInput = exports.removeStatus = exports.insertStatus = exports.createStatus = exports.commitStatusPicker = exports.DEFAULT_STATUS = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _analytics = require("@atlaskit/editor-common/analytics");
@@ -19,9 +19,8 @@ var DEFAULT_STATUS = exports.DEFAULT_STATUS = {
19
19
  text: '',
20
20
  color: 'neutral'
21
21
  };
22
- var verifyAndInsertStatus = exports.verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, state) {
23
- var fragment = _model.Fragment.fromArray([statusNode, state.schema.text(' ')]);
24
- var tr = state.tr;
22
+ var verifyAndInsertStatus = exports.verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr) {
23
+ var fragment = _model.Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ')]);
25
24
  var insertable = (0, _utils.canInsert)(tr.selection.$from, fragment);
26
25
  if (!insertable) {
27
26
  var parentSelection = _state.NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
@@ -34,11 +33,30 @@ var verifyAndInsertStatus = exports.verifyAndInsertStatus = function verifyAndIn
34
33
  isNew: true
35
34
  }).scrollIntoView();
36
35
  };
37
- var createStatus = exports.createStatus = function createStatus(state) {
38
- var statusNode = state.schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, DEFAULT_STATUS), {}, {
36
+ var createStatus = exports.createStatus = function createStatus(tr) {
37
+ var statusNode = tr.doc.type.schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, DEFAULT_STATUS), {}, {
39
38
  localId: _adfSchema.uuid.generate()
40
39
  }));
41
- return verifyAndInsertStatus(statusNode, state);
40
+ return verifyAndInsertStatus(statusNode, tr);
41
+ };
42
+ var insertStatus = exports.insertStatus = function insertStatus(editorAnalyticsAPI) {
43
+ return function () {
44
+ var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.TOOLBAR;
45
+ return function (_ref) {
46
+ var tr = _ref.tr;
47
+ var statusTr = createStatus(tr);
48
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
49
+ action: _analytics.ACTION.INSERTED,
50
+ actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
51
+ actionSubjectId: _analytics.ACTION_SUBJECT_ID.STATUS,
52
+ attributes: {
53
+ inputMethod: inputMethod
54
+ },
55
+ eventType: _analytics.EVENT_TYPE.TRACK
56
+ })(statusTr);
57
+ return statusTr;
58
+ };
59
+ };
42
60
  };
43
61
  var updateStatus = exports.updateStatus = function updateStatus(status) {
44
62
  return function (state, dispatch) {
@@ -49,12 +67,12 @@ var updateStatus = exports.updateStatus = function updateStatus(status) {
49
67
  }) : status;
50
68
  var statusProps = _objectSpread(_objectSpread({}, DEFAULT_STATUS), selectedStatus);
51
69
  var tr = state.tr;
52
- var _ref = _pluginKey.pluginKey.getState(state) || {},
53
- showStatusPickerAt = _ref.showStatusPickerAt;
70
+ var _ref2 = _pluginKey.pluginKey.getState(state) || {},
71
+ showStatusPickerAt = _ref2.showStatusPickerAt;
54
72
  if (!showStatusPickerAt) {
55
73
  // Same behaviour as quick insert (used in createStatus)
56
74
  var statusNode = schema.nodes.status.createChecked(statusProps);
57
- tr = verifyAndInsertStatus(statusNode, state);
75
+ tr = verifyAndInsertStatus(statusNode, state.tr);
58
76
  if (dispatch) {
59
77
  dispatch(tr);
60
78
  }
@@ -95,8 +113,8 @@ var setStatusPickerAt = exports.setStatusPickerAt = function setStatusPickerAt(s
95
113
  };
96
114
  };
97
115
  var removeStatus = exports.removeStatus = function removeStatus(showStatusPickerAt) {
98
- return function (_ref2) {
99
- var tr = _ref2.tr;
116
+ return function (_ref3) {
117
+ var tr = _ref3.tr;
100
118
  tr.replace(showStatusPickerAt, showStatusPickerAt + 1);
101
119
  return tr;
102
120
  };
@@ -126,10 +144,10 @@ var commitStatusPicker = exports.commitStatusPicker = function commitStatusPicke
126
144
  return function (editorView) {
127
145
  var state = editorView.state,
128
146
  dispatch = editorView.dispatch;
129
- var _ref3 = _pluginKey.pluginKey.getState(state) || {},
130
- showStatusPickerAt = _ref3.showStatusPickerAt;
131
- var _ref4 = closingPayload || {},
132
- closingMethod = _ref4.closingMethod;
147
+ var _ref4 = _pluginKey.pluginKey.getState(state) || {},
148
+ showStatusPickerAt = _ref4.showStatusPickerAt;
149
+ var _ref5 = closingPayload || {},
150
+ closingMethod = _ref5.closingMethod;
133
151
  if (!showStatusPickerAt) {
134
152
  return;
135
153
  }
@@ -16,7 +16,7 @@ var _plugin = _interopRequireDefault(require("./pm-plugins/plugin"));
16
16
  var _pluginKey = require("./pm-plugins/plugin-key");
17
17
  var _ContentComponent = require("./ui/ContentComponent");
18
18
  var baseStatusPlugin = function baseStatusPlugin(_ref) {
19
- var _api$analytics;
19
+ var _api$analytics, _api$analytics2;
20
20
  var options = _ref.config,
21
21
  api = _ref.api;
22
22
  return {
@@ -43,7 +43,8 @@ var baseStatusPlugin = function baseStatusPlugin(_ref) {
43
43
  updateStatus: (0, _actions.updateStatusWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
44
44
  },
45
45
  commands: {
46
- removeStatus: _actions.removeStatus
46
+ removeStatus: _actions.removeStatus,
47
+ insertStatus: (0, _actions.insertStatus)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
47
48
  },
48
49
  getSharedState: function getSharedState(state) {
49
50
  if (!state) {
@@ -79,30 +80,21 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
79
80
  }
80
81
  plugin.pluginsOptions = {
81
82
  quickInsert: function quickInsert(_ref3) {
82
- var _options$getEditorFea;
83
83
  var formatMessage = _ref3.formatMessage;
84
84
  return [{
85
85
  id: 'status',
86
86
  title: formatMessage(_messages.toolbarInsertBlockMessages.status),
87
87
  description: formatMessage(_messages.toolbarInsertBlockMessages.statusDescription),
88
- priority: options !== null && options !== void 0 && (_options$getEditorFea = options.getEditorFeatureFlags) !== null && _options$getEditorFea !== void 0 && _options$getEditorFea.call(options).platformEditorTypeaheadImprovedRelevancy ? 300 : 700,
88
+ priority: 700,
89
89
  keywords: ['lozenge'],
90
90
  icon: function icon() {
91
91
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconStatus, null);
92
92
  },
93
93
  action: function action(insert, state) {
94
- var _api$analytics2;
95
- var tr = (0, _actions.createStatus)(state);
96
- api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
97
- action: _analytics.ACTION.INSERTED,
98
- actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
99
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.STATUS,
100
- attributes: {
101
- inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
102
- },
103
- eventType: _analytics.EVENT_TYPE.TRACK
104
- })(tr);
105
- return tr;
94
+ var _insertStatus, _api$analytics3;
95
+ return (_insertStatus = (0, _actions.insertStatus)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(_analytics.INPUT_METHOD.QUICK_INSERT)({
96
+ tr: state.tr
97
+ })) !== null && _insertStatus !== void 0 ? _insertStatus : state.tr;
106
98
  }
107
99
  }];
108
100
  }
@@ -1,5 +1,5 @@
1
1
  import { uuid } from '@atlaskit/adf-schema';
2
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
4
4
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
5
5
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
@@ -9,9 +9,8 @@ export const DEFAULT_STATUS = {
9
9
  text: '',
10
10
  color: 'neutral'
11
11
  };
12
- export const verifyAndInsertStatus = (statusNode, state) => {
13
- const fragment = Fragment.fromArray([statusNode, state.schema.text(' ')]);
14
- const tr = state.tr;
12
+ export const verifyAndInsertStatus = (statusNode, tr) => {
13
+ const fragment = Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ')]);
15
14
  const insertable = canInsert(tr.selection.$from, fragment);
16
15
  if (!insertable) {
17
16
  const parentSelection = NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
@@ -24,12 +23,27 @@ export const verifyAndInsertStatus = (statusNode, state) => {
24
23
  isNew: true
25
24
  }).scrollIntoView();
26
25
  };
27
- export const createStatus = state => {
28
- const statusNode = state.schema.nodes.status.createChecked({
26
+ export const createStatus = tr => {
27
+ const statusNode = tr.doc.type.schema.nodes.status.createChecked({
29
28
  ...DEFAULT_STATUS,
30
29
  localId: uuid.generate()
31
30
  });
32
- return verifyAndInsertStatus(statusNode, state);
31
+ return verifyAndInsertStatus(statusNode, tr);
32
+ };
33
+ export const insertStatus = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.TOOLBAR) => ({
34
+ tr
35
+ }) => {
36
+ const statusTr = createStatus(tr);
37
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
38
+ action: ACTION.INSERTED,
39
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
40
+ actionSubjectId: ACTION_SUBJECT_ID.STATUS,
41
+ attributes: {
42
+ inputMethod
43
+ },
44
+ eventType: EVENT_TYPE.TRACK
45
+ })(statusTr);
46
+ return statusTr;
33
47
  };
34
48
  export const updateStatus = status => (state, dispatch) => {
35
49
  const {
@@ -50,7 +64,7 @@ export const updateStatus = status => (state, dispatch) => {
50
64
  if (!showStatusPickerAt) {
51
65
  // Same behaviour as quick insert (used in createStatus)
52
66
  const statusNode = schema.nodes.status.createChecked(statusProps);
53
- tr = verifyAndInsertStatus(statusNode, state);
67
+ tr = verifyAndInsertStatus(statusNode, state.tr);
54
68
  if (dispatch) {
55
69
  dispatch(tr);
56
70
  }
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { status } from '@atlaskit/adf-schema';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
5
  import { IconStatus } from '@atlaskit/editor-common/quick-insert';
6
- import { commitStatusPicker, createStatus, removeStatus, updateStatusWithAnalytics } from './actions';
6
+ import { commitStatusPicker, insertStatus, removeStatus, updateStatusWithAnalytics } from './actions';
7
7
  import { keymapPlugin } from './pm-plugins/keymap';
8
8
  import createStatusPlugin from './pm-plugins/plugin';
9
9
  import { pluginKey } from './pm-plugins/plugin-key';
@@ -12,7 +12,7 @@ const baseStatusPlugin = ({
12
12
  config: options,
13
13
  api
14
14
  }) => {
15
- var _api$analytics;
15
+ var _api$analytics, _api$analytics2;
16
16
  return {
17
17
  name: 'status',
18
18
  nodes() {
@@ -35,7 +35,8 @@ const baseStatusPlugin = ({
35
35
  updateStatus: updateStatusWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
36
36
  },
37
37
  commands: {
38
- removeStatus
38
+ removeStatus,
39
+ insertStatus: insertStatus(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
39
40
  },
40
41
  getSharedState(state) {
41
42
  if (!state) {
@@ -73,31 +74,20 @@ const decorateWithPluginOptions = (plugin, options, api) => {
73
74
  plugin.pluginsOptions = {
74
75
  quickInsert: ({
75
76
  formatMessage
76
- }) => {
77
- var _options$getEditorFea;
78
- return [{
79
- id: 'status',
80
- title: formatMessage(messages.status),
81
- description: formatMessage(messages.statusDescription),
82
- priority: options !== null && options !== void 0 && (_options$getEditorFea = options.getEditorFeatureFlags) !== null && _options$getEditorFea !== void 0 && _options$getEditorFea.call(options).platformEditorTypeaheadImprovedRelevancy ? 300 : 700,
83
- keywords: ['lozenge'],
84
- icon: () => /*#__PURE__*/React.createElement(IconStatus, null),
85
- action(insert, state) {
86
- var _api$analytics2;
87
- const tr = createStatus(state);
88
- api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
89
- action: ACTION.INSERTED,
90
- actionSubject: ACTION_SUBJECT.DOCUMENT,
91
- actionSubjectId: ACTION_SUBJECT_ID.STATUS,
92
- attributes: {
93
- inputMethod: INPUT_METHOD.QUICK_INSERT
94
- },
95
- eventType: EVENT_TYPE.TRACK
96
- })(tr);
97
- return tr;
98
- }
99
- }];
100
- }
77
+ }) => [{
78
+ id: 'status',
79
+ title: formatMessage(messages.status),
80
+ description: formatMessage(messages.statusDescription),
81
+ priority: 700,
82
+ keywords: ['lozenge'],
83
+ icon: () => /*#__PURE__*/React.createElement(IconStatus, null),
84
+ action(insert, state) {
85
+ var _insertStatus, _api$analytics3;
86
+ return (_insertStatus = insertStatus(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(INPUT_METHOD.QUICK_INSERT)({
87
+ tr: state.tr
88
+ })) !== null && _insertStatus !== void 0 ? _insertStatus : state.tr;
89
+ }
90
+ }]
101
91
  };
102
92
  return plugin;
103
93
  };
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { uuid } from '@atlaskit/adf-schema';
5
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
5
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
6
  import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
7
7
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
8
8
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
@@ -12,9 +12,8 @@ export var DEFAULT_STATUS = {
12
12
  text: '',
13
13
  color: 'neutral'
14
14
  };
15
- export var verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, state) {
16
- var fragment = Fragment.fromArray([statusNode, state.schema.text(' ')]);
17
- var tr = state.tr;
15
+ export var verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, tr) {
16
+ var fragment = Fragment.fromArray([statusNode, tr.doc.type.schema.text(' ')]);
18
17
  var insertable = canInsert(tr.selection.$from, fragment);
19
18
  if (!insertable) {
20
19
  var parentSelection = NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
@@ -27,11 +26,30 @@ export var verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, st
27
26
  isNew: true
28
27
  }).scrollIntoView();
29
28
  };
30
- export var createStatus = function createStatus(state) {
31
- var statusNode = state.schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, DEFAULT_STATUS), {}, {
29
+ export var createStatus = function createStatus(tr) {
30
+ var statusNode = tr.doc.type.schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, DEFAULT_STATUS), {}, {
32
31
  localId: uuid.generate()
33
32
  }));
34
- return verifyAndInsertStatus(statusNode, state);
33
+ return verifyAndInsertStatus(statusNode, tr);
34
+ };
35
+ export var insertStatus = function insertStatus(editorAnalyticsAPI) {
36
+ return function () {
37
+ var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.TOOLBAR;
38
+ return function (_ref) {
39
+ var tr = _ref.tr;
40
+ var statusTr = createStatus(tr);
41
+ editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
42
+ action: ACTION.INSERTED,
43
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
44
+ actionSubjectId: ACTION_SUBJECT_ID.STATUS,
45
+ attributes: {
46
+ inputMethod: inputMethod
47
+ },
48
+ eventType: EVENT_TYPE.TRACK
49
+ })(statusTr);
50
+ return statusTr;
51
+ };
52
+ };
35
53
  };
36
54
  export var updateStatus = function updateStatus(status) {
37
55
  return function (state, dispatch) {
@@ -42,12 +60,12 @@ export var updateStatus = function updateStatus(status) {
42
60
  }) : status;
43
61
  var statusProps = _objectSpread(_objectSpread({}, DEFAULT_STATUS), selectedStatus);
44
62
  var tr = state.tr;
45
- var _ref = pluginKey.getState(state) || {},
46
- showStatusPickerAt = _ref.showStatusPickerAt;
63
+ var _ref2 = pluginKey.getState(state) || {},
64
+ showStatusPickerAt = _ref2.showStatusPickerAt;
47
65
  if (!showStatusPickerAt) {
48
66
  // Same behaviour as quick insert (used in createStatus)
49
67
  var statusNode = schema.nodes.status.createChecked(statusProps);
50
- tr = verifyAndInsertStatus(statusNode, state);
68
+ tr = verifyAndInsertStatus(statusNode, state.tr);
51
69
  if (dispatch) {
52
70
  dispatch(tr);
53
71
  }
@@ -88,8 +106,8 @@ export var setStatusPickerAt = function setStatusPickerAt(showStatusPickerAt) {
88
106
  };
89
107
  };
90
108
  export var removeStatus = function removeStatus(showStatusPickerAt) {
91
- return function (_ref2) {
92
- var tr = _ref2.tr;
109
+ return function (_ref3) {
110
+ var tr = _ref3.tr;
93
111
  tr.replace(showStatusPickerAt, showStatusPickerAt + 1);
94
112
  return tr;
95
113
  };
@@ -119,10 +137,10 @@ export var commitStatusPicker = function commitStatusPicker(closingPayload) {
119
137
  return function (editorView) {
120
138
  var state = editorView.state,
121
139
  dispatch = editorView.dispatch;
122
- var _ref3 = pluginKey.getState(state) || {},
123
- showStatusPickerAt = _ref3.showStatusPickerAt;
124
- var _ref4 = closingPayload || {},
125
- closingMethod = _ref4.closingMethod;
140
+ var _ref4 = pluginKey.getState(state) || {},
141
+ showStatusPickerAt = _ref4.showStatusPickerAt;
142
+ var _ref5 = closingPayload || {},
143
+ closingMethod = _ref5.closingMethod;
126
144
  if (!showStatusPickerAt) {
127
145
  return;
128
146
  }
@@ -1,15 +1,15 @@
1
1
  import React from 'react';
2
2
  import { status } from '@atlaskit/adf-schema';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
5
  import { IconStatus } from '@atlaskit/editor-common/quick-insert';
6
- import { commitStatusPicker, createStatus, removeStatus, updateStatusWithAnalytics } from './actions';
6
+ import { commitStatusPicker, insertStatus, removeStatus, updateStatusWithAnalytics } from './actions';
7
7
  import { keymapPlugin } from './pm-plugins/keymap';
8
8
  import createStatusPlugin from './pm-plugins/plugin';
9
9
  import { pluginKey } from './pm-plugins/plugin-key';
10
10
  import { ContentComponent } from './ui/ContentComponent';
11
11
  var baseStatusPlugin = function baseStatusPlugin(_ref) {
12
- var _api$analytics;
12
+ var _api$analytics, _api$analytics2;
13
13
  var options = _ref.config,
14
14
  api = _ref.api;
15
15
  return {
@@ -36,7 +36,8 @@ var baseStatusPlugin = function baseStatusPlugin(_ref) {
36
36
  updateStatus: updateStatusWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
37
37
  },
38
38
  commands: {
39
- removeStatus: removeStatus
39
+ removeStatus: removeStatus,
40
+ insertStatus: insertStatus(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
40
41
  },
41
42
  getSharedState: function getSharedState(state) {
42
43
  if (!state) {
@@ -72,30 +73,21 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
72
73
  }
73
74
  plugin.pluginsOptions = {
74
75
  quickInsert: function quickInsert(_ref3) {
75
- var _options$getEditorFea;
76
76
  var formatMessage = _ref3.formatMessage;
77
77
  return [{
78
78
  id: 'status',
79
79
  title: formatMessage(messages.status),
80
80
  description: formatMessage(messages.statusDescription),
81
- priority: options !== null && options !== void 0 && (_options$getEditorFea = options.getEditorFeatureFlags) !== null && _options$getEditorFea !== void 0 && _options$getEditorFea.call(options).platformEditorTypeaheadImprovedRelevancy ? 300 : 700,
81
+ priority: 700,
82
82
  keywords: ['lozenge'],
83
83
  icon: function icon() {
84
84
  return /*#__PURE__*/React.createElement(IconStatus, null);
85
85
  },
86
86
  action: function action(insert, state) {
87
- var _api$analytics2;
88
- var tr = createStatus(state);
89
- api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
90
- action: ACTION.INSERTED,
91
- actionSubject: ACTION_SUBJECT.DOCUMENT,
92
- actionSubjectId: ACTION_SUBJECT_ID.STATUS,
93
- attributes: {
94
- inputMethod: INPUT_METHOD.QUICK_INSERT
95
- },
96
- eventType: EVENT_TYPE.TRACK
97
- })(tr);
98
- return tr;
87
+ var _insertStatus, _api$analytics3;
88
+ return (_insertStatus = insertStatus(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(INPUT_METHOD.QUICK_INSERT)({
89
+ tr: state.tr
90
+ })) !== null && _insertStatus !== void 0 ? _insertStatus : state.tr;
99
91
  }
100
92
  }];
101
93
  }
@@ -1,12 +1,14 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
3
  import type { Command, CommandDispatch, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
3
4
  import type { Node } from '@atlaskit/editor-prosemirror/model';
4
5
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
7
  import type { ClosingPayload, StatusType } from './types';
7
8
  export declare const DEFAULT_STATUS: StatusType;
8
- export declare const verifyAndInsertStatus: (statusNode: Node, state: EditorState) => Transaction;
9
- export declare const createStatus: (state: EditorState) => Transaction;
9
+ export declare const verifyAndInsertStatus: (statusNode: Node, tr: Transaction) => Transaction;
10
+ export declare const createStatus: (tr: Transaction) => Transaction;
11
+ export declare const insertStatus: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR) => EditorCommand;
10
12
  export declare const updateStatus: (status?: StatusType) => Command;
11
13
  export type UpdateStatus = (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
12
14
  export declare const updateStatusWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
@@ -1,7 +1,7 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { UpdateStatus } from './actions';
4
- import { commitStatusPicker, removeStatus } from './actions';
4
+ import { commitStatusPicker, insertStatus, removeStatus } from './actions';
5
5
  import type { StatusPluginOptions, StatusState } from './types';
6
6
  export type StatusPlugin = NextEditorPlugin<'status', {
7
7
  dependencies: [OptionalPlugin<AnalyticsPlugin>];
@@ -12,6 +12,7 @@ export type StatusPlugin = NextEditorPlugin<'status', {
12
12
  };
13
13
  commands: {
14
14
  removeStatus: typeof removeStatus;
15
+ insertStatus: ReturnType<typeof insertStatus>;
15
16
  };
16
17
  sharedState: StatusState | undefined;
17
18
  }>;
@@ -1,4 +1,3 @@
1
- import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
2
1
  import type { Color as ColorType } from '@atlaskit/status/element';
3
2
  import type { closingMethods } from './ui/statusPicker';
4
3
  export type StatusType = {
@@ -14,7 +13,6 @@ export type StatusState = {
14
13
  export interface StatusPluginOptions {
15
14
  menuDisabled: boolean;
16
15
  allowZeroWidthSpaceAfter?: boolean;
17
- getEditorFeatureFlags?: GetEditorFeatureFlags;
18
16
  }
19
17
  export type ClosingPayload = {
20
18
  closingMethod: closingMethods;
@@ -1,12 +1,14 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
3
  import type { Command, CommandDispatch, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
3
4
  import type { Node } from '@atlaskit/editor-prosemirror/model';
4
5
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
7
  import type { ClosingPayload, StatusType } from './types';
7
8
  export declare const DEFAULT_STATUS: StatusType;
8
- export declare const verifyAndInsertStatus: (statusNode: Node, state: EditorState) => Transaction;
9
- export declare const createStatus: (state: EditorState) => Transaction;
9
+ export declare const verifyAndInsertStatus: (statusNode: Node, tr: Transaction) => Transaction;
10
+ export declare const createStatus: (tr: Transaction) => Transaction;
11
+ export declare const insertStatus: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: INPUT_METHOD.INSERT_MENU | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR) => EditorCommand;
10
12
  export declare const updateStatus: (status?: StatusType) => Command;
11
13
  export type UpdateStatus = (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
12
14
  export declare const updateStatusWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
@@ -1,7 +1,7 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { UpdateStatus } from './actions';
4
- import { commitStatusPicker, removeStatus } from './actions';
4
+ import { commitStatusPicker, insertStatus, removeStatus } from './actions';
5
5
  import type { StatusPluginOptions, StatusState } from './types';
6
6
  export type StatusPlugin = NextEditorPlugin<'status', {
7
7
  dependencies: [
@@ -14,6 +14,7 @@ export type StatusPlugin = NextEditorPlugin<'status', {
14
14
  };
15
15
  commands: {
16
16
  removeStatus: typeof removeStatus;
17
+ insertStatus: ReturnType<typeof insertStatus>;
17
18
  };
18
19
  sharedState: StatusState | undefined;
19
20
  }>;
@@ -1,4 +1,3 @@
1
- import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
2
1
  import type { Color as ColorType } from '@atlaskit/status/element';
3
2
  import type { closingMethods } from './ui/statusPicker';
4
3
  export type StatusType = {
@@ -14,7 +13,6 @@ export type StatusState = {
14
13
  export interface StatusPluginOptions {
15
14
  menuDisabled: boolean;
16
15
  allowZeroWidthSpaceAfter?: boolean;
17
- getEditorFeatureFlags?: GetEditorFeatureFlags;
18
16
  }
19
17
  export type ClosingPayload = {
20
18
  closingMethod: closingMethods;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-status",
3
- "version": "1.4.1",
3
+ "version": "2.1.0",
4
4
  "description": "Status plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -8,7 +8,7 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
- "team": "Editor: Scarlet",
11
+ "team": "Editor: Core Experiences",
12
12
  "singleton": true,
13
13
  "inPublicMirror": false,
14
14
  "releaseModel": "continuous",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^39.0.3",
37
37
  "@atlaskit/analytics-next": "^9.3.0",
38
- "@atlaskit/editor-common": "^83.5.0",
38
+ "@atlaskit/editor-common": "^84.0.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
40
40
  "@atlaskit/editor-prosemirror": "4.0.1",
41
41
  "@atlaskit/editor-shared-styles": "^2.12.0",