@atlaskit/editor-plugin-tasks-and-decisions 5.1.18 → 5.1.19
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 +9 -0
- package/dist/cjs/nodeviews/TaskItemNodeView.js +0 -31
- package/dist/cjs/nodeviews/task-node-view.js +8 -37
- package/dist/cjs/nodeviews/taskItemNodeSpec.js +6 -3
- package/dist/cjs/pm-plugins/main.js +8 -22
- package/dist/cjs/tasksAndDecisionsPlugin.js +1 -8
- package/dist/es2019/nodeviews/TaskItemNodeView.js +0 -31
- package/dist/es2019/nodeviews/task-node-view.js +8 -33
- package/dist/es2019/nodeviews/taskItemNodeSpec.js +6 -3
- package/dist/es2019/pm-plugins/main.js +3 -17
- package/dist/es2019/tasksAndDecisionsPlugin.js +1 -8
- package/dist/esm/nodeviews/TaskItemNodeView.js +0 -31
- package/dist/esm/nodeviews/task-node-view.js +8 -32
- package/dist/esm/nodeviews/taskItemNodeSpec.js +6 -3
- package/dist/esm/pm-plugins/main.js +8 -22
- package/dist/esm/tasksAndDecisionsPlugin.js +1 -8
- package/dist/types/nodeviews/TaskItemNodeView.d.ts +0 -28
- package/dist/types/nodeviews/task-node-view.d.ts +1 -4
- package/dist/types/nodeviews/taskItemNodeSpec.d.ts +5 -3
- package/dist/types/pm-plugins/main.d.ts +1 -17
- package/dist/types-ts4.5/nodeviews/TaskItemNodeView.d.ts +0 -28
- package/dist/types-ts4.5/nodeviews/task-node-view.d.ts +1 -4
- package/dist/types-ts4.5/nodeviews/taskItemNodeSpec.d.ts +5 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -17
- package/package.json +5 -5
- package/dist/cjs/nodeviews/taskItem.compiled.css +0 -30
- package/dist/cjs/nodeviews/taskItem.js +0 -389
- package/dist/es2019/nodeviews/taskItem.compiled.css +0 -30
- package/dist/es2019/nodeviews/taskItem.js +0 -346
- package/dist/esm/nodeviews/taskItem.compiled.css +0 -30
- package/dist/esm/nodeviews/taskItem.js +0 -381
- package/dist/types/nodeviews/taskItem.d.ts +0 -26
- package/dist/types-ts4.5/nodeviews/taskItem.d.ts +0 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-tasks-and-decisions
|
|
2
2
|
|
|
3
|
+
## 5.1.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#176023](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/176023)
|
|
8
|
+
[`d88b8886797ae`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d88b8886797ae) -
|
|
9
|
+
clean up experiment platform_editor_vanilla_dom on task
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 5.1.18
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -14,21 +14,7 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
14
14
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
15
15
|
var _helpers = require("../pm-plugins/helpers");
|
|
16
16
|
var _taskItemNodeSpec = require("./taskItemNodeSpec");
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
17
|
var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param node
|
|
24
|
-
* @param view
|
|
25
|
-
* @param getPos
|
|
26
|
-
* @param root0
|
|
27
|
-
* @param root0.api
|
|
28
|
-
* @param root0.placeholder
|
|
29
|
-
* @param root0.intl
|
|
30
|
-
* @example
|
|
31
|
-
*/
|
|
32
18
|
function TaskItemNodeView(node, view, getPos, _ref) {
|
|
33
19
|
var _this = this;
|
|
34
20
|
var api = _ref.api,
|
|
@@ -141,12 +127,6 @@ var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
|
|
|
141
127
|
(_this$contentDOM = this.contentDOM) === null || _this$contentDOM === void 0 || _this$contentDOM.toggleAttribute('data-empty', currentIsContentEmpty);
|
|
142
128
|
}
|
|
143
129
|
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
*
|
|
147
|
-
* @param node
|
|
148
|
-
* @example
|
|
149
|
-
*/
|
|
150
130
|
}, {
|
|
151
131
|
key: "update",
|
|
152
132
|
value: function update(node) {
|
|
@@ -163,12 +143,6 @@ var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
|
|
|
163
143
|
this.node = node;
|
|
164
144
|
return true;
|
|
165
145
|
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
* @param mutation
|
|
170
|
-
* @example
|
|
171
|
-
*/
|
|
172
146
|
}, {
|
|
173
147
|
key: "ignoreMutation",
|
|
174
148
|
value: function ignoreMutation(mutation) {
|
|
@@ -177,11 +151,6 @@ var TaskItemNodeView = exports.TaskItemNodeView = /*#__PURE__*/function () {
|
|
|
177
151
|
}
|
|
178
152
|
return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
|
|
179
153
|
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
*/
|
|
185
154
|
}, {
|
|
186
155
|
key: "destroy",
|
|
187
156
|
value: function destroy() {
|
|
@@ -1,45 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.taskView = void 0;
|
|
8
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
-
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
10
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
|
-
var _taskItem = require("./taskItem");
|
|
12
7
|
var _TaskItemNodeView = require("./TaskItemNodeView");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
api: api,
|
|
22
|
-
intl: intl
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
if ((0, _experiments.editorExperiment)('platform_editor_exp_lazy_node_views', false)) {
|
|
27
|
-
return (0, _taskItem.taskItemNodeViewFactory)(portalProviderAPI, eventDispatcher, providerFactory, api, intl, placeholder);
|
|
28
|
-
}
|
|
29
|
-
return (0, _lazyNodeView.withLazyLoading)({
|
|
30
|
-
nodeName: 'taskItem',
|
|
31
|
-
getNodeViewOptions: function getNodeViewOptions() {},
|
|
32
|
-
loader: function loader() {
|
|
33
|
-
var result = Promise.resolve().then(function () {
|
|
34
|
-
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-tasks-and-decisions_task-item-nodeview" */
|
|
35
|
-
'./taskItem'));
|
|
36
|
-
}).then(function (_ref) {
|
|
37
|
-
var taskItemNodeViewFactory = _ref.taskItemNodeViewFactory;
|
|
38
|
-
return function (node, view, getPos) {
|
|
39
|
-
return taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory, api, intl, placeholder)(node, view, getPos);
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
8
|
+
var taskView = exports.taskView = function taskView(api, intl, placeholder) {
|
|
9
|
+
return function (node, view, getPos) {
|
|
10
|
+
return new _TaskItemNodeView.TaskItemNodeView(node, view, getPos, {
|
|
11
|
+
placeholder: placeholder,
|
|
12
|
+
api: api,
|
|
13
|
+
intl: intl
|
|
14
|
+
});
|
|
15
|
+
};
|
|
45
16
|
};
|
|
@@ -31,11 +31,14 @@ var taskItemNodeSpec = exports.taskItemNodeSpec = function taskItemNodeSpec() {
|
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
// eslint-disable-next-line jsdoc/require-example
|
|
34
35
|
/**
|
|
36
|
+
* Converts a task item node to a DOM output specification.
|
|
37
|
+
* This is used for rendering the task item in the editor.
|
|
35
38
|
*
|
|
36
|
-
* @param node
|
|
37
|
-
* @param placeholder
|
|
38
|
-
* @
|
|
39
|
+
* @param {Node} node - The ProseMirror node representing the task item.
|
|
40
|
+
* @param {string} placeholder - The placeholder text to display when the task item is empty.
|
|
41
|
+
* @returns A DOMOutputSpec representing the task item.
|
|
39
42
|
*/
|
|
40
43
|
function taskItemToDom(node, placeholder) {
|
|
41
44
|
var checked = node.attrs.state === 'DONE';
|
|
@@ -34,31 +34,17 @@ function nodesBetweenChanged(tr, f, startPos) {
|
|
|
34
34
|
tr.doc.nodesBetween(stepRange.from, stepRange.to, f, startPos);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @param getIntl
|
|
45
|
-
* @param useLongPressSelection
|
|
46
|
-
* @param hasEditPermission
|
|
47
|
-
* @param hasRequestedEditPermission
|
|
48
|
-
* @param requestToEditContent
|
|
49
|
-
* @param taskPlaceholder
|
|
50
|
-
* @example
|
|
51
|
-
*/
|
|
52
|
-
function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, getIntl) {
|
|
53
|
-
var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
54
|
-
var hasEditPermission = arguments.length > 7 ? arguments[7] : undefined;
|
|
55
|
-
var hasRequestedEditPermission = arguments.length > 8 ? arguments[8] : undefined;
|
|
56
|
-
var requestToEditContent = arguments.length > 9 ? arguments[9] : undefined;
|
|
57
|
-
var taskPlaceholder = arguments.length > 10 ? arguments[10] : undefined;
|
|
37
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
38
|
+
function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl) {
|
|
39
|
+
var useLongPressSelection = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
40
|
+
var hasEditPermission = arguments.length > 6 ? arguments[6] : undefined;
|
|
41
|
+
var hasRequestedEditPermission = arguments.length > 7 ? arguments[7] : undefined;
|
|
42
|
+
var requestToEditContent = arguments.length > 8 ? arguments[8] : undefined;
|
|
43
|
+
var taskPlaceholder = arguments.length > 9 ? arguments[9] : undefined;
|
|
58
44
|
return new _safePlugin.SafePlugin({
|
|
59
45
|
props: {
|
|
60
46
|
nodeViews: {
|
|
61
|
-
taskItem: (0, _taskNodeView.taskView)(
|
|
47
|
+
taskItem: (0, _taskNodeView.taskView)(api, getIntl(), taskPlaceholder),
|
|
62
48
|
decisionItem: function (node, view, getPos, decorations, innerDecorations) {
|
|
63
49
|
if ((0, _experiments.editorExperiment)('platform_editor_vanilla_dom', true, {
|
|
64
50
|
exposure: true
|
|
@@ -19,7 +19,6 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
19
19
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
20
20
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
21
21
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
22
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
22
|
var _taskItemNodeSpec = require("./nodeviews/taskItemNodeSpec");
|
|
24
23
|
var _decisionItem = require("./nodeviews/toDOM-fixes/decisionItem");
|
|
25
24
|
var _helpers = require("./pm-plugins/helpers");
|
|
@@ -59,11 +58,6 @@ function ContentComponent(_ref2) {
|
|
|
59
58
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
60
59
|
var openRequestToEditPopupAt = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(dependencyApi, 'taskDecision.openRequestToEditPopupAt');
|
|
61
60
|
var hasEditPermission = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(dependencyApi, 'taskDecision.hasEditPermission');
|
|
62
|
-
if ((0, _experiments.editorExperiment)('platform_editor_vanilla_dom', false, {
|
|
63
|
-
exposure: true
|
|
64
|
-
})) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
61
|
if (hasEditPermission || !openRequestToEditPopupAt) {
|
|
68
62
|
return null;
|
|
69
63
|
}
|
|
@@ -212,11 +206,10 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
212
206
|
name: 'tasksAndDecisions',
|
|
213
207
|
plugin: function plugin(_ref8) {
|
|
214
208
|
var portalProviderAPI = _ref8.portalProviderAPI,
|
|
215
|
-
providerFactory = _ref8.providerFactory,
|
|
216
209
|
eventDispatcher = _ref8.eventDispatcher,
|
|
217
210
|
dispatch = _ref8.dispatch,
|
|
218
211
|
getIntl = _ref8.getIntl;
|
|
219
|
-
return (0, _main.createPlugin)(portalProviderAPI, eventDispatcher,
|
|
212
|
+
return (0, _main.createPlugin)(portalProviderAPI, eventDispatcher, dispatch, api, getIntl, useLongPressSelection, hasEditPermission, hasRequestedEditPermission, requestToEditContent, taskPlaceholder);
|
|
220
213
|
}
|
|
221
214
|
}, {
|
|
222
215
|
name: 'tasksAndDecisionsInputRule',
|
|
@@ -5,21 +5,7 @@ import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
|
5
5
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { openRequestEditPopupAt } from '../pm-plugins/helpers';
|
|
7
7
|
import { taskItemToDom } from './taskItemNodeSpec';
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
8
|
export class TaskItemNodeView {
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param node
|
|
15
|
-
* @param view
|
|
16
|
-
* @param getPos
|
|
17
|
-
* @param root0
|
|
18
|
-
* @param root0.api
|
|
19
|
-
* @param root0.placeholder
|
|
20
|
-
* @param root0.intl
|
|
21
|
-
* @example
|
|
22
|
-
*/
|
|
23
9
|
constructor(node, view, getPos, {
|
|
24
10
|
api,
|
|
25
11
|
placeholder,
|
|
@@ -127,12 +113,6 @@ export class TaskItemNodeView {
|
|
|
127
113
|
(_this$contentDOM = this.contentDOM) === null || _this$contentDOM === void 0 ? void 0 : _this$contentDOM.toggleAttribute('data-empty', currentIsContentEmpty);
|
|
128
114
|
}
|
|
129
115
|
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
133
|
-
* @param node
|
|
134
|
-
* @example
|
|
135
|
-
*/
|
|
136
116
|
update(node) {
|
|
137
117
|
const isValidUpdate = node.type === this.node.type && !!(node.attrs.state === this.node.attrs.state);
|
|
138
118
|
if (!isValidUpdate) {
|
|
@@ -147,23 +127,12 @@ export class TaskItemNodeView {
|
|
|
147
127
|
this.node = node;
|
|
148
128
|
return true;
|
|
149
129
|
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
*
|
|
153
|
-
* @param mutation
|
|
154
|
-
* @example
|
|
155
|
-
*/
|
|
156
130
|
ignoreMutation(mutation) {
|
|
157
131
|
if (!this.contentDOM) {
|
|
158
132
|
return true;
|
|
159
133
|
}
|
|
160
134
|
return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
|
|
161
135
|
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
*/
|
|
167
136
|
destroy() {
|
|
168
137
|
if (this.unbindInputDom) {
|
|
169
138
|
this.unbindInputDom();
|
|
@@ -1,35 +1,10 @@
|
|
|
1
|
-
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
|
-
import { taskItemNodeViewFactory } from './taskItem';
|
|
4
1
|
import { TaskItemNodeView } from './TaskItemNodeView';
|
|
5
|
-
export const taskView = (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
intl
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
18
|
-
return taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory, api, intl, placeholder);
|
|
19
|
-
}
|
|
20
|
-
return withLazyLoading({
|
|
21
|
-
nodeName: 'taskItem',
|
|
22
|
-
getNodeViewOptions: () => {},
|
|
23
|
-
loader: () => {
|
|
24
|
-
const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-tasks-and-decisions_task-item-nodeview" */
|
|
25
|
-
'./taskItem').then(({
|
|
26
|
-
taskItemNodeViewFactory
|
|
27
|
-
}) => {
|
|
28
|
-
return (node, view, getPos) => {
|
|
29
|
-
return taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory, api, intl, placeholder)(node, view, getPos);
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
2
|
+
export const taskView = (api, intl, placeholder) => {
|
|
3
|
+
return (node, view, getPos) => {
|
|
4
|
+
return new TaskItemNodeView(node, view, getPos, {
|
|
5
|
+
placeholder,
|
|
6
|
+
api,
|
|
7
|
+
intl
|
|
8
|
+
});
|
|
9
|
+
};
|
|
35
10
|
};
|
|
@@ -19,11 +19,14 @@ export const taskItemNodeSpec = () => {
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
// eslint-disable-next-line jsdoc/require-example
|
|
22
23
|
/**
|
|
24
|
+
* Converts a task item node to a DOM output specification.
|
|
25
|
+
* This is used for rendering the task item in the editor.
|
|
23
26
|
*
|
|
24
|
-
* @param node
|
|
25
|
-
* @param placeholder
|
|
26
|
-
* @
|
|
27
|
+
* @param {Node} node - The ProseMirror node representing the task item.
|
|
28
|
+
* @param {string} placeholder - The placeholder text to display when the task item is empty.
|
|
29
|
+
* @returns A DOMOutputSpec representing the task item.
|
|
27
30
|
*/
|
|
28
31
|
export function taskItemToDom(node, placeholder) {
|
|
29
32
|
const checked = node.attrs.state === 'DONE';
|
|
@@ -22,26 +22,12 @@ function nodesBetweenChanged(tr, f, startPos) {
|
|
|
22
22
|
tr.doc.nodesBetween(stepRange.from, stepRange.to, f, startPos);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* @param portalProviderAPI
|
|
28
|
-
* @param eventDispatcher
|
|
29
|
-
* @param providerFactory
|
|
30
|
-
* @param dispatch
|
|
31
|
-
* @param api
|
|
32
|
-
* @param getIntl
|
|
33
|
-
* @param useLongPressSelection
|
|
34
|
-
* @param hasEditPermission
|
|
35
|
-
* @param hasRequestedEditPermission
|
|
36
|
-
* @param requestToEditContent
|
|
37
|
-
* @param taskPlaceholder
|
|
38
|
-
* @example
|
|
39
|
-
*/
|
|
40
|
-
export function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, getIntl, useLongPressSelection = false, hasEditPermission, hasRequestedEditPermission, requestToEditContent, taskPlaceholder) {
|
|
25
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
26
|
+
export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl, useLongPressSelection = false, hasEditPermission, hasRequestedEditPermission, requestToEditContent, taskPlaceholder) {
|
|
41
27
|
return new SafePlugin({
|
|
42
28
|
props: {
|
|
43
29
|
nodeViews: {
|
|
44
|
-
taskItem: taskView(
|
|
30
|
+
taskItem: taskView(api, getIntl(), taskPlaceholder),
|
|
45
31
|
decisionItem: (node, view, getPos, decorations, innerDecorations) => {
|
|
46
32
|
if (editorExperiment('platform_editor_vanilla_dom', true, {
|
|
47
33
|
exposure: true
|
|
@@ -9,7 +9,6 @@ import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/edi
|
|
|
9
9
|
import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
|
|
10
10
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
11
11
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
12
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
12
|
import { taskItemNodeSpec } from './nodeviews/taskItemNodeSpec';
|
|
14
13
|
import { decisionItemSpecWithFixedToDOM } from './nodeviews/toDOM-fixes/decisionItem';
|
|
15
14
|
import { closeRequestEditPopupAt, getCurrentIndentLevel, getTaskItemIndex, isInsideTask } from './pm-plugins/helpers';
|
|
@@ -49,11 +48,6 @@ function ContentComponent({
|
|
|
49
48
|
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
50
49
|
const openRequestToEditPopupAt = useSharedPluginStateSelector(dependencyApi, 'taskDecision.openRequestToEditPopupAt');
|
|
51
50
|
const hasEditPermission = useSharedPluginStateSelector(dependencyApi, 'taskDecision.hasEditPermission');
|
|
52
|
-
if (editorExperiment('platform_editor_vanilla_dom', false, {
|
|
53
|
-
exposure: true
|
|
54
|
-
})) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
51
|
if (hasEditPermission || !openRequestToEditPopupAt) {
|
|
58
52
|
return null;
|
|
59
53
|
}
|
|
@@ -174,12 +168,11 @@ export const tasksAndDecisionsPlugin = ({
|
|
|
174
168
|
name: 'tasksAndDecisions',
|
|
175
169
|
plugin: ({
|
|
176
170
|
portalProviderAPI,
|
|
177
|
-
providerFactory,
|
|
178
171
|
eventDispatcher,
|
|
179
172
|
dispatch,
|
|
180
173
|
getIntl
|
|
181
174
|
}) => {
|
|
182
|
-
return createPlugin(portalProviderAPI, eventDispatcher,
|
|
175
|
+
return createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl, useLongPressSelection, hasEditPermission, hasRequestedEditPermission, requestToEditContent, taskPlaceholder);
|
|
183
176
|
}
|
|
184
177
|
}, {
|
|
185
178
|
name: 'tasksAndDecisionsInputRule',
|
|
@@ -7,21 +7,7 @@ import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
|
7
7
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { openRequestEditPopupAt } from '../pm-plugins/helpers';
|
|
9
9
|
import { taskItemToDom } from './taskItemNodeSpec';
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
10
|
export var TaskItemNodeView = /*#__PURE__*/function () {
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @param node
|
|
17
|
-
* @param view
|
|
18
|
-
* @param getPos
|
|
19
|
-
* @param root0
|
|
20
|
-
* @param root0.api
|
|
21
|
-
* @param root0.placeholder
|
|
22
|
-
* @param root0.intl
|
|
23
|
-
* @example
|
|
24
|
-
*/
|
|
25
11
|
function TaskItemNodeView(node, view, getPos, _ref) {
|
|
26
12
|
var _this = this;
|
|
27
13
|
var api = _ref.api,
|
|
@@ -134,12 +120,6 @@ export var TaskItemNodeView = /*#__PURE__*/function () {
|
|
|
134
120
|
(_this$contentDOM = this.contentDOM) === null || _this$contentDOM === void 0 || _this$contentDOM.toggleAttribute('data-empty', currentIsContentEmpty);
|
|
135
121
|
}
|
|
136
122
|
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
*
|
|
140
|
-
* @param node
|
|
141
|
-
* @example
|
|
142
|
-
*/
|
|
143
123
|
}, {
|
|
144
124
|
key: "update",
|
|
145
125
|
value: function update(node) {
|
|
@@ -156,12 +136,6 @@ export var TaskItemNodeView = /*#__PURE__*/function () {
|
|
|
156
136
|
this.node = node;
|
|
157
137
|
return true;
|
|
158
138
|
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
*
|
|
162
|
-
* @param mutation
|
|
163
|
-
* @example
|
|
164
|
-
*/
|
|
165
139
|
}, {
|
|
166
140
|
key: "ignoreMutation",
|
|
167
141
|
value: function ignoreMutation(mutation) {
|
|
@@ -170,11 +144,6 @@ export var TaskItemNodeView = /*#__PURE__*/function () {
|
|
|
170
144
|
}
|
|
171
145
|
return !this.contentDOM.contains(mutation.target) && mutation.type !== 'selection';
|
|
172
146
|
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
*/
|
|
178
147
|
}, {
|
|
179
148
|
key: "destroy",
|
|
180
149
|
value: function destroy() {
|
|
@@ -1,34 +1,10 @@
|
|
|
1
|
-
import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
|
|
2
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
|
-
import { taskItemNodeViewFactory } from './taskItem';
|
|
4
1
|
import { TaskItemNodeView } from './TaskItemNodeView';
|
|
5
|
-
export var taskView = function taskView(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
intl: intl
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
if (editorExperiment('platform_editor_exp_lazy_node_views', false)) {
|
|
18
|
-
return taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory, api, intl, placeholder);
|
|
19
|
-
}
|
|
20
|
-
return withLazyLoading({
|
|
21
|
-
nodeName: 'taskItem',
|
|
22
|
-
getNodeViewOptions: function getNodeViewOptions() {},
|
|
23
|
-
loader: function loader() {
|
|
24
|
-
var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-tasks-and-decisions_task-item-nodeview" */
|
|
25
|
-
'./taskItem').then(function (_ref) {
|
|
26
|
-
var taskItemNodeViewFactory = _ref.taskItemNodeViewFactory;
|
|
27
|
-
return function (node, view, getPos) {
|
|
28
|
-
return taskItemNodeViewFactory(portalProviderAPI, eventDispatcher, providerFactory, api, intl, placeholder)(node, view, getPos);
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
2
|
+
export var taskView = function taskView(api, intl, placeholder) {
|
|
3
|
+
return function (node, view, getPos) {
|
|
4
|
+
return new TaskItemNodeView(node, view, getPos, {
|
|
5
|
+
placeholder: placeholder,
|
|
6
|
+
api: api,
|
|
7
|
+
intl: intl
|
|
8
|
+
});
|
|
9
|
+
};
|
|
34
10
|
};
|
|
@@ -23,11 +23,14 @@ export var taskItemNodeSpec = function taskItemNodeSpec() {
|
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
// eslint-disable-next-line jsdoc/require-example
|
|
26
27
|
/**
|
|
28
|
+
* Converts a task item node to a DOM output specification.
|
|
29
|
+
* This is used for rendering the task item in the editor.
|
|
27
30
|
*
|
|
28
|
-
* @param node
|
|
29
|
-
* @param placeholder
|
|
30
|
-
* @
|
|
31
|
+
* @param {Node} node - The ProseMirror node representing the task item.
|
|
32
|
+
* @param {string} placeholder - The placeholder text to display when the task item is empty.
|
|
33
|
+
* @returns A DOMOutputSpec representing the task item.
|
|
31
34
|
*/
|
|
32
35
|
export function taskItemToDom(node, placeholder) {
|
|
33
36
|
var checked = node.attrs.state === 'DONE';
|
|
@@ -27,31 +27,17 @@ function nodesBetweenChanged(tr, f, startPos) {
|
|
|
27
27
|
tr.doc.nodesBetween(stepRange.from, stepRange.to, f, startPos);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* @param getIntl
|
|
38
|
-
* @param useLongPressSelection
|
|
39
|
-
* @param hasEditPermission
|
|
40
|
-
* @param hasRequestedEditPermission
|
|
41
|
-
* @param requestToEditContent
|
|
42
|
-
* @param taskPlaceholder
|
|
43
|
-
* @example
|
|
44
|
-
*/
|
|
45
|
-
export function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api, getIntl) {
|
|
46
|
-
var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
47
|
-
var hasEditPermission = arguments.length > 7 ? arguments[7] : undefined;
|
|
48
|
-
var hasRequestedEditPermission = arguments.length > 8 ? arguments[8] : undefined;
|
|
49
|
-
var requestToEditContent = arguments.length > 9 ? arguments[9] : undefined;
|
|
50
|
-
var taskPlaceholder = arguments.length > 10 ? arguments[10] : undefined;
|
|
30
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
31
|
+
export function createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl) {
|
|
32
|
+
var useLongPressSelection = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
33
|
+
var hasEditPermission = arguments.length > 6 ? arguments[6] : undefined;
|
|
34
|
+
var hasRequestedEditPermission = arguments.length > 7 ? arguments[7] : undefined;
|
|
35
|
+
var requestToEditContent = arguments.length > 8 ? arguments[8] : undefined;
|
|
36
|
+
var taskPlaceholder = arguments.length > 9 ? arguments[9] : undefined;
|
|
51
37
|
return new SafePlugin({
|
|
52
38
|
props: {
|
|
53
39
|
nodeViews: {
|
|
54
|
-
taskItem: taskView(
|
|
40
|
+
taskItem: taskView(api, getIntl(), taskPlaceholder),
|
|
55
41
|
decisionItem: function (node, view, getPos, decorations, innerDecorations) {
|
|
56
42
|
if (editorExperiment('platform_editor_vanilla_dom', true, {
|
|
57
43
|
exposure: true
|
|
@@ -11,7 +11,6 @@ import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/edi
|
|
|
11
11
|
import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
|
|
12
12
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
13
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
14
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
14
|
import { taskItemNodeSpec } from './nodeviews/taskItemNodeSpec';
|
|
16
15
|
import { decisionItemSpecWithFixedToDOM } from './nodeviews/toDOM-fixes/decisionItem';
|
|
17
16
|
import { closeRequestEditPopupAt, getCurrentIndentLevel, getTaskItemIndex, isInsideTask } from './pm-plugins/helpers';
|
|
@@ -50,11 +49,6 @@ function ContentComponent(_ref2) {
|
|
|
50
49
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
51
50
|
var openRequestToEditPopupAt = useSharedPluginStateSelector(dependencyApi, 'taskDecision.openRequestToEditPopupAt');
|
|
52
51
|
var hasEditPermission = useSharedPluginStateSelector(dependencyApi, 'taskDecision.hasEditPermission');
|
|
53
|
-
if (editorExperiment('platform_editor_vanilla_dom', false, {
|
|
54
|
-
exposure: true
|
|
55
|
-
})) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
52
|
if (hasEditPermission || !openRequestToEditPopupAt) {
|
|
59
53
|
return null;
|
|
60
54
|
}
|
|
@@ -203,11 +197,10 @@ export var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref3) {
|
|
|
203
197
|
name: 'tasksAndDecisions',
|
|
204
198
|
plugin: function plugin(_ref8) {
|
|
205
199
|
var portalProviderAPI = _ref8.portalProviderAPI,
|
|
206
|
-
providerFactory = _ref8.providerFactory,
|
|
207
200
|
eventDispatcher = _ref8.eventDispatcher,
|
|
208
201
|
dispatch = _ref8.dispatch,
|
|
209
202
|
getIntl = _ref8.getIntl;
|
|
210
|
-
return createPlugin(portalProviderAPI, eventDispatcher,
|
|
203
|
+
return createPlugin(portalProviderAPI, eventDispatcher, dispatch, api, getIntl, useLongPressSelection, hasEditPermission, hasRequestedEditPermission, requestToEditContent, taskPlaceholder);
|
|
211
204
|
}
|
|
212
205
|
}, {
|
|
213
206
|
name: 'tasksAndDecisionsInputRule',
|
|
@@ -9,9 +9,6 @@ interface TaskItemNodeViewOptions {
|
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
intl: IntlShape;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
12
|
export declare class TaskItemNodeView implements NodeView {
|
|
16
13
|
dom: Node;
|
|
17
14
|
domElement: HTMLElement | undefined;
|
|
@@ -25,17 +22,6 @@ export declare class TaskItemNodeView implements NodeView {
|
|
|
25
22
|
private unbindInputDom;
|
|
26
23
|
private emptyContent;
|
|
27
24
|
private input?;
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param node
|
|
31
|
-
* @param view
|
|
32
|
-
* @param getPos
|
|
33
|
-
* @param root0
|
|
34
|
-
* @param root0.api
|
|
35
|
-
* @param root0.placeholder
|
|
36
|
-
* @param root0.intl
|
|
37
|
-
* @example
|
|
38
|
-
*/
|
|
39
25
|
constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode, { api, placeholder, intl }: TaskItemNodeViewOptions);
|
|
40
26
|
private getContextIdentifierProvider;
|
|
41
27
|
private getObjectAri;
|
|
@@ -43,25 +29,11 @@ export declare class TaskItemNodeView implements NodeView {
|
|
|
43
29
|
private handleOnChange;
|
|
44
30
|
private isContentEmpty;
|
|
45
31
|
private updatePlaceholder;
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @param node
|
|
49
|
-
* @example
|
|
50
|
-
*/
|
|
51
32
|
update(node: PMNode): boolean;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* @param mutation
|
|
55
|
-
* @example
|
|
56
|
-
*/
|
|
57
33
|
ignoreMutation(mutation: MutationRecord | {
|
|
58
34
|
type: 'selection';
|
|
59
35
|
target: Node;
|
|
60
36
|
}): boolean;
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
*/
|
|
65
37
|
destroy(): void;
|
|
66
38
|
}
|
|
67
39
|
export {};
|