@atlaskit/editor-core 187.36.0 → 187.37.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 +6 -0
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +13 -6
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/input-rules.js +15 -7
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +9 -7
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/input-rules.js +11 -5
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/commands.js +12 -6
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/input-rules.js +14 -7
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/tasks-and-decisions/commands.d.ts +4 -4
- package/dist/types/plugins/tasks-and-decisions/types.d.ts +3 -0
- package/dist/types-ts4.5/plugins/tasks-and-decisions/commands.d.ts +4 -4
- package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +3 -0
- package/package.json +2 -2
- package/report.api.md +8 -0
- package/tmp/api-report-tmp.d.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.37.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`082b7cf0ea7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/082b7cf0ea7) - [ux] ECA11Y-1 Added new typeahead shortcut to create checked action item
|
|
8
|
+
|
|
3
9
|
## 187.36.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.isSupportedSourceNode = exports.insertTaskDecisionWithAnalytics = exports.insertTaskDecisionCommand = exports.insertTaskDecisionAction = exports.getListTypes = exports.createListAtSelection = exports.changeInDepth = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -13,6 +15,8 @@ var _analytics = require("../analytics");
|
|
|
13
15
|
var _gapCursorSelection = require("../selection/gap-cursor-selection");
|
|
14
16
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
15
17
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
16
20
|
var getContextData = function getContextData() {
|
|
17
21
|
var contextProvider = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
22
|
var objectId = contextProvider.objectId,
|
|
@@ -73,6 +77,7 @@ var insertTaskDecisionAction = function insertTaskDecisionAction(state, listType
|
|
|
73
77
|
var addItem = arguments.length > 3 ? arguments[3] : undefined;
|
|
74
78
|
var listLocalId = arguments.length > 4 ? arguments[4] : undefined;
|
|
75
79
|
var itemLocalId = arguments.length > 5 ? arguments[5] : undefined;
|
|
80
|
+
var itemAttrs = arguments.length > 6 ? arguments[6] : undefined;
|
|
76
81
|
var schema = state.schema;
|
|
77
82
|
var addAndCreateList = function addAndCreateList(_ref) {
|
|
78
83
|
var tr = _ref.tr,
|
|
@@ -80,7 +85,7 @@ var insertTaskDecisionAction = function insertTaskDecisionAction(state, listType
|
|
|
80
85
|
item = _ref.item,
|
|
81
86
|
listLocalId = _ref.listLocalId,
|
|
82
87
|
itemLocalId = _ref.itemLocalId;
|
|
83
|
-
return createListAtSelection(tr, list, item, schema, state, listLocalId, itemLocalId);
|
|
88
|
+
return createListAtSelection(tr, list, item, schema, state, listLocalId, itemLocalId, itemAttrs);
|
|
84
89
|
};
|
|
85
90
|
var addToList = function addToList(_ref2) {
|
|
86
91
|
var state = _ref2.state,
|
|
@@ -98,7 +103,7 @@ var insertTaskDecisionAction = function insertTaskDecisionAction(state, listType
|
|
|
98
103
|
}]).setSelection(new _state.TextSelection(tr.doc.resolve(newItemParagraphPos)));
|
|
99
104
|
};
|
|
100
105
|
var addAndCreateListFn = addItem !== null && addItem !== void 0 ? addItem : addAndCreateList;
|
|
101
|
-
var tr = insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateListFn, addToList, listLocalId, itemLocalId);
|
|
106
|
+
var tr = insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateListFn, addToList, listLocalId, itemLocalId, itemAttrs);
|
|
102
107
|
if (!tr) {
|
|
103
108
|
return state.tr;
|
|
104
109
|
}
|
|
@@ -120,7 +125,7 @@ var insertTaskDecisionCommand = function insertTaskDecisionCommand(listType) {
|
|
|
120
125
|
};
|
|
121
126
|
};
|
|
122
127
|
exports.insertTaskDecisionCommand = insertTaskDecisionCommand;
|
|
123
|
-
var insertTaskDecisionWithAnalytics = function insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateList, addToList, listLocalId, itemLocalId) {
|
|
128
|
+
var insertTaskDecisionWithAnalytics = function insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateList, addToList, listLocalId, itemLocalId, itemAttrs) {
|
|
124
129
|
var schema = state.schema;
|
|
125
130
|
var _getListTypes = getListTypes(listType, schema),
|
|
126
131
|
list = _getListTypes.list,
|
|
@@ -154,7 +159,8 @@ var insertTaskDecisionWithAnalytics = function insertTaskDecisionWithAnalytics(s
|
|
|
154
159
|
list: list,
|
|
155
160
|
item: item,
|
|
156
161
|
listLocalId: listLocalId,
|
|
157
|
-
itemLocalId: itemLocalId
|
|
162
|
+
itemLocalId: itemLocalId,
|
|
163
|
+
itemAttrs: itemAttrs
|
|
158
164
|
});
|
|
159
165
|
if (insertTr) {
|
|
160
166
|
insertTr = (0, _analytics.addAnalytics)(state, insertTr, generateAnalyticsPayload(listType, contextData, inputMethod, itemLocalId, listLocalId, itemIdx || 0, listSize || 0));
|
|
@@ -180,6 +186,7 @@ exports.changeInDepth = changeInDepth;
|
|
|
180
186
|
var createListAtSelection = function createListAtSelection(tr, list, item, schema, state) {
|
|
181
187
|
var listLocalId = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _adfSchema.uuid.generate();
|
|
182
188
|
var itemLocalId = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : _adfSchema.uuid.generate();
|
|
189
|
+
var itemAttrs = arguments.length > 7 ? arguments[7] : undefined;
|
|
183
190
|
var selection = state.selection;
|
|
184
191
|
var $from = selection.$from,
|
|
185
192
|
$to = selection.$to;
|
|
@@ -200,9 +207,9 @@ var createListAtSelection = function createListAtSelection(tr, list, item, schem
|
|
|
200
207
|
}
|
|
201
208
|
var emptyList = list.create({
|
|
202
209
|
localId: listLocalId
|
|
203
|
-
}, [item.create({
|
|
210
|
+
}, [item.create(_objectSpread({
|
|
204
211
|
localId: itemLocalId
|
|
205
|
-
})]);
|
|
212
|
+
}, itemAttrs))]);
|
|
206
213
|
|
|
207
214
|
// we don't take the content of a block node next to the gap cursor and always create an empty task
|
|
208
215
|
if (selection instanceof _gapCursorSelection.GapCursorSelection) {
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
8
|
exports.inputRulePlugin = inputRulePlugin;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
10
12
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
11
13
|
var _analytics = require("../../analytics");
|
|
12
14
|
var _commands = require("../commands");
|
|
13
|
-
var
|
|
15
|
+
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
|
+
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
|
+
var createListRule = function createListRule(regex, listType, itemAttrs) {
|
|
14
18
|
return (0, _prosemirrorInputRules.createRule)(regex, function (state, _match, start, end) {
|
|
15
19
|
var paragraph = state.schema.nodes.paragraph;
|
|
16
20
|
var _getListTypes = (0, _commands.getListTypes)(listType, state.schema),
|
|
@@ -22,7 +26,7 @@ var createListRule = function createListRule(regex, listType) {
|
|
|
22
26
|
if ($end.parent.type !== paragraph || !(0, _utils.canInsert)($endOfParent, list.createAndFill())) {
|
|
23
27
|
return null;
|
|
24
28
|
}
|
|
25
|
-
var insertTr = (0, _commands.insertTaskDecisionAction)(state, listType, _analytics.INPUT_METHOD.FORMATTING, addItem(start, end));
|
|
29
|
+
var insertTr = (0, _commands.insertTaskDecisionAction)(state, listType, _analytics.INPUT_METHOD.FORMATTING, addItem(start, end), undefined, undefined, itemAttrs);
|
|
26
30
|
return insertTr;
|
|
27
31
|
});
|
|
28
32
|
};
|
|
@@ -33,7 +37,8 @@ var addItem = function addItem(start, end) {
|
|
|
33
37
|
list = _ref.list,
|
|
34
38
|
item = _ref.item,
|
|
35
39
|
listLocalId = _ref.listLocalId,
|
|
36
|
-
itemLocalId = _ref.itemLocalId
|
|
40
|
+
itemLocalId = _ref.itemLocalId,
|
|
41
|
+
itemAttrs = _ref.itemAttrs;
|
|
37
42
|
var $from = state.selection.$from,
|
|
38
43
|
schema = state.schema;
|
|
39
44
|
var hardBreak = schema.nodes.hardBreak;
|
|
@@ -47,16 +52,16 @@ var addItem = function addItem(start, end) {
|
|
|
47
52
|
if (!shouldBreakNode) {
|
|
48
53
|
tr.replaceRangeWith($from.before(), $from.after(), list.create({
|
|
49
54
|
localId: listLocalId
|
|
50
|
-
}, [item.create({
|
|
55
|
+
}, [item.create(_objectSpread({
|
|
51
56
|
localId: itemLocalId
|
|
52
|
-
}, content)])).delete(start + 1, end + 1).setSelection(new _state.TextSelection(tr.doc.resolve(start + 1)));
|
|
57
|
+
}, itemAttrs), content)])).delete(start + 1, end + 1).setSelection(new _state.TextSelection(tr.doc.resolve(start + 1)));
|
|
53
58
|
} else {
|
|
54
59
|
var depthAdjustment = (0, _commands.changeInDepth)($from, tr.selection.$from);
|
|
55
60
|
tr.split($from.pos).setSelection(new _state.NodeSelection(tr.doc.resolve($from.pos + 1))).replaceSelectionWith(list.create({
|
|
56
61
|
localId: listLocalId
|
|
57
|
-
}, [item.create({
|
|
62
|
+
}, [item.create(_objectSpread({
|
|
58
63
|
localId: itemLocalId
|
|
59
|
-
},
|
|
64
|
+
}, itemAttrs),
|
|
60
65
|
// TODO: [ts30] handle void and null properly
|
|
61
66
|
tr.doc.nodeAt($from.pos + 1).content)])).setSelection(new _state.TextSelection(tr.doc.resolve($from.pos + depthAdjustment))).delete(start, end + 1);
|
|
62
67
|
}
|
|
@@ -75,6 +80,9 @@ function inputRulePlugin(schema, featureFlags) {
|
|
|
75
80
|
}
|
|
76
81
|
if (taskList && taskItem) {
|
|
77
82
|
rules.push(createListRule(new RegExp("(^|".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, ")\\[\\]\\s$")), 'taskList'));
|
|
83
|
+
rules.push(createListRule(new RegExp("(^|".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, ")\\[x\\]\\s$")), 'taskList', {
|
|
84
|
+
state: 'DONE'
|
|
85
|
+
}));
|
|
78
86
|
}
|
|
79
87
|
return (0, _prosemirrorInputRules.createPlugin)('tasks-and-decisions', rules, {
|
|
80
88
|
isBlockNodeRule: true
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.
|
|
9
|
+
var version = "187.37.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -65,7 +65,7 @@ export const getListTypes = (listType, schema) => {
|
|
|
65
65
|
item: decisionItem
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
export const insertTaskDecisionAction = (state, listType, inputMethod = INPUT_METHOD.TOOLBAR, addItem, listLocalId, itemLocalId) => {
|
|
68
|
+
export const insertTaskDecisionAction = (state, listType, inputMethod = INPUT_METHOD.TOOLBAR, addItem, listLocalId, itemLocalId, itemAttrs) => {
|
|
69
69
|
const {
|
|
70
70
|
schema
|
|
71
71
|
} = state;
|
|
@@ -75,7 +75,7 @@ export const insertTaskDecisionAction = (state, listType, inputMethod = INPUT_ME
|
|
|
75
75
|
item,
|
|
76
76
|
listLocalId,
|
|
77
77
|
itemLocalId
|
|
78
|
-
}) => createListAtSelection(tr, list, item, schema, state, listLocalId, itemLocalId);
|
|
78
|
+
}) => createListAtSelection(tr, list, item, schema, state, listLocalId, itemLocalId, itemAttrs);
|
|
79
79
|
const addToList = ({
|
|
80
80
|
state,
|
|
81
81
|
tr,
|
|
@@ -95,7 +95,7 @@ export const insertTaskDecisionAction = (state, listType, inputMethod = INPUT_ME
|
|
|
95
95
|
}]).setSelection(new TextSelection(tr.doc.resolve(newItemParagraphPos)));
|
|
96
96
|
};
|
|
97
97
|
const addAndCreateListFn = addItem !== null && addItem !== void 0 ? addItem : addAndCreateList;
|
|
98
|
-
const tr = insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateListFn, addToList, listLocalId, itemLocalId);
|
|
98
|
+
const tr = insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateListFn, addToList, listLocalId, itemLocalId, itemAttrs);
|
|
99
99
|
if (!tr) {
|
|
100
100
|
return state.tr;
|
|
101
101
|
}
|
|
@@ -109,7 +109,7 @@ export const insertTaskDecisionCommand = (listType, inputMethod = INPUT_METHOD.T
|
|
|
109
109
|
}
|
|
110
110
|
return true;
|
|
111
111
|
};
|
|
112
|
-
export const insertTaskDecisionWithAnalytics = (state, listType, inputMethod, addAndCreateList, addToList, listLocalId, itemLocalId) => {
|
|
112
|
+
export const insertTaskDecisionWithAnalytics = (state, listType, inputMethod, addAndCreateList, addToList, listLocalId, itemLocalId, itemAttrs) => {
|
|
113
113
|
const {
|
|
114
114
|
schema
|
|
115
115
|
} = state;
|
|
@@ -150,7 +150,8 @@ export const insertTaskDecisionWithAnalytics = (state, listType, inputMethod, ad
|
|
|
150
150
|
list,
|
|
151
151
|
item,
|
|
152
152
|
listLocalId,
|
|
153
|
-
itemLocalId
|
|
153
|
+
itemLocalId,
|
|
154
|
+
itemAttrs
|
|
154
155
|
});
|
|
155
156
|
if (insertTr) {
|
|
156
157
|
insertTr = addAnalytics(state, insertTr, generateAnalyticsPayload(listType, contextData, inputMethod, itemLocalId, listLocalId, itemIdx || 0, listSize || 0));
|
|
@@ -169,7 +170,7 @@ export const isSupportedSourceNode = (schema, selection) => {
|
|
|
169
170
|
return hasParentNodeOfType([blockquote, paragraph, decisionList, taskList])(selection);
|
|
170
171
|
};
|
|
171
172
|
export const changeInDepth = (before, after) => after.depth - before.depth;
|
|
172
|
-
export const createListAtSelection = (tr, list, item, schema, state, listLocalId = uuid.generate(), itemLocalId = uuid.generate()) => {
|
|
173
|
+
export const createListAtSelection = (tr, list, item, schema, state, listLocalId = uuid.generate(), itemLocalId = uuid.generate(), itemAttrs) => {
|
|
173
174
|
const {
|
|
174
175
|
selection
|
|
175
176
|
} = state;
|
|
@@ -196,7 +197,8 @@ export const createListAtSelection = (tr, list, item, schema, state, listLocalId
|
|
|
196
197
|
const emptyList = list.create({
|
|
197
198
|
localId: listLocalId
|
|
198
199
|
}, [item.create({
|
|
199
|
-
localId: itemLocalId
|
|
200
|
+
localId: itemLocalId,
|
|
201
|
+
...itemAttrs
|
|
200
202
|
})]);
|
|
201
203
|
|
|
202
204
|
// we don't take the content of a block node next to the gap cursor and always create an empty task
|
|
@@ -4,7 +4,7 @@ import { createRule, createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
|
4
4
|
import { leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
5
5
|
import { INPUT_METHOD } from '../../analytics';
|
|
6
6
|
import { changeInDepth, insertTaskDecisionAction, getListTypes } from '../commands';
|
|
7
|
-
const createListRule = (regex, listType) => {
|
|
7
|
+
const createListRule = (regex, listType, itemAttrs) => {
|
|
8
8
|
return createRule(regex, (state, _match, start, end) => {
|
|
9
9
|
const {
|
|
10
10
|
paragraph
|
|
@@ -19,7 +19,7 @@ const createListRule = (regex, listType) => {
|
|
|
19
19
|
if ($end.parent.type !== paragraph || !canInsert($endOfParent, list.createAndFill())) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
const insertTr = insertTaskDecisionAction(state, listType, INPUT_METHOD.FORMATTING, addItem(start, end));
|
|
22
|
+
const insertTr = insertTaskDecisionAction(state, listType, INPUT_METHOD.FORMATTING, addItem(start, end), undefined, undefined, itemAttrs);
|
|
23
23
|
return insertTr;
|
|
24
24
|
});
|
|
25
25
|
};
|
|
@@ -29,7 +29,8 @@ const addItem = (start, end) => ({
|
|
|
29
29
|
list,
|
|
30
30
|
item,
|
|
31
31
|
listLocalId,
|
|
32
|
-
itemLocalId
|
|
32
|
+
itemLocalId,
|
|
33
|
+
itemAttrs
|
|
33
34
|
}) => {
|
|
34
35
|
const {
|
|
35
36
|
selection: {
|
|
@@ -51,14 +52,16 @@ const addItem = (start, end) => ({
|
|
|
51
52
|
tr.replaceRangeWith($from.before(), $from.after(), list.create({
|
|
52
53
|
localId: listLocalId
|
|
53
54
|
}, [item.create({
|
|
54
|
-
localId: itemLocalId
|
|
55
|
+
localId: itemLocalId,
|
|
56
|
+
...itemAttrs
|
|
55
57
|
}, content)])).delete(start + 1, end + 1).setSelection(new TextSelection(tr.doc.resolve(start + 1)));
|
|
56
58
|
} else {
|
|
57
59
|
const depthAdjustment = changeInDepth($from, tr.selection.$from);
|
|
58
60
|
tr.split($from.pos).setSelection(new NodeSelection(tr.doc.resolve($from.pos + 1))).replaceSelectionWith(list.create({
|
|
59
61
|
localId: listLocalId
|
|
60
62
|
}, [item.create({
|
|
61
|
-
localId: itemLocalId
|
|
63
|
+
localId: itemLocalId,
|
|
64
|
+
...itemAttrs
|
|
62
65
|
},
|
|
63
66
|
// TODO: [ts30] handle void and null properly
|
|
64
67
|
tr.doc.nodeAt($from.pos + 1).content)])).setSelection(new TextSelection(tr.doc.resolve($from.pos + depthAdjustment))).delete(start, end + 1);
|
|
@@ -78,6 +81,9 @@ export function inputRulePlugin(schema, featureFlags) {
|
|
|
78
81
|
}
|
|
79
82
|
if (taskList && taskItem) {
|
|
80
83
|
rules.push(createListRule(new RegExp(`(^|${leafNodeReplacementCharacter})\\[\\]\\s$`), 'taskList'));
|
|
84
|
+
rules.push(createListRule(new RegExp(`(^|${leafNodeReplacementCharacter})\\[x\\]\\s$`), 'taskList', {
|
|
85
|
+
state: 'DONE'
|
|
86
|
+
}));
|
|
81
87
|
}
|
|
82
88
|
return createPlugin('tasks-and-decisions', rules, {
|
|
83
89
|
isBlockNodeRule: true
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import { NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
2
5
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
6
|
import { findParentNodeOfType, hasParentNodeOfType, replaceParentNodeOfType, safeInsert, setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -66,6 +69,7 @@ export var insertTaskDecisionAction = function insertTaskDecisionAction(state, l
|
|
|
66
69
|
var addItem = arguments.length > 3 ? arguments[3] : undefined;
|
|
67
70
|
var listLocalId = arguments.length > 4 ? arguments[4] : undefined;
|
|
68
71
|
var itemLocalId = arguments.length > 5 ? arguments[5] : undefined;
|
|
72
|
+
var itemAttrs = arguments.length > 6 ? arguments[6] : undefined;
|
|
69
73
|
var schema = state.schema;
|
|
70
74
|
var addAndCreateList = function addAndCreateList(_ref) {
|
|
71
75
|
var tr = _ref.tr,
|
|
@@ -73,7 +77,7 @@ export var insertTaskDecisionAction = function insertTaskDecisionAction(state, l
|
|
|
73
77
|
item = _ref.item,
|
|
74
78
|
listLocalId = _ref.listLocalId,
|
|
75
79
|
itemLocalId = _ref.itemLocalId;
|
|
76
|
-
return createListAtSelection(tr, list, item, schema, state, listLocalId, itemLocalId);
|
|
80
|
+
return createListAtSelection(tr, list, item, schema, state, listLocalId, itemLocalId, itemAttrs);
|
|
77
81
|
};
|
|
78
82
|
var addToList = function addToList(_ref2) {
|
|
79
83
|
var state = _ref2.state,
|
|
@@ -91,7 +95,7 @@ export var insertTaskDecisionAction = function insertTaskDecisionAction(state, l
|
|
|
91
95
|
}]).setSelection(new TextSelection(tr.doc.resolve(newItemParagraphPos)));
|
|
92
96
|
};
|
|
93
97
|
var addAndCreateListFn = addItem !== null && addItem !== void 0 ? addItem : addAndCreateList;
|
|
94
|
-
var tr = insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateListFn, addToList, listLocalId, itemLocalId);
|
|
98
|
+
var tr = insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateListFn, addToList, listLocalId, itemLocalId, itemAttrs);
|
|
95
99
|
if (!tr) {
|
|
96
100
|
return state.tr;
|
|
97
101
|
}
|
|
@@ -111,7 +115,7 @@ export var insertTaskDecisionCommand = function insertTaskDecisionCommand(listTy
|
|
|
111
115
|
return true;
|
|
112
116
|
};
|
|
113
117
|
};
|
|
114
|
-
export var insertTaskDecisionWithAnalytics = function insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateList, addToList, listLocalId, itemLocalId) {
|
|
118
|
+
export var insertTaskDecisionWithAnalytics = function insertTaskDecisionWithAnalytics(state, listType, inputMethod, addAndCreateList, addToList, listLocalId, itemLocalId, itemAttrs) {
|
|
115
119
|
var schema = state.schema;
|
|
116
120
|
var _getListTypes = getListTypes(listType, schema),
|
|
117
121
|
list = _getListTypes.list,
|
|
@@ -145,7 +149,8 @@ export var insertTaskDecisionWithAnalytics = function insertTaskDecisionWithAnal
|
|
|
145
149
|
list: list,
|
|
146
150
|
item: item,
|
|
147
151
|
listLocalId: listLocalId,
|
|
148
|
-
itemLocalId: itemLocalId
|
|
152
|
+
itemLocalId: itemLocalId,
|
|
153
|
+
itemAttrs: itemAttrs
|
|
149
154
|
});
|
|
150
155
|
if (insertTr) {
|
|
151
156
|
insertTr = addAnalytics(state, insertTr, generateAnalyticsPayload(listType, contextData, inputMethod, itemLocalId, listLocalId, itemIdx || 0, listSize || 0));
|
|
@@ -168,6 +173,7 @@ export var changeInDepth = function changeInDepth(before, after) {
|
|
|
168
173
|
export var createListAtSelection = function createListAtSelection(tr, list, item, schema, state) {
|
|
169
174
|
var listLocalId = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : uuid.generate();
|
|
170
175
|
var itemLocalId = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : uuid.generate();
|
|
176
|
+
var itemAttrs = arguments.length > 7 ? arguments[7] : undefined;
|
|
171
177
|
var selection = state.selection;
|
|
172
178
|
var $from = selection.$from,
|
|
173
179
|
$to = selection.$to;
|
|
@@ -188,9 +194,9 @@ export var createListAtSelection = function createListAtSelection(tr, list, item
|
|
|
188
194
|
}
|
|
189
195
|
var emptyList = list.create({
|
|
190
196
|
localId: listLocalId
|
|
191
|
-
}, [item.create({
|
|
197
|
+
}, [item.create(_objectSpread({
|
|
192
198
|
localId: itemLocalId
|
|
193
|
-
})]);
|
|
199
|
+
}, itemAttrs))]);
|
|
194
200
|
|
|
195
201
|
// we don't take the content of a block node next to the gap cursor and always create an empty task
|
|
196
202
|
if (selection instanceof GapCursorSelection) {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
5
|
import { canInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
3
6
|
import { createRule, createPlugin } from '@atlaskit/prosemirror-input-rules';
|
|
4
7
|
import { leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
5
8
|
import { INPUT_METHOD } from '../../analytics';
|
|
6
9
|
import { changeInDepth, insertTaskDecisionAction, getListTypes } from '../commands';
|
|
7
|
-
var createListRule = function createListRule(regex, listType) {
|
|
10
|
+
var createListRule = function createListRule(regex, listType, itemAttrs) {
|
|
8
11
|
return createRule(regex, function (state, _match, start, end) {
|
|
9
12
|
var paragraph = state.schema.nodes.paragraph;
|
|
10
13
|
var _getListTypes = getListTypes(listType, state.schema),
|
|
@@ -16,7 +19,7 @@ var createListRule = function createListRule(regex, listType) {
|
|
|
16
19
|
if ($end.parent.type !== paragraph || !canInsert($endOfParent, list.createAndFill())) {
|
|
17
20
|
return null;
|
|
18
21
|
}
|
|
19
|
-
var insertTr = insertTaskDecisionAction(state, listType, INPUT_METHOD.FORMATTING, addItem(start, end));
|
|
22
|
+
var insertTr = insertTaskDecisionAction(state, listType, INPUT_METHOD.FORMATTING, addItem(start, end), undefined, undefined, itemAttrs);
|
|
20
23
|
return insertTr;
|
|
21
24
|
});
|
|
22
25
|
};
|
|
@@ -27,7 +30,8 @@ var addItem = function addItem(start, end) {
|
|
|
27
30
|
list = _ref.list,
|
|
28
31
|
item = _ref.item,
|
|
29
32
|
listLocalId = _ref.listLocalId,
|
|
30
|
-
itemLocalId = _ref.itemLocalId
|
|
33
|
+
itemLocalId = _ref.itemLocalId,
|
|
34
|
+
itemAttrs = _ref.itemAttrs;
|
|
31
35
|
var $from = state.selection.$from,
|
|
32
36
|
schema = state.schema;
|
|
33
37
|
var hardBreak = schema.nodes.hardBreak;
|
|
@@ -41,16 +45,16 @@ var addItem = function addItem(start, end) {
|
|
|
41
45
|
if (!shouldBreakNode) {
|
|
42
46
|
tr.replaceRangeWith($from.before(), $from.after(), list.create({
|
|
43
47
|
localId: listLocalId
|
|
44
|
-
}, [item.create({
|
|
48
|
+
}, [item.create(_objectSpread({
|
|
45
49
|
localId: itemLocalId
|
|
46
|
-
}, content)])).delete(start + 1, end + 1).setSelection(new TextSelection(tr.doc.resolve(start + 1)));
|
|
50
|
+
}, itemAttrs), content)])).delete(start + 1, end + 1).setSelection(new TextSelection(tr.doc.resolve(start + 1)));
|
|
47
51
|
} else {
|
|
48
52
|
var depthAdjustment = changeInDepth($from, tr.selection.$from);
|
|
49
53
|
tr.split($from.pos).setSelection(new NodeSelection(tr.doc.resolve($from.pos + 1))).replaceSelectionWith(list.create({
|
|
50
54
|
localId: listLocalId
|
|
51
|
-
}, [item.create({
|
|
55
|
+
}, [item.create(_objectSpread({
|
|
52
56
|
localId: itemLocalId
|
|
53
|
-
},
|
|
57
|
+
}, itemAttrs),
|
|
54
58
|
// TODO: [ts30] handle void and null properly
|
|
55
59
|
tr.doc.nodeAt($from.pos + 1).content)])).setSelection(new TextSelection(tr.doc.resolve($from.pos + depthAdjustment))).delete(start, end + 1);
|
|
56
60
|
}
|
|
@@ -69,6 +73,9 @@ export function inputRulePlugin(schema, featureFlags) {
|
|
|
69
73
|
}
|
|
70
74
|
if (taskList && taskItem) {
|
|
71
75
|
rules.push(createListRule(new RegExp("(^|".concat(leafNodeReplacementCharacter, ")\\[\\]\\s$")), 'taskList'));
|
|
76
|
+
rules.push(createListRule(new RegExp("(^|".concat(leafNodeReplacementCharacter, ")\\[x\\]\\s$")), 'taskList', {
|
|
77
|
+
state: 'DONE'
|
|
78
|
+
}));
|
|
72
79
|
}
|
|
73
80
|
return createPlugin('tasks-and-decisions', rules, {
|
|
74
81
|
isBlockNodeRule: true
|
|
@@ -3,14 +3,14 @@ import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prose
|
|
|
3
3
|
import type { Command } from '../../types';
|
|
4
4
|
import { INPUT_METHOD } from '../analytics';
|
|
5
5
|
import type { TOOLBAR_MENU_TYPE } from '../insert-block/ui/ToolbarInsertBlock/types';
|
|
6
|
-
import type { AddItemTransactionCreator, TaskDecisionInputMethod, TaskDecisionListType } from './types';
|
|
6
|
+
import type { AddItemAttrs, AddItemTransactionCreator, TaskDecisionInputMethod, TaskDecisionListType } from './types';
|
|
7
7
|
export declare const getListTypes: (listType: TaskDecisionListType, schema: Schema) => {
|
|
8
8
|
list: NodeType;
|
|
9
9
|
item: NodeType;
|
|
10
10
|
};
|
|
11
|
-
export declare const insertTaskDecisionAction: (state: EditorState, listType: TaskDecisionListType, inputMethod?: INPUT_METHOD.FORMATTING | INPUT_METHOD.QUICK_INSERT | TOOLBAR_MENU_TYPE, addItem?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string) => Transaction;
|
|
11
|
+
export declare const insertTaskDecisionAction: (state: EditorState, listType: TaskDecisionListType, inputMethod?: INPUT_METHOD.FORMATTING | INPUT_METHOD.QUICK_INSERT | TOOLBAR_MENU_TYPE, addItem?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string, itemAttrs?: AddItemAttrs) => Transaction;
|
|
12
12
|
export declare const insertTaskDecisionCommand: (listType: TaskDecisionListType, inputMethod?: INPUT_METHOD.FORMATTING | INPUT_METHOD.QUICK_INSERT | TOOLBAR_MENU_TYPE, addItem?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string) => Command;
|
|
13
|
-
export declare const insertTaskDecisionWithAnalytics: (state: EditorState, listType: TaskDecisionListType, inputMethod: TaskDecisionInputMethod, addAndCreateList: AddItemTransactionCreator, addToList?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string) => Transaction | null;
|
|
13
|
+
export declare const insertTaskDecisionWithAnalytics: (state: EditorState, listType: TaskDecisionListType, inputMethod: TaskDecisionInputMethod, addAndCreateList: AddItemTransactionCreator, addToList?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string, itemAttrs?: AddItemAttrs) => Transaction | null;
|
|
14
14
|
export declare const isSupportedSourceNode: (schema: Schema, selection: Selection) => boolean;
|
|
15
15
|
export declare const changeInDepth: (before: ResolvedPos, after: ResolvedPos) => number;
|
|
16
|
-
export declare const createListAtSelection: (tr: Transaction, list: any, item: any, schema: Schema, state: EditorState, listLocalId?: string, itemLocalId?: string) => Transaction | null;
|
|
16
|
+
export declare const createListAtSelection: (tr: Transaction, list: any, item: any, schema: Schema, state: EditorState, listLocalId?: string, itemLocalId?: string, itemAttrs?: AddItemAttrs) => Transaction | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DecisionItemDefinition, TaskItemDefinition } from '@atlaskit/adf-schema';
|
|
1
2
|
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { INPUT_METHOD, USER_CONTEXT } from '@atlaskit/editor-common/analytics';
|
|
@@ -9,6 +10,7 @@ export type ContextData = {
|
|
|
9
10
|
containerId: string;
|
|
10
11
|
userContext: USER_CONTEXT;
|
|
11
12
|
};
|
|
13
|
+
export type AddItemAttrs = Partial<DecisionItemDefinition['attrs']> | Partial<TaskItemDefinition['attrs']>;
|
|
12
14
|
export type AddItemTransactionCreator = (opts: {
|
|
13
15
|
state: EditorState;
|
|
14
16
|
tr: Transaction;
|
|
@@ -16,6 +18,7 @@ export type AddItemTransactionCreator = (opts: {
|
|
|
16
18
|
item: NodeType;
|
|
17
19
|
listLocalId: string;
|
|
18
20
|
itemLocalId: string;
|
|
21
|
+
itemAttrs?: AddItemAttrs;
|
|
19
22
|
}) => Transaction | null;
|
|
20
23
|
export interface TaskDecisionPluginOptions extends LongPressSelectionPluginOptions {
|
|
21
24
|
allowNestedTasks?: boolean;
|
|
@@ -3,14 +3,14 @@ import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prose
|
|
|
3
3
|
import type { Command } from '../../types';
|
|
4
4
|
import { INPUT_METHOD } from '../analytics';
|
|
5
5
|
import type { TOOLBAR_MENU_TYPE } from '../insert-block/ui/ToolbarInsertBlock/types';
|
|
6
|
-
import type { AddItemTransactionCreator, TaskDecisionInputMethod, TaskDecisionListType } from './types';
|
|
6
|
+
import type { AddItemAttrs, AddItemTransactionCreator, TaskDecisionInputMethod, TaskDecisionListType } from './types';
|
|
7
7
|
export declare const getListTypes: (listType: TaskDecisionListType, schema: Schema) => {
|
|
8
8
|
list: NodeType;
|
|
9
9
|
item: NodeType;
|
|
10
10
|
};
|
|
11
|
-
export declare const insertTaskDecisionAction: (state: EditorState, listType: TaskDecisionListType, inputMethod?: INPUT_METHOD.FORMATTING | INPUT_METHOD.QUICK_INSERT | TOOLBAR_MENU_TYPE, addItem?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string) => Transaction;
|
|
11
|
+
export declare const insertTaskDecisionAction: (state: EditorState, listType: TaskDecisionListType, inputMethod?: INPUT_METHOD.FORMATTING | INPUT_METHOD.QUICK_INSERT | TOOLBAR_MENU_TYPE, addItem?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string, itemAttrs?: AddItemAttrs) => Transaction;
|
|
12
12
|
export declare const insertTaskDecisionCommand: (listType: TaskDecisionListType, inputMethod?: INPUT_METHOD.FORMATTING | INPUT_METHOD.QUICK_INSERT | TOOLBAR_MENU_TYPE, addItem?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string) => Command;
|
|
13
|
-
export declare const insertTaskDecisionWithAnalytics: (state: EditorState, listType: TaskDecisionListType, inputMethod: TaskDecisionInputMethod, addAndCreateList: AddItemTransactionCreator, addToList?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string) => Transaction | null;
|
|
13
|
+
export declare const insertTaskDecisionWithAnalytics: (state: EditorState, listType: TaskDecisionListType, inputMethod: TaskDecisionInputMethod, addAndCreateList: AddItemTransactionCreator, addToList?: AddItemTransactionCreator, listLocalId?: string, itemLocalId?: string, itemAttrs?: AddItemAttrs) => Transaction | null;
|
|
14
14
|
export declare const isSupportedSourceNode: (schema: Schema, selection: Selection) => boolean;
|
|
15
15
|
export declare const changeInDepth: (before: ResolvedPos, after: ResolvedPos) => number;
|
|
16
|
-
export declare const createListAtSelection: (tr: Transaction, list: any, item: any, schema: Schema, state: EditorState, listLocalId?: string, itemLocalId?: string) => Transaction | null;
|
|
16
|
+
export declare const createListAtSelection: (tr: Transaction, list: any, item: any, schema: Schema, state: EditorState, listLocalId?: string, itemLocalId?: string, itemAttrs?: AddItemAttrs) => Transaction | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DecisionItemDefinition, TaskItemDefinition } from '@atlaskit/adf-schema';
|
|
1
2
|
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
2
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { INPUT_METHOD, USER_CONTEXT } from '@atlaskit/editor-common/analytics';
|
|
@@ -9,6 +10,7 @@ export type ContextData = {
|
|
|
9
10
|
containerId: string;
|
|
10
11
|
userContext: USER_CONTEXT;
|
|
11
12
|
};
|
|
13
|
+
export type AddItemAttrs = Partial<DecisionItemDefinition['attrs']> | Partial<TaskItemDefinition['attrs']>;
|
|
12
14
|
export type AddItemTransactionCreator = (opts: {
|
|
13
15
|
state: EditorState;
|
|
14
16
|
tr: Transaction;
|
|
@@ -16,6 +18,7 @@ export type AddItemTransactionCreator = (opts: {
|
|
|
16
18
|
item: NodeType;
|
|
17
19
|
listLocalId: string;
|
|
18
20
|
itemLocalId: string;
|
|
21
|
+
itemAttrs?: AddItemAttrs;
|
|
19
22
|
}) => Transaction | null;
|
|
20
23
|
export interface TaskDecisionPluginOptions extends LongPressSelectionPluginOptions {
|
|
21
24
|
allowNestedTasks?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.
|
|
3
|
+
"version": "187.37.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"@atlaskit/radio": "^5.6.0",
|
|
106
106
|
"@atlaskit/section-message": "^6.4.0",
|
|
107
107
|
"@atlaskit/select": "^16.5.0",
|
|
108
|
-
"@atlaskit/smart-card": "^26.
|
|
108
|
+
"@atlaskit/smart-card": "^26.20.0",
|
|
109
109
|
"@atlaskit/smart-user-picker": "^6.3.0",
|
|
110
110
|
"@atlaskit/spinner": "^15.5.0",
|
|
111
111
|
"@atlaskit/status": "^1.3.0",
|
package/report.api.md
CHANGED
|
@@ -45,6 +45,7 @@ import type { ContextUpdateHandler } from '@atlaskit/editor-common/types';
|
|
|
45
45
|
import { createTable } from '@atlaskit/editor-plugin-table/commands';
|
|
46
46
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
47
47
|
import { darkModeStatusColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
48
|
+
import type { DecisionItemDefinition } from '@atlaskit/adf-schema';
|
|
48
49
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
49
50
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
50
51
|
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -148,6 +149,7 @@ import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
|
148
149
|
import { setTextSelection } from '@atlaskit/editor-common/utils';
|
|
149
150
|
import type { SEVERITY } from '@atlaskit/editor-common/utils';
|
|
150
151
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision';
|
|
152
|
+
import type { TaskItemDefinition } from '@atlaskit/adf-schema';
|
|
151
153
|
import { TeamMentionResource } from '@atlaskit/mention/team-resource';
|
|
152
154
|
import { InputMethodBasic as TextFormattingInputMethodBasic } from '@atlaskit/editor-common/types';
|
|
153
155
|
import { InputMethodToolbar as TextFormattingInputMethodToolbar } from '@atlaskit/editor-common/types';
|
|
@@ -183,6 +185,11 @@ export { ACTION_SUBJECT };
|
|
|
183
185
|
|
|
184
186
|
export { ACTION_SUBJECT_ID };
|
|
185
187
|
|
|
188
|
+
// @public (undocumented)
|
|
189
|
+
type AddItemAttrs =
|
|
190
|
+
| Partial<DecisionItemDefinition['attrs']>
|
|
191
|
+
| Partial<TaskItemDefinition['attrs']>;
|
|
192
|
+
|
|
186
193
|
// @public (undocumented)
|
|
187
194
|
type AddItemTransactionCreator = (opts: {
|
|
188
195
|
state: EditorState;
|
|
@@ -191,6 +198,7 @@ type AddItemTransactionCreator = (opts: {
|
|
|
191
198
|
item: NodeType;
|
|
192
199
|
listLocalId: string;
|
|
193
200
|
itemLocalId: string;
|
|
201
|
+
itemAttrs?: AddItemAttrs;
|
|
194
202
|
}) => Transaction | null;
|
|
195
203
|
|
|
196
204
|
// @public (undocumented)
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ import type { ContextUpdateHandler } from '@atlaskit/editor-common/types';
|
|
|
34
34
|
import { createTable } from '@atlaskit/editor-plugin-table/commands';
|
|
35
35
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
36
36
|
import { darkModeStatusColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
37
|
+
import type { DecisionItemDefinition } from '@atlaskit/adf-schema';
|
|
37
38
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
38
39
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
39
40
|
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -137,6 +138,7 @@ import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
|
137
138
|
import { setTextSelection } from '@atlaskit/editor-common/utils';
|
|
138
139
|
import type { SEVERITY } from '@atlaskit/editor-common/utils';
|
|
139
140
|
import type { TaskDecisionProvider } from '@atlaskit/task-decision';
|
|
141
|
+
import type { TaskItemDefinition } from '@atlaskit/adf-schema';
|
|
140
142
|
import { TeamMentionResource } from '@atlaskit/mention/team-resource';
|
|
141
143
|
import { InputMethodBasic as TextFormattingInputMethodBasic } from '@atlaskit/editor-common/types';
|
|
142
144
|
import { InputMethodToolbar as TextFormattingInputMethodToolbar } from '@atlaskit/editor-common/types';
|
|
@@ -172,6 +174,9 @@ export { ACTION_SUBJECT }
|
|
|
172
174
|
|
|
173
175
|
export { ACTION_SUBJECT_ID }
|
|
174
176
|
|
|
177
|
+
// @public (undocumented)
|
|
178
|
+
type AddItemAttrs = Partial<DecisionItemDefinition['attrs']> | Partial<TaskItemDefinition['attrs']>;
|
|
179
|
+
|
|
175
180
|
// @public (undocumented)
|
|
176
181
|
type AddItemTransactionCreator = (opts: {
|
|
177
182
|
state: EditorState;
|
|
@@ -180,6 +185,7 @@ type AddItemTransactionCreator = (opts: {
|
|
|
180
185
|
item: NodeType;
|
|
181
186
|
listLocalId: string;
|
|
182
187
|
itemLocalId: string;
|
|
188
|
+
itemAttrs?: AddItemAttrs;
|
|
183
189
|
}) => Transaction | null;
|
|
184
190
|
|
|
185
191
|
// @public (undocumented)
|