@atlaskit/editor-plugin-highlight 2.3.1 → 2.5.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,25 @@
1
1
  # @atlaskit/editor-plugin-highlight
2
2
 
3
+ ## 2.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#140315](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/140315)
8
+ [`e9258b34b7063`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e9258b34b7063) -
9
+ MODES-6284 Add CMD+OPT+Y as yellow text highlight shortcut
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 2.4.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#144636](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/144636)
20
+ [`b13ed93531996`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b13ed93531996) -
21
+ Clean-up unused text highlight floating toolbar configuration
22
+
3
23
  ## 2.3.1
4
24
 
5
25
  ### Patch Changes
@@ -76,7 +76,7 @@ var highlightPlugin = exports.highlightPlugin = function highlightPlugin(_ref) {
76
76
  pluginsOptions: {
77
77
  selectionToolbar: function selectionToolbar() {
78
78
  var _api$selectionToolbar;
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', {
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) === 'none' && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
80
80
  exposure: true
81
81
  })) {
82
82
  var toolbarCustom = {
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.keymapPlugin = keymapPlugin;
7
7
  var _analytics = require("@atlaskit/editor-common/analytics");
8
8
  var _keymaps = require("@atlaskit/editor-common/keymaps");
9
+ var _preset = require("@atlaskit/editor-common/preset");
10
+ var _uiColor = require("@atlaskit/editor-common/ui-color");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _changeColor = require("../editor-commands/change-color");
9
13
  var _palette = require("../editor-commands/palette");
10
14
  function keymapPlugin(_ref) {
11
15
  var api = _ref.api;
@@ -19,5 +23,23 @@ function keymapPlugin(_ref) {
19
23
  (0, _palette.togglePalette)(api)({
20
24
  inputMethod: _analytics.INPUT_METHOD.SHORTCUT
21
25
  }), list);
26
+ if ((0, _platformFeatureFlags.fg)('platform_editor_yellow_text_highlight_shortcut')) {
27
+ var _api$analytics;
28
+ var analyticsApi = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
29
+ // NOTE: This will work with fallback until we clean up `editor_text_highlight_orange_to_yellow`
30
+ var color = _uiColor.highlightColorPalette.find(function (_ref2) {
31
+ var label = _ref2.label;
32
+ return label === 'Yellow';
33
+ }) || {
34
+ value: '#fedec8'
35
+ };
36
+ (0, _keymaps.bindKeymapWithCommand)(
37
+ // Ignored via go/ees005
38
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
39
+ _keymaps.applyYellowHighlight.common, (0, _preset.editorCommandToPMCommand)((0, _changeColor.changeColor)(analyticsApi)({
40
+ color: color.value,
41
+ inputMethod: _analytics.INPUT_METHOD.SHORTCUT
42
+ })), list);
43
+ }
22
44
  return (0, _keymaps.keymap)(list);
23
45
  }
@@ -65,7 +65,7 @@ export const highlightPlugin = ({
65
65
  pluginsOptions: {
66
66
  selectionToolbar() {
67
67
  var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
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', {
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) === 'none' && editorExperiment('platform_editor_controls', 'variant1', {
69
69
  exposure: true
70
70
  })) {
71
71
  const toolbarCustom = {
@@ -1,5 +1,9 @@
1
1
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import { bindKeymapWithCommand, keymap, toggleHighlightPalette } from '@atlaskit/editor-common/keymaps';
2
+ import { bindKeymapWithCommand, keymap, toggleHighlightPalette, applyYellowHighlight } from '@atlaskit/editor-common/keymaps';
3
+ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
4
+ import { highlightColorPalette } from '@atlaskit/editor-common/ui-color';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { changeColor } from '../editor-commands/change-color';
3
7
  import { togglePalette } from '../editor-commands/palette';
4
8
  export function keymapPlugin({
5
9
  api
@@ -14,5 +18,22 @@ export function keymapPlugin({
14
18
  togglePalette(api)({
15
19
  inputMethod: INPUT_METHOD.SHORTCUT
16
20
  }), list);
21
+ if (fg('platform_editor_yellow_text_highlight_shortcut')) {
22
+ var _api$analytics;
23
+ const analyticsApi = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
24
+ // NOTE: This will work with fallback until we clean up `editor_text_highlight_orange_to_yellow`
25
+ const color = highlightColorPalette.find(({
26
+ label
27
+ }) => label === 'Yellow') || {
28
+ value: '#fedec8'
29
+ };
30
+ bindKeymapWithCommand(
31
+ // Ignored via go/ees005
32
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
33
+ applyYellowHighlight.common, editorCommandToPMCommand(changeColor(analyticsApi)({
34
+ color: color.value,
35
+ inputMethod: INPUT_METHOD.SHORTCUT
36
+ })), list);
37
+ }
17
38
  return keymap(list);
18
39
  }
@@ -69,7 +69,7 @@ export var highlightPlugin = function highlightPlugin(_ref) {
69
69
  pluginsOptions: {
70
70
  selectionToolbar: function selectionToolbar() {
71
71
  var _api$selectionToolbar;
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', {
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) === 'none' && editorExperiment('platform_editor_controls', 'variant1', {
73
73
  exposure: true
74
74
  })) {
75
75
  var toolbarCustom = {
@@ -1,5 +1,9 @@
1
1
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import { bindKeymapWithCommand, keymap, toggleHighlightPalette } from '@atlaskit/editor-common/keymaps';
2
+ import { bindKeymapWithCommand, keymap, toggleHighlightPalette, applyYellowHighlight } from '@atlaskit/editor-common/keymaps';
3
+ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
4
+ import { highlightColorPalette } from '@atlaskit/editor-common/ui-color';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { changeColor } from '../editor-commands/change-color';
3
7
  import { togglePalette } from '../editor-commands/palette';
4
8
  export function keymapPlugin(_ref) {
5
9
  var api = _ref.api;
@@ -13,5 +17,23 @@ export function keymapPlugin(_ref) {
13
17
  togglePalette(api)({
14
18
  inputMethod: INPUT_METHOD.SHORTCUT
15
19
  }), list);
20
+ if (fg('platform_editor_yellow_text_highlight_shortcut')) {
21
+ var _api$analytics;
22
+ var analyticsApi = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
23
+ // NOTE: This will work with fallback until we clean up `editor_text_highlight_orange_to_yellow`
24
+ var color = highlightColorPalette.find(function (_ref2) {
25
+ var label = _ref2.label;
26
+ return label === 'Yellow';
27
+ }) || {
28
+ value: '#fedec8'
29
+ };
30
+ bindKeymapWithCommand(
31
+ // Ignored via go/ees005
32
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
33
+ applyYellowHighlight.common, editorCommandToPMCommand(changeColor(analyticsApi)({
34
+ color: color.value,
35
+ inputMethod: INPUT_METHOD.SHORTCUT
36
+ })), list);
37
+ }
16
38
  return keymap(list);
17
39
  }
@@ -5,11 +5,7 @@ import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolb
5
5
  import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
6
6
  import type { TextFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
7
7
  import type { HighlightPluginState } from './pm-plugins/main';
8
- export type HighlightPluginOptions = {
9
- textHighlightingFloatingToolbarExperiment?: boolean;
10
- };
11
8
  export type HighlightPlugin = NextEditorPlugin<'highlight', {
12
- pluginConfiguration?: HighlightPluginOptions;
13
9
  dependencies: [
14
10
  OptionalPlugin<AnalyticsPlugin>,
15
11
  OptionalPlugin<TextFormattingPlugin>,
@@ -1,3 +1,3 @@
1
1
  export { highlightPlugin } from './highlightPlugin';
2
- export type { HighlightPlugin, HighlightPluginOptions } from './highlightPluginType';
2
+ export type { HighlightPlugin } from './highlightPluginType';
3
3
  export type { HighlightPluginState } from './pm-plugins/main';
@@ -5,11 +5,7 @@ import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolb
5
5
  import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
6
6
  import type { TextFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
7
7
  import type { HighlightPluginState } from './pm-plugins/main';
8
- export type HighlightPluginOptions = {
9
- textHighlightingFloatingToolbarExperiment?: boolean;
10
- };
11
8
  export type HighlightPlugin = NextEditorPlugin<'highlight', {
12
- pluginConfiguration?: HighlightPluginOptions;
13
9
  dependencies: [
14
10
  OptionalPlugin<AnalyticsPlugin>,
15
11
  OptionalPlugin<TextFormattingPlugin>,
@@ -1,3 +1,3 @@
1
1
  export { highlightPlugin } from './highlightPlugin';
2
- export type { HighlightPlugin, HighlightPluginOptions } from './highlightPluginType';
2
+ export type { HighlightPlugin } from './highlightPluginType';
3
3
  export type { HighlightPluginState } from './pm-plugins/main';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-highlight",
3
- "version": "2.3.1",
3
+ "version": "2.5.0",
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": "^103.12.0",
40
+ "@atlaskit/editor-common": "^103.23.0",
41
41
  "@atlaskit/editor-palette": "^2.1.0",
42
42
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
43
43
  "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
@@ -48,8 +48,8 @@
48
48
  "@atlaskit/editor-tables": "^2.9.0",
49
49
  "@atlaskit/icon": "^25.6.0",
50
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
51
- "@atlaskit/primitives": "^14.4.0",
52
- "@atlaskit/tmp-editor-statsig": "^4.12.0",
51
+ "@atlaskit/primitives": "^14.7.0",
52
+ "@atlaskit/tmp-editor-statsig": "^4.15.0",
53
53
  "@atlaskit/tokens": "^4.8.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1"
@@ -110,6 +110,9 @@
110
110
  "type": "boolean",
111
111
  "referenceOnly": "true"
112
112
  },
113
+ "platform_editor_yellow_text_highlight_shortcut": {
114
+ "type": "boolean"
115
+ },
113
116
  "platform-visual-refresh-icons": {
114
117
  "type": "boolean"
115
118
  }