@atlaskit/editor-plugin-tasks-and-decisions 9.1.18 → 9.1.20
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/tasksAndDecisionsPlugin.js +14 -0
- package/dist/cjs/ui/DecisionListBlockMenuItem/DecisionListBlockMenuItem.js +51 -0
- package/dist/cjs/ui/TaskListBlockMenuItem/TaskListBlockMenuItem.js +5 -2
- package/dist/es2019/tasksAndDecisionsPlugin.js +13 -1
- package/dist/es2019/ui/DecisionListBlockMenuItem/DecisionListBlockMenuItem.js +45 -0
- package/dist/es2019/ui/TaskListBlockMenuItem/TaskListBlockMenuItem.js +5 -2
- package/dist/esm/tasksAndDecisionsPlugin.js +15 -1
- package/dist/esm/ui/DecisionListBlockMenuItem/DecisionListBlockMenuItem.js +42 -0
- package/dist/esm/ui/TaskListBlockMenuItem/TaskListBlockMenuItem.js +5 -2
- package/dist/types/ui/DecisionListBlockMenuItem/DecisionListBlockMenuItem.d.ts +6 -0
- package/dist/types-ts4.5/ui/DecisionListBlockMenuItem/DecisionListBlockMenuItem.d.ts +6 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-tasks-and-decisions
|
|
2
2
|
|
|
3
|
+
## 9.1.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.1.19
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`e3779b75fdeca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3779b75fdeca) -
|
|
14
|
+
EDITOR-1643 Promote syncBlock and bodiedSyncBlock to full schema
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 9.1.18
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -32,6 +32,7 @@ var _keymaps = _interopRequireWildcard(require("./pm-plugins/keymaps"));
|
|
|
32
32
|
var _main = require("./pm-plugins/main");
|
|
33
33
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
34
34
|
var _toggleTasklistCommands = require("./pm-plugins/toggle-tasklist-commands");
|
|
35
|
+
var _DecisionListBlockMenuItem = require("./ui/DecisionListBlockMenuItem/DecisionListBlockMenuItem");
|
|
35
36
|
var _RequestToEditPopup = require("./ui/Task/RequestToEditPopup");
|
|
36
37
|
var _TaskListBlockMenuItem = require("./ui/TaskListBlockMenuItem/TaskListBlockMenuItem");
|
|
37
38
|
var _toolbarComponents = require("./ui/toolbar-components");
|
|
@@ -139,6 +140,19 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
|
|
|
139
140
|
api: api
|
|
140
141
|
});
|
|
141
142
|
}
|
|
143
|
+
}, {
|
|
144
|
+
type: 'block-menu-item',
|
|
145
|
+
key: _blockMenu.TRANSFORM_STRUCTURE_DECISION_MENU_ITEM.key,
|
|
146
|
+
parent: {
|
|
147
|
+
type: 'block-menu-section',
|
|
148
|
+
key: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
149
|
+
rank: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION_RANK[_blockMenu.TRANSFORM_STRUCTURE_DECISION_MENU_ITEM.key]
|
|
150
|
+
},
|
|
151
|
+
component: function component() {
|
|
152
|
+
return /*#__PURE__*/React.createElement(_DecisionListBlockMenuItem.DecisionListBlockMenuItem, {
|
|
153
|
+
api: api
|
|
154
|
+
});
|
|
155
|
+
}
|
|
142
156
|
}]);
|
|
143
157
|
}
|
|
144
158
|
return {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.DecisionListBlockMenuItem = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactIntlNext = require("react-intl-next");
|
|
11
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
|
+
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
|
+
var _decision = _interopRequireDefault(require("@atlaskit/icon/core/decision"));
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
|
+
var DecisionListBlockMenuItem = exports.DecisionListBlockMenuItem = function DecisionListBlockMenuItem(_ref) {
|
|
18
|
+
var api = _ref.api;
|
|
19
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
20
|
+
formatMessage = _useIntl.formatMessage;
|
|
21
|
+
var selection = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
|
|
22
|
+
var _states$selectionStat;
|
|
23
|
+
return (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection;
|
|
24
|
+
});
|
|
25
|
+
var isSelected = (0, _react.useMemo)(function () {
|
|
26
|
+
return selection && selection.$from.parent.type.name === 'decisionItem';
|
|
27
|
+
}, [selection]);
|
|
28
|
+
var onClick = function onClick(event) {
|
|
29
|
+
var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
|
|
30
|
+
var inputMethod = _analytics.INPUT_METHOD.BLOCK_MENU;
|
|
31
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
32
|
+
var _api$blockMenu;
|
|
33
|
+
var tr = _ref2.tr;
|
|
34
|
+
var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.decisionList, {
|
|
35
|
+
inputMethod: inputMethod,
|
|
36
|
+
triggeredFrom: triggeredFrom,
|
|
37
|
+
targetTypeName: 'decisionList'
|
|
38
|
+
});
|
|
39
|
+
return command ? command({
|
|
40
|
+
tr: tr
|
|
41
|
+
}) : null;
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
45
|
+
isSelected: isSelected,
|
|
46
|
+
onClick: onClick,
|
|
47
|
+
elemBefore: /*#__PURE__*/_react.default.createElement(_decision.default, {
|
|
48
|
+
label: ""
|
|
49
|
+
})
|
|
50
|
+
}, formatMessage(_messages.blockMenuMessages.decisionList));
|
|
51
|
+
};
|
|
@@ -9,8 +9,8 @@ exports.TaskListBlockMenuItem = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _reactIntlNext = require("react-intl-next");
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
14
14
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
15
15
|
var _task = _interopRequireDefault(require("@atlaskit/icon/core/task"));
|
|
16
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -18,7 +18,10 @@ var TaskListBlockMenuItem = exports.TaskListBlockMenuItem = function TaskListBlo
|
|
|
18
18
|
var api = _ref.api;
|
|
19
19
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
20
20
|
formatMessage = _useIntl.formatMessage;
|
|
21
|
-
var selection = (0,
|
|
21
|
+
var selection = (0, _hooks.useSharedPluginStateWithSelector)(api, ['selection'], function (states) {
|
|
22
|
+
var _states$selectionStat;
|
|
23
|
+
return (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection;
|
|
24
|
+
});
|
|
22
25
|
var isSelected = (0, _react.useMemo)(function () {
|
|
23
26
|
return selection && selection.$from.parent.type.name === 'taskItem';
|
|
24
27
|
}, [selection]);
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { decisionList, taskList } from '@atlaskit/adf-schema';
|
|
6
6
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
|
-
import { TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
7
|
+
import { TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
|
|
8
8
|
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
9
9
|
import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
|
|
@@ -23,6 +23,7 @@ import keymap, { getIndentCommand, getUnindentCommand } from './pm-plugins/keyma
|
|
|
23
23
|
import { createPlugin } from './pm-plugins/main';
|
|
24
24
|
import { stateKey as taskPluginKey } from './pm-plugins/plugin-key';
|
|
25
25
|
import { toggleTaskList } from './pm-plugins/toggle-tasklist-commands';
|
|
26
|
+
import { DecisionListBlockMenuItem } from './ui/DecisionListBlockMenuItem/DecisionListBlockMenuItem';
|
|
26
27
|
import { RequestToEditPopup } from './ui/Task/RequestToEditPopup';
|
|
27
28
|
import { TaskListBlockMenuItem } from './ui/TaskListBlockMenuItem/TaskListBlockMenuItem';
|
|
28
29
|
import { getTasksAndDecisionsToolbarComponents } from './ui/toolbar-components';
|
|
@@ -125,6 +126,17 @@ export const tasksAndDecisionsPlugin = ({
|
|
|
125
126
|
component: () => /*#__PURE__*/React.createElement(TaskListBlockMenuItem, {
|
|
126
127
|
api: api
|
|
127
128
|
})
|
|
129
|
+
}, {
|
|
130
|
+
type: 'block-menu-item',
|
|
131
|
+
key: TRANSFORM_STRUCTURE_DECISION_MENU_ITEM.key,
|
|
132
|
+
parent: {
|
|
133
|
+
type: 'block-menu-section',
|
|
134
|
+
key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
135
|
+
rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_DECISION_MENU_ITEM.key]
|
|
136
|
+
},
|
|
137
|
+
component: () => /*#__PURE__*/React.createElement(DecisionListBlockMenuItem, {
|
|
138
|
+
api: api
|
|
139
|
+
})
|
|
128
140
|
}]);
|
|
129
141
|
}
|
|
130
142
|
return {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import DecisionIcon from '@atlaskit/icon/core/decision';
|
|
8
|
+
export const DecisionListBlockMenuItem = ({
|
|
9
|
+
api
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
formatMessage
|
|
13
|
+
} = useIntl();
|
|
14
|
+
const selection = useSharedPluginStateWithSelector(api, ['selection'], states => {
|
|
15
|
+
var _states$selectionStat;
|
|
16
|
+
return (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection;
|
|
17
|
+
});
|
|
18
|
+
const isSelected = useMemo(() => {
|
|
19
|
+
return selection && selection.$from.parent.type.name === 'decisionItem';
|
|
20
|
+
}, [selection]);
|
|
21
|
+
const onClick = event => {
|
|
22
|
+
const triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
|
|
23
|
+
const inputMethod = INPUT_METHOD.BLOCK_MENU;
|
|
24
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
25
|
+
tr
|
|
26
|
+
}) => {
|
|
27
|
+
var _api$blockMenu;
|
|
28
|
+
const command = api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.decisionList, {
|
|
29
|
+
inputMethod,
|
|
30
|
+
triggeredFrom,
|
|
31
|
+
targetTypeName: 'decisionList'
|
|
32
|
+
});
|
|
33
|
+
return command ? command({
|
|
34
|
+
tr
|
|
35
|
+
}) : null;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
39
|
+
isSelected: isSelected,
|
|
40
|
+
onClick: onClick,
|
|
41
|
+
elemBefore: /*#__PURE__*/React.createElement(DecisionIcon, {
|
|
42
|
+
label: ""
|
|
43
|
+
})
|
|
44
|
+
}, formatMessage(blockMenuMessages.decisionList));
|
|
45
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
5
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
6
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
7
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
8
8
|
export const TaskListBlockMenuItem = ({
|
|
@@ -11,7 +11,10 @@ export const TaskListBlockMenuItem = ({
|
|
|
11
11
|
const {
|
|
12
12
|
formatMessage
|
|
13
13
|
} = useIntl();
|
|
14
|
-
const selection =
|
|
14
|
+
const selection = useSharedPluginStateWithSelector(api, ['selection'], states => {
|
|
15
|
+
var _states$selectionStat;
|
|
16
|
+
return (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection;
|
|
17
|
+
});
|
|
15
18
|
const isSelected = useMemo(() => {
|
|
16
19
|
return selection && selection.$from.parent.type.name === 'taskItem';
|
|
17
20
|
}, [selection]);
|
|
@@ -7,7 +7,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { decisionList, taskList } from '@atlaskit/adf-schema';
|
|
9
9
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
10
|
-
import { TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
|
|
10
|
+
import { TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
|
|
11
11
|
import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
|
|
12
12
|
import { toolbarInsertBlockMessages as insertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
13
13
|
import { IconAction, IconDecision } from '@atlaskit/editor-common/quick-insert';
|
|
@@ -26,6 +26,7 @@ import keymap, { getIndentCommand, getUnindentCommand } from './pm-plugins/keyma
|
|
|
26
26
|
import { createPlugin } from './pm-plugins/main';
|
|
27
27
|
import { stateKey as taskPluginKey } from './pm-plugins/plugin-key';
|
|
28
28
|
import { toggleTaskList } from './pm-plugins/toggle-tasklist-commands';
|
|
29
|
+
import { DecisionListBlockMenuItem } from './ui/DecisionListBlockMenuItem/DecisionListBlockMenuItem';
|
|
29
30
|
import { RequestToEditPopup } from './ui/Task/RequestToEditPopup';
|
|
30
31
|
import { TaskListBlockMenuItem } from './ui/TaskListBlockMenuItem/TaskListBlockMenuItem';
|
|
31
32
|
import { getTasksAndDecisionsToolbarComponents } from './ui/toolbar-components';
|
|
@@ -130,6 +131,19 @@ export var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref3) {
|
|
|
130
131
|
api: api
|
|
131
132
|
});
|
|
132
133
|
}
|
|
134
|
+
}, {
|
|
135
|
+
type: 'block-menu-item',
|
|
136
|
+
key: TRANSFORM_STRUCTURE_DECISION_MENU_ITEM.key,
|
|
137
|
+
parent: {
|
|
138
|
+
type: 'block-menu-section',
|
|
139
|
+
key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
|
|
140
|
+
rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_DECISION_MENU_ITEM.key]
|
|
141
|
+
},
|
|
142
|
+
component: function component() {
|
|
143
|
+
return /*#__PURE__*/React.createElement(DecisionListBlockMenuItem, {
|
|
144
|
+
api: api
|
|
145
|
+
});
|
|
146
|
+
}
|
|
133
147
|
}]);
|
|
134
148
|
}
|
|
135
149
|
return {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { blockMenuMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
|
+
import DecisionIcon from '@atlaskit/icon/core/decision';
|
|
8
|
+
export var DecisionListBlockMenuItem = function DecisionListBlockMenuItem(_ref) {
|
|
9
|
+
var api = _ref.api;
|
|
10
|
+
var _useIntl = useIntl(),
|
|
11
|
+
formatMessage = _useIntl.formatMessage;
|
|
12
|
+
var selection = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
13
|
+
var _states$selectionStat;
|
|
14
|
+
return (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection;
|
|
15
|
+
});
|
|
16
|
+
var isSelected = useMemo(function () {
|
|
17
|
+
return selection && selection.$from.parent.type.name === 'decisionItem';
|
|
18
|
+
}, [selection]);
|
|
19
|
+
var onClick = function onClick(event) {
|
|
20
|
+
var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
|
|
21
|
+
var inputMethod = INPUT_METHOD.BLOCK_MENU;
|
|
22
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
|
|
23
|
+
var _api$blockMenu;
|
|
24
|
+
var tr = _ref2.tr;
|
|
25
|
+
var command = api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.transformNode(tr.doc.type.schema.nodes.decisionList, {
|
|
26
|
+
inputMethod: inputMethod,
|
|
27
|
+
triggeredFrom: triggeredFrom,
|
|
28
|
+
targetTypeName: 'decisionList'
|
|
29
|
+
});
|
|
30
|
+
return command ? command({
|
|
31
|
+
tr: tr
|
|
32
|
+
}) : null;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
36
|
+
isSelected: isSelected,
|
|
37
|
+
onClick: onClick,
|
|
38
|
+
elemBefore: /*#__PURE__*/React.createElement(DecisionIcon, {
|
|
39
|
+
label: ""
|
|
40
|
+
})
|
|
41
|
+
}, formatMessage(blockMenuMessages.decisionList));
|
|
42
|
+
};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
5
|
import { tasksAndDecisionsMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
6
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
7
7
|
import TaskIcon from '@atlaskit/icon/core/task';
|
|
8
8
|
export var TaskListBlockMenuItem = function TaskListBlockMenuItem(_ref) {
|
|
9
9
|
var api = _ref.api;
|
|
10
10
|
var _useIntl = useIntl(),
|
|
11
11
|
formatMessage = _useIntl.formatMessage;
|
|
12
|
-
var selection =
|
|
12
|
+
var selection = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
13
|
+
var _states$selectionStat;
|
|
14
|
+
return (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection;
|
|
15
|
+
});
|
|
13
16
|
var isSelected = useMemo(function () {
|
|
14
17
|
return selection && selection.$from.parent.type.name === 'taskItem';
|
|
15
18
|
}, [selection]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { TasksAndDecisionsPlugin } from '../../tasksAndDecisionsPluginType';
|
|
4
|
+
export declare const DecisionListBlockMenuItem: ({ api, }: {
|
|
5
|
+
api: ExtractInjectionAPI<TasksAndDecisionsPlugin> | undefined;
|
|
6
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { TasksAndDecisionsPlugin } from '../../tasksAndDecisionsPluginType';
|
|
4
|
+
export declare const DecisionListBlockMenuItem: ({ api, }: {
|
|
5
|
+
api: ExtractInjectionAPI<TasksAndDecisionsPlugin> | undefined;
|
|
6
|
+
}) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-tasks-and-decisions",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.20",
|
|
4
4
|
"description": "Tasks and decisions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^51.
|
|
32
|
+
"@atlaskit/adf-schema": "^51.5.1",
|
|
33
33
|
"@atlaskit/analytics-namespaced-context": "^7.2.0",
|
|
34
34
|
"@atlaskit/css": "^0.17.0",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
@@ -49,14 +49,14 @@
|
|
|
49
49
|
"@atlaskit/primitives": "^16.4.0",
|
|
50
50
|
"@atlaskit/prosemirror-input-rules": "^3.6.0",
|
|
51
51
|
"@atlaskit/task-decision": "^19.2.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^15.0.0",
|
|
53
53
|
"@atlaskit/tokens": "^8.4.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@compiled/react": "^0.18.6",
|
|
56
56
|
"bind-event-listener": "^3.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@atlaskit/editor-common": "^110.
|
|
59
|
+
"@atlaskit/editor-common": "^110.40.0",
|
|
60
60
|
"react": "^18.2.0",
|
|
61
61
|
"react-dom": "^18.2.0",
|
|
62
62
|
"react-intl-next": "npm:react-intl@^5.18.1"
|