@atlaskit/editor-core 189.3.26 → 189.3.27

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +37 -38
  3. package/dist/cjs/plugins/paste/pm-plugins/main.js +25 -8
  4. package/dist/cjs/plugins/tasks-and-decisions/index.js +16 -7
  5. package/dist/cjs/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +3 -3
  6. package/dist/cjs/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +3 -3
  7. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -5
  8. package/dist/cjs/ui/ContentStyles/index.js +2 -2
  9. package/dist/cjs/version-wrapper.js +1 -1
  10. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +6 -6
  11. package/dist/es2019/plugins/paste/pm-plugins/main.js +25 -8
  12. package/dist/es2019/plugins/tasks-and-decisions/index.js +115 -107
  13. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/input-rules.js +1 -2
  14. package/dist/es2019/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +1 -1
  15. package/dist/es2019/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +1 -1
  16. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -5
  17. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  18. package/dist/es2019/version-wrapper.js +1 -1
  19. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +37 -38
  20. package/dist/esm/plugins/paste/pm-plugins/main.js +25 -8
  21. package/dist/esm/plugins/tasks-and-decisions/index.js +14 -8
  22. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/input-rules.js +1 -2
  23. package/dist/esm/plugins/tasks-and-decisions/ui/ToolbarDecision/index.js +1 -1
  24. package/dist/esm/plugins/tasks-and-decisions/ui/ToolbarTask/index.js +1 -1
  25. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -5
  26. package/dist/esm/ui/ContentStyles/index.js +1 -1
  27. package/dist/esm/version-wrapper.js +1 -1
  28. package/dist/types/plugins/insert-block/types.d.ts +3 -1
  29. package/dist/types/plugins/tasks-and-decisions/commands.d.ts +1 -2
  30. package/dist/types/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +3 -3
  31. package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +3 -3
  32. package/dist/types/plugins/tasks-and-decisions/types.d.ts +7 -0
  33. package/dist/types/plugins/tasks-and-decisions/ui/Decision/index.d.ts +1 -1
  34. package/dist/types/plugins/tasks-and-decisions/ui/Task/index.d.ts +4 -3
  35. package/dist/types/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.d.ts +3 -2
  36. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
  37. package/dist/types-ts4.5/plugins/tasks-and-decisions/commands.d.ts +1 -2
  38. package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +3 -3
  39. package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +3 -3
  40. package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +7 -0
  41. package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/Decision/index.d.ts +1 -1
  42. package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/Task/index.d.ts +4 -3
  43. package/dist/types-ts4.5/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.d.ts +3 -2
  44. package/package.json +6 -6
  45. /package/dist/cjs/{plugins/tasks-and-decisions/styles.js → ui/ContentStyles/tasks-and-decisions.js} +0 -0
  46. /package/dist/es2019/{plugins/tasks-and-decisions/styles.js → ui/ContentStyles/tasks-and-decisions.js} +0 -0
  47. /package/dist/esm/{plugins/tasks-and-decisions/styles.js → ui/ContentStyles/tasks-and-decisions.js} +0 -0
  48. /package/dist/types/{plugins/tasks-and-decisions/styles.d.ts → ui/ContentStyles/tasks-and-decisions.d.ts} +0 -0
  49. /package/dist/types-ts4.5/{plugins/tasks-and-decisions/styles.d.ts → ui/ContentStyles/tasks-and-decisions.d.ts} +0 -0
@@ -5,9 +5,9 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/editor-common/messages';
6
6
  import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
7
7
  import { stateKey as taskPluginKey } from './pm-plugins/plugin-key';
8
- import { insertTaskDecisionAction, getListTypes } from './commands';
8
+ import { insertTaskDecisionAction, getListTypes, insertTaskDecisionCommand } from './commands';
9
9
  import inputRulePlugin from './pm-plugins/input-rules';
10
- import keymap from './pm-plugins/keymaps';
10
+ import keymap, { getIndentCommand, getUnindentCommand } from './pm-plugins/keymaps';
11
11
  import { createPlugin } from './pm-plugins/main';
12
12
  import ToolbarDecision from './ui/ToolbarDecision';
13
13
  import ToolbarTask from './ui/ToolbarTask';
@@ -37,111 +37,119 @@ const tasksAndDecisionsPlugin = ({
37
37
  useLongPressSelection
38
38
  } = {},
39
39
  api
40
- }) => ({
41
- name: 'taskDecision',
42
- nodes() {
43
- return [{
44
- name: 'decisionList',
45
- node: decisionList
46
- }, {
47
- name: 'decisionItem',
48
- node: decisionItem
49
- }, {
50
- name: 'taskList',
51
- node: taskList
52
- }, {
53
- name: 'taskItem',
54
- node: taskItem
55
- }];
56
- },
57
- getSharedState(editorState) {
58
- if (!editorState) {
59
- return undefined;
60
- }
61
- const pluginState = taskPluginKey.getState(editorState);
62
- const indentLevel = getCurrentIndentLevel(editorState.selection) || 0;
63
- const itemIndex = getTaskItemIndex(editorState);
64
- return {
65
- focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null,
66
- isInsideTask: isInsideTask(editorState),
67
- indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL,
68
- outdentDisabled: indentLevel <= 1
69
- };
70
- },
71
- pmPlugins() {
72
- return [{
73
- name: 'tasksAndDecisions',
74
- plugin: ({
75
- portalProviderAPI,
76
- providerFactory,
77
- eventDispatcher,
78
- dispatch
79
- }) => {
80
- return createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, useLongPressSelection);
81
- }
82
- }, {
83
- name: 'tasksAndDecisionsInputRule',
84
- plugin: ({
85
- schema,
86
- featureFlags
87
- }) => {
88
- var _api$analytics;
89
- return inputRulePlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(schema, featureFlags);
40
+ }) => {
41
+ var _api$analytics, _api$analytics2, _api$analytics3;
42
+ return {
43
+ name: 'taskDecision',
44
+ nodes() {
45
+ return [{
46
+ name: 'decisionList',
47
+ node: decisionList
48
+ }, {
49
+ name: 'decisionItem',
50
+ node: decisionItem
51
+ }, {
52
+ name: 'taskList',
53
+ node: taskList
54
+ }, {
55
+ name: 'taskItem',
56
+ node: taskItem
57
+ }];
58
+ },
59
+ getSharedState(editorState) {
60
+ if (!editorState) {
61
+ return undefined;
90
62
  }
91
- }, {
92
- name: 'tasksAndDecisionsKeyMap',
93
- plugin: ({
94
- schema
95
- }) => keymap(schema, api, allowNestedTasks, consumeTabs)
96
- } // Needs to be after "save-on-enter"
97
- ];
98
- },
63
+ const pluginState = taskPluginKey.getState(editorState);
64
+ const indentLevel = getCurrentIndentLevel(editorState.selection) || 0;
65
+ const itemIndex = getTaskItemIndex(editorState);
66
+ return {
67
+ focusedTaskItemLocalId: (pluginState === null || pluginState === void 0 ? void 0 : pluginState.focusedTaskItemLocalId) || null,
68
+ isInsideTask: isInsideTask(editorState),
69
+ indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL,
70
+ outdentDisabled: indentLevel <= 1
71
+ };
72
+ },
73
+ actions: {
74
+ insertTaskDecision: insertTaskDecisionCommand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
75
+ indentTaskList: getIndentCommand(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
76
+ outdentTaskList: getUnindentCommand(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)
77
+ },
78
+ pmPlugins() {
79
+ return [{
80
+ name: 'tasksAndDecisions',
81
+ plugin: ({
82
+ portalProviderAPI,
83
+ providerFactory,
84
+ eventDispatcher,
85
+ dispatch
86
+ }) => {
87
+ return createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, useLongPressSelection);
88
+ }
89
+ }, {
90
+ name: 'tasksAndDecisionsInputRule',
91
+ plugin: ({
92
+ schema,
93
+ featureFlags
94
+ }) => {
95
+ var _api$analytics4;
96
+ return inputRulePlugin(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(schema, featureFlags);
97
+ }
98
+ }, {
99
+ name: 'tasksAndDecisionsKeyMap',
100
+ plugin: ({
101
+ schema
102
+ }) => keymap(schema, api, allowNestedTasks, consumeTabs)
103
+ } // Needs to be after "save-on-enter"
104
+ ];
105
+ },
99
106
 
100
- secondaryToolbarComponent({
101
- editorView,
102
- disabled
103
- }) {
104
- return jsx("div", {
105
- css: taskDecisionToolbarGroup
106
- }, jsx(ToolbarDecision, {
107
- editorView: editorView,
108
- isDisabled: disabled,
109
- isReducedSpacing: true,
110
- editorAPI: api
111
- }), jsx(ToolbarTask, {
112
- editorView: editorView,
113
- isDisabled: disabled,
114
- isReducedSpacing: true,
115
- editorAPI: api
116
- }));
117
- },
118
- pluginsOptions: {
119
- quickInsert: ({
120
- formatMessage
121
- }) => [{
122
- id: 'action',
123
- title: formatMessage(insertBlockMessages.action),
124
- description: formatMessage(insertBlockMessages.actionDescription),
125
- priority: 100,
126
- keywords: ['checkbox', 'task', 'todo'],
127
- keyshortcut: '[]',
128
- icon: () => jsx(IconAction, null),
129
- action(insert, state) {
130
- var _api$analytics2;
131
- return insertTaskDecisionAction(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(state, 'taskList', INPUT_METHOD.QUICK_INSERT, addItem(insert, 'taskList', state.schema));
132
- }
133
- }, {
134
- id: 'decision',
135
- title: formatMessage(insertBlockMessages.decision),
136
- description: formatMessage(insertBlockMessages.decisionDescription),
137
- priority: 900,
138
- keyshortcut: '<>',
139
- icon: () => jsx(IconDecision, null),
140
- action(insert, state) {
141
- var _api$analytics3;
142
- return insertTaskDecisionAction(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(state, 'decisionList', INPUT_METHOD.QUICK_INSERT, addItem(insert, 'decisionList', state.schema));
143
- }
144
- }]
145
- }
146
- });
107
+ secondaryToolbarComponent({
108
+ editorView,
109
+ disabled
110
+ }) {
111
+ return jsx("div", {
112
+ css: taskDecisionToolbarGroup
113
+ }, jsx(ToolbarDecision, {
114
+ editorView: editorView,
115
+ isDisabled: disabled,
116
+ isReducedSpacing: true,
117
+ editorAPI: api
118
+ }), jsx(ToolbarTask, {
119
+ editorView: editorView,
120
+ isDisabled: disabled,
121
+ isReducedSpacing: true,
122
+ editorAPI: api
123
+ }));
124
+ },
125
+ pluginsOptions: {
126
+ quickInsert: ({
127
+ formatMessage
128
+ }) => [{
129
+ id: 'action',
130
+ title: formatMessage(insertBlockMessages.action),
131
+ description: formatMessage(insertBlockMessages.actionDescription),
132
+ priority: 100,
133
+ keywords: ['checkbox', 'task', 'todo'],
134
+ keyshortcut: '[]',
135
+ icon: () => jsx(IconAction, null),
136
+ action(insert, state) {
137
+ var _api$analytics5;
138
+ return insertTaskDecisionAction(api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)(state, 'taskList', INPUT_METHOD.QUICK_INSERT, addItem(insert, 'taskList', state.schema));
139
+ }
140
+ }, {
141
+ id: 'decision',
142
+ title: formatMessage(insertBlockMessages.decision),
143
+ description: formatMessage(insertBlockMessages.decisionDescription),
144
+ priority: 900,
145
+ keyshortcut: '<>',
146
+ icon: () => jsx(IconDecision, null),
147
+ action(insert, state) {
148
+ var _api$analytics6;
149
+ return insertTaskDecisionAction(api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)(state, 'decisionList', INPUT_METHOD.QUICK_INSERT, addItem(insert, 'decisionList', state.schema));
150
+ }
151
+ }]
152
+ }
153
+ };
154
+ };
147
155
  export default tasksAndDecisionsPlugin;
@@ -1,7 +1,6 @@
1
1
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { canInsert } from '@atlaskit/editor-prosemirror/utils';
3
- import { createRule, createPlugin } from '@atlaskit/prosemirror-input-rules';
4
- import { leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
3
+ import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
5
4
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
5
  import { changeInDepth, insertTaskDecisionAction, getListTypes } from '../commands';
7
6
  const createListRule = editorAnalyticsAPI => (regex, listType, itemAttrs) => {
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { PureComponent } from 'react';
3
3
  import { injectIntl } from 'react-intl-next';
4
4
  import DecisionIcon from '@atlaskit/icon/glyph/editor/decision';
5
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
5
+ import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
6
6
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
7
7
  import { insertTaskDecisionCommand } from '../../commands';
8
8
  export class ToolbarDecision extends PureComponent {
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { PureComponent } from 'react';
3
3
  import { injectIntl } from 'react-intl-next';
4
4
  import TaskIcon from '@atlaskit/icon/glyph/editor/task';
5
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
5
+ import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
6
6
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
7
7
  import { insertTaskDecisionCommand } from '../../commands';
8
8
  export class ToolbarTask extends PureComponent {
@@ -1,4 +1,3 @@
1
- import { getIndentCommand as indentTaskList, getUnindentCommand as outdentTaskList } from '../../tasks-and-decisions/pm-plugins/keymaps';
2
1
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
2
  export const onItemActivated = (pluginInjectionApi, indentationStateNode) => ({
4
3
  buttonName,
@@ -22,8 +21,8 @@ export const onItemActivated = (pluginInjectionApi, indentationStateNode) => ({
22
21
  pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(INPUT_METHOD.TOOLBAR));
23
22
  }
24
23
  if (node === 'taskList') {
25
- var _pluginInjectionApi$a;
26
- indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
24
+ var _pluginInjectionApi$t;
25
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t === void 0 ? void 0 : _pluginInjectionApi$t.actions.indentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
27
26
  }
28
27
  break;
29
28
  }
@@ -38,8 +37,8 @@ export const onItemActivated = (pluginInjectionApi, indentationStateNode) => ({
38
37
  pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(INPUT_METHOD.TOOLBAR));
39
38
  }
40
39
  if (node === 'taskList') {
41
- var _pluginInjectionApi$a2;
42
- outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
40
+ var _pluginInjectionApi$t2;
41
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$t2 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t2 === void 0 ? void 0 : _pluginInjectionApi$t2.actions.outdentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
43
42
  }
44
43
  break;
45
44
  }
@@ -17,7 +17,7 @@ import { extensionStyles } from './extension';
17
17
  import { expandStyles } from './expand';
18
18
  import { MediaSharedClassNames } from '@atlaskit/editor-common/styles';
19
19
  import { findReplaceStyles } from '../../plugins/find-replace/styles';
20
- import { taskDecisionStyles } from '../../plugins/tasks-and-decisions/styles';
20
+ import { taskDecisionStyles } from './tasks-and-decisions';
21
21
  import { statusStyles } from './status';
22
22
  import { dateStyles } from './date';
23
23
  import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "189.3.26";
2
+ export const version = "189.3.27";
@@ -20,7 +20,6 @@ import { Popup } from '@atlaskit/editor-common/ui';
20
20
  import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
21
21
  import { separatorStyles, buttonGroupStyle, wrapperStyle } from '@atlaskit/editor-common/styles';
22
22
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
23
- import { insertTaskDecisionCommand } from '../../../tasks-and-decisions/commands';
24
23
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
25
24
  import { messages } from './messages';
26
25
  import { createItems } from './create-items';
@@ -244,40 +243,41 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
244
243
  }
245
244
  return true;
246
245
  });
247
- _defineProperty(_assertThisInitialized(_this), "insertTaskDecision", function (editorAnalyticsAPI) {
248
- return function (name, inputMethod) {
249
- return function () {
250
- var _this$props$editorVie = _this.props.editorView,
251
- state = _this$props$editorVie.state,
252
- dispatch = _this$props$editorVie.dispatch;
253
- var listType = name === 'action' ? 'taskList' : 'decisionList';
254
- return insertTaskDecisionCommand(editorAnalyticsAPI)(listType, inputMethod)(state, dispatch);
255
- };
246
+ _defineProperty(_assertThisInitialized(_this), "insertTaskDecision", function (name, inputMethod) {
247
+ return function () {
248
+ var _pluginInjectionApi$t5, _pluginInjectionApi$t6;
249
+ var _this$props7 = _this.props,
250
+ _this$props7$editorVi = _this$props7.editorView,
251
+ state = _this$props7$editorVi.state,
252
+ dispatch = _this$props7$editorVi.dispatch,
253
+ pluginInjectionApi = _this$props7.pluginInjectionApi;
254
+ var listType = name === 'action' ? 'taskList' : 'decisionList';
255
+ return (_pluginInjectionApi$t5 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t6 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t6 === void 0 ? void 0 : _pluginInjectionApi$t6.actions.insertTaskDecision(listType, inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$t5 !== void 0 ? _pluginInjectionApi$t5 : false;
256
256
  };
257
257
  });
258
258
  _defineProperty(_assertThisInitialized(_this), "insertHorizontalRule", function (inputMethod) {
259
259
  var _pluginInjectionApi$r, _pluginInjectionApi$r2;
260
- var _this$props7 = _this.props,
261
- _this$props7$editorVi = _this$props7.editorView,
262
- state = _this$props7$editorVi.state,
263
- dispatch = _this$props7$editorVi.dispatch,
264
- pluginInjectionApi = _this$props7.pluginInjectionApi;
265
- return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
266
- });
267
- _defineProperty(_assertThisInitialized(_this), "insertExpand", function () {
268
- var _pluginInjectionApi$e, _pluginInjectionApi$e2;
269
260
  var _this$props8 = _this.props,
270
261
  _this$props8$editorVi = _this$props8.editorView,
271
262
  state = _this$props8$editorVi.state,
272
263
  dispatch = _this$props8$editorVi.dispatch,
273
264
  pluginInjectionApi = _this$props8.pluginInjectionApi;
265
+ return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
266
+ });
267
+ _defineProperty(_assertThisInitialized(_this), "insertExpand", function () {
268
+ var _pluginInjectionApi$e, _pluginInjectionApi$e2;
269
+ var _this$props9 = _this.props,
270
+ _this$props9$editorVi = _this$props9.editorView,
271
+ state = _this$props9$editorVi.state,
272
+ dispatch = _this$props9$editorVi.dispatch,
273
+ pluginInjectionApi = _this$props9.pluginInjectionApi;
274
274
  return (_pluginInjectionApi$e = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.expand) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.actions.insertExpand(state, dispatch)) !== null && _pluginInjectionApi$e !== void 0 ? _pluginInjectionApi$e : false;
275
275
  });
276
276
  _defineProperty(_assertThisInitialized(_this), "insertBlockType", function (itemName) {
277
277
  return function () {
278
- var _this$props9 = _this.props,
279
- editorView = _this$props9.editorView,
280
- onInsertBlockType = _this$props9.onInsertBlockType;
278
+ var _this$props10 = _this.props,
279
+ editorView = _this$props10.editorView,
280
+ onInsertBlockType = _this$props10.onInsertBlockType;
281
281
  var state = editorView.state,
282
282
  dispatch = editorView.dispatch;
283
283
  onInsertBlockType(itemName)(state, dispatch);
@@ -298,14 +298,13 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
298
298
  pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.commands.openElementBrowserModal);
299
299
  });
300
300
  _defineProperty(_assertThisInitialized(_this), "onItemActivated", function (_ref2) {
301
- var _this$props$pluginInj;
302
301
  var item = _ref2.item,
303
302
  inputMethod = _ref2.inputMethod;
304
- var _this$props10 = _this.props,
305
- editorView = _this$props10.editorView,
306
- editorActions = _this$props10.editorActions,
307
- handleImageUpload = _this$props10.handleImageUpload,
308
- expandEnabled = _this$props10.expandEnabled;
303
+ var _this$props11 = _this.props,
304
+ editorView = _this$props11.editorView,
305
+ editorActions = _this$props11.editorActions,
306
+ handleImageUpload = _this$props11.handleImageUpload,
307
+ expandEnabled = _this$props11.expandEnabled;
309
308
 
310
309
  // need to do this before inserting nodes so scrollIntoView works properly
311
310
  if (!editorView.hasFocus()) {
@@ -341,7 +340,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
341
340
  break;
342
341
  case 'action':
343
342
  case 'decision':
344
- _this.insertTaskDecision((_this$props$pluginInj = _this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || (_this$props$pluginInj = _this$props$pluginInj.analytics) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.actions)(item.value.name, inputMethod)();
343
+ _this.insertTaskDecision(item.value.name, inputMethod)();
345
344
  break;
346
345
  case 'horizontalrule':
347
346
  _this.insertHorizontalRule(inputMethod);
@@ -421,12 +420,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
421
420
  key: "renderPopup",
422
421
  value: function renderPopup() {
423
422
  var emojiPickerOpen = this.state.emojiPickerOpen;
424
- var _this$props11 = this.props,
425
- popupsMountPoint = _this$props11.popupsMountPoint,
426
- popupsBoundariesElement = _this$props11.popupsBoundariesElement,
427
- popupsScrollableElement = _this$props11.popupsScrollableElement,
428
- emojiProvider = _this$props11.emojiProvider,
429
- replacePlusMenuWithElementBrowser = _this$props11.replacePlusMenuWithElementBrowser;
423
+ var _this$props12 = this.props,
424
+ popupsMountPoint = _this$props12.popupsMountPoint,
425
+ popupsBoundariesElement = _this$props12.popupsBoundariesElement,
426
+ popupsScrollableElement = _this$props12.popupsScrollableElement,
427
+ emojiProvider = _this$props12.emojiProvider,
428
+ replacePlusMenuWithElementBrowser = _this$props12.replacePlusMenuWithElementBrowser;
430
429
  var dropdownEmoji = this.state.dropdownItems.some(function (_ref4) {
431
430
  var name = _ref4.value.name;
432
431
  return name === 'emoji';
@@ -463,9 +462,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
463
462
  buttons = _this$state.buttons,
464
463
  dropdownItems = _this$state.dropdownItems,
465
464
  emojiPickerOpen = _this$state.emojiPickerOpen;
466
- var _this$props12 = this.props,
467
- isDisabled = _this$props12.isDisabled,
468
- isReducedSpacing = _this$props12.isReducedSpacing;
465
+ var _this$props13 = this.props,
466
+ isDisabled = _this$props13.isDisabled,
467
+ isReducedSpacing = _this$props13.isReducedSpacing;
469
468
  if (buttons.length === 0 && dropdownItems.length === 0) {
470
469
  return null;
471
470
  }
@@ -30,20 +30,37 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
30
30
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
31
31
  var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
32
32
  function getMarkdownSlice(text, openStart, openEnd) {
33
- var textInput = text;
34
- var textSplitByCodeBlock = textInput.split(/```/);
35
- for (var i = 0; i < textSplitByCodeBlock.length; i++) {
36
- if (i % 2 === 0) {
37
- textSplitByCodeBlock[i] = textSplitByCodeBlock[i].replace(/\\/g, '\\\\');
38
- }
39
- }
40
- textInput = textSplitByCodeBlock.join('```');
33
+ var textInput = escapeBackslashExceptCodeblock(text);
41
34
  var doc = atlassianMarkDownParser.parse(escapeLinks(textInput));
42
35
  if (doc && doc.content) {
43
36
  return new Slice(doc.content, openStart, openEnd);
44
37
  }
45
38
  return;
46
39
  }
40
+ function escapeBackslashExceptCodeblock(textInput) {
41
+ var codeToken = '```';
42
+ if (!textInput.includes(codeToken)) {
43
+ return textInput.replace(/\\/g, '\\\\');
44
+ }
45
+ var isInsideCodeblock = false;
46
+ var textSplitByNewLine = textInput.split('\n');
47
+ // In the splitted array, we traverse through every line and check if it will be parsed as a codeblock.
48
+ textSplitByNewLine = textSplitByNewLine.map(function (text) {
49
+ if (text === codeToken) {
50
+ isInsideCodeblock = !isInsideCodeblock;
51
+ } else if (text.startsWith(codeToken) && isInsideCodeblock === false) {
52
+ // if there is some text after the ``` mark , it gets counted as language attribute only at the start of codeblock
53
+ isInsideCodeblock = true;
54
+ }
55
+ if (!isInsideCodeblock) {
56
+ // only escape text which is not inside a codeblock
57
+ text = text.replace(/\\/g, '\\\\');
58
+ }
59
+ return text;
60
+ });
61
+ textInput = textSplitByNewLine.join('\n');
62
+ return textInput;
63
+ }
47
64
  var extensionAutoConverter;
48
65
  function setExtensionAutoConverter(_x, _x2) {
49
66
  return _setExtensionAutoConverter.apply(this, arguments);
@@ -7,9 +7,9 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
7
  import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/editor-common/messages';
8
8
  import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
9
9
  import { stateKey as taskPluginKey } from './pm-plugins/plugin-key';
10
- import { insertTaskDecisionAction, getListTypes } from './commands';
10
+ import { insertTaskDecisionAction, getListTypes, insertTaskDecisionCommand } from './commands';
11
11
  import inputRulePlugin from './pm-plugins/input-rules';
12
- import keymap from './pm-plugins/keymaps';
12
+ import keymap, { getIndentCommand, getUnindentCommand } from './pm-plugins/keymaps';
13
13
  import { createPlugin } from './pm-plugins/main';
14
14
  import ToolbarDecision from './ui/ToolbarDecision';
15
15
  import ToolbarTask from './ui/ToolbarTask';
@@ -31,6 +31,7 @@ var addItem = function addItem(insert, listType, schema) {
31
31
  };
32
32
  };
33
33
  var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
34
+ var _api$analytics, _api$analytics2, _api$analytics3;
34
35
  var _ref2$config = _ref2.config,
35
36
  _ref2$config2 = _ref2$config === void 0 ? {} : _ref2$config,
36
37
  allowNestedTasks = _ref2$config2.allowNestedTasks,
@@ -68,6 +69,11 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
68
69
  outdentDisabled: indentLevel <= 1
69
70
  };
70
71
  },
72
+ actions: {
73
+ insertTaskDecision: insertTaskDecisionCommand(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions),
74
+ indentTaskList: getIndentCommand(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
75
+ outdentTaskList: getUnindentCommand(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)
76
+ },
71
77
  pmPlugins: function pmPlugins() {
72
78
  return [{
73
79
  name: 'tasksAndDecisions',
@@ -81,10 +87,10 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
81
87
  }, {
82
88
  name: 'tasksAndDecisionsInputRule',
83
89
  plugin: function plugin(_ref4) {
84
- var _api$analytics;
90
+ var _api$analytics4;
85
91
  var schema = _ref4.schema,
86
92
  featureFlags = _ref4.featureFlags;
87
- return inputRulePlugin(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(schema, featureFlags);
93
+ return inputRulePlugin(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(schema, featureFlags);
88
94
  }
89
95
  }, {
90
96
  name: 'tasksAndDecisionsKeyMap',
@@ -126,8 +132,8 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
126
132
  return jsx(IconAction, null);
127
133
  },
128
134
  action: function action(insert, state) {
129
- var _api$analytics2;
130
- return insertTaskDecisionAction(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(state, 'taskList', INPUT_METHOD.QUICK_INSERT, addItem(insert, 'taskList', state.schema));
135
+ var _api$analytics5;
136
+ return insertTaskDecisionAction(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)(state, 'taskList', INPUT_METHOD.QUICK_INSERT, addItem(insert, 'taskList', state.schema));
131
137
  }
132
138
  }, {
133
139
  id: 'decision',
@@ -139,8 +145,8 @@ var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref2) {
139
145
  return jsx(IconDecision, null);
140
146
  },
141
147
  action: function action(insert, state) {
142
- var _api$analytics3;
143
- return insertTaskDecisionAction(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)(state, 'decisionList', INPUT_METHOD.QUICK_INSERT, addItem(insert, 'decisionList', state.schema));
148
+ var _api$analytics6;
149
+ return insertTaskDecisionAction(api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions)(state, 'decisionList', INPUT_METHOD.QUICK_INSERT, addItem(insert, 'decisionList', state.schema));
144
150
  }
145
151
  }];
146
152
  }
@@ -3,8 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
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 { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { canInsert } from '@atlaskit/editor-prosemirror/utils';
6
- import { createRule, createPlugin } from '@atlaskit/prosemirror-input-rules';
7
- import { leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
6
+ import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
8
7
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
9
8
  import { changeInDepth, insertTaskDecisionAction, getListTypes } from '../commands';
10
9
  var createListRule = function createListRule(editorAnalyticsAPI) {
@@ -10,7 +10,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
  import React, { PureComponent } from 'react';
11
11
  import { injectIntl } from 'react-intl-next';
12
12
  import DecisionIcon from '@atlaskit/icon/glyph/editor/decision';
13
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
13
+ import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
14
14
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
15
15
  import { insertTaskDecisionCommand } from '../../commands';
16
16
  export var ToolbarDecision = /*#__PURE__*/function (_PureComponent) {
@@ -10,7 +10,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
  import React, { PureComponent } from 'react';
11
11
  import { injectIntl } from 'react-intl-next';
12
12
  import TaskIcon from '@atlaskit/icon/glyph/editor/task';
13
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
13
+ import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
14
14
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
15
15
  import { insertTaskDecisionCommand } from '../../commands';
16
16
  export var ToolbarTask = /*#__PURE__*/function (_PureComponent) {
@@ -1,4 +1,3 @@
1
- import { getIndentCommand as indentTaskList, getUnindentCommand as outdentTaskList } from '../../tasks-and-decisions/pm-plugins/keymaps';
2
1
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
2
  export var onItemActivated = function onItemActivated(pluginInjectionApi, indentationStateNode) {
4
3
  return function (_ref) {
@@ -22,8 +21,8 @@ export var onItemActivated = function onItemActivated(pluginInjectionApi, indent
22
21
  pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(INPUT_METHOD.TOOLBAR));
23
22
  }
24
23
  if (node === 'taskList') {
25
- var _pluginInjectionApi$a;
26
- indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
24
+ var _pluginInjectionApi$t;
25
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t === void 0 || _pluginInjectionApi$t.actions.indentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
27
26
  }
28
27
  break;
29
28
  }
@@ -38,8 +37,8 @@ export var onItemActivated = function onItemActivated(pluginInjectionApi, indent
38
37
  pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(INPUT_METHOD.TOOLBAR));
39
38
  }
40
39
  if (_node === 'taskList') {
41
- var _pluginInjectionApi$a2;
42
- outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
40
+ var _pluginInjectionApi$t2;
41
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$t2 = pluginInjectionApi.taskDecision) === null || _pluginInjectionApi$t2 === void 0 || _pluginInjectionApi$t2.actions.outdentTaskList(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
43
42
  }
44
43
  break;
45
44
  }
@@ -19,7 +19,7 @@ import { extensionStyles } from './extension';
19
19
  import { expandStyles } from './expand';
20
20
  import { MediaSharedClassNames } from '@atlaskit/editor-common/styles';
21
21
  import { findReplaceStyles } from '../../plugins/find-replace/styles';
22
- import { taskDecisionStyles } from '../../plugins/tasks-and-decisions/styles';
22
+ import { taskDecisionStyles } from './tasks-and-decisions';
23
23
  import { statusStyles } from './status';
24
24
  import { dateStyles } from './date';
25
25
  import { InlineNodeViewSharedStyles } from '../../nodeviews/getInlineNodeViewProducer.styles';