@atlaskit/editor-plugin-text-color 12.3.4 → 12.3.6

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,20 @@
1
1
  # @atlaskit/editor-plugin-text-color
2
2
 
3
+ ## 12.3.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`294e8295a274f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/294e8295a274f) -
8
+ [ux] [EDITOR-7863] Keep the color menu open when clicking inside the palette.
9
+
10
+ ## 12.3.5
11
+
12
+ ### Patch Changes
13
+
14
+ - [`283c55290e6cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/283c55290e6cc) -
15
+ Preserve visual selection after applying text color or highlight
16
+ - Updated dependencies
17
+
3
18
  ## 12.3.4
4
19
 
5
20
  ### Patch Changes
@@ -5,9 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.changeColor = void 0;
7
7
  var _analytics = require("@atlaskit/editor-common/analytics");
8
+ var _selection = require("@atlaskit/editor-common/selection");
9
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
10
  var _color = require("../pm-plugins/utils/color");
9
11
  var _removeColor = require("./remove-color");
10
12
  var _toggleColor = require("./toggle-color");
13
+ var maybeSyncSelectionAfterFormat = function maybeSyncSelectionAfterFormat(tr) {
14
+ if (tr.docChanged && (0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
15
+ tr.setMeta(_selection.FORMAT_SELECTION_SYNC_META, true);
16
+ }
17
+ };
18
+
11
19
  /**
12
20
  * Helper to create an analytics payload
13
21
  * @param newColor - Color to be change in hex code
@@ -58,12 +66,14 @@ var changeColor = exports.changeColor = function changeColor(color, api, inputMe
58
66
  (0, _removeColor.removeColor)({
59
67
  tr: tr
60
68
  });
69
+ maybeSyncSelectionAfterFormat(tr);
61
70
  return tr;
62
71
  }
63
72
  api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent(colorAnalyticsPayload)(tr);
64
73
  (0, _toggleColor.toggleColor)(color)({
65
74
  tr: tr
66
75
  });
76
+ maybeSyncSelectionAfterFormat(tr);
67
77
  return tr;
68
78
  };
69
79
  };
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.removeColor = void 0;
7
7
  var _mark = require("@atlaskit/editor-common/mark");
8
+ var _selection = require("@atlaskit/editor-common/selection");
9
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
10
  var _main = require("../main");
9
11
  var removeColor = exports.removeColor = function removeColor() {
10
12
  return function (state, dispatch) {
@@ -15,6 +17,9 @@ var removeColor = exports.removeColor = function removeColor() {
15
17
  tr: tr
16
18
  });
17
19
  if (dispatch) {
20
+ if (tr.docChanged && (0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
21
+ tr.setMeta(_selection.FORMAT_SELECTION_SYNC_META, true);
22
+ }
18
23
  dispatch(tr.setMeta(_main.pluginKey, {
19
24
  action: _main.ACTIONS.RESET_COLOR
20
25
  }));
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toggleColor = void 0;
7
7
  var _mark = require("@atlaskit/editor-common/mark");
8
+ var _selection = require("@atlaskit/editor-common/selection");
8
9
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
9
10
  var _main = require("../main");
10
11
  var _constants = require("../utils/constants");
@@ -38,6 +39,9 @@ var toggleColor = exports.toggleColor = function toggleColor(color) {
38
39
  })({
39
40
  tr: tr
40
41
  });
42
+ if (tr.docChanged && (0, _expValEquals.expValEquals)('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
43
+ tr.setMeta(_selection.FORMAT_SELECTION_SYNC_META, true);
44
+ }
41
45
  dispatch(tr);
42
46
  }
43
47
  return true;
@@ -11,7 +11,9 @@ var _runtime = require("@compiled/react/runtime");
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _toolbar = require("@atlaskit/editor-common/toolbar");
13
13
  var _editorToolbar = require("@atlaskit/editor-toolbar");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _compiled = require("@atlaskit/primitives/compiled");
16
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
17
  var styles = {
16
18
  menu: "_1rjcv77o _18zru2gc"
17
19
  };
@@ -21,9 +23,15 @@ var TextMenuSection = exports.TextMenuSection = function TextMenuSection(_ref) {
21
23
  var hasSeparator = parents.some(function (parent) {
22
24
  return parent.key === _toolbar.TEXT_COLLAPSED_MENU.key;
23
25
  });
26
+ var onMouseDown = function onMouseDown(event) {
27
+ if ((0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_lovability_text_bg_color_patch_1')) {
28
+ event.stopPropagation();
29
+ }
30
+ };
24
31
  return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
25
32
  hasSeparator: hasSeparator
26
33
  }, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
27
- xcss: styles.menu
34
+ xcss: styles.menu,
35
+ onMouseDown: onMouseDown
28
36
  }, children));
29
37
  };
@@ -1,7 +1,14 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
+ import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
4
  import { getActiveColorNew } from '../pm-plugins/utils/color';
3
5
  import { removeColor } from './remove-color';
4
6
  import { toggleColor } from './toggle-color';
7
+ const maybeSyncSelectionAfterFormat = tr => {
8
+ if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
9
+ tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
10
+ }
11
+ };
5
12
 
6
13
  /**
7
14
  * Helper to create an analytics payload
@@ -53,11 +60,13 @@ export const changeColor = (color, api, inputMethod) => ({
53
60
  removeColor({
54
61
  tr
55
62
  });
63
+ maybeSyncSelectionAfterFormat(tr);
56
64
  return tr;
57
65
  }
58
66
  api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent(colorAnalyticsPayload)(tr);
59
67
  toggleColor(color)({
60
68
  tr
61
69
  });
70
+ maybeSyncSelectionAfterFormat(tr);
62
71
  return tr;
63
72
  };
@@ -1,4 +1,6 @@
1
1
  import { removeMark } from '@atlaskit/editor-common/mark';
2
+ import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
4
  import { ACTIONS, pluginKey } from '../main';
3
5
  export const removeColor = () => (state, dispatch) => {
4
6
  const {
@@ -12,6 +14,9 @@ export const removeColor = () => (state, dispatch) => {
12
14
  tr
13
15
  });
14
16
  if (dispatch) {
17
+ if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
18
+ tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
19
+ }
15
20
  dispatch(tr.setMeta(pluginKey, {
16
21
  action: ACTIONS.RESET_COLOR
17
22
  }));
@@ -1,4 +1,5 @@
1
1
  import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
2
+ import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
2
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { ACTIONS, pluginKey } from '../main';
4
5
  import { overrideMarks } from '../utils/constants';
@@ -35,6 +36,9 @@ export const toggleColor = color => (state, dispatch) => {
35
36
  })({
36
37
  tr
37
38
  });
39
+ if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
40
+ tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
41
+ }
38
42
  dispatch(tr);
39
43
  }
40
44
  return true;
@@ -4,7 +4,9 @@ import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
5
  import { TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
6
6
  import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { Box } from '@atlaskit/primitives/compiled';
9
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
10
  const styles = {
9
11
  menu: "_1rjcv77o _18zru2gc"
10
12
  };
@@ -13,9 +15,15 @@ export const TextMenuSection = ({
13
15
  parents
14
16
  }) => {
15
17
  const hasSeparator = parents.some(parent => parent.key === TEXT_COLLAPSED_MENU.key);
18
+ const onMouseDown = event => {
19
+ if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && fg('platform_editor_lovability_text_bg_color_patch_1')) {
20
+ event.stopPropagation();
21
+ }
22
+ };
16
23
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
17
24
  hasSeparator: hasSeparator
18
25
  }, /*#__PURE__*/React.createElement(Box, {
19
- xcss: styles.menu
26
+ xcss: styles.menu,
27
+ onMouseDown: onMouseDown
20
28
  }, children));
21
29
  };
@@ -1,7 +1,14 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
+ import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
4
  import { getActiveColorNew } from '../pm-plugins/utils/color';
3
5
  import { removeColor } from './remove-color';
4
6
  import { toggleColor } from './toggle-color';
7
+ var maybeSyncSelectionAfterFormat = function maybeSyncSelectionAfterFormat(tr) {
8
+ if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
9
+ tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
10
+ }
11
+ };
5
12
 
6
13
  /**
7
14
  * Helper to create an analytics payload
@@ -53,12 +60,14 @@ export var changeColor = function changeColor(color, api, inputMethod) {
53
60
  removeColor({
54
61
  tr: tr
55
62
  });
63
+ maybeSyncSelectionAfterFormat(tr);
56
64
  return tr;
57
65
  }
58
66
  api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent(colorAnalyticsPayload)(tr);
59
67
  toggleColor(color)({
60
68
  tr: tr
61
69
  });
70
+ maybeSyncSelectionAfterFormat(tr);
62
71
  return tr;
63
72
  };
64
73
  };
@@ -1,4 +1,6 @@
1
1
  import { removeMark } from '@atlaskit/editor-common/mark';
2
+ import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
4
  import { ACTIONS, pluginKey } from '../main';
3
5
  export var removeColor = function removeColor() {
4
6
  return function (state, dispatch) {
@@ -9,6 +11,9 @@ export var removeColor = function removeColor() {
9
11
  tr: tr
10
12
  });
11
13
  if (dispatch) {
14
+ if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
15
+ tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
16
+ }
12
17
  dispatch(tr.setMeta(pluginKey, {
13
18
  action: ACTIONS.RESET_COLOR
14
19
  }));
@@ -1,4 +1,5 @@
1
1
  import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
2
+ import { FORMAT_SELECTION_SYNC_META } from '@atlaskit/editor-common/selection';
2
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
3
4
  import { ACTIONS, pluginKey } from '../main';
4
5
  import { overrideMarks } from '../utils/constants';
@@ -32,6 +33,9 @@ export var toggleColor = function toggleColor(color) {
32
33
  })({
33
34
  tr: tr
34
35
  });
36
+ if (tr.docChanged && expValEquals('platform_editor_fix_selection_text_color_change', 'isEnabled', true)) {
37
+ tr.setMeta(FORMAT_SELECTION_SYNC_META, true);
38
+ }
35
39
  dispatch(tr);
36
40
  }
37
41
  return true;
@@ -4,7 +4,9 @@ import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
5
  import { TEXT_COLLAPSED_MENU } from '@atlaskit/editor-common/toolbar';
6
6
  import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { Box } from '@atlaskit/primitives/compiled';
9
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
10
  var styles = {
9
11
  menu: "_1rjcv77o _18zru2gc"
10
12
  };
@@ -14,9 +16,15 @@ export var TextMenuSection = function TextMenuSection(_ref) {
14
16
  var hasSeparator = parents.some(function (parent) {
15
17
  return parent.key === TEXT_COLLAPSED_MENU.key;
16
18
  });
19
+ var onMouseDown = function onMouseDown(event) {
20
+ if (expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && fg('platform_editor_lovability_text_bg_color_patch_1')) {
21
+ event.stopPropagation();
22
+ }
23
+ };
17
24
  return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
18
25
  hasSeparator: hasSeparator
19
26
  }, /*#__PURE__*/React.createElement(Box, {
20
- xcss: styles.menu
27
+ xcss: styles.menu,
28
+ onMouseDown: onMouseDown
21
29
  }, children));
22
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-text-color",
3
- "version": "12.3.4",
3
+ "version": "12.3.6",
4
4
  "description": "Text color plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -22,7 +22,7 @@
22
22
  "atlaskit:src": "src/index.ts",
23
23
  "dependencies": {
24
24
  "@atlaskit/adf-schema": "^56.0.0",
25
- "@atlaskit/button": "^24.1.0",
25
+ "@atlaskit/button": "^24.3.0",
26
26
  "@atlaskit/css": "^1.0.0",
27
27
  "@atlaskit/editor-palette": "^3.1.0",
28
28
  "@atlaskit/editor-plugin-analytics": "^12.0.0",
@@ -33,21 +33,21 @@
33
33
  "@atlaskit/editor-plugin-toolbar": "^9.0.0",
34
34
  "@atlaskit/editor-prosemirror": "^8.0.0",
35
35
  "@atlaskit/editor-shared-styles": "^4.0.0",
36
- "@atlaskit/editor-toolbar": "^2.0.0",
37
- "@atlaskit/editor-toolbar-model": "^1.0.0",
38
- "@atlaskit/heading": "^6.0.0",
39
- "@atlaskit/icon": "^36.0.0",
40
- "@atlaskit/icon-lab": "^7.1.0",
36
+ "@atlaskit/editor-toolbar": "^2.1.0",
37
+ "@atlaskit/editor-toolbar-model": "^1.1.0",
38
+ "@atlaskit/heading": "^6.1.0",
39
+ "@atlaskit/icon": "^36.1.0",
40
+ "@atlaskit/icon-lab": "^7.2.0",
41
41
  "@atlaskit/platform-feature-flags": "^2.0.0",
42
- "@atlaskit/platform-feature-flags-react": "^1.0.0",
43
- "@atlaskit/primitives": "^20.0.0",
44
- "@atlaskit/tmp-editor-statsig": "^114.0.0",
45
- "@atlaskit/tokens": "^15.0.0",
42
+ "@atlaskit/platform-feature-flags-react": "^1.1.0",
43
+ "@atlaskit/primitives": "^20.2.0",
44
+ "@atlaskit/tmp-editor-statsig": "^114.6.0",
45
+ "@atlaskit/tokens": "^15.2.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1"
48
48
  },
49
49
  "peerDependencies": {
50
- "@atlaskit/editor-common": "^116.14.0",
50
+ "@atlaskit/editor-common": "^116.17.0",
51
51
  "react": "^18.2.0",
52
52
  "react-dom": "^18.2.0",
53
53
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"