@atlaskit/editor-plugin-toolbar 4.0.4 → 4.0.6

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-toolbar
2
2
 
3
+ ## 4.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c9c11b2544f4e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c9c11b2544f4e) -
8
+ Remove platform_editor_toolbar_aifc_template_editor feature flag
9
+ - Updated dependencies
10
+
11
+ ## 4.0.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`0caee373bff2d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0caee373bff2d) -
16
+ Exported additional types to fix typescript portable annotation errors
17
+ - [`20d29306fb10e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/20d29306fb10e) -
18
+ [ED-29451] clean up platform_editor_toolbar_aifc_patch_5
19
+ - Updated dependencies
20
+
3
21
  ## 4.0.4
4
22
 
5
23
  ### Patch Changes
@@ -128,15 +128,13 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
128
128
  apply: function apply(tr, pluginState, _, newState) {
129
129
  var meta = tr.getMeta(_pluginKey.editorToolbarPluginKey);
130
130
  var newPluginState = _objectSpread({}, pluginState);
131
- if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_5', 'isEnabled', true)) {
132
- var shouldUpdateNode = tr.docChanged || tr.selectionSet;
133
- if (shouldUpdateNode) {
134
- var newSelectedNode = getSelectedNode(newState);
135
- var oldNode = pluginState.selectedNode;
136
- var hasNodeChanged = !oldNode || !newSelectedNode || oldNode.nodeType !== newSelectedNode.nodeType || oldNode.pos !== newSelectedNode.pos || JSON.stringify(oldNode.marks) !== JSON.stringify(newSelectedNode.marks);
137
- if (hasNodeChanged) {
138
- newPluginState.selectedNode = newSelectedNode;
139
- }
131
+ var shouldUpdateNode = tr.docChanged || tr.selectionSet;
132
+ if (shouldUpdateNode) {
133
+ var newSelectedNode = getSelectedNode(newState);
134
+ var oldNode = pluginState.selectedNode;
135
+ var hasNodeChanged = !oldNode || !newSelectedNode || oldNode.nodeType !== newSelectedNode.nodeType || oldNode.pos !== newSelectedNode.pos || JSON.stringify(oldNode.marks) !== JSON.stringify(newSelectedNode.marks);
136
+ if (hasNodeChanged) {
137
+ newPluginState.selectedNode = newSelectedNode;
140
138
  }
141
139
  }
142
140
  if (meta) {
@@ -100,8 +100,7 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
100
100
  editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference,
101
101
  currentUserIntent = _usePluginState.currentUserIntent,
102
102
  shouldShowToolbar = _usePluginState.shouldShowToolbar,
103
- editorViewMode = _usePluginState.editorViewMode,
104
- _selection = _usePluginState.selection;
103
+ editorViewMode = _usePluginState.editorViewMode;
105
104
  var contextualFormattingEnabled = (_api$toolbar$actions$ = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) !== null && _api$toolbar$actions$ !== void 0 ? _api$toolbar$actions$ : 'always-pinned';
106
105
  var selectionToolbarConfigEnabled = (0, _toolbar.shouldShowSelectionToolbar)(contextualFormattingEnabled, editorToolbarDockingPreference);
107
106
  var intl = (0, _reactIntlNext.useIntl)();
@@ -120,7 +119,7 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
120
119
  var isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof _state.AllSelection;
121
120
  var isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
122
121
  var onPositionCalculated = useOnPositionCalculated(editorView);
123
- if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
122
+ if (selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
124
123
  return null;
125
124
  }
126
125
  if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) || ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_user_intent_fix') ?
@@ -145,7 +144,7 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
145
144
  var _api$analytics;
146
145
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent(payload);
147
146
  },
148
- keyboardNavigation: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_5', 'isEnabled', true) ? keyboardNavigation : undefined
147
+ keyboardNavigation: keyboardNavigation
149
148
  }, /*#__PURE__*/_react.default.createElement(_editorToolbarModel.ToolbarModelRenderer, {
150
149
  toolbar: toolbar,
151
150
  components: components,
@@ -28,7 +28,7 @@ var getInlineTextToolbarComponents = function getInlineTextToolbarComponents() {
28
28
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.Toolbar, {
29
29
  label: _consts.SELECTION_TOOLBAR_LABEL,
30
30
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.SELECTION_TOOLBAR,
31
- testId: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_5', 'isEnabled', true) ? 'editor-floating-toolbar' : undefined
31
+ testId: 'editor-floating-toolbar'
32
32
  }, children);
33
33
  }
34
34
  }];
@@ -115,15 +115,13 @@ export const toolbarPlugin = ({
115
115
  let newPluginState = {
116
116
  ...pluginState
117
117
  };
118
- if (expValEquals('platform_editor_toolbar_aifc_patch_5', 'isEnabled', true)) {
119
- const shouldUpdateNode = tr.docChanged || tr.selectionSet;
120
- if (shouldUpdateNode) {
121
- const newSelectedNode = getSelectedNode(newState);
122
- const oldNode = pluginState.selectedNode;
123
- const hasNodeChanged = !oldNode || !newSelectedNode || oldNode.nodeType !== newSelectedNode.nodeType || oldNode.pos !== newSelectedNode.pos || JSON.stringify(oldNode.marks) !== JSON.stringify(newSelectedNode.marks);
124
- if (hasNodeChanged) {
125
- newPluginState.selectedNode = newSelectedNode;
126
- }
118
+ const shouldUpdateNode = tr.docChanged || tr.selectionSet;
119
+ if (shouldUpdateNode) {
120
+ const newSelectedNode = getSelectedNode(newState);
121
+ const oldNode = pluginState.selectedNode;
122
+ const hasNodeChanged = !oldNode || !newSelectedNode || oldNode.nodeType !== newSelectedNode.nodeType || oldNode.pos !== newSelectedNode.pos || JSON.stringify(oldNode.marks) !== JSON.stringify(newSelectedNode.marks);
123
+ if (hasNodeChanged) {
124
+ newPluginState.selectedNode = newSelectedNode;
127
125
  }
128
126
  }
129
127
  if (meta) {
@@ -92,9 +92,7 @@ export const SelectionToolbar = ({
92
92
  editorToolbarDockingPreference,
93
93
  currentUserIntent,
94
94
  shouldShowToolbar,
95
- editorViewMode,
96
- // @ts-ignore
97
- selection: _selection
95
+ editorViewMode
98
96
  } = usePluginState(api);
99
97
  const contextualFormattingEnabled = (_api$toolbar$actions$ = api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) !== null && _api$toolbar$actions$ !== void 0 ? _api$toolbar$actions$ : 'always-pinned';
100
98
  const selectionToolbarConfigEnabled = shouldShowSelectionToolbar(contextualFormattingEnabled, editorToolbarDockingPreference);
@@ -113,7 +111,7 @@ export const SelectionToolbar = ({
113
111
  const isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof AllSelection;
114
112
  const isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
115
113
  const onPositionCalculated = useOnPositionCalculated(editorView);
116
- if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
114
+ if (selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
117
115
  return null;
118
116
  }
119
117
  if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || (fg('platform_editor_toolbar_aifc_user_intent_fix') ?
@@ -138,7 +136,7 @@ export const SelectionToolbar = ({
138
136
  var _api$analytics;
139
137
  api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent(payload);
140
138
  },
141
- keyboardNavigation: expValEquals('platform_editor_toolbar_aifc_patch_5', 'isEnabled', true) ? keyboardNavigation : undefined
139
+ keyboardNavigation: keyboardNavigation
142
140
  }, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
143
141
  toolbar: toolbar,
144
142
  components: components,
@@ -21,7 +21,7 @@ const getInlineTextToolbarComponents = () => {
21
21
  return /*#__PURE__*/React.createElement(Toolbar, {
22
22
  label: SELECTION_TOOLBAR_LABEL,
23
23
  actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR,
24
- testId: expValEquals('platform_editor_toolbar_aifc_patch_5', 'isEnabled', true) ? 'editor-floating-toolbar' : undefined
24
+ testId: 'editor-floating-toolbar'
25
25
  }, children);
26
26
  }
27
27
  }];
@@ -121,15 +121,13 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
121
121
  apply: function apply(tr, pluginState, _, newState) {
122
122
  var meta = tr.getMeta(editorToolbarPluginKey);
123
123
  var newPluginState = _objectSpread({}, pluginState);
124
- if (expValEquals('platform_editor_toolbar_aifc_patch_5', 'isEnabled', true)) {
125
- var shouldUpdateNode = tr.docChanged || tr.selectionSet;
126
- if (shouldUpdateNode) {
127
- var newSelectedNode = getSelectedNode(newState);
128
- var oldNode = pluginState.selectedNode;
129
- var hasNodeChanged = !oldNode || !newSelectedNode || oldNode.nodeType !== newSelectedNode.nodeType || oldNode.pos !== newSelectedNode.pos || JSON.stringify(oldNode.marks) !== JSON.stringify(newSelectedNode.marks);
130
- if (hasNodeChanged) {
131
- newPluginState.selectedNode = newSelectedNode;
132
- }
124
+ var shouldUpdateNode = tr.docChanged || tr.selectionSet;
125
+ if (shouldUpdateNode) {
126
+ var newSelectedNode = getSelectedNode(newState);
127
+ var oldNode = pluginState.selectedNode;
128
+ var hasNodeChanged = !oldNode || !newSelectedNode || oldNode.nodeType !== newSelectedNode.nodeType || oldNode.pos !== newSelectedNode.pos || JSON.stringify(oldNode.marks) !== JSON.stringify(newSelectedNode.marks);
129
+ if (hasNodeChanged) {
130
+ newPluginState.selectedNode = newSelectedNode;
133
131
  }
134
132
  }
135
133
  if (meta) {
@@ -92,8 +92,7 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
92
92
  editorToolbarDockingPreference = _usePluginState.editorToolbarDockingPreference,
93
93
  currentUserIntent = _usePluginState.currentUserIntent,
94
94
  shouldShowToolbar = _usePluginState.shouldShowToolbar,
95
- editorViewMode = _usePluginState.editorViewMode,
96
- _selection = _usePluginState.selection;
95
+ editorViewMode = _usePluginState.editorViewMode;
97
96
  var contextualFormattingEnabled = (_api$toolbar$actions$ = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) !== null && _api$toolbar$actions$ !== void 0 ? _api$toolbar$actions$ : 'always-pinned';
98
97
  var selectionToolbarConfigEnabled = shouldShowSelectionToolbar(contextualFormattingEnabled, editorToolbarDockingPreference);
99
98
  var intl = useIntl();
@@ -112,7 +111,7 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
112
111
  var isAllSelection = !editorView.state.selection.empty && editorView.state.selection instanceof AllSelection;
113
112
  var isCellSelection = !editorView.state.selection.empty && '$anchorCell' in editorView.state.selection;
114
113
  var onPositionCalculated = useOnPositionCalculated(editorView);
115
- if (expValEquals('platform_editor_toolbar_aifc_template_editor', 'isEnabled', true) && selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
114
+ if (selectionToolbarConfigEnabled && disableSelectionToolbarWhenPinned || !components || !toolbar) {
116
115
  return null;
117
116
  }
118
117
  if (!(isTextSelection || isCellSelection || isAllSelection) || currentUserIntent === 'dragging' || !shouldShowToolbar || currentUserIntent === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) || (fg('platform_editor_toolbar_aifc_user_intent_fix') ?
@@ -137,7 +136,7 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
137
136
  var _api$analytics;
138
137
  api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent(payload);
139
138
  },
140
- keyboardNavigation: expValEquals('platform_editor_toolbar_aifc_patch_5', 'isEnabled', true) ? keyboardNavigation : undefined
139
+ keyboardNavigation: keyboardNavigation
141
140
  }, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
142
141
  toolbar: toolbar,
143
142
  components: components,
@@ -21,7 +21,7 @@ var getInlineTextToolbarComponents = function getInlineTextToolbarComponents() {
21
21
  return /*#__PURE__*/React.createElement(Toolbar, {
22
22
  label: SELECTION_TOOLBAR_LABEL,
23
23
  actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR,
24
- testId: expValEquals('platform_editor_toolbar_aifc_patch_5', 'isEnabled', true) ? 'editor-floating-toolbar' : undefined
24
+ testId: 'editor-floating-toolbar'
25
25
  }, children);
26
26
  }
27
27
  }];
@@ -1,3 +1,3 @@
1
1
  export { toolbarPlugin } from './toolbarPlugin';
2
- export type { ToolbarPlugin } from './toolbarPluginType';
3
- export type { ToolbarPluginOptions } from './types';
2
+ export type { ToolbarPlugin, EditorToolbarPluginState } from './toolbarPluginType';
3
+ export type { ToolbarPluginOptions, RegisterComponentsAction } from './types';
@@ -1,3 +1,3 @@
1
1
  export { toolbarPlugin } from './toolbarPlugin';
2
- export type { ToolbarPlugin } from './toolbarPluginType';
3
- export type { ToolbarPluginOptions } from './types';
2
+ export type { ToolbarPlugin, EditorToolbarPluginState } from './toolbarPluginType';
3
+ export type { ToolbarPluginOptions, RegisterComponentsAction } from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-toolbar",
3
- "version": "4.0.4",
3
+ "version": "4.0.6",
4
4
  "description": "Toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,13 +40,13 @@
40
40
  "@atlaskit/editor-toolbar-model": "^0.2.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
42
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
43
- "@atlaskit/tmp-editor-statsig": "^16.18.0",
43
+ "@atlaskit/tmp-editor-statsig": "^16.20.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "bind-event-listener": "^3.0.0",
46
46
  "react-intl-next": "npm:react-intl@^5.18.1"
47
47
  },
48
48
  "peerDependencies": {
49
- "@atlaskit/editor-common": "^111.7.0",
49
+ "@atlaskit/editor-common": "^111.8.0",
50
50
  "react": "^18.2.0"
51
51
  },
52
52
  "platform-feature-flags": {