@atlaskit/editor-plugin-tasks-and-decisions 13.2.6 → 13.3.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 +11 -0
- package/dist/cjs/tasksAndDecisionsPlugin.js +6 -6
- package/dist/cjs/ui/Task/task-item-with-providers.js +15 -15
- package/dist/cjs/ui/TaskListMenuItem/TaskListMenuItem.js +26 -6
- package/dist/es2019/ui/TaskListMenuItem/TaskListMenuItem.js +26 -6
- package/dist/esm/tasksAndDecisionsPlugin.js +6 -6
- package/dist/esm/ui/Task/task-item-with-providers.js +14 -14
- package/dist/esm/ui/TaskListMenuItem/TaskListMenuItem.js +26 -6
- package/dist/types/tasksAndDecisionsPluginType.d.ts +23 -1
- package/dist/types-ts4.5/tasksAndDecisionsPluginType.d.ts +23 -1
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-tasks-and-decisions
|
|
2
2
|
|
|
3
|
+
## 13.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`3b79e10490ac2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3b79e10490ac2) -
|
|
8
|
+
Support markdown source view list and task toolbar actions
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 13.2.6
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -233,25 +233,25 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
233
233
|
var _setProvider2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(providerPromise) {
|
|
234
234
|
var _api$core$actions$exe;
|
|
235
235
|
var provider;
|
|
236
|
-
return _regenerator.default.wrap(function
|
|
236
|
+
return _regenerator.default.wrap(function (_context) {
|
|
237
237
|
while (1) switch (_context.prev = _context.next) {
|
|
238
238
|
case 0:
|
|
239
|
-
_context.next =
|
|
239
|
+
_context.next = 1;
|
|
240
240
|
return providerPromise;
|
|
241
|
-
case
|
|
241
|
+
case 1:
|
|
242
242
|
provider = _context.sent;
|
|
243
243
|
if (!(previousTaskAndDecisionProvider === provider || taskDecisionProvider === providerPromise)) {
|
|
244
|
-
_context.next =
|
|
244
|
+
_context.next = 2;
|
|
245
245
|
break;
|
|
246
246
|
}
|
|
247
247
|
return _context.abrupt("return", false);
|
|
248
|
-
case
|
|
248
|
+
case 2:
|
|
249
249
|
previousTaskAndDecisionProvider = provider;
|
|
250
250
|
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref7) {
|
|
251
251
|
var tr = _ref7.tr;
|
|
252
252
|
return (0, _insertCommands.setProvider)(provider)(tr);
|
|
253
253
|
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
254
|
-
case
|
|
254
|
+
case 3:
|
|
255
255
|
case "end":
|
|
256
256
|
return _context.stop();
|
|
257
257
|
}
|
|
@@ -20,7 +20,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
20
20
|
var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
|
|
21
21
|
var _taskDecision = require("@atlaskit/task-decision");
|
|
22
22
|
var _excluded = ["contextIdentifierProvider"];
|
|
23
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
23
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
24
24
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
25
25
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
26
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -66,47 +66,47 @@ var TaskItemWithProviders = exports.default = /*#__PURE__*/function (_Component)
|
|
|
66
66
|
key: "updateContextIdentifierProvider",
|
|
67
67
|
value: function () {
|
|
68
68
|
var _updateContextIdentifierProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(props) {
|
|
69
|
-
var resolvedContextProvider;
|
|
70
|
-
return _regenerator.default.wrap(function
|
|
69
|
+
var resolvedContextProvider, _t;
|
|
70
|
+
return _regenerator.default.wrap(function (_context) {
|
|
71
71
|
while (1) switch (_context.prev = _context.next) {
|
|
72
72
|
case 0:
|
|
73
73
|
if (!props.contextIdentifierProvider) {
|
|
74
|
-
_context.next =
|
|
74
|
+
_context.next = 5;
|
|
75
75
|
break;
|
|
76
76
|
}
|
|
77
77
|
_context.prev = 1;
|
|
78
|
-
_context.next =
|
|
78
|
+
_context.next = 2;
|
|
79
79
|
return props.contextIdentifierProvider;
|
|
80
|
-
case
|
|
80
|
+
case 2:
|
|
81
81
|
resolvedContextProvider = _context.sent;
|
|
82
82
|
if (this.mounted) {
|
|
83
83
|
this.setState({
|
|
84
84
|
resolvedContextProvider: resolvedContextProvider
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
_context.next =
|
|
87
|
+
_context.next = 4;
|
|
88
88
|
break;
|
|
89
|
-
case
|
|
90
|
-
_context.prev =
|
|
91
|
-
|
|
89
|
+
case 3:
|
|
90
|
+
_context.prev = 3;
|
|
91
|
+
_t = _context["catch"](1);
|
|
92
92
|
// eslint-disable-line no-unused-vars
|
|
93
93
|
if (this.mounted) {
|
|
94
94
|
this.setState({
|
|
95
95
|
resolvedContextProvider: undefined
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
case
|
|
99
|
-
_context.next =
|
|
98
|
+
case 4:
|
|
99
|
+
_context.next = 6;
|
|
100
100
|
break;
|
|
101
|
-
case
|
|
101
|
+
case 5:
|
|
102
102
|
this.setState({
|
|
103
103
|
resolvedContextProvider: undefined
|
|
104
104
|
});
|
|
105
|
-
case
|
|
105
|
+
case 6:
|
|
106
106
|
case "end":
|
|
107
107
|
return _context.stop();
|
|
108
108
|
}
|
|
109
|
-
}, _callee, this, [[1,
|
|
109
|
+
}, _callee, this, [[1, 3]]);
|
|
110
110
|
}));
|
|
111
111
|
function updateContextIdentifierProvider(_x) {
|
|
112
112
|
return _updateContextIdentifierProvider.apply(this, arguments);
|
|
@@ -11,19 +11,39 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
11
11
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
14
16
|
var TaskListMenuItem = exports.TaskListMenuItem = function TaskListMenuItem(_ref) {
|
|
15
17
|
var api = _ref.api;
|
|
16
18
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
17
19
|
formatMessage = _useIntl.formatMessage;
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
+
var isMarkdownToolbarEnabled = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc-markdown-mode', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_markdown_compatible_toolbar');
|
|
21
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['taskDecision', 'markdownMode'], function (states) {
|
|
22
|
+
var _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
20
23
|
return {
|
|
21
|
-
isInsideTask: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
24
|
+
isInsideTask: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask,
|
|
25
|
+
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
26
|
+
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
27
|
+
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
22
28
|
};
|
|
23
29
|
}),
|
|
24
|
-
isInsideTask = _useSharedPluginState.isInsideTask
|
|
30
|
+
isInsideTask = _useSharedPluginState.isInsideTask,
|
|
31
|
+
markdownView = _useSharedPluginState.markdownView,
|
|
32
|
+
sourceBlockFormatState = _useSharedPluginState.sourceBlockFormatState,
|
|
33
|
+
sourceListFormatState = _useSharedPluginState.sourceListFormatState;
|
|
34
|
+
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
35
|
+
var isSelected = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList : isInsideTask;
|
|
36
|
+
var isDisabled = Boolean(isInSourceView && (sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock));
|
|
25
37
|
var handleClick = function handleClick() {
|
|
26
38
|
var _api$taskDecision;
|
|
39
|
+
if (isDisabled) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (isInSourceView) {
|
|
43
|
+
var _api$markdownMode;
|
|
44
|
+
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceTaskList();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
27
47
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList());
|
|
28
48
|
};
|
|
29
49
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
@@ -34,8 +54,8 @@ var TaskListMenuItem = exports.TaskListMenuItem = function TaskListMenuItem(_ref
|
|
|
34
54
|
elemAfter: /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarKeyboardShortcutHint, {
|
|
35
55
|
shortcut: (0, _keymaps.formatShortcut)(_keymaps.toggleTaskList)
|
|
36
56
|
}),
|
|
37
|
-
isSelected:
|
|
38
|
-
isDisabled:
|
|
57
|
+
isSelected: isSelected,
|
|
58
|
+
isDisabled: isDisabled,
|
|
39
59
|
onClick: handleClick,
|
|
40
60
|
ariaKeyshortcuts: (0, _keymaps.formatShortcut)(_keymaps.toggleTaskList)
|
|
41
61
|
}, formatMessage(_messages.tasksAndDecisionsMessages.taskList));
|
|
@@ -4,22 +4,42 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
4
4
|
import { formatShortcut, toggleTaskList } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint, TaskIcon } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
7
9
|
export const TaskListMenuItem = ({
|
|
8
10
|
api
|
|
9
11
|
}) => {
|
|
10
12
|
const {
|
|
11
13
|
formatMessage
|
|
12
14
|
} = useIntl();
|
|
15
|
+
const isMarkdownToolbarEnabled = expValEqualsNoExposure('cc-markdown-mode', 'isEnabled', true) && fg('platform_editor_markdown_compatible_toolbar');
|
|
13
16
|
const {
|
|
14
|
-
isInsideTask
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
isInsideTask,
|
|
18
|
+
markdownView,
|
|
19
|
+
sourceBlockFormatState,
|
|
20
|
+
sourceListFormatState
|
|
21
|
+
} = useSharedPluginStateWithSelector(api, ['taskDecision', 'markdownMode'], states => {
|
|
22
|
+
var _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
17
23
|
return {
|
|
18
|
-
isInsideTask: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
24
|
+
isInsideTask: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask,
|
|
25
|
+
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
26
|
+
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
27
|
+
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
19
28
|
};
|
|
20
29
|
});
|
|
30
|
+
const isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
31
|
+
const isSelected = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList : isInsideTask;
|
|
32
|
+
const isDisabled = Boolean(isInSourceView && (sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock));
|
|
21
33
|
const handleClick = () => {
|
|
22
34
|
var _api$taskDecision;
|
|
35
|
+
if (isDisabled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (isInSourceView) {
|
|
39
|
+
var _api$markdownMode;
|
|
40
|
+
api === null || api === void 0 ? void 0 : (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 ? void 0 : _api$markdownMode.actions.toggleSourceTaskList();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
23
43
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList());
|
|
24
44
|
};
|
|
25
45
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -30,8 +50,8 @@ export const TaskListMenuItem = ({
|
|
|
30
50
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
31
51
|
shortcut: formatShortcut(toggleTaskList)
|
|
32
52
|
}),
|
|
33
|
-
isSelected:
|
|
34
|
-
isDisabled:
|
|
53
|
+
isSelected: isSelected,
|
|
54
|
+
isDisabled: isDisabled,
|
|
35
55
|
onClick: handleClick,
|
|
36
56
|
ariaKeyshortcuts: formatShortcut(toggleTaskList)
|
|
37
57
|
}, formatMessage(tasksAndDecisionsMessages.taskList));
|
|
@@ -224,25 +224,25 @@ export var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref3) {
|
|
|
224
224
|
var _setProvider2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(providerPromise) {
|
|
225
225
|
var _api$core$actions$exe;
|
|
226
226
|
var provider;
|
|
227
|
-
return _regeneratorRuntime.wrap(function
|
|
227
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
228
228
|
while (1) switch (_context.prev = _context.next) {
|
|
229
229
|
case 0:
|
|
230
|
-
_context.next =
|
|
230
|
+
_context.next = 1;
|
|
231
231
|
return providerPromise;
|
|
232
|
-
case
|
|
232
|
+
case 1:
|
|
233
233
|
provider = _context.sent;
|
|
234
234
|
if (!(previousTaskAndDecisionProvider === provider || taskDecisionProvider === providerPromise)) {
|
|
235
|
-
_context.next =
|
|
235
|
+
_context.next = 2;
|
|
236
236
|
break;
|
|
237
237
|
}
|
|
238
238
|
return _context.abrupt("return", false);
|
|
239
|
-
case
|
|
239
|
+
case 2:
|
|
240
240
|
previousTaskAndDecisionProvider = provider;
|
|
241
241
|
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref7) {
|
|
242
242
|
var tr = _ref7.tr;
|
|
243
243
|
return _setProvider(provider)(tr);
|
|
244
244
|
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
245
|
-
case
|
|
245
|
+
case 3:
|
|
246
246
|
case "end":
|
|
247
247
|
return _context.stop();
|
|
248
248
|
}
|
|
@@ -57,47 +57,47 @@ var TaskItemWithProviders = /*#__PURE__*/function (_Component) {
|
|
|
57
57
|
key: "updateContextIdentifierProvider",
|
|
58
58
|
value: function () {
|
|
59
59
|
var _updateContextIdentifierProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(props) {
|
|
60
|
-
var resolvedContextProvider;
|
|
61
|
-
return _regeneratorRuntime.wrap(function
|
|
60
|
+
var resolvedContextProvider, _t;
|
|
61
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
62
62
|
while (1) switch (_context.prev = _context.next) {
|
|
63
63
|
case 0:
|
|
64
64
|
if (!props.contextIdentifierProvider) {
|
|
65
|
-
_context.next =
|
|
65
|
+
_context.next = 5;
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
_context.prev = 1;
|
|
69
|
-
_context.next =
|
|
69
|
+
_context.next = 2;
|
|
70
70
|
return props.contextIdentifierProvider;
|
|
71
|
-
case
|
|
71
|
+
case 2:
|
|
72
72
|
resolvedContextProvider = _context.sent;
|
|
73
73
|
if (this.mounted) {
|
|
74
74
|
this.setState({
|
|
75
75
|
resolvedContextProvider: resolvedContextProvider
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
_context.next =
|
|
78
|
+
_context.next = 4;
|
|
79
79
|
break;
|
|
80
|
-
case
|
|
81
|
-
_context.prev =
|
|
82
|
-
|
|
80
|
+
case 3:
|
|
81
|
+
_context.prev = 3;
|
|
82
|
+
_t = _context["catch"](1);
|
|
83
83
|
// eslint-disable-line no-unused-vars
|
|
84
84
|
if (this.mounted) {
|
|
85
85
|
this.setState({
|
|
86
86
|
resolvedContextProvider: undefined
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
case
|
|
90
|
-
_context.next =
|
|
89
|
+
case 4:
|
|
90
|
+
_context.next = 6;
|
|
91
91
|
break;
|
|
92
|
-
case
|
|
92
|
+
case 5:
|
|
93
93
|
this.setState({
|
|
94
94
|
resolvedContextProvider: undefined
|
|
95
95
|
});
|
|
96
|
-
case
|
|
96
|
+
case 6:
|
|
97
97
|
case "end":
|
|
98
98
|
return _context.stop();
|
|
99
99
|
}
|
|
100
|
-
}, _callee, this, [[1,
|
|
100
|
+
}, _callee, this, [[1, 3]]);
|
|
101
101
|
}));
|
|
102
102
|
function updateContextIdentifierProvider(_x) {
|
|
103
103
|
return _updateContextIdentifierProvider.apply(this, arguments);
|
|
@@ -4,19 +4,39 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
4
4
|
import { formatShortcut, toggleTaskList } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { ToolbarDropdownItem, ToolbarKeyboardShortcutHint, TaskIcon } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
7
9
|
export var TaskListMenuItem = function TaskListMenuItem(_ref) {
|
|
8
10
|
var api = _ref.api;
|
|
9
11
|
var _useIntl = useIntl(),
|
|
10
12
|
formatMessage = _useIntl.formatMessage;
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
+
var isMarkdownToolbarEnabled = expValEqualsNoExposure('cc-markdown-mode', 'isEnabled', true) && fg('platform_editor_markdown_compatible_toolbar');
|
|
14
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['taskDecision', 'markdownMode'], function (states) {
|
|
15
|
+
var _states$taskDecisionS, _states$markdownModeS, _states$markdownModeS2, _states$markdownModeS3;
|
|
13
16
|
return {
|
|
14
|
-
isInsideTask: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask
|
|
17
|
+
isInsideTask: (_states$taskDecisionS = states.taskDecisionState) === null || _states$taskDecisionS === void 0 ? void 0 : _states$taskDecisionS.isInsideTask,
|
|
18
|
+
markdownView: isMarkdownToolbarEnabled ? (_states$markdownModeS = states.markdownModeState) === null || _states$markdownModeS === void 0 ? void 0 : _states$markdownModeS.view : undefined,
|
|
19
|
+
sourceBlockFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS2 = states.markdownModeState) === null || _states$markdownModeS2 === void 0 ? void 0 : _states$markdownModeS2.sourceBlockFormatState : null,
|
|
20
|
+
sourceListFormatState: isMarkdownToolbarEnabled ? (_states$markdownModeS3 = states.markdownModeState) === null || _states$markdownModeS3 === void 0 ? void 0 : _states$markdownModeS3.sourceListFormatState : null
|
|
15
21
|
};
|
|
16
22
|
}),
|
|
17
|
-
isInsideTask = _useSharedPluginState.isInsideTask
|
|
23
|
+
isInsideTask = _useSharedPluginState.isInsideTask,
|
|
24
|
+
markdownView = _useSharedPluginState.markdownView,
|
|
25
|
+
sourceBlockFormatState = _useSharedPluginState.sourceBlockFormatState,
|
|
26
|
+
sourceListFormatState = _useSharedPluginState.sourceListFormatState;
|
|
27
|
+
var isInSourceView = isMarkdownToolbarEnabled && markdownView === 'syntax';
|
|
28
|
+
var isSelected = isInSourceView ? sourceListFormatState === null || sourceListFormatState === void 0 ? void 0 : sourceListFormatState.inTaskList : isInsideTask;
|
|
29
|
+
var isDisabled = Boolean(isInSourceView && (sourceBlockFormatState === null || sourceBlockFormatState === void 0 ? void 0 : sourceBlockFormatState.inCodeBlock));
|
|
18
30
|
var handleClick = function handleClick() {
|
|
19
31
|
var _api$taskDecision;
|
|
32
|
+
if (isDisabled) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (isInSourceView) {
|
|
36
|
+
var _api$markdownMode;
|
|
37
|
+
api === null || api === void 0 || (_api$markdownMode = api.markdownMode) === null || _api$markdownMode === void 0 || _api$markdownMode.actions.toggleSourceTaskList();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
20
40
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$taskDecision = api.taskDecision) === null || _api$taskDecision === void 0 ? void 0 : _api$taskDecision.commands.toggleTaskList());
|
|
21
41
|
};
|
|
22
42
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
@@ -27,8 +47,8 @@ export var TaskListMenuItem = function TaskListMenuItem(_ref) {
|
|
|
27
47
|
elemAfter: /*#__PURE__*/React.createElement(ToolbarKeyboardShortcutHint, {
|
|
28
48
|
shortcut: formatShortcut(toggleTaskList)
|
|
29
49
|
}),
|
|
30
|
-
isSelected:
|
|
31
|
-
isDisabled:
|
|
50
|
+
isSelected: isSelected,
|
|
51
|
+
isDisabled: isDisabled,
|
|
32
52
|
onClick: handleClick,
|
|
33
53
|
ariaKeyshortcuts: formatShortcut(toggleTaskList)
|
|
34
54
|
}, formatMessage(tasksAndDecisionsMessages.taskList));
|
|
@@ -10,6 +10,26 @@ import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
|
|
|
10
10
|
import type { insertTaskDecisionCommand } from './pm-plugins/insert-commands';
|
|
11
11
|
import type { getIndentCommand, getUnindentCommand } from './pm-plugins/keymaps';
|
|
12
12
|
import type { TaskAndDecisionsSharedState, TasksAndDecisionsPluginOptions } from './types';
|
|
13
|
+
/**
|
|
14
|
+
* Minimal duck-typed slice of `@atlassian/editor-plugin-markdown-mode`'s
|
|
15
|
+
* `MarkdownModePlugin` covering only the task-list source-view surface this
|
|
16
|
+
* plugin uses. See `editor-plugin-text-formatting/textFormattingPluginType.ts`
|
|
17
|
+
* for the rationale for not importing the real type.
|
|
18
|
+
*/
|
|
19
|
+
type _MarkdownModePluginStub = NextEditorPlugin<'markdownMode', {
|
|
20
|
+
actions: {
|
|
21
|
+
toggleSourceTaskList: () => boolean;
|
|
22
|
+
};
|
|
23
|
+
sharedState: {
|
|
24
|
+
sourceBlockFormatState: {
|
|
25
|
+
inCodeBlock: boolean;
|
|
26
|
+
} | null;
|
|
27
|
+
sourceListFormatState: {
|
|
28
|
+
inTaskList: boolean;
|
|
29
|
+
} | null;
|
|
30
|
+
view: 'syntax' | 'split-view' | 'preview';
|
|
31
|
+
} | undefined;
|
|
32
|
+
}>;
|
|
13
33
|
export type TasksAndDecisionsPluginDependencies = [
|
|
14
34
|
OptionalPlugin<TypeAheadPlugin>,
|
|
15
35
|
OptionalPlugin<AnalyticsPlugin>,
|
|
@@ -17,7 +37,8 @@ export type TasksAndDecisionsPluginDependencies = [
|
|
|
17
37
|
OptionalPlugin<EditorViewModePlugin>,
|
|
18
38
|
OptionalPlugin<BlockMenuPlugin>,
|
|
19
39
|
OptionalPlugin<SelectionPlugin>,
|
|
20
|
-
OptionalPlugin<ToolbarPlugin
|
|
40
|
+
OptionalPlugin<ToolbarPlugin>,
|
|
41
|
+
OptionalPlugin<_MarkdownModePluginStub>
|
|
21
42
|
];
|
|
22
43
|
export type TasksAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
|
|
23
44
|
actions: {
|
|
@@ -35,3 +56,4 @@ export type TasksAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
|
|
|
35
56
|
pluginConfiguration: TasksAndDecisionsPluginOptions | undefined;
|
|
36
57
|
sharedState: TaskAndDecisionsSharedState | undefined;
|
|
37
58
|
}>;
|
|
59
|
+
export {};
|
|
@@ -10,6 +10,26 @@ import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
|
|
|
10
10
|
import type { insertTaskDecisionCommand } from './pm-plugins/insert-commands';
|
|
11
11
|
import type { getIndentCommand, getUnindentCommand } from './pm-plugins/keymaps';
|
|
12
12
|
import type { TaskAndDecisionsSharedState, TasksAndDecisionsPluginOptions } from './types';
|
|
13
|
+
/**
|
|
14
|
+
* Minimal duck-typed slice of `@atlassian/editor-plugin-markdown-mode`'s
|
|
15
|
+
* `MarkdownModePlugin` covering only the task-list source-view surface this
|
|
16
|
+
* plugin uses. See `editor-plugin-text-formatting/textFormattingPluginType.ts`
|
|
17
|
+
* for the rationale for not importing the real type.
|
|
18
|
+
*/
|
|
19
|
+
type _MarkdownModePluginStub = NextEditorPlugin<'markdownMode', {
|
|
20
|
+
actions: {
|
|
21
|
+
toggleSourceTaskList: () => boolean;
|
|
22
|
+
};
|
|
23
|
+
sharedState: {
|
|
24
|
+
sourceBlockFormatState: {
|
|
25
|
+
inCodeBlock: boolean;
|
|
26
|
+
} | null;
|
|
27
|
+
sourceListFormatState: {
|
|
28
|
+
inTaskList: boolean;
|
|
29
|
+
} | null;
|
|
30
|
+
view: 'syntax' | 'split-view' | 'preview';
|
|
31
|
+
} | undefined;
|
|
32
|
+
}>;
|
|
13
33
|
export type TasksAndDecisionsPluginDependencies = [
|
|
14
34
|
OptionalPlugin<TypeAheadPlugin>,
|
|
15
35
|
OptionalPlugin<AnalyticsPlugin>,
|
|
@@ -17,7 +37,8 @@ export type TasksAndDecisionsPluginDependencies = [
|
|
|
17
37
|
OptionalPlugin<EditorViewModePlugin>,
|
|
18
38
|
OptionalPlugin<BlockMenuPlugin>,
|
|
19
39
|
OptionalPlugin<SelectionPlugin>,
|
|
20
|
-
OptionalPlugin<ToolbarPlugin
|
|
40
|
+
OptionalPlugin<ToolbarPlugin>,
|
|
41
|
+
OptionalPlugin<_MarkdownModePluginStub>
|
|
21
42
|
];
|
|
22
43
|
export type TasksAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
|
|
23
44
|
actions: {
|
|
@@ -35,3 +56,4 @@ export type TasksAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
|
|
|
35
56
|
pluginConfiguration: TasksAndDecisionsPluginOptions | undefined;
|
|
36
57
|
sharedState: TaskAndDecisionsSharedState | undefined;
|
|
37
58
|
}>;
|
|
59
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-tasks-and-decisions",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.0",
|
|
4
4
|
"description": "Tasks and decisions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^52.
|
|
32
|
+
"@atlaskit/adf-schema": "^52.15.0",
|
|
33
33
|
"@atlaskit/analytics-namespaced-context": "^7.3.0",
|
|
34
34
|
"@atlaskit/css": "^0.19.0",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^10.1.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/editor-plugin-type-ahead": "^10.2.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
44
|
-
"@atlaskit/editor-toolbar": "^1.
|
|
44
|
+
"@atlaskit/editor-toolbar": "^1.8.0",
|
|
45
45
|
"@atlaskit/editor-toolbar-model": "^0.5.0",
|
|
46
46
|
"@atlaskit/heading": "^5.4.0",
|
|
47
47
|
"@atlaskit/icon": "^35.3.0",
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
"@atlaskit/primitives": "^19.0.0",
|
|
50
50
|
"@atlaskit/prosemirror-input-rules": "^3.7.0",
|
|
51
51
|
"@atlaskit/task-decision": "^20.1.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^84.
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^84.2.0",
|
|
53
53
|
"@atlaskit/tokens": "^13.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@compiled/react": "^0.20.0",
|
|
56
56
|
"bind-event-listener": "^3.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@atlaskit/editor-common": "^114.
|
|
59
|
+
"@atlaskit/editor-common": "^114.48.0",
|
|
60
60
|
"react": "^18.2.0",
|
|
61
61
|
"react-dom": "^18.2.0",
|
|
62
62
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -110,6 +110,9 @@
|
|
|
110
110
|
},
|
|
111
111
|
"platform_editor_toolbar_task_list_analytics": {
|
|
112
112
|
"type": "boolean"
|
|
113
|
+
},
|
|
114
|
+
"platform_editor_markdown_compatible_toolbar": {
|
|
115
|
+
"type": "boolean"
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
}
|