@atlaskit/editor-common 68.0.1 → 69.0.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/codemods/69.0.0-update-validator-imports.ts +7 -0
  3. package/codemods/migrates/entry-points.ts +37 -0
  4. package/dist/cjs/extensions/manifest-helpers.js +2 -2
  5. package/dist/cjs/styles/index.js +15 -1
  6. package/dist/cjs/styles/shared/code-block.js +58 -0
  7. package/dist/cjs/styles/shared/emoji.js +2 -1
  8. package/dist/cjs/styles/shared/panel.js +2 -1
  9. package/dist/cjs/ui/Popup/index.js +38 -1
  10. package/dist/cjs/ui/clear-next-sibling-margin-top.js +11 -4
  11. package/dist/cjs/ui/index.js +6 -0
  12. package/dist/cjs/utils/index.js +0 -56
  13. package/dist/cjs/validator.js +6 -0
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/es2019/styles/index.js +2 -1
  16. package/dist/es2019/styles/shared/code-block.js +94 -0
  17. package/dist/es2019/styles/shared/emoji.js +3 -2
  18. package/dist/es2019/styles/shared/panel.js +2 -1
  19. package/dist/es2019/ui/Popup/index.js +24 -1
  20. package/dist/es2019/ui/clear-next-sibling-margin-top.js +9 -1
  21. package/dist/es2019/ui/index.js +1 -1
  22. package/dist/es2019/utils/index.js +0 -1
  23. package/dist/es2019/validator.js +1 -1
  24. package/dist/es2019/version.json +1 -1
  25. package/dist/esm/extensions/default-extension-provider.js +1 -1
  26. package/dist/esm/extensions/extension-fields-helpers.js +1 -1
  27. package/dist/esm/extensions/extension-handlers.js +1 -1
  28. package/dist/esm/extensions/manifest-helpers.js +1 -1
  29. package/dist/esm/extensions/module-helpers.js +1 -1
  30. package/dist/esm/provider-helpers/combine-providers.js +1 -1
  31. package/dist/esm/styles/index.js +2 -1
  32. package/dist/esm/styles/shared/code-block.js +39 -0
  33. package/dist/esm/styles/shared/emoji.js +3 -2
  34. package/dist/esm/styles/shared/panel.js +2 -1
  35. package/dist/esm/ui/Popup/index.js +40 -1
  36. package/dist/esm/ui/clear-next-sibling-margin-top.js +8 -2
  37. package/dist/esm/ui/index.js +1 -1
  38. package/dist/esm/utils/index.js +0 -1
  39. package/dist/esm/validator.js +1 -1
  40. package/dist/esm/version.json +1 -1
  41. package/dist/types/provider-factory/card-provider.d.ts +1 -1
  42. package/dist/types/styles/index.d.ts +1 -0
  43. package/dist/types/styles/shared/code-block.d.ts +8 -0
  44. package/dist/types/styles/shared/emoji.d.ts +1 -0
  45. package/dist/types/styles/shared/panel.d.ts +1 -0
  46. package/dist/types/ui/Popup/index.d.ts +4 -0
  47. package/dist/types/ui/clear-next-sibling-margin-top.d.ts +1 -0
  48. package/dist/types/ui/index.d.ts +1 -1
  49. package/dist/types/utils/index.d.ts +0 -2
  50. package/dist/types/validator.d.ts +1 -1
  51. package/package.json +13 -12
  52. package/report.api.md +7 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 69.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 69.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`04589993d81`](https://bitbucket.org/atlassian/atlassian-frontend/commits/04589993d81) - ED-15148: moved duplicate entrypoints from @atlaskit/editor-common/utils to @atlaskit/editor-common/validator
14
+
15
+ ### Minor Changes
16
+
17
+ - [`8ff3031db06`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8ff3031db06) - Introduce new optional argument to CardProvider.resolve
18
+ - [`07c8b0b4504`](https://bitbucket.org/atlassian/atlassian-frontend/commits/07c8b0b4504) - [ux] ED-15102 adds a copy button to nodes with floating toolbars
19
+ - [`2d979ce9877`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2d979ce9877) - [ux] ED-14945: Add windowed codeblock support in renderer (This feature sits behind a flag in the featureFlags prop 'allow-windowed-code-block')
20
+ - [`04746af08f6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/04746af08f6) - [ux] ED-15097 added floating toolbar copy button to table
21
+ - [`e4dba654a71`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e4dba654a71) - [ux] ED-15233: Fix breakout button positioning for breakout supported nodes in scenarios where editor disabled props changes while Editor is visually hidden and redisplayed.
22
+ Fixed by skipping breakout width update work when the editorView dom element is width 0 (hidden) and deferring LayoutButton position updates to second animation frame (on window
23
+ and editor resizes).
24
+ - [`11f56527739`](https://bitbucket.org/atlassian/atlassian-frontend/commits/11f56527739) - Export emoji placeholder class name
25
+
26
+ ### Patch Changes
27
+
28
+ - [`153b80fdcda`](https://bitbucket.org/atlassian/atlassian-frontend/commits/153b80fdcda) - [ux] ED-15111: Fix aligned text and headings margin-top values in layouts in Renderer (by clearing them)
29
+ - Updated dependencies
30
+
31
+ ## 68.0.2
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies
36
+
3
37
  ## 68.0.1
4
38
 
5
39
  ### Patch Changes
@@ -0,0 +1,7 @@
1
+ import { createTransformer } from '@atlaskit/codemod-utils';
2
+
3
+ import { validatorExports, validatorTypes } from './migrates/entry-points';
4
+
5
+ const transformer = createTransformer([...validatorTypes, ...validatorExports]);
6
+
7
+ export default transformer;
@@ -0,0 +1,37 @@
1
+ import { changeImportEntryPoint } from '@atlaskit/codemod-utils';
2
+
3
+ const PACKAGE_NAME = '@atlaskit/editor-common';
4
+
5
+ export const validatorExports = [
6
+ 'getMarksByOrder',
7
+ 'getValidContent',
8
+ 'getValidDocument',
9
+ 'getValidMark',
10
+ 'getValidNode',
11
+ 'getValidUnknownNode',
12
+ 'isSameMark',
13
+ 'isSubSupType',
14
+ 'markOrder',
15
+ 'ADFStages',
16
+ ].map((name) =>
17
+ changeImportEntryPoint(
18
+ `${PACKAGE_NAME}/utils`,
19
+ name,
20
+ `${PACKAGE_NAME}/validator`,
21
+ ),
22
+ );
23
+
24
+ export const validatorTypes = [
25
+ 'ADDoc',
26
+ 'ADFStage',
27
+ 'ADMark',
28
+ 'ADMarkSimple',
29
+ 'ADNode',
30
+ ].map((name) =>
31
+ changeImportEntryPoint(
32
+ `${PACKAGE_NAME}/utils`,
33
+ name,
34
+ `${PACKAGE_NAME}/validator`,
35
+ true,
36
+ ),
37
+ );
@@ -11,10 +11,10 @@ exports.buildExtensionKeyAndNodeKey = void 0;
11
11
  exports.buildNode = buildNode;
12
12
  exports.resolveImport = exports.getExtensionKeyAndNodeKey = void 0;
13
13
 
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
14
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
17
15
 
16
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
+
18
18
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
19
19
 
20
20
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "AnnotationSharedClassNames", {
15
15
  return _annotation.AnnotationSharedClassNames;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "CodeBlockSharedCssClassName", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _codeBlock.CodeBlockSharedCssClassName;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "DateSharedCssClassName", {
19
25
  enumerable: true,
20
26
  get: function get() {
@@ -69,6 +75,12 @@ Object.defineProperty(exports, "calcTableWidth", {
69
75
  return _table.calcTableWidth;
70
76
  }
71
77
  });
78
+ Object.defineProperty(exports, "codeBlockSharedStyles", {
79
+ enumerable: true,
80
+ get: function get() {
81
+ return _codeBlock.codeBlockSharedStyles;
82
+ }
83
+ });
72
84
  Object.defineProperty(exports, "codeMarkSharedStyles", {
73
85
  enumerable: true,
74
86
  get: function get() {
@@ -258,4 +270,6 @@ var _taskDecision = require("./shared/task-decision");
258
270
 
259
271
  var _status = require("./shared/status");
260
272
 
261
- var _smartCard = require("./shared/smart-card");
273
+ var _smartCard = require("./shared/smart-card");
274
+
275
+ var _codeBlock = require("./shared/code-block");
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.codeBlockSharedStyles = exports.CodeBlockSharedCssClassName = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = require("@emotion/react");
13
+
14
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
+
16
+ var _colors = require("@atlaskit/theme/colors");
17
+
18
+ var _components = require("@atlaskit/theme/components");
19
+
20
+ var _constants = require("@atlaskit/theme/constants");
21
+
22
+ var _tokens = require("@atlaskit/tokens");
23
+
24
+ var _templateObject;
25
+
26
+ var CodeBlockSharedCssClassName = {
27
+ CODEBLOCK_CONTAINER: 'code-block',
28
+ CODEBLOCK_LINE_NUMBER_GUTTER: 'line-number-gutter',
29
+ CODEBLOCK_CONTENT: 'code-content',
30
+ DS_CODEBLOCK: '[data-ds--code--code-block]'
31
+ };
32
+ exports.CodeBlockSharedCssClassName = CodeBlockSharedCssClassName;
33
+
34
+ var codeBlockSharedStyles = function codeBlockSharedStyles(props) {
35
+ return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n counter-reset: line;\n display: flex;\n overflow-x: auto;\n\n background-image: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-repeat: no-repeat;\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n margin: ", " 0 0 0;\n min-width: ", "px;\n cursor: pointer;\n\n .", " {\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n ::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n color: ", ";\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, (0, _components.themed)({
36
+ light: (0, _tokens.token)('color.background.neutral', _colors.N20),
37
+ dark: (0, _tokens.token)('color.background.neutral', _colors.DN50)
38
+ })(props), (0, _constants.borderRadius)(), (0, _editorSharedStyles.overflowShadow)({
39
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4118
40
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
41
+ background: (0, _components.themed)({
42
+ light: _colors.N20,
43
+ dark: _colors.DN50
44
+ })(props),
45
+ width: '8px'
46
+ }), _editorSharedStyles.akEditorCodeFontFamily, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.akEditorTableCellMinWidth, CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, (0, _components.themed)({
47
+ light: (0, _tokens.token)('color.background.neutral', _colors.N30),
48
+ dark: (0, _tokens.token)('color.background.neutral', _colors.DN20)
49
+ })(props), (0, _constants.gridSize)(), (0, _components.themed)({
50
+ light: (0, _tokens.token)('color.text.subtlest', _colors.N400),
51
+ dark: (0, _tokens.token)('color.text.subtlest', _colors.DN400)
52
+ })(props), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), CodeBlockSharedCssClassName.CODEBLOCK_CONTENT, (0, _components.themed)({
53
+ light: (0, _tokens.token)('color.text', _colors.N800),
54
+ dark: (0, _tokens.token)('color.text', _colors.DN800)
55
+ })(props), (0, _constants.borderRadius)(), (0, _constants.gridSize)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()));
56
+ };
57
+
58
+ exports.codeBlockSharedStyles = codeBlockSharedStyles;
@@ -11,6 +11,7 @@ var EmojiSharedCssClassName = {
11
11
  EMOJI_CONTAINER: 'emojiView-content-wrap',
12
12
  EMOJI_NODE: _emoji.emojiNode,
13
13
  EMOJI_SPRITE: _emoji.emojiSprite,
14
- EMOJI_IMAGE: _emoji.emojiImage
14
+ EMOJI_IMAGE: _emoji.emojiImage,
15
+ EMOJI_PLACEHOLDER: _emoji.emojiPlaceholder
15
16
  };
16
17
  exports.EmojiSharedCssClassName = EmojiSharedCssClassName;
@@ -178,7 +178,8 @@ var PanelSharedSelectors = {
178
178
  emojiPopup: "[aria-label=\"Popup\"]",
179
179
  searchEmoji: "[aria-label=\"Search emoji\"]",
180
180
  orangeWarningIcon: "[aria-label=\":warning:\"]",
181
- yellowWarningIcon: "[aria-label=\":warning:\"] span:nth-child(1)"
181
+ yellowWarningIcon: "[aria-label=\":warning:\"] span:nth-child(1)",
182
+ copyButton: "button[aria-label=\"Copy\"]"
182
183
  };
183
184
  exports.PanelSharedSelectors = PanelSharedSelectors;
184
185
 
@@ -41,6 +41,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
41
41
 
42
42
  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; }
43
43
 
44
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
45
+
46
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
47
+
48
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
49
+
44
50
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
45
51
 
46
52
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -62,6 +68,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
62
68
  }
63
69
 
64
70
  _this = _super.call.apply(_super, [this].concat(args));
71
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "rafIds", new Set());
65
72
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
66
73
  validPosition: true
67
74
  });
@@ -73,8 +80,37 @@ var Popup = /*#__PURE__*/function (_React$Component) {
73
80
 
74
81
  _this.initPopup(popup);
75
82
  });
83
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cancelRequestAnimationFrames", function () {
84
+ var _iterator = _createForOfIteratorHelper(_this.rafIds),
85
+ _step;
86
+
87
+ try {
88
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
89
+ var rafId = _step.value;
90
+ cancelAnimationFrame(rafId);
91
+ }
92
+ } catch (err) {
93
+ _iterator.e(err);
94
+ } finally {
95
+ _iterator.f();
96
+ }
97
+ });
76
98
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scheduledUpdatePosition", (0, _rafSchd.default)(function (props) {
77
- return _this.updatePosition(props);
99
+ if (!_this.props.waitForExtraLayoutUpdates) {
100
+ _this.updatePosition(_this.props);
101
+ }
102
+
103
+ if (_this.props.scheduleExtraLayoutUpdates) {
104
+ // We need two requestAnimationFrame calls to ensure reflow/repaints
105
+ // are flushed to DOM before our popup position recalculations happen
106
+ var rafId = requestAnimationFrame(function () {
107
+ _this.updatePosition(_this.props);
108
+
109
+ _this.rafIds.delete(rafId);
110
+ });
111
+
112
+ _this.rafIds.add(rafId);
113
+ }
78
114
  }));
79
115
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onResize", function () {
80
116
  return _this.scheduledUpdatePosition(_this.props);
@@ -237,6 +273,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
237
273
  }
238
274
 
239
275
  this.scheduledUpdatePosition.cancel();
276
+ this.cancelRequestAnimationFrames();
240
277
  }
241
278
  }, {
242
279
  key: "renderPopup",
@@ -5,14 +5,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.clearNextSiblingMarginTopStyle = void 0;
8
+ exports.clearNextSiblingMarginTopStyle = exports.clearNextSiblingBlockMarkMarginTopStyle = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
11
 
12
12
  var _react = require("@emotion/react");
13
13
 
14
- var _templateObject;
14
+ var _templateObject, _templateObject2;
15
15
 
16
16
  // We use !important to ensure next sibling gets the margin reset no matter what
17
- var clearNextSiblingMarginTopStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n & + * {\n margin-top: 0 !important;\n }\n"])));
18
- exports.clearNextSiblingMarginTopStyle = clearNextSiblingMarginTopStyle;
17
+ var marginTopReset = "margin-top: 0 !important;";
18
+ var clearNextSiblingMarginTopStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n & + * {\n ", "\n }\n"])), marginTopReset);
19
+ exports.clearNextSiblingMarginTopStyle = clearNextSiblingMarginTopStyle;
20
+ var textElements = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
21
+ var nextSiblingBlockMarkContentSelectors = textElements.map(function (elem) {
22
+ return "+ .fabric-editor-block-mark > ".concat(elem);
23
+ }).join(',');
24
+ var clearNextSiblingBlockMarkMarginTopStyle = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", " {\n ", "\n }\n"])), nextSiblingBlockMarkContentSelectors, marginTopReset);
25
+ exports.clearNextSiblingBlockMarkMarginTopStyle = clearNextSiblingBlockMarkMarginTopStyle;
@@ -151,6 +151,12 @@ Object.defineProperty(exports, "calcPxFromPct", {
151
151
  return _grid.calcPxFromPct;
152
152
  }
153
153
  });
154
+ Object.defineProperty(exports, "clearNextSiblingBlockMarkMarginTopStyle", {
155
+ enumerable: true,
156
+ get: function get() {
157
+ return _clearNextSiblingMarginTop.clearNextSiblingBlockMarkMarginTopStyle;
158
+ }
159
+ });
154
160
  Object.defineProperty(exports, "clearNextSiblingMarginTopStyle", {
155
161
  enumerable: true,
156
162
  get: function get() {
@@ -167,12 +167,6 @@ Object.defineProperty(exports, "getExtensionRenderer", {
167
167
  return _extensionHandler.getExtensionRenderer;
168
168
  }
169
169
  });
170
- Object.defineProperty(exports, "getMarksByOrder", {
171
- enumerable: true,
172
- get: function get() {
173
- return _validator.getMarksByOrder;
174
- }
175
- });
176
170
  Object.defineProperty(exports, "getModeFromTheme", {
177
171
  enumerable: true,
178
172
  get: function get() {
@@ -209,36 +203,6 @@ Object.defineProperty(exports, "getUnsupportedContentLevelData", {
209
203
  return _analytics.getUnsupportedContentLevelData;
210
204
  }
211
205
  });
212
- Object.defineProperty(exports, "getValidContent", {
213
- enumerable: true,
214
- get: function get() {
215
- return _validator.getValidContent;
216
- }
217
- });
218
- Object.defineProperty(exports, "getValidDocument", {
219
- enumerable: true,
220
- get: function get() {
221
- return _validator.getValidDocument;
222
- }
223
- });
224
- Object.defineProperty(exports, "getValidMark", {
225
- enumerable: true,
226
- get: function get() {
227
- return _validator.getValidMark;
228
- }
229
- });
230
- Object.defineProperty(exports, "getValidNode", {
231
- enumerable: true,
232
- get: function get() {
233
- return _validator.getValidNode;
234
- }
235
- });
236
- Object.defineProperty(exports, "getValidUnknownNode", {
237
- enumerable: true,
238
- get: function get() {
239
- return _validator.getValidUnknownNode;
240
- }
241
- });
242
206
  Object.defineProperty(exports, "hasMergedCell", {
243
207
  enumerable: true,
244
208
  get: function get() {
@@ -263,24 +227,6 @@ Object.defineProperty(exports, "isPerformanceObserverAvailable", {
263
227
  return _isPerformanceApiAvailable.isPerformanceObserverAvailable;
264
228
  }
265
229
  });
266
- Object.defineProperty(exports, "isSameMark", {
267
- enumerable: true,
268
- get: function get() {
269
- return _validator.isSameMark;
270
- }
271
- });
272
- Object.defineProperty(exports, "isSubSupType", {
273
- enumerable: true,
274
- get: function get() {
275
- return _validator.isSubSupType;
276
- }
277
- });
278
- Object.defineProperty(exports, "markOrder", {
279
- enumerable: true,
280
- get: function get() {
281
- return _validator.markOrder;
282
- }
283
- });
284
230
  Object.defineProperty(exports, "measureRender", {
285
231
  enumerable: true,
286
232
  get: function get() {
@@ -376,8 +322,6 @@ var _annotation = require("./annotation");
376
322
 
377
323
  var _macro = require("./macro");
378
324
 
379
- var _validator = require("./validator");
380
-
381
325
  var _browser = _interopRequireDefault(require("./browser"));
382
326
 
383
327
  var _errorReporter = _interopRequireDefault(require("./error-reporter"));
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "ADFStages", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _validator.ADFStages;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "getMarksByOrder", {
7
13
  enumerable: true,
8
14
  get: function get() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "68.0.1",
3
+ "version": "69.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -17,4 +17,5 @@ export { shadowSharedStyle } from './shared/shadow';
17
17
  export { dateSharedStyle, DateSharedCssClassName } from './shared/date';
18
18
  export { tasksAndDecisionsStyles, TaskDecisionSharedCssClassName } from './shared/task-decision';
19
19
  export { StatusSharedCssClassName } from './shared/status';
20
- export { smartCardSharedStyles, SmartCardSharedCssClassName } from './shared/smart-card';
20
+ export { smartCardSharedStyles, SmartCardSharedCssClassName } from './shared/smart-card';
21
+ export { CodeBlockSharedCssClassName, codeBlockSharedStyles } from './shared/code-block';
@@ -0,0 +1,94 @@
1
+ import { css } from '@emotion/react';
2
+ import { akEditorCodeFontFamily, akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
3
+ import { DN20, DN400, DN50, DN800, N20, N30, N400, N800 } from '@atlaskit/theme/colors';
4
+ import { themed } from '@atlaskit/theme/components';
5
+ import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
6
+ import { token } from '@atlaskit/tokens';
7
+ export const CodeBlockSharedCssClassName = {
8
+ CODEBLOCK_CONTAINER: 'code-block',
9
+ CODEBLOCK_LINE_NUMBER_GUTTER: 'line-number-gutter',
10
+ CODEBLOCK_CONTENT: 'code-content',
11
+ DS_CODEBLOCK: '[data-ds--code--code-block]'
12
+ };
13
+ export const codeBlockSharedStyles = props => css`
14
+ .${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER} {
15
+ position: relative;
16
+ background-color: ${themed({
17
+ light: token('color.background.neutral', N20),
18
+ dark: token('color.background.neutral', DN50)
19
+ })(props)};
20
+ border-radius: ${borderRadius()}px;
21
+ counter-reset: line;
22
+ display: flex;
23
+ overflow-x: auto;
24
+
25
+ background-image: ${overflowShadow({
26
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4118
27
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
28
+ background: themed({
29
+ light: N20,
30
+ dark: DN50
31
+ })(props),
32
+ width: '8px'
33
+ })};
34
+
35
+ --ds--code--bg-color: transparent;
36
+
37
+ background-repeat: no-repeat;
38
+ background-attachment: local, scroll, scroll;
39
+ background-size: 8px 100%, 8px 100%, 8px 100%;
40
+ background-position: 100% 0, 100% 0, 0 0;
41
+ font-family: ${akEditorCodeFontFamily};
42
+ margin: ${blockNodesVerticalMargin} 0 0 0;
43
+ min-width: ${akEditorTableCellMinWidth}px;
44
+ cursor: pointer;
45
+
46
+ .${CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER} {
47
+ flex-shrink: 0;
48
+ text-align: right;
49
+ background-color: ${themed({
50
+ light: token('color.background.neutral', N30),
51
+ dark: token('color.background.neutral', DN20)
52
+ })(props)};
53
+ padding: ${gridSize()}px;
54
+
55
+ span {
56
+ display: block;
57
+ line-height: 0;
58
+ font-size: 0;
59
+
60
+ ::before {
61
+ display: inline-block;
62
+ content: counter(line);
63
+ counter-increment: line;
64
+ color: ${themed({
65
+ light: token('color.text.subtlest', N400),
66
+ dark: token('color.text.subtlest', DN400)
67
+ })(props)};
68
+ font-size: ${relativeFontSizeToBase16(fontSize())};
69
+ line-height: 1.5rem;
70
+ }
71
+ }
72
+ }
73
+
74
+ .${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT} {
75
+ display: flex;
76
+ flex: 1;
77
+
78
+ code {
79
+ flex-grow: 1;
80
+ tab-size: 4;
81
+ cursor: text;
82
+ color: ${themed({
83
+ light: token('color.text', N800),
84
+ dark: token('color.text', DN800)
85
+ })(props)};
86
+ border-radius: ${borderRadius()}px;
87
+ margin: ${gridSize()}px;
88
+ white-space: pre;
89
+ font-size: ${relativeFontSizeToBase16(fontSize())};
90
+ line-height: 1.5rem;
91
+ }
92
+ }
93
+ }
94
+ `;
@@ -1,7 +1,8 @@
1
- import { emojiImage, emojiNode, emojiSprite } from '@atlaskit/emoji';
1
+ import { emojiImage, emojiNode, emojiPlaceholder, emojiSprite } from '@atlaskit/emoji';
2
2
  export const EmojiSharedCssClassName = {
3
3
  EMOJI_CONTAINER: 'emojiView-content-wrap',
4
4
  EMOJI_NODE: emojiNode,
5
5
  EMOJI_SPRITE: emojiSprite,
6
- EMOJI_IMAGE: emojiImage
6
+ EMOJI_IMAGE: emojiImage,
7
+ EMOJI_PLACEHOLDER: emojiPlaceholder
7
8
  };
@@ -138,7 +138,8 @@ export const PanelSharedSelectors = {
138
138
  emojiPopup: `[aria-label="Popup"]`,
139
139
  searchEmoji: `[aria-label="Search emoji"]`,
140
140
  orangeWarningIcon: `[aria-label=":warning:"]`,
141
- yellowWarningIcon: `[aria-label=":warning:"] span:nth-child(1)`
141
+ yellowWarningIcon: `[aria-label=":warning:"] span:nth-child(1)`,
142
+ copyButton: `button[aria-label="Copy"]`
142
143
  };
143
144
 
144
145
  const iconDynamicStyles = panelType => props => {
@@ -10,6 +10,8 @@ export default class Popup extends React.Component {
10
10
 
11
11
  super(...args);
12
12
 
13
+ _defineProperty(this, "rafIds", new Set());
14
+
13
15
  _defineProperty(this, "state", {
14
16
  validPosition: true
15
17
  });
@@ -24,7 +26,27 @@ export default class Popup extends React.Component {
24
26
  this.initPopup(popup);
25
27
  });
26
28
 
27
- _defineProperty(this, "scheduledUpdatePosition", rafSchedule(props => this.updatePosition(props)));
29
+ _defineProperty(this, "cancelRequestAnimationFrames", () => {
30
+ for (const rafId of this.rafIds) {
31
+ cancelAnimationFrame(rafId);
32
+ }
33
+ });
34
+
35
+ _defineProperty(this, "scheduledUpdatePosition", rafSchedule(props => {
36
+ if (!this.props.waitForExtraLayoutUpdates) {
37
+ this.updatePosition(this.props);
38
+ }
39
+
40
+ if (this.props.scheduleExtraLayoutUpdates) {
41
+ // We need two requestAnimationFrame calls to ensure reflow/repaints
42
+ // are flushed to DOM before our popup position recalculations happen
43
+ const rafId = requestAnimationFrame(() => {
44
+ this.updatePosition(this.props);
45
+ this.rafIds.delete(rafId);
46
+ });
47
+ this.rafIds.add(rafId);
48
+ }
49
+ }));
28
50
 
29
51
  _defineProperty(this, "onResize", () => this.scheduledUpdatePosition(this.props));
30
52
 
@@ -182,6 +204,7 @@ export default class Popup extends React.Component {
182
204
  }
183
205
 
184
206
  this.scheduledUpdatePosition.cancel();
207
+ this.cancelRequestAnimationFrames();
185
208
  }
186
209
 
187
210
  renderPopup() {
@@ -1,7 +1,15 @@
1
1
  import { css } from '@emotion/react'; // We use !important to ensure next sibling gets the margin reset no matter what
2
2
 
3
+ const marginTopReset = `margin-top: 0 !important;`;
3
4
  export const clearNextSiblingMarginTopStyle = css`
4
5
  & + * {
5
- margin-top: 0 !important;
6
+ ${marginTopReset}
7
+ }
8
+ `;
9
+ const textElements = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
10
+ const nextSiblingBlockMarkContentSelectors = textElements.map(elem => `+ .fabric-editor-block-mark > ${elem}`).join(',');
11
+ export const clearNextSiblingBlockMarkMarginTopStyle = css`
12
+ ${nextSiblingBlockMarkContentSelectors} {
13
+ ${marginTopReset}
6
14
  }
7
15
  `;
@@ -14,5 +14,5 @@ export { shadowObserverClassNames, ShadowObserver } from './OverflowShadow/shado
14
14
  export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
15
15
  export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef } from './Expand';
16
16
  export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
17
- export { clearNextSiblingMarginTopStyle } from './clear-next-sibling-margin-top';
17
+ export { clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from './clear-next-sibling-margin-top';
18
18
  export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
@@ -1,6 +1,5 @@
1
1
  export { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from './annotation';
2
2
  export { getExtensionLozengeData } from './macro';
3
- export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder } from './validator';
4
3
  export { default as browser } from './browser';
5
4
  export { default as ErrorReporter } from './error-reporter';
6
5
  export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC } from './date';
@@ -1 +1 @@
1
- export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder } from './utils/validator';
1
+ export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder, ADFStages } from './utils/validator';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "68.0.1",
3
+ "version": "69.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,7 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  import { getAutoConvertPatternsFromModule } from './module-helpers';
6
6
 
7
7
  var DefaultExtensionProvider = /*#__PURE__*/function () {
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
 
4
4
  function getExtensionModuleField(_x, _x2, _x3) {
5
5
  return _getExtensionModuleField.apply(this, arguments);
@@ -1,6 +1,6 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import React from 'react';
5
5
  import Loadable from 'react-loadable';
6
6
  import { getExtensionKeyAndNodeKey, resolveImport } from './manifest-helpers';
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
4
 
@@ -7,6 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
7
6
 
8
7
  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) { _defineProperty(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; }
9
8
 
9
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  export var FORGE_EXTENSION_TYPE = 'com.atlassian.ecosystem';
11
11
  export var getExtensionKeyAndNodeKey = function getExtensionKeyAndNodeKey(extensionKey, extensionType) {
12
12
  // Forge macro extensionKey has a user generated string, so splitting on
@@ -1,7 +1,7 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
 
6
6
  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; }
7
7
 
@@ -1,6 +1,6 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { getOnlyFulfilled, waitForAllPromises, waitForFirstFulfilledPromise } from './promise-helpers';
5
5
 
6
6
  var flatten = function flatten(arr) {
@@ -17,4 +17,5 @@ export { shadowSharedStyle } from './shared/shadow';
17
17
  export { dateSharedStyle, DateSharedCssClassName } from './shared/date';
18
18
  export { tasksAndDecisionsStyles, TaskDecisionSharedCssClassName } from './shared/task-decision';
19
19
  export { StatusSharedCssClassName } from './shared/status';
20
- export { smartCardSharedStyles, SmartCardSharedCssClassName } from './shared/smart-card';
20
+ export { smartCardSharedStyles, SmartCardSharedCssClassName } from './shared/smart-card';
21
+ export { CodeBlockSharedCssClassName, codeBlockSharedStyles } from './shared/code-block';
@@ -0,0 +1,39 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject;
4
+
5
+ import { css } from '@emotion/react';
6
+ import { akEditorCodeFontFamily, akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
7
+ import { DN20, DN400, DN50, DN800, N20, N30, N400, N800 } from '@atlaskit/theme/colors';
8
+ import { themed } from '@atlaskit/theme/components';
9
+ import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
10
+ import { token } from '@atlaskit/tokens';
11
+ export var CodeBlockSharedCssClassName = {
12
+ CODEBLOCK_CONTAINER: 'code-block',
13
+ CODEBLOCK_LINE_NUMBER_GUTTER: 'line-number-gutter',
14
+ CODEBLOCK_CONTENT: 'code-content',
15
+ DS_CODEBLOCK: '[data-ds--code--code-block]'
16
+ };
17
+ export var codeBlockSharedStyles = function codeBlockSharedStyles(props) {
18
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n counter-reset: line;\n display: flex;\n overflow-x: auto;\n\n background-image: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-repeat: no-repeat;\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n margin: ", " 0 0 0;\n min-width: ", "px;\n cursor: pointer;\n\n .", " {\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n ::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n color: ", ";\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, themed({
19
+ light: token('color.background.neutral', N20),
20
+ dark: token('color.background.neutral', DN50)
21
+ })(props), borderRadius(), overflowShadow({
22
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4118
23
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
24
+ background: themed({
25
+ light: N20,
26
+ dark: DN50
27
+ })(props),
28
+ width: '8px'
29
+ }), akEditorCodeFontFamily, blockNodesVerticalMargin, akEditorTableCellMinWidth, CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, themed({
30
+ light: token('color.background.neutral', N30),
31
+ dark: token('color.background.neutral', DN20)
32
+ })(props), gridSize(), themed({
33
+ light: token('color.text.subtlest', N400),
34
+ dark: token('color.text.subtlest', DN400)
35
+ })(props), relativeFontSizeToBase16(fontSize()), CodeBlockSharedCssClassName.CODEBLOCK_CONTENT, themed({
36
+ light: token('color.text', N800),
37
+ dark: token('color.text', DN800)
38
+ })(props), borderRadius(), gridSize(), relativeFontSizeToBase16(fontSize()));
39
+ };
@@ -1,7 +1,8 @@
1
- import { emojiImage, emojiNode, emojiSprite } from '@atlaskit/emoji';
1
+ import { emojiImage, emojiNode, emojiPlaceholder, emojiSprite } from '@atlaskit/emoji';
2
2
  export var EmojiSharedCssClassName = {
3
3
  EMOJI_CONTAINER: 'emojiView-content-wrap',
4
4
  EMOJI_NODE: emojiNode,
5
5
  EMOJI_SPRITE: emojiSprite,
6
- EMOJI_IMAGE: emojiImage
6
+ EMOJI_IMAGE: emojiImage,
7
+ EMOJI_PLACEHOLDER: emojiPlaceholder
7
8
  };
@@ -146,7 +146,8 @@ export var PanelSharedSelectors = {
146
146
  emojiPopup: "[aria-label=\"Popup\"]",
147
147
  searchEmoji: "[aria-label=\"Search emoji\"]",
148
148
  orangeWarningIcon: "[aria-label=\":warning:\"]",
149
- yellowWarningIcon: "[aria-label=\":warning:\"] span:nth-child(1)"
149
+ yellowWarningIcon: "[aria-label=\":warning:\"] span:nth-child(1)",
150
+ copyButton: "button[aria-label=\"Copy\"]"
150
151
  };
151
152
 
152
153
  var iconDynamicStyles = function iconDynamicStyles(panelType) {
@@ -10,6 +10,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
10
10
 
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) { _defineProperty(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
12
 
13
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
14
+
15
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16
+
17
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
18
+
13
19
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
20
 
15
21
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -38,6 +44,8 @@ var Popup = /*#__PURE__*/function (_React$Component) {
38
44
 
39
45
  _this = _super.call.apply(_super, [this].concat(args));
40
46
 
47
+ _defineProperty(_assertThisInitialized(_this), "rafIds", new Set());
48
+
41
49
  _defineProperty(_assertThisInitialized(_this), "state", {
42
50
  validPosition: true
43
51
  });
@@ -52,8 +60,38 @@ var Popup = /*#__PURE__*/function (_React$Component) {
52
60
  _this.initPopup(popup);
53
61
  });
54
62
 
63
+ _defineProperty(_assertThisInitialized(_this), "cancelRequestAnimationFrames", function () {
64
+ var _iterator = _createForOfIteratorHelper(_this.rafIds),
65
+ _step;
66
+
67
+ try {
68
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
69
+ var rafId = _step.value;
70
+ cancelAnimationFrame(rafId);
71
+ }
72
+ } catch (err) {
73
+ _iterator.e(err);
74
+ } finally {
75
+ _iterator.f();
76
+ }
77
+ });
78
+
55
79
  _defineProperty(_assertThisInitialized(_this), "scheduledUpdatePosition", rafSchedule(function (props) {
56
- return _this.updatePosition(props);
80
+ if (!_this.props.waitForExtraLayoutUpdates) {
81
+ _this.updatePosition(_this.props);
82
+ }
83
+
84
+ if (_this.props.scheduleExtraLayoutUpdates) {
85
+ // We need two requestAnimationFrame calls to ensure reflow/repaints
86
+ // are flushed to DOM before our popup position recalculations happen
87
+ var rafId = requestAnimationFrame(function () {
88
+ _this.updatePosition(_this.props);
89
+
90
+ _this.rafIds.delete(rafId);
91
+ });
92
+
93
+ _this.rafIds.add(rafId);
94
+ }
57
95
  }));
58
96
 
59
97
  _defineProperty(_assertThisInitialized(_this), "onResize", function () {
@@ -220,6 +258,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
220
258
  }
221
259
 
222
260
  this.scheduledUpdatePosition.cancel();
261
+ this.cancelRequestAnimationFrames();
223
262
  }
224
263
  }, {
225
264
  key: "renderPopup",
@@ -1,7 +1,13 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
 
3
- var _templateObject;
3
+ var _templateObject, _templateObject2;
4
4
 
5
5
  import { css } from '@emotion/react'; // We use !important to ensure next sibling gets the margin reset no matter what
6
6
 
7
- export var clearNextSiblingMarginTopStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & + * {\n margin-top: 0 !important;\n }\n"])));
7
+ var marginTopReset = "margin-top: 0 !important;";
8
+ export var clearNextSiblingMarginTopStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & + * {\n ", "\n }\n"])), marginTopReset);
9
+ var textElements = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
10
+ var nextSiblingBlockMarkContentSelectors = textElements.map(function (elem) {
11
+ return "+ .fabric-editor-block-mark > ".concat(elem);
12
+ }).join(',');
13
+ export var clearNextSiblingBlockMarkMarginTopStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " {\n ", "\n }\n"])), nextSiblingBlockMarkContentSelectors, marginTopReset);
@@ -14,5 +14,5 @@ export { shadowObserverClassNames, ShadowObserver } from './OverflowShadow/shado
14
14
  export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
15
15
  export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef } from './Expand';
16
16
  export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
17
- export { clearNextSiblingMarginTopStyle } from './clear-next-sibling-margin-top';
17
+ export { clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from './clear-next-sibling-margin-top';
18
18
  export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
@@ -1,6 +1,5 @@
1
1
  export { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from './annotation';
2
2
  export { getExtensionLozengeData } from './macro';
3
- export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder } from './validator';
4
3
  export { default as browser } from './browser';
5
4
  export { default as ErrorReporter } from './error-reporter';
6
5
  export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC } from './date';
@@ -1 +1 @@
1
- export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder } from './utils/validator';
1
+ export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder, ADFStages } from './utils/validator';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "68.0.1",
3
+ "version": "69.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,6 +2,6 @@ import { CardAdf } from '@atlaskit/smart-card';
2
2
  export declare type CardAppearance = 'inline' | 'block' | 'embed';
3
3
  export type { CardAdf };
4
4
  export interface CardProvider {
5
- resolve(url: string, appearance: CardAppearance): Promise<CardAdf>;
5
+ resolve(url: string, appearance: CardAppearance, shouldForceAppearance?: boolean): Promise<CardAdf>;
6
6
  findPattern(url: string): Promise<boolean>;
7
7
  }
@@ -18,3 +18,4 @@ export { dateSharedStyle, DateSharedCssClassName } from './shared/date';
18
18
  export { tasksAndDecisionsStyles, TaskDecisionSharedCssClassName, } from './shared/task-decision';
19
19
  export { StatusSharedCssClassName } from './shared/status';
20
20
  export { smartCardSharedStyles, SmartCardSharedCssClassName, } from './shared/smart-card';
21
+ export { CodeBlockSharedCssClassName, codeBlockSharedStyles, } from './shared/code-block';
@@ -0,0 +1,8 @@
1
+ import { ThemeProps } from '@atlaskit/theme/types';
2
+ export declare const CodeBlockSharedCssClassName: {
3
+ CODEBLOCK_CONTAINER: string;
4
+ CODEBLOCK_LINE_NUMBER_GUTTER: string;
5
+ CODEBLOCK_CONTENT: string;
6
+ DS_CODEBLOCK: string;
7
+ };
8
+ export declare const codeBlockSharedStyles: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
@@ -3,4 +3,5 @@ export declare const EmojiSharedCssClassName: {
3
3
  EMOJI_NODE: string;
4
4
  EMOJI_SPRITE: string;
5
5
  EMOJI_IMAGE: string;
6
+ EMOJI_PLACEHOLDER: string;
6
7
  };
@@ -77,6 +77,7 @@ export declare const PanelSharedSelectors: {
77
77
  searchEmoji: string;
78
78
  orangeWarningIcon: string;
79
79
  yellowWarningIcon: string;
80
+ copyButton: string;
80
81
  };
81
82
  export declare const getPanelTypeBackground: (panelType: Exclude<PanelType, PanelType.CUSTOM>, props?: ThemeProps) => string;
82
83
  export declare const panelSharedStylesWithoutPrefix: (props: ThemeProps) => import("@emotion/react").SerializedStyles;
@@ -19,6 +19,8 @@ export interface Props {
19
19
  forcePlacement?: boolean;
20
20
  allowOutOfBounds?: boolean;
21
21
  rect?: DOMRect;
22
+ scheduleExtraLayoutUpdates?: boolean;
23
+ waitForExtraLayoutUpdates?: boolean;
22
24
  }
23
25
  export interface State {
24
26
  popup?: HTMLElement;
@@ -28,6 +30,7 @@ export interface State {
28
30
  export default class Popup extends React.Component<Props, State> {
29
31
  scrollElement: undefined | false | HTMLElement;
30
32
  scrollParentElement: undefined | false | HTMLElement;
33
+ rafIds: Set<number>;
31
34
  static defaultProps: {
32
35
  offset: number[];
33
36
  allowOutOfBound: boolean;
@@ -46,6 +49,7 @@ export default class Popup extends React.Component<Props, State> {
46
49
  */
47
50
  private initPopup;
48
51
  private handleRef;
52
+ private cancelRequestAnimationFrames;
49
53
  private scheduledUpdatePosition;
50
54
  onResize: () => void;
51
55
  UNSAFE_componentWillReceiveProps(newProps: Props): void;
@@ -1 +1,2 @@
1
1
  export declare const clearNextSiblingMarginTopStyle: import("@emotion/react").SerializedStyles;
2
+ export declare const clearNextSiblingBlockMarkMarginTopStyle: import("@emotion/react").SerializedStyles;
@@ -21,5 +21,5 @@ export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
21
21
  export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef, } from './Expand';
22
22
  export type { StyleProps as ExpandStyleProps } from './Expand';
23
23
  export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
24
- export { clearNextSiblingMarginTopStyle } from './clear-next-sibling-margin-top';
24
+ export { clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle, } from './clear-next-sibling-margin-top';
25
25
  export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE, } from './IntlErrorBoundary';
@@ -1,8 +1,6 @@
1
1
  export { canApplyAnnotationOnRange, getAnnotationIdsFromRange, } from './annotation';
2
2
  export { getExtensionLozengeData } from './macro';
3
3
  export type { Params } from './macro';
4
- export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder, } from './validator';
5
- export type { ADDoc, ADFStage, ADFStages, ADMark, ADMarkSimple, ADNode, } from './validator';
6
4
  export { default as browser } from './browser';
7
5
  export { default as ErrorReporter } from './error-reporter';
8
6
  export type { ErrorReportingHandler } from './error-reporter';
@@ -1,2 +1,2 @@
1
- export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder, } from './utils/validator';
1
+ export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder, ADFStages, } from './utils/validator';
2
2
  export type { ADDoc, ADFStage, ADMark, ADMarkSimple, ADNode, } from './utils/validator';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "68.0.1",
3
+ "version": "69.0.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,22 +44,23 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@atlaskit/activity-provider": "^2.3.0",
47
- "@atlaskit/adf-schema": "^23.1.0",
48
- "@atlaskit/adf-utils": "^17.0.0",
49
- "@atlaskit/analytics-namespaced-context": "^6.4.0",
47
+ "@atlaskit/adf-schema": "^23.2.0",
48
+ "@atlaskit/adf-utils": "^17.1.0",
49
+ "@atlaskit/analytics-namespaced-context": "^6.5.0",
50
50
  "@atlaskit/analytics-next": "^8.2.0",
51
51
  "@atlaskit/code": "^14.3.0",
52
+ "@atlaskit/codemod-utils": "^4.1.0",
52
53
  "@atlaskit/editor-json-transformer": "^8.7.0",
53
54
  "@atlaskit/editor-shared-styles": "^2.1.0",
54
- "@atlaskit/emoji": "^64.7.0",
55
+ "@atlaskit/emoji": "^65.0.0",
55
56
  "@atlaskit/icon": "^21.10.0",
56
57
  "@atlaskit/in-product-testing": "^0.1.0",
57
- "@atlaskit/media-card": "^73.8.0",
58
- "@atlaskit/media-client": "^17.0.0",
58
+ "@atlaskit/media-card": "^74.0.0",
59
+ "@atlaskit/media-client": "^17.1.0",
59
60
  "@atlaskit/media-picker": "^63.0.0",
60
61
  "@atlaskit/mention": "^21.0.0",
61
- "@atlaskit/profilecard": "^16.5.0",
62
- "@atlaskit/smart-card": "^19.1.0",
62
+ "@atlaskit/profilecard": "^16.10.0",
63
+ "@atlaskit/smart-card": "^21.0.0",
63
64
  "@atlaskit/smart-user-picker": "^5.1.0",
64
65
  "@atlaskit/task-decision": "^17.4.0",
65
66
  "@atlaskit/theme": "^12.1.0",
@@ -85,16 +86,16 @@
85
86
  "react-loadable": "^5.1.0"
86
87
  },
87
88
  "peerDependencies": {
88
- "@atlaskit/media-core": "^33.0.0",
89
+ "@atlaskit/media-core": "^33.0.1",
89
90
  "react": "^16.8.0",
90
91
  "react-dom": "^16.8.0",
91
92
  "react-intl-next": "npm:react-intl@^5.18.1"
92
93
  },
93
94
  "devDependencies": {
94
95
  "@atlaskit/editor-json-transformer": "^8.7.0",
95
- "@atlaskit/editor-test-helpers": "^17.0.0",
96
+ "@atlaskit/editor-test-helpers": "^17.1.0",
96
97
  "@atlaskit/media-core": "^33.0.0",
97
- "@atlaskit/util-data-test": "^17.3.0",
98
+ "@atlaskit/util-data-test": "^17.5.0",
98
99
  "@atlaskit/visual-regression": "*",
99
100
  "@atlaskit/webdriver-runner": "*",
100
101
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
package/report.api.md ADDED
@@ -0,0 +1,7 @@
1
+ ## API Report File for "@atlaskit/editor-common"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ export {};
7
+ ```