@atlaskit/editor-plugin-tasks-and-decisions 9.1.16 → 9.1.18

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,21 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 9.1.18
4
+
5
+ ### Patch Changes
6
+
7
+ - [`55920a92e882a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55920a92e882a) -
8
+ tsignores added for help-center local consumpton removed
9
+ - Updated dependencies
10
+
11
+ ## 9.1.17
12
+
13
+ ### Patch Changes
14
+
15
+ - [`bd911d5eca1cb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd911d5eca1cb) -
16
+ Use new transfromNode command in existing block menu items. Update transformNode analytics type.
17
+ - Updated dependencies
18
+
3
19
  ## 9.1.16
4
20
 
5
21
  ### Patch Changes
@@ -31,9 +31,6 @@ function nodesBetweenChanged(tr, f, startPos) {
31
31
  if (!stepRange) {
32
32
  return;
33
33
  }
34
-
35
- // @ts-ignore - Workaround for help-center local consumption
36
-
37
34
  tr.doc.nodesBetween(stepRange.from, stepRange.to, f, startPos);
38
35
  }
39
36
 
@@ -46,8 +43,6 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
46
43
  var taskPlaceholder = arguments.length > 9 ? arguments[9] : undefined;
47
44
  return new _safePlugin.SafePlugin({
48
45
  props: {
49
- // @ts-ignore - Workaround for help-center local consumption
50
-
51
46
  nodeViews: _objectSpread({
52
47
  taskItem: (0, _taskNodeView.taskView)(api, getIntl(), taskPlaceholder),
53
48
  decisionItem: function (node) {
@@ -56,7 +51,6 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
56
51
  }, (0, _expValEquals.expValEquals)('platform_editor_blocktaskitem_node_tenantid', 'isEnabled', true) ? {
57
52
  blockTaskItem: (0, _taskNodeView.taskView)(api, getIntl(), taskPlaceholder)
58
53
  } : {}),
59
- // @ts-ignore - Workaround for help-center local consumption
60
54
  decorations: function decorations(state) {
61
55
  var pluginState = _pluginKey.stateKey.getState(state);
62
56
  if (pluginState !== null && pluginState !== void 0 && pluginState.decorations) {
@@ -64,7 +58,6 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
64
58
  }
65
59
  return _view.DecorationSet.empty;
66
60
  },
67
- // @ts-ignore - Workaround for help-center local consumption
68
61
  handleTextInput: function handleTextInput(view, from, to, text) {
69
62
  // When a decision item is selected and the user starts typing, the entire node
70
63
  // should be replaced with what was just typed. This custom text input handler
@@ -88,15 +81,11 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
88
81
  }, {
89
82
  useLongPressSelection: useLongPressSelection
90
83
  }),
91
- // @ts-ignore - Workaround for help-center local consumption
92
-
93
84
  handleDOMEvents: {
94
85
  // When the page is lazy loaded and task item is not yet available this allows
95
86
  // our toDOM implementation to toggle the node state
96
87
  change: _taskItemOnChange.taskItemOnChange
97
88
  },
98
- // @ts-ignore - Workaround for help-center local consumption
99
-
100
89
  handleKeyDown: function handleKeyDown(view, event) {
101
90
  var state = view.state;
102
91
  var selection = state.selection,
@@ -189,8 +178,6 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
189
178
  }
190
179
  }
191
180
  },
192
- // @ts-ignore - Workaround for help-center local consumption
193
-
194
181
  transformPasted: function transformPasted(slice, view) {
195
182
  var _view$state;
196
183
  if (Boolean(view === null || view === void 0 || (_view$state = view.state) === null || _view$state === void 0 || (_view$state = _view$state.schema) === null || _view$state === void 0 || (_view$state = _view$state.nodes) === null || _view$state === void 0 ? void 0 : _view$state.blockTaskItem)) {
@@ -200,7 +187,6 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
200
187
  }
201
188
  },
202
189
  state: {
203
- // @ts-ignore - Workaround for help-center local consumption
204
190
  init: function init() {
205
191
  return {
206
192
  insideTaskDecisionItem: false,
@@ -212,7 +198,6 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
212
198
  decorations: _view.DecorationSet.empty
213
199
  };
214
200
  },
215
- // @ts-ignore - Workaround for help-center local consumption
216
201
  apply: function apply(tr, pluginState) {
217
202
  var metaData = tr.getMeta(_pluginKey.stateKey);
218
203
  var _ref = metaData !== null && metaData !== void 0 ? metaData : {
@@ -264,8 +249,6 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
264
249
  })]);
265
250
  } else {
266
251
  var _newPluginState$decor;
267
- // @ts-ignore - Workaround for help-center local consumption
268
-
269
252
  decorations = (_newPluginState$decor = newPluginState.decorations) === null || _newPluginState$decor === void 0 ? void 0 : _newPluginState$decor.map(tr.mapping, tr.doc);
270
253
  }
271
254
  var newState = _objectSpread(_objectSpread({}, newPluginState), {}, {
@@ -284,13 +267,9 @@ function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl
284
267
  *
285
268
  * Note: we currently do not handle the edge case where two nodes may have the same localId
286
269
  */
287
- // @ts-ignore - Workaround for help-center local consumption
288
-
289
270
  appendTransaction: function appendTransaction(transactions, _oldState, newState) {
290
271
  var tr = newState.tr;
291
272
  var modified = false;
292
- // @ts-ignore - Workaround for help-center local consumption
293
-
294
273
  transactions.forEach(function (transaction) {
295
274
  if (!transaction.docChanged) {
296
275
  return;
@@ -23,13 +23,20 @@ var TaskListBlockMenuItem = exports.TaskListBlockMenuItem = function TaskListBlo
23
23
  return selection && selection.$from.parent.type.name === 'taskItem';
24
24
  }, [selection]);
25
25
  var onClick = function onClick(event) {
26
- var _api$blockMenu;
27
26
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
28
27
  var inputMethod = _analytics.INPUT_METHOD.BLOCK_MENU;
29
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode('taskList', {
30
- inputMethod: inputMethod,
31
- triggeredFrom: triggeredFrom
32
- }));
28
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
29
+ var _api$blockMenu;
30
+ var tr = _ref2.tr;
31
+ var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.taskList, {
32
+ inputMethod: inputMethod,
33
+ triggeredFrom: triggeredFrom,
34
+ targetTypeName: 'taskList'
35
+ });
36
+ return command ? command({
37
+ tr: tr
38
+ }) : null;
39
+ });
33
40
  };
34
41
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
35
42
  isSelected: isSelected,
@@ -19,9 +19,6 @@ function nodesBetweenChanged(tr, f, startPos) {
19
19
  if (!stepRange) {
20
20
  return;
21
21
  }
22
-
23
- // @ts-ignore - Workaround for help-center local consumption
24
-
25
22
  tr.doc.nodesBetween(stepRange.from, stepRange.to, f, startPos);
26
23
  }
27
24
 
@@ -29,8 +26,6 @@ function nodesBetweenChanged(tr, f, startPos) {
29
26
  export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl, useLongPressSelection = false, hasEditPermission, hasRequestedEditPermission, requestToEditContent, taskPlaceholder) {
30
27
  return new SafePlugin({
31
28
  props: {
32
- // @ts-ignore - Workaround for help-center local consumption
33
-
34
29
  nodeViews: {
35
30
  taskItem: taskView(api, getIntl(), taskPlaceholder),
36
31
  decisionItem: node => {
@@ -40,8 +35,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
40
35
  blockTaskItem: taskView(api, getIntl(), taskPlaceholder)
41
36
  } : {})
42
37
  },
43
- // @ts-ignore - Workaround for help-center local consumption
44
-
45
38
  decorations(state) {
46
39
  const pluginState = stateKey.getState(state);
47
40
  if (pluginState !== null && pluginState !== void 0 && pluginState.decorations) {
@@ -49,8 +42,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
49
42
  }
50
43
  return DecorationSet.empty;
51
44
  },
52
- // @ts-ignore - Workaround for help-center local consumption
53
-
54
45
  handleTextInput(view, from, to, text) {
55
46
  // When a decision item is selected and the user starts typing, the entire node
56
47
  // should be replaced with what was just typed. This custom text input handler
@@ -76,15 +67,11 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
76
67
  handleClickOn: createSelectionClickHandler(['decisionItem', 'taskItem'], target => target.hasAttribute('data-decision-wrapper') || target.getAttribute('aria-label') === 'Decision', {
77
68
  useLongPressSelection
78
69
  }),
79
- // @ts-ignore - Workaround for help-center local consumption
80
-
81
70
  handleDOMEvents: {
82
71
  // When the page is lazy loaded and task item is not yet available this allows
83
72
  // our toDOM implementation to toggle the node state
84
73
  change: taskItemOnChange
85
74
  },
86
- // @ts-ignore - Workaround for help-center local consumption
87
-
88
75
  handleKeyDown: (view, event) => {
89
76
  const {
90
77
  state
@@ -183,8 +170,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
183
170
  }
184
171
  }
185
172
  },
186
- // @ts-ignore - Workaround for help-center local consumption
187
-
188
173
  transformPasted: (slice, view) => {
189
174
  var _view$state, _view$state$schema, _view$state$schema$no;
190
175
  if (Boolean(view === null || view === void 0 ? void 0 : (_view$state = view.state) === null || _view$state === void 0 ? void 0 : (_view$state$schema = _view$state.schema) === null || _view$state$schema === void 0 ? void 0 : (_view$state$schema$no = _view$state$schema.nodes) === null || _view$state$schema$no === void 0 ? void 0 : _view$state$schema$no.blockTaskItem)) {
@@ -194,8 +179,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
194
179
  }
195
180
  },
196
181
  state: {
197
- // @ts-ignore - Workaround for help-center local consumption
198
-
199
182
  init() {
200
183
  return {
201
184
  insideTaskDecisionItem: false,
@@ -207,8 +190,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
207
190
  decorations: DecorationSet.empty
208
191
  };
209
192
  },
210
- // @ts-ignore - Workaround for help-center local consumption
211
-
212
193
  apply(tr, pluginState) {
213
194
  const metaData = tr.getMeta(stateKey);
214
195
  const {
@@ -263,8 +244,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
263
244
  })]);
264
245
  } else {
265
246
  var _newPluginState$decor;
266
- // @ts-ignore - Workaround for help-center local consumption
267
-
268
247
  decorations = (_newPluginState$decor = newPluginState.decorations) === null || _newPluginState$decor === void 0 ? void 0 : _newPluginState$decor.map(tr.mapping, tr.doc);
269
248
  }
270
249
  const newState = {
@@ -284,13 +263,9 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
284
263
  *
285
264
  * Note: we currently do not handle the edge case where two nodes may have the same localId
286
265
  */
287
- // @ts-ignore - Workaround for help-center local consumption
288
-
289
266
  appendTransaction: (transactions, _oldState, newState) => {
290
267
  const tr = newState.tr;
291
268
  let modified = false;
292
- // @ts-ignore - Workaround for help-center local consumption
293
-
294
269
  transactions.forEach(transaction => {
295
270
  if (!transaction.docChanged) {
296
271
  return;
@@ -16,13 +16,21 @@ export const TaskListBlockMenuItem = ({
16
16
  return selection && selection.$from.parent.type.name === 'taskItem';
17
17
  }, [selection]);
18
18
  const onClick = event => {
19
- var _api$blockMenu;
20
19
  const triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
21
20
  const inputMethod = INPUT_METHOD.BLOCK_MENU;
22
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode('taskList', {
23
- inputMethod,
24
- triggeredFrom
25
- }));
21
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(({
22
+ tr
23
+ }) => {
24
+ var _api$blockMenu;
25
+ const command = api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.taskList, {
26
+ inputMethod,
27
+ triggeredFrom,
28
+ targetTypeName: 'taskList'
29
+ });
30
+ return command ? command({
31
+ tr
32
+ }) : null;
33
+ });
26
34
  };
27
35
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
28
36
  isSelected: isSelected,
@@ -24,9 +24,6 @@ function nodesBetweenChanged(tr, f, startPos) {
24
24
  if (!stepRange) {
25
25
  return;
26
26
  }
27
-
28
- // @ts-ignore - Workaround for help-center local consumption
29
-
30
27
  tr.doc.nodesBetween(stepRange.from, stepRange.to, f, startPos);
31
28
  }
32
29
 
@@ -39,8 +36,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
39
36
  var taskPlaceholder = arguments.length > 9 ? arguments[9] : undefined;
40
37
  return new SafePlugin({
41
38
  props: {
42
- // @ts-ignore - Workaround for help-center local consumption
43
-
44
39
  nodeViews: _objectSpread({
45
40
  taskItem: taskView(api, getIntl(), taskPlaceholder),
46
41
  decisionItem: function (node) {
@@ -49,7 +44,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
49
44
  }, expValEquals('platform_editor_blocktaskitem_node_tenantid', 'isEnabled', true) ? {
50
45
  blockTaskItem: taskView(api, getIntl(), taskPlaceholder)
51
46
  } : {}),
52
- // @ts-ignore - Workaround for help-center local consumption
53
47
  decorations: function decorations(state) {
54
48
  var pluginState = stateKey.getState(state);
55
49
  if (pluginState !== null && pluginState !== void 0 && pluginState.decorations) {
@@ -57,7 +51,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
57
51
  }
58
52
  return DecorationSet.empty;
59
53
  },
60
- // @ts-ignore - Workaround for help-center local consumption
61
54
  handleTextInput: function handleTextInput(view, from, to, text) {
62
55
  // When a decision item is selected and the user starts typing, the entire node
63
56
  // should be replaced with what was just typed. This custom text input handler
@@ -81,15 +74,11 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
81
74
  }, {
82
75
  useLongPressSelection: useLongPressSelection
83
76
  }),
84
- // @ts-ignore - Workaround for help-center local consumption
85
-
86
77
  handleDOMEvents: {
87
78
  // When the page is lazy loaded and task item is not yet available this allows
88
79
  // our toDOM implementation to toggle the node state
89
80
  change: taskItemOnChange
90
81
  },
91
- // @ts-ignore - Workaround for help-center local consumption
92
-
93
82
  handleKeyDown: function handleKeyDown(view, event) {
94
83
  var state = view.state;
95
84
  var selection = state.selection,
@@ -182,8 +171,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
182
171
  }
183
172
  }
184
173
  },
185
- // @ts-ignore - Workaround for help-center local consumption
186
-
187
174
  transformPasted: function transformPasted(slice, view) {
188
175
  var _view$state;
189
176
  if (Boolean(view === null || view === void 0 || (_view$state = view.state) === null || _view$state === void 0 || (_view$state = _view$state.schema) === null || _view$state === void 0 || (_view$state = _view$state.nodes) === null || _view$state === void 0 ? void 0 : _view$state.blockTaskItem)) {
@@ -193,7 +180,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
193
180
  }
194
181
  },
195
182
  state: {
196
- // @ts-ignore - Workaround for help-center local consumption
197
183
  init: function init() {
198
184
  return {
199
185
  insideTaskDecisionItem: false,
@@ -205,7 +191,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
205
191
  decorations: DecorationSet.empty
206
192
  };
207
193
  },
208
- // @ts-ignore - Workaround for help-center local consumption
209
194
  apply: function apply(tr, pluginState) {
210
195
  var metaData = tr.getMeta(stateKey);
211
196
  var _ref = metaData !== null && metaData !== void 0 ? metaData : {
@@ -257,8 +242,6 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
257
242
  })]);
258
243
  } else {
259
244
  var _newPluginState$decor;
260
- // @ts-ignore - Workaround for help-center local consumption
261
-
262
245
  decorations = (_newPluginState$decor = newPluginState.decorations) === null || _newPluginState$decor === void 0 ? void 0 : _newPluginState$decor.map(tr.mapping, tr.doc);
263
246
  }
264
247
  var newState = _objectSpread(_objectSpread({}, newPluginState), {}, {
@@ -277,13 +260,9 @@ export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api,
277
260
  *
278
261
  * Note: we currently do not handle the edge case where two nodes may have the same localId
279
262
  */
280
- // @ts-ignore - Workaround for help-center local consumption
281
-
282
263
  appendTransaction: function appendTransaction(transactions, _oldState, newState) {
283
264
  var tr = newState.tr;
284
265
  var modified = false;
285
- // @ts-ignore - Workaround for help-center local consumption
286
-
287
266
  transactions.forEach(function (transaction) {
288
267
  if (!transaction.docChanged) {
289
268
  return;
@@ -14,13 +14,20 @@ export var TaskListBlockMenuItem = function TaskListBlockMenuItem(_ref) {
14
14
  return selection && selection.$from.parent.type.name === 'taskItem';
15
15
  }, [selection]);
16
16
  var onClick = function onClick(event) {
17
- var _api$blockMenu;
18
17
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
19
18
  var inputMethod = INPUT_METHOD.BLOCK_MENU;
20
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode('taskList', {
21
- inputMethod: inputMethod,
22
- triggeredFrom: triggeredFrom
23
- }));
19
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
20
+ var _api$blockMenu;
21
+ var tr = _ref2.tr;
22
+ var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.taskList, {
23
+ inputMethod: inputMethod,
24
+ triggeredFrom: triggeredFrom,
25
+ targetTypeName: 'taskList'
26
+ });
27
+ return command ? command({
28
+ tr: tr
29
+ }) : null;
30
+ });
24
31
  };
25
32
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
26
33
  isSelected: isSelected,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "9.1.16",
3
+ "version": "9.1.18",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  "@atlaskit/analytics-namespaced-context": "^7.2.0",
34
34
  "@atlaskit/css": "^0.17.0",
35
35
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
36
- "@atlaskit/editor-plugin-block-menu": "^5.0.0",
36
+ "@atlaskit/editor-plugin-block-menu": "^5.1.0",
37
37
  "@atlaskit/editor-plugin-context-identifier": "^6.0.0",
38
38
  "@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
39
39
  "@atlaskit/editor-plugin-selection": "^6.1.0",
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/primitives": "^16.4.0",
50
50
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
51
51
  "@atlaskit/task-decision": "^19.2.0",
52
- "@atlaskit/tmp-editor-statsig": "^14.1.0",
52
+ "@atlaskit/tmp-editor-statsig": "^14.2.0",
53
53
  "@atlaskit/tokens": "^8.4.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@compiled/react": "^0.18.6",