@atlaskit/editor-plugin-tasks-and-decisions 2.12.38 → 2.12.40
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 +15 -0
- package/dist/cjs/pm-plugins/main.js +6 -0
- package/dist/cjs/pm-plugins/taskItemOnChange.js +31 -0
- package/dist/cjs/tasksAndDecisionsPlugin.js +1 -0
- package/dist/es2019/pm-plugins/main.js +6 -0
- package/dist/es2019/pm-plugins/taskItemOnChange.js +24 -0
- package/dist/es2019/tasksAndDecisionsPlugin.js +1 -0
- package/dist/esm/pm-plugins/main.js +6 -0
- package/dist/esm/pm-plugins/taskItemOnChange.js +24 -0
- package/dist/esm/tasksAndDecisionsPlugin.js +1 -0
- package/dist/types/pm-plugins/taskItemOnChange.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/taskItemOnChange.d.ts +2 -0
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-tasks-and-decisions
|
|
2
2
|
|
|
3
|
+
## 2.12.40
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.12.39
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#104325](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104325)
|
|
14
|
+
[`a29af260680fd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a29af260680fd) -
|
|
15
|
+
Allow changing of task item state while using pre-loaded version of task item.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.12.38
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -19,6 +19,7 @@ var _taskLazyNodeView = require("../nodeviews/task-lazy-node-view");
|
|
|
19
19
|
var _actions = require("./actions");
|
|
20
20
|
var _helpers = require("./helpers");
|
|
21
21
|
var _pluginKey = require("./plugin-key");
|
|
22
|
+
var _taskItemOnChange = require("./taskItemOnChange");
|
|
22
23
|
var _types = require("./types");
|
|
23
24
|
var _excluded = ["localId"];
|
|
24
25
|
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; }
|
|
@@ -74,6 +75,11 @@ function createPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispa
|
|
|
74
75
|
}, {
|
|
75
76
|
useLongPressSelection: useLongPressSelection
|
|
76
77
|
}),
|
|
78
|
+
handleDOMEvents: {
|
|
79
|
+
// When the page is lazy loaded and task item is not yet available this allows
|
|
80
|
+
// our toDOM implementation to toggle the node state
|
|
81
|
+
change: _taskItemOnChange.taskItemOnChange
|
|
82
|
+
},
|
|
77
83
|
handleKeyDown: function handleKeyDown(view, event) {
|
|
78
84
|
var state = view.state,
|
|
79
85
|
dispatch = view.dispatch;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.taskItemOnChange = taskItemOnChange;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function taskItemOnChange(view, event) {
|
|
13
|
+
var _parentNode$type;
|
|
14
|
+
var target = event.target;
|
|
15
|
+
if (!target || !(target instanceof HTMLInputElement) || target.type !== 'checkbox' || target.getAttribute('data-input-type') !== 'lazy-task-item' || !(0, _platformFeatureFlags.fg)('platform_editor_lazy_task_item_check')) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
var pos = view.posAtDOM(target, 0);
|
|
19
|
+
// Resolve the position in the current document
|
|
20
|
+
var resolvedPos = view.state.doc.resolve(pos);
|
|
21
|
+
// Access the parent node
|
|
22
|
+
var parentNode = resolvedPos === null || resolvedPos === void 0 ? void 0 : resolvedPos.parent;
|
|
23
|
+
if ((parentNode === null || parentNode === void 0 || (_parentNode$type = parentNode.type) === null || _parentNode$type === void 0 ? void 0 : _parentNode$type.name) !== 'taskItem') {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var parentPos = resolvedPos.before(resolvedPos.depth);
|
|
27
|
+
var tr = view.state.tr.setNodeMarkup(parentPos, null, _objectSpread(_objectSpread({}, parentNode.attrs), {}, {
|
|
28
|
+
state: target.checked ? 'DONE' : 'TODO'
|
|
29
|
+
}));
|
|
30
|
+
view.dispatch(tr);
|
|
31
|
+
}
|
|
@@ -82,6 +82,7 @@ var taskItemSpecWithFixedToDOM = exports.taskItemSpecWithFixedToDOM = function t
|
|
|
82
82
|
placeContent: 'center center'
|
|
83
83
|
})
|
|
84
84
|
}, ['input', _objectSpread(_objectSpread({}, inputAttrs), {}, {
|
|
85
|
+
'data-input-type': 'lazy-task-item',
|
|
85
86
|
style: (0, _lazyNodeView.convertToInlineCss)({
|
|
86
87
|
width: '13px',
|
|
87
88
|
height: '13px',
|
|
@@ -10,6 +10,7 @@ import { lazyTaskView } from '../nodeviews/task-lazy-node-view';
|
|
|
10
10
|
import { focusTaskDecision, setProvider } from './actions';
|
|
11
11
|
import { focusCheckboxAndUpdateSelection, getTaskItemDataAtPos, getTaskItemDataToFocus, removeCheckboxFocus } from './helpers';
|
|
12
12
|
import { stateKey } from './plugin-key';
|
|
13
|
+
import { taskItemOnChange } from './taskItemOnChange';
|
|
13
14
|
import { ACTIONS } from './types';
|
|
14
15
|
function nodesBetweenChanged(tr, f, startPos) {
|
|
15
16
|
const stepRange = getStepRange(tr);
|
|
@@ -59,6 +60,11 @@ export function createPlugin(portalProviderAPI, eventDispatcher, providerFactory
|
|
|
59
60
|
handleClickOn: createSelectionClickHandler(['decisionItem'], target => target.hasAttribute('data-decision-wrapper') || target.getAttribute('aria-label') === 'Decision', {
|
|
60
61
|
useLongPressSelection
|
|
61
62
|
}),
|
|
63
|
+
handleDOMEvents: {
|
|
64
|
+
// When the page is lazy loaded and task item is not yet available this allows
|
|
65
|
+
// our toDOM implementation to toggle the node state
|
|
66
|
+
change: taskItemOnChange
|
|
67
|
+
},
|
|
62
68
|
handleKeyDown: (view, event) => {
|
|
63
69
|
const {
|
|
64
70
|
state,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
export function taskItemOnChange(view, event) {
|
|
3
|
+
var _parentNode$type;
|
|
4
|
+
const {
|
|
5
|
+
target
|
|
6
|
+
} = event;
|
|
7
|
+
if (!target || !(target instanceof HTMLInputElement) || target.type !== 'checkbox' || target.getAttribute('data-input-type') !== 'lazy-task-item' || !fg('platform_editor_lazy_task_item_check')) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const pos = view.posAtDOM(target, 0);
|
|
11
|
+
// Resolve the position in the current document
|
|
12
|
+
const resolvedPos = view.state.doc.resolve(pos);
|
|
13
|
+
// Access the parent node
|
|
14
|
+
const parentNode = resolvedPos === null || resolvedPos === void 0 ? void 0 : resolvedPos.parent;
|
|
15
|
+
if ((parentNode === null || parentNode === void 0 ? void 0 : (_parentNode$type = parentNode.type) === null || _parentNode$type === void 0 ? void 0 : _parentNode$type.name) !== 'taskItem') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const parentPos = resolvedPos.before(resolvedPos.depth);
|
|
19
|
+
const tr = view.state.tr.setNodeMarkup(parentPos, null, {
|
|
20
|
+
...parentNode.attrs,
|
|
21
|
+
state: target.checked ? 'DONE' : 'TODO'
|
|
22
|
+
});
|
|
23
|
+
view.dispatch(tr);
|
|
24
|
+
}
|
|
@@ -15,6 +15,7 @@ import { lazyTaskView } from '../nodeviews/task-lazy-node-view';
|
|
|
15
15
|
import { focusTaskDecision, setProvider } from './actions';
|
|
16
16
|
import { focusCheckboxAndUpdateSelection, getTaskItemDataAtPos, getTaskItemDataToFocus, removeCheckboxFocus } from './helpers';
|
|
17
17
|
import { stateKey } from './plugin-key';
|
|
18
|
+
import { taskItemOnChange } from './taskItemOnChange';
|
|
18
19
|
import { ACTIONS } from './types';
|
|
19
20
|
function nodesBetweenChanged(tr, f, startPos) {
|
|
20
21
|
var stepRange = getStepRange(tr);
|
|
@@ -67,6 +68,11 @@ export function createPlugin(portalProviderAPI, eventDispatcher, providerFactory
|
|
|
67
68
|
}, {
|
|
68
69
|
useLongPressSelection: useLongPressSelection
|
|
69
70
|
}),
|
|
71
|
+
handleDOMEvents: {
|
|
72
|
+
// When the page is lazy loaded and task item is not yet available this allows
|
|
73
|
+
// our toDOM implementation to toggle the node state
|
|
74
|
+
change: taskItemOnChange
|
|
75
|
+
},
|
|
70
76
|
handleKeyDown: function handleKeyDown(view, event) {
|
|
71
77
|
var state = view.state,
|
|
72
78
|
dispatch = view.dispatch;
|
|
@@ -0,0 +1,24 @@
|
|
|
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; }
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
export function taskItemOnChange(view, event) {
|
|
6
|
+
var _parentNode$type;
|
|
7
|
+
var target = event.target;
|
|
8
|
+
if (!target || !(target instanceof HTMLInputElement) || target.type !== 'checkbox' || target.getAttribute('data-input-type') !== 'lazy-task-item' || !fg('platform_editor_lazy_task_item_check')) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
var pos = view.posAtDOM(target, 0);
|
|
12
|
+
// Resolve the position in the current document
|
|
13
|
+
var resolvedPos = view.state.doc.resolve(pos);
|
|
14
|
+
// Access the parent node
|
|
15
|
+
var parentNode = resolvedPos === null || resolvedPos === void 0 ? void 0 : resolvedPos.parent;
|
|
16
|
+
if ((parentNode === null || parentNode === void 0 || (_parentNode$type = parentNode.type) === null || _parentNode$type === void 0 ? void 0 : _parentNode$type.name) !== 'taskItem') {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
var parentPos = resolvedPos.before(resolvedPos.depth);
|
|
20
|
+
var tr = view.state.tr.setNodeMarkup(parentPos, null, _objectSpread(_objectSpread({}, parentNode.attrs), {}, {
|
|
21
|
+
state: target.checked ? 'DONE' : 'TODO'
|
|
22
|
+
}));
|
|
23
|
+
view.dispatch(tr);
|
|
24
|
+
}
|
|
@@ -74,6 +74,7 @@ export var taskItemSpecWithFixedToDOM = function taskItemSpecWithFixedToDOM() {
|
|
|
74
74
|
placeContent: 'center center'
|
|
75
75
|
})
|
|
76
76
|
}, ['input', _objectSpread(_objectSpread({}, inputAttrs), {}, {
|
|
77
|
+
'data-input-type': 'lazy-task-item',
|
|
77
78
|
style: convertToInlineCss({
|
|
78
79
|
width: '13px',
|
|
79
80
|
height: '13px',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-tasks-and-decisions",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.40",
|
|
4
4
|
"description": "Tasks and decisions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
35
|
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
36
36
|
"@atlaskit/analytics-next": "^10.2.0",
|
|
37
|
-
"@atlaskit/editor-common": "^99.
|
|
38
|
-
"@atlaskit/editor-plugin-analytics": "^1.
|
|
37
|
+
"@atlaskit/editor-common": "^99.5.0",
|
|
38
|
+
"@atlaskit/editor-plugin-analytics": "^1.11.0",
|
|
39
39
|
"@atlaskit/editor-plugin-context-identifier": "^1.3.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-viewmode": "2.1.16",
|
|
41
41
|
"@atlaskit/editor-plugin-type-ahead": "^1.11.0",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@atlaskit/primitives": "13.3.8",
|
|
48
48
|
"@atlaskit/prosemirror-input-rules": "^3.2.0",
|
|
49
49
|
"@atlaskit/task-decision": "^17.11.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
51
|
-
"@atlaskit/tokens": "3.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^2.39.0",
|
|
51
|
+
"@atlaskit/tokens": "3.2.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@emotion/react": "^11.7.1"
|
|
54
54
|
},
|
|
@@ -107,6 +107,9 @@
|
|
|
107
107
|
"editor_request_to_edit_task": {
|
|
108
108
|
"type": "boolean"
|
|
109
109
|
},
|
|
110
|
+
"platform_editor_lazy_task_item_check": {
|
|
111
|
+
"type": "boolean"
|
|
112
|
+
},
|
|
110
113
|
"platform_editor_action_decisions_ssr_fix": {
|
|
111
114
|
"type": "boolean"
|
|
112
115
|
}
|