@atlaskit/editor-plugin-date 5.1.10 → 5.1.12
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 +14 -0
- package/dist/cjs/nodeviews/utils.js +14 -1
- package/dist/es2019/nodeviews/utils.js +14 -2
- package/dist/esm/nodeviews/utils.js +14 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-date
|
|
2
2
|
|
|
3
|
+
## 5.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 5.1.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`db857b08dd89a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/db857b08dd89a) -
|
|
14
|
+
[EDITOR-1202] Make dates in blockTaskItem be formatted correctly
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 5.1.10
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getDateInformation = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
|
+
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
8
9
|
var getDateInformation = exports.getDateInformation = function getDateInformation(timestamp, intl, state, pos) {
|
|
9
10
|
if (!state) {
|
|
10
11
|
return {
|
|
@@ -14,13 +15,25 @@ var getDateInformation = exports.getDateInformation = function getDateInformatio
|
|
|
14
15
|
}
|
|
15
16
|
var doc = state.doc,
|
|
16
17
|
selection = state.selection;
|
|
17
|
-
var
|
|
18
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
19
|
+
taskItem = _state$schema$nodes.taskItem,
|
|
20
|
+
blockTaskItem = _state$schema$nodes.blockTaskItem;
|
|
18
21
|
|
|
19
22
|
// We fall back to selection.$from even though it does not cover all use cases
|
|
20
23
|
// eg. upon Editor init, selection is at the start, not at the Date node
|
|
21
24
|
var $nodePos = typeof pos === 'number' ? doc.resolve(pos) : selection.$from;
|
|
22
25
|
var parent = $nodePos.parent;
|
|
23
26
|
var withinIncompleteTask = parent.type === taskItem && parent.attrs.state !== 'DONE';
|
|
27
|
+
|
|
28
|
+
// If there is blockTaskItem in the schema and it's not nested in an incomplete task item,
|
|
29
|
+
// check if it's nested in an incomplete block task item
|
|
30
|
+
if (blockTaskItem && !withinIncompleteTask) {
|
|
31
|
+
var blockTaskItemParent = (0, _utils2.findParentNodeOfTypeClosestToPos)($nodePos, blockTaskItem);
|
|
32
|
+
// If nested in a blockTaskItem that is incomplete
|
|
33
|
+
if (blockTaskItemParent) {
|
|
34
|
+
withinIncompleteTask = blockTaskItemParent.node.attrs.state !== 'DONE';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
24
37
|
var color = withinIncompleteTask && (0, _utils.isPastDate)(timestamp) ? 'red' : undefined;
|
|
25
38
|
var displayString = withinIncompleteTask ? (0, _utils.timestampToTaskContext)(timestamp, intl) : (0, _utils.timestampToString)(timestamp, intl);
|
|
26
39
|
return {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isPastDate, timestampToString, timestampToTaskContext } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
3
|
export const getDateInformation = (timestamp, intl, state, pos) => {
|
|
3
4
|
if (!state) {
|
|
4
5
|
return {
|
|
@@ -11,14 +12,25 @@ export const getDateInformation = (timestamp, intl, state, pos) => {
|
|
|
11
12
|
selection
|
|
12
13
|
} = state;
|
|
13
14
|
const {
|
|
14
|
-
taskItem
|
|
15
|
+
taskItem,
|
|
16
|
+
blockTaskItem
|
|
15
17
|
} = state.schema.nodes;
|
|
16
18
|
|
|
17
19
|
// We fall back to selection.$from even though it does not cover all use cases
|
|
18
20
|
// eg. upon Editor init, selection is at the start, not at the Date node
|
|
19
21
|
const $nodePos = typeof pos === 'number' ? doc.resolve(pos) : selection.$from;
|
|
20
22
|
const parent = $nodePos.parent;
|
|
21
|
-
|
|
23
|
+
let withinIncompleteTask = parent.type === taskItem && parent.attrs.state !== 'DONE';
|
|
24
|
+
|
|
25
|
+
// If there is blockTaskItem in the schema and it's not nested in an incomplete task item,
|
|
26
|
+
// check if it's nested in an incomplete block task item
|
|
27
|
+
if (blockTaskItem && !withinIncompleteTask) {
|
|
28
|
+
const blockTaskItemParent = findParentNodeOfTypeClosestToPos($nodePos, blockTaskItem);
|
|
29
|
+
// If nested in a blockTaskItem that is incomplete
|
|
30
|
+
if (blockTaskItemParent) {
|
|
31
|
+
withinIncompleteTask = blockTaskItemParent.node.attrs.state !== 'DONE';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
22
34
|
const color = withinIncompleteTask && isPastDate(timestamp) ? 'red' : undefined;
|
|
23
35
|
const displayString = withinIncompleteTask ? timestampToTaskContext(timestamp, intl) : timestampToString(timestamp, intl);
|
|
24
36
|
return {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isPastDate, timestampToString, timestampToTaskContext } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
3
|
export var getDateInformation = function getDateInformation(timestamp, intl, state, pos) {
|
|
3
4
|
if (!state) {
|
|
4
5
|
return {
|
|
@@ -8,13 +9,25 @@ export var getDateInformation = function getDateInformation(timestamp, intl, sta
|
|
|
8
9
|
}
|
|
9
10
|
var doc = state.doc,
|
|
10
11
|
selection = state.selection;
|
|
11
|
-
var
|
|
12
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
13
|
+
taskItem = _state$schema$nodes.taskItem,
|
|
14
|
+
blockTaskItem = _state$schema$nodes.blockTaskItem;
|
|
12
15
|
|
|
13
16
|
// We fall back to selection.$from even though it does not cover all use cases
|
|
14
17
|
// eg. upon Editor init, selection is at the start, not at the Date node
|
|
15
18
|
var $nodePos = typeof pos === 'number' ? doc.resolve(pos) : selection.$from;
|
|
16
19
|
var parent = $nodePos.parent;
|
|
17
20
|
var withinIncompleteTask = parent.type === taskItem && parent.attrs.state !== 'DONE';
|
|
21
|
+
|
|
22
|
+
// If there is blockTaskItem in the schema and it's not nested in an incomplete task item,
|
|
23
|
+
// check if it's nested in an incomplete block task item
|
|
24
|
+
if (blockTaskItem && !withinIncompleteTask) {
|
|
25
|
+
var blockTaskItemParent = findParentNodeOfTypeClosestToPos($nodePos, blockTaskItem);
|
|
26
|
+
// If nested in a blockTaskItem that is incomplete
|
|
27
|
+
if (blockTaskItemParent) {
|
|
28
|
+
withinIncompleteTask = blockTaskItemParent.node.attrs.state !== 'DONE';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
18
31
|
var color = withinIncompleteTask && isPastDate(timestamp) ? 'red' : undefined;
|
|
19
32
|
var displayString = withinIncompleteTask ? timestampToTaskContext(timestamp, intl) : timestampToString(timestamp, intl);
|
|
20
33
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-date",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.12",
|
|
4
4
|
"description": "Date plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
".": "./src/index.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@atlaskit/adf-schema": "^50.2.
|
|
35
|
+
"@atlaskit/adf-schema": "^50.2.2",
|
|
36
36
|
"@atlaskit/calendar": "^17.1.0",
|
|
37
37
|
"@atlaskit/css": "^0.12.0",
|
|
38
38
|
"@atlaskit/date": "^2.0.0",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
45
45
|
"@atlaskit/form": "^12.2.0",
|
|
46
|
-
"@atlaskit/icon": "^28.
|
|
46
|
+
"@atlaskit/icon": "^28.1.0",
|
|
47
47
|
"@atlaskit/locale": "^3.0.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/textfield": "^8.0.0",
|
|
50
|
-
"@atlaskit/theme": "^
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
52
|
-
"@atlaskit/tokens": "^6.
|
|
50
|
+
"@atlaskit/theme": "^20.0.0",
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^11.8.0",
|
|
52
|
+
"@atlaskit/tokens": "^6.1.0",
|
|
53
53
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"bind-event-listener": "^3.0.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@atlaskit/editor-plugin-composition": "^2.0.0",
|
|
62
62
|
"@atlaskit/editor-plugin-content-insertion": "^3.1.0",
|
|
63
|
-
"@atlaskit/editor-plugin-decorations": "^3.
|
|
63
|
+
"@atlaskit/editor-plugin-decorations": "^3.1.0",
|
|
64
64
|
"@atlaskit/editor-plugin-feature-flags": "^2.0.0",
|
|
65
65
|
"@atlaskit/editor-plugin-guideline": "^3.0.0",
|
|
66
66
|
"@atlaskit/editor-plugin-quick-insert": "^3.0.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@testing-library/react": "^13.4.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^107.
|
|
75
|
+
"@atlaskit/editor-common": "^107.31.0",
|
|
76
76
|
"react": "^18.2.0",
|
|
77
77
|
"react-dom": "^18.2.0"
|
|
78
78
|
},
|