@atlaskit/editor-plugin-code-block-advanced 6.0.0 → 6.0.2

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,20 @@
1
1
  # @atlaskit/editor-plugin-code-block-advanced
2
2
 
3
+ ## 6.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`51d46145cda56`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51d46145cda56) -
8
+ Adds additional attributes to Element Converted event and fires the event for the empty line
9
+ transforms
10
+ - Updated dependencies
11
+
12
+ ## 6.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 6.0.0
4
19
 
5
20
  ### Patch Changes
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.createCodeBlockMenuItem = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _reactIntlNext = require("react-intl-next");
11
+ var _analytics = require("@atlaskit/editor-common/analytics");
11
12
  var _messages = require("@atlaskit/editor-common/messages");
12
13
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
13
14
  var _state = require("@atlaskit/editor-prosemirror/state");
@@ -30,9 +31,14 @@ var CodeBlockMenuItem = function CodeBlockMenuItem(_ref) {
30
31
  }
31
32
  return false;
32
33
  }, [selection]);
33
- var handleClick = function handleClick() {
34
+ var handleClick = function handleClick(event) {
34
35
  var _api$blockMenu;
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(nodeName));
36
+ var inputMethod = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE;
37
+ var triggeredFrom = _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
+ }));
36
42
  };
37
43
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
38
44
  onClick: handleClick,
@@ -1,5 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
4
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
4
5
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
5
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
@@ -23,9 +24,14 @@ const CodeBlockMenuItem = ({
23
24
  }
24
25
  return false;
25
26
  }, [selection]);
26
- const handleClick = () => {
27
+ const handleClick = event => {
27
28
  var _api$blockMenu;
28
- 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));
29
+ const inputMethod = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
30
+ const triggeredFrom = 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
+ }));
29
35
  };
30
36
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
31
37
  onClick: handleClick,
@@ -1,5 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
4
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
4
5
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
5
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
@@ -21,9 +22,14 @@ var CodeBlockMenuItem = function CodeBlockMenuItem(_ref) {
21
22
  }
22
23
  return false;
23
24
  }, [selection]);
24
- var handleClick = function handleClick() {
25
+ var handleClick = function handleClick(event) {
25
26
  var _api$blockMenu;
26
- 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));
27
+ var inputMethod = event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0 ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE;
28
+ var triggeredFrom = 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
+ }));
27
33
  };
28
34
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
29
35
  onClick: handleClick,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block-advanced",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,13 +34,13 @@
34
34
  "@atlaskit/editor-plugin-editor-disabled": "^6.0.0",
35
35
  "@atlaskit/editor-plugin-find-replace": "^6.0.0",
36
36
  "@atlaskit/editor-plugin-selection": "^6.0.0",
37
- "@atlaskit/editor-plugin-selection-marker": "^6.0.0",
37
+ "@atlaskit/editor-plugin-selection-marker": "^6.1.0",
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
- "@atlaskit/editor-toolbar": "^0.9.0",
39
+ "@atlaskit/editor-toolbar": "^0.10.0",
40
40
  "@atlaskit/icon": "^28.3.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^12.31.0",
43
- "@atlaskit/tokens": "^6.3.0",
42
+ "@atlaskit/tmp-editor-statsig": "^12.32.0",
43
+ "@atlaskit/tokens": "^6.4.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@codemirror/autocomplete": "6.18.4",
46
46
  "@codemirror/commands": "6.7.1",
@@ -55,7 +55,7 @@
55
55
  "codemirror-lang-elixir": "4.0.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^110.0.0",
58
+ "@atlaskit/editor-common": "^110.4.0",
59
59
  "react": "^18.2.0",
60
60
  "react-intl-next": "npm:react-intl@^5.18.1"
61
61
  },
@@ -2,6 +2,7 @@ import React, { useMemo } from 'react';
2
2
 
3
3
  import { useIntl } from 'react-intl-next';
4
4
 
5
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
6
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
6
7
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
7
8
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
@@ -34,8 +35,16 @@ const CodeBlockMenuItem = ({ api }: Props) => {
34
35
  return false;
35
36
  }, [selection]);
36
37
 
37
- const handleClick = () => {
38
- api?.core.actions.execute(api?.blockMenu?.commands.formatNode(nodeName));
38
+ const handleClick = (event: React.MouseEvent | React.KeyboardEvent) => {
39
+ const inputMethod =
40
+ event.nativeEvent instanceof KeyboardEvent || event.nativeEvent.detail === 0
41
+ ? INPUT_METHOD.KEYBOARD
42
+ : INPUT_METHOD.MOUSE;
43
+ const triggeredFrom = INPUT_METHOD.BLOCK_MENU;
44
+
45
+ api?.core.actions.execute(
46
+ api?.blockMenu?.commands.formatNode(nodeName, { inputMethod, triggeredFrom }),
47
+ );
39
48
  };
40
49
 
41
50
  return (