@atlaskit/editor-common 72.5.1 → 72.6.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 +41 -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 +18 -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
|
@@ -9,4 +9,17 @@ Object.defineProperty(exports, "DEFAULT_BORDER_COLOR", {
|
|
|
9
9
|
return _common.DEFAULT_BORDER_COLOR;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
Object.defineProperty(exports, "backgroundPaletteTooltipMessages", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _paletteMessagesTokenModeNames.backgroundPaletteTooltipMessages;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "textPaletteTooltipMessages", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _paletteMessagesTokenModeNames.textPaletteTooltipMessages;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _common = require("./common");
|
|
25
|
+
var _paletteMessagesTokenModeNames = require("./paletteMessagesTokenModeNames");
|
|
@@ -4,14 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.textPaletteTooltipMessages = exports.lightTextPaletteTooltipMessages = exports.lightBackgroundPaletteTooltipMessages = exports.darkTextPaletteTooltipMessages = exports.darkBackgroundPaletteTooltipMessages = exports.backgroundPaletteTooltipMessages = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
// These messages are only to be used when
|
|
13
|
-
|
|
14
|
-
var newLightPalette = (0, _reactIntlNext.defineMessages)({
|
|
12
|
+
// These messages are only to be used when showSomewhatSemanticTooltips is true.
|
|
13
|
+
var lightTextPaletteTooltipMessages = (0, _reactIntlNext.defineMessages)({
|
|
15
14
|
'#FFFFFF': {
|
|
16
15
|
id: 'fabric.theme.white',
|
|
17
16
|
defaultMessage: 'White',
|
|
@@ -118,13 +117,145 @@ var newLightPalette = (0, _reactIntlNext.defineMessages)({
|
|
|
118
117
|
description: 'Name of a color'
|
|
119
118
|
}
|
|
120
119
|
});
|
|
121
|
-
exports.
|
|
122
|
-
var
|
|
120
|
+
exports.lightTextPaletteTooltipMessages = lightTextPaletteTooltipMessages;
|
|
121
|
+
var darkModeTextPaletteOverrides = (0, _reactIntlNext.defineMessages)({
|
|
123
122
|
'#FFFFFF': {
|
|
124
123
|
id: 'fabric.theme.dark-gray',
|
|
125
124
|
defaultMessage: 'Dark gray',
|
|
126
125
|
description: 'Name of a color'
|
|
127
126
|
}
|
|
128
127
|
});
|
|
129
|
-
var
|
|
130
|
-
exports.
|
|
128
|
+
var darkTextPaletteTooltipMessages = _objectSpread(_objectSpread({}, lightTextPaletteTooltipMessages), darkModeTextPaletteOverrides);
|
|
129
|
+
exports.darkTextPaletteTooltipMessages = darkTextPaletteTooltipMessages;
|
|
130
|
+
var textPaletteTooltipMessages = {
|
|
131
|
+
light: lightTextPaletteTooltipMessages,
|
|
132
|
+
dark: darkTextPaletteTooltipMessages
|
|
133
|
+
};
|
|
134
|
+
exports.textPaletteTooltipMessages = textPaletteTooltipMessages;
|
|
135
|
+
var lightBackgroundPaletteTooltipMessages = (0, _reactIntlNext.defineMessages)({
|
|
136
|
+
'#DEEBFF': {
|
|
137
|
+
id: 'fabric.theme.subtle-blue',
|
|
138
|
+
defaultMessage: 'Subtle blue',
|
|
139
|
+
description: 'Name of a color'
|
|
140
|
+
},
|
|
141
|
+
'#B3D4FF': {
|
|
142
|
+
id: 'fabric.theme.blue',
|
|
143
|
+
defaultMessage: 'Blue',
|
|
144
|
+
description: 'Name of a color'
|
|
145
|
+
},
|
|
146
|
+
'#4C9AFF': {
|
|
147
|
+
id: 'fabric.theme.bold-blue',
|
|
148
|
+
defaultMessage: 'Bold blue',
|
|
149
|
+
description: 'Name of a color'
|
|
150
|
+
},
|
|
151
|
+
'#E6FCFF': {
|
|
152
|
+
id: 'fabric.theme.subtle-teal',
|
|
153
|
+
defaultMessage: 'Subtle teal',
|
|
154
|
+
description: 'Name of a color'
|
|
155
|
+
},
|
|
156
|
+
'#B3F5FF': {
|
|
157
|
+
id: 'fabric.theme.teal',
|
|
158
|
+
defaultMessage: 'Teal',
|
|
159
|
+
description: 'Name of a color'
|
|
160
|
+
},
|
|
161
|
+
'#79E2F2': {
|
|
162
|
+
id: 'fabric.theme.bold-teal',
|
|
163
|
+
defaultMessage: 'Bold teal',
|
|
164
|
+
description: 'Name of a color'
|
|
165
|
+
},
|
|
166
|
+
'#E3FCEF': {
|
|
167
|
+
id: 'fabric.theme.subtle-green',
|
|
168
|
+
defaultMessage: 'Subtle green',
|
|
169
|
+
description: 'Name of a color'
|
|
170
|
+
},
|
|
171
|
+
'#ABF5D1': {
|
|
172
|
+
id: 'fabric.theme.green',
|
|
173
|
+
defaultMessage: 'Green',
|
|
174
|
+
description: 'Name of a color'
|
|
175
|
+
},
|
|
176
|
+
'#57D9A3': {
|
|
177
|
+
id: 'fabric.theme.bold-green',
|
|
178
|
+
defaultMessage: 'Bold green',
|
|
179
|
+
description: 'Name of a color'
|
|
180
|
+
},
|
|
181
|
+
'#FFFAE6': {
|
|
182
|
+
id: 'fabric.theme.subtle-yellow',
|
|
183
|
+
defaultMessage: 'Subtle yellow',
|
|
184
|
+
description: 'Name of a color'
|
|
185
|
+
},
|
|
186
|
+
'#FFF0B3': {
|
|
187
|
+
id: 'fabric.theme.yellow',
|
|
188
|
+
defaultMessage: 'Yellow',
|
|
189
|
+
description: 'Name of a color'
|
|
190
|
+
},
|
|
191
|
+
'#FFC400': {
|
|
192
|
+
id: 'fabric.theme.bold-yellow',
|
|
193
|
+
defaultMessage: 'Bold yellow',
|
|
194
|
+
description: 'Name of a color'
|
|
195
|
+
},
|
|
196
|
+
'#FFEBE6': {
|
|
197
|
+
id: 'fabric.theme.subtle-red',
|
|
198
|
+
defaultMessage: 'Subtle red',
|
|
199
|
+
description: 'Name of a color'
|
|
200
|
+
},
|
|
201
|
+
'#FFBDAD': {
|
|
202
|
+
id: 'fabric.theme.red',
|
|
203
|
+
defaultMessage: 'Red',
|
|
204
|
+
description: 'Name of a color.'
|
|
205
|
+
},
|
|
206
|
+
'#FF8F73': {
|
|
207
|
+
id: 'fabric.theme.bold-red',
|
|
208
|
+
defaultMessage: 'Bold red',
|
|
209
|
+
description: 'Name of a color'
|
|
210
|
+
},
|
|
211
|
+
'#EAE6FF': {
|
|
212
|
+
id: 'fabric.theme.subtle-purple',
|
|
213
|
+
defaultMessage: 'Subtle purple',
|
|
214
|
+
description: 'Name of a color'
|
|
215
|
+
},
|
|
216
|
+
'#C0B6F2': {
|
|
217
|
+
id: 'fabric.theme.purple',
|
|
218
|
+
defaultMessage: 'Purple',
|
|
219
|
+
description: 'Name of a color'
|
|
220
|
+
},
|
|
221
|
+
'#998DD9': {
|
|
222
|
+
id: 'fabric.theme.bold-purple',
|
|
223
|
+
defaultMessage: 'Bold purple',
|
|
224
|
+
description: 'Name of a color'
|
|
225
|
+
},
|
|
226
|
+
'#FFFFFF': {
|
|
227
|
+
id: 'fabric.theme.white',
|
|
228
|
+
defaultMessage: 'White',
|
|
229
|
+
description: 'Name of a color'
|
|
230
|
+
},
|
|
231
|
+
'#F4F5F7': {
|
|
232
|
+
id: 'fabric.theme.gray',
|
|
233
|
+
defaultMessage: 'Gray',
|
|
234
|
+
description: 'Name of a color'
|
|
235
|
+
},
|
|
236
|
+
'#B3BAC5': {
|
|
237
|
+
id: 'fabric.theme.bold-gray',
|
|
238
|
+
defaultMessage: 'Bold gray',
|
|
239
|
+
description: 'Name of a color'
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
exports.lightBackgroundPaletteTooltipMessages = lightBackgroundPaletteTooltipMessages;
|
|
243
|
+
var darkModeBackgroundPaletteOverrides = (0, _reactIntlNext.defineMessages)({
|
|
244
|
+
'#FFFFFF': {
|
|
245
|
+
id: 'fabric.theme.subtle-gray',
|
|
246
|
+
defaultMessage: 'Subtle gray',
|
|
247
|
+
description: 'Name of a color'
|
|
248
|
+
},
|
|
249
|
+
'#B3BAC5': {
|
|
250
|
+
id: 'fabric.theme.bold-gray',
|
|
251
|
+
defaultMessage: 'Bold gray',
|
|
252
|
+
description: 'Name of a color'
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
var darkBackgroundPaletteTooltipMessages = _objectSpread(_objectSpread({}, lightBackgroundPaletteTooltipMessages), darkModeBackgroundPaletteOverrides);
|
|
256
|
+
exports.darkBackgroundPaletteTooltipMessages = darkBackgroundPaletteTooltipMessages;
|
|
257
|
+
var backgroundPaletteTooltipMessages = {
|
|
258
|
+
light: lightBackgroundPaletteTooltipMessages,
|
|
259
|
+
dark: darkBackgroundPaletteTooltipMessages
|
|
260
|
+
};
|
|
261
|
+
exports.backgroundPaletteTooltipMessages = backgroundPaletteTooltipMessages;
|
|
@@ -13,7 +13,6 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
13
13
|
var _tokens = require("@atlaskit/tokens");
|
|
14
14
|
var _Color = _interopRequireDefault(require("./Color"));
|
|
15
15
|
var _getColorMessage = _interopRequireDefault(require("./Palettes/getColorMessage"));
|
|
16
|
-
var _paletteMessagesTokenModeNames = require("./Palettes/paletteMessagesTokenModeNames");
|
|
17
16
|
var _styles = require("./styles");
|
|
18
17
|
var _utils = require("./utils");
|
|
19
18
|
/** @jsx jsx */
|
|
@@ -41,18 +40,18 @@ function getCheckMarkColor(color, useIconToken) {
|
|
|
41
40
|
return contrastColor === _colors.N0 ? "var(--ds-icon-inverse, ".concat(_colors.N0, ")") : "var(--ds-icon, ".concat(_colors.N500, ")");
|
|
42
41
|
}
|
|
43
42
|
var ColorPalette = function ColorPalette(props) {
|
|
44
|
-
var
|
|
45
|
-
_props$cols = props.cols,
|
|
43
|
+
var _props$cols = props.cols,
|
|
46
44
|
cols = _props$cols === void 0 ? _utils.DEFAULT_COLOR_PICKER_COLUMNS : _props$cols,
|
|
47
45
|
onClick = props.onClick,
|
|
48
46
|
selectedColor = props.selectedColor,
|
|
49
47
|
className = props.className,
|
|
50
48
|
formatMessage = props.intl.formatMessage,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
hexToPaletteColor =
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
paletteOptions = props.paletteOptions;
|
|
50
|
+
var palette = paletteOptions.palette,
|
|
51
|
+
hexToPaletteColor = paletteOptions.hexToPaletteColor,
|
|
52
|
+
_paletteOptions$showS = paletteOptions.showSomewhatSemanticTooltips,
|
|
53
|
+
showSomewhatSemanticTooltips = _paletteOptions$showS === void 0 ? false : _paletteOptions$showS,
|
|
54
|
+
paletteColorTooltipMessages = paletteOptions.paletteColorTooltipMessages;
|
|
56
55
|
var _useThemeObserver = (0, _tokens.useThemeObserver)(),
|
|
57
56
|
tokenTheme = _useThemeObserver.colorMode;
|
|
58
57
|
var useIconToken = !!hexToPaletteColor;
|
|
@@ -70,12 +69,12 @@ var ColorPalette = function ColorPalette(props) {
|
|
|
70
69
|
label = _ref.label,
|
|
71
70
|
border = _ref.border,
|
|
72
71
|
message = _ref.message;
|
|
73
|
-
if (
|
|
72
|
+
if (showSomewhatSemanticTooltips && paletteColorTooltipMessages) {
|
|
74
73
|
if (tokenTheme === 'dark') {
|
|
75
|
-
message = (0, _getColorMessage.default)(
|
|
74
|
+
message = (0, _getColorMessage.default)(paletteColorTooltipMessages.dark, value.toUpperCase());
|
|
76
75
|
}
|
|
77
76
|
if (tokenTheme === 'light') {
|
|
78
|
-
message = (0, _getColorMessage.default)(
|
|
77
|
+
message = (0, _getColorMessage.default)(paletteColorTooltipMessages.light, value.toUpperCase());
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
return (0, _react2.jsx)(_Color.default, {
|
|
@@ -28,6 +28,12 @@ Object.defineProperty(exports, "DEFAULT_COLOR_PICKER_COLUMNS", {
|
|
|
28
28
|
return _utils.DEFAULT_COLOR_PICKER_COLUMNS;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
Object.defineProperty(exports, "backgroundPaletteTooltipMessages", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _Palettes.backgroundPaletteTooltipMessages;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
31
37
|
Object.defineProperty(exports, "cellBackgroundColorPalette", {
|
|
32
38
|
enumerable: true,
|
|
33
39
|
get: function get() {
|
|
@@ -88,6 +94,12 @@ Object.defineProperty(exports, "textColorPalette", {
|
|
|
88
94
|
return _textColorPalette.textColorPalette;
|
|
89
95
|
}
|
|
90
96
|
});
|
|
97
|
+
Object.defineProperty(exports, "textPaletteTooltipMessages", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function get() {
|
|
100
|
+
return _Palettes.textPaletteTooltipMessages;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
91
103
|
var _ColorPalette = _interopRequireDefault(require("./ColorPalette"));
|
|
92
104
|
var _Color = _interopRequireDefault(require("./ColorPalette/Color"));
|
|
93
105
|
var _utils = require("./ColorPalette/utils");
|
|
@@ -96,4 +108,5 @@ var _paletteMessages = _interopRequireDefault(require("./ColorPalette/Palettes/p
|
|
|
96
108
|
var _panelBackgroundPalette = require("./ColorPalette/Palettes/panelBackgroundPalette");
|
|
97
109
|
var _statusColorPalette = require("./ColorPalette/Palettes/statusColorPalette");
|
|
98
110
|
var _textColorPalette = require("./ColorPalette/Palettes/textColorPalette");
|
|
111
|
+
var _Palettes = require("./ColorPalette/Palettes");
|
|
99
112
|
var _common = require("./ColorPalette/Palettes/common");
|
|
@@ -114,20 +114,20 @@ var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvider(_re
|
|
|
114
114
|
if (!targetElement.closest('.custom-key-handler-wrapper')) {
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
+
handleClose(event);
|
|
117
118
|
if (!targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
118
119
|
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowLeft();
|
|
119
120
|
}
|
|
120
|
-
handleClose(event);
|
|
121
121
|
break;
|
|
122
122
|
case 'ArrowRight':
|
|
123
123
|
//Filter out the events from outside the menu
|
|
124
124
|
if (!targetElement.closest('.custom-key-handler-wrapper')) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
+
handleClose(event);
|
|
127
128
|
if (!targetElement.closest('[data-testid="editor-floating-toolbar"]')) {
|
|
128
129
|
keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleArrowRight();
|
|
129
130
|
}
|
|
130
|
-
handleClose(event);
|
|
131
131
|
break;
|
|
132
132
|
case 'Escape':
|
|
133
133
|
handleClose(event);
|
|
@@ -46,6 +46,19 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
|
|
|
46
46
|
popupPlacement: placement
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleCloseAndFocus", function (event) {
|
|
50
|
+
var _this$state$target, _this$state$target$qu;
|
|
51
|
+
(_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();
|
|
52
|
+
_this.handleClose(event);
|
|
53
|
+
});
|
|
54
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClose", function (event) {
|
|
55
|
+
if (_this.props.onOpenChange) {
|
|
56
|
+
_this.props.onOpenChange({
|
|
57
|
+
isOpen: false,
|
|
58
|
+
event: event
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
49
62
|
_this.state = {
|
|
50
63
|
popupPlacement: ['bottom', 'left']
|
|
51
64
|
};
|
|
@@ -66,7 +79,8 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
|
|
|
66
79
|
fitHeight = _this$props.fitHeight,
|
|
67
80
|
fitWidth = _this$props.fitWidth,
|
|
68
81
|
zIndex = _this$props.zIndex,
|
|
69
|
-
arrowKeyNavigationProviderOptions = _this$props.arrowKeyNavigationProviderOptions
|
|
82
|
+
arrowKeyNavigationProviderOptions = _this$props.arrowKeyNavigationProviderOptions,
|
|
83
|
+
dropdownListId = _this$props.dropdownListId;
|
|
70
84
|
return /*#__PURE__*/_react.default.createElement(_Popup.default, {
|
|
71
85
|
target: target,
|
|
72
86
|
mountTo: mountTo,
|
|
@@ -78,12 +92,7 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
|
|
|
78
92
|
zIndex: zIndex
|
|
79
93
|
}, /*#__PURE__*/_react.default.createElement(_ArrowKeyNavigationProvider.ArrowKeyNavigationProvider, (0, _extends2.default)({}, arrowKeyNavigationProviderOptions, {
|
|
80
94
|
closeOnTab: true,
|
|
81
|
-
handleClose:
|
|
82
|
-
return onOpenChange && onOpenChange({
|
|
83
|
-
isOpen: false,
|
|
84
|
-
event: event
|
|
85
|
-
});
|
|
86
|
-
}
|
|
95
|
+
handleClose: this.handleCloseAndFocus
|
|
87
96
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
88
97
|
style: {
|
|
89
98
|
height: 0,
|
|
@@ -93,7 +102,8 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
|
|
|
93
102
|
isOpen: true,
|
|
94
103
|
onOpenChange: onOpenChange,
|
|
95
104
|
position: popupPlacement.join(' '),
|
|
96
|
-
shouldFitContainer: true
|
|
105
|
+
shouldFitContainer: true,
|
|
106
|
+
id: dropdownListId
|
|
97
107
|
}, children))));
|
|
98
108
|
}
|
|
99
109
|
}, {
|
|
@@ -103,8 +103,8 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
|
|
|
103
103
|
});
|
|
104
104
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleCloseAndFocus", function () {
|
|
105
105
|
var _this$state$target, _this$state$target$qu;
|
|
106
|
-
_this.handleClose();
|
|
107
106
|
(_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();
|
|
107
|
+
_this.handleClose();
|
|
108
108
|
});
|
|
109
109
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClose", function () {
|
|
110
110
|
if (_this.props.onOpenChange) {
|
|
@@ -89,11 +89,15 @@ function calculateBreakoutStyles(_ref) {
|
|
|
89
89
|
// it breaks things like sticky headers.
|
|
90
90
|
//
|
|
91
91
|
// It can also cause bluriness for some child content (such as iframes)
|
|
92
|
+
|
|
92
93
|
return {
|
|
93
94
|
type: 'line-length-unknown',
|
|
94
95
|
width: breakoutWidth,
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
minWidth: breakoutWidthPx,
|
|
97
|
+
display: 'flex',
|
|
98
|
+
justifyContent: 'center',
|
|
99
|
+
transform: 'none',
|
|
100
|
+
transition: "min-width 0.5s ".concat(_editorSharedStyles.akEditorSwoopCubicBezier)
|
|
97
101
|
};
|
|
98
102
|
}
|
|
99
103
|
|
|
@@ -102,11 +106,15 @@ function calculateBreakoutStyles(_ref) {
|
|
|
102
106
|
// full-page appearance modes. There is a slight delay before
|
|
103
107
|
// the widthState is updated.
|
|
104
108
|
// During this period -- the marginLeftPx will be incorrect.
|
|
105
|
-
|
|
109
|
+
// const marginLeftPx = -(breakoutWidthPx - widthStateLineLength) / 2;
|
|
110
|
+
|
|
106
111
|
return {
|
|
107
112
|
type: 'line-length-known',
|
|
108
113
|
width: breakoutWidth,
|
|
109
|
-
|
|
114
|
+
minWidth: breakoutWidthPx,
|
|
115
|
+
transition: "min-width 0.5s ".concat(_editorSharedStyles.akEditorSwoopCubicBezier),
|
|
116
|
+
transform: "translateX(-50%)",
|
|
117
|
+
marginLeft: "50%"
|
|
110
118
|
};
|
|
111
119
|
}
|
|
112
120
|
function calcBreakoutWidthPx(mode, widthStateWidth) {
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -10,12 +10,6 @@ Object.defineProperty(exports, "ADFTraversor", {
|
|
|
10
10
|
return _traversor.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "Builder", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _builder.Builder;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
13
|
Object.defineProperty(exports, "ErrorReporter", {
|
|
20
14
|
enumerable: true,
|
|
21
15
|
get: function get() {
|
|
@@ -340,6 +334,18 @@ Object.defineProperty(exports, "isLinkMark", {
|
|
|
340
334
|
return _nodes.isLinkMark;
|
|
341
335
|
}
|
|
342
336
|
});
|
|
337
|
+
Object.defineProperty(exports, "isMediaNode", {
|
|
338
|
+
enumerable: true,
|
|
339
|
+
get: function get() {
|
|
340
|
+
return _nodes.isMediaNode;
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
Object.defineProperty(exports, "isNodeBeforeMediaNode", {
|
|
344
|
+
enumerable: true,
|
|
345
|
+
get: function get() {
|
|
346
|
+
return _nodes.isNodeBeforeMediaNode;
|
|
347
|
+
}
|
|
348
|
+
});
|
|
343
349
|
Object.defineProperty(exports, "isNodeSelectedOrInRange", {
|
|
344
350
|
enumerable: true,
|
|
345
351
|
get: function get() {
|
|
@@ -677,5 +683,4 @@ var _useComponentRenderTracking = require("./performance/hooks/use-component-ren
|
|
|
677
683
|
var _outdatedBrowsers = require("./outdated-browsers");
|
|
678
684
|
var _referentiality = require("./referentiality");
|
|
679
685
|
var _sendLogs = require("./sendLogs");
|
|
680
|
-
var _builder = require("./builder");
|
|
681
686
|
var _list = require("./list");
|
package/dist/cjs/utils/nodes.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.validateNodes = exports.validNode = exports.isType = exports.isText = exports.isSupportedInParent = exports.isParagraph = exports.isNodeSelectedOrInRange = exports.isLinkMark = exports.findChangedNodesFromTransaction = exports.SelectedState = void 0;
|
|
6
|
+
exports.validateNodes = exports.validNode = exports.isType = exports.isText = exports.isSupportedInParent = exports.isParagraph = exports.isNodeSelectedOrInRange = exports.isNodeBeforeMediaNode = exports.isMediaNode = exports.isLinkMark = exports.findChangedNodesFromTransaction = exports.SelectedState = void 0;
|
|
7
|
+
var _prosemirrorUtils = require("prosemirror-utils");
|
|
7
8
|
/**
|
|
8
9
|
* Finds all top level nodes affected by the transaction
|
|
9
10
|
* Uses from/to positions in transaction's steps to work out which nodes will
|
|
@@ -104,4 +105,39 @@ var isSupportedInParent = function isSupportedInParent(state, fragment, currentA
|
|
|
104
105
|
var parent = state.selection.$from.node(depth);
|
|
105
106
|
return parent && parent.type.validContent(fragment);
|
|
106
107
|
};
|
|
107
|
-
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Checks if the passed in node is a media node
|
|
111
|
+
* Includes media, mediaInline, mediaGroup, mediaSingle
|
|
112
|
+
* @param node The PM node to be checked
|
|
113
|
+
*/
|
|
114
|
+
exports.isSupportedInParent = isSupportedInParent;
|
|
115
|
+
var isMediaNode = function isMediaNode(node) {
|
|
116
|
+
return ['media', 'mediaInline', 'mediaGroup', 'mediaSingle'].includes(node.type.name);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Checks if the node before selection is a media node
|
|
121
|
+
* If there is no node before, checks the node before the parent node
|
|
122
|
+
* Includes media, mediaInline, mediaGroup, mediaSingle
|
|
123
|
+
* @param $pos The position of the selection
|
|
124
|
+
* @param state The editor state
|
|
125
|
+
*/
|
|
126
|
+
exports.isMediaNode = isMediaNode;
|
|
127
|
+
var isNodeBeforeMediaNode = function isNodeBeforeMediaNode($pos, state) {
|
|
128
|
+
var nodeBefore = $pos.nodeBefore;
|
|
129
|
+
if (!nodeBefore) {
|
|
130
|
+
var depthOfParent = $pos.depth - 1 || 1;
|
|
131
|
+
var parentNode = (0, _prosemirrorUtils.findParentNodeOfType)([state.schema.nodes["".concat($pos.node(depthOfParent).type.name)]])(state.selection);
|
|
132
|
+
var resolvedPosOfParentNode = parentNode ? state.tr.doc.resolve(parentNode.pos) : undefined;
|
|
133
|
+
var nodeBeforeParent = resolvedPosOfParentNode && resolvedPosOfParentNode.pos < state.doc.nodeSize ? resolvedPosOfParentNode.nodeBefore : undefined;
|
|
134
|
+
if (nodeBeforeParent) {
|
|
135
|
+
nodeBefore = nodeBeforeParent;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (nodeBefore) {
|
|
139
|
+
return ['media', 'mediaInline', 'mediaGroup', 'mediaSingle'].includes(nodeBefore.type.name);
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
};
|
|
143
|
+
exports.isNodeBeforeMediaNode = isNodeBeforeMediaNode;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
|
|
2
2
|
import { akEditorFullWidthLayoutWidth, akLayoutGutterOffset, gridMediumMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { gridSize } from '@atlaskit/theme/constants';
|
|
3
4
|
import { BODIED_EXT_PADDING } from '../styles/shared/extension';
|
|
4
5
|
import { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '../styles/shared/layout';
|
|
5
6
|
import { absoluteBreakoutWidth } from '../utils/breakout';
|
|
@@ -41,10 +42,23 @@ export const getParentNodeWidth = (pos, state, containerWidth, isFullWidthModeEn
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
// account for the padding of the parent node
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
switch (node.type) {
|
|
46
|
+
case schema.nodes.layoutSection:
|
|
47
|
+
parentWidth -= LAYOUT_COLUMN_PADDING * 2;
|
|
48
|
+
break;
|
|
49
|
+
case schema.nodes.bodiedExtension:
|
|
50
|
+
parentWidth -= BODIED_EXT_PADDING * 2;
|
|
51
|
+
break;
|
|
52
|
+
case schema.nodes.expand:
|
|
53
|
+
// padding
|
|
54
|
+
parentWidth -= gridSize() * 2;
|
|
55
|
+
// gutter offset
|
|
56
|
+
parentWidth += gridSize() * 1.5 * 2;
|
|
57
|
+
// padding right
|
|
58
|
+
parentWidth -= gridSize();
|
|
59
|
+
// padding left
|
|
60
|
+
parentWidth -= gridSize() * 4 - gridSize() / 2;
|
|
61
|
+
break;
|
|
48
62
|
}
|
|
49
63
|
parentWidth -= 2; // border
|
|
50
64
|
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
export class EditorPresetBuilder {
|
|
3
|
+
constructor(...more) {
|
|
4
|
+
_defineProperty(this, "safeEntry", plugin => Array.isArray(plugin) ? plugin : [plugin, undefined]);
|
|
5
|
+
this.data = [...more] || [];
|
|
6
|
+
}
|
|
7
|
+
add(nextOrTuple) {
|
|
8
|
+
return new EditorPresetBuilder(
|
|
9
|
+
/**
|
|
10
|
+
* re-cast this to NewPlugin as we've done all the type
|
|
11
|
+
* safety, dependency checking, narrowing, during
|
|
12
|
+
* `SafePresetCheck & VerifyPluginDependencies`
|
|
13
|
+
*/
|
|
14
|
+
nextOrTuple, ...this.data);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//hasPlugin<Plugin extends NextEditorPlugin<any, any>>(
|
|
18
|
+
// pluginToAdd: Plugin,
|
|
19
|
+
//): this is TryCastEditorPresetBuilderByCheckingPlugins<this, Plugin> {
|
|
20
|
+
// const hasPluginQueryExists = this.data.find((pluginEntry) => {
|
|
21
|
+
// const pluginFunction: NextEditorPlugin<any, any> = !Array.isArray(
|
|
22
|
+
// pluginEntry,
|
|
23
|
+
// )
|
|
24
|
+
// ? pluginEntry
|
|
25
|
+
// : pluginEntry[0];
|
|
26
|
+
|
|
27
|
+
// return pluginFunction === pluginToAdd;
|
|
28
|
+
// });
|
|
29
|
+
|
|
30
|
+
// return Boolean(hasPluginQueryExists);
|
|
31
|
+
//}
|
|
32
|
+
|
|
33
|
+
maybeAdd(pluginToAdd, add) {
|
|
34
|
+
return add(pluginToAdd,
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
this);
|
|
37
|
+
}
|
|
38
|
+
has(plugin) {
|
|
39
|
+
return this.data.some(pluginPreset => {
|
|
40
|
+
if (Array.isArray(pluginPreset)) {
|
|
41
|
+
return pluginPreset[0] === plugin;
|
|
42
|
+
}
|
|
43
|
+
return pluginPreset === plugin;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
build({
|
|
47
|
+
pluginInjectionAPI,
|
|
48
|
+
excludePlugins: maybeExcludePlugins
|
|
49
|
+
} = {}) {
|
|
50
|
+
const excludePlugins = new Set(maybeExcludePlugins ? maybeExcludePlugins : []);
|
|
51
|
+
const editorPlugins = this.processEditorPlugins({
|
|
52
|
+
pluginInjectionAPI,
|
|
53
|
+
excludePlugins
|
|
54
|
+
});
|
|
55
|
+
return this.removeExcludedPlugins(editorPlugins, excludePlugins);
|
|
56
|
+
}
|
|
57
|
+
verifyDuplicatedPlugins() {
|
|
58
|
+
const cache = new Set();
|
|
59
|
+
this.data.forEach(pluginEntry => {
|
|
60
|
+
const [pluginFn, _] = Array.isArray(pluginEntry) ? pluginEntry : [pluginEntry, undefined];
|
|
61
|
+
if (cache.has(pluginFn)) {
|
|
62
|
+
throw new Error(`${pluginFn} is already included!`);
|
|
63
|
+
}
|
|
64
|
+
cache.add(pluginFn);
|
|
65
|
+
});
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
processEditorPlugins({
|
|
69
|
+
pluginInjectionAPI,
|
|
70
|
+
excludePlugins
|
|
71
|
+
}) {
|
|
72
|
+
this.verifyDuplicatedPlugins();
|
|
73
|
+
const seen = new Set();
|
|
74
|
+
const plugins = this.data.reverse().map(entry => {
|
|
75
|
+
const [fn, config] = this.safeEntry(entry);
|
|
76
|
+
if (seen.has(fn)) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
seen.add(fn);
|
|
80
|
+
if (typeof fn !== 'function') {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const plugin = pluginInjectionAPI ? fn(config, pluginInjectionAPI.api()) : fn(config);
|
|
84
|
+
if (plugin && excludePlugins !== null && excludePlugins !== void 0 && excludePlugins.has(plugin.name)) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
if (!pluginInjectionAPI) {
|
|
88
|
+
return plugin;
|
|
89
|
+
}
|
|
90
|
+
pluginInjectionAPI.onEditorPluginInitialized(plugin);
|
|
91
|
+
return plugin;
|
|
92
|
+
}).filter(Boolean);
|
|
93
|
+
return plugins;
|
|
94
|
+
}
|
|
95
|
+
removeExcludedPlugins(plugins, excludes) {
|
|
96
|
+
if (excludes) {
|
|
97
|
+
return plugins.filter(plugin => !plugin || !excludes.has(plugin.name));
|
|
98
|
+
}
|
|
99
|
+
return plugins;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
|
|
103
|
+
//import type {
|
|
104
|
+
// ExtractPluginDependencies,
|
|
105
|
+
//} from '../types/next-editor-plugin';
|
|
106
|
+
//type TryCastEditorPresetBuilderByCheckingDependencies<MaybeEditorPresetBuilder, Plugin> =
|
|
107
|
+
// MaybeEditorPresetBuilder extends EditorPresetBuilder<any, infer StackPlugins>
|
|
108
|
+
// ? Plugin extends NextEditorPlugin<any, any>
|
|
109
|
+
// ? ExtractPluginDependencies<Plugin>[number] extends StackPlugins[number]
|
|
110
|
+
// ? MaybeEditorPresetBuilder
|
|
111
|
+
// : never
|
|
112
|
+
// : never
|
|
113
|
+
// : never;
|
|
114
|
+
// Because how our plugins are added in the preset, we can't use the type safe system
|
|
115
|
+
// in the EditorPresetBuilder.
|
|
116
|
+
// TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
|
|
117
|
+
//maybeAdd<
|
|
118
|
+
// MaybePlugin extends NextEditorPlugin<any, any>,
|
|
119
|
+
// MaybePluginNames extends string[],
|
|
120
|
+
// MaybeStackPlugins extends AllEditorPresetPluginTypes[],
|
|
121
|
+
// MaybeEditorPresetBuilder extends EditorPresetBuilder<
|
|
122
|
+
// MaybePluginNames,
|
|
123
|
+
// MaybeStackPlugins
|
|
124
|
+
// >,
|
|
125
|
+
//>(
|
|
126
|
+
// pluginToAdd: MaybePlugin,
|
|
127
|
+
// add: (
|
|
128
|
+
// pluginToAdd: MaybePlugin,
|
|
129
|
+
// maybeEditorPresetBuilder: TryCastEditorPresetBuilderByCheckingDependencies<this, MaybePlugin>,
|
|
130
|
+
// ) => MaybeEditorPresetBuilder,
|
|
131
|
+
//): MaybeEditorPresetBuilder | this {
|
|
132
|
+
// return add(
|
|
133
|
+
// pluginToAdd,
|
|
134
|
+
// // @ts-ignore
|
|
135
|
+
// this as any,
|
|
136
|
+
// );
|
|
137
|
+
//}
|
|
138
|
+
}
|