@atlaskit/editor-plugin-toolbar 10.0.2 → 10.1.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,45 @@
1
1
  # @atlaskit/editor-plugin-toolbar
2
2
 
3
+ ## 10.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b7e3a66378c6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b7e3a66378c6e) -
8
+ [ux] Restore the contextual toolbar when selecting text inside a reference synced block, behind
9
+ `platform_editor_blocks_patch_7`.
10
+ - `@atlaskit/editor-plugin-toolbar`: the toolbar no longer treats focus inside a nested editable
11
+ region that ProseMirror does not own - such as the content island a reference synced block
12
+ renders - as the editor being blurred.
13
+ - `@atlaskit/editor-synced-block-provider`: `getProviderFactory` is now side-effect free. Applying
14
+ parent and dynamically created providers moved to a new `syncProviders` method. Previously this
15
+ ran during render, scheduling a `setState` on another component mid-render, which forced an
16
+ extra render pass that replaced the synced block DOM and destroyed any in-progress text
17
+ selection.
18
+
19
+ `syncProviders` mutates the cached factory and notifies its subscribers, so call it from an effect
20
+ rather than during render:
21
+
22
+ ```ts
23
+ const providerFactory = manager.referenceManager.getProviderFactory(resourceId);
24
+
25
+ useEffect(() => {
26
+ manager.referenceManager.syncProviders(resourceId);
27
+ }, [manager.referenceManager, resourceId, syncBlockInstance]);
28
+ ```
29
+
30
+ With the flag off, `getProviderFactory` keeps applying providers inline, so existing behaviour is
31
+ unchanged.
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies
36
+
37
+ ## 10.0.3
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies
42
+
3
43
  ## 10.0.2
4
44
 
5
45
  ### Patch Changes
@@ -14,6 +14,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
14
14
  var _state = require("@atlaskit/editor-prosemirror/state");
15
15
  var _utils = require("@atlaskit/editor-prosemirror/utils");
16
16
  var _editorToolbarModel = require("@atlaskit/editor-toolbar-model");
17
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
17
18
  var _selectionToolbarOpenExperience = require("./pm-plugins/experiences/selection-toolbar-open-experience");
18
19
  var _pluginKey = require("./pm-plugins/plugin-key");
19
20
  var _consts = require("./ui/consts");
@@ -196,8 +197,12 @@ var toolbarPlugin = exports.toolbarPlugin = function toolbarPlugin(_ref) {
196
197
  // due to a click outside the editor.
197
198
  var editorViewModePlugin = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState();
198
199
  var isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
200
+ // Focus can sit inside a nested editable region ProseMirror does not own -
201
+ // such as a reference synced block's island - where `view.hasFocus()` is
202
+ // false but the user is still interacting with the editor.
203
+ var hasEditorFocus = (0, _fg.fg)('platform_editor_blocks_patch_7') ? _view.hasFocus() || _view.dom.contains(_view.root.activeElement) : _view.hasFocus();
199
204
  _view.dispatch(_view.state.tr.setMeta(_pluginKey.editorToolbarPluginKey, {
200
- shouldShowToolbar: !isViewModeEnabled ? _view.hasFocus() || isInToolbar || isInPortal : true
205
+ shouldShowToolbar: !isViewModeEnabled ? hasEditorFocus || isInToolbar || isInPortal : true
201
206
  }));
202
207
  }
203
208
  });
@@ -4,6 +4,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';
7
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
7
8
  import { getSelectionToolbarOpenExperiencePlugin } from './pm-plugins/experiences/selection-toolbar-open-experience';
8
9
  import { editorToolbarPluginKey } from './pm-plugins/plugin-key';
9
10
  import { DEFAULT_POPUP_SELECTORS } from './ui/consts';
@@ -188,8 +189,12 @@ export const toolbarPlugin = ({
188
189
  // due to a click outside the editor.
189
190
  const editorViewModePlugin = api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState();
190
191
  const isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
192
+ // Focus can sit inside a nested editable region ProseMirror does not own -
193
+ // such as a reference synced block's island - where `view.hasFocus()` is
194
+ // false but the user is still interacting with the editor.
195
+ const hasEditorFocus = fg('platform_editor_blocks_patch_7') ? view.hasFocus() || view.dom.contains(view.root.activeElement) : view.hasFocus();
191
196
  view.dispatch(view.state.tr.setMeta(editorToolbarPluginKey, {
192
- shouldShowToolbar: !isViewModeEnabled ? view.hasFocus() || isInToolbar || isInPortal : true
197
+ shouldShowToolbar: !isViewModeEnabled ? hasEditorFocus || isInToolbar || isInPortal : true
193
198
  }));
194
199
  }
195
200
  });
@@ -10,6 +10,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
10
10
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
11
  import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
12
12
  import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';
13
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
13
14
  import { getSelectionToolbarOpenExperiencePlugin } from './pm-plugins/experiences/selection-toolbar-open-experience';
14
15
  import { editorToolbarPluginKey } from './pm-plugins/plugin-key';
15
16
  import { DEFAULT_POPUP_SELECTORS } from './ui/consts';
@@ -189,8 +190,12 @@ export var toolbarPlugin = function toolbarPlugin(_ref) {
189
190
  // due to a click outside the editor.
190
191
  var editorViewModePlugin = api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState();
191
192
  var isViewModeEnabled = (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view';
193
+ // Focus can sit inside a nested editable region ProseMirror does not own -
194
+ // such as a reference synced block's island - where `view.hasFocus()` is
195
+ // false but the user is still interacting with the editor.
196
+ var hasEditorFocus = fg('platform_editor_blocks_patch_7') ? _view.hasFocus() || _view.dom.contains(_view.root.activeElement) : _view.hasFocus();
192
197
  _view.dispatch(_view.state.tr.setMeta(editorToolbarPluginKey, {
193
- shouldShowToolbar: !isViewModeEnabled ? _view.hasFocus() || isInToolbar || isInPortal : true
198
+ shouldShowToolbar: !isViewModeEnabled ? hasEditorFocus || isInToolbar || isInPortal : true
194
199
  }));
195
200
  }
196
201
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-toolbar",
3
- "version": "10.0.2",
3
+ "version": "10.1.0",
4
4
  "description": "Toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,16 +32,21 @@
32
32
  "@atlaskit/editor-toolbar": "^2.4.0",
33
33
  "@atlaskit/editor-toolbar-model": "^1.2.0",
34
34
  "@atlaskit/platform-feature-flags": "^2.1.0",
35
- "@atlaskit/tmp-editor-statsig": "^140.0.0",
35
+ "@atlaskit/tmp-editor-statsig": "^141.1.0",
36
36
  "@babel/runtime": "^7.0.0",
37
37
  "bind-event-listener": "^3.0.0"
38
38
  },
39
39
  "peerDependencies": {
40
- "@atlaskit/editor-common": "^117.2.0",
40
+ "@atlaskit/editor-common": "^117.3.0",
41
41
  "react": "^18.2.0 || ^19.2.0",
42
42
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
43
43
  },
44
- "platform-feature-flags": {},
44
+ "platform-feature-flags": {
45
+ "platform_editor_blocks_patch_7": {
46
+ "type": "boolean",
47
+ "referenceOnly": true
48
+ }
49
+ },
45
50
  "techstack": {
46
51
  "@atlassian/frontend": {
47
52
  "code-structure": [
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "extends": "../../../tsconfig.json",
3
- "include": [
4
- "src/**/*.ts",
5
- "src/**/*.tsx"
6
- ]
2
+ "extends": "./tsconfig.dev.json",
3
+ "compilerOptions": {
4
+ "disableReferencedProjectLoad": true,
5
+ "disableSolutionSearching": true
6
+ }
7
7
  }