@atlaskit/editor-plugin-text-color 1.1.7 → 1.2.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-text-color
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#98130](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98130)
|
|
8
|
+
[`6a3c0d9d6382`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6a3c0d9d6382) -
|
|
9
|
+
[ED-23154] Add highlight option to main toolbar in editor
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 1.1.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#97599](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97599)
|
|
20
|
+
[`32c3130b08fe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/32c3130b08fe) -
|
|
21
|
+
[ED-22282] Bump adf-schema to 36.1.0
|
|
22
|
+
|
|
3
23
|
## 1.1.7
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -90,8 +90,7 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
|
|
|
90
90
|
});
|
|
91
91
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOpenChange", function (_ref) {
|
|
92
92
|
var isOpen = _ref.isOpen,
|
|
93
|
-
logCloseEvent = _ref.logCloseEvent
|
|
94
|
-
event = _ref.event;
|
|
93
|
+
logCloseEvent = _ref.logCloseEvent;
|
|
95
94
|
_this.setState({
|
|
96
95
|
isOpen: isOpen
|
|
97
96
|
});
|
|
@@ -105,10 +104,6 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
|
|
|
105
104
|
noSelect: isOpen === false
|
|
106
105
|
}));
|
|
107
106
|
}
|
|
108
|
-
if (!isOpen && event instanceof KeyboardEvent && (event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
|
|
109
|
-
var _this$toolbarItemRef;
|
|
110
|
-
(_this$toolbarItemRef = _this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 || (_this$toolbarItemRef = _this$toolbarItemRef.current) === null || _this$toolbarItemRef === void 0 || _this$toolbarItemRef.focus();
|
|
111
|
-
}
|
|
112
107
|
});
|
|
113
108
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hide", function (e) {
|
|
114
109
|
var isOpen = _this.state.isOpen;
|
|
@@ -120,15 +115,15 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
|
|
|
120
115
|
isOpen: false
|
|
121
116
|
});
|
|
122
117
|
if (e instanceof KeyboardEvent && e.key === 'Escape') {
|
|
123
|
-
var _this$
|
|
124
|
-
(_this$
|
|
118
|
+
var _this$toolbarItemRef;
|
|
119
|
+
(_this$toolbarItemRef = _this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 || (_this$toolbarItemRef = _this$toolbarItemRef.current) === null || _this$toolbarItemRef === void 0 || _this$toolbarItemRef.focus();
|
|
125
120
|
}
|
|
126
121
|
}
|
|
127
122
|
});
|
|
128
123
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hideonEsc", function (e) {
|
|
129
|
-
var _this$
|
|
124
|
+
var _this$toolbarItemRef2;
|
|
130
125
|
_this.hide(e);
|
|
131
|
-
(_this$
|
|
126
|
+
(_this$toolbarItemRef2 = _this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 || (_this$toolbarItemRef2 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef2 === void 0 || _this$toolbarItemRef2.focus();
|
|
132
127
|
});
|
|
133
128
|
return _this;
|
|
134
129
|
}
|
|
@@ -159,6 +154,7 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
|
|
|
159
154
|
fitWidth = 242;
|
|
160
155
|
}
|
|
161
156
|
var selectedColor = this.getSelectedColor(pluginState);
|
|
157
|
+
// TODO: This doesn't work, the label isn't translated
|
|
162
158
|
var selectedColorPaletteItemLabel = (_palette$find = palette.find(function (paletteItem) {
|
|
163
159
|
return paletteItem.value === pluginState.color;
|
|
164
160
|
})) === null || _palette$find === void 0 ? void 0 : _palette$find.label;
|
|
@@ -229,7 +225,9 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
|
|
|
229
225
|
hexToPaletteColor: _editorPalette.hexToEditorTextPaletteColor,
|
|
230
226
|
paletteColorTooltipMessages: _uiColor.textPaletteTooltipMessages
|
|
231
227
|
}
|
|
232
|
-
}))),
|
|
228
|
+
}))),
|
|
229
|
+
// Only render the separator if the highlight toolbar option isn't being rendered after it
|
|
230
|
+
!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.highlight) && (0, _react2.jsx)("span", {
|
|
233
231
|
css: _styles.separatorStyles
|
|
234
232
|
}))
|
|
235
233
|
);
|
|
@@ -67,8 +67,7 @@ export class ToolbarTextColor extends React.Component {
|
|
|
67
67
|
});
|
|
68
68
|
_defineProperty(this, "handleOpenChange", ({
|
|
69
69
|
isOpen,
|
|
70
|
-
logCloseEvent
|
|
71
|
-
event
|
|
70
|
+
logCloseEvent
|
|
72
71
|
}) => {
|
|
73
72
|
this.setState({
|
|
74
73
|
isOpen
|
|
@@ -83,10 +82,6 @@ export class ToolbarTextColor extends React.Component {
|
|
|
83
82
|
noSelect: isOpen === false
|
|
84
83
|
}));
|
|
85
84
|
}
|
|
86
|
-
if (!isOpen && event instanceof KeyboardEvent && (event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
|
|
87
|
-
var _this$toolbarItemRef, _this$toolbarItemRef$;
|
|
88
|
-
(_this$toolbarItemRef = this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 ? void 0 : (_this$toolbarItemRef$ = _this$toolbarItemRef.current) === null || _this$toolbarItemRef$ === void 0 ? void 0 : _this$toolbarItemRef$.focus();
|
|
89
|
-
}
|
|
90
85
|
});
|
|
91
86
|
_defineProperty(this, "hide", e => {
|
|
92
87
|
const {
|
|
@@ -100,15 +95,15 @@ export class ToolbarTextColor extends React.Component {
|
|
|
100
95
|
isOpen: false
|
|
101
96
|
});
|
|
102
97
|
if (e instanceof KeyboardEvent && e.key === 'Escape') {
|
|
103
|
-
var _this$
|
|
104
|
-
(_this$
|
|
98
|
+
var _this$toolbarItemRef, _this$toolbarItemRef$;
|
|
99
|
+
(_this$toolbarItemRef = this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 ? void 0 : (_this$toolbarItemRef$ = _this$toolbarItemRef.current) === null || _this$toolbarItemRef$ === void 0 ? void 0 : _this$toolbarItemRef$.focus();
|
|
105
100
|
}
|
|
106
101
|
}
|
|
107
102
|
});
|
|
108
103
|
_defineProperty(this, "hideonEsc", e => {
|
|
109
|
-
var _this$
|
|
104
|
+
var _this$toolbarItemRef2, _this$toolbarItemRef3;
|
|
110
105
|
this.hide(e);
|
|
111
|
-
(_this$
|
|
106
|
+
(_this$toolbarItemRef2 = this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 ? void 0 : (_this$toolbarItemRef3 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef3 === void 0 ? void 0 : _this$toolbarItemRef3.focus();
|
|
112
107
|
});
|
|
113
108
|
}
|
|
114
109
|
render() {
|
|
@@ -139,6 +134,7 @@ export class ToolbarTextColor extends React.Component {
|
|
|
139
134
|
fitWidth = 242;
|
|
140
135
|
}
|
|
141
136
|
const selectedColor = this.getSelectedColor(pluginState);
|
|
137
|
+
// TODO: This doesn't work, the label isn't translated
|
|
142
138
|
const selectedColorPaletteItemLabel = (_palette$find = palette.find(paletteItem => paletteItem.value === pluginState.color)) === null || _palette$find === void 0 ? void 0 : _palette$find.label;
|
|
143
139
|
const selectedColorPaletteItemLabelText = selectedColorPaletteItemLabel || '';
|
|
144
140
|
const labelTextColor = formatMessage(messages.textColor, {
|
|
@@ -208,7 +204,9 @@ export class ToolbarTextColor extends React.Component {
|
|
|
208
204
|
hexToPaletteColor: hexToEditorTextPaletteColor,
|
|
209
205
|
paletteColorTooltipMessages: textPaletteTooltipMessages
|
|
210
206
|
}
|
|
211
|
-
}))),
|
|
207
|
+
}))),
|
|
208
|
+
// Only render the separator if the highlight toolbar option isn't being rendered after it
|
|
209
|
+
!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.highlight) && jsx("span", {
|
|
212
210
|
css: separatorStyles
|
|
213
211
|
}))
|
|
214
212
|
);
|
|
@@ -84,8 +84,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
84
84
|
});
|
|
85
85
|
_defineProperty(_assertThisInitialized(_this), "handleOpenChange", function (_ref) {
|
|
86
86
|
var isOpen = _ref.isOpen,
|
|
87
|
-
logCloseEvent = _ref.logCloseEvent
|
|
88
|
-
event = _ref.event;
|
|
87
|
+
logCloseEvent = _ref.logCloseEvent;
|
|
89
88
|
_this.setState({
|
|
90
89
|
isOpen: isOpen
|
|
91
90
|
});
|
|
@@ -99,10 +98,6 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
99
98
|
noSelect: isOpen === false
|
|
100
99
|
}));
|
|
101
100
|
}
|
|
102
|
-
if (!isOpen && event instanceof KeyboardEvent && (event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
|
|
103
|
-
var _this$toolbarItemRef;
|
|
104
|
-
(_this$toolbarItemRef = _this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 || (_this$toolbarItemRef = _this$toolbarItemRef.current) === null || _this$toolbarItemRef === void 0 || _this$toolbarItemRef.focus();
|
|
105
|
-
}
|
|
106
101
|
});
|
|
107
102
|
_defineProperty(_assertThisInitialized(_this), "hide", function (e) {
|
|
108
103
|
var isOpen = _this.state.isOpen;
|
|
@@ -114,15 +109,15 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
114
109
|
isOpen: false
|
|
115
110
|
});
|
|
116
111
|
if (e instanceof KeyboardEvent && e.key === 'Escape') {
|
|
117
|
-
var _this$
|
|
118
|
-
(_this$
|
|
112
|
+
var _this$toolbarItemRef;
|
|
113
|
+
(_this$toolbarItemRef = _this.toolbarItemRef) === null || _this$toolbarItemRef === void 0 || (_this$toolbarItemRef = _this$toolbarItemRef.current) === null || _this$toolbarItemRef === void 0 || _this$toolbarItemRef.focus();
|
|
119
114
|
}
|
|
120
115
|
}
|
|
121
116
|
});
|
|
122
117
|
_defineProperty(_assertThisInitialized(_this), "hideonEsc", function (e) {
|
|
123
|
-
var _this$
|
|
118
|
+
var _this$toolbarItemRef2;
|
|
124
119
|
_this.hide(e);
|
|
125
|
-
(_this$
|
|
120
|
+
(_this$toolbarItemRef2 = _this.toolbarItemRef) === null || _this$toolbarItemRef2 === void 0 || (_this$toolbarItemRef2 = _this$toolbarItemRef2.current) === null || _this$toolbarItemRef2 === void 0 || _this$toolbarItemRef2.focus();
|
|
126
121
|
});
|
|
127
122
|
return _this;
|
|
128
123
|
}
|
|
@@ -153,6 +148,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
153
148
|
fitWidth = 242;
|
|
154
149
|
}
|
|
155
150
|
var selectedColor = this.getSelectedColor(pluginState);
|
|
151
|
+
// TODO: This doesn't work, the label isn't translated
|
|
156
152
|
var selectedColorPaletteItemLabel = (_palette$find = palette.find(function (paletteItem) {
|
|
157
153
|
return paletteItem.value === pluginState.color;
|
|
158
154
|
})) === null || _palette$find === void 0 ? void 0 : _palette$find.label;
|
|
@@ -223,7 +219,9 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
|
|
|
223
219
|
hexToPaletteColor: hexToEditorTextPaletteColor,
|
|
224
220
|
paletteColorTooltipMessages: textPaletteTooltipMessages
|
|
225
221
|
}
|
|
226
|
-
}))),
|
|
222
|
+
}))),
|
|
223
|
+
// Only render the separator if the highlight toolbar option isn't being rendered after it
|
|
224
|
+
!(pluginInjectionApi !== null && pluginInjectionApi !== void 0 && pluginInjectionApi.highlight) && jsx("span", {
|
|
227
225
|
css: separatorStyles
|
|
228
226
|
}))
|
|
229
227
|
);
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { HighlightPlugin } from '@atlaskit/editor-plugin-highlight';
|
|
3
4
|
import type { TextColorPluginConfig, TextColorPluginState } from './pm-plugins/main';
|
|
4
5
|
type Config = TextColorPluginConfig | boolean;
|
|
5
6
|
export type TextColorPlugin = NextEditorPlugin<'textColor', {
|
|
6
7
|
pluginConfiguration: Config | undefined;
|
|
7
|
-
dependencies: [
|
|
8
|
+
dependencies: [
|
|
9
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
10
|
+
OptionalPlugin<HighlightPlugin>
|
|
11
|
+
];
|
|
8
12
|
actions: {
|
|
9
13
|
changeColor: (color: string) => Command;
|
|
10
14
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
import type { HighlightPlugin } from '@atlaskit/editor-plugin-highlight';
|
|
3
4
|
import type { TextColorPluginConfig, TextColorPluginState } from './pm-plugins/main';
|
|
4
5
|
type Config = TextColorPluginConfig | boolean;
|
|
5
6
|
export type TextColorPlugin = NextEditorPlugin<'textColor', {
|
|
6
7
|
pluginConfiguration: Config | undefined;
|
|
7
8
|
dependencies: [
|
|
8
|
-
OptionalPlugin<AnalyticsPlugin
|
|
9
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
10
|
+
OptionalPlugin<HighlightPlugin>
|
|
9
11
|
];
|
|
10
12
|
actions: {
|
|
11
13
|
changeColor: (color: string) => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-text-color",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Text color plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,15 +33,16 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/adf-schema": "^
|
|
37
|
-
"@atlaskit/editor-common": "^79.
|
|
36
|
+
"@atlaskit/adf-schema": "^36.1.0",
|
|
37
|
+
"@atlaskit/editor-common": "^79.4.0",
|
|
38
38
|
"@atlaskit/editor-palette": "1.6.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.1.0",
|
|
40
|
+
"@atlaskit/editor-plugin-highlight": "^1.1.0",
|
|
40
41
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
41
42
|
"@atlaskit/editor-shared-styles": "^2.10.0",
|
|
42
43
|
"@atlaskit/editor-tables": "^2.7.0",
|
|
43
44
|
"@atlaskit/icon": "^22.1.0",
|
|
44
|
-
"@atlaskit/theme": "^12.
|
|
45
|
+
"@atlaskit/theme": "^12.8.0",
|
|
45
46
|
"@babel/runtime": "^7.0.0",
|
|
46
47
|
"@emotion/react": "^11.7.1"
|
|
47
48
|
},
|