@atlaskit/editor-plugin-block-menu 3.1.6 → 3.2.0

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,16 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 3.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b610a8281f843`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b610a8281f843) -
8
+ Fix double format options highlight for selection with blockQuotes
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 3.1.6
4
15
 
5
16
  ### Patch Changes
@@ -40,6 +40,20 @@ var blockMenuPlugin = exports.blockMenuPlugin = function blockMenuPlugin(_ref) {
40
40
  return (0, _formatNode2.formatNode)(targetType);
41
41
  }
42
42
  },
43
+ getSharedState: function getSharedState(editorState) {
44
+ var _api$blockControls;
45
+ if (!editorState) {
46
+ return {
47
+ currentSelectedNodeName: undefined
48
+ };
49
+ }
50
+
51
+ // Get the menuTriggerBy from blockControls plugin if available
52
+ var currentSelectedNodeName = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.menuTriggerBy;
53
+ return {
54
+ currentSelectedNodeName: currentSelectedNodeName
55
+ };
56
+ },
43
57
  contentComponent: function contentComponent(_ref2) {
44
58
  var editorView = _ref2.editorView,
45
59
  popupsMountPoint = _ref2.popupsMountPoint,
@@ -34,6 +34,20 @@ export const blockMenuPlugin = ({
34
34
  return formatNode(targetType);
35
35
  }
36
36
  },
37
+ getSharedState(editorState) {
38
+ var _api$blockControls, _api$blockControls$sh;
39
+ if (!editorState) {
40
+ return {
41
+ currentSelectedNodeName: undefined
42
+ };
43
+ }
44
+
45
+ // Get the menuTriggerBy from blockControls plugin if available
46
+ const currentSelectedNodeName = api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$sh = _api$blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.menuTriggerBy;
47
+ return {
48
+ currentSelectedNodeName
49
+ };
50
+ },
37
51
  contentComponent({
38
52
  editorView,
39
53
  popupsMountPoint,
@@ -33,6 +33,20 @@ export var blockMenuPlugin = function blockMenuPlugin(_ref) {
33
33
  return _formatNode(targetType);
34
34
  }
35
35
  },
36
+ getSharedState: function getSharedState(editorState) {
37
+ var _api$blockControls;
38
+ if (!editorState) {
39
+ return {
40
+ currentSelectedNodeName: undefined
41
+ };
42
+ }
43
+
44
+ // Get the menuTriggerBy from blockControls plugin if available
45
+ var currentSelectedNodeName = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.menuTriggerBy;
46
+ return {
47
+ currentSelectedNodeName: currentSelectedNodeName
48
+ };
49
+ },
36
50
  contentComponent: function contentComponent(_ref2) {
37
51
  var editorView = _ref2.editorView,
38
52
  popupsMountPoint = _ref2.popupsMountPoint,
@@ -19,6 +19,7 @@ export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
19
19
  OptionalPlugin<DecorationsPlugin>
20
20
  ];
21
21
  pluginConfiguration?: BlockMenuPluginOptions;
22
+ sharedState: BlockMenuSharedState;
22
23
  }>;
23
24
  export type BlockMenuPluginOptions = {
24
25
  /**
@@ -31,6 +32,13 @@ export type BlockMenuPluginOptions = {
31
32
  */
32
33
  getLinkPath?: () => string | null;
33
34
  };
35
+ export type BlockMenuSharedState = {
36
+ /**
37
+ * The name of the currently selected node type that triggered the block menu
38
+ * This exposes the menuTriggerBy value from blockControls plugin
39
+ */
40
+ currentSelectedNodeName: string | undefined;
41
+ } | undefined;
34
42
  type WithRank<T> = T & {
35
43
  rank: number;
36
44
  };
@@ -1,2 +1,2 @@
1
1
  export { blockMenuPlugin } from './blockMenuPlugin';
2
- export type { BlockMenuPlugin, RegisterBlockMenuComponent, Parent, BlockMenuPluginOptions, } from './blockMenuPluginType';
2
+ export type { BlockMenuPlugin, RegisterBlockMenuComponent, Parent, BlockMenuPluginOptions, BlockMenuSharedState, } from './blockMenuPluginType';
@@ -19,6 +19,7 @@ export type BlockMenuPlugin = NextEditorPlugin<'blockMenu', {
19
19
  OptionalPlugin<DecorationsPlugin>
20
20
  ];
21
21
  pluginConfiguration?: BlockMenuPluginOptions;
22
+ sharedState: BlockMenuSharedState;
22
23
  }>;
23
24
  export type BlockMenuPluginOptions = {
24
25
  /**
@@ -31,6 +32,13 @@ export type BlockMenuPluginOptions = {
31
32
  */
32
33
  getLinkPath?: () => string | null;
33
34
  };
35
+ export type BlockMenuSharedState = {
36
+ /**
37
+ * The name of the currently selected node type that triggered the block menu
38
+ * This exposes the menuTriggerBy value from blockControls plugin
39
+ */
40
+ currentSelectedNodeName: string | undefined;
41
+ } | undefined;
34
42
  type WithRank<T> = T & {
35
43
  rank: number;
36
44
  };
@@ -1,2 +1,2 @@
1
1
  export { blockMenuPlugin } from './blockMenuPlugin';
2
- export type { BlockMenuPlugin, RegisterBlockMenuComponent, Parent, BlockMenuPluginOptions, } from './blockMenuPluginType';
2
+ export type { BlockMenuPlugin, RegisterBlockMenuComponent, Parent, BlockMenuPluginOptions, BlockMenuSharedState, } from './blockMenuPluginType';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "3.1.6",
3
+ "version": "3.2.0",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,12 +42,12 @@
42
42
  "@atlaskit/icon-lab": "^5.7.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
44
  "@atlaskit/primitives": "^14.14.0",
45
- "@atlaskit/tmp-editor-statsig": "^12.23.0",
45
+ "@atlaskit/tmp-editor-statsig": "^12.25.0",
46
46
  "@atlaskit/tokens": "^6.3.0",
47
47
  "@babel/runtime": "^7.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@atlaskit/editor-common": "^109.8.0",
50
+ "@atlaskit/editor-common": "^109.10.0",
51
51
  "react": "^18.2.0",
52
52
  "react-intl-next": "npm:react-intl@^5.18.1"
53
53
  },