@atlaskit/editor-plugin-status 0.2.0 → 0.2.2
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 +13 -0
- package/dist/cjs/actions.js +22 -29
- package/dist/cjs/plugin.js +1 -1
- package/dist/es2019/actions.js +18 -22
- package/dist/es2019/plugin.js +1 -1
- package/dist/esm/actions.js +21 -28
- package/dist/esm/plugin.js +1 -1
- package/dist/types/actions.d.ts +3 -3
- package/dist/types-ts4.5/actions.d.ts +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-status
|
|
2
2
|
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#43379](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43379) [`482c025520d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/482c025520d) - ED-20763 Upgrade ADF schema version to 33.2.3 for MBE nodes.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 0.2.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#42564](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42564) [`7139d6b0a64`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7139d6b0a64) - ED-20512 Fixed issue with adding status node inside a codeblock
|
|
15
|
+
|
|
3
16
|
## 0.2.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/dist/cjs/actions.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.updateStatusWithAnalytics = exports.updateStatus = exports.setStatusPickerAt = exports.setFocusOnStatusInput = exports.removeStatus = exports.createStatus = exports.commitStatusPicker = exports.DEFAULT_STATUS = void 0;
|
|
7
|
+
exports.verifyAndInsertStatus = exports.updateStatusWithAnalytics = exports.updateStatus = exports.setStatusPickerAt = exports.setFocusOnStatusInput = exports.removeStatus = exports.createStatus = exports.commitStatusPicker = exports.DEFAULT_STATUS = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
@@ -19,22 +19,26 @@ var DEFAULT_STATUS = exports.DEFAULT_STATUS = {
|
|
|
19
19
|
text: '',
|
|
20
20
|
color: 'neutral'
|
|
21
21
|
};
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
var verifyAndInsertStatus = exports.verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, state) {
|
|
23
|
+
var fragment = _model.Fragment.fromArray([statusNode, state.schema.text(' ')]);
|
|
24
|
+
var tr = state.tr;
|
|
25
|
+
var insertable = (0, _utils.canInsert)(tr.selection.$from, fragment);
|
|
26
|
+
if (!insertable) {
|
|
27
|
+
var parentSelection = _state.NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
28
|
+
tr.insert(parentSelection.to, fragment).setSelection(_state.NodeSelection.create(tr.doc, parentSelection.to + 1));
|
|
29
|
+
} else {
|
|
30
|
+
tr.insert(tr.selection.from, fragment).setSelection(_state.NodeSelection.create(tr.doc, tr.selection.from - fragment.size));
|
|
31
|
+
}
|
|
32
|
+
return tr.setMeta(_pluginKey.pluginKey, {
|
|
33
|
+
showStatusPickerAt: tr.selection.from,
|
|
34
|
+
isNew: true
|
|
35
|
+
}).scrollIntoView();
|
|
36
|
+
};
|
|
37
|
+
var createStatus = exports.createStatus = function createStatus(state) {
|
|
38
|
+
var statusNode = state.schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, DEFAULT_STATUS), {}, {
|
|
39
|
+
localId: _adfSchema.uuid.generate()
|
|
40
|
+
}));
|
|
41
|
+
return verifyAndInsertStatus(statusNode, state);
|
|
38
42
|
};
|
|
39
43
|
var updateStatus = exports.updateStatus = function updateStatus(status) {
|
|
40
44
|
return function (state, dispatch) {
|
|
@@ -50,18 +54,7 @@ var updateStatus = exports.updateStatus = function updateStatus(status) {
|
|
|
50
54
|
if (!showStatusPickerAt) {
|
|
51
55
|
// Same behaviour as quick insert (used in createStatus)
|
|
52
56
|
var statusNode = schema.nodes.status.createChecked(statusProps);
|
|
53
|
-
|
|
54
|
-
var insertable = (0, _utils.canInsert)(tr.selection.$from, fragment);
|
|
55
|
-
if (!insertable) {
|
|
56
|
-
var parentSelection = _state.NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
57
|
-
tr.insert(parentSelection.to, fragment).setSelection(_state.NodeSelection.create(tr.doc, parentSelection.to + 1));
|
|
58
|
-
} else {
|
|
59
|
-
tr.insert(tr.selection.from, fragment).setSelection(_state.NodeSelection.create(tr.doc, tr.selection.from - fragment.size));
|
|
60
|
-
}
|
|
61
|
-
tr.setMeta(_pluginKey.pluginKey, {
|
|
62
|
-
showStatusPickerAt: tr.selection.from,
|
|
63
|
-
isNew: true
|
|
64
|
-
}).scrollIntoView();
|
|
57
|
+
tr = verifyAndInsertStatus(statusNode, state);
|
|
65
58
|
if (dispatch) {
|
|
66
59
|
dispatch(tr);
|
|
67
60
|
}
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -119,7 +119,7 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
119
119
|
},
|
|
120
120
|
action: function action(insert, state) {
|
|
121
121
|
var _api$analytics2;
|
|
122
|
-
var tr = (0, _actions.createStatus)(
|
|
122
|
+
var tr = (0, _actions.createStatus)(state);
|
|
123
123
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
124
124
|
action: _analytics.ACTION.INSERTED,
|
|
125
125
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
package/dist/es2019/actions.js
CHANGED
|
@@ -9,20 +9,27 @@ export const DEFAULT_STATUS = {
|
|
|
9
9
|
text: '',
|
|
10
10
|
color: 'neutral'
|
|
11
11
|
};
|
|
12
|
-
export const
|
|
12
|
+
export const verifyAndInsertStatus = (statusNode, state) => {
|
|
13
|
+
const fragment = Fragment.fromArray([statusNode, state.schema.text(' ')]);
|
|
14
|
+
const tr = state.tr;
|
|
15
|
+
const insertable = canInsert(tr.selection.$from, fragment);
|
|
16
|
+
if (!insertable) {
|
|
17
|
+
const parentSelection = NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
18
|
+
tr.insert(parentSelection.to, fragment).setSelection(NodeSelection.create(tr.doc, parentSelection.to + 1));
|
|
19
|
+
} else {
|
|
20
|
+
tr.insert(tr.selection.from, fragment).setSelection(NodeSelection.create(tr.doc, tr.selection.from - fragment.size));
|
|
21
|
+
}
|
|
22
|
+
return tr.setMeta(pluginKey, {
|
|
23
|
+
showStatusPickerAt: tr.selection.from,
|
|
24
|
+
isNew: true
|
|
25
|
+
}).scrollIntoView();
|
|
26
|
+
};
|
|
27
|
+
export const createStatus = state => {
|
|
13
28
|
const statusNode = state.schema.nodes.status.createChecked({
|
|
14
29
|
...DEFAULT_STATUS,
|
|
15
30
|
localId: uuid.generate()
|
|
16
31
|
});
|
|
17
|
-
|
|
18
|
-
const tr = insert(Fragment.from([statusNode, space]), {
|
|
19
|
-
selectInlineNode: true
|
|
20
|
-
});
|
|
21
|
-
const showStatusPickerAt = tr.selection.from + showStatusPickerAtOffset;
|
|
22
|
-
return tr.setSelection(NodeSelection.create(tr.doc, showStatusPickerAt)).setMeta(pluginKey, {
|
|
23
|
-
showStatusPickerAt,
|
|
24
|
-
isNew: true
|
|
25
|
-
});
|
|
32
|
+
return verifyAndInsertStatus(statusNode, state);
|
|
26
33
|
};
|
|
27
34
|
export const updateStatus = status => (state, dispatch) => {
|
|
28
35
|
const {
|
|
@@ -43,18 +50,7 @@ export const updateStatus = status => (state, dispatch) => {
|
|
|
43
50
|
if (!showStatusPickerAt) {
|
|
44
51
|
// Same behaviour as quick insert (used in createStatus)
|
|
45
52
|
const statusNode = schema.nodes.status.createChecked(statusProps);
|
|
46
|
-
|
|
47
|
-
const insertable = canInsert(tr.selection.$from, fragment);
|
|
48
|
-
if (!insertable) {
|
|
49
|
-
const parentSelection = NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
50
|
-
tr.insert(parentSelection.to, fragment).setSelection(NodeSelection.create(tr.doc, parentSelection.to + 1));
|
|
51
|
-
} else {
|
|
52
|
-
tr.insert(tr.selection.from, fragment).setSelection(NodeSelection.create(tr.doc, tr.selection.from - fragment.size));
|
|
53
|
-
}
|
|
54
|
-
tr.setMeta(pluginKey, {
|
|
55
|
-
showStatusPickerAt: tr.selection.from,
|
|
56
|
-
isNew: true
|
|
57
|
-
}).scrollIntoView();
|
|
53
|
+
tr = verifyAndInsertStatus(statusNode, state);
|
|
58
54
|
if (dispatch) {
|
|
59
55
|
dispatch(tr);
|
|
60
56
|
}
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -113,7 +113,7 @@ const decorateWithPluginOptions = (plugin, options, api) => {
|
|
|
113
113
|
icon: () => /*#__PURE__*/React.createElement(IconStatus, null),
|
|
114
114
|
action(insert, state) {
|
|
115
115
|
var _api$analytics2;
|
|
116
|
-
const tr = createStatus(
|
|
116
|
+
const tr = createStatus(state);
|
|
117
117
|
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
118
118
|
action: ACTION.INSERTED,
|
|
119
119
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
package/dist/esm/actions.js
CHANGED
|
@@ -12,22 +12,26 @@ export var DEFAULT_STATUS = {
|
|
|
12
12
|
text: '',
|
|
13
13
|
color: 'neutral'
|
|
14
14
|
};
|
|
15
|
-
export var
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
export var verifyAndInsertStatus = function verifyAndInsertStatus(statusNode, state) {
|
|
16
|
+
var fragment = Fragment.fromArray([statusNode, state.schema.text(' ')]);
|
|
17
|
+
var tr = state.tr;
|
|
18
|
+
var insertable = canInsert(tr.selection.$from, fragment);
|
|
19
|
+
if (!insertable) {
|
|
20
|
+
var parentSelection = NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
21
|
+
tr.insert(parentSelection.to, fragment).setSelection(NodeSelection.create(tr.doc, parentSelection.to + 1));
|
|
22
|
+
} else {
|
|
23
|
+
tr.insert(tr.selection.from, fragment).setSelection(NodeSelection.create(tr.doc, tr.selection.from - fragment.size));
|
|
24
|
+
}
|
|
25
|
+
return tr.setMeta(pluginKey, {
|
|
26
|
+
showStatusPickerAt: tr.selection.from,
|
|
27
|
+
isNew: true
|
|
28
|
+
}).scrollIntoView();
|
|
29
|
+
};
|
|
30
|
+
export var createStatus = function createStatus(state) {
|
|
31
|
+
var statusNode = state.schema.nodes.status.createChecked(_objectSpread(_objectSpread({}, DEFAULT_STATUS), {}, {
|
|
32
|
+
localId: uuid.generate()
|
|
33
|
+
}));
|
|
34
|
+
return verifyAndInsertStatus(statusNode, state);
|
|
31
35
|
};
|
|
32
36
|
export var updateStatus = function updateStatus(status) {
|
|
33
37
|
return function (state, dispatch) {
|
|
@@ -43,18 +47,7 @@ export var updateStatus = function updateStatus(status) {
|
|
|
43
47
|
if (!showStatusPickerAt) {
|
|
44
48
|
// Same behaviour as quick insert (used in createStatus)
|
|
45
49
|
var statusNode = schema.nodes.status.createChecked(statusProps);
|
|
46
|
-
|
|
47
|
-
var insertable = canInsert(tr.selection.$from, fragment);
|
|
48
|
-
if (!insertable) {
|
|
49
|
-
var parentSelection = NodeSelection.create(tr.doc, tr.selection.from - tr.selection.$anchor.parentOffset - 1);
|
|
50
|
-
tr.insert(parentSelection.to, fragment).setSelection(NodeSelection.create(tr.doc, parentSelection.to + 1));
|
|
51
|
-
} else {
|
|
52
|
-
tr.insert(tr.selection.from, fragment).setSelection(NodeSelection.create(tr.doc, tr.selection.from - fragment.size));
|
|
53
|
-
}
|
|
54
|
-
tr.setMeta(pluginKey, {
|
|
55
|
-
showStatusPickerAt: tr.selection.from,
|
|
56
|
-
isNew: true
|
|
57
|
-
}).scrollIntoView();
|
|
50
|
+
tr = verifyAndInsertStatus(statusNode, state);
|
|
58
51
|
if (dispatch) {
|
|
59
52
|
dispatch(tr);
|
|
60
53
|
}
|
package/dist/esm/plugin.js
CHANGED
|
@@ -112,7 +112,7 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
112
112
|
},
|
|
113
113
|
action: function action(insert, state) {
|
|
114
114
|
var _api$analytics2;
|
|
115
|
-
var tr = createStatus(
|
|
115
|
+
var tr = createStatus(state);
|
|
116
116
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
117
117
|
action: ACTION.INSERTED,
|
|
118
118
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
package/dist/types/actions.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Command, CommandDispatch, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
6
|
import type { ClosingPayload, StatusType } from './types';
|
|
6
7
|
export declare const DEFAULT_STATUS: StatusType;
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
}) => Transaction, state: EditorState) => Transaction;
|
|
8
|
+
export declare const verifyAndInsertStatus: (statusNode: Node, state: EditorState) => Transaction;
|
|
9
|
+
export declare const createStatus: (state: EditorState) => Transaction;
|
|
10
10
|
export declare const updateStatus: (status?: StatusType) => Command;
|
|
11
11
|
export type UpdateStatus = (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
|
|
12
12
|
export declare const updateStatusWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Command, CommandDispatch, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
6
|
import type { ClosingPayload, StatusType } from './types';
|
|
6
7
|
export declare const DEFAULT_STATUS: StatusType;
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
}) => Transaction, state: EditorState) => Transaction;
|
|
8
|
+
export declare const verifyAndInsertStatus: (statusNode: Node, state: EditorState) => Transaction;
|
|
9
|
+
export declare const createStatus: (state: EditorState) => Transaction;
|
|
10
10
|
export declare const updateStatus: (status?: StatusType) => Command;
|
|
11
11
|
export type UpdateStatus = (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
|
|
12
12
|
export declare const updateStatusWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-status",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Status plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/adf-schema": "^
|
|
34
|
+
"@atlaskit/adf-schema": "^33.2.3",
|
|
35
35
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
|
-
"@atlaskit/editor-common": "^76.
|
|
36
|
+
"@atlaskit/editor-common": "^76.22.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^0.3.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
39
39
|
"@atlaskit/editor-shared-styles": "^2.8.0",
|