@atlaskit/editor-plugin-block-type 10.2.17 → 10.2.18

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-block-type
2
2
 
3
+ ## 10.2.18
4
+
5
+ ### Patch Changes
6
+
7
+ - [`bd911d5eca1cb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd911d5eca1cb) -
8
+ Use new transfromNode command in existing block menu items. Update transformNode analytics type.
9
+ - Updated dependencies
10
+
3
11
  ## 10.2.17
4
12
 
5
13
  ### Patch Changes
@@ -40,13 +40,20 @@ var HeadingBlockMenuItem = function HeadingBlockMenuItem(_ref) {
40
40
  return;
41
41
  }
42
42
  if (!isSelected) {
43
- var _api$blockMenu;
44
43
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
45
44
  var inputMethod = _analytics.INPUT_METHOD.BLOCK_MENU;
46
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode("heading".concat(level), {
47
- inputMethod: inputMethod,
48
- triggeredFrom: triggeredFrom
49
- }));
45
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
46
+ var _api$blockMenu;
47
+ var tr = _ref2.tr;
48
+ 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, {
49
+ inputMethod: inputMethod,
50
+ triggeredFrom: triggeredFrom,
51
+ targetTypeName: "heading".concat(level)
52
+ });
53
+ return command ? command({
54
+ tr: tr
55
+ }) : null;
56
+ });
50
57
  }
51
58
  };
52
59
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
@@ -57,9 +64,9 @@ var HeadingBlockMenuItem = function HeadingBlockMenuItem(_ref) {
57
64
  })
58
65
  }, formatMessage(message));
59
66
  };
60
- var createHeadingBlockMenuItem = exports.createHeadingBlockMenuItem = function createHeadingBlockMenuItem(_ref2) {
61
- var level = _ref2.level,
62
- api = _ref2.api;
67
+ var createHeadingBlockMenuItem = exports.createHeadingBlockMenuItem = function createHeadingBlockMenuItem(_ref3) {
68
+ var level = _ref3.level,
69
+ api = _ref3.api;
63
70
  return function () {
64
71
  return /*#__PURE__*/_react.default.createElement(HeadingBlockMenuItem, {
65
72
  level: level,
@@ -29,13 +29,20 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
29
29
  return;
30
30
  }
31
31
  if (!isParagraph) {
32
- var _api$blockMenu;
33
32
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
34
33
  var inputMethod = _analytics.INPUT_METHOD.BLOCK_MENU;
35
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode("paragraph", {
36
- inputMethod: inputMethod,
37
- triggeredFrom: triggeredFrom
38
- }));
34
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
35
+ var _api$blockMenu;
36
+ var tr = _ref2.tr;
37
+ 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, {
38
+ inputMethod: inputMethod,
39
+ triggeredFrom: triggeredFrom,
40
+ targetTypeName: "paragraph"
41
+ });
42
+ return command ? command({
43
+ tr: tr
44
+ }) : null;
45
+ });
39
46
  }
40
47
  };
41
48
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
@@ -46,8 +53,8 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
46
53
  })
47
54
  }, formatMessage(_messages.blockMenuMessages.paragraph));
48
55
  };
49
- var createParagraphBlockMenuItem = exports.createParagraphBlockMenuItem = function createParagraphBlockMenuItem(_ref2) {
50
- var api = _ref2.api;
56
+ var createParagraphBlockMenuItem = exports.createParagraphBlockMenuItem = function createParagraphBlockMenuItem(_ref3) {
57
+ var api = _ref3.api;
51
58
  return function () {
52
59
  return /*#__PURE__*/_react.default.createElement(ParagraphBlockMenuItem, {
53
60
  api: api
@@ -21,13 +21,20 @@ var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
21
21
  var isBlockQuote = currentBlockType && currentBlockType === _consts.BLOCK_QUOTE;
22
22
  var handleClick = function handleClick(event) {
23
23
  if (!isBlockQuote) {
24
- var _api$blockMenu;
25
24
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
26
25
  var inputMethod = _analytics.INPUT_METHOD.BLOCK_MENU;
27
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode("blockquote", {
28
- inputMethod: inputMethod,
29
- triggeredFrom: triggeredFrom
30
- }));
26
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
27
+ var _api$blockMenu;
28
+ var tr = _ref2.tr;
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.blockquote, {
30
+ inputMethod: inputMethod,
31
+ triggeredFrom: triggeredFrom,
32
+ targetTypeName: "blockquote"
33
+ });
34
+ return command ? command({
35
+ tr: tr
36
+ }) : null;
37
+ });
31
38
  }
32
39
  };
33
40
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
@@ -38,8 +45,8 @@ var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
38
45
  })
39
46
  }, formatMessage(_messages.blockTypeMessages.blockquote));
40
47
  };
41
- var createQuoteBlockMenuItem = exports.createQuoteBlockMenuItem = function createQuoteBlockMenuItem(_ref2) {
42
- var api = _ref2.api;
48
+ var createQuoteBlockMenuItem = exports.createQuoteBlockMenuItem = function createQuoteBlockMenuItem(_ref3) {
49
+ var api = _ref3.api;
43
50
  return function () {
44
51
  return /*#__PURE__*/_react.default.createElement(QuoteBlockMenuItem, {
45
52
  api: api
@@ -35,13 +35,21 @@ const HeadingBlockMenuItem = ({
35
35
  return;
36
36
  }
37
37
  if (!isSelected) {
38
- var _api$blockMenu;
39
38
  const triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
40
39
  const inputMethod = INPUT_METHOD.BLOCK_MENU;
41
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode(`heading${level}`, {
42
- inputMethod,
43
- triggeredFrom
44
- }));
40
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(({
41
+ tr
42
+ }) => {
43
+ var _api$blockMenu;
44
+ 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, {
45
+ inputMethod,
46
+ triggeredFrom,
47
+ targetTypeName: `heading${level}`
48
+ });
49
+ return command ? command({
50
+ tr
51
+ }) : null;
52
+ });
45
53
  }
46
54
  };
47
55
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
@@ -24,13 +24,21 @@ const ParagraphBlockMenuItem = ({
24
24
  return;
25
25
  }
26
26
  if (!isParagraph) {
27
- var _api$blockMenu;
28
27
  const triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
29
28
  const inputMethod = INPUT_METHOD.BLOCK_MENU;
30
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode(`paragraph`, {
31
- inputMethod,
32
- triggeredFrom
33
- }));
29
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(({
30
+ tr
31
+ }) => {
32
+ var _api$blockMenu;
33
+ 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, {
34
+ inputMethod,
35
+ triggeredFrom,
36
+ targetTypeName: `paragraph`
37
+ });
38
+ return command ? command({
39
+ tr
40
+ }) : null;
41
+ });
34
42
  }
35
43
  };
36
44
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
@@ -16,13 +16,21 @@ const QuoteBlockMenuItem = ({
16
16
  const isBlockQuote = currentBlockType && currentBlockType === BLOCK_QUOTE;
17
17
  const handleClick = event => {
18
18
  if (!isBlockQuote) {
19
- var _api$blockMenu;
20
19
  const triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
21
20
  const inputMethod = INPUT_METHOD.BLOCK_MENU;
22
- api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode(`blockquote`, {
23
- inputMethod,
24
- triggeredFrom
25
- }));
21
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(({
22
+ tr
23
+ }) => {
24
+ var _api$blockMenu;
25
+ 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, {
26
+ inputMethod,
27
+ triggeredFrom,
28
+ targetTypeName: `blockquote`
29
+ });
30
+ return command ? command({
31
+ tr
32
+ }) : null;
33
+ });
26
34
  }
27
35
  };
28
36
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
@@ -33,13 +33,20 @@ var HeadingBlockMenuItem = function HeadingBlockMenuItem(_ref) {
33
33
  return;
34
34
  }
35
35
  if (!isSelected) {
36
- var _api$blockMenu;
37
36
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
38
37
  var inputMethod = INPUT_METHOD.BLOCK_MENU;
39
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode("heading".concat(level), {
40
- inputMethod: inputMethod,
41
- triggeredFrom: triggeredFrom
42
- }));
38
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
39
+ var _api$blockMenu;
40
+ var tr = _ref2.tr;
41
+ 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, {
42
+ inputMethod: inputMethod,
43
+ triggeredFrom: triggeredFrom,
44
+ targetTypeName: "heading".concat(level)
45
+ });
46
+ return command ? command({
47
+ tr: tr
48
+ }) : null;
49
+ });
43
50
  }
44
51
  };
45
52
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
@@ -50,9 +57,9 @@ var HeadingBlockMenuItem = function HeadingBlockMenuItem(_ref) {
50
57
  })
51
58
  }, formatMessage(message));
52
59
  };
53
- export var createHeadingBlockMenuItem = function createHeadingBlockMenuItem(_ref2) {
54
- var level = _ref2.level,
55
- api = _ref2.api;
60
+ export var createHeadingBlockMenuItem = function createHeadingBlockMenuItem(_ref3) {
61
+ var level = _ref3.level,
62
+ api = _ref3.api;
56
63
  return function () {
57
64
  return /*#__PURE__*/React.createElement(HeadingBlockMenuItem, {
58
65
  level: level,
@@ -22,13 +22,20 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
22
22
  return;
23
23
  }
24
24
  if (!isParagraph) {
25
- var _api$blockMenu;
26
25
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
27
26
  var inputMethod = INPUT_METHOD.BLOCK_MENU;
28
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode("paragraph", {
29
- inputMethod: inputMethod,
30
- triggeredFrom: triggeredFrom
31
- }));
27
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
28
+ var _api$blockMenu;
29
+ var tr = _ref2.tr;
30
+ 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, {
31
+ inputMethod: inputMethod,
32
+ triggeredFrom: triggeredFrom,
33
+ targetTypeName: "paragraph"
34
+ });
35
+ return command ? command({
36
+ tr: tr
37
+ }) : null;
38
+ });
32
39
  }
33
40
  };
34
41
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
@@ -39,8 +46,8 @@ var ParagraphBlockMenuItem = function ParagraphBlockMenuItem(_ref) {
39
46
  })
40
47
  }, formatMessage(blockMenuMessages.paragraph));
41
48
  };
42
- export var createParagraphBlockMenuItem = function createParagraphBlockMenuItem(_ref2) {
43
- var api = _ref2.api;
49
+ export var createParagraphBlockMenuItem = function createParagraphBlockMenuItem(_ref3) {
50
+ var api = _ref3.api;
44
51
  return function () {
45
52
  return /*#__PURE__*/React.createElement(ParagraphBlockMenuItem, {
46
53
  api: api
@@ -14,13 +14,20 @@ var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
14
14
  var isBlockQuote = currentBlockType && currentBlockType === BLOCK_QUOTE;
15
15
  var handleClick = function handleClick(event) {
16
16
  if (!isBlockQuote) {
17
- var _api$blockMenu;
18
17
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
19
18
  var inputMethod = INPUT_METHOD.BLOCK_MENU;
20
- api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.commands.formatNode("blockquote", {
21
- inputMethod: inputMethod,
22
- triggeredFrom: triggeredFrom
23
- }));
19
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
20
+ var _api$blockMenu;
21
+ var tr = _ref2.tr;
22
+ 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, {
23
+ inputMethod: inputMethod,
24
+ triggeredFrom: triggeredFrom,
25
+ targetTypeName: "blockquote"
26
+ });
27
+ return command ? command({
28
+ tr: tr
29
+ }) : null;
30
+ });
24
31
  }
25
32
  };
26
33
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
@@ -31,8 +38,8 @@ var QuoteBlockMenuItem = function QuoteBlockMenuItem(_ref) {
31
38
  })
32
39
  }, formatMessage(blockTypeMessages.blockquote));
33
40
  };
34
- export var createQuoteBlockMenuItem = function createQuoteBlockMenuItem(_ref2) {
35
- var api = _ref2.api;
41
+ export var createQuoteBlockMenuItem = function createQuoteBlockMenuItem(_ref3) {
42
+ var api = _ref3.api;
36
43
  return function () {
37
44
  return /*#__PURE__*/React.createElement(QuoteBlockMenuItem, {
38
45
  api: api
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-type",
3
- "version": "10.2.17",
3
+ "version": "10.2.18",
4
4
  "description": "BlockType plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/adf-schema": "^51.4.0",
33
33
  "@atlaskit/css": "^0.17.0",
34
34
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
35
- "@atlaskit/editor-plugin-block-menu": "^5.0.0",
35
+ "@atlaskit/editor-plugin-block-menu": "^5.1.0",
36
36
  "@atlaskit/editor-plugin-list": "^8.2.0",
37
37
  "@atlaskit/editor-plugin-primary-toolbar": "^7.0.0",
38
38
  "@atlaskit/editor-plugin-selection": "^6.1.0",
@@ -51,7 +51,7 @@
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.1.0",
54
+ "@atlaskit/tmp-editor-statsig": "^14.2.0",
55
55
  "@atlaskit/tokens": "^8.4.0",
56
56
  "@babel/runtime": "^7.0.0",
57
57
  "@emotion/react": "^11.7.1"