@atlaskit/editor-plugin-block-type 10.2.19 → 10.2.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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 10.2.20
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e3779b75fdeca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3779b75fdeca) -
8
+ EDITOR-1643 Promote syncBlock and bodiedSyncBlock to full schema
9
+ - [`9f0fb29cbfc8b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9f0fb29cbfc8b) -
10
+ Add paragraph option to block menu
11
+ - Updated dependencies
12
+
3
13
  ## 10.2.19
4
14
 
5
15
  ### Patch Changes
@@ -8,8 +8,8 @@ exports.createParagraphBlockMenuItem = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _analytics = require("@atlaskit/editor-common/analytics");
11
+ var _hooks = require("@atlaskit/editor-common/hooks");
11
12
  var _messages = require("@atlaskit/editor-common/messages");
12
- var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
14
  var _editorToolbar = require("@atlaskit/editor-toolbar");
15
15
  var _textParagraph = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-paragraph"));
@@ -18,10 +18,19 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
18
18
  var api = _ref.api;
19
19
  var _useIntl = (0, _reactIntlNext.useIntl)(),
20
20
  formatMessage = _useIntl.formatMessage;
21
- var currentBlockType = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockType.currentBlockType');
22
- var bulletListActive = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'list.bulletListActive');
23
- var orderedListActive = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'list.orderedListActive');
24
- var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
21
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['blockType', 'list', 'selection'], function (states) {
22
+ var _states$blockTypeStat, _states$listState, _states$listState2, _states$selectionStat;
23
+ return {
24
+ currentBlockType: (_states$blockTypeStat = states.blockTypeState) === null || _states$blockTypeStat === void 0 ? void 0 : _states$blockTypeStat.currentBlockType,
25
+ bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
26
+ orderedListActive: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListActive,
27
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
28
+ };
29
+ }),
30
+ currentBlockType = _useSharedPluginState.currentBlockType,
31
+ bulletListActive = _useSharedPluginState.bulletListActive,
32
+ orderedListActive = _useSharedPluginState.orderedListActive,
33
+ selection = _useSharedPluginState.selection;
25
34
  var isTextSelection = selection instanceof _state.TextSelection;
26
35
  var isParagraph = isTextSelection && currentBlockType && currentBlockType === _consts.NORMAL_TEXT && !bulletListActive && !orderedListActive;
27
36
  var handleClick = function handleClick(event) {
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getBlockTypeComponents = void 0;
7
7
  var _blockMenu = require("@atlaskit/editor-common/block-menu");
8
8
  var _HeadingBlockMenuItem = require("./HeadingBlockMenuItem");
9
+ var _ParagraphBlockMenuItem = require("./ParagraphBlockMenuItem");
9
10
  var _QuoteBlockMenuItem = require("./QuoteBlockMenuItem");
10
11
  var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockTypeComponents(api) {
11
12
  return [{
@@ -91,5 +92,16 @@ var getBlockTypeComponents = exports.getBlockTypeComponents = function getBlockT
91
92
  component: (0, _QuoteBlockMenuItem.createQuoteBlockMenuItem)({
92
93
  api: api
93
94
  })
95
+ }, {
96
+ type: 'block-menu-item',
97
+ key: _blockMenu.TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key,
98
+ parent: {
99
+ type: 'block-menu-section',
100
+ key: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key,
101
+ rank: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION_RANK[_blockMenu.TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key]
102
+ },
103
+ component: (0, _ParagraphBlockMenuItem.createParagraphBlockMenuItem)({
104
+ api: api
105
+ })
94
106
  }];
95
107
  };
@@ -1,8 +1,8 @@
1
1
  import React 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 { blockMenuMessages } from '@atlaskit/editor-common/messages';
5
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
6
6
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
8
8
  import TextParagraphIcon from '@atlaskit/icon-lab/core/text-paragraph';
@@ -13,10 +13,20 @@ const ParagraphBlockMenuItem = ({
13
13
  const {
14
14
  formatMessage
15
15
  } = useIntl();
16
- const currentBlockType = useSharedPluginStateSelector(api, 'blockType.currentBlockType');
17
- const bulletListActive = useSharedPluginStateSelector(api, 'list.bulletListActive');
18
- const orderedListActive = useSharedPluginStateSelector(api, 'list.orderedListActive');
19
- const selection = useSharedPluginStateSelector(api, 'selection.selection');
16
+ const {
17
+ currentBlockType,
18
+ bulletListActive,
19
+ orderedListActive,
20
+ selection
21
+ } = useSharedPluginStateWithSelector(api, ['blockType', 'list', 'selection'], states => {
22
+ var _states$blockTypeStat, _states$listState, _states$listState2, _states$selectionStat;
23
+ return {
24
+ currentBlockType: (_states$blockTypeStat = states.blockTypeState) === null || _states$blockTypeStat === void 0 ? void 0 : _states$blockTypeStat.currentBlockType,
25
+ bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
26
+ orderedListActive: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListActive,
27
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
28
+ };
29
+ });
20
30
  const isTextSelection = selection instanceof TextSelection;
21
31
  const isParagraph = isTextSelection && currentBlockType && currentBlockType === NORMAL_TEXT && !bulletListActive && !orderedListActive;
22
32
  const handleClick = event => {
@@ -1,5 +1,6 @@
1
- import { TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
1
+ import { TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
2
2
  import { createHeadingBlockMenuItem } from './HeadingBlockMenuItem';
3
+ import { createParagraphBlockMenuItem } from './ParagraphBlockMenuItem';
3
4
  import { createQuoteBlockMenuItem } from './QuoteBlockMenuItem';
4
5
  export const getBlockTypeComponents = api => {
5
6
  return [{
@@ -85,5 +86,16 @@ export const getBlockTypeComponents = api => {
85
86
  component: createQuoteBlockMenuItem({
86
87
  api
87
88
  })
89
+ }, {
90
+ type: 'block-menu-item',
91
+ key: TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key,
92
+ parent: {
93
+ type: 'block-menu-section',
94
+ key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
95
+ rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key]
96
+ },
97
+ component: createParagraphBlockMenuItem({
98
+ api
99
+ })
88
100
  }];
89
101
  };
@@ -1,8 +1,8 @@
1
1
  import React 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 { blockMenuMessages } from '@atlaskit/editor-common/messages';
5
- import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
6
6
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
8
8
  import TextParagraphIcon from '@atlaskit/icon-lab/core/text-paragraph';
@@ -11,10 +11,19 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
11
11
  var api = _ref.api;
12
12
  var _useIntl = useIntl(),
13
13
  formatMessage = _useIntl.formatMessage;
14
- var currentBlockType = useSharedPluginStateSelector(api, 'blockType.currentBlockType');
15
- var bulletListActive = useSharedPluginStateSelector(api, 'list.bulletListActive');
16
- var orderedListActive = useSharedPluginStateSelector(api, 'list.orderedListActive');
17
- var selection = useSharedPluginStateSelector(api, 'selection.selection');
14
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['blockType', 'list', 'selection'], function (states) {
15
+ var _states$blockTypeStat, _states$listState, _states$listState2, _states$selectionStat;
16
+ return {
17
+ currentBlockType: (_states$blockTypeStat = states.blockTypeState) === null || _states$blockTypeStat === void 0 ? void 0 : _states$blockTypeStat.currentBlockType,
18
+ bulletListActive: (_states$listState = states.listState) === null || _states$listState === void 0 ? void 0 : _states$listState.bulletListActive,
19
+ orderedListActive: (_states$listState2 = states.listState) === null || _states$listState2 === void 0 ? void 0 : _states$listState2.orderedListActive,
20
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
21
+ };
22
+ }),
23
+ currentBlockType = _useSharedPluginState.currentBlockType,
24
+ bulletListActive = _useSharedPluginState.bulletListActive,
25
+ orderedListActive = _useSharedPluginState.orderedListActive,
26
+ selection = _useSharedPluginState.selection;
18
27
  var isTextSelection = selection instanceof TextSelection;
19
28
  var isParagraph = isTextSelection && currentBlockType && currentBlockType === NORMAL_TEXT && !bulletListActive && !orderedListActive;
20
29
  var handleClick = function handleClick(event) {
@@ -1,5 +1,6 @@
1
- import { TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK } from '@atlaskit/editor-common/block-menu';
1
+ import { TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM } from '@atlaskit/editor-common/block-menu';
2
2
  import { createHeadingBlockMenuItem } from './HeadingBlockMenuItem';
3
+ import { createParagraphBlockMenuItem } from './ParagraphBlockMenuItem';
3
4
  import { createQuoteBlockMenuItem } from './QuoteBlockMenuItem';
4
5
  export var getBlockTypeComponents = function getBlockTypeComponents(api) {
5
6
  return [{
@@ -85,5 +86,16 @@ export var getBlockTypeComponents = function getBlockTypeComponents(api) {
85
86
  component: createQuoteBlockMenuItem({
86
87
  api: api
87
88
  })
89
+ }, {
90
+ type: 'block-menu-item',
91
+ key: TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key,
92
+ parent: {
93
+ type: 'block-menu-section',
94
+ key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
95
+ rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key]
96
+ },
97
+ component: createParagraphBlockMenuItem({
98
+ api: api
99
+ })
88
100
  }];
89
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "10.2.19",
3
+ "version": "10.2.20",
4
4
  "description": "BlockType 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.4.0",
32
+ "@atlaskit/adf-schema": "^51.5.1",
33
33
  "@atlaskit/css": "^0.17.0",
34
34
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
35
35
  "@atlaskit/editor-plugin-block-menu": "^5.1.0",
@@ -51,13 +51,13 @@
51
51
  "@atlaskit/prosemirror-history": "^0.2.0",
52
52
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
53
53
  "@atlaskit/theme": "^21.0.0",
54
- "@atlaskit/tmp-editor-statsig": "^14.2.0",
54
+ "@atlaskit/tmp-editor-statsig": "^14.5.0",
55
55
  "@atlaskit/tokens": "^8.4.0",
56
56
  "@babel/runtime": "^7.0.0",
57
57
  "@emotion/react": "^11.7.1"
58
58
  },
59
59
  "peerDependencies": {
60
- "@atlaskit/editor-common": "^110.36.0",
60
+ "@atlaskit/editor-common": "^110.38.0",
61
61
  "react": "^18.2.0",
62
62
  "react-dom": "^18.2.0",
63
63
  "react-intl-next": "npm:react-intl@^5.18.1"