@atlaskit/editor-plugin-selection-toolbar 7.0.14 → 7.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,24 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 7.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`301c7dd0ccdd2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/301c7dd0ccdd2) -
8
+ Adds new `contextualFormattingEnabled` plugin option to editor-plugin-toolbar. This has 3 options
9
+ (always-inline, always-pinned and controlled) to allow direct control over toolbar placement in
10
+ the editor.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 7.0.15
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 7.0.14
4
23
 
5
24
  ### Patch Changes
@@ -46,8 +46,19 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
46
46
  var userPreferencesProvider = config.userPreferencesProvider,
47
47
  contextualFormattingEnabled = config.contextualFormattingEnabled;
48
48
  if (isToolbarAIFCEnabled) {
49
- var _api$toolbar;
50
- api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api, contextualFormattingEnabled));
49
+ if ((0, _platformFeatureFlags.fg)('platform_editor_toolbar_aifc_placement_config')) {
50
+ var _api$toolbar;
51
+ /**
52
+ * If toolbar is set to always-pinned or always-inline, there is no control over toolbar placement
53
+ */
54
+ if ((api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) === 'controlled') {
55
+ var _api$toolbar2;
56
+ api === null || api === void 0 || (_api$toolbar2 = api.toolbar) === null || _api$toolbar2 === void 0 || _api$toolbar2.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api, true));
57
+ }
58
+ } else {
59
+ var _api$toolbar3;
60
+ api === null || api === void 0 || (_api$toolbar3 = api.toolbar) === null || _api$toolbar3 === void 0 || _api$toolbar3.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(api, contextualFormattingEnabled));
61
+ }
51
62
  } else {
52
63
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
53
64
  exposure: true
@@ -38,8 +38,19 @@ export const selectionToolbarPlugin = ({
38
38
  contextualFormattingEnabled
39
39
  } = config;
40
40
  if (isToolbarAIFCEnabled) {
41
- var _api$toolbar;
42
- api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.registerComponents(getToolbarComponents(api, contextualFormattingEnabled));
41
+ if (fg('platform_editor_toolbar_aifc_placement_config')) {
42
+ var _api$toolbar;
43
+ /**
44
+ * If toolbar is set to always-pinned or always-inline, there is no control over toolbar placement
45
+ */
46
+ if ((api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) === 'controlled') {
47
+ var _api$toolbar2;
48
+ api === null || api === void 0 ? void 0 : (_api$toolbar2 = api.toolbar) === null || _api$toolbar2 === void 0 ? void 0 : _api$toolbar2.actions.registerComponents(getToolbarComponents(api, true));
49
+ }
50
+ } else {
51
+ var _api$toolbar3;
52
+ api === null || api === void 0 ? void 0 : (_api$toolbar3 = api.toolbar) === null || _api$toolbar3 === void 0 ? void 0 : _api$toolbar3.actions.registerComponents(getToolbarComponents(api, contextualFormattingEnabled));
53
+ }
43
54
  } else {
44
55
  if (editorExperiment('platform_editor_controls', 'variant1', {
45
56
  exposure: true
@@ -39,8 +39,19 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
39
39
  var userPreferencesProvider = config.userPreferencesProvider,
40
40
  contextualFormattingEnabled = config.contextualFormattingEnabled;
41
41
  if (isToolbarAIFCEnabled) {
42
- var _api$toolbar;
43
- api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents(api, contextualFormattingEnabled));
42
+ if (fg('platform_editor_toolbar_aifc_placement_config')) {
43
+ var _api$toolbar;
44
+ /**
45
+ * If toolbar is set to always-pinned or always-inline, there is no control over toolbar placement
46
+ */
47
+ if ((api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.contextualFormattingMode()) === 'controlled') {
48
+ var _api$toolbar2;
49
+ api === null || api === void 0 || (_api$toolbar2 = api.toolbar) === null || _api$toolbar2 === void 0 || _api$toolbar2.actions.registerComponents(getToolbarComponents(api, true));
50
+ }
51
+ } else {
52
+ var _api$toolbar3;
53
+ api === null || api === void 0 || (_api$toolbar3 = api.toolbar) === null || _api$toolbar3 === void 0 || _api$toolbar3.actions.registerComponents(getToolbarComponents(api, contextualFormattingEnabled));
54
+ }
44
55
  } else {
45
56
  if (editorExperiment('platform_editor_controls', 'variant1', {
46
57
  exposure: true
@@ -9,6 +9,12 @@ import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
9
9
  import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
10
10
  import type { ToolbarDocking } from './types';
11
11
  export type SelectionToolbarPluginOptions = {
12
+ /**
13
+ * Whether to enable floating toolbar for text selection.
14
+ *
15
+ * Warning: This option will be deprecated in the future, and instead will rely on options passed to `toolbarPlugin` which
16
+ * allows more control over toolbar placement.
17
+ */
12
18
  contextualFormattingEnabled?: boolean;
13
19
  /** @defaults false */
14
20
  preferenceToolbarAboveSelection?: boolean;
@@ -9,6 +9,12 @@ import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
9
9
  import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
10
10
  import type { ToolbarDocking } from './types';
11
11
  export type SelectionToolbarPluginOptions = {
12
+ /**
13
+ * Whether to enable floating toolbar for text selection.
14
+ *
15
+ * Warning: This option will be deprecated in the future, and instead will rely on options passed to `toolbarPlugin` which
16
+ * allows more control over toolbar placement.
17
+ */
12
18
  contextualFormattingEnabled?: boolean;
13
19
  /** @defaults false */
14
20
  preferenceToolbarAboveSelection?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "7.0.14",
3
+ "version": "7.1.0",
4
4
  "description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,28 +31,28 @@
31
31
  "dependencies": {
32
32
  "@atlaskit/css": "^0.15.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
34
- "@atlaskit/editor-plugin-block-controls": "^7.3.0",
34
+ "@atlaskit/editor-plugin-block-controls": "^7.4.0",
35
35
  "@atlaskit/editor-plugin-connectivity": "^6.0.0",
36
36
  "@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
37
37
  "@atlaskit/editor-plugin-primary-toolbar": "^7.0.0",
38
- "@atlaskit/editor-plugin-toolbar": "^3.3.0",
38
+ "@atlaskit/editor-plugin-toolbar": "^3.4.0",
39
39
  "@atlaskit/editor-plugin-user-intent": "^4.0.0",
40
40
  "@atlaskit/editor-plugin-user-preferences": "^4.0.0",
41
41
  "@atlaskit/editor-prosemirror": "7.0.0",
42
- "@atlaskit/editor-toolbar": "^0.15.0",
42
+ "@atlaskit/editor-toolbar": "^0.16.0",
43
43
  "@atlaskit/editor-toolbar-model": "^0.2.0",
44
44
  "@atlaskit/icon": "^28.5.0",
45
45
  "@atlaskit/icon-lab": "^5.10.0",
46
46
  "@atlaskit/menu": "^8.4.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
48
  "@atlaskit/platform-feature-flags-react": "^0.3.0",
49
- "@atlaskit/tmp-editor-statsig": "^13.15.0",
49
+ "@atlaskit/tmp-editor-statsig": "^13.18.0",
50
50
  "@atlaskit/tokens": "^7.0.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "bind-event-listener": "^3.0.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@atlaskit/editor-common": "^110.15.0",
55
+ "@atlaskit/editor-common": "^110.18.0",
56
56
  "react": "^18.2.0",
57
57
  "react-dom": "^18.2.0",
58
58
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -113,6 +113,9 @@
113
113
  },
114
114
  "platform_editor_migrate_toolbar_docking": {
115
115
  "type": "boolean"
116
+ },
117
+ "platform_editor_toolbar_aifc_placement_config": {
118
+ "type": "boolean"
116
119
  }
117
120
  }
118
121
  }