@atlaskit/editor-common 72.5.1 → 72.6.1
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 +47 -0
- package/dist/cjs/node-width/index.js +18 -4
- package/dist/cjs/preset/builder.js +180 -0
- package/dist/cjs/preset/index.js +19 -0
- package/dist/cjs/preset/plugin-injection-api.js +223 -0
- package/dist/cjs/styles/shared/media-single.js +1 -1
- package/dist/cjs/styles/shared/panel.js +2 -2
- package/dist/cjs/styles/shared/table.js +2 -1
- package/dist/cjs/styles/shared/tableCell.js +31 -0
- package/dist/cjs/ui/DropList/index.js +6 -3
- package/dist/cjs/ui-color/ColorPalette/Color/styles.js +1 -1
- package/dist/cjs/ui-color/ColorPalette/Palettes/index.js +14 -1
- package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +139 -8
- package/dist/cjs/ui-color/ColorPalette/index.js +10 -11
- package/dist/cjs/ui-color/index.js +13 -0
- package/dist/cjs/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +2 -2
- package/dist/cjs/ui-menu/Dropdown/index.js +18 -8
- package/dist/cjs/ui-menu/DropdownMenu/index.js +1 -1
- package/dist/cjs/utils/breakout.js +12 -4
- package/dist/cjs/utils/index.js +12 -7
- package/dist/cjs/utils/nodes.js +38 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/node-width/index.js +18 -4
- package/dist/es2019/preset/builder.js +138 -0
- package/dist/es2019/preset/index.js +2 -0
- package/dist/es2019/preset/plugin-injection-api.js +176 -0
- package/dist/es2019/styles/shared/media-single.js +9 -0
- package/dist/es2019/styles/shared/panel.js +2 -2
- package/dist/es2019/styles/shared/table.js +2 -0
- package/dist/es2019/styles/shared/tableCell.js +27 -0
- package/dist/es2019/ui/DropList/index.js +6 -3
- package/dist/es2019/ui-color/ColorPalette/Color/styles.js +3 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/index.js +2 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +137 -7
- package/dist/es2019/ui-color/ColorPalette/index.js +10 -8
- package/dist/es2019/ui-color/index.js +1 -0
- package/dist/es2019/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +2 -2
- package/dist/es2019/ui-menu/Dropdown/index.js +18 -6
- package/dist/es2019/ui-menu/DropdownMenu/index.js +1 -1
- package/dist/es2019/utils/breakout.js +13 -5
- package/dist/es2019/utils/index.js +1 -2
- package/dist/es2019/utils/nodes.js +34 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/node-width/index.js +18 -4
- package/dist/esm/preset/builder.js +172 -0
- package/dist/esm/preset/index.js +2 -0
- package/dist/esm/preset/plugin-injection-api.js +213 -0
- package/dist/esm/styles/shared/media-single.js +1 -1
- package/dist/esm/styles/shared/panel.js +2 -2
- package/dist/esm/styles/shared/table.js +2 -1
- package/dist/esm/styles/shared/tableCell.js +24 -0
- package/dist/esm/ui/DropList/index.js +6 -3
- package/dist/esm/ui-color/ColorPalette/Color/styles.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/index.js +2 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +132 -5
- package/dist/esm/ui-color/ColorPalette/index.js +10 -11
- package/dist/esm/ui-color/index.js +1 -0
- package/dist/esm/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +2 -2
- package/dist/esm/ui-menu/Dropdown/index.js +18 -8
- package/dist/esm/ui-menu/DropdownMenu/index.js +1 -1
- package/dist/esm/utils/breakout.js +13 -5
- package/dist/esm/utils/index.js +1 -2
- package/dist/esm/utils/nodes.js +34 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/card/cardOptions.d.ts +1 -0
- package/dist/types/preset/builder.d.ts +30 -0
- package/dist/types/preset/index.d.ts +2 -0
- package/dist/types/preset/plugin-injection-api.d.ts +43 -0
- package/dist/types/provider-factory/provider-factory.d.ts +1 -1
- package/dist/types/styles/shared/tableCell.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +28 -3
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/next-editor-plugin.d.ts +56 -28
- package/dist/types/ui/DropList/index.d.ts +2 -1
- package/dist/types/ui-color/ColorPalette/Palettes/index.d.ts +1 -0
- package/dist/types/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.d.ts +648 -2
- package/dist/types/ui-color/ColorPalette/Palettes/type.d.ts +4 -0
- package/dist/types/ui-color/ColorPalette/index.d.ts +36 -17
- package/dist/types/ui-color/index.d.ts +2 -1
- package/dist/types/ui-menu/Dropdown/index.d.ts +3 -0
- package/dist/types/utils/breakout.d.ts +10 -2
- package/dist/types/utils/index.d.ts +1 -2
- package/dist/types/utils/nodes.d.ts +15 -1
- package/package.json +13 -12
- package/preset/package.json +15 -0
- package/dist/cjs/utils/builder.js +0 -34
- package/dist/es2019/utils/builder.js +0 -14
- package/dist/esm/utils/builder.js +0 -26
- package/dist/types/utils/builder.d.ts +0 -8
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import isEqual from 'lodash/isEqual';
|
|
3
|
+
import throttle from 'lodash/throttle';
|
|
4
|
+
function hasGetSharedState(plugin) {
|
|
5
|
+
return typeof plugin.getSharedState === 'function';
|
|
6
|
+
}
|
|
7
|
+
function hasActions(plugin) {
|
|
8
|
+
return typeof plugin.actions === 'object';
|
|
9
|
+
}
|
|
10
|
+
const DREAM_TARGET_60_FPS = 16;
|
|
11
|
+
/*
|
|
12
|
+
*
|
|
13
|
+
* After some investigations, we discovered this is the best ratio for our current Editor: 80ms. That means is five times bigger than the 60fps dream target.
|
|
14
|
+
*
|
|
15
|
+
* In the future, once we remove the entire WithPluginState, We may decide to reduce this value.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
const THROTTLE_CALLS_FOR_MILLISECONDS = DREAM_TARGET_60_FPS * 5;
|
|
19
|
+
const notifyListenersThrottled = throttle(({
|
|
20
|
+
newEditorState,
|
|
21
|
+
oldEditorState,
|
|
22
|
+
listeners,
|
|
23
|
+
plugins
|
|
24
|
+
}) => {
|
|
25
|
+
const isInitialization = !oldEditorState && newEditorState;
|
|
26
|
+
const callbacks = [];
|
|
27
|
+
for (let pluginName of listeners.keys()) {
|
|
28
|
+
const plugin = plugins.get(pluginName);
|
|
29
|
+
if (!plugin || !hasGetSharedState(plugin)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const nextSharedState = plugin.getSharedState(newEditorState);
|
|
33
|
+
const prevSharedState = !isInitialization && oldEditorState ? plugin.getSharedState(oldEditorState) : undefined;
|
|
34
|
+
const isSamePluginState = isEqual(prevSharedState, nextSharedState);
|
|
35
|
+
if (isInitialization || !isSamePluginState) {
|
|
36
|
+
(listeners.get(pluginName) || new Set()).forEach(callback => {
|
|
37
|
+
callbacks.push(callback.bind(callback, {
|
|
38
|
+
nextSharedState,
|
|
39
|
+
prevSharedState
|
|
40
|
+
}));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (callbacks.length === 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
callbacks.forEach(cb => {
|
|
48
|
+
cb();
|
|
49
|
+
});
|
|
50
|
+
}, THROTTLE_CALLS_FOR_MILLISECONDS);
|
|
51
|
+
export class PluginsData {}
|
|
52
|
+
class ActionsAPI {
|
|
53
|
+
createAPI(plugin) {
|
|
54
|
+
if (!plugin || !hasActions(plugin)) {
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
return new Proxy(plugin.actions || {}, {
|
|
58
|
+
get: function (target, prop, receiver) {
|
|
59
|
+
// We will be able to track perfomance here
|
|
60
|
+
return Reflect.get(target, prop);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export class SharedStateAPI {
|
|
66
|
+
constructor({
|
|
67
|
+
getEditorState
|
|
68
|
+
}) {
|
|
69
|
+
this.getEditorState = getEditorState;
|
|
70
|
+
this.listeners = new Map();
|
|
71
|
+
}
|
|
72
|
+
createAPI(plugin) {
|
|
73
|
+
if (!plugin) {
|
|
74
|
+
return {
|
|
75
|
+
currentState: () => undefined,
|
|
76
|
+
onChange: sub => {
|
|
77
|
+
return () => {};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const pluginName = plugin.name;
|
|
82
|
+
return {
|
|
83
|
+
currentState: () => {
|
|
84
|
+
const state = this.getEditorState();
|
|
85
|
+
if (!state || !hasGetSharedState(plugin)) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
return plugin.getSharedState(state);
|
|
89
|
+
},
|
|
90
|
+
onChange: sub => {
|
|
91
|
+
const pluginListeners = this.listeners.get(pluginName) || new Set();
|
|
92
|
+
pluginListeners.add(sub);
|
|
93
|
+
this.listeners.set(pluginName, pluginListeners);
|
|
94
|
+
return () => {
|
|
95
|
+
(this.listeners.get(pluginName) || new Set()).delete(sub);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
notifyListeners({
|
|
101
|
+
newEditorState,
|
|
102
|
+
oldEditorState,
|
|
103
|
+
plugins
|
|
104
|
+
}) {
|
|
105
|
+
const {
|
|
106
|
+
listeners
|
|
107
|
+
} = this;
|
|
108
|
+
notifyListenersThrottled({
|
|
109
|
+
newEditorState,
|
|
110
|
+
oldEditorState,
|
|
111
|
+
listeners,
|
|
112
|
+
plugins
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
destroy() {
|
|
116
|
+
this.listeners.clear();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export class EditorPluginInjectionAPI {
|
|
120
|
+
constructor({
|
|
121
|
+
getEditorState
|
|
122
|
+
}) {
|
|
123
|
+
_defineProperty(this, "onEditorViewUpdated", ({
|
|
124
|
+
newEditorState,
|
|
125
|
+
oldEditorState
|
|
126
|
+
}) => {
|
|
127
|
+
this.sharedStateAPI.notifyListeners({
|
|
128
|
+
newEditorState,
|
|
129
|
+
oldEditorState,
|
|
130
|
+
plugins: this.plugins
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
_defineProperty(this, "onEditorPluginInitialized", plugin => {
|
|
134
|
+
this.addPlugin(plugin);
|
|
135
|
+
});
|
|
136
|
+
_defineProperty(this, "addPlugin", plugin => {
|
|
137
|
+
this.plugins.set(plugin.name, plugin);
|
|
138
|
+
});
|
|
139
|
+
_defineProperty(this, "getPluginByName", pluginName => {
|
|
140
|
+
const plugin = this.plugins.get(pluginName);
|
|
141
|
+
return plugin;
|
|
142
|
+
});
|
|
143
|
+
this.sharedStateAPI = new SharedStateAPI({
|
|
144
|
+
getEditorState
|
|
145
|
+
});
|
|
146
|
+
this.plugins = new Map();
|
|
147
|
+
this.actionsAPI = new ActionsAPI();
|
|
148
|
+
}
|
|
149
|
+
api() {
|
|
150
|
+
const {
|
|
151
|
+
sharedStateAPI,
|
|
152
|
+
actionsAPI,
|
|
153
|
+
getPluginByName
|
|
154
|
+
} = this;
|
|
155
|
+
const externalPlugins = new Proxy({}, {
|
|
156
|
+
get: function (target, prop, receiver) {
|
|
157
|
+
const plugin = getPluginByName(prop);
|
|
158
|
+
if (!plugin) {
|
|
159
|
+
// eslint-disable-next-line
|
|
160
|
+
console.error(`Plugin: ${prop} does not exist`);
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
const sharedState = sharedStateAPI.createAPI(plugin);
|
|
164
|
+
const actions = actionsAPI.createAPI(plugin);
|
|
165
|
+
const proxyCoreAPI = {
|
|
166
|
+
sharedState,
|
|
167
|
+
actions
|
|
168
|
+
};
|
|
169
|
+
return proxyCoreAPI;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return {
|
|
173
|
+
externalPlugins
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -32,6 +32,15 @@ const mediaSingleSharedStyle = css`
|
|
|
32
32
|
margin-top: 12px;
|
|
33
33
|
margin-bottom: 12px;
|
|
34
34
|
clear: both;
|
|
35
|
+
|
|
36
|
+
&.image-wrap-left,
|
|
37
|
+
&.image-wrap-right {
|
|
38
|
+
clear: none;
|
|
39
|
+
|
|
40
|
+
&:first-child {
|
|
41
|
+
margin-top: 12px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
.${richMediaClassName}.image-wrap-right
|
|
@@ -147,11 +147,11 @@ export const PanelSharedSelectors = {
|
|
|
147
147
|
removeEmojiIcon: `[aria-label="Remove emoji"]`,
|
|
148
148
|
emojiIcon: `[aria-label="editor-add-emoji"]`,
|
|
149
149
|
selectedEmoji: `[aria-label=":grinning:"]`,
|
|
150
|
-
addYourOwnEmoji:
|
|
150
|
+
addYourOwnEmoji: `#add-custom-emoji`,
|
|
151
151
|
emojiNameInCustomEmoji: `[aria-label="Enter a name for the new emoji"]`,
|
|
152
152
|
title: `#editor-title`,
|
|
153
153
|
emojiPopup: `[aria-label="Popup"]`,
|
|
154
|
-
searchEmoji: `[aria-label="
|
|
154
|
+
searchEmoji: `[aria-label="Emoji name"]`,
|
|
155
155
|
orangeWarningIcon: `[aria-label=":warning:"]`,
|
|
156
156
|
yellowWarningIcon: `[aria-label=":warning:"] span:nth-child(1)`,
|
|
157
157
|
copyButton: `button[aria-label="Copy"]`
|
|
@@ -8,6 +8,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
8
8
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
9
9
|
import browser from '../../utils/browser';
|
|
10
10
|
import { CodeBlockSharedCssClassName } from './code-block';
|
|
11
|
+
import { tableCellBackgroundStyleOverride } from './tableCell';
|
|
11
12
|
export const tableMarginTop = 24;
|
|
12
13
|
export const tableMarginBottom = 16;
|
|
13
14
|
export const tableMarginTopWithControl = 14;
|
|
@@ -33,6 +34,7 @@ export const TableSharedCssClassName = {
|
|
|
33
34
|
TABLE_COLUMN_CONTROLS_DECORATIONS: `${tablePrefixSelector}-column-controls-decoration`
|
|
34
35
|
};
|
|
35
36
|
const tableSharedStyle = props => css`
|
|
37
|
+
${tableCellBackgroundStyleOverride()}
|
|
36
38
|
.${TableSharedCssClassName.TABLE_CONTAINER} {
|
|
37
39
|
position: relative;
|
|
38
40
|
margin: 0 auto ${tableMarginBottom}px;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
+
import { css } from '@emotion/react';
|
|
3
|
+
import { tableBackgroundColorNames } from '@atlaskit/adf-schema';
|
|
4
|
+
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
5
|
+
// This is used in order to support usage of DS tokens. Table cell background-color
|
|
6
|
+
// is set inline in '@atlaskit/adf-schema' and the color value is stored in ADF so
|
|
7
|
+
// it is not possible to use tokens there without polluting ADF.
|
|
8
|
+
// As table cell backgrounds are set inline, this should not break mobile as
|
|
9
|
+
// hexToEditorBackgroundPaletteColor() outputs a css variable with fallback hex.
|
|
10
|
+
const mapBackgroundColors = () => {
|
|
11
|
+
let cssString = '';
|
|
12
|
+
tableBackgroundColorNames.forEach((value, key) => {
|
|
13
|
+
const paletteColorValue = hexToEditorBackgroundPaletteColor(value);
|
|
14
|
+
if (paletteColorValue) {
|
|
15
|
+
cssString += `
|
|
16
|
+
td[colorname='${key}' i],
|
|
17
|
+
th[colorname='${key}' i] {
|
|
18
|
+
background-color: ${paletteColorValue} !important;
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return cssString;
|
|
24
|
+
};
|
|
25
|
+
export const tableCellBackgroundStyleOverride = () => css`
|
|
26
|
+
${mapBackgroundColors()}
|
|
27
|
+
`;
|
|
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
8
8
|
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
9
9
|
import Layer from '../Layer';
|
|
10
10
|
const packageName = "@atlaskit/editor-common";
|
|
11
|
-
const packageVersion = "72.
|
|
11
|
+
const packageVersion = "72.6.1";
|
|
12
12
|
const halfFocusRing = 1;
|
|
13
13
|
const dropOffset = `0, ${gridSize()}px`;
|
|
14
14
|
class DropList extends Component {
|
|
@@ -129,7 +129,8 @@ class DropList extends Component {
|
|
|
129
129
|
position,
|
|
130
130
|
trigger,
|
|
131
131
|
onPositioned,
|
|
132
|
-
testId
|
|
132
|
+
testId,
|
|
133
|
+
id
|
|
133
134
|
} = this.props;
|
|
134
135
|
let layerContent = isOpen ? jsx("div", {
|
|
135
136
|
css: theme => this.menuWrapper({
|
|
@@ -137,7 +138,9 @@ class DropList extends Component {
|
|
|
137
138
|
}),
|
|
138
139
|
"data-role": "droplistContent",
|
|
139
140
|
"data-testid": testId && `${testId}--content`,
|
|
140
|
-
ref: this.handleContentRef
|
|
141
|
+
ref: this.handleContentRef,
|
|
142
|
+
id: id,
|
|
143
|
+
role: "menu"
|
|
141
144
|
}, children) : null;
|
|
142
145
|
return jsx("div", {
|
|
143
146
|
css: this.wrapperStyles
|
|
@@ -25,8 +25,10 @@ export const buttonWrapperStyle = css`
|
|
|
25
25
|
align-items: center;
|
|
26
26
|
padding: 1px;
|
|
27
27
|
border-radius: 6px;
|
|
28
|
+
&:focus-within,
|
|
29
|
+
&:focus,
|
|
28
30
|
&:hover {
|
|
29
|
-
border-color: ${N50};
|
|
31
|
+
border-color: ${N50} !important;
|
|
30
32
|
}
|
|
31
33
|
`;
|
|
32
34
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { DEFAULT_BORDER_COLOR } from './common';
|
|
1
|
+
export { DEFAULT_BORDER_COLOR } from './common';
|
|
2
|
+
export { textPaletteTooltipMessages, backgroundPaletteTooltipMessages } from './paletteMessagesTokenModeNames';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl-next';
|
|
2
2
|
|
|
3
|
-
// These messages are only to be used when
|
|
4
|
-
|
|
5
|
-
export const newLightPalette = defineMessages({
|
|
3
|
+
// These messages are only to be used when showSomewhatSemanticTooltips is true.
|
|
4
|
+
export const lightTextPaletteTooltipMessages = defineMessages({
|
|
6
5
|
'#FFFFFF': {
|
|
7
6
|
id: 'fabric.theme.white',
|
|
8
7
|
defaultMessage: 'White',
|
|
@@ -109,14 +108,145 @@ export const newLightPalette = defineMessages({
|
|
|
109
108
|
description: 'Name of a color'
|
|
110
109
|
}
|
|
111
110
|
});
|
|
112
|
-
const
|
|
111
|
+
const darkModeTextPaletteOverrides = defineMessages({
|
|
113
112
|
'#FFFFFF': {
|
|
114
113
|
id: 'fabric.theme.dark-gray',
|
|
115
114
|
defaultMessage: 'Dark gray',
|
|
116
115
|
description: 'Name of a color'
|
|
117
116
|
}
|
|
118
117
|
});
|
|
119
|
-
export const
|
|
120
|
-
...
|
|
121
|
-
...
|
|
118
|
+
export const darkTextPaletteTooltipMessages = {
|
|
119
|
+
...lightTextPaletteTooltipMessages,
|
|
120
|
+
...darkModeTextPaletteOverrides
|
|
121
|
+
};
|
|
122
|
+
export const textPaletteTooltipMessages = {
|
|
123
|
+
light: lightTextPaletteTooltipMessages,
|
|
124
|
+
dark: darkTextPaletteTooltipMessages
|
|
125
|
+
};
|
|
126
|
+
export const lightBackgroundPaletteTooltipMessages = defineMessages({
|
|
127
|
+
'#DEEBFF': {
|
|
128
|
+
id: 'fabric.theme.subtle-blue',
|
|
129
|
+
defaultMessage: 'Subtle blue',
|
|
130
|
+
description: 'Name of a color'
|
|
131
|
+
},
|
|
132
|
+
'#B3D4FF': {
|
|
133
|
+
id: 'fabric.theme.blue',
|
|
134
|
+
defaultMessage: 'Blue',
|
|
135
|
+
description: 'Name of a color'
|
|
136
|
+
},
|
|
137
|
+
'#4C9AFF': {
|
|
138
|
+
id: 'fabric.theme.bold-blue',
|
|
139
|
+
defaultMessage: 'Bold blue',
|
|
140
|
+
description: 'Name of a color'
|
|
141
|
+
},
|
|
142
|
+
'#E6FCFF': {
|
|
143
|
+
id: 'fabric.theme.subtle-teal',
|
|
144
|
+
defaultMessage: 'Subtle teal',
|
|
145
|
+
description: 'Name of a color'
|
|
146
|
+
},
|
|
147
|
+
'#B3F5FF': {
|
|
148
|
+
id: 'fabric.theme.teal',
|
|
149
|
+
defaultMessage: 'Teal',
|
|
150
|
+
description: 'Name of a color'
|
|
151
|
+
},
|
|
152
|
+
'#79E2F2': {
|
|
153
|
+
id: 'fabric.theme.bold-teal',
|
|
154
|
+
defaultMessage: 'Bold teal',
|
|
155
|
+
description: 'Name of a color'
|
|
156
|
+
},
|
|
157
|
+
'#E3FCEF': {
|
|
158
|
+
id: 'fabric.theme.subtle-green',
|
|
159
|
+
defaultMessage: 'Subtle green',
|
|
160
|
+
description: 'Name of a color'
|
|
161
|
+
},
|
|
162
|
+
'#ABF5D1': {
|
|
163
|
+
id: 'fabric.theme.green',
|
|
164
|
+
defaultMessage: 'Green',
|
|
165
|
+
description: 'Name of a color'
|
|
166
|
+
},
|
|
167
|
+
'#57D9A3': {
|
|
168
|
+
id: 'fabric.theme.bold-green',
|
|
169
|
+
defaultMessage: 'Bold green',
|
|
170
|
+
description: 'Name of a color'
|
|
171
|
+
},
|
|
172
|
+
'#FFFAE6': {
|
|
173
|
+
id: 'fabric.theme.subtle-yellow',
|
|
174
|
+
defaultMessage: 'Subtle yellow',
|
|
175
|
+
description: 'Name of a color'
|
|
176
|
+
},
|
|
177
|
+
'#FFF0B3': {
|
|
178
|
+
id: 'fabric.theme.yellow',
|
|
179
|
+
defaultMessage: 'Yellow',
|
|
180
|
+
description: 'Name of a color'
|
|
181
|
+
},
|
|
182
|
+
'#FFC400': {
|
|
183
|
+
id: 'fabric.theme.bold-yellow',
|
|
184
|
+
defaultMessage: 'Bold yellow',
|
|
185
|
+
description: 'Name of a color'
|
|
186
|
+
},
|
|
187
|
+
'#FFEBE6': {
|
|
188
|
+
id: 'fabric.theme.subtle-red',
|
|
189
|
+
defaultMessage: 'Subtle red',
|
|
190
|
+
description: 'Name of a color'
|
|
191
|
+
},
|
|
192
|
+
'#FFBDAD': {
|
|
193
|
+
id: 'fabric.theme.red',
|
|
194
|
+
defaultMessage: 'Red',
|
|
195
|
+
description: 'Name of a color.'
|
|
196
|
+
},
|
|
197
|
+
'#FF8F73': {
|
|
198
|
+
id: 'fabric.theme.bold-red',
|
|
199
|
+
defaultMessage: 'Bold red',
|
|
200
|
+
description: 'Name of a color'
|
|
201
|
+
},
|
|
202
|
+
'#EAE6FF': {
|
|
203
|
+
id: 'fabric.theme.subtle-purple',
|
|
204
|
+
defaultMessage: 'Subtle purple',
|
|
205
|
+
description: 'Name of a color'
|
|
206
|
+
},
|
|
207
|
+
'#C0B6F2': {
|
|
208
|
+
id: 'fabric.theme.purple',
|
|
209
|
+
defaultMessage: 'Purple',
|
|
210
|
+
description: 'Name of a color'
|
|
211
|
+
},
|
|
212
|
+
'#998DD9': {
|
|
213
|
+
id: 'fabric.theme.bold-purple',
|
|
214
|
+
defaultMessage: 'Bold purple',
|
|
215
|
+
description: 'Name of a color'
|
|
216
|
+
},
|
|
217
|
+
'#FFFFFF': {
|
|
218
|
+
id: 'fabric.theme.white',
|
|
219
|
+
defaultMessage: 'White',
|
|
220
|
+
description: 'Name of a color'
|
|
221
|
+
},
|
|
222
|
+
'#F4F5F7': {
|
|
223
|
+
id: 'fabric.theme.gray',
|
|
224
|
+
defaultMessage: 'Gray',
|
|
225
|
+
description: 'Name of a color'
|
|
226
|
+
},
|
|
227
|
+
'#B3BAC5': {
|
|
228
|
+
id: 'fabric.theme.bold-gray',
|
|
229
|
+
defaultMessage: 'Bold gray',
|
|
230
|
+
description: 'Name of a color'
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
const darkModeBackgroundPaletteOverrides = defineMessages({
|
|
234
|
+
'#FFFFFF': {
|
|
235
|
+
id: 'fabric.theme.subtle-gray',
|
|
236
|
+
defaultMessage: 'Subtle gray',
|
|
237
|
+
description: 'Name of a color'
|
|
238
|
+
},
|
|
239
|
+
'#B3BAC5': {
|
|
240
|
+
id: 'fabric.theme.bold-gray',
|
|
241
|
+
defaultMessage: 'Bold gray',
|
|
242
|
+
description: 'Name of a color'
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
export const darkBackgroundPaletteTooltipMessages = {
|
|
246
|
+
...lightBackgroundPaletteTooltipMessages,
|
|
247
|
+
...darkModeBackgroundPaletteOverrides
|
|
248
|
+
};
|
|
249
|
+
export const backgroundPaletteTooltipMessages = {
|
|
250
|
+
light: lightBackgroundPaletteTooltipMessages,
|
|
251
|
+
dark: darkBackgroundPaletteTooltipMessages
|
|
122
252
|
};
|
|
@@ -7,7 +7,6 @@ import { N0, N500 } from '@atlaskit/theme/colors';
|
|
|
7
7
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
8
8
|
import Color from './Color';
|
|
9
9
|
import getColorMessage from './Palettes/getColorMessage';
|
|
10
|
-
import { newDarkPalette, newLightPalette } from './Palettes/paletteMessagesTokenModeNames';
|
|
11
10
|
import { colorPaletteWrapper } from './styles';
|
|
12
11
|
import { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette } from './utils';
|
|
13
12
|
/**
|
|
@@ -32,7 +31,6 @@ function getCheckMarkColor(color, useIconToken) {
|
|
|
32
31
|
}
|
|
33
32
|
const ColorPalette = props => {
|
|
34
33
|
const {
|
|
35
|
-
palette,
|
|
36
34
|
cols = DEFAULT_COLOR_PICKER_COLUMNS,
|
|
37
35
|
onClick,
|
|
38
36
|
selectedColor,
|
|
@@ -40,10 +38,14 @@ const ColorPalette = props => {
|
|
|
40
38
|
intl: {
|
|
41
39
|
formatMessage
|
|
42
40
|
},
|
|
43
|
-
|
|
44
|
-
hexToPaletteColor,
|
|
45
|
-
useSomewhatSemanticTextColorNames = false
|
|
41
|
+
paletteOptions
|
|
46
42
|
} = props;
|
|
43
|
+
const {
|
|
44
|
+
palette,
|
|
45
|
+
hexToPaletteColor,
|
|
46
|
+
showSomewhatSemanticTooltips = false,
|
|
47
|
+
paletteColorTooltipMessages
|
|
48
|
+
} = paletteOptions;
|
|
47
49
|
const {
|
|
48
50
|
colorMode: tokenTheme
|
|
49
51
|
} = useThemeObserver();
|
|
@@ -62,12 +64,12 @@ const ColorPalette = props => {
|
|
|
62
64
|
border,
|
|
63
65
|
message
|
|
64
66
|
}, colorIdx) => {
|
|
65
|
-
if (
|
|
67
|
+
if (showSomewhatSemanticTooltips && paletteColorTooltipMessages) {
|
|
66
68
|
if (tokenTheme === 'dark') {
|
|
67
|
-
message = getColorMessage(
|
|
69
|
+
message = getColorMessage(paletteColorTooltipMessages.dark, value.toUpperCase());
|
|
68
70
|
}
|
|
69
71
|
if (tokenTheme === 'light') {
|
|
70
|
-
message = getColorMessage(
|
|
72
|
+
message = getColorMessage(paletteColorTooltipMessages.light, value.toUpperCase());
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
return jsx(Color, {
|
|
@@ -6,4 +6,5 @@ export { default as colorPaletteMessages } from './ColorPalette/Palettes/palette
|
|
|
6
6
|
export { panelBackgroundPalette, panelDarkModeBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
|
7
7
|
export { lightModeStatusColorPalette, darkModeStatusColorPalette } from './ColorPalette/Palettes/statusColorPalette';
|
|
8
8
|
export { textColorPalette } from './ColorPalette/Palettes/textColorPalette';
|
|
9
|
+
export { backgroundPaletteTooltipMessages, textPaletteTooltipMessages } from './ColorPalette/Palettes';
|
|
9
10
|
export { DEFAULT_BORDER_COLOR } from './ColorPalette/Palettes/common';
|
package/dist/es2019/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js
CHANGED
|
@@ -101,20 +101,20 @@ export const MenuArrowKeyNavigationProvider = ({
|
|
|
101
101
|
if (!targetElement.closest('.custom-key-handler-wrapper')) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
+
handleClose(event);
|
|
104
105
|
if (!targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
105
106
|
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowLeft();
|
|
106
107
|
}
|
|
107
|
-
handleClose(event);
|
|
108
108
|
break;
|
|
109
109
|
case 'ArrowRight':
|
|
110
110
|
//Filter out the events from outside the menu
|
|
111
111
|
if (!targetElement.closest('.custom-key-handler-wrapper')) {
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
+
handleClose(event);
|
|
114
115
|
if (!targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
115
116
|
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowRight();
|
|
116
117
|
}
|
|
117
|
-
handleClose(event);
|
|
118
118
|
break;
|
|
119
119
|
case 'Escape':
|
|
120
120
|
handleClose(event);
|
|
@@ -24,6 +24,19 @@ export class Dropdown extends PureComponent {
|
|
|
24
24
|
popupPlacement: placement
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
+
_defineProperty(this, "handleCloseAndFocus", event => {
|
|
28
|
+
var _this$state$target, _this$state$target$qu;
|
|
29
|
+
(_this$state$target = this.state.target) === null || _this$state$target === void 0 ? void 0 : (_this$state$target$qu = _this$state$target.querySelector('button')) === null || _this$state$target$qu === void 0 ? void 0 : _this$state$target$qu.focus();
|
|
30
|
+
this.handleClose(event);
|
|
31
|
+
});
|
|
32
|
+
_defineProperty(this, "handleClose", event => {
|
|
33
|
+
if (this.props.onOpenChange) {
|
|
34
|
+
this.props.onOpenChange({
|
|
35
|
+
isOpen: false,
|
|
36
|
+
event
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
27
40
|
this.state = {
|
|
28
41
|
popupPlacement: ['bottom', 'left']
|
|
29
42
|
};
|
|
@@ -42,7 +55,8 @@ export class Dropdown extends PureComponent {
|
|
|
42
55
|
fitHeight,
|
|
43
56
|
fitWidth,
|
|
44
57
|
zIndex,
|
|
45
|
-
arrowKeyNavigationProviderOptions
|
|
58
|
+
arrowKeyNavigationProviderOptions,
|
|
59
|
+
dropdownListId
|
|
46
60
|
} = this.props;
|
|
47
61
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
48
62
|
target: target,
|
|
@@ -55,10 +69,7 @@ export class Dropdown extends PureComponent {
|
|
|
55
69
|
zIndex: zIndex
|
|
56
70
|
}, /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, _extends({}, arrowKeyNavigationProviderOptions, {
|
|
57
71
|
closeOnTab: true,
|
|
58
|
-
handleClose:
|
|
59
|
-
isOpen: false,
|
|
60
|
-
event
|
|
61
|
-
})
|
|
72
|
+
handleClose: this.handleCloseAndFocus
|
|
62
73
|
}), /*#__PURE__*/React.createElement("div", {
|
|
63
74
|
style: {
|
|
64
75
|
height: 0,
|
|
@@ -68,7 +79,8 @@ export class Dropdown extends PureComponent {
|
|
|
68
79
|
isOpen: true,
|
|
69
80
|
onOpenChange: onOpenChange,
|
|
70
81
|
position: popupPlacement.join(' '),
|
|
71
|
-
shouldFitContainer: true
|
|
82
|
+
shouldFitContainer: true,
|
|
83
|
+
id: dropdownListId
|
|
72
84
|
}, children))));
|
|
73
85
|
}
|
|
74
86
|
render() {
|
|
@@ -113,8 +113,8 @@ export default class DropdownMenuWrapper extends PureComponent {
|
|
|
113
113
|
});
|
|
114
114
|
_defineProperty(this, "handleCloseAndFocus", () => {
|
|
115
115
|
var _this$state$target, _this$state$target$qu;
|
|
116
|
-
this.handleClose();
|
|
117
116
|
(_this$state$target = this.state.target) === null || _this$state$target === void 0 ? void 0 : (_this$state$target$qu = _this$state$target.querySelector('button')) === null || _this$state$target$qu === void 0 ? void 0 : _this$state$target$qu.focus();
|
|
117
|
+
this.handleClose();
|
|
118
118
|
});
|
|
119
119
|
_defineProperty(this, "handleClose", () => {
|
|
120
120
|
if (this.props.onOpenChange) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { akEditorBreakoutPadding, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
|
|
1
|
+
import { akEditorBreakoutPadding, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorSwoopCubicBezier, akEditorWideLayoutWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
|
|
2
2
|
import { mapBreakpointToLayoutMaxWidth } from '../ui/BaseTheme';
|
|
3
3
|
import { getBreakpoint } from '../ui/WidthProvider';
|
|
4
4
|
import { parsePx } from './dom';
|
|
@@ -74,11 +74,15 @@ export function calculateBreakoutStyles({
|
|
|
74
74
|
// it breaks things like sticky headers.
|
|
75
75
|
//
|
|
76
76
|
// It can also cause bluriness for some child content (such as iframes)
|
|
77
|
+
|
|
77
78
|
return {
|
|
78
79
|
type: 'line-length-unknown',
|
|
79
80
|
width: breakoutWidth,
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
minWidth: breakoutWidthPx,
|
|
82
|
+
display: 'flex',
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
transform: 'none',
|
|
85
|
+
transition: `min-width 0.5s ${akEditorSwoopCubicBezier}`
|
|
82
86
|
};
|
|
83
87
|
}
|
|
84
88
|
|
|
@@ -87,11 +91,15 @@ export function calculateBreakoutStyles({
|
|
|
87
91
|
// full-page appearance modes. There is a slight delay before
|
|
88
92
|
// the widthState is updated.
|
|
89
93
|
// During this period -- the marginLeftPx will be incorrect.
|
|
90
|
-
const marginLeftPx = -(breakoutWidthPx - widthStateLineLength) / 2;
|
|
94
|
+
// const marginLeftPx = -(breakoutWidthPx - widthStateLineLength) / 2;
|
|
95
|
+
|
|
91
96
|
return {
|
|
92
97
|
type: 'line-length-known',
|
|
93
98
|
width: breakoutWidth,
|
|
94
|
-
|
|
99
|
+
minWidth: breakoutWidthPx,
|
|
100
|
+
transition: `min-width 0.5s ${akEditorSwoopCubicBezier}`,
|
|
101
|
+
transform: `translateX(-50%)`,
|
|
102
|
+
marginLeft: `50%`
|
|
95
103
|
};
|
|
96
104
|
}
|
|
97
105
|
export function calcBreakoutWidthPx(mode, widthStateWidth) {
|
|
@@ -6,7 +6,7 @@ export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskCon
|
|
|
6
6
|
export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition } from './editor-core-utils';
|
|
7
7
|
export { withImageLoader } from './imageLoader';
|
|
8
8
|
export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx } from './breakout';
|
|
9
|
-
export { findChangedNodesFromTransaction, validNode, validateNodes, isType, isParagraph, isText, isLinkMark, SelectedState, isNodeSelectedOrInRange, isSupportedInParent } from './nodes';
|
|
9
|
+
export { findChangedNodesFromTransaction, validNode, validateNodes, isType, isParagraph, isText, isLinkMark, SelectedState, isNodeSelectedOrInRange, isSupportedInParent, isMediaNode, isNodeBeforeMediaNode } from './nodes';
|
|
10
10
|
export { pluginFactory } from './plugin-state-factory';
|
|
11
11
|
export { getFragmentBackingArray, mapFragment, mapSlice, flatmap, mapChildren } from './slice';
|
|
12
12
|
export { walkUpTreeUntil, unwrap, removeNestedEmptyEls, containsClassName, closest, closestElement, parsePx, mapElem, maphElem } from './dom';
|
|
@@ -35,5 +35,4 @@ export { useComponentRenderTracking } from './performance/hooks/use-component-re
|
|
|
35
35
|
export { isOutdatedBrowser } from './outdated-browsers';
|
|
36
36
|
export { isReferencedSource, removeConnectedNodes, getChildrenInfo, getNodeName } from './referentiality';
|
|
37
37
|
export { sendLogs } from './sendLogs';
|
|
38
|
-
export { Builder } from './builder';
|
|
39
38
|
export { getItemCounterDigitsSize, getOrderFromOrderedListNode, resolveOrder } from './list';
|