@atlaskit/editor-plugin-code-block 8.1.16 → 8.1.17

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-code-block
2
2
 
3
+ ## 8.1.17
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
  ## 8.1.16
4
12
 
5
13
  ### Patch Changes
@@ -32,13 +32,20 @@ var CodeBlockMenuItem = function CodeBlockMenuItem(_ref) {
32
32
  return false;
33
33
  }, [selection]);
34
34
  var handleClick = function handleClick(event) {
35
- var _api$blockMenu;
36
35
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
37
36
  var inputMethod = _analytics.INPUT_METHOD.BLOCK_MENU;
38
- 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(nodeName, {
39
- inputMethod: inputMethod,
40
- triggeredFrom: triggeredFrom
41
- }));
37
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
38
+ var _api$blockMenu;
39
+ var tr = _ref2.tr;
40
+ 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.codeBlock, {
41
+ inputMethod: inputMethod,
42
+ triggeredFrom: triggeredFrom,
43
+ targetTypeName: nodeName
44
+ });
45
+ return command ? command({
46
+ tr: tr
47
+ }) : null;
48
+ });
42
49
  };
43
50
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
44
51
  onClick: handleClick,
@@ -25,13 +25,21 @@ const CodeBlockMenuItem = ({
25
25
  return false;
26
26
  }, [selection]);
27
27
  const handleClick = event => {
28
- var _api$blockMenu;
29
28
  const triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
30
29
  const inputMethod = INPUT_METHOD.BLOCK_MENU;
31
- 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(nodeName, {
32
- inputMethod,
33
- triggeredFrom
34
- }));
30
+ api === null || api === void 0 ? void 0 : api.core.actions.execute(({
31
+ tr
32
+ }) => {
33
+ var _api$blockMenu;
34
+ 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.codeBlock, {
35
+ inputMethod,
36
+ triggeredFrom,
37
+ targetTypeName: nodeName
38
+ });
39
+ return command ? command({
40
+ tr
41
+ }) : null;
42
+ });
35
43
  };
36
44
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
37
45
  onClick: handleClick,
@@ -23,13 +23,20 @@ var CodeBlockMenuItem = function CodeBlockMenuItem(_ref) {
23
23
  return false;
24
24
  }, [selection]);
25
25
  var handleClick = function handleClick(event) {
26
- var _api$blockMenu;
27
26
  var triggeredFrom = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
28
27
  var inputMethod = INPUT_METHOD.BLOCK_MENU;
29
- 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(nodeName, {
30
- inputMethod: inputMethod,
31
- triggeredFrom: triggeredFrom
32
- }));
28
+ api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
29
+ var _api$blockMenu;
30
+ var tr = _ref2.tr;
31
+ 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.codeBlock, {
32
+ inputMethod: inputMethod,
33
+ triggeredFrom: triggeredFrom,
34
+ targetTypeName: nodeName
35
+ });
36
+ return command ? command({
37
+ tr: tr
38
+ }) : null;
39
+ });
33
40
  };
34
41
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
35
42
  onClick: handleClick,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "8.1.16",
3
+ "version": "8.1.17",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/adf-schema": "^51.4.0",
31
31
  "@atlaskit/code": "^17.3.0",
32
32
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
33
- "@atlaskit/editor-plugin-block-menu": "^5.0.0",
33
+ "@atlaskit/editor-plugin-block-menu": "^5.1.0",
34
34
  "@atlaskit/editor-plugin-composition": "^5.0.0",
35
35
  "@atlaskit/editor-plugin-decorations": "^6.1.0",
36
36
  "@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/icon": "^29.0.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
46
- "@atlaskit/tmp-editor-statsig": "^14.1.0",
46
+ "@atlaskit/tmp-editor-statsig": "^14.2.0",
47
47
  "@babel/runtime": "^7.0.0"
48
48
  },
49
49
  "peerDependencies": {