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

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-menu
2
2
 
3
+ ## 0.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`de1880647c70f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/de1880647c70f) -
8
+ Support block menu config in selection extension
9
+ - Updated dependencies
10
+
3
11
  ## 0.0.14
4
12
 
5
13
  ### 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,
@@ -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,
@@ -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,
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.15",
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
  },