@atlaskit/editor-plugin-highlight 2.1.3 → 2.1.4

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,14 @@
1
1
  # @atlaskit/editor-plugin-highlight
2
2
 
3
+ ## 2.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#126126](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/126126)
8
+ [`468f52001a847`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/468f52001a847) -
9
+ Tidy up contextual formatting toolbar experiment and switch to `platform_editor_controls` flag
10
+ - Updated dependencies
11
+
3
12
  ## 2.1.3
4
13
 
5
14
  ### Patch Changes
@@ -76,35 +76,29 @@ var highlightPlugin = exports.highlightPlugin = function highlightPlugin(_ref) {
76
76
  pluginsOptions: {
77
77
  selectionToolbar: function selectionToolbar() {
78
78
  var _api$selectionToolbar;
79
- if ((api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
79
+ if (options !== null && options !== void 0 && options.textHighlightingFloatingToolbarExperiment || (api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'none' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
80
80
  exposure: true
81
81
  })) {
82
+ var toolbarCustom = {
83
+ type: 'custom',
84
+ render: function render(_view, _idx, dispatchAnalyticsEvent) {
85
+ return /*#__PURE__*/_react.default.createElement(_FloatingToolbarHighlightColor.FloatingToolbarHighlightColorWithIntl, {
86
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
87
+ pluginInjectionApi: api
88
+ });
89
+ },
90
+ fallback: []
91
+ };
92
+ var rank = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? 5 : -9;
93
+ return {
94
+ rank: rank,
95
+ isToolbarAbove: true,
96
+ items: [toolbarCustom],
97
+ pluginName: 'highlight'
98
+ };
99
+ } else {
82
100
  return undefined;
83
101
  }
84
- if (!(options !== null && options !== void 0 && options.textHighlightingFloatingToolbarExperiment) && (0, _experiments.editorExperiment)('contextual_formatting_toolbar', false, {
85
- exposure: true
86
- }) && (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'control', {
87
- exposure: true
88
- })) {
89
- return;
90
- }
91
- var toolbarCustom = {
92
- type: 'custom',
93
- render: function render(_view, _idx, dispatchAnalyticsEvent) {
94
- return /*#__PURE__*/_react.default.createElement(_FloatingToolbarHighlightColor.FloatingToolbarHighlightColorWithIntl, {
95
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
96
- pluginInjectionApi: api
97
- });
98
- },
99
- fallback: []
100
- };
101
- var rank = (0, _experiments.editorExperiment)('contextual_formatting_toolbar', true) || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant1') || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant2') ? 5 : -9;
102
- return {
103
- rank: rank,
104
- isToolbarAbove: true,
105
- items: [toolbarCustom],
106
- pluginName: 'highlight'
107
- };
108
102
  }
109
103
  },
110
104
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
@@ -83,7 +83,7 @@ var FloatingToolbarHighlightColor = function FloatingToolbarHighlightColor(_ref)
83
83
  // Get the design token for the active color (if it exists) to modify the toolbar
84
84
  // icon, but show the nice rainbow if none is selected
85
85
  var activeColorToken = highlightState.activeColor === null ? null : (0, _editorPalette.hexToEditorTextBackgroundPaletteColor)(highlightState.activeColor);
86
- var title = (0, _experiments.editorExperiment)('contextual_formatting_toolbar', true) || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant1') || (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'variant2') ? (0, _keymaps.tooltip)(_keymaps.toggleHighlightPalette, toolbarButtonLabel) : toolbarButtonLabel;
86
+ var title = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? (0, _keymaps.tooltip)(_keymaps.toggleHighlightPalette, toolbarButtonLabel) : toolbarButtonLabel;
87
87
  return (0, _react2.jsx)(_PaletteDropdown.PaletteDropdown, {
88
88
  isOpen: isDropdownOpen && !highlightState.disabled,
89
89
  activeColor: highlightState.activeColor,
@@ -136,7 +136,7 @@ var FloatingToolbarHighlightColor = function FloatingToolbarHighlightColor(_ref)
136
136
  }, (0, _react2.jsx)(_chevronDown.default, {
137
137
  label: ""
138
138
  }))
139
- }, (0, _experiments.editorExperiment)('contextual_formatting_toolbar', false) && (0, _experiments.editorExperiment)('platform_editor_contextual_formatting_toolbar_v2', 'control') && formatMessage(_messages.highlightMessages.highlightFloatingToolbar)),
139
+ }, (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && formatMessage(_messages.highlightMessages.highlightFloatingToolbar)),
140
140
  onColorChange: function onColorChange(color) {
141
141
  return handleColorChange({
142
142
  color: color,
@@ -65,33 +65,27 @@ export const highlightPlugin = ({
65
65
  pluginsOptions: {
66
66
  selectionToolbar() {
67
67
  var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
68
- if ((api === null || api === void 0 ? void 0 : (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 ? void 0 : (_api$selectionToolbar2 = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar2 === void 0 ? void 0 : (_api$selectionToolbar3 = _api$selectionToolbar2.currentState()) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.toolbarDocking) === 'top' && editorExperiment('platform_editor_controls', 'variant1', {
68
+ if (options !== null && options !== void 0 && options.textHighlightingFloatingToolbarExperiment || (api === null || api === void 0 ? void 0 : (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 ? void 0 : (_api$selectionToolbar2 = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar2 === void 0 ? void 0 : (_api$selectionToolbar3 = _api$selectionToolbar2.currentState()) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.toolbarDocking) === 'none' && editorExperiment('platform_editor_controls', 'variant1', {
69
69
  exposure: true
70
70
  })) {
71
+ const toolbarCustom = {
72
+ type: 'custom',
73
+ render: (_view, _idx, dispatchAnalyticsEvent) => /*#__PURE__*/React.createElement(FloatingToolbarHighlightColor, {
74
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
75
+ pluginInjectionApi: api
76
+ }),
77
+ fallback: []
78
+ };
79
+ const rank = editorExperiment('platform_editor_controls', 'variant1') ? 5 : -9;
80
+ return {
81
+ rank,
82
+ isToolbarAbove: true,
83
+ items: [toolbarCustom],
84
+ pluginName: 'highlight'
85
+ };
86
+ } else {
71
87
  return undefined;
72
88
  }
73
- if (!(options !== null && options !== void 0 && options.textHighlightingFloatingToolbarExperiment) && editorExperiment('contextual_formatting_toolbar', false, {
74
- exposure: true
75
- }) && editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'control', {
76
- exposure: true
77
- })) {
78
- return;
79
- }
80
- const toolbarCustom = {
81
- type: 'custom',
82
- render: (_view, _idx, dispatchAnalyticsEvent) => /*#__PURE__*/React.createElement(FloatingToolbarHighlightColor, {
83
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
84
- pluginInjectionApi: api
85
- }),
86
- fallback: []
87
- };
88
- const rank = editorExperiment('contextual_formatting_toolbar', true) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1') || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2') ? 5 : -9;
89
- return {
90
- rank,
91
- isToolbarAbove: true,
92
- items: [toolbarCustom],
93
- pluginName: 'highlight'
94
- };
95
89
  }
96
90
  },
97
91
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
@@ -76,7 +76,7 @@ const FloatingToolbarHighlightColor = ({
76
76
  // Get the design token for the active color (if it exists) to modify the toolbar
77
77
  // icon, but show the nice rainbow if none is selected
78
78
  const activeColorToken = highlightState.activeColor === null ? null : hexToEditorTextBackgroundPaletteColor(highlightState.activeColor);
79
- const title = editorExperiment('contextual_formatting_toolbar', true) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1') || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2') ? tooltip(toggleHighlightPalette, toolbarButtonLabel) : toolbarButtonLabel;
79
+ const title = editorExperiment('platform_editor_controls', 'variant1') ? tooltip(toggleHighlightPalette, toolbarButtonLabel) : toolbarButtonLabel;
80
80
  return jsx(PaletteDropdown, {
81
81
  isOpen: isDropdownOpen && !highlightState.disabled,
82
82
  activeColor: highlightState.activeColor,
@@ -129,7 +129,7 @@ const FloatingToolbarHighlightColor = ({
129
129
  }, jsx(ExpandIcon, {
130
130
  label: ""
131
131
  }))
132
- }, editorExperiment('contextual_formatting_toolbar', false) && editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'control') && formatMessage(messages.highlightFloatingToolbar)),
132
+ }, editorExperiment('platform_editor_controls', 'control') && formatMessage(messages.highlightFloatingToolbar)),
133
133
  onColorChange: color => handleColorChange({
134
134
  color,
135
135
  inputMethod: INPUT_METHOD.FLOATING_TB
@@ -69,35 +69,29 @@ export var highlightPlugin = function highlightPlugin(_ref) {
69
69
  pluginsOptions: {
70
70
  selectionToolbar: function selectionToolbar() {
71
71
  var _api$selectionToolbar;
72
- if ((api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'top' && editorExperiment('platform_editor_controls', 'variant1', {
72
+ if (options !== null && options !== void 0 && options.textHighlightingFloatingToolbarExperiment || (api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.sharedState) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.currentState()) === null || _api$selectionToolbar === void 0 ? void 0 : _api$selectionToolbar.toolbarDocking) === 'none' && editorExperiment('platform_editor_controls', 'variant1', {
73
73
  exposure: true
74
74
  })) {
75
+ var toolbarCustom = {
76
+ type: 'custom',
77
+ render: function render(_view, _idx, dispatchAnalyticsEvent) {
78
+ return /*#__PURE__*/React.createElement(FloatingToolbarHighlightColor, {
79
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
80
+ pluginInjectionApi: api
81
+ });
82
+ },
83
+ fallback: []
84
+ };
85
+ var rank = editorExperiment('platform_editor_controls', 'variant1') ? 5 : -9;
86
+ return {
87
+ rank: rank,
88
+ isToolbarAbove: true,
89
+ items: [toolbarCustom],
90
+ pluginName: 'highlight'
91
+ };
92
+ } else {
75
93
  return undefined;
76
94
  }
77
- if (!(options !== null && options !== void 0 && options.textHighlightingFloatingToolbarExperiment) && editorExperiment('contextual_formatting_toolbar', false, {
78
- exposure: true
79
- }) && editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'control', {
80
- exposure: true
81
- })) {
82
- return;
83
- }
84
- var toolbarCustom = {
85
- type: 'custom',
86
- render: function render(_view, _idx, dispatchAnalyticsEvent) {
87
- return /*#__PURE__*/React.createElement(FloatingToolbarHighlightColor, {
88
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
89
- pluginInjectionApi: api
90
- });
91
- },
92
- fallback: []
93
- };
94
- var rank = editorExperiment('contextual_formatting_toolbar', true) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1') || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2') ? 5 : -9;
95
- return {
96
- rank: rank,
97
- isToolbarAbove: true,
98
- items: [toolbarCustom],
99
- pluginName: 'highlight'
100
- };
101
95
  }
102
96
  },
103
97
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
@@ -75,7 +75,7 @@ var FloatingToolbarHighlightColor = function FloatingToolbarHighlightColor(_ref)
75
75
  // Get the design token for the active color (if it exists) to modify the toolbar
76
76
  // icon, but show the nice rainbow if none is selected
77
77
  var activeColorToken = highlightState.activeColor === null ? null : hexToEditorTextBackgroundPaletteColor(highlightState.activeColor);
78
- var title = editorExperiment('contextual_formatting_toolbar', true) || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant1') || editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'variant2') ? tooltip(toggleHighlightPalette, toolbarButtonLabel) : toolbarButtonLabel;
78
+ var title = editorExperiment('platform_editor_controls', 'variant1') ? tooltip(toggleHighlightPalette, toolbarButtonLabel) : toolbarButtonLabel;
79
79
  return jsx(PaletteDropdown, {
80
80
  isOpen: isDropdownOpen && !highlightState.disabled,
81
81
  activeColor: highlightState.activeColor,
@@ -128,7 +128,7 @@ var FloatingToolbarHighlightColor = function FloatingToolbarHighlightColor(_ref)
128
128
  }, jsx(ExpandIcon, {
129
129
  label: ""
130
130
  }))
131
- }, editorExperiment('contextual_formatting_toolbar', false) && editorExperiment('platform_editor_contextual_formatting_toolbar_v2', 'control') && formatMessage(messages.highlightFloatingToolbar)),
131
+ }, editorExperiment('platform_editor_controls', 'control') && formatMessage(messages.highlightFloatingToolbar)),
132
132
  onColorChange: function onColorChange(color) {
133
133
  return handleColorChange({
134
134
  color: color,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-highlight",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Highlight plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/adf-schema": "^47.6.0",
40
- "@atlaskit/editor-common": "^102.4.0",
40
+ "@atlaskit/editor-common": "^102.5.0",
41
41
  "@atlaskit/editor-palette": "^2.0.0",
42
42
  "@atlaskit/editor-plugin-analytics": "^2.1.0",
43
43
  "@atlaskit/editor-plugin-primary-toolbar": "^3.0.0",
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
51
51
  "@atlaskit/primitives": "^14.1.0",
52
52
  "@atlaskit/tmp-editor-statsig": "^3.6.0",
53
- "@atlaskit/tokens": "^4.4.0",
53
+ "@atlaskit/tokens": "^4.5.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1"
56
56
  },