@atlaskit/editor-plugin-tasks-and-decisions 8.2.0 → 8.4.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 +22 -0
- package/dist/cjs/pm-plugins/toggle-tasklist-commands.js +45 -0
- package/dist/cjs/tasksAndDecisionsPlugin.js +6 -2
- package/dist/cjs/ui/Task/RequestToEditPopup.js +1 -1
- package/dist/es2019/pm-plugins/toggle-tasklist-commands.js +44 -0
- package/dist/es2019/tasksAndDecisionsPlugin.js +6 -2
- package/dist/es2019/ui/Task/RequestToEditPopup.js +1 -1
- package/dist/esm/pm-plugins/toggle-tasklist-commands.js +39 -0
- package/dist/esm/tasksAndDecisionsPlugin.js +6 -2
- package/dist/esm/ui/Task/RequestToEditPopup.js +1 -1
- package/dist/types/pm-plugins/toggle-tasklist-commands.d.ts +4 -0
- package/dist/types/tasksAndDecisionsPluginType.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/toggle-tasklist-commands.d.ts +4 -0
- package/dist/types-ts4.5/tasksAndDecisionsPluginType.d.ts +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-tasks-and-decisions
|
|
2
2
|
|
|
3
|
+
## 8.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`b367661ba720e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b367661ba720e) -
|
|
8
|
+
EDITOR-1562 bump adf-schema for afm
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 8.3.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [`cebd8f9171426`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cebd8f9171426) -
|
|
19
|
+
[ux] ED-29159 Implement transform task inside lists - handle logic
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 8.2.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toggleTaskList = void 0;
|
|
7
|
+
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
8
|
+
var toggleTaskList = exports.toggleTaskList = function toggleTaskList() {
|
|
9
|
+
var targetType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'paragraph';
|
|
10
|
+
return function (_ref) {
|
|
11
|
+
var tr = _ref.tr;
|
|
12
|
+
var nodes = tr.doc.type.schema.nodes;
|
|
13
|
+
var selection = tr.selection;
|
|
14
|
+
var _getFormattedNode = (0, _transforms.getFormattedNode)(tr),
|
|
15
|
+
node = _getFormattedNode.node,
|
|
16
|
+
pos = _getFormattedNode.pos;
|
|
17
|
+
if (node !== null && pos !== null) {
|
|
18
|
+
if ((0, _transforms.isBulletOrOrderedList)(node.type)) {
|
|
19
|
+
var context = {
|
|
20
|
+
sourceNode: node,
|
|
21
|
+
sourcePos: pos,
|
|
22
|
+
targetNodeType: nodes.taskList,
|
|
23
|
+
tr: tr
|
|
24
|
+
};
|
|
25
|
+
return (0, _transforms.transformBetweenListTypes)(context);
|
|
26
|
+
}
|
|
27
|
+
if ((0, _transforms.isTaskList)(node.type)) {
|
|
28
|
+
var _context = {
|
|
29
|
+
sourceNode: node,
|
|
30
|
+
sourcePos: pos,
|
|
31
|
+
targetNodeType: nodes[targetType],
|
|
32
|
+
tr: tr
|
|
33
|
+
};
|
|
34
|
+
return targetType === 'paragraph' ? (0, _transforms.transformTaskListToBlockNodes)(_context) : (0, _transforms.transformBetweenListTypes)(_context);
|
|
35
|
+
}
|
|
36
|
+
var $from = selection.$from,
|
|
37
|
+
$to = selection.$to;
|
|
38
|
+
var range = $from.blockRange($to);
|
|
39
|
+
if (range) {
|
|
40
|
+
return (0, _transforms.transformToTaskList)(tr, range, nodes.taskList, undefined, nodes);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return tr;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* tasksAndDecisionsPlugin.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* tasksAndDecisionsPlugin.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -31,6 +31,7 @@ var _insertCommands = require("./pm-plugins/insert-commands");
|
|
|
31
31
|
var _keymaps = _interopRequireWildcard(require("./pm-plugins/keymaps"));
|
|
32
32
|
var _main = require("./pm-plugins/main");
|
|
33
33
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
34
|
+
var _toggleTasklistCommands = require("./pm-plugins/toggle-tasklist-commands");
|
|
34
35
|
var _RequestToEditPopup = require("./ui/Task/RequestToEditPopup");
|
|
35
36
|
var _TaskListBlockMenuItem = require("./ui/TaskListBlockMenuItem/TaskListBlockMenuItem");
|
|
36
37
|
var _ToolbarDecision = _interopRequireDefault(require("./ui/ToolbarDecision"));
|
|
@@ -55,7 +56,6 @@ var addItem = function addItem(insert, listType, schema) {
|
|
|
55
56
|
};
|
|
56
57
|
function ContentComponent(_ref2) {
|
|
57
58
|
var editorView = _ref2.editorView,
|
|
58
|
-
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
59
59
|
popupsMountPoint = _ref2.popupsMountPoint,
|
|
60
60
|
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
61
61
|
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
@@ -172,6 +172,7 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
172
172
|
};
|
|
173
173
|
},
|
|
174
174
|
commands: {
|
|
175
|
+
toggleTaskList: _toggleTasklistCommands.toggleTaskList,
|
|
175
176
|
updateEditPermission: function updateEditPermission(hasEditPermission) {
|
|
176
177
|
return function (_ref5) {
|
|
177
178
|
var tr = _ref5.tr;
|
|
@@ -277,6 +278,9 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
277
278
|
popupsMountPoint = _ref10.popupsMountPoint,
|
|
278
279
|
popupsBoundariesElement = _ref10.popupsBoundariesElement,
|
|
279
280
|
popupsScrollableElement = _ref10.popupsScrollableElement;
|
|
281
|
+
if (!editorView) {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
280
284
|
return /*#__PURE__*/React.createElement(ContentComponent, {
|
|
281
285
|
dependencyApi: api,
|
|
282
286
|
editorView: editorView,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { transformBetweenListTypes, transformToTaskList, transformTaskListToBlockNodes, isBulletOrOrderedList, isTaskList, getFormattedNode } from '@atlaskit/editor-common/transforms';
|
|
2
|
+
export const toggleTaskList = (targetType = 'paragraph') => ({
|
|
3
|
+
tr
|
|
4
|
+
}) => {
|
|
5
|
+
const {
|
|
6
|
+
nodes
|
|
7
|
+
} = tr.doc.type.schema;
|
|
8
|
+
const {
|
|
9
|
+
selection
|
|
10
|
+
} = tr;
|
|
11
|
+
const {
|
|
12
|
+
node,
|
|
13
|
+
pos
|
|
14
|
+
} = getFormattedNode(tr);
|
|
15
|
+
if (node !== null && pos !== null) {
|
|
16
|
+
if (isBulletOrOrderedList(node.type)) {
|
|
17
|
+
const context = {
|
|
18
|
+
sourceNode: node,
|
|
19
|
+
sourcePos: pos,
|
|
20
|
+
targetNodeType: nodes.taskList,
|
|
21
|
+
tr
|
|
22
|
+
};
|
|
23
|
+
return transformBetweenListTypes(context);
|
|
24
|
+
}
|
|
25
|
+
if (isTaskList(node.type)) {
|
|
26
|
+
const context = {
|
|
27
|
+
sourceNode: node,
|
|
28
|
+
sourcePos: pos,
|
|
29
|
+
targetNodeType: nodes[targetType],
|
|
30
|
+
tr
|
|
31
|
+
};
|
|
32
|
+
return targetType === 'paragraph' ? transformTaskListToBlockNodes(context) : transformBetweenListTypes(context);
|
|
33
|
+
}
|
|
34
|
+
const {
|
|
35
|
+
$from,
|
|
36
|
+
$to
|
|
37
|
+
} = selection;
|
|
38
|
+
const range = $from.blockRange($to);
|
|
39
|
+
if (range) {
|
|
40
|
+
return transformToTaskList(tr, range, nodes.taskList, undefined, nodes);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return tr;
|
|
44
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* tasksAndDecisionsPlugin.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* tasksAndDecisionsPlugin.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import "./tasksAndDecisionsPlugin.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
@@ -22,6 +22,7 @@ import { getListTypes, insertTaskDecisionAction, insertTaskDecisionCommand, setP
|
|
|
22
22
|
import keymap, { getIndentCommand, getUnindentCommand } from './pm-plugins/keymaps';
|
|
23
23
|
import { createPlugin } from './pm-plugins/main';
|
|
24
24
|
import { stateKey as taskPluginKey } from './pm-plugins/plugin-key';
|
|
25
|
+
import { toggleTaskList } from './pm-plugins/toggle-tasklist-commands';
|
|
25
26
|
import { RequestToEditPopup } from './ui/Task/RequestToEditPopup';
|
|
26
27
|
import { TaskListBlockMenuItem } from './ui/TaskListBlockMenuItem/TaskListBlockMenuItem';
|
|
27
28
|
import ToolbarDecision from './ui/ToolbarDecision';
|
|
@@ -43,7 +44,6 @@ const addItem = (insert, listType, schema) => ({
|
|
|
43
44
|
};
|
|
44
45
|
function ContentComponent({
|
|
45
46
|
editorView,
|
|
46
|
-
dispatchAnalyticsEvent,
|
|
47
47
|
popupsMountPoint,
|
|
48
48
|
popupsBoundariesElement,
|
|
49
49
|
popupsScrollableElement,
|
|
@@ -158,6 +158,7 @@ export const tasksAndDecisionsPlugin = ({
|
|
|
158
158
|
};
|
|
159
159
|
},
|
|
160
160
|
commands: {
|
|
161
|
+
toggleTaskList,
|
|
161
162
|
updateEditPermission: hasEditPermission => ({
|
|
162
163
|
tr
|
|
163
164
|
}) => tr.setMeta(taskPluginKey, {
|
|
@@ -239,6 +240,9 @@ export const tasksAndDecisionsPlugin = ({
|
|
|
239
240
|
popupsBoundariesElement,
|
|
240
241
|
popupsScrollableElement
|
|
241
242
|
}) {
|
|
243
|
+
if (!editorView) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
242
246
|
return /*#__PURE__*/React.createElement(ContentComponent, {
|
|
243
247
|
dependencyApi: api,
|
|
244
248
|
editorView: editorView,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { transformBetweenListTypes, transformToTaskList, transformTaskListToBlockNodes, isBulletOrOrderedList, isTaskList, getFormattedNode } from '@atlaskit/editor-common/transforms';
|
|
2
|
+
export var toggleTaskList = function toggleTaskList() {
|
|
3
|
+
var targetType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'paragraph';
|
|
4
|
+
return function (_ref) {
|
|
5
|
+
var tr = _ref.tr;
|
|
6
|
+
var nodes = tr.doc.type.schema.nodes;
|
|
7
|
+
var selection = tr.selection;
|
|
8
|
+
var _getFormattedNode = getFormattedNode(tr),
|
|
9
|
+
node = _getFormattedNode.node,
|
|
10
|
+
pos = _getFormattedNode.pos;
|
|
11
|
+
if (node !== null && pos !== null) {
|
|
12
|
+
if (isBulletOrOrderedList(node.type)) {
|
|
13
|
+
var context = {
|
|
14
|
+
sourceNode: node,
|
|
15
|
+
sourcePos: pos,
|
|
16
|
+
targetNodeType: nodes.taskList,
|
|
17
|
+
tr: tr
|
|
18
|
+
};
|
|
19
|
+
return transformBetweenListTypes(context);
|
|
20
|
+
}
|
|
21
|
+
if (isTaskList(node.type)) {
|
|
22
|
+
var _context = {
|
|
23
|
+
sourceNode: node,
|
|
24
|
+
sourcePos: pos,
|
|
25
|
+
targetNodeType: nodes[targetType],
|
|
26
|
+
tr: tr
|
|
27
|
+
};
|
|
28
|
+
return targetType === 'paragraph' ? transformTaskListToBlockNodes(_context) : transformBetweenListTypes(_context);
|
|
29
|
+
}
|
|
30
|
+
var $from = selection.$from,
|
|
31
|
+
$to = selection.$to;
|
|
32
|
+
var range = $from.blockRange($to);
|
|
33
|
+
if (range) {
|
|
34
|
+
return transformToTaskList(tr, range, nodes.taskList, undefined, nodes);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return tr;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* tasksAndDecisionsPlugin.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* tasksAndDecisionsPlugin.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
4
|
import "./tasksAndDecisionsPlugin.compiled.css";
|
|
@@ -25,6 +25,7 @@ import { getListTypes, insertTaskDecisionAction, insertTaskDecisionCommand, setP
|
|
|
25
25
|
import keymap, { getIndentCommand, getUnindentCommand } from './pm-plugins/keymaps';
|
|
26
26
|
import { createPlugin } from './pm-plugins/main';
|
|
27
27
|
import { stateKey as taskPluginKey } from './pm-plugins/plugin-key';
|
|
28
|
+
import { toggleTaskList } from './pm-plugins/toggle-tasklist-commands';
|
|
28
29
|
import { RequestToEditPopup } from './ui/Task/RequestToEditPopup';
|
|
29
30
|
import { TaskListBlockMenuItem } from './ui/TaskListBlockMenuItem/TaskListBlockMenuItem';
|
|
30
31
|
import ToolbarDecision from './ui/ToolbarDecision';
|
|
@@ -46,7 +47,6 @@ var addItem = function addItem(insert, listType, schema) {
|
|
|
46
47
|
};
|
|
47
48
|
function ContentComponent(_ref2) {
|
|
48
49
|
var editorView = _ref2.editorView,
|
|
49
|
-
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
50
50
|
popupsMountPoint = _ref2.popupsMountPoint,
|
|
51
51
|
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
52
52
|
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
@@ -163,6 +163,7 @@ export var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref3) {
|
|
|
163
163
|
};
|
|
164
164
|
},
|
|
165
165
|
commands: {
|
|
166
|
+
toggleTaskList: toggleTaskList,
|
|
166
167
|
updateEditPermission: function updateEditPermission(hasEditPermission) {
|
|
167
168
|
return function (_ref5) {
|
|
168
169
|
var tr = _ref5.tr;
|
|
@@ -268,6 +269,9 @@ export var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref3) {
|
|
|
268
269
|
popupsMountPoint = _ref10.popupsMountPoint,
|
|
269
270
|
popupsBoundariesElement = _ref10.popupsBoundariesElement,
|
|
270
271
|
popupsScrollableElement = _ref10.popupsScrollableElement;
|
|
272
|
+
if (!editorView) {
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
271
275
|
return /*#__PURE__*/React.createElement(ContentComponent, {
|
|
272
276
|
dependencyApi: api,
|
|
273
277
|
editorView: editorView,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* RequestToEditPopup.tsx generated by @compiled/babel-plugin v0.
|
|
1
|
+
/* RequestToEditPopup.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import "./RequestToEditPopup.compiled.css";
|
|
4
4
|
import * as React from 'react';
|
|
@@ -25,6 +25,7 @@ export type TasksAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
|
|
|
25
25
|
setProvider: (provider: Promise<TaskDecisionProvider>) => Promise<boolean>;
|
|
26
26
|
};
|
|
27
27
|
commands: {
|
|
28
|
+
toggleTaskList: (targetType?: 'orderedList' | 'bulletList' | 'paragraph') => EditorCommand;
|
|
28
29
|
updateEditPermission: (hasEditPermission: boolean | undefined) => EditorCommand;
|
|
29
30
|
updateHasRequestedEditPermission: (hasRequestedEditPermission: boolean) => EditorCommand;
|
|
30
31
|
};
|
|
@@ -25,6 +25,7 @@ export type TasksAndDecisionsPlugin = NextEditorPlugin<'taskDecision', {
|
|
|
25
25
|
setProvider: (provider: Promise<TaskDecisionProvider>) => Promise<boolean>;
|
|
26
26
|
};
|
|
27
27
|
commands: {
|
|
28
|
+
toggleTaskList: (targetType?: 'orderedList' | 'bulletList' | 'paragraph') => EditorCommand;
|
|
28
29
|
updateEditPermission: (hasEditPermission: boolean | undefined) => EditorCommand;
|
|
29
30
|
updateHasRequestedEditPermission: (hasRequestedEditPermission: boolean) => EditorCommand;
|
|
30
31
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-tasks-and-decisions",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.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,16 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^51.1.
|
|
32
|
+
"@atlaskit/adf-schema": "^51.1.2",
|
|
33
33
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
34
34
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
35
35
|
"@atlaskit/css": "^0.14.0",
|
|
36
|
-
"@atlaskit/editor-plugin-analytics": "^5.
|
|
37
|
-
"@atlaskit/editor-plugin-block-menu": "^3.
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^5.2.0",
|
|
37
|
+
"@atlaskit/editor-plugin-block-menu": "^3.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-context-identifier": "^5.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^7.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-selection": "^5.0.0",
|
|
41
|
-
"@atlaskit/editor-plugin-type-ahead": "^5.
|
|
41
|
+
"@atlaskit/editor-plugin-type-ahead": "^5.2.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
44
44
|
"@atlaskit/editor-toolbar": "^0.8.0",
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
"@atlaskit/primitives": "^14.14.0",
|
|
50
50
|
"@atlaskit/prosemirror-input-rules": "^3.4.0",
|
|
51
51
|
"@atlaskit/task-decision": "^19.2.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^12.18.0",
|
|
53
53
|
"@atlaskit/tokens": "^6.3.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@compiled/react": "^0.18.3",
|
|
56
56
|
"bind-event-listener": "^3.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@atlaskit/editor-common": "^109.
|
|
59
|
+
"@atlaskit/editor-common": "^109.5.0",
|
|
60
60
|
"react": "^18.2.0",
|
|
61
61
|
"react-dom": "^18.2.0",
|
|
62
62
|
"react-intl-next": "npm:react-intl@^5.18.1"
|