@atlaskit/editor-common 70.1.3 → 70.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/cjs/react-node-view/index.js +19 -17
  3. package/dist/cjs/styles/index.js +12 -0
  4. package/dist/cjs/styles/shared/code-block.js +5 -3
  5. package/dist/cjs/styles/shared/lists.js +4 -2
  6. package/dist/cjs/styles/shared/table.js +1 -1
  7. package/dist/cjs/types/copy-button.js +5 -0
  8. package/dist/cjs/ui/DropList/index.js +1 -1
  9. package/dist/cjs/ui/Expand/index.js +2 -2
  10. package/dist/cjs/ui/IntlProviderIfMissingWrapper/index.js +33 -0
  11. package/dist/cjs/ui/Popup/index.js +2 -2
  12. package/dist/cjs/ui/PortalProvider/index.js +62 -47
  13. package/dist/cjs/ui/index.js +8 -0
  14. package/dist/cjs/utils/breakout.js +53 -2
  15. package/dist/cjs/utils/collab.js +22 -0
  16. package/dist/cjs/utils/dom.js +16 -0
  17. package/dist/cjs/utils/get-performance-options.js +70 -0
  18. package/dist/cjs/utils/index.js +57 -1
  19. package/dist/cjs/utils/outdated-browsers.js +41 -0
  20. package/dist/cjs/utils/referentiality.js +49 -0
  21. package/dist/cjs/utils/sendLogs.js +19 -0
  22. package/dist/cjs/version.json +1 -1
  23. package/dist/cjs/with-plugin-state/index.js +61 -54
  24. package/dist/es2019/react-node-view/index.js +19 -24
  25. package/dist/es2019/styles/index.js +2 -2
  26. package/dist/es2019/styles/shared/code-block.js +13 -1
  27. package/dist/es2019/styles/shared/lists.js +2 -1
  28. package/dist/es2019/styles/shared/table.js +4 -2
  29. package/dist/es2019/types/copy-button.js +1 -0
  30. package/dist/es2019/ui/DropList/index.js +1 -1
  31. package/dist/es2019/ui/Expand/index.js +17 -15
  32. package/dist/es2019/ui/IntlProviderIfMissingWrapper/index.js +18 -0
  33. package/dist/es2019/ui/Popup/index.js +2 -1
  34. package/dist/es2019/ui/PortalProvider/index.js +33 -14
  35. package/dist/es2019/ui/index.js +2 -1
  36. package/dist/es2019/utils/breakout.js +47 -1
  37. package/dist/es2019/utils/collab.js +13 -0
  38. package/dist/es2019/utils/dom.js +16 -0
  39. package/dist/es2019/utils/get-performance-options.js +57 -0
  40. package/dist/es2019/utils/index.js +6 -2
  41. package/dist/es2019/utils/outdated-browsers.js +32 -0
  42. package/dist/es2019/utils/referentiality.js +34 -0
  43. package/dist/es2019/utils/sendLogs.js +8 -0
  44. package/dist/es2019/version.json +1 -1
  45. package/dist/es2019/with-plugin-state/index.js +55 -52
  46. package/dist/esm/react-node-view/index.js +19 -22
  47. package/dist/esm/styles/index.js +2 -2
  48. package/dist/esm/styles/shared/code-block.js +4 -3
  49. package/dist/esm/styles/shared/lists.js +2 -1
  50. package/dist/esm/styles/shared/table.js +1 -1
  51. package/dist/esm/types/copy-button.js +1 -0
  52. package/dist/esm/ui/DropList/index.js +1 -1
  53. package/dist/esm/ui/Expand/index.js +2 -2
  54. package/dist/esm/ui/IntlProviderIfMissingWrapper/index.js +19 -0
  55. package/dist/esm/ui/Popup/index.js +2 -2
  56. package/dist/esm/ui/PortalProvider/index.js +59 -48
  57. package/dist/esm/ui/index.js +2 -1
  58. package/dist/esm/utils/breakout.js +46 -1
  59. package/dist/esm/utils/collab.js +13 -0
  60. package/dist/esm/utils/dom.js +16 -0
  61. package/dist/esm/utils/get-performance-options.js +55 -0
  62. package/dist/esm/utils/index.js +6 -2
  63. package/dist/esm/utils/outdated-browsers.js +32 -0
  64. package/dist/esm/utils/referentiality.js +40 -0
  65. package/dist/esm/utils/sendLogs.js +10 -0
  66. package/dist/esm/version.json +1 -1
  67. package/dist/esm/with-plugin-state/index.js +59 -54
  68. package/dist/types/analytics/types/events.d.ts +1 -0
  69. package/dist/types/extensions/types/extension-handler.d.ts +1 -0
  70. package/dist/types/styles/index.d.ts +2 -2
  71. package/dist/types/styles/shared/code-block.d.ts +1 -0
  72. package/dist/types/styles/shared/lists.d.ts +1 -0
  73. package/dist/types/types/copy-button.d.ts +20 -0
  74. package/dist/types/types/editor-actions.d.ts +1 -0
  75. package/dist/types/types/editor-container-width.d.ts +14 -0
  76. package/dist/types/types/feature-flags.d.ts +0 -6
  77. package/dist/types/types/floating-toolbar.d.ts +23 -2
  78. package/dist/types/types/index.d.ts +2 -1
  79. package/dist/types/ui/IntlProviderIfMissingWrapper/index.d.ts +6 -0
  80. package/dist/types/ui/Popup/index.d.ts +1 -0
  81. package/dist/types/ui/PortalProvider/index.d.ts +2 -1
  82. package/dist/types/ui/index.d.ts +1 -0
  83. package/dist/types/utils/breakout.d.ts +25 -0
  84. package/dist/types/utils/collab.d.ts +2 -0
  85. package/dist/types/utils/dom.d.ts +15 -1
  86. package/dist/types/utils/get-performance-options.d.ts +18 -0
  87. package/dist/types/utils/getModeFromTheme.d.ts +1 -1
  88. package/dist/types/utils/index.d.ts +5 -1
  89. package/dist/types/utils/outdated-browsers.d.ts +1 -0
  90. package/dist/types/utils/referentiality.d.ts +3 -0
  91. package/dist/types/utils/sendLogs.d.ts +1 -0
  92. package/dist/types/with-plugin-state/index.d.ts +4 -2
  93. package/dist/types-ts4.0/analytics/types/events.d.ts +1 -0
  94. package/dist/types-ts4.0/extensions/types/extension-handler.d.ts +1 -0
  95. package/dist/types-ts4.0/styles/index.d.ts +2 -2
  96. package/dist/types-ts4.0/styles/shared/code-block.d.ts +1 -0
  97. package/dist/types-ts4.0/styles/shared/lists.d.ts +1 -0
  98. package/dist/types-ts4.0/types/copy-button.d.ts +20 -0
  99. package/dist/types-ts4.0/types/editor-actions.d.ts +1 -0
  100. package/dist/types-ts4.0/types/editor-container-width.d.ts +14 -0
  101. package/dist/types-ts4.0/types/feature-flags.d.ts +0 -6
  102. package/dist/types-ts4.0/types/floating-toolbar.d.ts +23 -2
  103. package/dist/types-ts4.0/types/index.d.ts +2 -1
  104. package/dist/types-ts4.0/ui/IntlProviderIfMissingWrapper/index.d.ts +6 -0
  105. package/dist/types-ts4.0/ui/Popup/index.d.ts +1 -0
  106. package/dist/types-ts4.0/ui/PortalProvider/index.d.ts +2 -1
  107. package/dist/types-ts4.0/ui/index.d.ts +1 -0
  108. package/dist/types-ts4.0/utils/breakout.d.ts +25 -0
  109. package/dist/types-ts4.0/utils/collab.d.ts +2 -0
  110. package/dist/types-ts4.0/utils/dom.d.ts +15 -1
  111. package/dist/types-ts4.0/utils/get-performance-options.d.ts +18 -0
  112. package/dist/types-ts4.0/utils/getModeFromTheme.d.ts +1 -1
  113. package/dist/types-ts4.0/utils/index.d.ts +5 -1
  114. package/dist/types-ts4.0/utils/outdated-browsers.d.ts +1 -0
  115. package/dist/types-ts4.0/utils/referentiality.d.ts +3 -0
  116. package/dist/types-ts4.0/utils/sendLogs.d.ts +1 -0
  117. package/dist/types-ts4.0/with-plugin-state/index.d.ts +4 -2
  118. package/package.json +9 -6
  119. package/report.api.md +7 -3
@@ -6,11 +6,8 @@ import React from 'react';
6
6
  import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
7
7
  import { createDispatch } from '../event-dispatcher';
8
8
  import { ErrorBoundary } from '../ui/ErrorBoundary';
9
- import { analyticsEventKey } from '../utils/analytics'; //import {
10
- // getPerformanceOptions,
11
- // startMeasureReactNodeViewRendered,
12
- // stopMeasureReactNodeViewRendered,
13
- //} from './get-performance-options';
9
+ import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
10
+ import { analyticsEventKey } from '../utils/analytics';
14
11
 
15
12
  var ReactNodeView = /*#__PURE__*/function () {
16
13
  function ReactNodeView(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent) {
@@ -82,26 +79,26 @@ var ReactNodeView = /*#__PURE__*/function () {
82
79
  // difference between them and it kills the nodeView
83
80
 
84
81
 
85
- this.domRef.classList.add("".concat(this.node.type.name, "View-content-wrap")); // TODO: ED-15580
86
- //const {
87
- // samplingRate,
88
- // slowThreshold,
89
- // trackingEnabled,
90
- //} = getPerformanceOptions(this.view);
91
- //trackingEnabled &&
92
- // startMeasureReactNodeViewRendered({ nodeTypeName: this.node.type.name });
82
+ this.domRef.classList.add("".concat(this.node.type.name, "View-content-wrap"));
93
83
 
84
+ var _getPerformanceOption = getPerformanceOptions(this.view),
85
+ samplingRate = _getPerformanceOption.samplingRate,
86
+ slowThreshold = _getPerformanceOption.slowThreshold,
87
+ trackingEnabled = _getPerformanceOption.trackingEnabled;
88
+
89
+ trackingEnabled && startMeasureReactNodeViewRendered({
90
+ nodeTypeName: this.node.type.name
91
+ });
94
92
  this.renderReactComponent(function () {
95
93
  return _this2.render(_this2.reactComponentProps, _this2.handleRef);
96
- }); //trackingEnabled &&
97
- // stopMeasureReactNodeViewRendered({
98
- // nodeTypeName: this.node.type.name,
99
- // dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
100
- // editorState: this.view.state,
101
- // samplingRate,
102
- // slowThreshold,
103
- // });
104
-
94
+ });
95
+ trackingEnabled && stopMeasureReactNodeViewRendered({
96
+ nodeTypeName: this.node.type.name,
97
+ dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
98
+ editorState: this.view.state,
99
+ samplingRate: samplingRate,
100
+ slowThreshold: slowThreshold
101
+ });
105
102
  return this;
106
103
  }
107
104
  }, {
@@ -9,7 +9,7 @@ export { ruleSharedStyles } from './shared/rule';
9
9
  export { whitespaceSharedStyles } from './shared/whitespace';
10
10
  export { paragraphSharedStyles } from './shared/paragraph';
11
11
  export { linkSharedStyle } from './shared/link';
12
- export { listsSharedStyles } from './shared/lists';
12
+ export { listsSharedStyles, listPaddingLeftMarkerSpace } from './shared/lists';
13
13
  export { indentationSharedStyles } from './shared/indentation';
14
14
  export { blockMarksSharedStyles } from './shared/block-marks';
15
15
  export { codeMarkSharedStyles } from './shared/code-mark';
@@ -18,6 +18,6 @@ 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';
21
+ export { CodeBlockSharedCssClassName, codeBlockSharedStyles, codeBlockInListSafariFix } from './shared/code-block';
22
22
  export { LAYOUT_SECTION_MARGIN, LAYOUT_COLUMN_PADDING } from './shared/layout';
23
23
  export { EXTENSION_PADDING, BODIED_EXT_PADDING } from './shared/extension';
@@ -1,9 +1,9 @@
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';
6
- import { akEditorCodeFontFamily, akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
6
+ import { akEditorCodeFontFamily, akEditorLineHeight, akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
7
7
  import { DN20, DN400, DN50, DN800, N20, N30, N400, N800 } from '@atlaskit/theme/colors';
8
8
  import { themed } from '@atlaskit/theme/components';
9
9
  import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
@@ -38,4 +38,5 @@ export var codeBlockSharedStyles = function codeBlockSharedStyles(props) {
38
38
  light: token('color.text', N800),
39
39
  dark: token('color.text', DN800)
40
40
  })(props), borderRadius(), gridSize(), relativeFontSizeToBase16(fontSize()));
41
- };
41
+ };
42
+ export var codeBlockInListSafariFix = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ::before {\n content: ' ';\n line-height: ", ";\n }\n\n > p:first-child,\n > .code-block:first-child,\n > .ProseMirror-gapcursor:first-child + .code-block {\n margin-top: -", "em !important;\n }\n"])), akEditorLineHeight, akEditorLineHeight);
@@ -5,4 +5,5 @@ var _templateObject;
5
5
  import { css } from '@emotion/react';
6
6
  import { bulletListSelector, orderedListSelector } from '@atlaskit/adf-schema';
7
7
  import browser from '../../utils/browser';
8
- export var listsSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* =============== INDENTATION SPACING ========= */\n\n ul,\n ol {\n box-sizing: border-box;\n padding-left: 24px;\n\n /*\n Firefox does not handle empty block element inside li tag.\n If there is not block element inside li tag,\n then firefox sets inherited height to li\n However, if there is any block element and if it's empty\n (or has empty inline element) then\n firefox sets li tag height to zero.\n More details at\n https://product-fabric.atlassian.net/wiki/spaces/~455502413/pages/3149365890/ED-14110+Investigation\n */\n li p:empty,\n li p > span:empty {\n ", "\n }\n }\n\n ", ", ", " {\n /*\n Ensures list item content adheres to the list's margin instead\n of filling the entire block row. This is important to allow\n clicking interactive elements which are floated next to a list.\n\n For some history and context on this block, see PRs related to tickets.:\n @see ED-6551 - original issue.\n @see ED-7015 - follow up issue.\n @see ED-7447 - flow-root change.\n\n We use 'display: table' (old clear fix / new block formatting context hack)\n for older browsers and 'flow-root' for modern browsers.\n\n @see https://css-tricks.com/display-flow-root/\n */\n // For older browsers the do not support flow-root.\n /* stylelint-disable declaration-block-no-duplicate-properties */\n display: table;\n display: flow-root;\n /* stylelint-enable declaration-block-no-duplicate-properties */\n }\n\n /* =============== INDENTATION AESTHETICS ========= */\n\n /**\n We support nested lists up to six levels deep.\n **/\n\n /* LEGACY LISTS */\n\n ul,\n ul ul ul ul {\n list-style-type: disc;\n }\n\n ul ul,\n ul ul ul ul ul {\n list-style-type: circle;\n }\n\n ul ul ul,\n ul ul ul ul ul ul {\n list-style-type: square;\n }\n\n ol,\n ol ol ol ol {\n list-style-type: decimal;\n }\n ol ol,\n ol ol ol ol ol {\n list-style-type: lower-alpha;\n }\n ol ol ol,\n ol ol ol ol ol ol {\n list-style-type: lower-roman;\n }\n\n /* PREDICTABLE LISTS */\n\n ol[data-indent-level='1'],\n ol[data-indent-level='4'] {\n list-style-type: decimal;\n }\n\n ol[data-indent-level='2'],\n ol[data-indent-level='5'] {\n list-style-type: lower-alpha;\n }\n\n ol[data-indent-level='3'],\n ol[data-indent-level='6'] {\n list-style-type: lower-roman;\n }\n\n ul[data-indent-level='1'],\n ul[data-indent-level='4'] {\n list-style-type: disc;\n }\n\n ul[data-indent-level='2'],\n ul[data-indent-level='5'] {\n list-style-type: circle;\n }\n\n ul[data-indent-level='3'],\n ul[data-indent-level='6'] {\n list-style-type: square;\n }\n"])), browser.gecko ? 'display: inline-block;' : '', orderedListSelector, bulletListSelector);
8
+ export var listPaddingLeftMarkerSpace = 24;
9
+ export var listsSharedStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* =============== INDENTATION SPACING ========= */\n\n ul,\n ol {\n box-sizing: border-box;\n padding-left: ", "px;\n\n /*\n Firefox does not handle empty block element inside li tag.\n If there is not block element inside li tag,\n then firefox sets inherited height to li\n However, if there is any block element and if it's empty\n (or has empty inline element) then\n firefox sets li tag height to zero.\n More details at\n https://product-fabric.atlassian.net/wiki/spaces/~455502413/pages/3149365890/ED-14110+Investigation\n */\n li p:empty,\n li p > span:empty {\n ", "\n }\n }\n\n ", ", ", " {\n /*\n Ensures list item content adheres to the list's margin instead\n of filling the entire block row. This is important to allow\n clicking interactive elements which are floated next to a list.\n\n For some history and context on this block, see PRs related to tickets.:\n @see ED-6551 - original issue.\n @see ED-7015 - follow up issue.\n @see ED-7447 - flow-root change.\n\n We use 'display: table' (old clear fix / new block formatting context hack)\n for older browsers and 'flow-root' for modern browsers.\n\n @see https://css-tricks.com/display-flow-root/\n */\n // For older browsers the do not support flow-root.\n /* stylelint-disable declaration-block-no-duplicate-properties */\n display: table;\n display: flow-root;\n /* stylelint-enable declaration-block-no-duplicate-properties */\n }\n\n /* =============== INDENTATION AESTHETICS ========= */\n\n /**\n We support nested lists up to six levels deep.\n **/\n\n /* LEGACY LISTS */\n\n ul,\n ul ul ul ul {\n list-style-type: disc;\n }\n\n ul ul,\n ul ul ul ul ul {\n list-style-type: circle;\n }\n\n ul ul ul,\n ul ul ul ul ul ul {\n list-style-type: square;\n }\n\n ol,\n ol ol ol ol {\n list-style-type: decimal;\n }\n ol ol,\n ol ol ol ol ol {\n list-style-type: lower-alpha;\n }\n ol ol ol,\n ol ol ol ol ol ol {\n list-style-type: lower-roman;\n }\n\n /* PREDICTABLE LISTS */\n\n ol[data-indent-level='1'],\n ol[data-indent-level='4'] {\n list-style-type: decimal;\n }\n\n ol[data-indent-level='2'],\n ol[data-indent-level='5'] {\n list-style-type: lower-alpha;\n }\n\n ol[data-indent-level='3'],\n ol[data-indent-level='6'] {\n list-style-type: lower-roman;\n }\n\n ul[data-indent-level='1'],\n ul[data-indent-level='4'] {\n list-style-type: disc;\n }\n\n ul[data-indent-level='2'],\n ul[data-indent-level='5'] {\n list-style-type: circle;\n }\n\n ul[data-indent-level='3'],\n ul[data-indent-level='6'] {\n list-style-type: square;\n }\n"])), listPaddingLeftMarkerSpace, browser.gecko ? 'display: inline-block;' : '', orderedListSelector, bulletListSelector);
@@ -38,7 +38,7 @@ export var TableSharedCssClassName = {
38
38
  };
39
39
 
40
40
  var tableSharedStyle = function tableSharedStyle(props) {
41
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n margin: 0 auto ", "px;\n box-sizing: border-box;\n\n /**\n * Fix block top alignment inside table cells.\n */\n .decisionItemView-content-wrap:first-of-type > div {\n margin-top: 0;\n }\n }\n .", "[data-number-column='true'] {\n padding-left: ", "px;\n clear: both;\n }\n .", " > table {\n margin: ", "px 0 0 0;\n }\n\n .", " > table,\n .", " > table {\n margin: ", "px ", "px 0 0;\n }\n\n /* avoid applying styles to nested tables (possible via extensions) */\n .", " > table,\n .", " > table,\n .", " > table {\n border-collapse: collapse;\n border: ", "px solid\n ", ";\n table-layout: fixed;\n font-size: 1em;\n width: 100%;\n\n &[data-autosize='true'] {\n table-layout: auto;\n }\n\n & {\n * {\n box-sizing: border-box;\n }\n hr {\n box-sizing: content-box;\n }\n\n tbody {\n border-bottom: none;\n }\n th td {\n background-color: ", ";\n }\n th,\n td {\n min-width: ", "px;\n font-weight: normal;\n vertical-align: top;\n border: 1px solid\n ", ";\n border-right-width: 0;\n border-bottom-width: 0;\n padding: ", "px;\n /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n ", "\n\n ", ";\n\n > :first-child:not(style),\n > style:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-of-type + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-of-type + span + * {\n margin-top: 0;\n }\n\n th p:not(:first-of-type),\n td p:not(:first-of-type) {\n margin-top: 12px;\n }\n }\n th {\n background-color: ", ";\n text-align: left;\n\n /* only apply this styling to codeblocks in default background headercells */\n /* TODO this needs to be overhauled as it relies on unsafe selectors */\n &:not([style]) {\n .code-block {\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n background-color: ", ";\n\n .line-number-gutter {\n background-color: ", ";\n }\n\n /* this is only relevant to the element taken care of by renderer */\n > [data-ds--code--code-block] {\n background-image: ", "!important;\n\n background-color: ", "!important;\n\n // selector lives inside @atlaskit/code\n --ds--code--line-number-bg-color: ", ";\n }\n }\n }\n }\n }\n }\n"])), TableSharedCssClassName.TABLE_CONTAINER, tableMarginBottom, TableSharedCssClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_NODE_WRAPPER, tableMarginTop, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableMarginTop, tableMarginSides, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableCellBorderWidth, themed({
41
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n margin: 0 auto ", "px;\n box-sizing: border-box;\n\n /**\n * Fix block top alignment inside table cells.\n */\n .decisionItemView-content-wrap:first-of-type > div {\n margin-top: 0;\n }\n }\n .", "[data-number-column='true'] {\n padding-left: ", "px;\n clear: both;\n }\n .", " > table {\n margin: ", "px 0 0 0;\n }\n\n .", " > table,\n .", " > table {\n margin: ", "px ", "px 0 0;\n }\n\n /* avoid applying styles to nested tables (possible via extensions) */\n .", " > table,\n .", " > table,\n .", " > table {\n border-collapse: collapse;\n border: ", "px solid\n ", ";\n table-layout: fixed;\n font-size: 1em;\n width: 100%;\n\n &[data-autosize='true'] {\n table-layout: auto;\n }\n\n & {\n * {\n box-sizing: border-box;\n }\n hr {\n box-sizing: content-box;\n }\n\n tbody {\n border-bottom: none;\n }\n th td {\n background-color: ", ";\n }\n th,\n td {\n min-width: ", "px;\n font-weight: normal;\n vertical-align: top;\n border: 1px solid\n ", ";\n border-right-width: 0;\n border-bottom-width: 0;\n padding: ", "px;\n /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n ", "\n\n ", ";\n\n > :first-child:not(style),\n > style:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + *,\n > style:first-child + .ProseMirror-gapcursor + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + *,\n > style:first-child + .ProseMirror-gapcursor + span + * {\n margin-top: 0;\n }\n\n th p:not(:first-of-type),\n td p:not(:first-of-type) {\n margin-top: 12px;\n }\n }\n th {\n background-color: ", ";\n text-align: left;\n\n /* only apply this styling to codeblocks in default background headercells */\n /* TODO this needs to be overhauled as it relies on unsafe selectors */\n &:not([style]) {\n .code-block {\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n background-color: ", ";\n\n .line-number-gutter {\n background-color: ", ";\n }\n\n /* this is only relevant to the element taken care of by renderer */\n > [data-ds--code--code-block] {\n background-image: ", "!important;\n\n background-color: ", "!important;\n\n // selector lives inside @atlaskit/code\n --ds--code--line-number-bg-color: ", ";\n }\n }\n }\n }\n }\n }\n"])), TableSharedCssClassName.TABLE_CONTAINER, tableMarginBottom, TableSharedCssClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_NODE_WRAPPER, tableMarginTop, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableMarginTop, tableMarginSides, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableCellBorderWidth, themed({
42
42
  light: token('color.border', akEditorTableBorder),
43
43
  dark: token('color.border', akEditorTableBorderDark)
44
44
  })(props), token('color.background.neutral.subtle', 'white'), tableCellMinWidth, themed({
@@ -0,0 +1 @@
1
+ export {};
@@ -23,7 +23,7 @@ import { borderRadius, gridSize } from '@atlaskit/theme/constants';
23
23
  import { token } from '@atlaskit/tokens';
24
24
  import Layer from '../Layer';
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "70.1.3";
26
+ var packageVersion = "70.2.0";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = "0, ".concat(gridSize(), "px");
29
29
 
@@ -88,7 +88,7 @@ var containerStyles = function containerStyles(styleProps) {
88
88
  var marginHorizontal = styleProps['data-node-type'] === 'expand' ? "-".concat(akLayoutGutterOffset, "px") : 0;
89
89
  var margin = "".concat(marginTop, " ").concat(marginHorizontal, " ").concat(marginBottom);
90
90
  return function (themeProps) {
91
- return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n border-radius: ", "px;\n min-height: 25px;\n background: ", ";\n margin: ", ";\n\n transition: background 0.3s ", ",\n border-color 0.3s ", ";\n padding: ", "px;\n\n // TODO: https://product-fabric.atlassian.net/browse/DSP-4152\n &:hover {\n border: 1px solid\n ", ";\n background: ", ";\n }\n\n td > :not(style):first-child,\n td > style:first-child + * {\n margin-top: 0;\n }\n "])), focused ? EXPAND_FOCUSED_BORDER_COLOR : expanded ? EXPAND_EXPANDED_BORDER_COLOR(themeProps) : EXPAND_COLLAPSED_BORDER_COLOR, BORDER_RADIUS, !expanded ? EXPAND_COLLAPSED_BACKGROUND : EXPAND_SELECTED_BACKGROUND(themeProps), margin, akEditorSwoopCubicBezier, akEditorSwoopCubicBezier, gridSize(), themed({
91
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-width: 1px;\n border-style: solid;\n border-color: ", ";\n border-radius: ", "px;\n min-height: 25px;\n background: ", ";\n margin: ", ";\n\n transition: background 0.3s ", ",\n border-color 0.3s ", ";\n padding: ", "px;\n\n &:hover {\n // TODO: Remove the border styles below once design tokens have been enabled and fallbacks are no longer triggered.\n // This is because the default state already uses the same token and, as such, the hover style won't change anything.\n // https://product-fabric.atlassian.net/browse/DSP-4152\n border: 1px solid\n ", ";\n background: ", ";\n }\n\n td > :not(style):first-child,\n td > style:first-child + * {\n margin-top: 0;\n }\n "])), focused ? EXPAND_FOCUSED_BORDER_COLOR : expanded ? EXPAND_EXPANDED_BORDER_COLOR(themeProps) : EXPAND_COLLAPSED_BORDER_COLOR, BORDER_RADIUS, !expanded ? EXPAND_COLLAPSED_BACKGROUND : EXPAND_SELECTED_BACKGROUND(themeProps), margin, akEditorSwoopCubicBezier, akEditorSwoopCubicBezier, gridSize(), themed({
92
92
  light: token('color.border', colors.N50A),
93
93
  dark: token('color.border', colors.DN50)
94
94
  })(themeProps), EXPAND_SELECTED_BACKGROUND(themeProps));
@@ -97,7 +97,7 @@ var containerStyles = function containerStyles(styleProps) {
97
97
 
98
98
  var contentStyles = function contentStyles(styleProps) {
99
99
  return function (themeProps) {
100
- return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-top: ", "px;\n padding-right: ", "px;\n padding-left: ", "px;\n display: flow-root;\n\n // The follow rules inside @supports block are added as a part of ED-8893\n // The fix is targeting mobile bridge on iOS 12 or below,\n // We should consider remove this fix when we no longer support iOS 12\n @supports not (display: flow-root) {\n width: 100%;\n box-sizing: border-box;\n }\n\n ", "\n"])), styleProps.expanded ? gridSize() : 0, gridSize(), gridSize() * 4 - gridSize() / 2, !styleProps.expanded ? "\n .expand-content-wrapper, .nestedExpand-content-wrapper {\n /* We visually hide the content here to preserve the content during copy+paste */\n width: 100%;\n display: block;\n height: 0;\n overflow: hidden;\n clip: rect(1px, 1px, 1px, 1px);\n white-space: nowrap;\n user-select: none;\n }\n " : '');
100
+ return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-top: ", "px;\n padding-right: ", "px;\n padding-left: ", "px;\n display: flow-root;\n\n // The follow rules inside @supports block are added as a part of ED-8893\n // The fix is targeting mobile bridge on iOS 12 or below,\n // We should consider remove this fix when we no longer support iOS 12\n @supports not (display: flow-root) {\n width: 100%;\n box-sizing: border-box;\n }\n\n ", "\n "])), styleProps.expanded ? gridSize() : 0, gridSize(), gridSize() * 4 - gridSize() / 2, !styleProps.expanded ? "\n .expand-content-wrapper, .nestedExpand-content-wrapper {\n /* We visually hide the content here to preserve the content during copy+paste */\n width: 100%;\n display: block;\n height: 0;\n overflow: hidden;\n clip: rect(1px, 1px, 1px, 1px);\n white-space: nowrap;\n user-select: none;\n }\n " : '');
101
101
  };
102
102
  };
103
103
 
@@ -0,0 +1,19 @@
1
+ import React, { useContext } from 'react';
2
+ import { IntlContext, IntlProvider } from 'react-intl-next';
3
+
4
+ var useCheckIntlContext = function useCheckIntlContext() {
5
+ return useContext(IntlContext) === null;
6
+ };
7
+
8
+ export default function IntlProviderIfMissingWrapper(_ref) {
9
+ var children = _ref.children;
10
+ var missingIntlContext = useCheckIntlContext();
11
+
12
+ if (missingIntlContext) {
13
+ return /*#__PURE__*/React.createElement(IntlProvider, {
14
+ locale: "en"
15
+ }, children);
16
+ }
17
+
18
+ return children;
19
+ }
@@ -235,10 +235,10 @@ var Popup = /*#__PURE__*/function (_React$Component) {
235
235
 
236
236
  return /*#__PURE__*/React.createElement("div", {
237
237
  ref: this.handleRef,
238
- style: _objectSpread({
238
+ style: _objectSpread(_objectSpread({
239
239
  position: 'absolute',
240
240
  zIndex: this.props.zIndex || akEditorFloatingPanelZIndex
241
- }, position),
241
+ }, position), this.props.style),
242
242
  "aria-label": this.props.ariaLabel || 'Popup' // Indicates component is an editor pop. Required for focus handling in Message.tsx
243
243
  ,
244
244
  "data-editor-popup": true
@@ -7,17 +7,21 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
 
10
+ var _class;
11
+
10
12
  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); }; }
11
13
 
12
14
  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; } }
13
15
 
14
16
  import React from 'react';
17
+ import PropTypes from 'prop-types';
15
18
  import { createPortal, unmountComponentAtNode, unstable_renderSubtreeIntoContainer } from 'react-dom';
16
19
  import { injectIntl, RawIntlProvider, useIntl } from 'react-intl-next';
17
20
  import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
18
21
  import { useGlobalTheme } from '@atlaskit/theme/components';
19
22
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
20
23
  import { EventDispatcher } from '../../event-dispatcher';
24
+ import IntlProviderIfMissingWrapper from '../IntlProviderIfMissingWrapper';
21
25
  import { PortalProviderThemeProviders } from './PortalProviderThemesProvider';
22
26
  export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
23
27
  _inherits(PortalProviderAPI, _EventDispatcher);
@@ -47,8 +51,6 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
47
51
  _createClass(PortalProviderAPI, [{
48
52
  key: "render",
49
53
  value: function render(children, container) {
50
- var _this2 = this;
51
-
52
54
  var hasAnalyticsContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
53
55
  var hasIntlContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
54
56
  this.portals.set(container, {
@@ -56,14 +58,10 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
56
58
  hasAnalyticsContext: hasAnalyticsContext,
57
59
  hasIntlContext: hasIntlContext
58
60
  });
59
-
60
- var childrenWithThemeProviders = function childrenWithThemeProviders() {
61
- return /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
62
- mode: _this2.themeMode
63
- }, children());
64
- };
65
-
66
- var wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders()) : childrenWithThemeProviders();
61
+ var childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
62
+ mode: this.themeMode
63
+ }, children());
64
+ var wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders) : childrenWithThemeProviders;
67
65
 
68
66
  if (hasIntlContext) {
69
67
  wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
@@ -79,36 +77,33 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
79
77
  }, {
80
78
  key: "forceUpdate",
81
79
  value: function forceUpdate(_ref) {
82
- var _this3 = this;
80
+ var _this2 = this;
83
81
 
84
82
  var intl = _ref.intl,
85
83
  themeMode = _ref.themeMode;
86
84
  this.intl = intl;
87
85
  this.themeMode = themeMode;
88
86
  this.portals.forEach(function (portal, container) {
89
- if (!portal.hasAnalyticsContext && !_this3.useAnalyticsContext && !portal.hasIntlContext) {
87
+ if (!portal.hasAnalyticsContext && !_this2.useAnalyticsContext && !portal.hasIntlContext) {
90
88
  return;
91
89
  }
92
90
 
93
91
  var wrappedChildren = portal.children();
92
+ var childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
93
+ mode: themeMode
94
+ }, wrappedChildren);
94
95
 
95
- var childrenWithThemeProviders = function childrenWithThemeProviders() {
96
- return /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
97
- mode: themeMode
98
- }, wrappedChildren);
99
- };
100
-
101
- if (portal.hasAnalyticsContext && _this3.useAnalyticsContext) {
102
- wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders());
96
+ if (portal.hasAnalyticsContext && _this2.useAnalyticsContext) {
97
+ wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders);
103
98
  }
104
99
 
105
100
  if (portal.hasIntlContext) {
106
101
  wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
107
- value: _this3.intl
108
- }, childrenWithThemeProviders());
102
+ value: _this2.intl
103
+ }, childrenWithThemeProviders);
109
104
  }
110
105
 
111
- unstable_renderSubtreeIntoContainer(_this3.context, wrappedChildren, container);
106
+ unstable_renderSubtreeIntoContainer(_this2.context, wrappedChildren, container);
112
107
  });
113
108
  }
114
109
  }, {
@@ -155,13 +150,13 @@ var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
155
150
  var _super2 = _createSuper(BasePortalProvider);
156
151
 
157
152
  function BasePortalProvider(props) {
158
- var _this4;
153
+ var _this3;
159
154
 
160
155
  _classCallCheck(this, BasePortalProvider);
161
156
 
162
- _this4 = _super2.call(this, props);
163
- _this4.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext, props.themeMode);
164
- return _this4;
157
+ _this3 = _super2.call(this, props);
158
+ _this3.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext, props.themeMode);
159
+ return _this3;
165
160
  }
166
161
 
167
162
  _createClass(BasePortalProvider, [{
@@ -185,51 +180,66 @@ var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
185
180
  _defineProperty(BasePortalProvider, "displayName", 'PortalProvider');
186
181
 
187
182
  export var PortalProvider = injectIntl(BasePortalProvider);
188
- export var PortalProviderWithThemeProviders = function PortalProviderWithThemeProviders(props) {
183
+ export var PortalProviderWithThemeProviders = function PortalProviderWithThemeProviders(_ref2) {
184
+ var onAnalyticsEvent = _ref2.onAnalyticsEvent,
185
+ useAnalyticsContext = _ref2.useAnalyticsContext,
186
+ render = _ref2.render;
187
+ return /*#__PURE__*/React.createElement(IntlProviderIfMissingWrapper, null, /*#__PURE__*/React.createElement(PortalProviderWithThemeAndIntlProviders, {
188
+ onAnalyticsEvent: onAnalyticsEvent,
189
+ useAnalyticsContext: useAnalyticsContext,
190
+ render: render
191
+ }));
192
+ };
193
+
194
+ var PortalProviderWithThemeAndIntlProviders = function PortalProviderWithThemeAndIntlProviders(_ref3) {
195
+ var onAnalyticsEvent = _ref3.onAnalyticsEvent,
196
+ useAnalyticsContext = _ref3.useAnalyticsContext,
197
+ render = _ref3.render;
189
198
  var intl = useIntl();
190
199
  var globalTheme = useGlobalTheme();
191
200
  return /*#__PURE__*/React.createElement(BasePortalProvider, {
192
201
  intl: intl,
193
202
  themeMode: globalTheme.mode,
194
- onAnalyticsEvent: props.onAnalyticsEvent,
195
- useAnalyticsContext: props.useAnalyticsContext,
196
- render: props.render
203
+ onAnalyticsEvent: onAnalyticsEvent,
204
+ useAnalyticsContext: useAnalyticsContext,
205
+ render: render
197
206
  });
198
207
  };
208
+
199
209
  export var PortalRenderer = /*#__PURE__*/function (_React$Component2) {
200
210
  _inherits(PortalRenderer, _React$Component2);
201
211
 
202
212
  var _super3 = _createSuper(PortalRenderer);
203
213
 
204
214
  function PortalRenderer(props) {
205
- var _this5;
215
+ var _this4;
206
216
 
207
217
  _classCallCheck(this, PortalRenderer);
208
218
 
209
- _this5 = _super3.call(this, props);
219
+ _this4 = _super3.call(this, props);
210
220
 
211
- _defineProperty(_assertThisInitialized(_this5), "handleUpdate", function (portals) {
212
- return _this5.setState({
221
+ _defineProperty(_assertThisInitialized(_this4), "handleUpdate", function (portals) {
222
+ return _this4.setState({
213
223
  portals: portals
214
224
  });
215
225
  });
216
226
 
217
- props.portalProviderAPI.setContext(_assertThisInitialized(_this5));
218
- props.portalProviderAPI.on('update', _this5.handleUpdate);
219
- _this5.state = {
227
+ props.portalProviderAPI.setContext(_assertThisInitialized(_this4));
228
+ props.portalProviderAPI.on('update', _this4.handleUpdate);
229
+ _this4.state = {
220
230
  portals: new Map()
221
231
  };
222
- return _this5;
232
+ return _this4;
223
233
  }
224
234
 
225
235
  _createClass(PortalRenderer, [{
226
236
  key: "render",
227
237
  value: function render() {
228
238
  var portals = this.state.portals;
229
- return /*#__PURE__*/React.createElement(React.Fragment, null, Array.from(portals.entries()).map(function (_ref2) {
230
- var _ref3 = _slicedToArray(_ref2, 2),
231
- container = _ref3[0],
232
- children = _ref3[1];
239
+ return /*#__PURE__*/React.createElement(React.Fragment, null, Array.from(portals.entries()).map(function (_ref4) {
240
+ var _ref5 = _slicedToArray(_ref4, 2),
241
+ container = _ref5[0],
242
+ children = _ref5[1];
233
243
 
234
244
  return /*#__PURE__*/createPortal(children, container);
235
245
  }));
@@ -246,8 +256,7 @@ var dummyAnalyticsContext = {
246
256
  getAtlaskitAnalyticsContext: function getAtlaskitAnalyticsContext() {},
247
257
  getAtlaskitAnalyticsEventHandlers: function getAtlaskitAnalyticsEventHandlers() {}
248
258
  };
249
-
250
- var AnalyticsContextWrapper = /*#__PURE__*/function (_React$Component3) {
259
+ var AnalyticsContextWrapper = (_class = /*#__PURE__*/function (_React$Component3) {
251
260
  _inherits(AnalyticsContextWrapper, _React$Component3);
252
261
 
253
262
  var _super4 = _createSuper(AnalyticsContextWrapper);
@@ -261,10 +270,10 @@ var AnalyticsContextWrapper = /*#__PURE__*/function (_React$Component3) {
261
270
  _createClass(AnalyticsContextWrapper, [{
262
271
  key: "render",
263
272
  value: function render() {
264
- var _ref4 = this.context.contextAdapter.analytics || {
273
+ var _ref6 = this.context.contextAdapter.analytics || {
265
274
  value: dummyAnalyticsContext
266
275
  },
267
- value = _ref4.value;
276
+ value = _ref6.value;
268
277
 
269
278
  return /*#__PURE__*/React.createElement(AnalyticsReactContext.Provider, {
270
279
  value: value
@@ -273,4 +282,6 @@ var AnalyticsContextWrapper = /*#__PURE__*/function (_React$Component3) {
273
282
  }]);
274
283
 
275
284
  return AnalyticsContextWrapper;
276
- }(React.Component);
285
+ }(React.Component), _defineProperty(_class, "contextTypes", {
286
+ contextAdapter: PropTypes.object
287
+ }), _class);
@@ -15,4 +15,5 @@ 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
17
  export { clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from './clear-next-sibling-margin-top';
18
- export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
18
+ export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
19
+ export { default as IntlProviderIfMissingWrapper } from './IntlProviderIfMissingWrapper';
@@ -1,6 +1,7 @@
1
1
  import { akEditorBreakoutPadding, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth, breakoutWideScaleRatio } from '@atlaskit/editor-shared-styles';
2
2
  import { mapBreakpointToLayoutMaxWidth } from '../ui/BaseTheme';
3
3
  import { getBreakpoint } from '../ui/WidthProvider';
4
+ import { parsePx } from './dom';
4
5
  /**
5
6
  * Variables required to construct a context for breakout ssr inline script.
6
7
  *
@@ -15,6 +16,11 @@ var breakoutConsts = {
15
16
  wideLayoutWidth: akEditorWideLayoutWidth,
16
17
  mapBreakpointToLayoutMaxWidth: mapBreakpointToLayoutMaxWidth,
17
18
  getBreakpoint: getBreakpoint,
19
+
20
+ /**
21
+ * Consumers are opinionated that this will always return a string ending in
22
+ * `px` when called with `full-width` or `wide` as the layout parameter.
23
+ */
18
24
  calcBreakoutWidth: function calcBreakoutWidth(layout, containerWidth) {
19
25
  var effectiveFullWidth = containerWidth - breakoutConsts.padding;
20
26
 
@@ -62,4 +68,43 @@ export var absoluteBreakoutWidth = function absoluteBreakoutWidth(layout, contai
62
68
  };
63
69
  export { breakoutConsts };
64
70
  export var calcWideWidth = breakoutConsts.calcWideWidth;
65
- export var calcBreakoutWidth = breakoutConsts.calcBreakoutWidth;
71
+ export var calcBreakoutWidth = breakoutConsts.calcBreakoutWidth;
72
+ export function calculateBreakoutStyles(_ref) {
73
+ var mode = _ref.mode,
74
+ widthStateLineLength = _ref.widthStateLineLength,
75
+ widthStateWidth = _ref.widthStateWidth;
76
+ var breakoutWidth = calcBreakoutWidth(mode, widthStateWidth);
77
+ var breakoutWidthPx = parsePx(breakoutWidth);
78
+
79
+ if (!widthStateLineLength) {
80
+ // lineLength is not normally undefined when this is run for,
81
+ // consumers but can be in SSR, initial render or test (jsdom)
82
+ // environments.
83
+ //
84
+ // this approach doesn't work well with position: fixed, so
85
+ // it breaks things like sticky headers.
86
+ //
87
+ // It can also cause bluriness for some child content (such as iframes)
88
+ return {
89
+ type: 'line-length-unknown',
90
+ width: breakoutWidth,
91
+ transform: 'translateX(-50%)',
92
+ marginLeft: '50%'
93
+ };
94
+ } // NOTE
95
+ // At time of writing -- when toggling between full-width and
96
+ // full-page appearance modes. There is a slight delay before
97
+ // the widthState is updated.
98
+ // During this period -- the marginLeftPx will be incorrect.
99
+
100
+
101
+ var marginLeftPx = -(breakoutWidthPx - widthStateLineLength) / 2;
102
+ return {
103
+ type: 'line-length-known',
104
+ width: breakoutWidth,
105
+ marginLeft: "".concat(marginLeftPx, "px")
106
+ };
107
+ }
108
+ export function calcBreakoutWidthPx(mode, widthStateWidth) {
109
+ return parsePx(calcBreakoutWidth(mode, widthStateWidth));
110
+ }
@@ -0,0 +1,13 @@
1
+ export var getParticipantsCount = function getParticipantsCount(editorState) {
2
+ var _collabEditPlugin$$pa, _collabEditPlugin$$pa2;
3
+
4
+ // TODO: ED-15663
5
+ // Please, do not copy or use this kind of code below
6
+ // @ts-ignore
7
+ if (!editorState || !editorState['collabEditPlugin$']) {
8
+ return 1;
9
+ }
10
+
11
+ var participantsCount = (_collabEditPlugin$$pa = (_collabEditPlugin$$pa2 = editorState['collabEditPlugin$'].participants) === null || _collabEditPlugin$$pa2 === void 0 ? void 0 : _collabEditPlugin$$pa2.size()) !== null && _collabEditPlugin$$pa !== void 0 ? _collabEditPlugin$$pa : 1;
12
+ return participantsCount;
13
+ };
@@ -90,6 +90,22 @@ export function closest(node, s) {
90
90
  export function closestElement(node, s) {
91
91
  return closest(node, s);
92
92
  }
93
+ /**
94
+ * Util for converting a css pixel size value to a number (of pixels).
95
+ *
96
+ * ie.
97
+ * ```ts
98
+ * const pixels = parsePx('10px')
99
+ * // ^$ const pixels: number
100
+ * ```
101
+ * * ```ts
102
+ * const pixels = parsePx('10')
103
+ * // ^$ const pixels: number | undefined
104
+ * ```
105
+ */
106
+ // At time of writting prettier would strip the extend here.
107
+ // prettier-ignore
108
+
93
109
  export function parsePx(pxStr) {
94
110
  if (!pxStr.endsWith('px')) {
95
111
  return undefined;
@@ -0,0 +1,55 @@
1
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics';
2
+ import { getParticipantsCount } from './collab';
3
+ import { startMeasure, stopMeasure } from './performance/measure'; // This was existing logic when converting from ReactNodeView
4
+ // our current sampling for this event is not bound by node.type
5
+
6
+ var nodeViewRenderedEventsCounter = 0;
7
+ var DEFAULT_SAMPLING_RATE = 100;
8
+ var DEFAULT_SLOW_THRESHOLD = 7;
9
+ export function getPerformanceOptions(view) {
10
+ var _nodeViewTracking$sam, _nodeViewTracking$slo;
11
+
12
+ // TODO: ED-15663
13
+ // Please, do not copy or use this kind of code below
14
+ // @ts-ignore
15
+ var fakePluginKey = {
16
+ key: 'analyticsPlugin$',
17
+ getState: function getState(state) {
18
+ return state['analyticsPlugin$'];
19
+ }
20
+ };
21
+ var pluginState = fakePluginKey.getState(view.state);
22
+ var nodeViewTracking = pluginState && pluginState.performanceTracking ? pluginState.performanceTracking.nodeViewTracking || {} : {};
23
+ var samplingRate = (_nodeViewTracking$sam = nodeViewTracking.samplingRate) !== null && _nodeViewTracking$sam !== void 0 ? _nodeViewTracking$sam : DEFAULT_SAMPLING_RATE;
24
+ var slowThreshold = (_nodeViewTracking$slo = nodeViewTracking.slowThreshold) !== null && _nodeViewTracking$slo !== void 0 ? _nodeViewTracking$slo : DEFAULT_SLOW_THRESHOLD;
25
+ return {
26
+ trackingEnabled: !!nodeViewTracking.enabled,
27
+ samplingRate: samplingRate,
28
+ slowThreshold: slowThreshold
29
+ };
30
+ }
31
+ export function startMeasureReactNodeViewRendered(_ref) {
32
+ var nodeTypeName = _ref.nodeTypeName;
33
+ startMeasure("\uD83E\uDD89".concat(nodeTypeName, "::ReactNodeView"));
34
+ }
35
+ export function stopMeasureReactNodeViewRendered(_ref2) {
36
+ var nodeTypeName = _ref2.nodeTypeName,
37
+ dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
38
+ editorState = _ref2.editorState,
39
+ samplingRate = _ref2.samplingRate,
40
+ slowThreshold = _ref2.slowThreshold;
41
+ stopMeasure("\uD83E\uDD89".concat(nodeTypeName, "::ReactNodeView"), function (duration) {
42
+ if (++nodeViewRenderedEventsCounter % samplingRate === 0 && duration > slowThreshold) {
43
+ dispatchAnalyticsEvent({
44
+ action: ACTION.REACT_NODEVIEW_RENDERED,
45
+ actionSubject: ACTION_SUBJECT.EDITOR,
46
+ eventType: EVENT_TYPE.OPERATIONAL,
47
+ attributes: {
48
+ node: nodeTypeName,
49
+ duration: duration,
50
+ participants: getParticipantsCount(editorState)
51
+ }
52
+ });
53
+ }
54
+ });
55
+ }
@@ -5,7 +5,7 @@ export { default as ErrorReporter } from './error-reporter';
5
5
  export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC } from './date';
6
6
  export { isElementInTableCell, isTextSelection, isLastItemMediaGroup, setNodeSelection, setTextSelection, nonNullable, stepAddsOneOf, stepHasSlice, extractSliceFromStep, isValidPosition } from './editor-core-utils';
7
7
  export { withImageLoader } from './imageLoader';
8
- export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts } from './breakout';
8
+ export { absoluteBreakoutWidth, calcBreakoutWidth, calcWideWidth, breakoutConsts, calculateBreakoutStyles, calcBreakoutWidthPx } from './breakout';
9
9
  export { findChangedNodesFromTransaction, validNode, validateNodes, isType, isParagraph, isText, isLinkMark, SelectedState, isNodeSelectedOrInRange, isSupportedInParent } from './nodes';
10
10
  export { pluginFactory } from './plugin-state-factory';
11
11
  export { getFragmentBackingArray, mapFragment, mapSlice, flatmap, mapChildren } from './slice';
@@ -26,8 +26,12 @@ export { isTextInput } from './is-text-input';
26
26
  export { ZERO_WIDTH_SPACE, ZERO_WIDTH_JOINER } from './whitespace';
27
27
  export { shouldForceTracking } from './should-force-tracking';
28
28
  export { getModeFromTheme } from './getModeFromTheme';
29
+ export { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from './get-performance-options';
29
30
  export { sniffUserBrowserExtensions } from './browser-extensions';
30
31
  export { RenderCountProfiler } from './profiler/render-count';
31
32
  export { validateADFEntity, validationErrorHandler } from './validate-using-spec';
32
33
  export { getShallowPropsDifference, getPropsDifference } from './compare-props';
33
- export { useComponentRenderTracking } from './performance/hooks/use-component-render-tracking';
34
+ export { useComponentRenderTracking } from './performance/hooks/use-component-render-tracking';
35
+ export { isOutdatedBrowser } from './outdated-browsers';
36
+ export { isReferencedSource } from './referentiality';
37
+ export { sendLogs } from './sendLogs';