@atlaskit/editor-plugin-highlight 3.0.1 → 3.0.3
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 +17 -0
- package/dist/cjs/ui/FloatingToolbarHighlightColor.js +8 -8
- package/dist/cjs/ui/PrimaryToolbarHighlightColor.js +8 -8
- package/dist/cjs/ui/shared/PaletteDropdown.js +9 -14
- package/dist/es2019/ui/FloatingToolbarHighlightColor.js +9 -9
- package/dist/es2019/ui/PrimaryToolbarHighlightColor.js +9 -9
- package/dist/es2019/ui/shared/PaletteDropdown.js +10 -15
- package/dist/esm/ui/FloatingToolbarHighlightColor.js +9 -9
- package/dist/esm/ui/PrimaryToolbarHighlightColor.js +9 -9
- package/dist/esm/ui/shared/PaletteDropdown.js +9 -14
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-highlight
|
|
2
2
|
|
|
3
|
+
## 3.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#184251](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/184251)
|
|
8
|
+
[`be8b910f66de1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be8b910f66de1) -
|
|
9
|
+
[ED-91152] Clean up experiment editor_text_highlight_orange_to_yellow
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.0.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#182839](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/182839)
|
|
17
|
+
[`81f1c3383bdab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/81f1c3383bdab) -
|
|
18
|
+
refactor: use useSharedPluginStateWithSelector instead of useSharedPluginStateSelector
|
|
19
|
+
|
|
3
20
|
## 3.0.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -16,7 +16,6 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
16
16
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
17
17
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
18
18
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
19
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
20
19
|
var _editorPalette = require("@atlaskit/editor-palette");
|
|
21
20
|
var _highlight = _interopRequireDefault(require("@atlaskit/icon/core/highlight"));
|
|
22
21
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-down"));
|
|
@@ -39,15 +38,16 @@ var expandIconContainerHighlightStyle = (0, _react2.css)({
|
|
|
39
38
|
var highlightIconContainerStyle = (0, _react2.css)({
|
|
40
39
|
marginTop: "var(--ds-space-negative-050, -4px)"
|
|
41
40
|
});
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var activeColor = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'highlight.activeColor');
|
|
45
|
-
var disabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'highlight.disabled');
|
|
41
|
+
var selector = function selector(states) {
|
|
42
|
+
var _states$highlightStat, _states$highlightStat2, _states$highlightStat3;
|
|
46
43
|
return {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
isPaletteOpen: (_states$highlightStat = states.highlightState) === null || _states$highlightStat === void 0 ? void 0 : _states$highlightStat.isPaletteOpen,
|
|
45
|
+
activeColor: (_states$highlightStat2 = states.highlightState) === null || _states$highlightStat2 === void 0 ? void 0 : _states$highlightStat2.activeColor,
|
|
46
|
+
disabled: (_states$highlightStat3 = states.highlightState) === null || _states$highlightStat3 === void 0 ? void 0 : _states$highlightStat3.disabled
|
|
50
47
|
};
|
|
48
|
+
};
|
|
49
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
50
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(api, ['highlight'], selector);
|
|
51
51
|
}, function (api) {
|
|
52
52
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['highlight']),
|
|
53
53
|
highlightState = _useSharedPluginState.highlightState;
|
|
@@ -15,7 +15,6 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
15
15
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
16
16
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
17
17
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
18
|
-
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
19
18
|
var _editorPalette = require("@atlaskit/editor-palette");
|
|
20
19
|
var _highlight = _interopRequireDefault(require("@atlaskit/icon/core/highlight"));
|
|
21
20
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-down"));
|
|
@@ -32,15 +31,16 @@ var _useDropdownEvents2 = require("./shared/useDropdownEvents");
|
|
|
32
31
|
|
|
33
32
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
34
33
|
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var highlightDisabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'highlight.disabled');
|
|
38
|
-
var activeColor = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'highlight.activeColor');
|
|
34
|
+
var selector = function selector(states) {
|
|
35
|
+
var _states$highlightStat, _states$highlightStat2, _states$highlightStat3;
|
|
39
36
|
return {
|
|
40
|
-
isPaletteOpen: isPaletteOpen,
|
|
41
|
-
highlightDisabled:
|
|
42
|
-
activeColor: activeColor
|
|
37
|
+
isPaletteOpen: (_states$highlightStat = states.highlightState) === null || _states$highlightStat === void 0 ? void 0 : _states$highlightStat.isPaletteOpen,
|
|
38
|
+
highlightDisabled: (_states$highlightStat2 = states.highlightState) === null || _states$highlightStat2 === void 0 ? void 0 : _states$highlightStat2.disabled,
|
|
39
|
+
activeColor: (_states$highlightStat3 = states.highlightState) === null || _states$highlightStat3 === void 0 ? void 0 : _states$highlightStat3.activeColor
|
|
43
40
|
};
|
|
41
|
+
};
|
|
42
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
43
|
+
return (0, _hooks.useSharedPluginStateWithSelector)(api, ['highlight'], selector);
|
|
44
44
|
}, function (api) {
|
|
45
45
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['highlight']),
|
|
46
46
|
highlightState = _useSharedPluginState.highlightState;
|
|
@@ -11,7 +11,6 @@ var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
|
11
11
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
12
12
|
var _editorPalette = require("@atlaskit/editor-palette");
|
|
13
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
16
|
var PaletteDropdown = exports.PaletteDropdown = function PaletteDropdown(props) {
|
|
@@ -30,19 +29,15 @@ var PaletteDropdown = exports.PaletteDropdown = function PaletteDropdown(props)
|
|
|
30
29
|
// this should reflect the width of the dropdown when fully populated with colors, including translations due to layering
|
|
31
30
|
var fitWidth = 242;
|
|
32
31
|
var colorPalette = _uiColor.highlightColorPalette;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
return item;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
32
|
+
colorPalette = _uiColor.highlightColorPalette.map(function (item) {
|
|
33
|
+
if (item.label === 'Orange') {
|
|
34
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
35
|
+
label: 'Yellow',
|
|
36
|
+
message: _uiColor.colorPaletteMessages.yellow
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return item;
|
|
40
|
+
});
|
|
46
41
|
var _getSelectedRowAndCol = (0, _uiColor.getSelectedRowAndColumnFromPalette)(colorPalette, activeColor),
|
|
47
42
|
selectedRowIndex = _getSelectedRowAndCol.selectedRowIndex,
|
|
48
43
|
selectedColumnIndex = _getSelectedRowAndCol.selectedColumnIndex;
|
|
@@ -8,13 +8,12 @@ import { useRef, useState } from 'react';
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { injectIntl } from 'react-intl-next';
|
|
10
10
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
11
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
11
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
12
12
|
import { DynamicStrokeIconDecoration } from '@atlaskit/editor-common/icons';
|
|
13
13
|
import { toggleHighlightPalette, tooltip, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
|
|
14
14
|
import { highlightMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { disableBlueBorderStyles, expandIconContainerStyle, triggerWrapperStylesWithPadding } from '@atlaskit/editor-common/styles';
|
|
16
16
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
17
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
18
17
|
import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
19
18
|
import HighlightIcon from '@atlaskit/icon/core/highlight';
|
|
20
19
|
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down';
|
|
@@ -30,15 +29,16 @@ const expandIconContainerHighlightStyle = css({
|
|
|
30
29
|
const highlightIconContainerStyle = css({
|
|
31
30
|
marginTop: "var(--ds-space-negative-050, -4px)"
|
|
32
31
|
});
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const activeColor = useSharedPluginStateSelector(api, 'highlight.activeColor');
|
|
36
|
-
const disabled = useSharedPluginStateSelector(api, 'highlight.disabled');
|
|
32
|
+
const selector = states => {
|
|
33
|
+
var _states$highlightStat, _states$highlightStat2, _states$highlightStat3;
|
|
37
34
|
return {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
isPaletteOpen: (_states$highlightStat = states.highlightState) === null || _states$highlightStat === void 0 ? void 0 : _states$highlightStat.isPaletteOpen,
|
|
36
|
+
activeColor: (_states$highlightStat2 = states.highlightState) === null || _states$highlightStat2 === void 0 ? void 0 : _states$highlightStat2.activeColor,
|
|
37
|
+
disabled: (_states$highlightStat3 = states.highlightState) === null || _states$highlightStat3 === void 0 ? void 0 : _states$highlightStat3.disabled
|
|
41
38
|
};
|
|
39
|
+
};
|
|
40
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
41
|
+
return useSharedPluginStateWithSelector(api, ['highlight'], selector);
|
|
42
42
|
}, api => {
|
|
43
43
|
const {
|
|
44
44
|
highlightState
|
|
@@ -8,13 +8,12 @@ import { useRef } from 'react';
|
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import { injectIntl } from 'react-intl-next';
|
|
10
10
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
11
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
11
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
12
12
|
import { DynamicStrokeIconDecoration } from '@atlaskit/editor-common/icons';
|
|
13
13
|
import { getAriaKeyshortcuts, toggleHighlightPalette, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
14
14
|
import { highlightMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { disableBlueBorderStyles, expandIconContainerStyle, expandIconWrapperStyle, triggerWrapperStylesWithPadding } from '@atlaskit/editor-common/styles';
|
|
16
16
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
17
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
18
17
|
import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
19
18
|
import HighlightIcon from '@atlaskit/icon/core/highlight';
|
|
20
19
|
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down';
|
|
@@ -24,15 +23,16 @@ import { setPalette } from '../editor-commands/palette';
|
|
|
24
23
|
import { EditorHighlightIcon } from './shared/EditorHighlightIcon';
|
|
25
24
|
import { PaletteDropdown } from './shared/PaletteDropdown';
|
|
26
25
|
import { useDropdownEvents } from './shared/useDropdownEvents';
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
const highlightDisabled = useSharedPluginStateSelector(api, 'highlight.disabled');
|
|
30
|
-
const activeColor = useSharedPluginStateSelector(api, 'highlight.activeColor');
|
|
26
|
+
const selector = states => {
|
|
27
|
+
var _states$highlightStat, _states$highlightStat2, _states$highlightStat3;
|
|
31
28
|
return {
|
|
32
|
-
isPaletteOpen,
|
|
33
|
-
highlightDisabled,
|
|
34
|
-
activeColor
|
|
29
|
+
isPaletteOpen: (_states$highlightStat = states.highlightState) === null || _states$highlightStat === void 0 ? void 0 : _states$highlightStat.isPaletteOpen,
|
|
30
|
+
highlightDisabled: (_states$highlightStat2 = states.highlightState) === null || _states$highlightStat2 === void 0 ? void 0 : _states$highlightStat2.disabled,
|
|
31
|
+
activeColor: (_states$highlightStat3 = states.highlightState) === null || _states$highlightStat3 === void 0 ? void 0 : _states$highlightStat3.activeColor
|
|
35
32
|
};
|
|
33
|
+
};
|
|
34
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
35
|
+
return useSharedPluginStateWithSelector(api, ['highlight'], selector);
|
|
36
36
|
}, api => {
|
|
37
37
|
const {
|
|
38
38
|
highlightState
|
|
@@ -3,7 +3,6 @@ import { ColorPalette, colorPaletteMessages, getSelectedRowAndColumnFromPalette,
|
|
|
3
3
|
import { ArrowKeyNavigationType, DropdownContainer as Dropdown } from '@atlaskit/editor-common/ui-menu';
|
|
4
4
|
import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
5
5
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
6
|
export const PaletteDropdown = props => {
|
|
8
7
|
const {
|
|
9
8
|
popupsMountPoint,
|
|
@@ -22,20 +21,16 @@ export const PaletteDropdown = props => {
|
|
|
22
21
|
// this should reflect the width of the dropdown when fully populated with colors, including translations due to layering
|
|
23
22
|
const fitWidth = 242;
|
|
24
23
|
let colorPalette = highlightColorPalette;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
return item;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
24
|
+
colorPalette = highlightColorPalette.map(item => {
|
|
25
|
+
if (item.label === 'Orange') {
|
|
26
|
+
return {
|
|
27
|
+
...item,
|
|
28
|
+
label: 'Yellow',
|
|
29
|
+
message: colorPaletteMessages.yellow
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return item;
|
|
33
|
+
});
|
|
39
34
|
const {
|
|
40
35
|
selectedRowIndex,
|
|
41
36
|
selectedColumnIndex
|
|
@@ -9,13 +9,12 @@ import { useRef, useState } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { injectIntl } from 'react-intl-next';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
12
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
12
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
13
13
|
import { DynamicStrokeIconDecoration } from '@atlaskit/editor-common/icons';
|
|
14
14
|
import { toggleHighlightPalette, tooltip, getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
|
|
15
15
|
import { highlightMessages as messages } from '@atlaskit/editor-common/messages';
|
|
16
16
|
import { disableBlueBorderStyles, expandIconContainerStyle, triggerWrapperStylesWithPadding } from '@atlaskit/editor-common/styles';
|
|
17
17
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
18
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
19
18
|
import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
20
19
|
import HighlightIcon from '@atlaskit/icon/core/highlight';
|
|
21
20
|
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down';
|
|
@@ -31,15 +30,16 @@ var expandIconContainerHighlightStyle = css({
|
|
|
31
30
|
var highlightIconContainerStyle = css({
|
|
32
31
|
marginTop: "var(--ds-space-negative-050, -4px)"
|
|
33
32
|
});
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var activeColor = useSharedPluginStateSelector(api, 'highlight.activeColor');
|
|
37
|
-
var disabled = useSharedPluginStateSelector(api, 'highlight.disabled');
|
|
33
|
+
var selector = function selector(states) {
|
|
34
|
+
var _states$highlightStat, _states$highlightStat2, _states$highlightStat3;
|
|
38
35
|
return {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
isPaletteOpen: (_states$highlightStat = states.highlightState) === null || _states$highlightStat === void 0 ? void 0 : _states$highlightStat.isPaletteOpen,
|
|
37
|
+
activeColor: (_states$highlightStat2 = states.highlightState) === null || _states$highlightStat2 === void 0 ? void 0 : _states$highlightStat2.activeColor,
|
|
38
|
+
disabled: (_states$highlightStat3 = states.highlightState) === null || _states$highlightStat3 === void 0 ? void 0 : _states$highlightStat3.disabled
|
|
42
39
|
};
|
|
40
|
+
};
|
|
41
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
42
|
+
return useSharedPluginStateWithSelector(api, ['highlight'], selector);
|
|
43
43
|
}, function (api) {
|
|
44
44
|
var _useSharedPluginState = useSharedPluginState(api, ['highlight']),
|
|
45
45
|
highlightState = _useSharedPluginState.highlightState;
|
|
@@ -8,13 +8,12 @@ import { useRef } from 'react';
|
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import { injectIntl } from 'react-intl-next';
|
|
10
10
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
11
|
-
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
11
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
12
12
|
import { DynamicStrokeIconDecoration } from '@atlaskit/editor-common/icons';
|
|
13
13
|
import { getAriaKeyshortcuts, toggleHighlightPalette, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
14
14
|
import { highlightMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { disableBlueBorderStyles, expandIconContainerStyle, expandIconWrapperStyle, triggerWrapperStylesWithPadding } from '@atlaskit/editor-common/styles';
|
|
16
16
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
17
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
18
17
|
import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
19
18
|
import HighlightIcon from '@atlaskit/icon/core/highlight';
|
|
20
19
|
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down';
|
|
@@ -24,15 +23,16 @@ import { setPalette } from '../editor-commands/palette';
|
|
|
24
23
|
import { EditorHighlightIcon } from './shared/EditorHighlightIcon';
|
|
25
24
|
import { PaletteDropdown } from './shared/PaletteDropdown';
|
|
26
25
|
import { useDropdownEvents } from './shared/useDropdownEvents';
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var highlightDisabled = useSharedPluginStateSelector(api, 'highlight.disabled');
|
|
30
|
-
var activeColor = useSharedPluginStateSelector(api, 'highlight.activeColor');
|
|
26
|
+
var selector = function selector(states) {
|
|
27
|
+
var _states$highlightStat, _states$highlightStat2, _states$highlightStat3;
|
|
31
28
|
return {
|
|
32
|
-
isPaletteOpen: isPaletteOpen,
|
|
33
|
-
highlightDisabled:
|
|
34
|
-
activeColor: activeColor
|
|
29
|
+
isPaletteOpen: (_states$highlightStat = states.highlightState) === null || _states$highlightStat === void 0 ? void 0 : _states$highlightStat.isPaletteOpen,
|
|
30
|
+
highlightDisabled: (_states$highlightStat2 = states.highlightState) === null || _states$highlightStat2 === void 0 ? void 0 : _states$highlightStat2.disabled,
|
|
31
|
+
activeColor: (_states$highlightStat3 = states.highlightState) === null || _states$highlightStat3 === void 0 ? void 0 : _states$highlightStat3.activeColor
|
|
35
32
|
};
|
|
33
|
+
};
|
|
34
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
35
|
+
return useSharedPluginStateWithSelector(api, ['highlight'], selector);
|
|
36
36
|
}, function (api) {
|
|
37
37
|
var _useSharedPluginState = useSharedPluginState(api, ['highlight']),
|
|
38
38
|
highlightState = _useSharedPluginState.highlightState;
|
|
@@ -6,7 +6,6 @@ import { ColorPalette, colorPaletteMessages, getSelectedRowAndColumnFromPalette,
|
|
|
6
6
|
import { ArrowKeyNavigationType, DropdownContainer as Dropdown } from '@atlaskit/editor-common/ui-menu';
|
|
7
7
|
import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
8
8
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
9
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
9
|
export var PaletteDropdown = function PaletteDropdown(props) {
|
|
11
10
|
var popupsMountPoint = props.popupsMountPoint,
|
|
12
11
|
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
@@ -23,19 +22,15 @@ export var PaletteDropdown = function PaletteDropdown(props) {
|
|
|
23
22
|
// this should reflect the width of the dropdown when fully populated with colors, including translations due to layering
|
|
24
23
|
var fitWidth = 242;
|
|
25
24
|
var colorPalette = highlightColorPalette;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
return item;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
25
|
+
colorPalette = highlightColorPalette.map(function (item) {
|
|
26
|
+
if (item.label === 'Orange') {
|
|
27
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
28
|
+
label: 'Yellow',
|
|
29
|
+
message: colorPaletteMessages.yellow
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return item;
|
|
33
|
+
});
|
|
39
34
|
var _getSelectedRowAndCol = getSelectedRowAndColumnFromPalette(colorPalette, activeColor),
|
|
40
35
|
selectedRowIndex = _getSelectedRowAndCol.selectedRowIndex,
|
|
41
36
|
selectedColumnIndex = _getSelectedRowAndCol.selectedColumnIndex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-highlight",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Highlight plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
".": "./src/index.ts"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@atlaskit/adf-schema": "^
|
|
38
|
+
"@atlaskit/adf-schema": "^49.0.5",
|
|
39
39
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-primary-toolbar": "^4.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/icon": "^27.3.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^14.10.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^9.3.0",
|
|
51
51
|
"@atlaskit/tokens": "^5.4.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@emotion/react": "^11.7.1"
|