@atlaskit/editor-plugin-block-type 16.0.6 → 16.1.0

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,18 @@
1
1
  # @atlaskit/editor-plugin-block-type
2
2
 
3
+ ## 16.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b483e293da76f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b483e293da76f) -
8
+ Add a gated `isSuggested` attribute to block menu element transformed analytics events so
9
+ suggested and non-suggested transform selections can be distinguished. The event attribute is
10
+ gated behind the `platform_editor_blocks_patch_2` feature gate.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 16.0.6
4
17
 
5
18
  ### Patch Changes
@@ -21,7 +21,8 @@ var headingMessages = [_messages.blockTypeMessages.heading1, _messages.blockType
21
21
  var NODE_NAME = 'heading';
22
22
  var HeadingBlockMenuItem = function HeadingBlockMenuItem(_ref) {
23
23
  var level = _ref.level,
24
- api = _ref.api;
24
+ api = _ref.api,
25
+ isSuggested = _ref.isSuggested;
25
26
  var _useIntl = (0, _reactIntl.useIntl)(),
26
27
  formatMessage = _useIntl.formatMessage;
27
28
  var Icon = headingIcons[level - 1];
@@ -34,6 +35,7 @@ var HeadingBlockMenuItem = function HeadingBlockMenuItem(_ref) {
34
35
  var tr = _ref2.tr;
35
36
  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.heading, {
36
37
  inputMethod: inputMethod,
38
+ isSuggested: isSuggested,
37
39
  triggeredFrom: triggeredFrom,
38
40
  targetTypeName: "".concat(NODE_NAME).concat(level),
39
41
  targetAttrs: {
@@ -57,9 +59,12 @@ var createHeadingBlockMenuItem = exports.createHeadingBlockMenuItem = function c
57
59
  var level = _ref3.level,
58
60
  api = _ref3.api;
59
61
  return function () {
62
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
63
+ isSuggested = _ref4.isSuggested;
60
64
  return /*#__PURE__*/_react.default.createElement(HeadingBlockMenuItem, {
61
65
  level: level,
62
- api: api
66
+ api: api,
67
+ isSuggested: isSuggested
63
68
  });
64
69
  };
65
70
  };
@@ -13,7 +13,8 @@ var _editorToolbar = require("@atlaskit/editor-toolbar");
13
13
  var _textParagraph = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-paragraph"));
14
14
  var NODE_NAME = 'paragraph';
15
15
  var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
16
- var api = _ref.api;
16
+ var api = _ref.api,
17
+ isSuggested = _ref.isSuggested;
17
18
  var _useIntl = (0, _reactIntl.useIntl)(),
18
19
  formatMessage = _useIntl.formatMessage;
19
20
  var handleClick = function handleClick(event) {
@@ -24,6 +25,7 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
24
25
  var tr = _ref2.tr;
25
26
  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.paragraph, {
26
27
  inputMethod: inputMethod,
28
+ isSuggested: isSuggested,
27
29
  triggeredFrom: triggeredFrom,
28
30
  targetTypeName: NODE_NAME
29
31
  });
@@ -43,8 +45,11 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
43
45
  var createParagraphBlockMenuItem = exports.createParagraphBlockMenuItem = function createParagraphBlockMenuItem(_ref3) {
44
46
  var api = _ref3.api;
45
47
  return function () {
48
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
49
+ isSuggested = _ref4.isSuggested;
46
50
  return /*#__PURE__*/_react.default.createElement(ParagraphBlockMenuItem, {
47
- api: api
51
+ api: api,
52
+ isSuggested: isSuggested
48
53
  });
49
54
  };
50
55
  };
@@ -19,7 +19,8 @@ var styles = {
19
19
  };
20
20
  var NODE_NAME = 'blockquote';
21
21
  var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
22
- var api = _ref.api;
22
+ var api = _ref.api,
23
+ isSuggested = _ref.isSuggested;
23
24
  var _useIntl = (0, _reactIntl.useIntl)(),
24
25
  formatMessage = _useIntl.formatMessage;
25
26
  var handleClick = function handleClick(event) {
@@ -30,6 +31,7 @@ var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
30
31
  var tr = _ref2.tr;
31
32
  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.blockquote, {
32
33
  inputMethod: inputMethod,
34
+ isSuggested: isSuggested,
33
35
  triggeredFrom: triggeredFrom,
34
36
  targetTypeName: NODE_NAME
35
37
  });
@@ -51,8 +53,11 @@ var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
51
53
  var createQuoteBlockMenuItem = exports.createQuoteBlockMenuItem = function createQuoteBlockMenuItem(_ref3) {
52
54
  var api = _ref3.api;
53
55
  return function () {
56
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
57
+ isSuggested = _ref4.isSuggested;
54
58
  return /*#__PURE__*/_react.default.createElement(QuoteBlockMenuItem, {
55
- api: api
59
+ api: api,
60
+ isSuggested: isSuggested
56
61
  });
57
62
  };
58
63
  };
@@ -14,7 +14,8 @@ const headingMessages = [blockTypeMessages.heading1, blockTypeMessages.heading2,
14
14
  const NODE_NAME = 'heading';
15
15
  const HeadingBlockMenuItem = ({
16
16
  level,
17
- api
17
+ api,
18
+ isSuggested
18
19
  }) => {
19
20
  const {
20
21
  formatMessage
@@ -30,6 +31,7 @@ const HeadingBlockMenuItem = ({
30
31
  var _api$blockMenu;
31
32
  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.heading, {
32
33
  inputMethod,
34
+ isSuggested,
33
35
  triggeredFrom,
34
36
  targetTypeName: `${NODE_NAME}${level}`,
35
37
  targetAttrs: {
@@ -53,8 +55,11 @@ export const createHeadingBlockMenuItem = ({
53
55
  level,
54
56
  api
55
57
  }) => {
56
- return () => /*#__PURE__*/React.createElement(HeadingBlockMenuItem, {
58
+ return ({
59
+ isSuggested
60
+ } = {}) => /*#__PURE__*/React.createElement(HeadingBlockMenuItem, {
57
61
  level: level,
58
- api: api
62
+ api: api,
63
+ isSuggested: isSuggested
59
64
  });
60
65
  };
@@ -6,7 +6,8 @@ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
6
  import TextParagraphIcon from '@atlaskit/icon-lab/core/text-paragraph';
7
7
  const NODE_NAME = 'paragraph';
8
8
  const ParagraphBlockMenuItem = ({
9
- api
9
+ api,
10
+ isSuggested
10
11
  }) => {
11
12
  const {
12
13
  formatMessage
@@ -20,6 +21,7 @@ const ParagraphBlockMenuItem = ({
20
21
  var _api$blockMenu;
21
22
  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.paragraph, {
22
23
  inputMethod,
24
+ isSuggested,
23
25
  triggeredFrom,
24
26
  targetTypeName: NODE_NAME
25
27
  });
@@ -39,7 +41,10 @@ const ParagraphBlockMenuItem = ({
39
41
  export const createParagraphBlockMenuItem = ({
40
42
  api
41
43
  }) => {
42
- return () => /*#__PURE__*/React.createElement(ParagraphBlockMenuItem, {
43
- api: api
44
+ return ({
45
+ isSuggested
46
+ } = {}) => /*#__PURE__*/React.createElement(ParagraphBlockMenuItem, {
47
+ api: api,
48
+ isSuggested: isSuggested
44
49
  });
45
50
  };
@@ -12,7 +12,8 @@ const styles = {
12
12
  };
13
13
  const NODE_NAME = 'blockquote';
14
14
  const QuoteBlockMenuItem = ({
15
- api
15
+ api,
16
+ isSuggested
16
17
  }) => {
17
18
  const {
18
19
  formatMessage
@@ -26,6 +27,7 @@ const QuoteBlockMenuItem = ({
26
27
  var _api$blockMenu;
27
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.blockquote, {
28
29
  inputMethod,
30
+ isSuggested,
29
31
  triggeredFrom,
30
32
  targetTypeName: NODE_NAME
31
33
  });
@@ -47,7 +49,10 @@ const QuoteBlockMenuItem = ({
47
49
  export const createQuoteBlockMenuItem = ({
48
50
  api
49
51
  }) => {
50
- return () => /*#__PURE__*/React.createElement(QuoteBlockMenuItem, {
51
- api: api
52
+ return ({
53
+ isSuggested
54
+ } = {}) => /*#__PURE__*/React.createElement(QuoteBlockMenuItem, {
55
+ api: api,
56
+ isSuggested: isSuggested
52
57
  });
53
58
  };
@@ -14,7 +14,8 @@ var headingMessages = [blockTypeMessages.heading1, blockTypeMessages.heading2, b
14
14
  var NODE_NAME = 'heading';
15
15
  var HeadingBlockMenuItem = function HeadingBlockMenuItem(_ref) {
16
16
  var level = _ref.level,
17
- api = _ref.api;
17
+ api = _ref.api,
18
+ isSuggested = _ref.isSuggested;
18
19
  var _useIntl = useIntl(),
19
20
  formatMessage = _useIntl.formatMessage;
20
21
  var Icon = headingIcons[level - 1];
@@ -27,6 +28,7 @@ var HeadingBlockMenuItem = function HeadingBlockMenuItem(_ref) {
27
28
  var tr = _ref2.tr;
28
29
  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.heading, {
29
30
  inputMethod: inputMethod,
31
+ isSuggested: isSuggested,
30
32
  triggeredFrom: triggeredFrom,
31
33
  targetTypeName: "".concat(NODE_NAME).concat(level),
32
34
  targetAttrs: {
@@ -50,9 +52,12 @@ export var createHeadingBlockMenuItem = function createHeadingBlockMenuItem(_ref
50
52
  var level = _ref3.level,
51
53
  api = _ref3.api;
52
54
  return function () {
55
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
56
+ isSuggested = _ref4.isSuggested;
53
57
  return /*#__PURE__*/React.createElement(HeadingBlockMenuItem, {
54
58
  level: level,
55
- api: api
59
+ api: api,
60
+ isSuggested: isSuggested
56
61
  });
57
62
  };
58
63
  };
@@ -6,7 +6,8 @@ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
6
  import TextParagraphIcon from '@atlaskit/icon-lab/core/text-paragraph';
7
7
  var NODE_NAME = 'paragraph';
8
8
  var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
9
- var api = _ref.api;
9
+ var api = _ref.api,
10
+ isSuggested = _ref.isSuggested;
10
11
  var _useIntl = useIntl(),
11
12
  formatMessage = _useIntl.formatMessage;
12
13
  var handleClick = function handleClick(event) {
@@ -17,6 +18,7 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
17
18
  var tr = _ref2.tr;
18
19
  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.paragraph, {
19
20
  inputMethod: inputMethod,
21
+ isSuggested: isSuggested,
20
22
  triggeredFrom: triggeredFrom,
21
23
  targetTypeName: NODE_NAME
22
24
  });
@@ -36,8 +38,11 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
36
38
  export var createParagraphBlockMenuItem = function createParagraphBlockMenuItem(_ref3) {
37
39
  var api = _ref3.api;
38
40
  return function () {
41
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
42
+ isSuggested = _ref4.isSuggested;
39
43
  return /*#__PURE__*/React.createElement(ParagraphBlockMenuItem, {
40
- api: api
44
+ api: api,
45
+ isSuggested: isSuggested
41
46
  });
42
47
  };
43
48
  };
@@ -12,7 +12,8 @@ var styles = {
12
12
  };
13
13
  var NODE_NAME = 'blockquote';
14
14
  var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
15
- var api = _ref.api;
15
+ var api = _ref.api,
16
+ isSuggested = _ref.isSuggested;
16
17
  var _useIntl = useIntl(),
17
18
  formatMessage = _useIntl.formatMessage;
18
19
  var handleClick = function handleClick(event) {
@@ -23,6 +24,7 @@ var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
23
24
  var tr = _ref2.tr;
24
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.blockquote, {
25
26
  inputMethod: inputMethod,
27
+ isSuggested: isSuggested,
26
28
  triggeredFrom: triggeredFrom,
27
29
  targetTypeName: NODE_NAME
28
30
  });
@@ -44,8 +46,11 @@ var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
44
46
  export var createQuoteBlockMenuItem = function createQuoteBlockMenuItem(_ref3) {
45
47
  var api = _ref3.api;
46
48
  return function () {
49
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
50
+ isSuggested = _ref4.isSuggested;
47
51
  return /*#__PURE__*/React.createElement(QuoteBlockMenuItem, {
48
- api: api
52
+ api: api,
53
+ isSuggested: isSuggested
49
54
  });
50
55
  };
51
56
  };
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { BlockMenuItemComponentProps } from '@atlaskit/editor-plugin-block-menu/blockMenuPluginType';
3
4
  import type { BlockTypePlugin } from '../blockTypePluginType';
4
5
  type HeadingBlockMenuItemProps = {
5
6
  api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
7
+ isSuggested?: boolean;
6
8
  level: 1 | 2 | 3 | 4 | 5 | 6;
7
9
  };
8
- export declare const createHeadingBlockMenuItem: ({ level, api }: HeadingBlockMenuItemProps) => () => React.JSX.Element;
10
+ export declare const createHeadingBlockMenuItem: ({ level, api }: HeadingBlockMenuItemProps) => ({ isSuggested }?: BlockMenuItemComponentProps) => React.JSX.Element;
9
11
  export {};
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { BlockMenuItemComponentProps } from '@atlaskit/editor-plugin-block-menu/blockMenuPluginType';
3
4
  import type { BlockTypePlugin } from '../blockTypePluginType';
4
5
  type ParagraphBlockMenuItemProps = {
5
6
  api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
7
+ isSuggested?: boolean;
6
8
  };
7
- export declare const createParagraphBlockMenuItem: ({ api }: ParagraphBlockMenuItemProps) => () => React.JSX.Element;
9
+ export declare const createParagraphBlockMenuItem: ({ api }: ParagraphBlockMenuItemProps) => ({ isSuggested }?: BlockMenuItemComponentProps) => React.JSX.Element;
8
10
  export {};
@@ -4,9 +4,11 @@
4
4
  */
5
5
  import React from 'react';
6
6
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
7
+ import type { BlockMenuItemComponentProps } from '@atlaskit/editor-plugin-block-menu/blockMenuPluginType';
7
8
  import type { BlockTypePlugin } from '../blockTypePluginType';
8
9
  type QuoteBlockMenuItemProps = {
9
10
  api: ExtractInjectionAPI<BlockTypePlugin> | undefined;
11
+ isSuggested?: boolean;
10
12
  };
11
- export declare const createQuoteBlockMenuItem: ({ api }: QuoteBlockMenuItemProps) => () => React.JSX.Element;
13
+ export declare const createQuoteBlockMenuItem: ({ api }: QuoteBlockMenuItemProps) => ({ isSuggested }?: BlockMenuItemComponentProps) => React.JSX.Element;
12
14
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "16.0.6",
3
+ "version": "16.1.0",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -24,9 +24,9 @@
24
24
  "@atlaskit/adf-schema": "^56.0.0",
25
25
  "@atlaskit/css": "^1.0.0",
26
26
  "@atlaskit/editor-plugin-analytics": "^12.0.0",
27
- "@atlaskit/editor-plugin-block-menu": "^11.0.0",
28
- "@atlaskit/editor-plugin-interaction": "^21.0.0",
29
- "@atlaskit/editor-plugin-list": "^14.0.0",
27
+ "@atlaskit/editor-plugin-block-menu": "^11.1.0",
28
+ "@atlaskit/editor-plugin-interaction": "^22.0.0",
29
+ "@atlaskit/editor-plugin-list": "^14.1.0",
30
30
  "@atlaskit/editor-plugin-primary-toolbar": "^13.0.0",
31
31
  "@atlaskit/editor-plugin-selection": "^12.0.0",
32
32
  "@atlaskit/editor-plugin-selection-toolbar": "^13.0.0",
@@ -37,19 +37,19 @@
37
37
  "@atlaskit/editor-toolbar": "^2.0.0",
38
38
  "@atlaskit/editor-toolbar-model": "^1.0.0",
39
39
  "@atlaskit/icon": "^36.0.0",
40
- "@atlaskit/icon-lab": "^7.0.0",
40
+ "@atlaskit/icon-lab": "^7.1.0",
41
41
  "@atlaskit/platform-feature-flags": "^2.0.0",
42
42
  "@atlaskit/primitives": "^20.0.0",
43
43
  "@atlaskit/prosemirror-history": "^1.0.0",
44
44
  "@atlaskit/prosemirror-input-rules": "^4.0.0",
45
- "@atlaskit/tmp-editor-statsig": "^109.0.0",
46
- "@atlaskit/tokens": "^14.0.0",
45
+ "@atlaskit/tmp-editor-statsig": "^110.0.0",
46
+ "@atlaskit/tokens": "^15.0.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "@compiled/react": "^0.20.0",
49
49
  "@emotion/react": "^11.7.1"
50
50
  },
51
51
  "peerDependencies": {
52
- "@atlaskit/editor-common": "^116.6.0",
52
+ "@atlaskit/editor-common": "^116.11.0",
53
53
  "react": "^18.2.0",
54
54
  "react-dom": "^18.2.0",
55
55
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -59,7 +59,7 @@
59
59
  "@testing-library/user-event": "^14.4.3",
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0",
62
- "react-intl": "^6.6.2",
62
+ "react-intl": "^7.0.0",
63
63
  "wait-for-expect": "^1.2.0"
64
64
  },
65
65
  "techstack": {