@atlaskit/editor-plugin-floating-toolbar 4.0.0 → 4.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,23 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 4.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#143960](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/143960)
8
+ [`e1bf8964b3cf8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e1bf8964b3cf8) -
9
+ Adding press interaction performance tracking to Comment action in floating toolbar. No UI change.
10
+ - Updated dependencies
11
+
12
+ ## 4.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#140969](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/140969)
17
+ [`b4ac22e73d43c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b4ac22e73d43c) -
18
+ [ux] [ED-27253] hide selection states until editor has been interacted with
19
+ - Updated dependencies
20
+
3
21
  ## 4.0.0
4
22
 
5
23
  ### Major Changes
@@ -174,11 +174,19 @@ var floatingToolbarPlugin = exports.floatingToolbarPlugin = function floatingToo
174
174
  }
175
175
  },
176
176
  getSharedState: function getSharedState(editorState) {
177
- var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
177
+ var _api$interaction;
178
178
  if (!editorState) {
179
179
  return undefined;
180
180
  }
181
- var configWithNodeInfo = (_pluginKey$getState$g = (_pluginKey$getState = pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 || (_pluginKey$getState$g2 = _pluginKey$getState.getConfigWithNodeInfo) === null || _pluginKey$getState$g2 === void 0 ? void 0 : _pluginKey$getState$g2.call(_pluginKey$getState, editorState)) !== null && _pluginKey$getState$g !== void 0 ? _pluginKey$getState$g : undefined;
181
+ var hasHadInteraction = api === null || api === void 0 || (_api$interaction = api.interaction) === null || _api$interaction === void 0 || (_api$interaction = _api$interaction.sharedState.currentState()) === null || _api$interaction === void 0 ? void 0 : _api$interaction.hasHadInteraction;
182
+ var configWithNodeInfo;
183
+ if ((0, _platformFeatureFlags.fg)('platform_editor_no_selection_until_interaction')) {
184
+ var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
185
+ configWithNodeInfo = hasHadInteraction !== false ? (_pluginKey$getState$g = (_pluginKey$getState = pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 || (_pluginKey$getState$g2 = _pluginKey$getState.getConfigWithNodeInfo) === null || _pluginKey$getState$g2 === void 0 ? void 0 : _pluginKey$getState$g2.call(_pluginKey$getState, editorState)) !== null && _pluginKey$getState$g !== void 0 ? _pluginKey$getState$g : undefined : undefined;
186
+ } else {
187
+ var _pluginKey$getState$g3, _pluginKey$getState2, _pluginKey$getState2$;
188
+ configWithNodeInfo = (_pluginKey$getState$g3 = (_pluginKey$getState2 = pluginKey.getState(editorState)) === null || _pluginKey$getState2 === void 0 || (_pluginKey$getState2$ = _pluginKey$getState2.getConfigWithNodeInfo) === null || _pluginKey$getState2$ === void 0 ? void 0 : _pluginKey$getState2$.call(_pluginKey$getState2, editorState)) !== null && _pluginKey$getState$g3 !== void 0 ? _pluginKey$getState$g3 : undefined;
189
+ }
182
190
  return {
183
191
  configWithNodeInfo: configWithNodeInfo,
184
192
  floatingToolbarData: _pluginKey.pluginKey.getState(editorState)
@@ -166,7 +166,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
166
166
  tabIndex: item.tabIndex,
167
167
  isRadioButton: item.isRadioButton,
168
168
  pulse: item.pulse,
169
- spotlightConfig: item.spotlightConfig
169
+ spotlightConfig: item.spotlightConfig,
170
+ interactionName: item.interactionName
170
171
  }, item.showTitle && item.title);
171
172
  case 'input':
172
173
  return (0, _react2.jsx)(_Input.Input, {
@@ -154,11 +154,19 @@ export const floatingToolbarPlugin = ({
154
154
  copyNode: nodeType => copyNode(nodeType)
155
155
  },
156
156
  getSharedState(editorState) {
157
- var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
157
+ var _api$interaction, _api$interaction$shar;
158
158
  if (!editorState) {
159
159
  return undefined;
160
160
  }
161
- const configWithNodeInfo = (_pluginKey$getState$g = (_pluginKey$getState = pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 ? void 0 : (_pluginKey$getState$g2 = _pluginKey$getState.getConfigWithNodeInfo) === null || _pluginKey$getState$g2 === void 0 ? void 0 : _pluginKey$getState$g2.call(_pluginKey$getState, editorState)) !== null && _pluginKey$getState$g !== void 0 ? _pluginKey$getState$g : undefined;
161
+ const hasHadInteraction = api === null || api === void 0 ? void 0 : (_api$interaction = api.interaction) === null || _api$interaction === void 0 ? void 0 : (_api$interaction$shar = _api$interaction.sharedState.currentState()) === null || _api$interaction$shar === void 0 ? void 0 : _api$interaction$shar.hasHadInteraction;
162
+ let configWithNodeInfo;
163
+ if (fg('platform_editor_no_selection_until_interaction')) {
164
+ var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
165
+ configWithNodeInfo = hasHadInteraction !== false ? (_pluginKey$getState$g = (_pluginKey$getState = pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 ? void 0 : (_pluginKey$getState$g2 = _pluginKey$getState.getConfigWithNodeInfo) === null || _pluginKey$getState$g2 === void 0 ? void 0 : _pluginKey$getState$g2.call(_pluginKey$getState, editorState)) !== null && _pluginKey$getState$g !== void 0 ? _pluginKey$getState$g : undefined : undefined;
166
+ } else {
167
+ var _pluginKey$getState$g3, _pluginKey$getState2, _pluginKey$getState2$;
168
+ configWithNodeInfo = (_pluginKey$getState$g3 = (_pluginKey$getState2 = pluginKey.getState(editorState)) === null || _pluginKey$getState2 === void 0 ? void 0 : (_pluginKey$getState2$ = _pluginKey$getState2.getConfigWithNodeInfo) === null || _pluginKey$getState2$ === void 0 ? void 0 : _pluginKey$getState2$.call(_pluginKey$getState2, editorState)) !== null && _pluginKey$getState$g3 !== void 0 ? _pluginKey$getState$g3 : undefined;
169
+ }
162
170
  return {
163
171
  configWithNodeInfo,
164
172
  floatingToolbarData: dataPluginKey.getState(editorState)
@@ -147,7 +147,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
147
147
  tabIndex: item.tabIndex,
148
148
  isRadioButton: item.isRadioButton,
149
149
  pulse: item.pulse,
150
- spotlightConfig: item.spotlightConfig
150
+ spotlightConfig: item.spotlightConfig,
151
+ interactionName: item.interactionName
151
152
  }, item.showTitle && item.title);
152
153
  case 'input':
153
154
  return jsx(Input, {
@@ -162,11 +162,19 @@ export var floatingToolbarPlugin = function floatingToolbarPlugin(_ref) {
162
162
  }
163
163
  },
164
164
  getSharedState: function getSharedState(editorState) {
165
- var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
165
+ var _api$interaction;
166
166
  if (!editorState) {
167
167
  return undefined;
168
168
  }
169
- var configWithNodeInfo = (_pluginKey$getState$g = (_pluginKey$getState = pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 || (_pluginKey$getState$g2 = _pluginKey$getState.getConfigWithNodeInfo) === null || _pluginKey$getState$g2 === void 0 ? void 0 : _pluginKey$getState$g2.call(_pluginKey$getState, editorState)) !== null && _pluginKey$getState$g !== void 0 ? _pluginKey$getState$g : undefined;
169
+ var hasHadInteraction = api === null || api === void 0 || (_api$interaction = api.interaction) === null || _api$interaction === void 0 || (_api$interaction = _api$interaction.sharedState.currentState()) === null || _api$interaction === void 0 ? void 0 : _api$interaction.hasHadInteraction;
170
+ var configWithNodeInfo;
171
+ if (fg('platform_editor_no_selection_until_interaction')) {
172
+ var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
173
+ configWithNodeInfo = hasHadInteraction !== false ? (_pluginKey$getState$g = (_pluginKey$getState = pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 || (_pluginKey$getState$g2 = _pluginKey$getState.getConfigWithNodeInfo) === null || _pluginKey$getState$g2 === void 0 ? void 0 : _pluginKey$getState$g2.call(_pluginKey$getState, editorState)) !== null && _pluginKey$getState$g !== void 0 ? _pluginKey$getState$g : undefined : undefined;
174
+ } else {
175
+ var _pluginKey$getState$g3, _pluginKey$getState2, _pluginKey$getState2$;
176
+ configWithNodeInfo = (_pluginKey$getState$g3 = (_pluginKey$getState2 = pluginKey.getState(editorState)) === null || _pluginKey$getState2 === void 0 || (_pluginKey$getState2$ = _pluginKey$getState2.getConfigWithNodeInfo) === null || _pluginKey$getState2$ === void 0 ? void 0 : _pluginKey$getState2$.call(_pluginKey$getState2, editorState)) !== null && _pluginKey$getState$g3 !== void 0 ? _pluginKey$getState$g3 : undefined;
177
+ }
170
178
  return {
171
179
  configWithNodeInfo: configWithNodeInfo,
172
180
  floatingToolbarData: dataPluginKey.getState(editorState)
@@ -159,7 +159,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
159
159
  tabIndex: item.tabIndex,
160
160
  isRadioButton: item.isRadioButton,
161
161
  pulse: item.pulse,
162
- spotlightConfig: item.spotlightConfig
162
+ spotlightConfig: item.spotlightConfig,
163
+ interactionName: item.interactionName
163
164
  }, item.showTitle && item.title);
164
165
  case 'input':
165
166
  return jsx(Input, {
@@ -7,6 +7,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
7
7
  import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
8
8
  import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
9
9
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
10
+ import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
10
11
  import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
11
12
  import type { Node } from '@atlaskit/editor-prosemirror/model';
12
13
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -35,7 +36,8 @@ export type FloatingToolbarPluginDependencies = [
35
36
  OptionalPlugin<EditorViewModePlugin>,
36
37
  OptionalPlugin<FeatureFlagsPlugin>,
37
38
  OptionalPlugin<EmojiPlugin>,
38
- OptionalPlugin<UserIntentPlugin>
39
+ OptionalPlugin<UserIntentPlugin>,
40
+ OptionalPlugin<InteractionPlugin>
39
41
  ];
40
42
  export type FloatingToolbarPlugin = NextEditorPlugin<'floatingToolbar', {
41
43
  dependencies: FloatingToolbarPluginDependencies;
@@ -7,6 +7,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
7
7
  import type { EmojiPlugin } from '@atlaskit/editor-plugin-emoji';
8
8
  import type { ExtensionPlugin } from '@atlaskit/editor-plugin-extension';
9
9
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
10
+ import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
10
11
  import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
11
12
  import type { Node } from '@atlaskit/editor-prosemirror/model';
12
13
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
@@ -35,7 +36,8 @@ export type FloatingToolbarPluginDependencies = [
35
36
  OptionalPlugin<EditorViewModePlugin>,
36
37
  OptionalPlugin<FeatureFlagsPlugin>,
37
38
  OptionalPlugin<EmojiPlugin>,
38
- OptionalPlugin<UserIntentPlugin>
39
+ OptionalPlugin<UserIntentPlugin>,
40
+ OptionalPlugin<InteractionPlugin>
39
41
  ];
40
42
  export type FloatingToolbarPlugin = NextEditorPlugin<'floatingToolbar', {
41
43
  dependencies: FloatingToolbarPluginDependencies;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,6 +37,7 @@
37
37
  "@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
38
38
  "@atlaskit/editor-plugin-emoji": "^3.6.0",
39
39
  "@atlaskit/editor-plugin-extension": "^5.2.0",
40
+ "@atlaskit/editor-plugin-interaction": "^1.0.0",
40
41
  "@atlaskit/editor-plugin-table": "^10.8.0",
41
42
  "@atlaskit/editor-plugin-user-intent": "^0.1.0",
42
43
  "@atlaskit/editor-prosemirror": "7.0.0",
@@ -138,6 +139,9 @@
138
139
  "platform_editor_controls_patch_4": {
139
140
  "type": "boolean"
140
141
  },
142
+ "platform_editor_no_selection_until_interaction": {
143
+ "type": "boolean"
144
+ },
141
145
  "platform_editor_user_intent_plugin": {
142
146
  "type": "boolean"
143
147
  }