@atlaskit/editor-core 167.0.3 → 169.1.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.
Files changed (193) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/cjs/create-editor/create-plugins-list.js +7 -0
  3. package/dist/cjs/plugins/analytics/types/toolbar-button.js +2 -0
  4. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +2 -2
  5. package/dist/cjs/plugins/breakout/index.js +7 -0
  6. package/dist/cjs/plugins/breakout/ui/LayoutButton.js +3 -1
  7. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +6 -1
  8. package/dist/cjs/plugins/card/styles.js +4 -2
  9. package/dist/cjs/plugins/card/toolbar.js +6 -1
  10. package/dist/cjs/plugins/code-block/styles.js +17 -41
  11. package/dist/cjs/plugins/code-block/ui/class-names.js +5 -2
  12. package/dist/cjs/plugins/collab-edit/index.js +2 -2
  13. package/dist/cjs/plugins/collab-edit/provider/channel.js +2 -2
  14. package/dist/cjs/plugins/copy-button/commands.js +85 -0
  15. package/dist/cjs/plugins/copy-button/index.js +27 -0
  16. package/dist/cjs/plugins/copy-button/pm-plugins/main.js +38 -0
  17. package/dist/cjs/plugins/copy-button/pm-plugins/plugin-key.js +11 -0
  18. package/dist/cjs/plugins/copy-button/utils.js +51 -0
  19. package/dist/cjs/plugins/extension/context-panel.js +2 -2
  20. package/dist/cjs/plugins/extension/pm-plugins/main.js +2 -2
  21. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  22. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
  23. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  24. package/dist/cjs/plugins/indentation/messages.js +23 -0
  25. package/dist/cjs/plugins/index.js +16 -0
  26. package/dist/cjs/plugins/list/index.js +0 -43
  27. package/dist/cjs/plugins/macro/actions.js +2 -2
  28. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +2 -2
  29. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
  30. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
  31. package/dist/cjs/plugins/panel/toolbar.js +10 -2
  32. package/dist/cjs/plugins/table/commands/hover.js +2 -2
  33. package/dist/cjs/plugins/table/toolbar.js +5 -1
  34. package/dist/cjs/plugins/table/utils/decoration.js +5 -1
  35. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +65 -0
  36. package/dist/cjs/plugins/toolbar-lists-indentation/types.js +5 -0
  37. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +122 -0
  38. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +173 -0
  39. package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +58 -0
  40. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +48 -0
  41. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +4 -5
  42. package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +17 -51
  43. package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +2 -2
  44. package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +2 -2
  45. package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +2 -2
  46. package/dist/cjs/ui/ConfigPanel/transformers.js +2 -2
  47. package/dist/cjs/ui/ElementBrowser/InsertMenu.js +12 -39
  48. package/dist/cjs/ui/ElementBrowser/components/ElementList/ElementList.js +31 -87
  49. package/dist/cjs/utils/clipboard.js +67 -2
  50. package/dist/cjs/version-wrapper.js +1 -1
  51. package/dist/cjs/version.json +1 -1
  52. package/dist/es2019/create-editor/create-plugins-list.js +8 -1
  53. package/dist/es2019/plugins/analytics/types/toolbar-button.js +2 -0
  54. package/dist/es2019/plugins/breakout/index.js +7 -0
  55. package/dist/es2019/plugins/breakout/ui/LayoutButton.js +3 -1
  56. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +6 -1
  57. package/dist/es2019/plugins/card/styles.js +5 -0
  58. package/dist/es2019/plugins/card/toolbar.js +5 -1
  59. package/dist/es2019/plugins/code-block/styles.js +18 -95
  60. package/dist/es2019/plugins/code-block/ui/class-names.js +3 -2
  61. package/dist/es2019/plugins/copy-button/commands.js +64 -0
  62. package/dist/es2019/plugins/copy-button/index.js +15 -0
  63. package/dist/es2019/plugins/copy-button/pm-plugins/main.js +28 -0
  64. package/dist/es2019/plugins/copy-button/pm-plugins/plugin-key.js +2 -0
  65. package/dist/es2019/plugins/copy-button/utils.js +29 -0
  66. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  67. package/dist/es2019/plugins/indentation/messages.js +14 -0
  68. package/dist/es2019/plugins/index.js +3 -1
  69. package/dist/es2019/plugins/list/index.js +1 -44
  70. package/dist/es2019/plugins/panel/toolbar.js +9 -2
  71. package/dist/es2019/plugins/table/commands/hover.js +2 -2
  72. package/dist/es2019/plugins/table/toolbar.js +5 -2
  73. package/dist/es2019/plugins/table/utils/decoration.js +5 -1
  74. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +53 -0
  75. package/dist/es2019/plugins/toolbar-lists-indentation/types.js +1 -0
  76. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +94 -0
  77. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +149 -0
  78. package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +49 -0
  79. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +35 -0
  80. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +11 -10
  81. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +17 -48
  82. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +10 -30
  83. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +34 -93
  84. package/dist/es2019/utils/clipboard.js +26 -0
  85. package/dist/es2019/version-wrapper.js +1 -1
  86. package/dist/es2019/version.json +1 -1
  87. package/dist/esm/actions/index.js +1 -1
  88. package/dist/esm/create-editor/ErrorBoundary.js +1 -1
  89. package/dist/esm/create-editor/create-plugins-list.js +8 -1
  90. package/dist/esm/editor.js +2 -1
  91. package/dist/esm/plugins/analytics/types/toolbar-button.js +2 -0
  92. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +1 -1
  93. package/dist/esm/plugins/breakout/index.js +7 -0
  94. package/dist/esm/plugins/breakout/ui/LayoutButton.js +3 -1
  95. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +6 -1
  96. package/dist/esm/plugins/card/styles.js +2 -1
  97. package/dist/esm/plugins/card/toolbar.js +5 -1
  98. package/dist/esm/plugins/code-block/styles.js +16 -35
  99. package/dist/esm/plugins/code-block/ui/class-names.js +3 -2
  100. package/dist/esm/plugins/collab-edit/index.js +1 -1
  101. package/dist/esm/plugins/collab-edit/provider/channel.js +1 -1
  102. package/dist/esm/plugins/copy-button/commands.js +66 -0
  103. package/dist/esm/plugins/copy-button/index.js +17 -0
  104. package/dist/esm/plugins/copy-button/pm-plugins/main.js +26 -0
  105. package/dist/esm/plugins/copy-button/pm-plugins/plugin-key.js +2 -0
  106. package/dist/esm/plugins/copy-button/utils.js +31 -0
  107. package/dist/esm/plugins/custom-autoformat/doc.js +1 -1
  108. package/dist/esm/plugins/custom-autoformat/index.js +1 -1
  109. package/dist/esm/plugins/extension/actions.js +1 -1
  110. package/dist/esm/plugins/extension/context-panel.js +1 -1
  111. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -1
  112. package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +1 -1
  113. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  114. package/dist/esm/plugins/feedback-dialog/index.js +1 -1
  115. package/dist/esm/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +1 -1
  116. package/dist/esm/plugins/find-replace/utils/batch-decorations.js +1 -1
  117. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -1
  118. package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
  119. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -1
  120. package/dist/esm/plugins/image-upload/pm-plugins/main.js +1 -1
  121. package/dist/esm/plugins/indentation/messages.js +14 -0
  122. package/dist/esm/plugins/index.js +3 -1
  123. package/dist/esm/plugins/list/index.js +1 -41
  124. package/dist/esm/plugins/macro/actions.js +1 -1
  125. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +1 -1
  126. package/dist/esm/plugins/media/nodeviews/mediaInline.js +2 -1
  127. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  128. package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +1 -1
  129. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
  130. package/dist/esm/plugins/media/picker-facade.js +1 -1
  131. package/dist/esm/plugins/media/pm-plugins/main.js +1 -1
  132. package/dist/esm/plugins/media/toolbar/utils.js +1 -1
  133. package/dist/esm/plugins/media/ui/MediaPicker/PickerFacadeProvider.js +1 -1
  134. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +1 -1
  135. package/dist/esm/plugins/media/utils/check-media-type.js +1 -1
  136. package/dist/esm/plugins/panel/toolbar.js +9 -2
  137. package/dist/esm/plugins/paste/handlers.js +1 -1
  138. package/dist/esm/plugins/paste/pm-plugins/main.js +1 -1
  139. package/dist/esm/plugins/quick-insert/index.js +1 -1
  140. package/dist/esm/plugins/table/commands/hover.js +2 -2
  141. package/dist/esm/plugins/table/toolbar.js +5 -2
  142. package/dist/esm/plugins/table/utils/decoration.js +5 -1
  143. package/dist/esm/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +1 -1
  144. package/dist/esm/plugins/toolbar-lists-indentation/index.js +51 -0
  145. package/dist/esm/plugins/toolbar-lists-indentation/types.js +1 -0
  146. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +96 -0
  147. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +153 -0
  148. package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +47 -0
  149. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +39 -0
  150. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +6 -8
  151. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +18 -51
  152. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
  153. package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +1 -1
  154. package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +1 -1
  155. package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +1 -1
  156. package/dist/esm/ui/ConfigPanel/transformers.js +1 -1
  157. package/dist/esm/ui/ElementBrowser/InsertMenu.js +12 -35
  158. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +31 -89
  159. package/dist/esm/ui/LinkSearch/index.js +1 -1
  160. package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
  161. package/dist/esm/utils/action.js +1 -1
  162. package/dist/esm/utils/clipboard.js +56 -1
  163. package/dist/esm/utils/extensions.js +1 -1
  164. package/dist/esm/version-wrapper.js +1 -1
  165. package/dist/esm/version.json +1 -1
  166. package/dist/types/plugins/analytics/types/toolbar-button.d.ts +3 -1
  167. package/dist/types/plugins/card/styles.d.ts +1 -0
  168. package/dist/types/plugins/copy-button/commands.d.ts +4 -0
  169. package/dist/types/plugins/copy-button/index.d.ts +3 -0
  170. package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +3 -0
  171. package/dist/types/plugins/copy-button/pm-plugins/plugin-key.d.ts +2 -0
  172. package/dist/types/plugins/copy-button/utils.d.ts +7 -0
  173. package/dist/types/plugins/indentation/messages.d.ts +12 -0
  174. package/dist/types/plugins/index.d.ts +2 -0
  175. package/dist/types/plugins/panel/toolbar.d.ts +1 -1
  176. package/dist/types/plugins/table/commands/hover.d.ts +1 -1
  177. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  178. package/dist/types/plugins/text-formatting/utils.d.ts +1 -1
  179. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +5 -0
  180. package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +16 -0
  181. package/dist/types/plugins/toolbar-lists-indentation/ui/Toolbar.d.ts +4 -0
  182. package/dist/types/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.d.ts +9 -0
  183. package/dist/types/plugins/{list/ui/ToolbarLists → toolbar-lists-indentation/ui}/index.d.ts +4 -10
  184. package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +6 -0
  185. package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +0 -25
  186. package/dist/types/types/feature-flags.d.ts +18 -0
  187. package/dist/types/ui/ElementBrowser/components/ElementList/ElementList.d.ts +11 -0
  188. package/dist/types/utils/clipboard.d.ts +1 -0
  189. package/package.json +25 -25
  190. package/report.api.md +6747 -0
  191. package/dist/cjs/plugins/list/ui/ToolbarLists/index.js +0 -266
  192. package/dist/es2019/plugins/list/ui/ToolbarLists/index.js +0 -220
  193. package/dist/esm/plugins/list/ui/ToolbarLists/index.js +0 -241
@@ -7,12 +7,11 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
+ exports.ElementItem = ElementItem;
10
11
  exports.default = void 0;
11
12
 
12
13
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
14
 
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
15
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
17
16
 
18
17
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -21,13 +20,11 @@ var _react = _interopRequireWildcard(require("react"));
21
20
 
22
21
  var _react2 = require("@emotion/react");
23
22
 
24
- var _memoizeOne = _interopRequireDefault(require("memoize-one"));
25
-
26
23
  var _AutoSizer = require("react-virtualized/dist/commonjs/AutoSizer");
27
24
 
28
25
  var _Collection = require("react-virtualized/dist/commonjs/Collection");
29
26
 
30
- var _item = _interopRequireDefault(require("@atlaskit/item"));
27
+ var _menu = require("@atlaskit/menu");
31
28
 
32
29
  var _colors = require("@atlaskit/theme/colors");
33
30
 
@@ -69,10 +66,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
69
66
 
70
67
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
71
68
 
72
- 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; }
73
-
74
- 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; }
75
-
76
69
  function ElementList(_ref) {
77
70
  var items = _ref.items,
78
71
  mode = _ref.mode,
@@ -165,40 +158,6 @@ function ElementList(_ref) {
165
158
  }))));
166
159
  }
167
160
 
168
- var getStyles = (0, _memoizeOne.default)(function (mode) {
169
- return _objectSpread(_objectSpread({}, mode === _types.Modes.full && {
170
- '-ms-flex': 'auto',
171
- position: 'relative',
172
- boxSizing: 'border-box'
173
- }), {}, {
174
- height: {
175
- default: _constants.ELEMENT_ITEM_HEIGHT
176
- },
177
- padding: {
178
- default: {
179
- top: _constants.GRID_SIZE * 1.5,
180
- right: _constants.GRID_SIZE * 1.5,
181
- bottom: _constants.GRID_SIZE * 1.5,
182
- left: _constants.GRID_SIZE * 1.5
183
- }
184
- },
185
- borderRadius: _constants.GRID_SIZE / 2,
186
- // TODO: apply a different background for when a selected item is hovered.
187
- // Not possible due to current implementation of @atlaskit/item component.
188
- selected: {
189
- background: (0, _tokens.token)('color.background.selected', _colors.N20)
190
- },
191
- hover: {
192
- background: (0, _tokens.token)('color.background.neutral.subtle.hovered', 'rgb(244, 245, 247)')
193
- },
194
- active: {
195
- background: (0, _tokens.token)('color.background.neutral.subtle.pressed', 'rgb(244, 245, 247)')
196
- },
197
- beforeItemSpacing: {
198
- default: _constants.GRID_SIZE * 1.5
199
- }
200
- });
201
- });
202
161
  var MemoizedElementItem = /*#__PURE__*/(0, _react.memo)(ElementItem);
203
162
  MemoizedElementItem.displayName = 'MemoizedElementItem';
204
163
 
@@ -211,11 +170,6 @@ function ElementItem(_ref4) {
211
170
  focus = _ref4.focus,
212
171
  setFocusedItemIndex = _ref4.setFocusedItemIndex;
213
172
  var ref = (0, _useFocus.default)(focus);
214
- var theme = (0, _react.useMemo)(function () {
215
- return {
216
- '@atlaskit-shared-theme/item': getStyles(inlineMode ? 'inline' : 'full')
217
- };
218
- }, [inlineMode]);
219
173
  /**
220
174
  * Note: props.onSelectItem(item) is not called here as the StatelessElementBrowser's
221
175
  * useEffect would trigger it on selectedItemIndex change. (Line 106-110)
@@ -227,33 +181,29 @@ function ElementItem(_ref4) {
227
181
  e.stopPropagation();
228
182
  setFocusedItemIndex(index);
229
183
 
230
- if (inlineMode) {
231
- onInsertItem(item);
232
- }
233
- }, [index, inlineMode, item, onInsertItem, setFocusedItemIndex]);
234
- var onDoubleClick = (0, _react.useCallback)(function (e) {
235
- if (inlineMode) {
236
- return;
237
- }
184
+ switch (e.nativeEvent.detail) {
185
+ case 0:
186
+ onInsertItem(item);
187
+ break;
238
188
 
239
- e.preventDefault();
240
- e.stopPropagation();
241
- setFocusedItemIndex(index);
242
- onInsertItem(item);
243
- }, [inlineMode, setFocusedItemIndex, index, onInsertItem, item]); // After tabbing we wanna select the item on enter/space key press from item level,
244
- // preventing the default top level component behavior.
245
-
246
- var onKeyPress = (0, _react.useCallback)(function (e) {
247
- var SPACE_KEY = 32;
248
- var ENTER_KEY = 13;
249
-
250
- if (e.which === ENTER_KEY || e.which === SPACE_KEY) {
251
- e.preventDefault();
252
- e.stopPropagation();
253
- setFocusedItemIndex(index);
254
- onInsertItem(item);
189
+ case 1:
190
+ if (inlineMode) {
191
+ onInsertItem(item);
192
+ }
193
+
194
+ break;
195
+
196
+ case 2:
197
+ if (!inlineMode) {
198
+ onInsertItem(item);
199
+ }
200
+
201
+ break;
202
+
203
+ default:
204
+ return;
255
205
  }
256
- }, [index, item, onInsertItem, setFocusedItemIndex]);
206
+ }, [index, inlineMode, item, onInsertItem, setFocusedItemIndex]);
257
207
  var icon = item.icon,
258
208
  title = item.title,
259
209
  description = item.description,
@@ -261,31 +211,25 @@ function ElementItem(_ref4) {
261
211
  return (0, _react2.jsx)(_tooltip.default, {
262
212
  content: description,
263
213
  testId: "element-item-tooltip-".concat(index)
264
- }, (0, _react2.jsx)(_item.default, {
214
+ }, (0, _react2.jsx)(_menu.ButtonItem, {
265
215
  onClick: onClick,
266
- onDoubleClick: onDoubleClick,
267
- elemBefore: (0, _react2.jsx)(ElementBefore, {
216
+ iconBefore: (0, _react2.jsx)(ElementBefore, {
268
217
  icon: icon,
269
218
  title: title
270
219
  }),
271
220
  isSelected: selected,
272
221
  "aria-describedby": title,
273
- innerRef: ref,
274
- onKeyPress: onKeyPress,
275
- "data-testid": "element-item-".concat(index),
276
- tabIndex: 0,
277
- style: inlineMode ? null : itemStyleOverrides,
278
- theme: theme
222
+ ref: ref,
223
+ testId: "element-item-".concat(index)
279
224
  }, (0, _react2.jsx)(ItemContent, {
225
+ style: inlineMode ? null : itemStyleOverrides,
226
+ tabIndex: 0,
280
227
  title: title,
281
228
  description: description,
282
229
  keyshortcut: keyshortcut
283
230
  })));
284
231
  }
285
232
  /**
286
- * Some properties (specified in 'BaseItem' packages/design-system/item/src/styled/Item.js) cannot be changed with
287
- * ThemeProvider as they are of higher specificity.
288
- *
289
233
  * Inline mode should use the existing Align-items:center value.
290
234
  */
291
235
 
@@ -322,8 +266,8 @@ var ItemContent = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
322
266
  }, description)));
323
267
  });
324
268
  var scrollbarStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ::-webkit-scrollbar {\n width: ", "px;\n }\n ::-webkit-scrollbar-track-piece {\n background: ", ";\n }\n ::-webkit-scrollbar-thumb {\n background: ", ";\n }\n\n /** Firefox **/\n scrollbar-color: ", " ", ";\n\n -ms-overflow-style: -ms-autohiding-scrollbar;\n"])), _constants.SCROLLBAR_WIDTH, _constants.SCROLLBAR_TRACK_COLOR, _constants.SCROLLBAR_THUMB_COLOR, _constants.SCROLLBAR_THUMB_COLOR, _constants.SCROLLBAR_TRACK_COLOR);
325
- var elementItemsWrapper = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex: 1;\n flex-flow: row wrap;\n align-items: flex-start;\n justify-content: flex-start;\n overflow: hidden;\n padding: ", "px; // For Focus outline\n\n .ReactVirtualized__Collection {\n ", ";\n border-radius: 3px; // Standard border-radius across other components like Search or Item.\n outline: none;\n\n :focus {\n box-shadow: 0 0 0 ", "px\n ", ";\n }\n }\n .ReactVirtualized__Collection__innerScrollContainer {\n div[class='element-item-wrapper']:last-child {\n padding-bottom: 4px;\n }\n }\n\n // temporary solution before we migrated off dst/item\n & span[class^='ItemParts__Before'] {\n margin-right: 12px;\n }\n"])), _constants.ELEMENT_LIST_PADDING, scrollbarStyle, _constants.ELEMENT_LIST_PADDING, (0, _tokens.token)('color.border.focused', _colors.B100));
326
- var elementItemWrapper = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n /**\n * Since we are using \"Item\" component's content itself for description,\n * the height of description overflows the parent container padding/margin.\n * manually setting it to take 100% of parent.\n */\n span {\n span:nth-of-type(2) {\n max-height: 100%;\n }\n }\n"])));
269
+ var elementItemsWrapper = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex: 1;\n flex-flow: row wrap;\n align-items: flex-start;\n justify-content: flex-start;\n overflow: hidden;\n padding: ", "px; // For Focus outline\n\n .ReactVirtualized__Collection {\n ", ";\n border-radius: 3px; // Standard border-radius across other components like Search or Item.\n outline: none;\n\n :focus {\n box-shadow: 0 0 0 ", "px\n ", ";\n }\n }\n .ReactVirtualized__Collection__innerScrollContainer {\n div[class='element-item-wrapper']:last-child {\n padding-bottom: 4px;\n }\n }\n"])), _constants.ELEMENT_LIST_PADDING, scrollbarStyle, _constants.ELEMENT_LIST_PADDING, (0, _tokens.token)('color.border.focused', _colors.B100));
270
+ var elementItemWrapper = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n div {\n button {\n height: 75px;\n align-items: flex-start;\n padding: 12px 12px 11px;\n }\n }\n"])));
327
271
  var itemBody = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n justify-content: space-between;\n line-height: 1.4;\n width: 100%;\n\n margin-top: -2px; // Fixes the Item Icon and text's alignment issue\n"])));
328
272
  /*
329
273
  * -webkit-line-clamp is also supported by firefox 🎉
@@ -2,17 +2,25 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
10
  exports.checkClipboardTypes = checkClipboardTypes;
9
- exports.copyToClipboard = void 0;
11
+ exports.copyToClipboard = exports.copyHTMLToClipboard = void 0;
10
12
  exports.isPastedFile = isPastedFile;
11
13
 
12
14
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
15
 
14
16
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
17
 
18
+ var clipboard = _interopRequireWildcard(require("clipboard-polyfill"));
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
16
24
  function checkClipboardTypes(type, item) {
17
25
  var isDOMStringList = function isDOMStringList(t) {
18
26
  return !t.indexOf && !!t.contains;
@@ -107,4 +115,61 @@ var copyToClipboard = /*#__PURE__*/function () {
107
115
  };
108
116
  }();
109
117
 
110
- exports.copyToClipboard = copyToClipboard;
118
+ exports.copyToClipboard = copyToClipboard;
119
+
120
+ var copyHTMLToClipboard = /*#__PURE__*/function () {
121
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(htmlToCopy) {
122
+ var blobInput, data, Clipboard, dt;
123
+ return _regenerator.default.wrap(function _callee2$(_context2) {
124
+ while (1) {
125
+ switch (_context2.prev = _context2.next) {
126
+ case 0:
127
+ if (!(isClipboardApiSupported() && typeof ClipboardItem !== 'undefined')) {
128
+ _context2.next = 12;
129
+ break;
130
+ }
131
+
132
+ _context2.prev = 1;
133
+ blobInput = new Blob([htmlToCopy], {
134
+ type: 'text/html'
135
+ }); // @ts-ignore
136
+
137
+ data = [new ClipboardItem({
138
+ 'text/html': blobInput
139
+ })]; // @ts-ignore
140
+
141
+ navigator.clipboard.write(data);
142
+ _context2.next = 10;
143
+ break;
144
+
145
+ case 7:
146
+ _context2.prev = 7;
147
+ _context2.t0 = _context2["catch"](1);
148
+ throw new Error('Clipboard api is not supported');
149
+
150
+ case 10:
151
+ _context2.next = 16;
152
+ break;
153
+
154
+ case 12:
155
+ // At the time of development, Firefox doesn't support ClipboardItem API
156
+ // Hence of use of this polyfill
157
+ Clipboard = clipboard;
158
+ dt = new Clipboard.DT();
159
+ dt.setData('text/html', htmlToCopy);
160
+ Clipboard.write(dt);
161
+
162
+ case 16:
163
+ case "end":
164
+ return _context2.stop();
165
+ }
166
+ }
167
+ }, _callee2, null, [[1, 7]]);
168
+ }));
169
+
170
+ return function copyHTMLToClipboard(_x2) {
171
+ return _ref3.apply(this, arguments);
172
+ };
173
+ }();
174
+
175
+ exports.copyHTMLToClipboard = copyHTMLToClipboard;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "167.0.3";
9
+ var version = "169.1.0";
10
10
  exports.version = version;
11
11
 
12
12
  var nextMajorVersion = function nextMajorVersion() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "167.0.3",
3
+ "version": "169.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tablesPlugin, tasksAndDecisionsPlugin, textColorPlugin, cardPlugin, gridPlugin, statusPlugin, alignmentPlugin, indentationPlugin, analyticsPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, contextPanelPlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin } from '../plugins';
1
+ import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tablesPlugin, tasksAndDecisionsPlugin, textColorPlugin, cardPlugin, gridPlugin, statusPlugin, alignmentPlugin, indentationPlugin, analyticsPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, contextPanelPlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin } from '../plugins';
2
2
  import { isFullPage as fullPageCheck } from '../utils/is-full-page';
3
3
  import { GUTTER_SIZE_MOBILE_IN_PX } from '../plugins/base/pm-plugins/scroll-gutter';
4
4
  import { createFeatureFlagsFromProps } from '../plugins/feature-flags-context/feature-flags-from-props';
@@ -359,6 +359,9 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
359
359
  } // UI only plugins
360
360
 
361
361
 
362
+ preset.add([toolbarListsIndentationPlugin, {
363
+ showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar
364
+ }]);
362
365
  preset.add([insertBlockPlugin, {
363
366
  allowTables: !!props.allowTables,
364
367
  allowExpand: isExpandInsertionEnabled(props),
@@ -411,6 +414,10 @@ export default function createPluginsList(props, prevProps, createAnalyticsEvent
411
414
  }]);
412
415
  }
413
416
 
417
+ if (featureFlags.floatingToolbarCopyButton) {
418
+ preset.add(copyButtonPlugin);
419
+ }
420
+
414
421
  const excludes = new Set();
415
422
 
416
423
  if (!isCodeBlockAllowed({
@@ -14,4 +14,6 @@ export let TOOLBAR_ACTION_SUBJECT_ID;
14
14
  TOOLBAR_ACTION_SUBJECT_ID["TEXT_FORMATTING_ITALIC"] = "italic";
15
15
  TOOLBAR_ACTION_SUBJECT_ID["UNDO"] = "undo";
16
16
  TOOLBAR_ACTION_SUBJECT_ID["REDO"] = "redo";
17
+ TOOLBAR_ACTION_SUBJECT_ID["INDENT"] = "indent";
18
+ TOOLBAR_ACTION_SUBJECT_ID["OUTDENT"] = "outdent";
17
19
  })(TOOLBAR_ACTION_SUBJECT_ID || (TOOLBAR_ACTION_SUBJECT_ID = {}));
@@ -14,6 +14,13 @@ import { findSupportedNodeForBreakout } from './utils/find-breakout-node';
14
14
  class BreakoutView {
15
15
  constructor(node, view, eventDispatcher) {
16
16
  _defineProperty(this, "updateWidth", widthState => {
17
+ // we skip updating the width of breakout nodes if the editorView dom
18
+ // element was hidden (to avoid breakout width and button thrashing
19
+ // when an editor is hidden, re-rendered and unhidden).
20
+ if (widthState.width === 0) {
21
+ return;
22
+ }
23
+
17
24
  const width = calcBreakoutWidth(this.node.attrs.mode, widthState.width);
18
25
  let newStyle = `width: ${width}; `;
19
26
  const lineLength = widthState.lineLength;
@@ -131,7 +131,9 @@ class LayoutButton extends React.Component {
131
131
  boundariesElement: boundariesElement,
132
132
  scrollableElement: scrollableElement,
133
133
  stick: true,
134
- forcePlacement: true
134
+ forcePlacement: true,
135
+ scheduleExtraLayoutUpdates: true,
136
+ waitForExtraLayoutUpdates: true
135
137
  }, jsx("div", {
136
138
  css: toolbarButtonWrapper
137
139
  }, jsx(ToolbarButton, {
@@ -6,7 +6,12 @@ import { replaceQueuedUrlWithCard, handleFallbackWithAnalytics } from '../doc';
6
6
  // Used for all interactions with the EditorCardProvider.
7
7
  // ============================================================================ //
8
8
  export const resolveWithProvider = (view, outstandingRequests, provider, request, options) => {
9
- const handleResolve = provider.resolve(request.url, request.appearance).then(resolvedCard => {
9
+ // When user manually changes appearance from blue link to smart link, we should respect that,
10
+ let shouldForceAppearance = // This flag is set to true only in one place atm:
11
+ // packages/editor/editor-core/src/plugins/card/pm-plugins/doc.ts @ convertHyperlinkToSmartCard
12
+ // Which is used when user switching from URL to smart link appearance.
13
+ !!request.shouldReplaceLink;
14
+ const handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(resolvedCard => {
10
15
  delete outstandingRequests[request.url];
11
16
  return resolvedCard;
12
17
  }).then(handleResolved(view, request, options), handleRejected(view, request));
@@ -4,6 +4,7 @@ import { N20 } from '@atlaskit/theme/colors';
4
4
  import { SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles';
5
5
  import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
6
6
  import { token } from '@atlaskit/tokens';
7
+ export const FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = 'card-floating-toolbar--link-picker';
7
8
  export const smartCardStyles = css`
8
9
  .${SmartCardSharedCssClassName.INLINE_CARD_CONTAINER} {
9
10
  max-width: calc(100% - 20px);
@@ -98,4 +99,8 @@ export const smartCardStyles = css`
98
99
  }
99
100
  }
100
101
  }
102
+
103
+ .${FLOATING_TOOLBAR_LINKPICKER_CLASSNAME} {
104
+ padding: 0;
105
+ }
101
106
  `;
@@ -18,6 +18,7 @@ import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
18
18
  import { messages } from './messages';
19
19
  import buildLayoutButtons from '../../ui/MediaAndEmbedsToolbar';
20
20
  import { buildVisitedLinkPayload } from '../../utils/linking-utils';
21
+ import { FLOATING_TOOLBAR_LINKPICKER_CLASSNAME } from './styles';
21
22
  export const removeCard = (state, dispatch) => {
22
23
  if (!(state.selection instanceof NodeSelection)) {
23
24
  return false;
@@ -227,9 +228,12 @@ export const floatingToolbar = (cardOptions, platform) => {
227
228
 
228
229
  const toolbarOffset = isEmbedCard ? {
229
230
  offset: [0, 24]
230
- } : {};
231
+ } : {}; // Applies padding override for when link picker is currently displayed
232
+
233
+ const className = pluginState.showLinkingToolbar ? FLOATING_TOOLBAR_LINKPICKER_CLASSNAME : undefined;
231
234
  return {
232
235
  title: intl.formatMessage(messages.card),
236
+ className,
233
237
  nodeType,
234
238
  ...toolbarOffset,
235
239
  getDomRef: view => {
@@ -1,10 +1,11 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { themed } from '@atlaskit/theme/components';
3
3
  import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
4
- import * as colors from '@atlaskit/theme/colors';
4
+ import { R75, N20, DN50, N30, DN20, N90, DN90, N400, DN400, N800, DN500 } from '@atlaskit/theme/colors';
5
5
  import { blockNodesVerticalMargin, akEditorTableCellMinWidth, akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorDeleteIconColor, SelectionStyle, getSelectionStyles, akEditorCodeFontFamily, akEditorSelectedNodeClassName, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
6
6
  import { token } from '@atlaskit/tokens';
7
7
  import { codeBlockClassNames } from './ui/class-names';
8
+ import { codeBlockSharedStyles } from '@atlaskit/editor-common/styles';
8
9
  export const highlightingCodeBlockStyles = props => css`
9
10
  .ProseMirror .code-block {
10
11
  position: relative;
@@ -12,15 +13,15 @@ export const highlightingCodeBlockStyles = props => css`
12
13
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4118
13
14
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
14
15
  background: themed({
15
- light: colors.N20,
16
- dark: colors.DN50
16
+ light: N20,
17
+ dark: DN50
17
18
  })(props),
18
19
  width: '8px'
19
20
  })};
20
21
  background-repeat: no-repeat;
21
22
  background-color: ${themed({
22
- light: token('color.background.neutral', colors.N20),
23
- dark: token('color.background.neutral', colors.DN50)
23
+ light: token('color.background.neutral', N20),
24
+ dark: token('color.background.neutral', DN50)
24
25
  })(props)};
25
26
 
26
27
  --ds--code--bg-color: transparent;
@@ -42,13 +43,13 @@ export const highlightingCodeBlockStyles = props => css`
42
43
  flex-shrink: 0;
43
44
  text-align: right;
44
45
  background-color: ${themed({
45
- light: token('color.background.neutral', colors.N30),
46
- dark: token('color.background.neutral', colors.DN20)
46
+ light: token('color.background.neutral', N30),
47
+ dark: token('color.background.neutral', DN20)
47
48
  })(props)};
48
49
  padding: ${gridSize()}px;
49
50
  color: ${themed({
50
- light: token('color.text.subtlest', colors.N90),
51
- dark: token('color.text.subtlest', colors.DN90)
51
+ light: token('color.text.subtlest', N90),
52
+ dark: token('color.text.subtlest', DN90)
52
53
  })(props)};
53
54
 
54
55
  span {
@@ -63,8 +64,8 @@ export const highlightingCodeBlockStyles = props => css`
63
64
  font-size: ${relativeFontSizeToBase16(fontSize())};
64
65
  line-height: 1.5rem;
65
66
  color: ${themed({
66
- light: token('color.text.subtle', colors.N400),
67
- dark: token('color.text.subtle', colors.DN400)
67
+ light: token('color.text.subtle', N400),
68
+ dark: token('color.text.subtle', DN400)
68
69
  })(props)};
69
70
  }
70
71
  }
@@ -117,8 +118,8 @@ export const highlightingCodeBlockStyles = props => css`
117
118
  > code:not([data-language='plaintext']):not([data-language='none']):not([data-language='']) {
118
119
  color: transparent;
119
120
  caret-color: ${themed({
120
- light: token('color.text', colors.N800),
121
- dark: token('color.text', colors.DN500)
121
+ light: token('color.text', N800),
122
+ dark: token('color.text', DN500)
122
123
  })(props)};
123
124
  }
124
125
  }
@@ -139,7 +140,7 @@ export const highlightingCodeBlockStyles = props => css`
139
140
  ${token('color.border.danger', akEditorDeleteBorder)};
140
141
 
141
142
  .${codeBlockClassNames.gutter} {
142
- background-color: ${token('color.blanket.danger', colors.R75)};
143
+ background-color: ${token('color.blanket.danger', R75)};
143
144
  color: ${token('color.text.danger', akEditorDeleteIconColor)};
144
145
  }
145
146
 
@@ -161,86 +162,8 @@ export const highlightingCodeBlockStyles = props => css`
161
162
  }
162
163
  `;
163
164
  export const codeBlockStyles = props => css`
164
- .ProseMirror .code-block {
165
- position: relative;
166
- background-image: ${overflowShadow({
167
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4118
168
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
169
- background: themed({
170
- light: colors.N20,
171
- dark: colors.DN50
172
- })(props),
173
- width: '8px'
174
- })};
175
-
176
- --ds--code--bg-color: transparent;
177
-
178
- background-repeat: no-repeat;
179
- background-color: ${themed({
180
- light: token('color.background.neutral', colors.N20),
181
- dark: token('color.background.neutral', colors.DN50)
182
- })(props)};
183
- background-attachment: local, scroll, scroll;
184
- background-size: 8px 100%, 8px 100%, 8px 100%;
185
- background-position: 100% 0, 100% 0, 0 0;
186
- font-family: ${akEditorCodeFontFamily};
187
- border-radius: ${borderRadius()}px;
188
- margin: ${blockNodesVerticalMargin} 0 0 0;
189
- counter-reset: line;
190
- display: flex;
191
- min-width: ${akEditorTableCellMinWidth}px;
192
- cursor: pointer;
193
- overflow-x: auto;
194
-
195
- .${codeBlockClassNames.gutter} {
196
- /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */
197
- flex-shrink: 0;
198
- text-align: right;
199
- background-color: ${themed({
200
- light: token('color.background.neutral', colors.N30),
201
- dark: token('color.background.neutral', colors.DN20)
202
- })(props)};
203
- padding: ${gridSize()}px;
204
-
205
- span {
206
- display: block;
207
- line-height: 0;
208
- font-size: 0;
209
-
210
- &::before {
211
- display: inline-block;
212
- content: counter(line);
213
- counter-increment: line;
214
- font-size: ${relativeFontSizeToBase16(fontSize())};
215
- line-height: 1.5rem;
216
- color: ${themed({
217
- light: token('color.text', colors.N400),
218
- dark: token('color.text', colors.DN400)
219
- })(props)};
220
- }
221
- }
222
- }
223
-
224
- .${codeBlockClassNames.content} {
225
- display: flex;
226
- flex: 1;
227
-
228
- code {
229
- flex-grow: 1;
230
- tab-size: 4;
231
- cursor: text;
232
- /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */
233
- font-size: ${relativeFontSizeToBase16(fontSize())};
234
- line-height: 1.5rem;
235
- color: ${themed({
236
- light: token('color.text', colors.N800),
237
- dark: token('color.text', colors.DN800)
238
- })(props)};
239
- border-radius: ${borderRadius()}px;
240
- margin: ${gridSize()}px;
241
- white-space: pre;
242
- }
243
- }
165
+ .ProseMirror {
166
+ ${codeBlockSharedStyles(props)}
244
167
  }
245
168
 
246
169
  .ProseMirror li > .code-block {
@@ -256,7 +179,7 @@ export const codeBlockStyles = props => css`
256
179
  box-shadow: 0 0 0 ${akEditorSelectedBorderSize}px ${akEditorDeleteBorder};
257
180
 
258
181
  .${codeBlockClassNames.gutter} {
259
- background-color: ${token('color.blanket.danger', colors.R75)};
182
+ background-color: ${token('color.blanket.danger', R75)};
260
183
  color: ${token('color.text.danger', akEditorDeleteIconColor)};
261
184
  }
262
185
 
@@ -1,5 +1,6 @@
1
+ import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
1
2
  export const codeBlockClassNames = {
2
- gutter: 'line-number-gutter',
3
- content: 'code-content',
3
+ gutter: CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER,
4
+ content: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT,
4
5
  highlighting: 'code-highlighting'
5
6
  };