@atlaskit/editor-plugin-tasks-and-decisions 6.4.6 → 6.5.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 +23 -0
- package/dist/cjs/nodeviews/TaskItemNodeView.js +5 -0
- package/dist/cjs/nodeviews/taskItemNodeSpec.js +7 -0
- package/dist/cjs/nodeviews/utils.js +16 -0
- package/dist/cjs/pm-plugins/commands.js +4 -1
- package/dist/cjs/pm-plugins/helpers.js +17 -4
- package/dist/cjs/pm-plugins/keymaps.js +4 -1
- package/dist/cjs/tasksAndDecisionsPlugin.js +20 -0
- package/dist/cjs/ui/TaskListBlockMenuItem/TaskListBlockMenuItem.js +35 -0
- package/dist/es2019/nodeviews/TaskItemNodeView.js +6 -1
- package/dist/es2019/nodeviews/taskItemNodeSpec.js +8 -1
- package/dist/es2019/nodeviews/utils.js +10 -0
- package/dist/es2019/pm-plugins/commands.js +4 -1
- package/dist/es2019/pm-plugins/helpers.js +17 -4
- package/dist/es2019/pm-plugins/keymaps.js +4 -1
- package/dist/es2019/tasksAndDecisionsPlugin.js +18 -0
- package/dist/es2019/ui/TaskListBlockMenuItem/TaskListBlockMenuItem.js +28 -0
- package/dist/esm/nodeviews/TaskItemNodeView.js +5 -0
- package/dist/esm/nodeviews/taskItemNodeSpec.js +7 -0
- package/dist/esm/nodeviews/utils.js +10 -0
- package/dist/esm/pm-plugins/commands.js +4 -1
- package/dist/esm/pm-plugins/helpers.js +17 -4
- package/dist/esm/pm-plugins/keymaps.js +4 -1
- package/dist/esm/tasksAndDecisionsPlugin.js +20 -0
- package/dist/esm/ui/TaskListBlockMenuItem/TaskListBlockMenuItem.js +26 -0
- package/dist/types/nodeviews/utils.d.ts +2 -0
- package/dist/types/pm-plugins/helpers.d.ts +5 -1
- package/dist/types/tasksAndDecisionsPluginType.d.ts +5 -1
- package/dist/types/ui/TaskListBlockMenuItem/TaskListBlockMenuItem.d.ts +6 -0
- package/dist/types-ts4.5/nodeviews/utils.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/helpers.d.ts +5 -1
- package/dist/types-ts4.5/tasksAndDecisionsPluginType.d.ts +5 -1
- package/dist/types-ts4.5/ui/TaskListBlockMenuItem/TaskListBlockMenuItem.d.ts +6 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-tasks-and-decisions
|
|
2
2
|
|
|
3
|
+
## 6.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`bfd653291c561`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bfd653291c561) -
|
|
8
|
+
[ux] ED-29018 Register taskList dropdown item and add menu item keys
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 6.4.7
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
|
|
19
|
+
EDITOR-1442 Bump adf-schema
|
|
20
|
+
- [`14592f727f369`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/14592f727f369) -
|
|
21
|
+
[EDITOR-1153] Patch bug with undenting blockTaskItems
|
|
22
|
+
- [`016e787a561d9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/016e787a561d9) -
|
|
23
|
+
EDITOR-1149 Ensuring placeholder displays correctly for blockTaskItem
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 6.4.6
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -13,8 +13,10 @@ var _steps = require("@atlaskit/adf-schema/steps");
|
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
17
|
var _helpers = require("../pm-plugins/helpers");
|
|
17
18
|
var _taskItemNodeSpec = require("./taskItemNodeSpec");
|
|
19
|
+
var _utils = require("./utils");
|
|
18
20
|
var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
|
|
19
21
|
function TaskItemNodeView(node, view, getPos, _ref) {
|
|
20
22
|
var _this = this;
|
|
@@ -132,6 +134,9 @@ var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
|
|
|
132
134
|
key: "updatePlaceholder",
|
|
133
135
|
value: function updatePlaceholder(node) {
|
|
134
136
|
var currentIsContentEmpty = this.isContentEmpty(node);
|
|
137
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_blocktaskitem_node', 'isEnabled', true)) {
|
|
138
|
+
currentIsContentEmpty = (0, _utils.isContentEmpty)(node);
|
|
139
|
+
}
|
|
135
140
|
if (currentIsContentEmpty !== this.emptyContent) {
|
|
136
141
|
var _this$contentDOM;
|
|
137
142
|
this.emptyContent = currentIsContentEmpty;
|
|
@@ -11,7 +11,9 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
11
11
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
14
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
|
+
var _utils = require("./utils");
|
|
15
17
|
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; }
|
|
16
18
|
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) { (0, _defineProperty2.default)(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; }
|
|
17
19
|
/**
|
|
@@ -84,6 +86,11 @@ function taskItemToDom(node, placeholder, intl) {
|
|
|
84
86
|
var contentDomDataAttrs = node.content.childCount > 0 ? {} : {
|
|
85
87
|
'data-empty': 'true'
|
|
86
88
|
};
|
|
89
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_blocktaskitem_node', 'isEnabled', true)) {
|
|
90
|
+
contentDomDataAttrs = (0, _utils.isContentEmpty)(node) ? {
|
|
91
|
+
'data-empty': 'true'
|
|
92
|
+
} : {};
|
|
93
|
+
}
|
|
87
94
|
return ['div', _objectSpread(_objectSpread({
|
|
88
95
|
class: "".concat(_styles.TaskDecisionSharedCssClassName.TASK_CONTAINER)
|
|
89
96
|
}, dataAttrs), {}, {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isContentEmpty = void 0;
|
|
7
|
+
var isContentEmpty = exports.isContentEmpty = function isContentEmpty(node) {
|
|
8
|
+
if (node.content.childCount === 0) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (node.type.name === 'blockTaskItem') {
|
|
12
|
+
var _node$content$firstCh, _node$content$firstCh2;
|
|
13
|
+
return node.content.childCount === 1 && ((_node$content$firstCh = node.content.firstChild) === null || _node$content$firstCh === void 0 ? void 0 : _node$content$firstCh.type.name) === 'paragraph' && ((_node$content$firstCh2 = node.content.firstChild) === null || _node$content$firstCh2 === void 0 ? void 0 : _node$content$firstCh2.childCount) === 0;
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
};
|
|
@@ -65,7 +65,10 @@ var wrapSelectionInTaskList = exports.wrapSelectionInTaskList = function wrapSel
|
|
|
65
65
|
if (maxDepth >= 6) {
|
|
66
66
|
return true;
|
|
67
67
|
}
|
|
68
|
-
var blockRange = (0, _helpers.getBlockRange)(
|
|
68
|
+
var blockRange = (0, _helpers.getBlockRange)({
|
|
69
|
+
$from: $from,
|
|
70
|
+
$to: $to
|
|
71
|
+
});
|
|
69
72
|
if (!blockRange) {
|
|
70
73
|
return true;
|
|
71
74
|
}
|
|
@@ -72,7 +72,11 @@ var isTable = exports.isTable = function isTable(node) {
|
|
|
72
72
|
* Creates a NodeRange around the given taskItem and the following
|
|
73
73
|
* ("nested") taskList, if one exists.
|
|
74
74
|
*/
|
|
75
|
-
var getBlockRange = exports.getBlockRange = function getBlockRange(
|
|
75
|
+
var getBlockRange = exports.getBlockRange = function getBlockRange(_ref) {
|
|
76
|
+
var $from = _ref.$from,
|
|
77
|
+
$to = _ref.$to,
|
|
78
|
+
_ref$isLifting = _ref.isLifting,
|
|
79
|
+
isLifting = _ref$isLifting === void 0 ? false : _ref$isLifting;
|
|
76
80
|
var _$from$doc$type$schem = $from.doc.type.schema.nodes,
|
|
77
81
|
taskList = _$from$doc$type$schem.taskList,
|
|
78
82
|
blockTaskItem = _$from$doc$type$schem.blockTaskItem;
|
|
@@ -83,7 +87,9 @@ var getBlockRange = exports.getBlockRange = function getBlockRange($from, $to) {
|
|
|
83
87
|
var startOfNodeInBlockTaskItem = $from.doc.resolve(blockTaskItemNode.start);
|
|
84
88
|
var lastNode = $to.node($to.depth);
|
|
85
89
|
var endOfNodeInBlockTaskItem = $from.doc.resolve($to.start() + lastNode.nodeSize - 1);
|
|
86
|
-
return new _model.NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem,
|
|
90
|
+
return new _model.NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem,
|
|
91
|
+
// When lifting we want to ignore the potential depth of nested nodes so reduce the depth
|
|
92
|
+
isLifting ? blockTaskItemNode.depth - 2 : blockTaskItemNode.depth - 1);
|
|
87
93
|
}
|
|
88
94
|
var end = $to.end();
|
|
89
95
|
var $after = $to.doc.resolve(end + 1);
|
|
@@ -197,7 +203,10 @@ var subtreeHeight = exports.subtreeHeight = function subtreeHeight($from, $to, t
|
|
|
197
203
|
//
|
|
198
204
|
// this is unlike regular bullet lists where the orderedList
|
|
199
205
|
// appears as descendent of listItem
|
|
200
|
-
var blockRange = getBlockRange(
|
|
206
|
+
var blockRange = getBlockRange({
|
|
207
|
+
$from: $from,
|
|
208
|
+
$to: $to
|
|
209
|
+
});
|
|
201
210
|
if (!blockRange) {
|
|
202
211
|
return -1;
|
|
203
212
|
}
|
|
@@ -236,7 +245,11 @@ var isEmptyTaskDecision = exports.isEmptyTaskDecision = function isEmptyTaskDeci
|
|
|
236
245
|
* @param $to End of range you want to lift (can be same as `$from`)
|
|
237
246
|
*/
|
|
238
247
|
var liftBlock = exports.liftBlock = function liftBlock(tr, $from, $to) {
|
|
239
|
-
var blockRange = getBlockRange(
|
|
248
|
+
var blockRange = getBlockRange({
|
|
249
|
+
$from: $from,
|
|
250
|
+
$to: $to,
|
|
251
|
+
isLifting: true
|
|
252
|
+
});
|
|
240
253
|
if (!blockRange) {
|
|
241
254
|
return null;
|
|
242
255
|
}
|
|
@@ -307,7 +307,10 @@ var splitListItemWith = function splitListItemWith(tr, content, $from, setSelect
|
|
|
307
307
|
// getBlockRange expects to be inside the taskItem
|
|
308
308
|
var pos = tr.mapping.map($oldAfter.pos + 2);
|
|
309
309
|
var $after = tr.doc.resolve(pos);
|
|
310
|
-
var blockRange = (0, _helpers.getBlockRange)(
|
|
310
|
+
var blockRange = (0, _helpers.getBlockRange)({
|
|
311
|
+
$from: $after,
|
|
312
|
+
$to: tr.doc.resolve($after.after($after.depth - 1) - 1)
|
|
313
|
+
});
|
|
311
314
|
if (blockRange) {
|
|
312
315
|
tr = tr.lift(blockRange, blockRange.depth - 1).scrollIntoView();
|
|
313
316
|
}
|
|
@@ -15,12 +15,14 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
15
15
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
16
16
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
17
17
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
18
|
+
var _blockMenu = require("@atlaskit/editor-common/block-menu");
|
|
18
19
|
var _indentation = require("@atlaskit/editor-common/indentation");
|
|
19
20
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
20
21
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
21
22
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
22
23
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
23
24
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
25
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
24
26
|
var _taskItemNodeSpec = require("./nodeviews/taskItemNodeSpec");
|
|
25
27
|
var _decisionItem = require("./nodeviews/toDOM-fixes/decisionItem");
|
|
26
28
|
var _helpers = require("./pm-plugins/helpers");
|
|
@@ -30,6 +32,7 @@ var _keymaps = _interopRequireWildcard(require("./pm-plugins/keymaps"));
|
|
|
30
32
|
var _main = require("./pm-plugins/main");
|
|
31
33
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
32
34
|
var _RequestToEditPopup = require("./ui/Task/RequestToEditPopup");
|
|
35
|
+
var _TaskListBlockMenuItem = require("./ui/TaskListBlockMenuItem/TaskListBlockMenuItem");
|
|
33
36
|
var _ToolbarDecision = _interopRequireDefault(require("./ui/ToolbarDecision"));
|
|
34
37
|
var _ToolbarTask = _interopRequireDefault(require("./ui/ToolbarTask"));
|
|
35
38
|
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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -110,6 +113,23 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
110
113
|
});
|
|
111
114
|
});
|
|
112
115
|
}
|
|
116
|
+
if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
117
|
+
var _api$blockMenu;
|
|
118
|
+
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
119
|
+
type: 'block-menu-item',
|
|
120
|
+
key: _blockMenu.FORMAT_TASK_LIST_MENU_ITEM.key,
|
|
121
|
+
parent: {
|
|
122
|
+
type: 'block-menu-section',
|
|
123
|
+
key: _blockMenu.NESTED_FORMAT_MENU_SECTION.key,
|
|
124
|
+
rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_TASK_LIST_MENU_ITEM.key]
|
|
125
|
+
},
|
|
126
|
+
component: function component() {
|
|
127
|
+
return /*#__PURE__*/React.createElement(_TaskListBlockMenuItem.TaskListBlockMenuItem, {
|
|
128
|
+
api: api
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}]);
|
|
132
|
+
}
|
|
113
133
|
return {
|
|
114
134
|
name: 'taskDecision',
|
|
115
135
|
nodes: function nodes() {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.TaskListBlockMenuItem = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactIntlNext = require("react-intl-next");
|
|
11
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
13
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
14
|
+
var _task = _interopRequireDefault(require("@atlaskit/icon/core/task"));
|
|
15
|
+
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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
|
+
var TaskListBlockMenuItem = exports.TaskListBlockMenuItem = function TaskListBlockMenuItem(_ref) {
|
|
17
|
+
var api = _ref.api;
|
|
18
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
19
|
+
formatMessage = _useIntl.formatMessage;
|
|
20
|
+
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
21
|
+
var isSelected = (0, _react.useMemo)(function () {
|
|
22
|
+
return selection && selection.$from.parent.type.name === 'taskItem';
|
|
23
|
+
}, [selection]);
|
|
24
|
+
var onClick = function onClick() {
|
|
25
|
+
var _api$blockMenu;
|
|
26
|
+
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'));
|
|
27
|
+
};
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
29
|
+
isSelected: isSelected,
|
|
30
|
+
onClick: onClick,
|
|
31
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_task.default, {
|
|
32
|
+
label: ""
|
|
33
|
+
})
|
|
34
|
+
}, formatMessage(_messages.tasksAndDecisionsMessages.taskList));
|
|
35
|
+
};
|
|
@@ -4,8 +4,10 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
|
4
4
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
8
|
import { openRequestEditPopupAt } from '../pm-plugins/helpers';
|
|
8
9
|
import { taskItemToDom } from './taskItemNodeSpec';
|
|
10
|
+
import { isContentEmpty } from './utils';
|
|
9
11
|
export class TaskItemNodeView {
|
|
10
12
|
constructor(node, view, getPos, {
|
|
11
13
|
api,
|
|
@@ -117,7 +119,10 @@ export class TaskItemNodeView {
|
|
|
117
119
|
|
|
118
120
|
// Update the placeholder visibility based on content
|
|
119
121
|
updatePlaceholder(node) {
|
|
120
|
-
|
|
122
|
+
let currentIsContentEmpty = this.isContentEmpty(node);
|
|
123
|
+
if (expValEquals('platform_editor_blocktaskitem_node', 'isEnabled', true)) {
|
|
124
|
+
currentIsContentEmpty = isContentEmpty(node);
|
|
125
|
+
}
|
|
121
126
|
if (currentIsContentEmpty !== this.emptyContent) {
|
|
122
127
|
var _this$contentDOM;
|
|
123
128
|
this.emptyContent = currentIsContentEmpty;
|
|
@@ -2,7 +2,9 @@ import { taskItem, blockTaskItemStage0 as blockTaskItem } from '@atlaskit/adf-sc
|
|
|
2
2
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
3
3
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { TaskDecisionSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
|
+
import { isContentEmpty } from './utils';
|
|
6
8
|
/**
|
|
7
9
|
* Wrapper for ADF taskItem node spec to augment toDOM implementation
|
|
8
10
|
* with fallback UI for lazy node view rendering / window virtualization
|
|
@@ -67,9 +69,14 @@ export function taskItemToDom(node, placeholder, intl) {
|
|
|
67
69
|
'data-task-is-block': 'true'
|
|
68
70
|
} : {})
|
|
69
71
|
};
|
|
70
|
-
|
|
72
|
+
let contentDomDataAttrs = node.content.childCount > 0 ? {} : {
|
|
71
73
|
'data-empty': 'true'
|
|
72
74
|
};
|
|
75
|
+
if (expValEquals('platform_editor_blocktaskitem_node', 'isEnabled', true)) {
|
|
76
|
+
contentDomDataAttrs = isContentEmpty(node) ? {
|
|
77
|
+
'data-empty': 'true'
|
|
78
|
+
} : {};
|
|
79
|
+
}
|
|
73
80
|
return ['div', {
|
|
74
81
|
class: `${TaskDecisionSharedCssClassName.TASK_CONTAINER}`,
|
|
75
82
|
...dataAttrs,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const isContentEmpty = node => {
|
|
2
|
+
if (node.content.childCount === 0) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
if (node.type.name === 'blockTaskItem') {
|
|
6
|
+
var _node$content$firstCh, _node$content$firstCh2;
|
|
7
|
+
return node.content.childCount === 1 && ((_node$content$firstCh = node.content.firstChild) === null || _node$content$firstCh === void 0 ? void 0 : _node$content$firstCh.type.name) === 'paragraph' && ((_node$content$firstCh2 = node.content.firstChild) === null || _node$content$firstCh2 === void 0 ? void 0 : _node$content$firstCh2.childCount) === 0;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
};
|
|
@@ -61,7 +61,10 @@ export const wrapSelectionInTaskList = (state, dispatch) => {
|
|
|
61
61
|
if (maxDepth >= 6) {
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
|
-
const blockRange = getBlockRange(
|
|
64
|
+
const blockRange = getBlockRange({
|
|
65
|
+
$from,
|
|
66
|
+
$to
|
|
67
|
+
});
|
|
65
68
|
if (!blockRange) {
|
|
66
69
|
return true;
|
|
67
70
|
}
|
|
@@ -61,7 +61,11 @@ export const isTable = node => {
|
|
|
61
61
|
* Creates a NodeRange around the given taskItem and the following
|
|
62
62
|
* ("nested") taskList, if one exists.
|
|
63
63
|
*/
|
|
64
|
-
export const getBlockRange = (
|
|
64
|
+
export const getBlockRange = ({
|
|
65
|
+
$from,
|
|
66
|
+
$to,
|
|
67
|
+
isLifting = false
|
|
68
|
+
}) => {
|
|
65
69
|
const {
|
|
66
70
|
taskList,
|
|
67
71
|
blockTaskItem
|
|
@@ -71,7 +75,9 @@ export const getBlockRange = ($from, $to) => {
|
|
|
71
75
|
const startOfNodeInBlockTaskItem = $from.doc.resolve(blockTaskItemNode.start);
|
|
72
76
|
const lastNode = $to.node($to.depth);
|
|
73
77
|
const endOfNodeInBlockTaskItem = $from.doc.resolve($to.start() + lastNode.nodeSize - 1);
|
|
74
|
-
return new NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem,
|
|
78
|
+
return new NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem,
|
|
79
|
+
// When lifting we want to ignore the potential depth of nested nodes so reduce the depth
|
|
80
|
+
isLifting ? blockTaskItemNode.depth - 2 : blockTaskItemNode.depth - 1);
|
|
75
81
|
}
|
|
76
82
|
let end = $to.end();
|
|
77
83
|
const $after = $to.doc.resolve(end + 1);
|
|
@@ -180,7 +186,10 @@ export const subtreeHeight = ($from, $to, types) => {
|
|
|
180
186
|
//
|
|
181
187
|
// this is unlike regular bullet lists where the orderedList
|
|
182
188
|
// appears as descendent of listItem
|
|
183
|
-
const blockRange = getBlockRange(
|
|
189
|
+
const blockRange = getBlockRange({
|
|
190
|
+
$from,
|
|
191
|
+
$to
|
|
192
|
+
});
|
|
184
193
|
if (!blockRange) {
|
|
185
194
|
return -1;
|
|
186
195
|
}
|
|
@@ -223,7 +232,11 @@ export const isEmptyTaskDecision = state => {
|
|
|
223
232
|
* @param $to End of range you want to lift (can be same as `$from`)
|
|
224
233
|
*/
|
|
225
234
|
export const liftBlock = (tr, $from, $to) => {
|
|
226
|
-
const blockRange = getBlockRange(
|
|
235
|
+
const blockRange = getBlockRange({
|
|
236
|
+
$from,
|
|
237
|
+
$to,
|
|
238
|
+
isLifting: true
|
|
239
|
+
});
|
|
227
240
|
if (!blockRange) {
|
|
228
241
|
return null;
|
|
229
242
|
}
|
|
@@ -282,7 +282,10 @@ const splitListItemWith = (tr, content, $from, setSelection) => {
|
|
|
282
282
|
// getBlockRange expects to be inside the taskItem
|
|
283
283
|
const pos = tr.mapping.map($oldAfter.pos + 2);
|
|
284
284
|
const $after = tr.doc.resolve(pos);
|
|
285
|
-
const blockRange = getBlockRange(
|
|
285
|
+
const blockRange = getBlockRange({
|
|
286
|
+
$from: $after,
|
|
287
|
+
$to: tr.doc.resolve($after.after($after.depth - 1) - 1)
|
|
288
|
+
});
|
|
286
289
|
if (blockRange) {
|
|
287
290
|
tr = tr.lift(blockRange, blockRange.depth - 1).scrollIntoView();
|
|
288
291
|
}
|
|
@@ -4,12 +4,14 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { decisionList, taskList } from '@atlaskit/adf-schema';
|
|
6
6
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
|
+
import { FORMAT_TASK_LIST_MENU_ITEM, FORMAT_NESTED_MENU_RANK, NESTED_FORMAT_MENU_SECTION } from '@atlaskit/editor-common/block-menu';
|
|
7
8
|
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
8
9
|
import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
9
10
|
import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
|
|
10
11
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
11
12
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
12
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
13
15
|
import { taskItemNodeSpec, blockTaskItemNodeSpec } from './nodeviews/taskItemNodeSpec';
|
|
14
16
|
import { decisionItemSpecWithFixedToDOM } from './nodeviews/toDOM-fixes/decisionItem';
|
|
15
17
|
import { closeRequestEditPopupAt, getCurrentIndentLevel, getTaskItemIndex, isInsideTask } from './pm-plugins/helpers';
|
|
@@ -21,6 +23,7 @@ import keymap, { getIndentCommand, getUnindentCommand } from './pm-plugins/keyma
|
|
|
21
23
|
import { createPlugin } from './pm-plugins/main';
|
|
22
24
|
import { stateKey as taskPluginKey } from './pm-plugins/plugin-key';
|
|
23
25
|
import { RequestToEditPopup } from './ui/Task/RequestToEditPopup';
|
|
26
|
+
import { TaskListBlockMenuItem } from './ui/TaskListBlockMenuItem/TaskListBlockMenuItem';
|
|
24
27
|
import ToolbarDecision from './ui/ToolbarDecision';
|
|
25
28
|
import ToolbarTask from './ui/ToolbarTask';
|
|
26
29
|
const taskDecisionToolbarGroupStyles = null;
|
|
@@ -98,6 +101,21 @@ export const tasksAndDecisionsPlugin = ({
|
|
|
98
101
|
}) => setProvider(provider)(tr));
|
|
99
102
|
});
|
|
100
103
|
}
|
|
104
|
+
if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
105
|
+
var _api$blockMenu;
|
|
106
|
+
api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
107
|
+
type: 'block-menu-item',
|
|
108
|
+
key: FORMAT_TASK_LIST_MENU_ITEM.key,
|
|
109
|
+
parent: {
|
|
110
|
+
type: 'block-menu-section',
|
|
111
|
+
key: NESTED_FORMAT_MENU_SECTION.key,
|
|
112
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_TASK_LIST_MENU_ITEM.key]
|
|
113
|
+
},
|
|
114
|
+
component: () => /*#__PURE__*/React.createElement(TaskListBlockMenuItem, {
|
|
115
|
+
api: api
|
|
116
|
+
})
|
|
117
|
+
}]);
|
|
118
|
+
}
|
|
101
119
|
return {
|
|
102
120
|
name: 'taskDecision',
|
|
103
121
|
nodes() {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import TaskIcon from '@atlaskit/icon/core/task';
|
|
7
|
+
export const TaskListBlockMenuItem = ({
|
|
8
|
+
api
|
|
9
|
+
}) => {
|
|
10
|
+
const {
|
|
11
|
+
formatMessage
|
|
12
|
+
} = useIntl();
|
|
13
|
+
const selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
14
|
+
const isSelected = useMemo(() => {
|
|
15
|
+
return selection && selection.$from.parent.type.name === 'taskItem';
|
|
16
|
+
}, [selection]);
|
|
17
|
+
const onClick = () => {
|
|
18
|
+
var _api$blockMenu;
|
|
19
|
+
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'));
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
22
|
+
isSelected: isSelected,
|
|
23
|
+
onClick: onClick,
|
|
24
|
+
elemBefore: /*#__PURE__*/React.createElement(TaskIcon, {
|
|
25
|
+
label: ""
|
|
26
|
+
})
|
|
27
|
+
}, formatMessage(tasksAndDecisionsMessages.taskList));
|
|
28
|
+
};
|
|
@@ -6,8 +6,10 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
|
6
6
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
import { openRequestEditPopupAt } from '../pm-plugins/helpers';
|
|
10
11
|
import { taskItemToDom } from './taskItemNodeSpec';
|
|
12
|
+
import { isContentEmpty } from './utils';
|
|
11
13
|
export var TaskItemNodeView = /*#__PURE__*/function () {
|
|
12
14
|
function TaskItemNodeView(node, view, getPos, _ref) {
|
|
13
15
|
var _this = this;
|
|
@@ -125,6 +127,9 @@ export var TaskItemNodeView = /*#__PURE__*/function () {
|
|
|
125
127
|
key: "updatePlaceholder",
|
|
126
128
|
value: function updatePlaceholder(node) {
|
|
127
129
|
var currentIsContentEmpty = this.isContentEmpty(node);
|
|
130
|
+
if (expValEquals('platform_editor_blocktaskitem_node', 'isEnabled', true)) {
|
|
131
|
+
currentIsContentEmpty = isContentEmpty(node);
|
|
132
|
+
}
|
|
128
133
|
if (currentIsContentEmpty !== this.emptyContent) {
|
|
129
134
|
var _this$contentDOM;
|
|
130
135
|
this.emptyContent = currentIsContentEmpty;
|
|
@@ -5,7 +5,9 @@ import { taskItem, blockTaskItemStage0 as blockTaskItem } from '@atlaskit/adf-sc
|
|
|
5
5
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
6
6
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { TaskDecisionSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
|
+
import { isContentEmpty } from './utils';
|
|
9
11
|
/**
|
|
10
12
|
* Wrapper for ADF taskItem node spec to augment toDOM implementation
|
|
11
13
|
* with fallback UI for lazy node view rendering / window virtualization
|
|
@@ -76,6 +78,11 @@ export function taskItemToDom(node, placeholder, intl) {
|
|
|
76
78
|
var contentDomDataAttrs = node.content.childCount > 0 ? {} : {
|
|
77
79
|
'data-empty': 'true'
|
|
78
80
|
};
|
|
81
|
+
if (expValEquals('platform_editor_blocktaskitem_node', 'isEnabled', true)) {
|
|
82
|
+
contentDomDataAttrs = isContentEmpty(node) ? {
|
|
83
|
+
'data-empty': 'true'
|
|
84
|
+
} : {};
|
|
85
|
+
}
|
|
79
86
|
return ['div', _objectSpread(_objectSpread({
|
|
80
87
|
class: "".concat(TaskDecisionSharedCssClassName.TASK_CONTAINER)
|
|
81
88
|
}, dataAttrs), {}, {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var isContentEmpty = function isContentEmpty(node) {
|
|
2
|
+
if (node.content.childCount === 0) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
if (node.type.name === 'blockTaskItem') {
|
|
6
|
+
var _node$content$firstCh, _node$content$firstCh2;
|
|
7
|
+
return node.content.childCount === 1 && ((_node$content$firstCh = node.content.firstChild) === null || _node$content$firstCh === void 0 ? void 0 : _node$content$firstCh.type.name) === 'paragraph' && ((_node$content$firstCh2 = node.content.firstChild) === null || _node$content$firstCh2 === void 0 ? void 0 : _node$content$firstCh2.childCount) === 0;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
};
|
|
@@ -59,7 +59,10 @@ export var wrapSelectionInTaskList = function wrapSelectionInTaskList(state, dis
|
|
|
59
59
|
if (maxDepth >= 6) {
|
|
60
60
|
return true;
|
|
61
61
|
}
|
|
62
|
-
var blockRange = getBlockRange(
|
|
62
|
+
var blockRange = getBlockRange({
|
|
63
|
+
$from: $from,
|
|
64
|
+
$to: $to
|
|
65
|
+
});
|
|
63
66
|
if (!blockRange) {
|
|
64
67
|
return true;
|
|
65
68
|
}
|
|
@@ -54,7 +54,11 @@ export var isTable = function isTable(node) {
|
|
|
54
54
|
* Creates a NodeRange around the given taskItem and the following
|
|
55
55
|
* ("nested") taskList, if one exists.
|
|
56
56
|
*/
|
|
57
|
-
export var getBlockRange = function getBlockRange(
|
|
57
|
+
export var getBlockRange = function getBlockRange(_ref) {
|
|
58
|
+
var $from = _ref.$from,
|
|
59
|
+
$to = _ref.$to,
|
|
60
|
+
_ref$isLifting = _ref.isLifting,
|
|
61
|
+
isLifting = _ref$isLifting === void 0 ? false : _ref$isLifting;
|
|
58
62
|
var _$from$doc$type$schem = $from.doc.type.schema.nodes,
|
|
59
63
|
taskList = _$from$doc$type$schem.taskList,
|
|
60
64
|
blockTaskItem = _$from$doc$type$schem.blockTaskItem;
|
|
@@ -65,7 +69,9 @@ export var getBlockRange = function getBlockRange($from, $to) {
|
|
|
65
69
|
var startOfNodeInBlockTaskItem = $from.doc.resolve(blockTaskItemNode.start);
|
|
66
70
|
var lastNode = $to.node($to.depth);
|
|
67
71
|
var endOfNodeInBlockTaskItem = $from.doc.resolve($to.start() + lastNode.nodeSize - 1);
|
|
68
|
-
return new NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem,
|
|
72
|
+
return new NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem,
|
|
73
|
+
// When lifting we want to ignore the potential depth of nested nodes so reduce the depth
|
|
74
|
+
isLifting ? blockTaskItemNode.depth - 2 : blockTaskItemNode.depth - 1);
|
|
69
75
|
}
|
|
70
76
|
var end = $to.end();
|
|
71
77
|
var $after = $to.doc.resolve(end + 1);
|
|
@@ -179,7 +185,10 @@ export var subtreeHeight = function subtreeHeight($from, $to, types) {
|
|
|
179
185
|
//
|
|
180
186
|
// this is unlike regular bullet lists where the orderedList
|
|
181
187
|
// appears as descendent of listItem
|
|
182
|
-
var blockRange = getBlockRange(
|
|
188
|
+
var blockRange = getBlockRange({
|
|
189
|
+
$from: $from,
|
|
190
|
+
$to: $to
|
|
191
|
+
});
|
|
183
192
|
if (!blockRange) {
|
|
184
193
|
return -1;
|
|
185
194
|
}
|
|
@@ -218,7 +227,11 @@ export var isEmptyTaskDecision = function isEmptyTaskDecision(state) {
|
|
|
218
227
|
* @param $to End of range you want to lift (can be same as `$from`)
|
|
219
228
|
*/
|
|
220
229
|
export var liftBlock = function liftBlock(tr, $from, $to) {
|
|
221
|
-
var blockRange = getBlockRange(
|
|
230
|
+
var blockRange = getBlockRange({
|
|
231
|
+
$from: $from,
|
|
232
|
+
$to: $to,
|
|
233
|
+
isLifting: true
|
|
234
|
+
});
|
|
222
235
|
if (!blockRange) {
|
|
223
236
|
return null;
|
|
224
237
|
}
|
|
@@ -299,7 +299,10 @@ var splitListItemWith = function splitListItemWith(tr, content, $from, setSelect
|
|
|
299
299
|
// getBlockRange expects to be inside the taskItem
|
|
300
300
|
var pos = tr.mapping.map($oldAfter.pos + 2);
|
|
301
301
|
var $after = tr.doc.resolve(pos);
|
|
302
|
-
var blockRange = getBlockRange(
|
|
302
|
+
var blockRange = getBlockRange({
|
|
303
|
+
$from: $after,
|
|
304
|
+
$to: tr.doc.resolve($after.after($after.depth - 1) - 1)
|
|
305
|
+
});
|
|
303
306
|
if (blockRange) {
|
|
304
307
|
tr = tr.lift(blockRange, blockRange.depth - 1).scrollIntoView();
|
|
305
308
|
}
|
|
@@ -7,12 +7,14 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { decisionList, taskList } from '@atlaskit/adf-schema';
|
|
9
9
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
10
|
+
import { FORMAT_TASK_LIST_MENU_ITEM, FORMAT_NESTED_MENU_RANK, NESTED_FORMAT_MENU_SECTION } from '@atlaskit/editor-common/block-menu';
|
|
10
11
|
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
11
12
|
import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
12
13
|
import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
|
|
13
14
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
14
15
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
15
16
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
16
18
|
import { taskItemNodeSpec, blockTaskItemNodeSpec } from './nodeviews/taskItemNodeSpec';
|
|
17
19
|
import { decisionItemSpecWithFixedToDOM } from './nodeviews/toDOM-fixes/decisionItem';
|
|
18
20
|
import { closeRequestEditPopupAt, getCurrentIndentLevel, getTaskItemIndex, isInsideTask } from './pm-plugins/helpers';
|
|
@@ -24,6 +26,7 @@ import keymap, { getIndentCommand, getUnindentCommand } from './pm-plugins/keyma
|
|
|
24
26
|
import { createPlugin } from './pm-plugins/main';
|
|
25
27
|
import { stateKey as taskPluginKey } from './pm-plugins/plugin-key';
|
|
26
28
|
import { RequestToEditPopup } from './ui/Task/RequestToEditPopup';
|
|
29
|
+
import { TaskListBlockMenuItem } from './ui/TaskListBlockMenuItem/TaskListBlockMenuItem';
|
|
27
30
|
import ToolbarDecision from './ui/ToolbarDecision';
|
|
28
31
|
import ToolbarTask from './ui/ToolbarTask';
|
|
29
32
|
var taskDecisionToolbarGroupStyles = null;
|
|
@@ -101,6 +104,23 @@ export var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref3) {
|
|
|
101
104
|
});
|
|
102
105
|
});
|
|
103
106
|
}
|
|
107
|
+
if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
108
|
+
var _api$blockMenu;
|
|
109
|
+
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents([{
|
|
110
|
+
type: 'block-menu-item',
|
|
111
|
+
key: FORMAT_TASK_LIST_MENU_ITEM.key,
|
|
112
|
+
parent: {
|
|
113
|
+
type: 'block-menu-section',
|
|
114
|
+
key: NESTED_FORMAT_MENU_SECTION.key,
|
|
115
|
+
rank: FORMAT_NESTED_MENU_RANK[FORMAT_TASK_LIST_MENU_ITEM.key]
|
|
116
|
+
},
|
|
117
|
+
component: function component() {
|
|
118
|
+
return /*#__PURE__*/React.createElement(TaskListBlockMenuItem, {
|
|
119
|
+
api: api
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}]);
|
|
123
|
+
}
|
|
104
124
|
return {
|
|
105
125
|
name: 'taskDecision',
|
|
106
126
|
nodes: function nodes() {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
|
+
import TaskIcon from '@atlaskit/icon/core/task';
|
|
7
|
+
export var TaskListBlockMenuItem = function TaskListBlockMenuItem(_ref) {
|
|
8
|
+
var api = _ref.api;
|
|
9
|
+
var _useIntl = useIntl(),
|
|
10
|
+
formatMessage = _useIntl.formatMessage;
|
|
11
|
+
var selection = useSharedPluginStateSelector(api, 'selection.selection');
|
|
12
|
+
var isSelected = useMemo(function () {
|
|
13
|
+
return selection && selection.$from.parent.type.name === 'taskItem';
|
|
14
|
+
}, [selection]);
|
|
15
|
+
var onClick = function onClick() {
|
|
16
|
+
var _api$blockMenu;
|
|
17
|
+
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'));
|
|
18
|
+
};
|
|
19
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
20
|
+
isSelected: isSelected,
|
|
21
|
+
onClick: onClick,
|
|
22
|
+
elemBefore: /*#__PURE__*/React.createElement(TaskIcon, {
|
|
23
|
+
label: ""
|
|
24
|
+
})
|
|
25
|
+
}, formatMessage(tasksAndDecisionsMessages.taskList));
|
|
26
|
+
};
|
|
@@ -12,7 +12,11 @@ export declare const isTable: (node?: Node | null) => boolean;
|
|
|
12
12
|
* Creates a NodeRange around the given taskItem and the following
|
|
13
13
|
* ("nested") taskList, if one exists.
|
|
14
14
|
*/
|
|
15
|
-
export declare const getBlockRange: ($from
|
|
15
|
+
export declare const getBlockRange: ({ $from, $to, isLifting, }: {
|
|
16
|
+
$from: ResolvedPos;
|
|
17
|
+
$to: ResolvedPos;
|
|
18
|
+
isLifting?: boolean;
|
|
19
|
+
}) => NodeRange | null;
|
|
16
20
|
/**
|
|
17
21
|
* Calculates the current indent level of the selection within a task list in the ProseMirror document.
|
|
18
22
|
*
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
|
|
3
4
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
4
5
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
5
7
|
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
6
8
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
|
|
7
9
|
import type { insertTaskDecisionCommand } from './pm-plugins/insert-commands';
|
|
@@ -11,7 +13,9 @@ export type TasksAndDecisionsPluginDependencies = [
|
|
|
11
13
|
OptionalPlugin<TypeAheadPlugin>,
|
|
12
14
|
OptionalPlugin<AnalyticsPlugin>,
|
|
13
15
|
OptionalPlugin<ContextIdentifierPlugin>,
|
|
14
|
-
OptionalPlugin<EditorViewModePlugin
|
|
16
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
17
|
+
OptionalPlugin<BlockMenuPlugin>,
|
|
18
|
+
OptionalPlugin<SelectionPlugin>
|
|
15
19
|
];
|
|
16
20
|
export type TasksAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
|
|
17
21
|
actions: {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { TasksAndDecisionsPlugin } from '../../tasksAndDecisionsPluginType';
|
|
4
|
+
export declare const TaskListBlockMenuItem: ({ api, }: {
|
|
5
|
+
api: ExtractInjectionAPI<TasksAndDecisionsPlugin>;
|
|
6
|
+
}) => React.JSX.Element;
|
|
@@ -12,7 +12,11 @@ export declare const isTable: (node?: Node | null) => boolean;
|
|
|
12
12
|
* Creates a NodeRange around the given taskItem and the following
|
|
13
13
|
* ("nested") taskList, if one exists.
|
|
14
14
|
*/
|
|
15
|
-
export declare const getBlockRange: ($from
|
|
15
|
+
export declare const getBlockRange: ({ $from, $to, isLifting, }: {
|
|
16
|
+
$from: ResolvedPos;
|
|
17
|
+
$to: ResolvedPos;
|
|
18
|
+
isLifting?: boolean;
|
|
19
|
+
}) => NodeRange | null;
|
|
16
20
|
/**
|
|
17
21
|
* Calculates the current indent level of the selection within a task list in the ProseMirror document.
|
|
18
22
|
*
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
|
|
3
4
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
4
5
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
|
+
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
5
7
|
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
6
8
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision/types';
|
|
7
9
|
import type { insertTaskDecisionCommand } from './pm-plugins/insert-commands';
|
|
@@ -11,7 +13,9 @@ export type TasksAndDecisionsPluginDependencies = [
|
|
|
11
13
|
OptionalPlugin<TypeAheadPlugin>,
|
|
12
14
|
OptionalPlugin<AnalyticsPlugin>,
|
|
13
15
|
OptionalPlugin<ContextIdentifierPlugin>,
|
|
14
|
-
OptionalPlugin<EditorViewModePlugin
|
|
16
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
17
|
+
OptionalPlugin<BlockMenuPlugin>,
|
|
18
|
+
OptionalPlugin<SelectionPlugin>
|
|
15
19
|
];
|
|
16
20
|
export type TasksAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
|
|
17
21
|
actions: {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { TasksAndDecisionsPlugin } from '../../tasksAndDecisionsPluginType';
|
|
4
|
+
export declare const TaskListBlockMenuItem: ({ api, }: {
|
|
5
|
+
api: ExtractInjectionAPI<TasksAndDecisionsPlugin>;
|
|
6
|
+
}) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-tasks-and-decisions",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.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,16 +29,19 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^50.2.
|
|
32
|
+
"@atlaskit/adf-schema": "^50.2.3",
|
|
33
33
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
34
34
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
35
35
|
"@atlaskit/css": "^0.12.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-block-menu": "^0.0.19",
|
|
37
38
|
"@atlaskit/editor-plugin-context-identifier": "^3.0.0",
|
|
38
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-selection": "^3.2.0",
|
|
39
41
|
"@atlaskit/editor-plugin-type-ahead": "^3.1.0",
|
|
40
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
43
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
44
|
+
"@atlaskit/editor-toolbar": "^0.6.0",
|
|
42
45
|
"@atlaskit/heading": "^5.2.0",
|
|
43
46
|
"@atlaskit/icon": "^28.1.0",
|
|
44
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -46,14 +49,14 @@
|
|
|
46
49
|
"@atlaskit/primitives": "^14.12.0",
|
|
47
50
|
"@atlaskit/prosemirror-input-rules": "^3.4.0",
|
|
48
51
|
"@atlaskit/task-decision": "^19.2.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^11.12.0",
|
|
50
53
|
"@atlaskit/tokens": "^6.1.0",
|
|
51
54
|
"@babel/runtime": "^7.0.0",
|
|
52
55
|
"@compiled/react": "^0.18.3",
|
|
53
56
|
"bind-event-listener": "^3.0.0"
|
|
54
57
|
},
|
|
55
58
|
"peerDependencies": {
|
|
56
|
-
"@atlaskit/editor-common": "^107.
|
|
59
|
+
"@atlaskit/editor-common": "^107.35.0",
|
|
57
60
|
"react": "^18.2.0",
|
|
58
61
|
"react-dom": "^18.2.0",
|
|
59
62
|
"react-intl-next": "npm:react-intl@^5.18.1"
|