@atlaskit/editor-plugin-text-color 1.16.2 → 1.16.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 +17 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/{commands → pm-plugins/commands}/change-color.js +1 -1
- package/dist/cjs/{commands → pm-plugins/commands}/remove-color.js +1 -1
- package/dist/cjs/{commands → pm-plugins/commands}/toggle-color.js +1 -1
- package/dist/cjs/pm-plugins/main.js +3 -3
- package/dist/cjs/{utils → pm-plugins/utils}/inputType.js +1 -1
- package/dist/cjs/{plugin.js → textColorPlugin.js} +4 -2
- package/dist/cjs/textColorPluginType.js +5 -0
- package/dist/cjs/ui/ToolbarTextColor/index.js +5 -3
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/{commands → pm-plugins/commands}/change-color.js +1 -1
- package/dist/es2019/{commands → pm-plugins/commands}/remove-color.js +1 -1
- package/dist/es2019/{commands → pm-plugins/commands}/toggle-color.js +1 -1
- package/dist/es2019/pm-plugins/main.js +4 -4
- package/dist/es2019/{utils → pm-plugins/utils}/inputType.js +1 -1
- package/dist/es2019/{plugin.js → textColorPlugin.js} +4 -2
- package/dist/es2019/textColorPluginType.js +1 -0
- package/dist/es2019/ui/ToolbarTextColor/index.js +5 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/{commands → pm-plugins/commands}/change-color.js +1 -1
- package/dist/esm/{commands → pm-plugins/commands}/remove-color.js +1 -1
- package/dist/esm/{commands → pm-plugins/commands}/toggle-color.js +1 -1
- package/dist/esm/pm-plugins/main.js +4 -4
- package/dist/esm/{utils → pm-plugins/utils}/inputType.js +1 -1
- package/dist/esm/{plugin.js → textColorPlugin.js} +4 -2
- package/dist/esm/textColorPluginType.js +1 -0
- package/dist/esm/ui/ToolbarTextColor/index.js +5 -3
- package/dist/types/index.d.ts +3 -2
- package/dist/types/{commands → pm-plugins/commands}/change-color.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/utils/inputType.d.ts +3 -0
- package/dist/types/{plugin.d.ts → textColorPlugin.d.ts} +1 -1
- package/dist/types/{types.d.ts → textColorPluginType.d.ts} +1 -6
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/ui/FloatingToolbarComponent.d.ts +1 -1
- package/dist/types/ui/PrimaryToolbarComponent.d.ts +1 -1
- package/dist/types/ui/ToolbarTextColor/index.d.ts +2 -1
- package/dist/types-ts4.5/index.d.ts +3 -2
- package/dist/types-ts4.5/{commands → pm-plugins/commands}/change-color.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/inputType.d.ts +3 -0
- package/dist/types-ts4.5/{plugin.d.ts → textColorPlugin.d.ts} +1 -1
- package/dist/types-ts4.5/{types.d.ts → textColorPluginType.d.ts} +1 -6
- package/dist/types-ts4.5/types/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/FloatingToolbarComponent.d.ts +1 -1
- package/dist/types-ts4.5/ui/PrimaryToolbarComponent.d.ts +1 -1
- package/dist/types-ts4.5/ui/ToolbarTextColor/index.d.ts +2 -1
- package/package.json +7 -4
- package/dist/types/utils/inputType.d.ts +0 -3
- package/dist/types-ts4.5/utils/inputType.d.ts +0 -3
- /package/dist/cjs/{utils → pm-plugins/utils}/color.js +0 -0
- /package/dist/cjs/{utils → pm-plugins/utils}/constants.js +0 -0
- /package/dist/cjs/{utils → pm-plugins/utils}/disabled.js +0 -0
- /package/dist/cjs/{types.js → types/index.js} +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/color.js +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/constants.js +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/disabled.js +0 -0
- /package/dist/es2019/{types.js → types/index.js} +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/color.js +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/constants.js +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/disabled.js +0 -0
- /package/dist/esm/{types.js → types/index.js} +0 -0
- /package/dist/types/{commands → pm-plugins/commands}/remove-color.d.ts +0 -0
- /package/dist/types/{commands → pm-plugins/commands}/toggle-color.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/color.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/constants.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/disabled.d.ts +0 -0
- /package/dist/types-ts4.5/{commands → pm-plugins/commands}/remove-color.d.ts +0 -0
- /package/dist/types-ts4.5/{commands → pm-plugins/commands}/toggle-color.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/color.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/constants.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/disabled.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-text-color
|
|
2
2
|
|
|
3
|
+
## 1.16.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#171551](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171551)
|
|
8
|
+
[`702c918817e78`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/702c918817e78) -
|
|
9
|
+
ED-25817: refactors plugins to meet folder standards
|
|
10
|
+
|
|
11
|
+
## 1.16.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#172933](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/172933)
|
|
16
|
+
[`8323af2381d00`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8323af2381d00) -
|
|
17
|
+
[ux] Arranges items in the Selection toolbar under the Contextual toolbar experiment flag
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 1.16.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "textColorPlugin", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _textColorPlugin.textColorPlugin;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _textColorPlugin = require("./textColorPlugin");
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.changeColor = void 0;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
9
|
-
var _main = require("../
|
|
9
|
+
var _main = require("../main");
|
|
10
10
|
var _color = require("../utils/color");
|
|
11
11
|
var _removeColor = require("./remove-color");
|
|
12
12
|
var _toggleColor = require("./toggle-color");
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.removeColor = void 0;
|
|
7
7
|
var _mark = require("@atlaskit/editor-common/mark");
|
|
8
|
-
var _main = require("../
|
|
8
|
+
var _main = require("../main");
|
|
9
9
|
var removeColor = exports.removeColor = function removeColor() {
|
|
10
10
|
return function (state, dispatch) {
|
|
11
11
|
var schema = state.schema;
|
|
@@ -5,7 +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 _main = require("../
|
|
8
|
+
var _main = require("../main");
|
|
9
9
|
var _constants = require("../utils/constants");
|
|
10
10
|
var _disabled = require("../utils/disabled");
|
|
11
11
|
var toggleColor = exports.toggleColor = function toggleColor(color) {
|
|
@@ -18,9 +18,9 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
18
18
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
19
19
|
var _uiColor = require("@atlaskit/editor-common/ui-color");
|
|
20
20
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
21
|
-
var _color = require("
|
|
22
|
-
var _constants = require("
|
|
23
|
-
var _disabled = require("
|
|
21
|
+
var _color = require("./utils/color");
|
|
22
|
+
var _constants = require("./utils/constants");
|
|
23
|
+
var _disabled = require("./utils/disabled");
|
|
24
24
|
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; }
|
|
25
25
|
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; }
|
|
26
26
|
function createInitialPluginState(editorState, pluginConfig) {
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getInputMethod = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
-
var _types = require("
|
|
10
|
+
var _types = require("../../types");
|
|
11
11
|
var _toolbarTypeToInputMe;
|
|
12
12
|
var toolbarTypeToInputMethod = (_toolbarTypeToInputMe = {}, (0, _defineProperty2.default)(_toolbarTypeToInputMe, _types.ToolbarType.PRIMARY, _analytics.INPUT_METHOD.TOOLBAR), (0, _defineProperty2.default)(_toolbarTypeToInputMe, _types.ToolbarType.FLOATING, _analytics.INPUT_METHOD.FLOATING_TB), _toolbarTypeToInputMe);
|
|
13
13
|
var getInputMethod = exports.getInputMethod = function getInputMethod(toolbarType) {
|
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "textColorPluginKey", {
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
16
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
|
-
var _changeColor2 = require("./commands/change-color");
|
|
17
|
+
var _changeColor2 = require("./pm-plugins/commands/change-color");
|
|
18
18
|
var _main = require("./pm-plugins/main");
|
|
19
19
|
var _FloatingToolbarComponent = require("./ui/FloatingToolbarComponent");
|
|
20
20
|
var _PrimaryToolbarComponent = require("./ui/PrimaryToolbarComponent");
|
|
@@ -101,7 +101,9 @@ var textColorPlugin = exports.textColorPlugin = function textColorPlugin(_ref) {
|
|
|
101
101
|
};
|
|
102
102
|
return {
|
|
103
103
|
isToolbarAbove: true,
|
|
104
|
-
items: [toolbarCustom]
|
|
104
|
+
items: [toolbarCustom],
|
|
105
|
+
rank: 6,
|
|
106
|
+
pluginName: 'textColor'
|
|
105
107
|
};
|
|
106
108
|
} else {
|
|
107
109
|
return undefined;
|
|
@@ -26,8 +26,9 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
26
26
|
var _textStyle = _interopRequireDefault(require("@atlaskit/icon/core/text-style"));
|
|
27
27
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-down"));
|
|
28
28
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
29
|
-
var _changeColor = require("../../commands/change-color");
|
|
30
|
-
var _inputType = require("../../utils/inputType");
|
|
29
|
+
var _changeColor = require("../../pm-plugins/commands/change-color");
|
|
30
|
+
var _inputType = require("../../pm-plugins/utils/inputType");
|
|
31
|
+
var _types = require("../../types");
|
|
31
32
|
var _icon = require("./icon");
|
|
32
33
|
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; }
|
|
33
34
|
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; }
|
|
@@ -172,6 +173,7 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
|
|
|
172
173
|
var _getSelectedRowAndCol = (0, _uiColor.getSelectedRowAndColumnFromPalette)(palette, pluginState.color),
|
|
173
174
|
selectedRowIndex = _getSelectedRowAndCol.selectedRowIndex,
|
|
174
175
|
selectedColumnIndex = _getSelectedRowAndCol.selectedColumnIndex;
|
|
176
|
+
var reducedSpacing = this.props.toolbarType === _types.ToolbarType.FLOATING ? 'compact' : 'none';
|
|
175
177
|
return (
|
|
176
178
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
177
179
|
(0, _react2.jsx)("span", {
|
|
@@ -195,7 +197,7 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
|
|
|
195
197
|
},
|
|
196
198
|
trigger: (0, _react2.jsx)(_uiMenu.ToolbarButton, {
|
|
197
199
|
buttonId: _uiMenu.TOOLBAR_BUTTON.TEXT_COLOR,
|
|
198
|
-
spacing: isReducedSpacing ?
|
|
200
|
+
spacing: isReducedSpacing ? reducedSpacing : 'default',
|
|
199
201
|
disabled: disabled || pluginState.disabled,
|
|
200
202
|
selected: isOpen,
|
|
201
203
|
"aria-label": labelTextColor,
|
package/dist/es2019/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { textColorPlugin } from './
|
|
1
|
+
export { textColorPlugin } from './textColorPlugin';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
3
|
-
import { pluginKey } from '../
|
|
3
|
+
import { pluginKey } from '../main';
|
|
4
4
|
import { getActiveColor } from '../utils/color';
|
|
5
5
|
import { removeColor } from './remove-color';
|
|
6
6
|
import { toggleColor } from './toggle-color';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
|
|
2
|
-
import { ACTIONS, pluginKey } from '../
|
|
2
|
+
import { ACTIONS, pluginKey } from '../main';
|
|
3
3
|
import { overrideMarks } from '../utils/constants';
|
|
4
4
|
import { getDisabledState } from '../utils/disabled';
|
|
5
5
|
export const toggleColor = color => (state, dispatch) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { textColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import { getActiveColor } from '
|
|
5
|
-
import { DEFAULT_COLOR } from '
|
|
6
|
-
import { getDisabledState } from '
|
|
7
|
-
export { DEFAULT_COLOR } from '
|
|
4
|
+
import { getActiveColor } from './utils/color';
|
|
5
|
+
import { DEFAULT_COLOR } from './utils/constants';
|
|
6
|
+
import { getDisabledState } from './utils/disabled';
|
|
7
|
+
export { DEFAULT_COLOR } from './utils/constants';
|
|
8
8
|
function createInitialPluginState(editorState, pluginConfig) {
|
|
9
9
|
const defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || DEFAULT_COLOR;
|
|
10
10
|
const palette = [{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { ToolbarType } from '
|
|
2
|
+
import { ToolbarType } from '../../types';
|
|
3
3
|
const toolbarTypeToInputMethod = {
|
|
4
4
|
[ToolbarType.PRIMARY]: INPUT_METHOD.TOOLBAR,
|
|
5
5
|
[ToolbarType.FLOATING]: INPUT_METHOD.FLOATING_TB
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { textColor } from '@atlaskit/adf-schema';
|
|
3
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
|
-
import { changeColor } from './commands/change-color';
|
|
4
|
+
import { changeColor } from './pm-plugins/commands/change-color';
|
|
5
5
|
import { createPlugin, pluginKey as textColorPluginKey } from './pm-plugins/main';
|
|
6
6
|
import { FloatingToolbarComponent } from './ui/FloatingToolbarComponent';
|
|
7
7
|
import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
|
|
@@ -89,7 +89,9 @@ export const textColorPlugin = ({
|
|
|
89
89
|
};
|
|
90
90
|
return {
|
|
91
91
|
isToolbarAbove: true,
|
|
92
|
-
items: [toolbarCustom]
|
|
92
|
+
items: [toolbarCustom],
|
|
93
|
+
rank: 6,
|
|
94
|
+
pluginName: 'textColor'
|
|
93
95
|
};
|
|
94
96
|
} else {
|
|
95
97
|
return undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -19,8 +19,9 @@ import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
|
19
19
|
import TextStyleIcon from '@atlaskit/icon/core/text-style';
|
|
20
20
|
import ChevronDownIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
|
-
import { changeColor as changeColorWithAnalytics } from '../../commands/change-color';
|
|
23
|
-
import { getInputMethod } from '../../utils/inputType';
|
|
22
|
+
import { changeColor as changeColorWithAnalytics } from '../../pm-plugins/commands/change-color';
|
|
23
|
+
import { getInputMethod } from '../../pm-plugins/utils/inputType';
|
|
24
|
+
import { ToolbarType } from '../../types';
|
|
24
25
|
import { EditorTextColorIcon } from './icon';
|
|
25
26
|
const EXPERIMENT_NAME = 'editor.toolbarTextColor.moreColors';
|
|
26
27
|
const EXPERIMENT_GROUP_CONTROL = 'control';
|
|
@@ -153,6 +154,7 @@ export class ToolbarTextColor extends React.Component {
|
|
|
153
154
|
selectedRowIndex,
|
|
154
155
|
selectedColumnIndex
|
|
155
156
|
} = getSelectedRowAndColumnFromPalette(palette, pluginState.color);
|
|
157
|
+
const reducedSpacing = this.props.toolbarType === ToolbarType.FLOATING ? 'compact' : 'none';
|
|
156
158
|
return (
|
|
157
159
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
158
160
|
jsx("span", {
|
|
@@ -176,7 +178,7 @@ export class ToolbarTextColor extends React.Component {
|
|
|
176
178
|
},
|
|
177
179
|
trigger: jsx(ToolbarButton, {
|
|
178
180
|
buttonId: TOOLBAR_BUTTON.TEXT_COLOR,
|
|
179
|
-
spacing: isReducedSpacing ?
|
|
181
|
+
spacing: isReducedSpacing ? reducedSpacing : 'default',
|
|
180
182
|
disabled: disabled || pluginState.disabled,
|
|
181
183
|
selected: isOpen,
|
|
182
184
|
"aria-label": labelTextColor,
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { textColorPlugin } from './
|
|
1
|
+
export { textColorPlugin } from './textColorPlugin';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
3
|
-
import { pluginKey } from '../
|
|
3
|
+
import { pluginKey } from '../main';
|
|
4
4
|
import { getActiveColor } from '../utils/color';
|
|
5
5
|
import { removeColor } from './remove-color';
|
|
6
6
|
import { toggleColor } from './toggle-color';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { removeMark } from '@atlaskit/editor-common/mark';
|
|
2
|
-
import { ACTIONS, pluginKey } from '../
|
|
2
|
+
import { ACTIONS, pluginKey } from '../main';
|
|
3
3
|
export var removeColor = function removeColor() {
|
|
4
4
|
return function (state, dispatch) {
|
|
5
5
|
var schema = state.schema;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { removeMark, toggleMark } from '@atlaskit/editor-common/mark';
|
|
2
|
-
import { ACTIONS, pluginKey } from '../
|
|
2
|
+
import { ACTIONS, pluginKey } from '../main';
|
|
3
3
|
import { overrideMarks } from '../utils/constants';
|
|
4
4
|
import { getDisabledState } from '../utils/disabled';
|
|
5
5
|
export var toggleColor = function toggleColor(color) {
|
|
@@ -5,10 +5,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import { textColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
7
7
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
-
import { getActiveColor } from '
|
|
9
|
-
import { DEFAULT_COLOR } from '
|
|
10
|
-
import { getDisabledState } from '
|
|
11
|
-
export { DEFAULT_COLOR } from '
|
|
8
|
+
import { getActiveColor } from './utils/color';
|
|
9
|
+
import { DEFAULT_COLOR } from './utils/constants';
|
|
10
|
+
import { getDisabledState } from './utils/disabled';
|
|
11
|
+
export { DEFAULT_COLOR } from './utils/constants';
|
|
12
12
|
function createInitialPluginState(editorState, pluginConfig) {
|
|
13
13
|
var defaultColor = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.defaultColor) || DEFAULT_COLOR;
|
|
14
14
|
var palette = [{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
var _toolbarTypeToInputMe;
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { ToolbarType } from '
|
|
4
|
+
import { ToolbarType } from '../../types';
|
|
5
5
|
var toolbarTypeToInputMethod = (_toolbarTypeToInputMe = {}, _defineProperty(_toolbarTypeToInputMe, ToolbarType.PRIMARY, INPUT_METHOD.TOOLBAR), _defineProperty(_toolbarTypeToInputMe, ToolbarType.FLOATING, INPUT_METHOD.FLOATING_TB), _toolbarTypeToInputMe);
|
|
6
6
|
export var getInputMethod = function getInputMethod(toolbarType) {
|
|
7
7
|
return toolbarTypeToInputMethod[toolbarType];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { textColor } from '@atlaskit/adf-schema';
|
|
3
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
|
-
import { changeColor as _changeColor } from './commands/change-color';
|
|
4
|
+
import { changeColor as _changeColor } from './pm-plugins/commands/change-color';
|
|
5
5
|
import { createPlugin, pluginKey as textColorPluginKey } from './pm-plugins/main';
|
|
6
6
|
import { FloatingToolbarComponent } from './ui/FloatingToolbarComponent';
|
|
7
7
|
import { PrimaryToolbarComponent } from './ui/PrimaryToolbarComponent';
|
|
@@ -88,7 +88,9 @@ export var textColorPlugin = function textColorPlugin(_ref) {
|
|
|
88
88
|
};
|
|
89
89
|
return {
|
|
90
90
|
isToolbarAbove: true,
|
|
91
|
-
items: [toolbarCustom]
|
|
91
|
+
items: [toolbarCustom],
|
|
92
|
+
rank: 6,
|
|
93
|
+
pluginName: 'textColor'
|
|
92
94
|
};
|
|
93
95
|
} else {
|
|
94
96
|
return undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -29,8 +29,9 @@ import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
|
29
29
|
import TextStyleIcon from '@atlaskit/icon/core/text-style';
|
|
30
30
|
import ChevronDownIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
31
31
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
32
|
-
import { changeColor as changeColorWithAnalytics } from '../../commands/change-color';
|
|
33
|
-
import { getInputMethod } from '../../utils/inputType';
|
|
32
|
+
import { changeColor as changeColorWithAnalytics } from '../../pm-plugins/commands/change-color';
|
|
33
|
+
import { getInputMethod } from '../../pm-plugins/utils/inputType';
|
|
34
|
+
import { ToolbarType } from '../../types';
|
|
34
35
|
import { EditorTextColorIcon } from './icon';
|
|
35
36
|
var EXPERIMENT_NAME = 'editor.toolbarTextColor.moreColors';
|
|
36
37
|
var EXPERIMENT_GROUP_CONTROL = 'control';
|
|
@@ -168,6 +169,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
168
169
|
var _getSelectedRowAndCol = getSelectedRowAndColumnFromPalette(palette, pluginState.color),
|
|
169
170
|
selectedRowIndex = _getSelectedRowAndCol.selectedRowIndex,
|
|
170
171
|
selectedColumnIndex = _getSelectedRowAndCol.selectedColumnIndex;
|
|
172
|
+
var reducedSpacing = this.props.toolbarType === ToolbarType.FLOATING ? 'compact' : 'none';
|
|
171
173
|
return (
|
|
172
174
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
173
175
|
jsx("span", {
|
|
@@ -191,7 +193,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
191
193
|
},
|
|
192
194
|
trigger: jsx(ToolbarButton, {
|
|
193
195
|
buttonId: TOOLBAR_BUTTON.TEXT_COLOR,
|
|
194
|
-
spacing: isReducedSpacing ?
|
|
196
|
+
spacing: isReducedSpacing ? reducedSpacing : 'default',
|
|
195
197
|
disabled: disabled || pluginState.disabled,
|
|
196
198
|
selected: isOpen,
|
|
197
199
|
"aria-label": labelTextColor,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { textColorPlugin } from './
|
|
2
|
-
export type {
|
|
1
|
+
export { textColorPlugin } from './textColorPlugin';
|
|
2
|
+
export type { TextColorPlugin } from './textColorPluginType';
|
|
3
|
+
export type { TextColorInputMethod } from './types';
|
|
3
4
|
export type { TextColorPluginState, TextColorPluginConfig } from './pm-plugins/main';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { TextColorInputMethod } from '
|
|
3
|
+
import type { TextColorInputMethod } from '../../types';
|
|
4
4
|
export declare const changeColor: (color: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod?: TextColorInputMethod) => Command;
|
|
@@ -2,7 +2,7 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
export { DEFAULT_COLOR } from '
|
|
5
|
+
export { DEFAULT_COLOR } from './utils/constants';
|
|
6
6
|
export type TextColorPluginState = {
|
|
7
7
|
palette: Array<PaletteColor>;
|
|
8
8
|
defaultColor: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TextColorPluginState } from './pm-plugins/main';
|
|
2
2
|
import { pluginKey as textColorPluginKey } from './pm-plugins/main';
|
|
3
|
-
import type { TextColorPlugin } from './
|
|
3
|
+
import type { TextColorPlugin } from './textColorPluginType';
|
|
4
4
|
export declare const textColorPlugin: TextColorPlugin;
|
|
5
5
|
export { textColorPluginKey };
|
|
6
6
|
export type { TextColorPluginState };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
3
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
5
4
|
import type { TextColorPluginConfig, TextColorPluginState } from './pm-plugins/main';
|
|
5
|
+
import type { TextColorInputMethod } from './types';
|
|
6
6
|
type Config = TextColorPluginConfig | boolean;
|
|
7
|
-
export type TextColorInputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.FLOATING_TB;
|
|
8
7
|
export type TextColorPlugin = NextEditorPlugin<'textColor', {
|
|
9
8
|
pluginConfiguration: Config | undefined;
|
|
10
9
|
dependencies: [OptionalPlugin<AnalyticsPlugin>, OptionalPlugin<PrimaryToolbarPlugin>];
|
|
@@ -13,8 +12,4 @@ export type TextColorPlugin = NextEditorPlugin<'textColor', {
|
|
|
13
12
|
};
|
|
14
13
|
sharedState: TextColorPluginState | undefined;
|
|
15
14
|
}>;
|
|
16
|
-
export declare enum ToolbarType {
|
|
17
|
-
PRIMARY = "primaryToolbar",
|
|
18
|
-
FLOATING = "floatingToolbar"
|
|
19
|
-
}
|
|
20
15
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { TextColorPlugin } from '../
|
|
5
|
+
import type { TextColorPlugin } from '../textColorPluginType';
|
|
6
6
|
interface FloatingToolbarComponentProps {
|
|
7
7
|
editorView: EditorView;
|
|
8
8
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { TextColorPlugin } from '../
|
|
5
|
+
import type { TextColorPlugin } from '../textColorPluginType';
|
|
6
6
|
interface PrimaryToolbarComponentProps {
|
|
7
7
|
isReducedSpacing: boolean;
|
|
8
8
|
editorView: EditorView;
|
|
@@ -9,7 +9,8 @@ import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/edito
|
|
|
9
9
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
10
10
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
11
|
import type { TextColorPluginState } from '../../pm-plugins/main';
|
|
12
|
-
import type { TextColorPlugin
|
|
12
|
+
import type { TextColorPlugin } from '../../textColorPluginType';
|
|
13
|
+
import { ToolbarType } from '../../types';
|
|
13
14
|
export interface State {
|
|
14
15
|
isOpen: boolean;
|
|
15
16
|
isOpenedByKeyboard: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { textColorPlugin } from './
|
|
2
|
-
export type {
|
|
1
|
+
export { textColorPlugin } from './textColorPlugin';
|
|
2
|
+
export type { TextColorPlugin } from './textColorPluginType';
|
|
3
|
+
export type { TextColorInputMethod } from './types';
|
|
3
4
|
export type { TextColorPluginState, TextColorPluginConfig } from './pm-plugins/main';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { TextColorInputMethod } from '
|
|
3
|
+
import type { TextColorInputMethod } from '../../types';
|
|
4
4
|
export declare const changeColor: (color: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined, inputMethod?: TextColorInputMethod) => Command;
|
|
@@ -2,7 +2,7 @@ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
3
|
import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
-
export { DEFAULT_COLOR } from '
|
|
5
|
+
export { DEFAULT_COLOR } from './utils/constants';
|
|
6
6
|
export type TextColorPluginState = {
|
|
7
7
|
palette: Array<PaletteColor>;
|
|
8
8
|
defaultColor: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TextColorPluginState } from './pm-plugins/main';
|
|
2
2
|
import { pluginKey as textColorPluginKey } from './pm-plugins/main';
|
|
3
|
-
import type { TextColorPlugin } from './
|
|
3
|
+
import type { TextColorPlugin } from './textColorPluginType';
|
|
4
4
|
export declare const textColorPlugin: TextColorPlugin;
|
|
5
5
|
export { textColorPluginKey };
|
|
6
6
|
export type { TextColorPluginState };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
1
|
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
3
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
5
4
|
import type { TextColorPluginConfig, TextColorPluginState } from './pm-plugins/main';
|
|
5
|
+
import type { TextColorInputMethod } from './types';
|
|
6
6
|
type Config = TextColorPluginConfig | boolean;
|
|
7
|
-
export type TextColorInputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.FLOATING_TB;
|
|
8
7
|
export type TextColorPlugin = NextEditorPlugin<'textColor', {
|
|
9
8
|
pluginConfiguration: Config | undefined;
|
|
10
9
|
dependencies: [
|
|
@@ -16,8 +15,4 @@ export type TextColorPlugin = NextEditorPlugin<'textColor', {
|
|
|
16
15
|
};
|
|
17
16
|
sharedState: TextColorPluginState | undefined;
|
|
18
17
|
}>;
|
|
19
|
-
export declare enum ToolbarType {
|
|
20
|
-
PRIMARY = "primaryToolbar",
|
|
21
|
-
FLOATING = "floatingToolbar"
|
|
22
|
-
}
|
|
23
18
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { TextColorPlugin } from '../
|
|
5
|
+
import type { TextColorPlugin } from '../textColorPluginType';
|
|
6
6
|
interface FloatingToolbarComponentProps {
|
|
7
7
|
editorView: EditorView;
|
|
8
8
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { TextColorPlugin } from '../
|
|
5
|
+
import type { TextColorPlugin } from '../textColorPluginType';
|
|
6
6
|
interface PrimaryToolbarComponentProps {
|
|
7
7
|
isReducedSpacing: boolean;
|
|
8
8
|
editorView: EditorView;
|
|
@@ -9,7 +9,8 @@ import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/edito
|
|
|
9
9
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
10
10
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
11
|
import type { TextColorPluginState } from '../../pm-plugins/main';
|
|
12
|
-
import type { TextColorPlugin
|
|
12
|
+
import type { TextColorPlugin } from '../../textColorPluginType';
|
|
13
|
+
import { ToolbarType } from '../../types';
|
|
13
14
|
export interface State {
|
|
14
15
|
isOpen: boolean;
|
|
15
16
|
isOpenedByKeyboard: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-color",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.4",
|
|
4
4
|
"description": "Text color plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
|
-
"@atlaskit/editor-common": "^96.
|
|
35
|
+
"@atlaskit/editor-common": "^96.3.0",
|
|
36
36
|
"@atlaskit/editor-palette": "1.6.3",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
38
38
|
"@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
41
41
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
42
|
-
"@atlaskit/icon": "^23.
|
|
42
|
+
"@atlaskit/icon": "^23.1.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
44
44
|
"@atlaskit/theme": "^14.0.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^2.23.0",
|
|
46
46
|
"@atlaskit/tokens": "^2.4.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"@emotion/react": "^11.7.1"
|
|
@@ -62,6 +62,9 @@
|
|
|
62
62
|
},
|
|
63
63
|
"techstack": {
|
|
64
64
|
"@atlassian/frontend": {
|
|
65
|
+
"code-structure": [
|
|
66
|
+
"editor-plugin"
|
|
67
|
+
],
|
|
65
68
|
"import-structure": [
|
|
66
69
|
"atlassian-conventions"
|
|
67
70
|
],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|