@atlaskit/editor-plugin-toolbar 13.0.18 → 14.0.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,15 @@
1
1
  # @atlaskit/editor-plugin-toolbar
2
2
 
3
+ ## 14.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ac7ebc57182dd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ac7ebc57182dd) -
8
+ Avoid dispatching a no-op selection-toolbar transaction on every mouseup when `shouldShowToolbar`
9
+ is unchanged, reducing redundant shared-state updates on interaction. Behind the
10
+ `platform_editor_toolbar_multi_editor_fix` experiment.
11
+ - Updated dependencies
12
+
3
13
  ## 13.0.18
4
14
 
5
15
  ### Patch Changes
@@ -194,7 +194,7 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
194
194
  mouseState.isMouseDown = false;
195
195
  var event = ev;
196
196
  if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_toolbar_multi_editor_fix')) {
197
- var _api$editorViewMode;
197
+ var _api$editorViewMode, _api$toolbar;
198
198
  // Scope mouseups to this editor and its React-portaled toolbar.
199
199
  var isMouseUpInOwnedToolbar = refs.toolbarMouseUpEvent === event;
200
200
  var isMouseUpInEditor = event.composedPath().includes(_view.dom);
@@ -206,9 +206,12 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
206
206
  // Include focus in nested editable islands when enabled.
207
207
  var _hasEditorFocus = (0, _fg.fg)('platform_editor_blocks_patch_7') ? _view.hasFocus() || _view.dom.contains(_view.root.activeElement) : _view.hasFocus();
208
208
  var shouldShowToolbar = _isViewModeEnabled ? isMouseUpInEditor || isMouseUpInOwnedToolbar : _hasEditorFocus || isMouseUpInOwnedToolbar;
209
- _view.dispatch(_view.state.tr.setMeta(_pluginKey.editorToolbarPluginKey, {
210
- shouldShowToolbar: shouldShowToolbar
211
- }));
209
+ var currentShouldShowToolbar = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || (_api$toolbar = _api$toolbar.sharedState.currentState()) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.shouldShowToolbar;
210
+ if (currentShouldShowToolbar !== shouldShowToolbar) {
211
+ _view.dispatch(_view.state.tr.setMeta(_pluginKey.editorToolbarPluginKey, {
212
+ shouldShowToolbar: shouldShowToolbar
213
+ }));
214
+ }
212
215
  return;
213
216
  }
214
217
  var isInToolbar = (0, _toolbar.isEventInContainer)(event, _consts.DEFAULT_POPUP_SELECTORS.toolbarContainer);
@@ -186,7 +186,7 @@ export const toolbarPlugin = ({
186
186
  mouseState.isMouseDown = false;
187
187
  const event = ev;
188
188
  if (isExperimentEnabled('platform_editor_toolbar_multi_editor_fix')) {
189
- var _api$editorViewMode;
189
+ var _api$editorViewMode, _api$toolbar, _api$toolbar$sharedSt;
190
190
  // Scope mouseups to this editor and its React-portaled toolbar.
191
191
  const isMouseUpInOwnedToolbar = refs.toolbarMouseUpEvent === event;
192
192
  const isMouseUpInEditor = event.composedPath().includes(view.dom);
@@ -198,9 +198,12 @@ export const toolbarPlugin = ({
198
198
  // Include focus in nested editable islands when enabled.
199
199
  const hasEditorFocus = fg('platform_editor_blocks_patch_7') ? view.hasFocus() || view.dom.contains(view.root.activeElement) : view.hasFocus();
200
200
  const shouldShowToolbar = isViewModeEnabled ? isMouseUpInEditor || isMouseUpInOwnedToolbar : hasEditorFocus || isMouseUpInOwnedToolbar;
201
- view.dispatch(view.state.tr.setMeta(editorToolbarPluginKey, {
202
- shouldShowToolbar
203
- }));
201
+ const currentShouldShowToolbar = api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : (_api$toolbar$sharedSt = _api$toolbar.sharedState.currentState()) === null || _api$toolbar$sharedSt === void 0 ? void 0 : _api$toolbar$sharedSt.shouldShowToolbar;
202
+ if (currentShouldShowToolbar !== shouldShowToolbar) {
203
+ view.dispatch(view.state.tr.setMeta(editorToolbarPluginKey, {
204
+ shouldShowToolbar
205
+ }));
206
+ }
204
207
  return;
205
208
  }
206
209
  const isInToolbar = isEventInContainer(event, DEFAULT_POPUP_SELECTORS.toolbarContainer);
@@ -187,7 +187,7 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
187
187
  mouseState.isMouseDown = false;
188
188
  var event = ev;
189
189
  if (isExperimentEnabled('platform_editor_toolbar_multi_editor_fix')) {
190
- var _api$editorViewMode;
190
+ var _api$editorViewMode, _api$toolbar;
191
191
  // Scope mouseups to this editor and its React-portaled toolbar.
192
192
  var isMouseUpInOwnedToolbar = refs.toolbarMouseUpEvent === event;
193
193
  var isMouseUpInEditor = event.composedPath().includes(_view.dom);
@@ -199,9 +199,12 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
199
199
  // Include focus in nested editable islands when enabled.
200
200
  var _hasEditorFocus = fg('platform_editor_blocks_patch_7') ? _view.hasFocus() || _view.dom.contains(_view.root.activeElement) : _view.hasFocus();
201
201
  var shouldShowToolbar = _isViewModeEnabled ? isMouseUpInEditor || isMouseUpInOwnedToolbar : _hasEditorFocus || isMouseUpInOwnedToolbar;
202
- _view.dispatch(_view.state.tr.setMeta(editorToolbarPluginKey, {
203
- shouldShowToolbar: shouldShowToolbar
204
- }));
202
+ var currentShouldShowToolbar = api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || (_api$toolbar = _api$toolbar.sharedState.currentState()) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.shouldShowToolbar;
203
+ if (currentShouldShowToolbar !== shouldShowToolbar) {
204
+ _view.dispatch(_view.state.tr.setMeta(editorToolbarPluginKey, {
205
+ shouldShowToolbar: shouldShowToolbar
206
+ }));
207
+ }
205
208
  return;
206
209
  }
207
210
  var isInToolbar = isEventInContainer(event, DEFAULT_POPUP_SELECTORS.toolbarContainer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-toolbar",
3
- "version": "13.0.18",
3
+ "version": "14.0.0",
4
4
  "description": "Toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -21,24 +21,24 @@
21
21
  "atlaskit:src": "src/index.ts",
22
22
  "dependencies": {
23
23
  "@atlaskit/browser-apis": "^1.2.0",
24
- "@atlaskit/editor-plugin-analytics": "^16.1.0",
25
- "@atlaskit/editor-plugin-connectivity": "^16.0.0",
26
- "@atlaskit/editor-plugin-editor-viewmode": "^18.0.0",
27
- "@atlaskit/editor-plugin-selection": "^16.1.0",
28
- "@atlaskit/editor-plugin-user-intent": "^14.0.0",
29
- "@atlaskit/editor-plugin-user-preferences": "^14.0.0",
24
+ "@atlaskit/editor-plugin-analytics": "^17.0.0",
25
+ "@atlaskit/editor-plugin-connectivity": "^17.0.0",
26
+ "@atlaskit/editor-plugin-editor-viewmode": "^19.0.0",
27
+ "@atlaskit/editor-plugin-selection": "^17.0.0",
28
+ "@atlaskit/editor-plugin-user-intent": "^15.0.0",
29
+ "@atlaskit/editor-plugin-user-preferences": "^15.0.0",
30
30
  "@atlaskit/editor-prosemirror": "^8.0.0",
31
31
  "@atlaskit/editor-shared-styles": "^4.1.0",
32
32
  "@atlaskit/editor-toolbar": "^2.6.0",
33
33
  "@atlaskit/editor-toolbar-model": "^1.2.0",
34
34
  "@atlaskit/platform-feature-experiments": "^0.3.0",
35
35
  "@atlaskit/platform-feature-flags": "^2.2.0",
36
- "@atlaskit/tmp-editor-statsig": "^178.0.0",
36
+ "@atlaskit/tmp-editor-statsig": "^179.0.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "bind-event-listener": "^3.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@atlaskit/editor-common": "^120.16.0",
41
+ "@atlaskit/editor-common": "^121.0.0",
42
42
  "react": "^18.2.0 || ^19.2.0",
43
43
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
44
44
  },