@atlaskit/editor-plugin-list 5.1.8 → 5.1.9

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-list
2
2
 
3
+ ## 5.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1ab3eb4c56ebb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1ab3eb4c56ebb) -
8
+ [ux] ED-28581: Registered components for block type and list plugins
9
+ - Updated dependencies
10
+
3
11
  ## 5.1.8
4
12
 
5
13
  ### Patch Changes
@@ -13,6 +13,7 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
13
13
  var _messages = require("@atlaskit/editor-common/messages");
14
14
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
15
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
16
17
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
18
  var _commands = require("./pm-plugins/commands");
18
19
  var _indentList = require("./pm-plugins/commands/indent-list");
@@ -22,6 +23,7 @@ var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
22
23
  var _main = require("./pm-plugins/main");
23
24
  var _find = require("./pm-plugins/utils/find");
24
25
  var _selection = require("./pm-plugins/utils/selection");
26
+ var _ui = require("./ui");
25
27
  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; }
26
28
  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; } // Ignored via go/ees005
27
29
  // eslint-disable-next-line import/no-named-as-default
@@ -40,6 +42,10 @@ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
40
42
  api = _ref.api;
41
43
  var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
42
44
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
45
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
46
+ var _api$blockMenu;
47
+ api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents((0, _ui.getListComponents)());
48
+ }
43
49
  return {
44
50
  name: 'list',
45
51
  actions: {
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.BulletedListMenuItem = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntlNext = require("react-intl-next");
10
+ var _messages = require("@atlaskit/editor-common/messages");
11
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
12
+ var _listBulleted = _interopRequireDefault(require("@atlaskit/icon/core/list-bulleted"));
13
+ var BulletedListMenuItem = exports.BulletedListMenuItem = function BulletedListMenuItem() {
14
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
15
+ formatMessage = _useIntl.formatMessage;
16
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
17
+ elemBefore: /*#__PURE__*/_react.default.createElement(_listBulleted.default, {
18
+ label: formatMessage(_messages.listMessages.bulletedList)
19
+ })
20
+ }, formatMessage(_messages.listMessages.bulletedList));
21
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.NumberedListMenuItem = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntlNext = require("react-intl-next");
10
+ var _messages = require("@atlaskit/editor-common/messages");
11
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
12
+ var _listNumbered = _interopRequireDefault(require("@atlaskit/icon/core/list-numbered"));
13
+ var NumberedListMenuItem = exports.NumberedListMenuItem = function NumberedListMenuItem() {
14
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
15
+ formatMessage = _useIntl.formatMessage;
16
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
17
+ elemBefore: /*#__PURE__*/_react.default.createElement(_listNumbered.default, {
18
+ label: formatMessage(_messages.listMessages.orderedList)
19
+ })
20
+ }, formatMessage(_messages.listMessages.orderedList));
21
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getListComponents = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _blockMenu = require("@atlaskit/editor-common/block-menu");
10
+ var _BulletedListMenuItem = require("./BulletedListMenuItem");
11
+ var _NumberedListMenuItem = require("./NumberedListMenuItem");
12
+ var getListComponents = exports.getListComponents = function getListComponents() {
13
+ return [{
14
+ type: 'block-menu-item',
15
+ key: _blockMenu.FORMAT_BULLETED_LIST_MENU_ITEM.key,
16
+ parent: {
17
+ type: 'block-menu-section',
18
+ key: 'nested-menu-format-section-primary',
19
+ rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_BULLETED_LIST_MENU_ITEM.key]
20
+ },
21
+ component: function component() {
22
+ return /*#__PURE__*/_react.default.createElement(_BulletedListMenuItem.BulletedListMenuItem, null);
23
+ }
24
+ }, {
25
+ type: 'block-menu-item',
26
+ key: _blockMenu.FORMAT_NUMBERED_LIST_MENU_ITEM.key,
27
+ parent: {
28
+ type: 'block-menu-section',
29
+ key: 'nested-menu-format-section-primary',
30
+ rank: _blockMenu.FORMAT_NESTED_MENU_RANK[_blockMenu.FORMAT_NUMBERED_LIST_MENU_ITEM.key]
31
+ },
32
+ component: function component() {
33
+ return /*#__PURE__*/_react.default.createElement(_NumberedListMenuItem.NumberedListMenuItem, null);
34
+ }
35
+ }];
36
+ };
@@ -5,6 +5,7 @@ import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-c
5
5
  import { listMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
8
9
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
10
  import { toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggleOrderedListCommand } from './pm-plugins/commands';
10
11
  import { indentList } from './pm-plugins/commands/indent-list';
@@ -16,6 +17,7 @@ import keymapPlugin from './pm-plugins/keymap';
16
17
  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';
20
+ import { getListComponents } from './ui';
19
21
 
20
22
  /*
21
23
  Toolbar buttons to bullet and ordered list can be found in
@@ -33,6 +35,10 @@ export const listPlugin = ({
33
35
  var _api$featureFlags, _api$analytics;
34
36
  const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
35
37
  const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
38
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
39
+ var _api$blockMenu;
40
+ api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents(getListComponents());
41
+ }
36
42
  return {
37
43
  name: 'list',
38
44
  actions: {
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { listMessages } from '@atlaskit/editor-common/messages';
4
+ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
5
+ import ListBulletedIcon from '@atlaskit/icon/core/list-bulleted';
6
+ export const BulletedListMenuItem = () => {
7
+ const {
8
+ formatMessage
9
+ } = useIntl();
10
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
11
+ elemBefore: /*#__PURE__*/React.createElement(ListBulletedIcon, {
12
+ label: formatMessage(listMessages.bulletedList)
13
+ })
14
+ }, formatMessage(listMessages.bulletedList));
15
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { listMessages } from '@atlaskit/editor-common/messages';
4
+ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
5
+ import ListNumberedIcon from '@atlaskit/icon/core/list-numbered';
6
+ export const NumberedListMenuItem = () => {
7
+ const {
8
+ formatMessage
9
+ } = useIntl();
10
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
11
+ elemBefore: /*#__PURE__*/React.createElement(ListNumberedIcon, {
12
+ label: formatMessage(listMessages.orderedList)
13
+ })
14
+ }, formatMessage(listMessages.orderedList));
15
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { FORMAT_BULLETED_LIST_MENU_ITEM, FORMAT_NESTED_MENU_RANK, FORMAT_NUMBERED_LIST_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
3
+ import { BulletedListMenuItem } from './BulletedListMenuItem';
4
+ import { NumberedListMenuItem } from './NumberedListMenuItem';
5
+ export const getListComponents = () => {
6
+ return [{
7
+ type: 'block-menu-item',
8
+ key: FORMAT_BULLETED_LIST_MENU_ITEM.key,
9
+ parent: {
10
+ type: 'block-menu-section',
11
+ key: 'nested-menu-format-section-primary',
12
+ rank: FORMAT_NESTED_MENU_RANK[FORMAT_BULLETED_LIST_MENU_ITEM.key]
13
+ },
14
+ component: () => /*#__PURE__*/React.createElement(BulletedListMenuItem, null)
15
+ }, {
16
+ type: 'block-menu-item',
17
+ key: FORMAT_NUMBERED_LIST_MENU_ITEM.key,
18
+ parent: {
19
+ type: 'block-menu-section',
20
+ key: 'nested-menu-format-section-primary',
21
+ rank: FORMAT_NESTED_MENU_RANK[FORMAT_NUMBERED_LIST_MENU_ITEM.key]
22
+ },
23
+ component: () => /*#__PURE__*/React.createElement(NumberedListMenuItem, null)
24
+ }];
25
+ };
@@ -8,6 +8,7 @@ import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-c
8
8
  import { listMessages as messages } from '@atlaskit/editor-common/messages';
9
9
  import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
11
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
13
  import { toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggleOrderedListCommand } from './pm-plugins/commands';
13
14
  import { indentList } from './pm-plugins/commands/indent-list';
@@ -19,6 +20,7 @@ import keymapPlugin from './pm-plugins/keymap';
19
20
  import { createPlugin, pluginKey as listPluginKey } from './pm-plugins/main';
20
21
  import { findRootParentListNode } from './pm-plugins/utils/find';
21
22
  import { isInsideListItem } from './pm-plugins/utils/selection';
23
+ import { getListComponents } from './ui';
22
24
 
23
25
  /*
24
26
  Toolbar buttons to bullet and ordered list can be found in
@@ -35,6 +37,10 @@ export var listPlugin = function listPlugin(_ref) {
35
37
  api = _ref.api;
36
38
  var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
37
39
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
40
+ if (expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
41
+ var _api$blockMenu;
42
+ api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(getListComponents());
43
+ }
38
44
  return {
39
45
  name: 'list',
40
46
  actions: {
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { listMessages } from '@atlaskit/editor-common/messages';
4
+ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
5
+ import ListBulletedIcon from '@atlaskit/icon/core/list-bulleted';
6
+ export var BulletedListMenuItem = function BulletedListMenuItem() {
7
+ var _useIntl = useIntl(),
8
+ formatMessage = _useIntl.formatMessage;
9
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
10
+ elemBefore: /*#__PURE__*/React.createElement(ListBulletedIcon, {
11
+ label: formatMessage(listMessages.bulletedList)
12
+ })
13
+ }, formatMessage(listMessages.bulletedList));
14
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { listMessages } from '@atlaskit/editor-common/messages';
4
+ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
5
+ import ListNumberedIcon from '@atlaskit/icon/core/list-numbered';
6
+ export var NumberedListMenuItem = function NumberedListMenuItem() {
7
+ var _useIntl = useIntl(),
8
+ formatMessage = _useIntl.formatMessage;
9
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
10
+ elemBefore: /*#__PURE__*/React.createElement(ListNumberedIcon, {
11
+ label: formatMessage(listMessages.orderedList)
12
+ })
13
+ }, formatMessage(listMessages.orderedList));
14
+ };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { FORMAT_BULLETED_LIST_MENU_ITEM, FORMAT_NESTED_MENU_RANK, FORMAT_NUMBERED_LIST_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
3
+ import { BulletedListMenuItem } from './BulletedListMenuItem';
4
+ import { NumberedListMenuItem } from './NumberedListMenuItem';
5
+ export var getListComponents = function getListComponents() {
6
+ return [{
7
+ type: 'block-menu-item',
8
+ key: FORMAT_BULLETED_LIST_MENU_ITEM.key,
9
+ parent: {
10
+ type: 'block-menu-section',
11
+ key: 'nested-menu-format-section-primary',
12
+ rank: FORMAT_NESTED_MENU_RANK[FORMAT_BULLETED_LIST_MENU_ITEM.key]
13
+ },
14
+ component: function component() {
15
+ return /*#__PURE__*/React.createElement(BulletedListMenuItem, null);
16
+ }
17
+ }, {
18
+ type: 'block-menu-item',
19
+ key: FORMAT_NUMBERED_LIST_MENU_ITEM.key,
20
+ parent: {
21
+ type: 'block-menu-section',
22
+ key: 'nested-menu-format-section-primary',
23
+ rank: FORMAT_NESTED_MENU_RANK[FORMAT_NUMBERED_LIST_MENU_ITEM.key]
24
+ },
25
+ component: function component() {
26
+ return /*#__PURE__*/React.createElement(NumberedListMenuItem, null);
27
+ }
28
+ }];
29
+ };
@@ -1,10 +1,12 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
+ import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
3
4
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
5
  import type { FindRootParentListNode, IndentList, IsInsideListItem, ListState, OutdentList, ToggleBulletList, ToggleOrderedList } from './types';
5
6
  export type ListPluginDependencies = [
6
7
  OptionalPlugin<FeatureFlagsPlugin>,
7
- OptionalPlugin<AnalyticsPlugin>
8
+ OptionalPlugin<AnalyticsPlugin>,
9
+ OptionalPlugin<BlockMenuPlugin>
8
10
  ];
9
11
  export type ListPluginActions = {
10
12
  findRootParentListNode: FindRootParentListNode;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const BulletedListMenuItem: () => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const NumberedListMenuItem: () => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { RegisterBlockMenuComponent } from '@atlaskit/editor-plugin-block-menu';
2
+ export declare const getListComponents: () => RegisterBlockMenuComponent[];
@@ -1,10 +1,12 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
+ import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
3
4
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
4
5
  import type { FindRootParentListNode, IndentList, IsInsideListItem, ListState, OutdentList, ToggleBulletList, ToggleOrderedList } from './types';
5
6
  export type ListPluginDependencies = [
6
7
  OptionalPlugin<FeatureFlagsPlugin>,
7
- OptionalPlugin<AnalyticsPlugin>
8
+ OptionalPlugin<AnalyticsPlugin>,
9
+ OptionalPlugin<BlockMenuPlugin>
8
10
  ];
9
11
  export type ListPluginActions = {
10
12
  findRootParentListNode: FindRootParentListNode;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const BulletedListMenuItem: () => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const NumberedListMenuItem: () => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { RegisterBlockMenuComponent } from '@atlaskit/editor-plugin-block-menu';
2
+ export declare const getListComponents: () => RegisterBlockMenuComponent[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-list",
3
- "version": "5.1.8",
3
+ "version": "5.1.9",
4
4
  "description": "List plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,8 +29,11 @@
29
29
  "dependencies": {
30
30
  "@atlaskit/adf-schema": "^50.2.3",
31
31
  "@atlaskit/editor-plugin-analytics": "^3.0.0",
32
+ "@atlaskit/editor-plugin-block-menu": "^0.0.16",
32
33
  "@atlaskit/editor-plugin-feature-flags": "^2.0.0",
33
34
  "@atlaskit/editor-prosemirror": "7.0.0",
35
+ "@atlaskit/editor-toolbar": "^0.5.0",
36
+ "@atlaskit/icon": "^28.1.0",
34
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
35
38
  "@atlaskit/prosemirror-input-rules": "^3.4.0",
36
39
  "@atlaskit/tmp-editor-statsig": "^11.9.0",