@atlaskit/editor-plugin-list 15.0.1 → 15.0.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 +8 -0
- package/dist/cjs/listPlugin.js +10 -1
- package/dist/cjs/ui/quick-insert/ListQuickInsertMenuItem.js +48 -0
- package/dist/cjs/ui/quick-insert/getListQuickInsertComponents.js +39 -0
- package/dist/es2019/listPlugin.js +10 -1
- package/dist/es2019/ui/quick-insert/ListQuickInsertMenuItem.js +45 -0
- package/dist/es2019/ui/quick-insert/getListQuickInsertComponents.js +28 -0
- package/dist/esm/listPlugin.js +10 -1
- package/dist/esm/ui/quick-insert/ListQuickInsertMenuItem.js +40 -0
- package/dist/esm/ui/quick-insert/getListQuickInsertComponents.js +32 -0
- package/dist/types/listPluginType.d.ts +3 -1
- package/dist/types/ui/quick-insert/ListQuickInsertMenuItem.d.ts +9 -0
- package/dist/types/ui/quick-insert/getListQuickInsertComponents.d.ts +6 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-list
|
|
2
2
|
|
|
3
|
+
## 15.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7087f393ec725`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7087f393ec725) -
|
|
8
|
+
Add the categorized registered Quick Insert browse experience with representative native elements
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 15.0.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cjs/listPlugin.js
CHANGED
|
@@ -11,6 +11,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
11
11
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
14
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
14
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
17
|
var _commands = require("./pm-plugins/commands");
|
|
@@ -22,6 +23,7 @@ var _main = require("./pm-plugins/main");
|
|
|
22
23
|
var _find = require("./pm-plugins/utils/find");
|
|
23
24
|
var _selection = require("./pm-plugins/utils/selection");
|
|
24
25
|
var _ui = require("./ui");
|
|
26
|
+
var _getListQuickInsertComponents = require("./ui/quick-insert/getListQuickInsertComponents");
|
|
25
27
|
// Ignored via go/ees005
|
|
26
28
|
// eslint-disable-next-line import/no-named-as-default
|
|
27
29
|
|
|
@@ -43,6 +45,13 @@ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
|
|
|
43
45
|
var _api$blockMenu;
|
|
44
46
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents((0, _ui.getListComponents)(api));
|
|
45
47
|
}
|
|
48
|
+
var isRegisteredSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
|
|
49
|
+
if (isRegisteredSlashCommandEnabled) {
|
|
50
|
+
var _api$uiControlRegistr;
|
|
51
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _getListQuickInsertComponents.getListQuickInsertComponents)({
|
|
52
|
+
api: api
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
46
55
|
return {
|
|
47
56
|
name: 'list',
|
|
48
57
|
actions: {
|
|
@@ -103,7 +112,7 @@ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
|
|
|
103
112
|
}
|
|
104
113
|
}];
|
|
105
114
|
},
|
|
106
|
-
pluginsOptions: {
|
|
115
|
+
pluginsOptions: isRegisteredSlashCommandEnabled ? {} : {
|
|
107
116
|
quickInsert: function quickInsert(_ref4) {
|
|
108
117
|
var formatMessage = _ref4.formatMessage;
|
|
109
118
|
return [{
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ListQuickInsertMenuItem = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactIntl = require("react-intl");
|
|
10
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
+
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
14
|
+
var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
|
|
15
|
+
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); }
|
|
16
|
+
var ListQuickInsertMenuItem = exports.ListQuickInsertMenuItem = function ListQuickInsertMenuItem(_ref) {
|
|
17
|
+
var api = _ref.api,
|
|
18
|
+
type = _ref.type;
|
|
19
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
20
|
+
formatMessage = _useIntl.formatMessage;
|
|
21
|
+
var isOrdered = type === 'ordered';
|
|
22
|
+
var onSelect = (0, _react.useCallback)(function (_ref2) {
|
|
23
|
+
var _api$analytics;
|
|
24
|
+
var editorView = _ref2.editorView,
|
|
25
|
+
insert = _ref2.insert,
|
|
26
|
+
source = _ref2.source;
|
|
27
|
+
var schema = editorView.state.schema;
|
|
28
|
+
var listNode = isOrdered ? schema.nodes.orderedList : schema.nodes.bulletList;
|
|
29
|
+
var actionSubjectId = isOrdered ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET;
|
|
30
|
+
var tr = insert(listNode.createChecked({}, schema.nodes.listItem.createChecked({}, schema.nodes.paragraph.createChecked())));
|
|
31
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
32
|
+
action: _analytics.ACTION.INSERTED,
|
|
33
|
+
actionSubject: _analytics.ACTION_SUBJECT.LIST,
|
|
34
|
+
actionSubjectId: actionSubjectId,
|
|
35
|
+
attributes: {
|
|
36
|
+
inputMethod: source
|
|
37
|
+
},
|
|
38
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
39
|
+
})(tr);
|
|
40
|
+
return tr;
|
|
41
|
+
}, [api, isOrdered]);
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
|
|
43
|
+
iconBefore: isOrdered ? /*#__PURE__*/_react.default.createElement(_quickInsert.IconListNumber, null) : /*#__PURE__*/_react.default.createElement(_quickInsert.IconList, null),
|
|
44
|
+
onSelect: onSelect,
|
|
45
|
+
shortcut: (0, _keymaps.tooltip)(isOrdered ? _keymaps.toggleOrderedList : _keymaps.toggleBulletList),
|
|
46
|
+
title: formatMessage(isOrdered ? _messages.listMessages.orderedList : _messages.listMessages.unorderedList)
|
|
47
|
+
});
|
|
48
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getListQuickInsertComponents = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
|
|
10
|
+
var _rank = require("@atlaskit/editor-common/quick-insert/rank");
|
|
11
|
+
var _ListQuickInsertMenuItem = require("./ListQuickInsertMenuItem");
|
|
12
|
+
var getListQuickInsertComponents = exports.getListQuickInsertComponents = function getListQuickInsertComponents(_ref) {
|
|
13
|
+
var api = _ref.api;
|
|
14
|
+
return [{
|
|
15
|
+
item: _keys.UNORDERED_LIST_MENU_ITEM,
|
|
16
|
+
type: 'unordered'
|
|
17
|
+
}, {
|
|
18
|
+
item: _keys.ORDERED_LIST_MENU_ITEM,
|
|
19
|
+
type: 'ordered'
|
|
20
|
+
}].map(function (_ref2) {
|
|
21
|
+
var item = _ref2.item,
|
|
22
|
+
type = _ref2.type;
|
|
23
|
+
return {
|
|
24
|
+
key: item.key,
|
|
25
|
+
type: item.type,
|
|
26
|
+
parents: [{
|
|
27
|
+
key: _keys.TEXT_FORMATTING_SECTION.key,
|
|
28
|
+
type: _keys.TEXT_FORMATTING_SECTION.type,
|
|
29
|
+
rank: _rank.TEXT_FORMATTING_SECTION_RANK[item.key]
|
|
30
|
+
}],
|
|
31
|
+
component: function component() {
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_ListQuickInsertMenuItem.ListQuickInsertMenuItem, {
|
|
33
|
+
api: api,
|
|
34
|
+
type: type
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
};
|
|
@@ -4,6 +4,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
4
4
|
import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { listMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
10
|
import { toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggleOrderedListCommand } from './pm-plugins/commands';
|
|
@@ -17,6 +18,7 @@ import { createPlugin, pluginKey as listPluginKey } from './pm-plugins/main';
|
|
|
17
18
|
import { findRootParentListNode } from './pm-plugins/utils/find';
|
|
18
19
|
import { isInsideListItem } from './pm-plugins/utils/selection';
|
|
19
20
|
import { getListComponents } from './ui';
|
|
21
|
+
import { getListQuickInsertComponents } from './ui/quick-insert/getListQuickInsertComponents';
|
|
20
22
|
|
|
21
23
|
/*
|
|
22
24
|
Toolbar buttons to bullet and ordered list can be found in
|
|
@@ -37,6 +39,13 @@ export const listPlugin = ({
|
|
|
37
39
|
var _api$blockMenu;
|
|
38
40
|
api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents(getListComponents(api));
|
|
39
41
|
}
|
|
42
|
+
const isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
43
|
+
if (isRegisteredSlashCommandEnabled) {
|
|
44
|
+
var _api$uiControlRegistr;
|
|
45
|
+
api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getListQuickInsertComponents({
|
|
46
|
+
api
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
40
49
|
return {
|
|
41
50
|
name: 'list',
|
|
42
51
|
actions: {
|
|
@@ -95,7 +104,7 @@ export const listPlugin = ({
|
|
|
95
104
|
}
|
|
96
105
|
}];
|
|
97
106
|
},
|
|
98
|
-
pluginsOptions: {
|
|
107
|
+
pluginsOptions: isRegisteredSlashCommandEnabled ? {} : {
|
|
99
108
|
quickInsert: ({
|
|
100
109
|
formatMessage
|
|
101
110
|
}) => {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
|
+
import { listMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
8
|
+
export const ListQuickInsertMenuItem = ({
|
|
9
|
+
api,
|
|
10
|
+
type
|
|
11
|
+
}) => {
|
|
12
|
+
const {
|
|
13
|
+
formatMessage
|
|
14
|
+
} = useIntl();
|
|
15
|
+
const isOrdered = type === 'ordered';
|
|
16
|
+
const onSelect = useCallback(({
|
|
17
|
+
editorView,
|
|
18
|
+
insert,
|
|
19
|
+
source
|
|
20
|
+
}) => {
|
|
21
|
+
var _api$analytics;
|
|
22
|
+
const {
|
|
23
|
+
schema
|
|
24
|
+
} = editorView.state;
|
|
25
|
+
const listNode = isOrdered ? schema.nodes.orderedList : schema.nodes.bulletList;
|
|
26
|
+
const actionSubjectId = isOrdered ? ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER : ACTION_SUBJECT_ID.FORMAT_LIST_BULLET;
|
|
27
|
+
const tr = insert(listNode.createChecked({}, schema.nodes.listItem.createChecked({}, schema.nodes.paragraph.createChecked())));
|
|
28
|
+
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.attachAnalyticsEvent({
|
|
29
|
+
action: ACTION.INSERTED,
|
|
30
|
+
actionSubject: ACTION_SUBJECT.LIST,
|
|
31
|
+
actionSubjectId,
|
|
32
|
+
attributes: {
|
|
33
|
+
inputMethod: source
|
|
34
|
+
},
|
|
35
|
+
eventType: EVENT_TYPE.TRACK
|
|
36
|
+
})(tr);
|
|
37
|
+
return tr;
|
|
38
|
+
}, [api, isOrdered]);
|
|
39
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
40
|
+
iconBefore: isOrdered ? /*#__PURE__*/React.createElement(IconListNumber, null) : /*#__PURE__*/React.createElement(IconList, null),
|
|
41
|
+
onSelect: onSelect,
|
|
42
|
+
shortcut: tooltip(isOrdered ? toggleOrderedList : toggleBulletList),
|
|
43
|
+
title: formatMessage(isOrdered ? messages.orderedList : messages.unorderedList)
|
|
44
|
+
});
|
|
45
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ORDERED_LIST_MENU_ITEM, TEXT_FORMATTING_SECTION, UNORDERED_LIST_MENU_ITEM } from '@atlaskit/editor-common/quick-insert/keys';
|
|
3
|
+
import { TEXT_FORMATTING_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
4
|
+
import { ListQuickInsertMenuItem } from './ListQuickInsertMenuItem';
|
|
5
|
+
export const getListQuickInsertComponents = ({
|
|
6
|
+
api
|
|
7
|
+
}) => [{
|
|
8
|
+
item: UNORDERED_LIST_MENU_ITEM,
|
|
9
|
+
type: 'unordered'
|
|
10
|
+
}, {
|
|
11
|
+
item: ORDERED_LIST_MENU_ITEM,
|
|
12
|
+
type: 'ordered'
|
|
13
|
+
}].map(({
|
|
14
|
+
item,
|
|
15
|
+
type
|
|
16
|
+
}) => ({
|
|
17
|
+
key: item.key,
|
|
18
|
+
type: item.type,
|
|
19
|
+
parents: [{
|
|
20
|
+
key: TEXT_FORMATTING_SECTION.key,
|
|
21
|
+
type: TEXT_FORMATTING_SECTION.type,
|
|
22
|
+
rank: TEXT_FORMATTING_SECTION_RANK[item.key]
|
|
23
|
+
}],
|
|
24
|
+
component: () => /*#__PURE__*/React.createElement(ListQuickInsertMenuItem, {
|
|
25
|
+
api: api,
|
|
26
|
+
type: type
|
|
27
|
+
})
|
|
28
|
+
}));
|
package/dist/esm/listPlugin.js
CHANGED
|
@@ -4,6 +4,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
4
4
|
import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { listMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
7
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
10
|
import { toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggleOrderedListCommand } from './pm-plugins/commands';
|
|
@@ -17,6 +18,7 @@ import { createPlugin, pluginKey as listPluginKey } from './pm-plugins/main';
|
|
|
17
18
|
import { findRootParentListNode } from './pm-plugins/utils/find';
|
|
18
19
|
import { isInsideListItem } from './pm-plugins/utils/selection';
|
|
19
20
|
import { getListComponents } from './ui';
|
|
21
|
+
import { getListQuickInsertComponents } from './ui/quick-insert/getListQuickInsertComponents';
|
|
20
22
|
|
|
21
23
|
/*
|
|
22
24
|
Toolbar buttons to bullet and ordered list can be found in
|
|
@@ -36,6 +38,13 @@ export var listPlugin = function listPlugin(_ref) {
|
|
|
36
38
|
var _api$blockMenu;
|
|
37
39
|
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(getListComponents(api));
|
|
38
40
|
}
|
|
41
|
+
var isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
42
|
+
if (isRegisteredSlashCommandEnabled) {
|
|
43
|
+
var _api$uiControlRegistr;
|
|
44
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getListQuickInsertComponents({
|
|
45
|
+
api: api
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
39
48
|
return {
|
|
40
49
|
name: 'list',
|
|
41
50
|
actions: {
|
|
@@ -96,7 +105,7 @@ export var listPlugin = function listPlugin(_ref) {
|
|
|
96
105
|
}
|
|
97
106
|
}];
|
|
98
107
|
},
|
|
99
|
-
pluginsOptions: {
|
|
108
|
+
pluginsOptions: isRegisteredSlashCommandEnabled ? {} : {
|
|
100
109
|
quickInsert: function quickInsert(_ref4) {
|
|
101
110
|
var formatMessage = _ref4.formatMessage;
|
|
102
111
|
return [{
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
|
+
import { listMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
8
|
+
export var ListQuickInsertMenuItem = function ListQuickInsertMenuItem(_ref) {
|
|
9
|
+
var api = _ref.api,
|
|
10
|
+
type = _ref.type;
|
|
11
|
+
var _useIntl = useIntl(),
|
|
12
|
+
formatMessage = _useIntl.formatMessage;
|
|
13
|
+
var isOrdered = type === 'ordered';
|
|
14
|
+
var onSelect = useCallback(function (_ref2) {
|
|
15
|
+
var _api$analytics;
|
|
16
|
+
var editorView = _ref2.editorView,
|
|
17
|
+
insert = _ref2.insert,
|
|
18
|
+
source = _ref2.source;
|
|
19
|
+
var schema = editorView.state.schema;
|
|
20
|
+
var listNode = isOrdered ? schema.nodes.orderedList : schema.nodes.bulletList;
|
|
21
|
+
var actionSubjectId = isOrdered ? ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER : ACTION_SUBJECT_ID.FORMAT_LIST_BULLET;
|
|
22
|
+
var tr = insert(listNode.createChecked({}, schema.nodes.listItem.createChecked({}, schema.nodes.paragraph.createChecked())));
|
|
23
|
+
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.attachAnalyticsEvent({
|
|
24
|
+
action: ACTION.INSERTED,
|
|
25
|
+
actionSubject: ACTION_SUBJECT.LIST,
|
|
26
|
+
actionSubjectId: actionSubjectId,
|
|
27
|
+
attributes: {
|
|
28
|
+
inputMethod: source
|
|
29
|
+
},
|
|
30
|
+
eventType: EVENT_TYPE.TRACK
|
|
31
|
+
})(tr);
|
|
32
|
+
return tr;
|
|
33
|
+
}, [api, isOrdered]);
|
|
34
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
35
|
+
iconBefore: isOrdered ? /*#__PURE__*/React.createElement(IconListNumber, null) : /*#__PURE__*/React.createElement(IconList, null),
|
|
36
|
+
onSelect: onSelect,
|
|
37
|
+
shortcut: tooltip(isOrdered ? toggleOrderedList : toggleBulletList),
|
|
38
|
+
title: formatMessage(isOrdered ? messages.orderedList : messages.unorderedList)
|
|
39
|
+
});
|
|
40
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ORDERED_LIST_MENU_ITEM, TEXT_FORMATTING_SECTION, UNORDERED_LIST_MENU_ITEM } from '@atlaskit/editor-common/quick-insert/keys';
|
|
3
|
+
import { TEXT_FORMATTING_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
4
|
+
import { ListQuickInsertMenuItem } from './ListQuickInsertMenuItem';
|
|
5
|
+
export var getListQuickInsertComponents = function getListQuickInsertComponents(_ref) {
|
|
6
|
+
var api = _ref.api;
|
|
7
|
+
return [{
|
|
8
|
+
item: UNORDERED_LIST_MENU_ITEM,
|
|
9
|
+
type: 'unordered'
|
|
10
|
+
}, {
|
|
11
|
+
item: ORDERED_LIST_MENU_ITEM,
|
|
12
|
+
type: 'ordered'
|
|
13
|
+
}].map(function (_ref2) {
|
|
14
|
+
var item = _ref2.item,
|
|
15
|
+
type = _ref2.type;
|
|
16
|
+
return {
|
|
17
|
+
key: item.key,
|
|
18
|
+
type: item.type,
|
|
19
|
+
parents: [{
|
|
20
|
+
key: TEXT_FORMATTING_SECTION.key,
|
|
21
|
+
type: TEXT_FORMATTING_SECTION.type,
|
|
22
|
+
rank: TEXT_FORMATTING_SECTION_RANK[item.key]
|
|
23
|
+
}],
|
|
24
|
+
component: function component() {
|
|
25
|
+
return /*#__PURE__*/React.createElement(ListQuickInsertMenuItem, {
|
|
26
|
+
api: api,
|
|
27
|
+
type: type
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
@@ -3,12 +3,14 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
3
3
|
import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
|
|
4
4
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
5
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
6
|
+
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry/ui-control-registry-plugin-type';
|
|
6
7
|
import type { FindRootParentListNode, IndentList, IsInsideListItem, ListState, OutdentList, ToggleBulletList, ToggleOrderedList } from './types';
|
|
7
8
|
export type ListPluginDependencies = [
|
|
8
9
|
OptionalPlugin<FeatureFlagsPlugin>,
|
|
9
10
|
OptionalPlugin<AnalyticsPlugin>,
|
|
10
11
|
OptionalPlugin<BlockMenuPlugin>,
|
|
11
|
-
OptionalPlugin<ToolbarPlugin
|
|
12
|
+
OptionalPlugin<ToolbarPlugin>,
|
|
13
|
+
OptionalPlugin<UiControlRegistryPlugin>
|
|
12
14
|
];
|
|
13
15
|
export type ListPluginActions = {
|
|
14
16
|
findRootParentListNode: FindRootParentListNode;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { ListPlugin } from '../../listPluginType';
|
|
4
|
+
type Props = {
|
|
5
|
+
api: ExtractInjectionAPI<ListPlugin> | undefined;
|
|
6
|
+
type: 'ordered' | 'unordered';
|
|
7
|
+
};
|
|
8
|
+
export declare const ListQuickInsertMenuItem: ({ api, type }: Props) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
|
|
3
|
+
import type { ListPlugin } from '../../listPluginType';
|
|
4
|
+
export declare const getListQuickInsertComponents: ({ api, }: {
|
|
5
|
+
api: ExtractInjectionAPI<ListPlugin> | undefined;
|
|
6
|
+
}) => RegisterMenuItem[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-list",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.2",
|
|
4
4
|
"description": "List plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,9 +24,12 @@
|
|
|
24
24
|
"@atlaskit/editor-plugin-block-menu": "^12.0.0",
|
|
25
25
|
"@atlaskit/editor-plugin-feature-flags": "^12.0.0",
|
|
26
26
|
"@atlaskit/editor-plugin-toolbar": "^10.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^7.0.0",
|
|
27
28
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
28
29
|
"@atlaskit/editor-toolbar": "^2.4.0",
|
|
29
|
-
"@atlaskit/
|
|
30
|
+
"@atlaskit/editor-ui-control-model": "^2.4.0",
|
|
31
|
+
"@atlaskit/icon": "^37.3.0",
|
|
32
|
+
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
30
33
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
31
34
|
"@atlaskit/prosemirror-history": "^1.1.0",
|
|
32
35
|
"@atlaskit/prosemirror-input-rules": "^4.0.0",
|
|
@@ -34,7 +37,7 @@
|
|
|
34
37
|
"@babel/runtime": "^7.0.0"
|
|
35
38
|
},
|
|
36
39
|
"peerDependencies": {
|
|
37
|
-
"@atlaskit/editor-common": "^117.
|
|
40
|
+
"@atlaskit/editor-common": "^117.2.0",
|
|
38
41
|
"react": "^18.2.0 || ^19.2.0",
|
|
39
42
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
40
43
|
},
|