@atlaskit/editor-plugin-block-menu 0.0.14 → 0.0.16

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,21 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 0.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1ab3eb4c56ebb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1ab3eb4c56ebb) -
8
+ [ux] ED-28581: Registered components for block type and list plugins
9
+ - Updated dependencies
10
+
11
+ ## 0.0.15
12
+
13
+ ### Patch Changes
14
+
15
+ - [`de1880647c70f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/de1880647c70f) -
16
+ Support block menu config in selection extension
17
+ - Updated dependencies
18
+
3
19
  ## 0.0.14
4
20
 
5
21
  ### Patch Changes
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createBlockMenuRegistry = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
7
  /**
10
8
  * Create a simple registry for block menu components.
11
9
  *
@@ -56,7 +54,19 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
56
54
  var createBlockMenuRegistry = exports.createBlockMenuRegistry = function createBlockMenuRegistry() {
57
55
  var components = [];
58
56
  var register = function register(blockMenuComponents) {
59
- components.push.apply(components, (0, _toConsumableArray2.default)(blockMenuComponents));
57
+ blockMenuComponents.forEach(function (newComponent) {
58
+ // Find if a component with the same key already exists
59
+ var existingIndex = components.findIndex(function (comp) {
60
+ return comp.key === newComponent.key;
61
+ });
62
+ if (existingIndex !== -1) {
63
+ // Replace the existing component
64
+ components[existingIndex] = newComponent;
65
+ } else {
66
+ // Add new component
67
+ components.push(newComponent);
68
+ }
69
+ });
60
70
  };
61
71
  return {
62
72
  register: register,
@@ -84,20 +84,20 @@ var getFormatMenuComponents = function getFormatMenuComponents() {
84
84
  children = _ref2.children;
85
85
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, children);
86
86
  }
87
- }];
88
- };
89
- var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockMenuComponents(_ref3) {
90
- var api = _ref3.api,
91
- config = _ref3.config;
92
- return [].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_block_menu_format') ? getFormatMenuComponents() : []), [{
87
+ }, {
93
88
  type: 'block-menu-section',
94
89
  key: 'block-menu-section-primary',
95
90
  rank: 100,
96
- component: function component(_ref4) {
97
- var children = _ref4.children;
91
+ component: function component(_ref3) {
92
+ var children = _ref3.children;
98
93
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, children);
99
94
  }
100
- }, {
95
+ }];
96
+ };
97
+ var getBlockMenuComponents = exports.getBlockMenuComponents = function getBlockMenuComponents(_ref4) {
98
+ var api = _ref4.api,
99
+ config = _ref4.config;
100
+ return [].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_block_menu_format') ? getFormatMenuComponents() : []), [{
101
101
  type: 'block-menu-section',
102
102
  key: 'block-menu-section-copy',
103
103
  rank: 200,
@@ -48,7 +48,17 @@
48
48
  export const createBlockMenuRegistry = () => {
49
49
  const components = [];
50
50
  const register = blockMenuComponents => {
51
- components.push(...blockMenuComponents);
51
+ blockMenuComponents.forEach(newComponent => {
52
+ // Find if a component with the same key already exists
53
+ const existingIndex = components.findIndex(comp => comp.key === newComponent.key);
54
+ if (existingIndex !== -1) {
55
+ // Replace the existing component
56
+ components[existingIndex] = newComponent;
57
+ } else {
58
+ // Add new component
59
+ components.push(newComponent);
60
+ }
61
+ });
52
62
  };
53
63
  return {
54
64
  register,
@@ -72,13 +72,7 @@ const getFormatMenuComponents = () => {
72
72
  }) => {
73
73
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
74
74
  }
75
- }];
76
- };
77
- export const getBlockMenuComponents = ({
78
- api,
79
- config
80
- }) => {
81
- return [...(fg('platform_editor_block_menu_format') ? getFormatMenuComponents() : []), {
75
+ }, {
82
76
  type: 'block-menu-section',
83
77
  key: 'block-menu-section-primary',
84
78
  rank: 100,
@@ -87,7 +81,13 @@ export const getBlockMenuComponents = ({
87
81
  }) => {
88
82
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
89
83
  }
90
- }, {
84
+ }];
85
+ };
86
+ export const getBlockMenuComponents = ({
87
+ api,
88
+ config
89
+ }) => {
90
+ return [...(fg('platform_editor_block_menu_format') ? getFormatMenuComponents() : []), {
91
91
  type: 'block-menu-section',
92
92
  key: 'block-menu-section-copy',
93
93
  rank: 200,
@@ -1,4 +1,3 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
1
  /**
3
2
  * Create a simple registry for block menu components.
4
3
  *
@@ -49,7 +48,19 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
49
48
  export var createBlockMenuRegistry = function createBlockMenuRegistry() {
50
49
  var components = [];
51
50
  var register = function register(blockMenuComponents) {
52
- components.push.apply(components, _toConsumableArray(blockMenuComponents));
51
+ blockMenuComponents.forEach(function (newComponent) {
52
+ // Find if a component with the same key already exists
53
+ var existingIndex = components.findIndex(function (comp) {
54
+ return comp.key === newComponent.key;
55
+ });
56
+ if (existingIndex !== -1) {
57
+ // Replace the existing component
58
+ components[existingIndex] = newComponent;
59
+ } else {
60
+ // Add new component
61
+ components.push(newComponent);
62
+ }
63
+ });
53
64
  };
54
65
  return {
55
66
  register: register,
@@ -77,20 +77,20 @@ var getFormatMenuComponents = function getFormatMenuComponents() {
77
77
  children = _ref2.children;
78
78
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
79
79
  }
80
- }];
81
- };
82
- export var getBlockMenuComponents = function getBlockMenuComponents(_ref3) {
83
- var api = _ref3.api,
84
- config = _ref3.config;
85
- return [].concat(_toConsumableArray(fg('platform_editor_block_menu_format') ? getFormatMenuComponents() : []), [{
80
+ }, {
86
81
  type: 'block-menu-section',
87
82
  key: 'block-menu-section-primary',
88
83
  rank: 100,
89
- component: function component(_ref4) {
90
- var children = _ref4.children;
84
+ component: function component(_ref3) {
85
+ var children = _ref3.children;
91
86
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
92
87
  }
93
- }, {
88
+ }];
89
+ };
90
+ export var getBlockMenuComponents = function getBlockMenuComponents(_ref4) {
91
+ var api = _ref4.api,
92
+ config = _ref4.config;
93
+ return [].concat(_toConsumableArray(fg('platform_editor_block_menu_format') ? getFormatMenuComponents() : []), [{
94
94
  type: 'block-menu-section',
95
95
  key: 'block-menu-section-copy',
96
96
  rank: 200,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/editor-prosemirror": "7.0.0",
38
38
  "@atlaskit/editor-shared-styles": "^3.6.0",
39
39
  "@atlaskit/editor-tables": "^2.9.0",
40
- "@atlaskit/editor-toolbar": "^0.4.0",
40
+ "@atlaskit/editor-toolbar": "^0.5.0",
41
41
  "@atlaskit/icon": "^28.1.0",
42
42
  "@atlaskit/icon-lab": "^5.7.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -46,7 +46,7 @@
46
46
  "@babel/runtime": "^7.0.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@atlaskit/editor-common": "^107.32.0",
49
+ "@atlaskit/editor-common": "^107.33.0",
50
50
  "react": "^18.2.0",
51
51
  "react-intl-next": "npm:react-intl@^5.18.1"
52
52
  },