@atlaskit/editor-plugin-selection-extension 9.0.3 → 9.0.4

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-selection-extension
2
2
 
3
+ ## 9.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b831109342cdf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b831109342cdf) -
8
+ EDITOR-3880 Register block menu selection extensions statically
9
+ - Updated dependencies
10
+
3
11
  ## 9.0.3
4
12
 
5
13
  ### Patch Changes
@@ -12,7 +12,6 @@ var _messages = require("@atlaskit/editor-common/messages");
12
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
13
  var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
14
14
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
- var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
16
15
  var _insertAdfAtEndOfDoc2 = require("./pm-plugins/actions/insertAdfAtEndOfDoc");
17
16
  var _replaceWithAdf2 = require("./pm-plugins/actions/replaceWithAdf");
18
17
  var _main = require("./pm-plugins/main");
@@ -57,6 +56,9 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
57
56
  });
58
57
  }
59
58
  }
59
+ if ((0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true)) {
60
+ (0, _registerBlockMenuItems.registerBlockMenuItems)(extensionList, api);
61
+ }
60
62
  return {
61
63
  name: 'selectionExtension',
62
64
  getSharedState: function getSharedState(editorState) {
@@ -143,14 +145,10 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
143
145
  }
144
146
  },
145
147
  usePluginHook: function usePluginHook() {
146
- (0, _usePluginStateEffect.usePluginStateEffect)(api, ['userIntent', 'selection'], function (_ref6) {
147
- var userIntentState = _ref6.userIntentState;
148
+ (0, _usePluginStateEffect.usePluginStateEffect)(api, ['selection'], function () {
148
149
  if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && (0, _coreUtils.isSSR)()) {
149
150
  return;
150
151
  }
151
- if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
152
- (0, _registerBlockMenuItems.registerBlockMenuItems)(extensionList, api);
153
- }
154
152
  if (isToolbarAIFCEnabled && (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_selection_extension', 'isEnabled', true)) {
155
153
  var _api$toolbar;
156
154
  api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)({
@@ -160,9 +158,9 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
160
158
  }
161
159
  });
162
160
  },
163
- contentComponent: function contentComponent(_ref7) {
161
+ contentComponent: function contentComponent(_ref6) {
164
162
  var _api$analytics;
165
- var editorView = _ref7.editorView;
163
+ var editorView = _ref6.editorView;
166
164
  if (!editorView || (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && (0, _coreUtils.isSSR)()) {
167
165
  return null;
168
166
  }
@@ -231,8 +229,8 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
231
229
  selectionRanges: selectionRanges
232
230
  };
233
231
  (_extension$onClick = extension.onClick) === null || _extension$onClick === void 0 || _extension$onClick.call(extension, onClickCallbackOptions);
234
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref8) {
235
- var tr = _ref8.tr;
232
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref7) {
233
+ var tr = _ref7.tr;
236
234
  tr.setMeta(_main.selectionExtensionPluginKey, {
237
235
  type: _types.SelectionExtensionActionTypes.SET_SELECTED_NODE,
238
236
  selectedNode: selectedNode,
@@ -4,7 +4,6 @@ import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
6
6
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
8
7
  import { insertAdfAtEndOfDoc } from './pm-plugins/actions/insertAdfAtEndOfDoc';
9
8
  import { replaceWithAdf } from './pm-plugins/actions/replaceWithAdf';
10
9
  import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
@@ -46,6 +45,9 @@ export const selectionExtensionPlugin = ({
46
45
  });
47
46
  }
48
47
  }
48
+ if (expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
49
+ registerBlockMenuItems(extensionList, api);
50
+ }
49
51
  return {
50
52
  name: 'selectionExtension',
51
53
  getSharedState(editorState) {
@@ -138,15 +140,10 @@ export const selectionExtensionPlugin = ({
138
140
  }
139
141
  },
140
142
  usePluginHook: () => {
141
- usePluginStateEffect(api, ['userIntent', 'selection'], ({
142
- userIntentState
143
- }) => {
143
+ usePluginStateEffect(api, ['selection'], () => {
144
144
  if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && isSSR()) {
145
145
  return;
146
146
  }
147
- if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
148
- registerBlockMenuItems(extensionList, api);
149
- }
150
147
  if (isToolbarAIFCEnabled && expValEquals('platform_editor_toolbar_aifc_selection_extension', 'isEnabled', true)) {
151
148
  var _api$toolbar;
152
149
  api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.registerComponents(getToolbarComponents({
@@ -5,7 +5,6 @@ import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
6
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
7
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
9
8
  import { insertAdfAtEndOfDoc as _insertAdfAtEndOfDoc } from './pm-plugins/actions/insertAdfAtEndOfDoc';
10
9
  import { replaceWithAdf as _replaceWithAdf } from './pm-plugins/actions/replaceWithAdf';
11
10
  import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
@@ -50,6 +49,9 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
50
49
  });
51
50
  }
52
51
  }
52
+ if (expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
53
+ registerBlockMenuItems(extensionList, api);
54
+ }
53
55
  return {
54
56
  name: 'selectionExtension',
55
57
  getSharedState: function getSharedState(editorState) {
@@ -136,14 +138,10 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
136
138
  }
137
139
  },
138
140
  usePluginHook: function usePluginHook() {
139
- usePluginStateEffect(api, ['userIntent', 'selection'], function (_ref6) {
140
- var userIntentState = _ref6.userIntentState;
141
+ usePluginStateEffect(api, ['selection'], function () {
141
142
  if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && isSSR()) {
142
143
  return;
143
144
  }
144
- if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
145
- registerBlockMenuItems(extensionList, api);
146
- }
147
145
  if (isToolbarAIFCEnabled && expValEquals('platform_editor_toolbar_aifc_selection_extension', 'isEnabled', true)) {
148
146
  var _api$toolbar;
149
147
  api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents({
@@ -153,9 +151,9 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
153
151
  }
154
152
  });
155
153
  },
156
- contentComponent: function contentComponent(_ref7) {
154
+ contentComponent: function contentComponent(_ref6) {
157
155
  var _api$analytics;
158
- var editorView = _ref7.editorView;
156
+ var editorView = _ref6.editorView;
159
157
  if (!editorView || expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && isSSR()) {
160
158
  return null;
161
159
  }
@@ -224,8 +222,8 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
224
222
  selectionRanges: selectionRanges
225
223
  };
226
224
  (_extension$onClick = extension.onClick) === null || _extension$onClick === void 0 || _extension$onClick.call(extension, onClickCallbackOptions);
227
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref8) {
228
- var tr = _ref8.tr;
225
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref7) {
226
+ var tr = _ref7.tr;
229
227
  tr.setMeta(selectionExtensionPluginKey, {
230
228
  type: SelectionExtensionActionTypes.SET_SELECTED_NODE,
231
229
  selectedNode: selectedNode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-extension",
3
- "version": "9.0.3",
3
+ "version": "9.0.4",
4
4
  "description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",