@atlaskit/editor-plugin-code-block 8.1.27 → 9.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,25 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 9.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b909e5f47ea91`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b909e5f47ea91) -
8
+ EDITOR-4159 Make sure block-menu-item type component return null when tranform disabled
9
+ - Updated dependencies
10
+
11
+ ## 9.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
17
+ ## 9.0.0
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 8.1.27
4
24
 
5
25
  ### Patch Changes
@@ -26,6 +26,7 @@ var _toolbar = require("./pm-plugins/toolbar");
26
26
  var _CodeBlockMenuItem = require("./ui/CodeBlockMenuItem");
27
27
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
28
28
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
29
+ var CODE_BLOCK_NODE_NAME = 'codeBlock';
29
30
  var codeBlockPlugin = function codeBlockPlugin(_ref) {
30
31
  var options = _ref.config,
31
32
  api = _ref.api;
@@ -39,7 +40,11 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
39
40
  key: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION.key,
40
41
  rank: _blockMenu.TRANSFORM_STRUCTURE_MENU_SECTION_RANK[_blockMenu.TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM.key]
41
42
  },
42
- component: (0, _CodeBlockMenuItem.createCodeBlockMenuItem)(api)
43
+ component: (0, _CodeBlockMenuItem.createCodeBlockMenuItem)(api),
44
+ isHidden: function isHidden() {
45
+ var _api$blockMenu2;
46
+ return Boolean(api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(CODE_BLOCK_NODE_NAME));
47
+ }
43
48
  }]);
44
49
  }
45
50
  return {
@@ -12,8 +12,8 @@ var _codeBlock = require("@atlaskit/editor-common/code-block");
12
12
  var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
13
13
  var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
14
14
  var _utils = require("@atlaskit/editor-prosemirror/utils");
15
+ var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
15
16
  var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
16
- var _copy = _interopRequireDefault(require("@atlaskit/icon/core/migration/copy"));
17
17
  var _textWrap = _interopRequireDefault(require("@atlaskit/icon/core/text-wrap"));
18
18
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
19
  var _editorCommands = require("../editor-commands");
@@ -13,7 +13,6 @@ var _editorToolbar = require("@atlaskit/editor-toolbar");
13
13
  var _angleBrackets = _interopRequireDefault(require("@atlaskit/icon/core/angle-brackets"));
14
14
  var NODE_NAME = 'codeBlock';
15
15
  var CodeBlockMenuItem = function CodeBlockMenuItem(_ref) {
16
- var _api$blockMenu2;
17
16
  var api = _ref.api;
18
17
  var _useIntl = (0, _reactIntlNext.useIntl)(),
19
18
  formatMessage = _useIntl.formatMessage;
@@ -33,10 +32,6 @@ var CodeBlockMenuItem = function CodeBlockMenuItem(_ref) {
33
32
  }) : null;
34
33
  });
35
34
  };
36
- var isTransfromToPanelDisabled = api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(NODE_NAME);
37
- if (isTransfromToPanelDisabled) {
38
- return null;
39
- }
40
35
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
41
36
  onClick: handleClick,
42
37
  elemBefore: /*#__PURE__*/_react.default.createElement(_angleBrackets.default, {
@@ -16,6 +16,7 @@ import { createPlugin } from './pm-plugins/main';
16
16
  import refreshBrowserSelectionOnChange from './pm-plugins/refresh-browser-selection';
17
17
  import { getToolbarConfig } from './pm-plugins/toolbar';
18
18
  import { createCodeBlockMenuItem } from './ui/CodeBlockMenuItem';
19
+ const CODE_BLOCK_NODE_NAME = 'codeBlock';
19
20
  const codeBlockPlugin = ({
20
21
  config: options,
21
22
  api
@@ -30,7 +31,11 @@ const codeBlockPlugin = ({
30
31
  key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
31
32
  rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM.key]
32
33
  },
33
- component: createCodeBlockMenuItem(api)
34
+ component: createCodeBlockMenuItem(api),
35
+ isHidden: () => {
36
+ var _api$blockMenu2;
37
+ return Boolean(api === null || api === void 0 ? void 0 : (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(CODE_BLOCK_NODE_NAME));
38
+ }
34
39
  }]);
35
40
  }
36
41
  return {
@@ -2,8 +2,8 @@ import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
2
2
  import commonMessages, { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
3
3
  import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
4
4
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
5
+ import CopyIcon from '@atlaskit/icon/core/copy';
5
6
  import DeleteIcon from '@atlaskit/icon/core/delete';
6
- import CopyIcon from '@atlaskit/icon/core/migration/copy';
7
7
  import TextWrapIcon from '@atlaskit/icon/core/text-wrap';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { changeLanguage, copyContentToClipboardWithAnalytics, removeCodeBlockWithAnalytics, resetCopiedState, toggleWordWrapStateForCodeBlockNode } from '../editor-commands';
@@ -8,7 +8,6 @@ const NODE_NAME = 'codeBlock';
8
8
  const CodeBlockMenuItem = ({
9
9
  api
10
10
  }) => {
11
- var _api$blockMenu2;
12
11
  const {
13
12
  formatMessage
14
13
  } = useIntl();
@@ -29,10 +28,6 @@ const CodeBlockMenuItem = ({
29
28
  }) : null;
30
29
  });
31
30
  };
32
- const isTransfromToPanelDisabled = api === null || api === void 0 ? void 0 : (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(NODE_NAME);
33
- if (isTransfromToPanelDisabled) {
34
- return null;
35
- }
36
31
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
37
32
  onClick: handleClick,
38
33
  elemBefore: /*#__PURE__*/React.createElement(AngleBracketsIcon, {
@@ -19,6 +19,7 @@ import { createPlugin } from './pm-plugins/main';
19
19
  import refreshBrowserSelectionOnChange from './pm-plugins/refresh-browser-selection';
20
20
  import { getToolbarConfig } from './pm-plugins/toolbar';
21
21
  import { createCodeBlockMenuItem } from './ui/CodeBlockMenuItem';
22
+ var CODE_BLOCK_NODE_NAME = 'codeBlock';
22
23
  var codeBlockPlugin = function codeBlockPlugin(_ref) {
23
24
  var options = _ref.config,
24
25
  api = _ref.api;
@@ -32,7 +33,11 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
32
33
  key: TRANSFORM_STRUCTURE_MENU_SECTION.key,
33
34
  rank: TRANSFORM_STRUCTURE_MENU_SECTION_RANK[TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM.key]
34
35
  },
35
- component: createCodeBlockMenuItem(api)
36
+ component: createCodeBlockMenuItem(api),
37
+ isHidden: function isHidden() {
38
+ var _api$blockMenu2;
39
+ return Boolean(api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(CODE_BLOCK_NODE_NAME));
40
+ }
36
41
  }]);
37
42
  }
38
43
  return {
@@ -6,8 +6,8 @@ import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
6
6
  import commonMessages, { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
7
7
  import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
8
8
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
9
+ import CopyIcon from '@atlaskit/icon/core/copy';
9
10
  import DeleteIcon from '@atlaskit/icon/core/delete';
10
- import CopyIcon from '@atlaskit/icon/core/migration/copy';
11
11
  import TextWrapIcon from '@atlaskit/icon/core/text-wrap';
12
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
13
  import { changeLanguage, copyContentToClipboardWithAnalytics, removeCodeBlockWithAnalytics, resetCopiedState, toggleWordWrapStateForCodeBlockNode } from '../editor-commands';
@@ -6,7 +6,6 @@ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
6
  import AngleBracketsIcon from '@atlaskit/icon/core/angle-brackets';
7
7
  var NODE_NAME = 'codeBlock';
8
8
  var CodeBlockMenuItem = function CodeBlockMenuItem(_ref) {
9
- var _api$blockMenu2;
10
9
  var api = _ref.api;
11
10
  var _useIntl = useIntl(),
12
11
  formatMessage = _useIntl.formatMessage;
@@ -26,10 +25,6 @@ var CodeBlockMenuItem = function CodeBlockMenuItem(_ref) {
26
25
  }) : null;
27
26
  });
28
27
  };
29
- var isTransfromToPanelDisabled = api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.isTransformOptionDisabled(NODE_NAME);
30
- if (isTransfromToPanelDisabled) {
31
- return null;
32
- }
33
28
  return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
34
29
  onClick: handleClick,
35
30
  elemBefore: /*#__PURE__*/React.createElement(AngleBracketsIcon, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "8.1.27",
3
+ "version": "9.0.2",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,25 +29,25 @@
29
29
  "dependencies": {
30
30
  "@atlaskit/adf-schema": "^51.5.0",
31
31
  "@atlaskit/code": "^17.4.0",
32
- "@atlaskit/editor-plugin-analytics": "^6.2.0",
33
- "@atlaskit/editor-plugin-block-menu": "^5.2.0",
34
- "@atlaskit/editor-plugin-composition": "^5.0.0",
35
- "@atlaskit/editor-plugin-decorations": "^6.1.0",
36
- "@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
37
- "@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
38
- "@atlaskit/editor-plugin-interaction": "^11.0.0",
39
- "@atlaskit/editor-plugin-selection": "^6.1.0",
40
- "@atlaskit/editor-plugin-toolbar": "^3.5.0",
32
+ "@atlaskit/editor-plugin-analytics": "^7.0.0",
33
+ "@atlaskit/editor-plugin-block-menu": "^6.0.0",
34
+ "@atlaskit/editor-plugin-composition": "^6.0.0",
35
+ "@atlaskit/editor-plugin-decorations": "^7.0.0",
36
+ "@atlaskit/editor-plugin-editor-disabled": "^7.0.0",
37
+ "@atlaskit/editor-plugin-editor-viewmode": "^9.0.0",
38
+ "@atlaskit/editor-plugin-interaction": "^12.0.0",
39
+ "@atlaskit/editor-plugin-selection": "^7.0.0",
40
+ "@atlaskit/editor-plugin-toolbar": "^4.0.0",
41
41
  "@atlaskit/editor-prosemirror": "^7.2.0",
42
- "@atlaskit/editor-toolbar": "^0.18.0",
43
- "@atlaskit/icon": "^29.3.0",
42
+ "@atlaskit/editor-toolbar": "^0.19.0",
43
+ "@atlaskit/icon": "^29.4.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
46
- "@atlaskit/tmp-editor-statsig": "^16.3.0",
46
+ "@atlaskit/tmp-editor-statsig": "^16.11.0",
47
47
  "@babel/runtime": "^7.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@atlaskit/editor-common": "^110.50.0",
50
+ "@atlaskit/editor-common": "^111.7.0",
51
51
  "react": "^18.2.0",
52
52
  "react-intl-next": "npm:react-intl@^5.18.1"
53
53
  },