@atlaskit/editor-common 118.10.3 → 118.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/compass.yml +2 -2
- package/dist/cjs/core-utils/index.js +1 -8
- package/dist/cjs/extensibility/ExtensionSSRReactContextsProvider.js +1 -2
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/portal/common.js +2 -3
- package/dist/cjs/react-node-view/NodeViewContentHole.js +1 -2
- package/dist/cjs/react-node-view/index.js +1 -1
- package/dist/cjs/styles/shared/table.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Mention/index.js +20 -1
- package/dist/cjs/ui/Mention/mention-node-data-provider.js +5 -0
- package/dist/cjs/ui/Mention/mention-with-profilecard.js +8 -0
- package/dist/cjs/ui/Mention/mention-with-providers.js +92 -15
- package/dist/cjs/utils/content-visibility.js +177 -0
- package/dist/es2019/core-utils/index.js +1 -2
- package/dist/es2019/extensibility/ExtensionSSRReactContextsProvider.js +1 -2
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/portal/common.js +2 -3
- package/dist/es2019/react-node-view/NodeViewContentHole.js +1 -2
- package/dist/es2019/react-node-view/index.js +2 -2
- package/dist/es2019/styles/shared/table.js +8 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Mention/index.js +21 -2
- package/dist/es2019/ui/Mention/mention-node-data-provider.js +1 -0
- package/dist/es2019/ui/Mention/mention-with-profilecard.js +8 -0
- package/dist/es2019/ui/Mention/mention-with-providers.js +69 -2
- package/dist/es2019/utils/content-visibility.js +165 -0
- package/dist/esm/core-utils/index.js +1 -2
- package/dist/esm/extensibility/ExtensionSSRReactContextsProvider.js +1 -2
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/portal/common.js +2 -3
- package/dist/esm/react-node-view/NodeViewContentHole.js +1 -2
- package/dist/esm/react-node-view/index.js +2 -2
- package/dist/esm/styles/shared/table.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Mention/index.js +21 -2
- package/dist/esm/ui/Mention/mention-node-data-provider.js +1 -0
- package/dist/esm/ui/Mention/mention-with-profilecard.js +8 -0
- package/dist/esm/ui/Mention/mention-with-providers.js +92 -15
- package/dist/esm/utils/content-visibility.js +166 -0
- package/dist/types/core-utils/index.d.ts +0 -1
- package/dist/types/mention.d.ts +1 -0
- package/dist/types/ui/Mention/index.d.ts +2 -0
- package/dist/types/ui/Mention/mention-node-data-provider.d.ts +32 -0
- package/dist/types/ui/Mention/mention-with-profilecard.d.ts +5 -1
- package/dist/types/ui/Mention/mention-with-providers.d.ts +11 -1
- package/dist/types/utils/content-visibility.d.ts +78 -0
- package/package.json +9 -3
- package/utils/content-visibility/package.json +10 -0
- package/dist/cjs/core-utils/is-ssr-streaming.js +0 -22
- package/dist/es2019/core-utils/is-ssr-streaming.js +0 -16
- package/dist/esm/core-utils/is-ssr-streaming.js +0 -16
- package/dist/types/core-utils/is-ssr-streaming.d.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 118.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`13e86ff9f1588`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/13e86ff9f1588) -
|
|
8
|
+
[ux] Display avatars for mention nodes.
|
|
9
|
+
- [`da5eaf0bc37da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/da5eaf0bc37da) -
|
|
10
|
+
Clean up the platform_editor_editor_ssr_streaming experiment. The SSR streaming code paths are now
|
|
11
|
+
permanent and the isSSRStreaming() utility has been removed from
|
|
12
|
+
@atlaskit/editor-common/core-utils.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 118.11.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- [`2d23b40eed4f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2d23b40eed4f0) -
|
|
23
|
+
Add gated content-visibility:auto to tables, expands and media singles to improve editor rendering
|
|
24
|
+
performance on large documents. Applied only to nodes whose rendered size can be estimated closely
|
|
25
|
+
— structurally (row/child counts) for tables and expands, and from the media's own dimensions and
|
|
26
|
+
the renderer's width calculation for media singles. Behind the
|
|
27
|
+
cc_editor_limited_mode_perf_improvements experiment and only active when limited mode is enabled
|
|
28
|
+
for the document (shared large-document detection with the limited-mode plugin).
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies
|
|
33
|
+
|
|
3
34
|
## 118.10.3
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/compass.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
configVersion: 1
|
|
2
2
|
id: ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/8aba7f6e-457b-4200-9b6f-00adf2350107
|
|
3
3
|
name: '@atlaskit/editor-common'
|
|
4
|
-
ownerId: ari:cloud:identity::team/
|
|
4
|
+
ownerId: ari:cloud:identity::team/cf6a670b-5252-4c68-a769-9207de366beb # Editor Developers
|
|
5
5
|
labels:
|
|
6
6
|
- platform-code
|
|
7
7
|
- platform-afm
|
|
@@ -23,7 +23,7 @@ links:
|
|
|
23
23
|
customFields:
|
|
24
24
|
- name: Department
|
|
25
25
|
type: text
|
|
26
|
-
value:
|
|
26
|
+
value: Editor Developers
|
|
27
27
|
- name: Trusted Reviewer Teams
|
|
28
28
|
type: text
|
|
29
29
|
value: ari:cloud:identity::team/cf6a670b-5252-4c68-a769-9207de366beb
|
|
@@ -21,13 +21,6 @@ Object.defineProperty(exports, "isSSR", {
|
|
|
21
21
|
return _isSsr.isSSR;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "isSSRStreaming", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _isSsrStreaming.isSSRStreaming;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
24
|
var _inside = require("./inside");
|
|
31
25
|
var _documentLogger = require("./document-logger");
|
|
32
|
-
var _isSsr = require("./is-ssr");
|
|
33
|
-
var _isSsrStreaming = require("./is-ssr-streaming");
|
|
26
|
+
var _isSsr = require("./is-ssr");
|
|
@@ -8,11 +8,10 @@ exports.ExtensionSSRReactContextsProvider = ExtensionSSRReactContextsProvider;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
10
|
var _isSsr = require("../core-utils/is-ssr");
|
|
11
|
-
var _isSsrStreaming = require("../core-utils/is-ssr-streaming");
|
|
12
11
|
function ExtensionSSRReactContextsProvider(_ref) {
|
|
13
12
|
var children = _ref.children,
|
|
14
13
|
intl = _ref.intl;
|
|
15
|
-
if (!(0, _isSsr.isSSR)()
|
|
14
|
+
if (!(0, _isSsr.isSSR)()) {
|
|
16
15
|
return children;
|
|
17
16
|
}
|
|
18
17
|
if (!intl) {
|
|
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
28
28
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
29
29
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
30
30
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
31
|
-
var packageVersion = "118.
|
|
31
|
+
var packageVersion = "118.11.0";
|
|
32
32
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
33
33
|
// Remove URL as it has UGC
|
|
34
34
|
// Ignored via go/ees007
|
|
@@ -20,7 +20,6 @@ exports.getPortalProviderAPI = void 0;
|
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
var _reactDom = require("react-dom");
|
|
22
22
|
var _isSsr = require("../core-utils/is-ssr");
|
|
23
|
-
var _isSsrStreaming = require("../core-utils/is-ssr-streaming");
|
|
24
23
|
var _PortalRenderWrapperInner = require("./PortalRenderWrapperInner");
|
|
25
24
|
var _createPortalRendererComponent = require("./createPortalRendererComponent");
|
|
26
25
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -60,7 +59,7 @@ var getPortalProviderAPI = exports.getPortalProviderAPI = function getPortalProv
|
|
|
60
59
|
return {
|
|
61
60
|
render: function render(children, container, key, onBeforeReactDomRender) {
|
|
62
61
|
var immediate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
63
|
-
if ((0, _isSsr.isSSR)()
|
|
62
|
+
if ((0, _isSsr.isSSR)()) {
|
|
64
63
|
var html = '';
|
|
65
64
|
try {
|
|
66
65
|
var renderToStaticMarkup = getRenderToStaticMarkup();
|
|
@@ -93,7 +92,7 @@ var getPortalProviderAPI = exports.getPortalProviderAPI = function getPortalProv
|
|
|
93
92
|
},
|
|
94
93
|
remove: function remove(key) {
|
|
95
94
|
var _portalsMap$get;
|
|
96
|
-
if ((0, _isSsr.isSSR)()
|
|
95
|
+
if ((0, _isSsr.isSSR)()) {
|
|
97
96
|
return;
|
|
98
97
|
}
|
|
99
98
|
(_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 || _portalsMap$get();
|
|
@@ -9,7 +9,6 @@ exports.NodeViewContentHole = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _isSsr = require("../core-utils/is-ssr");
|
|
12
|
-
var _isSsrStreaming = require("../core-utils/is-ssr-streaming");
|
|
13
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
13
|
/**
|
|
15
14
|
* A component that serves as a placeholder for the content DOM of a ProseMirror NodeView.
|
|
@@ -18,6 +17,6 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
18
17
|
var NodeViewContentHole = exports.NodeViewContentHole = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
19
18
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, props, {
|
|
20
19
|
ref: ref,
|
|
21
|
-
"data-ssr-content-dom-ref": (0, _isSsr.isSSR)()
|
|
20
|
+
"data-ssr-content-dom-ref": (0, _isSsr.isSSR)() ? '' : undefined
|
|
22
21
|
}));
|
|
23
22
|
});
|
|
@@ -123,7 +123,7 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
123
123
|
// contentDOMWrapper that was appended above. The React ref callback
|
|
124
124
|
// (forwardRef) never fires in renderToStaticMarkup, so contentDOM is
|
|
125
125
|
// left detached. Re-attach it by finding the marked SSR ref target.
|
|
126
|
-
if ((0, _coreUtils.isSSR)() &&
|
|
126
|
+
if ((0, _coreUtils.isSSR)() && this.domRef) {
|
|
127
127
|
var refTarget = this.domRef.querySelector('[data-ssr-content-dom-ref]');
|
|
128
128
|
if (refTarget) {
|
|
129
129
|
this.handleRef(refTarget);
|
|
@@ -69,7 +69,7 @@ var firstNodeWithNotMarginTop = function firstNodeWithNotMarginTop() {
|
|
|
69
69
|
var tableSharedStyle = exports.tableSharedStyle = function tableSharedStyle() {
|
|
70
70
|
var browser = (0, _browser.getBrowserInfo)();
|
|
71
71
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Appears safe to auto-fix, but leaving it up to the team to remediate as the readability only gets worse with autofixing
|
|
72
|
-
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\t\t", "\n\t\t.", " {\n\t\t\tposition: relative;\n\t\t\tmargin: 0 auto ", ";\n\t\t\tbox-sizing: border-box;\n\n\t\t\t/**\n\t\t\t * Fix block top alignment inside table cells.\n\t\t\t */\n\t\t\t.decisionItemView-content-wrap:first-of-type > div {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t\t", "\n\t\t}\n\t\t.", "[data-number-column='true'] {\n\t\t\tpadding-left: ", "px;\n\t\t\tclear: both;\n\t\t}\n\n\t\t.", " {\n\t\t\twill-change: width, margin-left;\n\t\t}\n\n\t\t.", " table {\n\t\t\twill-change: width;\n\t\t}\n\t\t.", " > table {\n\t\t\tmargin: ", " 0 0 0;\n\t\t}\n\n\t\t.", " > table,\n\t\t.", " > table {\n\t\t\tmargin: ", " ", " 0 0;\n\t\t}\n\n\t\t/* support panel nested in table */\n\t\t", "\n\n\t\t/* avoid applying styles to nested tables (possible via extensions) */\n\t.", " > table,\n\t.", " > table,\n\t.", " > table {\n\t\t\tborder-collapse: collapse;\n\t\t\t", "\n\t\t\ttable-layout: fixed;\n\t\t\tfont-size: 1em;\n\t\t\twidth: 100%;\n\t\t\t", "\n\n\t\t\t&[data-autosize='true'] {\n\t\t\t\ttable-layout: auto;\n\t\t\t}\n\n\t\t\t& {\n\t\t\t\t* {\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\t\t\t\thr {\n\t\t\t\t\tbox-sizing: content-box;\n\t\t\t\t}\n\n\t\t\t\ttbody {\n\t\t\t\t\tborder-bottom: none;\n\t\t\t\t}\n\t\t\t\tth td {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\n\t\t\t\t> tbody > tr > th,\n\t\t\t\t> tbody > tr > td {\n\t\t\t\t\tmin-width: ", "px;\n\t\t\t\t\tfont-weight: ", ";\n\t\t\t\t\tvertical-align: top;\n\t\t\t\t\t", "\n\t\t\t\t\tborder: 1px solid ", ";\n\t\t\t\t\tborder-right-width: 0;\n\t\t\t\t\tborder-bottom-width: 0;\n\n\t\t\t\t\tpadding: ", ";\n\t\t\t\t\t/* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n\t\t\t\t\t", "\n\n\t\t\t\t\t", "\n\n\t\t\t\tth p:not(:first-of-type),\n\t\t\t\ttd p:not(:first-of-type) {\n\t\t\t\t\t\tmargin-top: ", ";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Ensures nested tables are compatible with parent table background color - uses specificity to ensure tables nested by extensions are not affected */\n\t\t\t\t> tbody > tr > td {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\n\t\t\t\t", "\n\t\t\t\tth {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\ttext-align: left;\n\n\t\t\t\t\t/* only apply this styling to codeblocks in default background headercells */\n\t\t\t\t\t/* TODO this needs to be overhauled as it relies on unsafe selectors */\n\t\t\t\t\t", " {\n\t\t\t\t\t\t.", ":not(.danger) {\n\t\t\t\t\t\t\tbackground-color: ", ";\n\n\t\t\t\t\t\t\t:not(.", ") {\n\t\t\t\t\t\t\t\tbox-shadow: 0px 0px 0px 1px ", ";\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\tbackground-image: ", ";\n\n\t\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* this is only relevant to the element taken care of by renderer */\n\t\t\t\t\t\t\t> [data-ds--code--code-block] {\n\t\t\t\t\t\t\t\tbackground-image: ", "!important;\n\n\t\t\t\t\t\t\t\tbackground-color: ", "!important;\n\n\t\t\t\t\t\t\t\t/* selector lives inside @atlaskit/code */\n\t\t\t\t\t\t\t\t--ds--code--line-number-bg-color: ", ";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t", "\n\t"])), (0, _tableCell.tableCellBackgroundStyleOverride)(), _TableSharedCssClassName.TableSharedCssClassName.TABLE_CONTAINER, "var(--ds-space-200, 16px)", (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "/* Fake side borders are not needed when the rounded overlay owns the outer border. */\n\t\t\t\t.".concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_RIGHT_BORDER, ",\n\t\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_LEFT_BORDER, " {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t\t\t") : ".".concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_RIGHT_BORDER, ",\n\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_LEFT_BORDER, " {\n\t\t\t\tdisplay: block;\n\t\t\t\twidth: 1px;\n\t\t\t\theight: calc(100% - ", "var(--ds-space-300, 24px)", ");\n\t\t\t\tbackground: ", "var(--ds-background-accent-gray-subtler, #DDDEE1)", ";\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: ", "var(--ds-space-300, 24px)", ";\n\t\t\t}\n\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_RIGHT_BORDER, " {\n\t\t\t\tright: 0;\n\t\t\t}\n\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_LEFT_BORDER, " {\n\t\t\t\tleft: 0;\n\t\t\t}\n\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_LEFT_BORDER, "[data-with-numbered-table='true'] {\n\t\t\t\tleft: ").concat(_editorSharedStyles.akEditorTableNumberColumnWidth - 1, "px;\n\t\t\t}"), _TableSharedCssClassName.TableSharedCssClassName.TABLE_CONTAINER, _editorSharedStyles.akEditorTableNumberColumnWidth - 1, _TableSharedCssClassName.TableSharedCssClassName.TABLE_RESIZER_CONTAINER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_RESIZER_CONTAINER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_NODE_WRAPPER, "var(--ds-space-300, 24px)", _TableSharedCssClassName.TableSharedCssClassName.TABLE_CONTAINER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_STICKY_WRAPPER, "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", (0, _platformFeatureFlags.fg)('platform_editor_bordered_panel_nested_in_table') ? ".".concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_NODE_WRAPPER, " .ak-editor-panel {\n\t\t\tborder: ", "var(--ds-border-width, 1px)", " solid ", "var(--ds-border, #0B120E24)", ";\n\t\t}") : '', _TableSharedCssClassName.TableSharedCssClassName.TABLE_CONTAINER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_NODE_WRAPPER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_STICKY_WRAPPER, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "/* Keep a transparent border so the collapsed border model reserves the same 1px slot\n\t\t\t on the table edge; the ::after overlay draws the visible rounded border instead. */\n\t\t\tborder: ".concat(tableCellBorderWidth, "px solid transparent;") : "border: ".concat(tableCellBorderWidth, "px solid ", "var(--ds-background-accent-gray-subtler, #DDDEE1)", ";\n\t\t\tborder-left-color: transparent;\n\t\t\tborder-right-color: transparent;"), (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "position: relative;\n\n\t\t\t/* Table-width outer-border owner for overflow-safe rounded corners. */\n\t\t\t&::after {\n\t\t\t\tcontent: '';\n\t\t\t\tposition: absolute;\n\t\t\t\tinset: -0.5px;\n\t\t\t\tborder: ".concat(tableCellBorderWidth, "px solid ", "var(--ds-background-accent-gray-subtler, #DDDEE1)", ";\n\t\t\t\tborder-radius: ", "var(--ds-radius-xlarge, 12px)", ";\n\t\t\t\tpointer-events: none;\n\t\t\t\tz-index: 1;\n\t\t\t}") : '', "var(--ds-background-neutral-subtle, #00000000)", tableCellMinWidth, "var(--ds-font-weight-regular, 400)", (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) ? "&[data-valign='middle'] {\n\t\t\t\t\t\t\t\tvertical-align: middle;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t&[data-valign='bottom'] {\n\t\t\t\t\t\t\t\tvertical-align: bottom;\n\t\t\t\t\t\t\t}" : '', "var(--ds-background-accent-gray-subtler, #DDDEE1)", "var(--ds-space-100, 8px)", browser.gecko || browser.ie || browser.mac && browser.chrome ? 'background-clip: padding-box;' : '', firstNodeWithNotMarginTop(), "var(--ds-space-150, 12px)", "var(--ds-surface, #FFFFFF)", (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "/* Let the wrapper overlay own the outer table perimeter.\n\t\t\t\t data-reaches-* attributes are set by the TableCell node view. */\n\t\t\t\t> tbody > tr > th[data-reaches-top],\n\t\t\t\t> tbody > tr > td[data-reaches-top] {\n\t\t\t\t\tborder-top-color: transparent;\n\t\t\t\t}\n\n\t\t\t\t> tbody > tr > th[data-reaches-left],\n\t\t\t\t> tbody > tr > td[data-reaches-left] {\n\t\t\t\t\tborder-left-color: transparent;\n\t\t\t\t}\n\n\t\t\t\t> tbody > tr > td[data-reaches-left]::after {\n\t\t\t\t\tborder-left-color: transparent;\n\t\t\t\t}\n\n\t\t\t\t> tbody > tr > td[data-reaches-bottom]::after,\n\t\t\t\t> tbody > tr > th[data-reaches-bottom]::after {\n\t\t\t\t\tborder-bottom-color: transparent;\n\t\t\t\t}\n\n\t\t\t\t/* The rounded-table overlay owns transparent perimeter borders.\n\t\t\t\t Paint edge cell backgrounds into that reserved border area so coloured\n\t\t\t\t first/last rows do not show the page background through 1px seams. */\n\t\t\t\t> tbody > tr > th[data-reaches-top],\n\t\t\t\t> tbody > tr > td[data-reaches-top],\n\t\t\t\t> tbody > tr > th[data-reaches-bottom],\n\t\t\t\t> tbody > tr > td[data-reaches-bottom] {\n\t\t\t\t\tbackground-clip: border-box;\n\t\t\t\t}" : '', "var(--ds-background-accent-gray-subtlest, #F0F1F2)", (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? '&:not(.danger)' : '&:not([style]):not(.danger)', _codeBlock.CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, "var(--ds-surface-raised, #FFFFFF)", _editorSharedStyles.akEditorSelectedNodeClassName, "var(--ds-border, #0B120E24)", _codeBlock.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, (0, _editorSharedStyles.overflowShadow)({
|
|
72
|
+
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n\t\t", "\n\t\t.", " {\n\t\t\tposition: relative;\n\t\t\tmargin: 0 auto ", ";\n\t\t\tbox-sizing: border-box;\n\n\t\t\t/**\n\t\t\t * Fix block top alignment inside table cells.\n\t\t\t */\n\t\t\t.decisionItemView-content-wrap:first-of-type > div {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t\t", "\n\t\t}\n\t\t.", "[data-number-column='true'] {\n\t\t\tpadding-left: ", "px;\n\t\t\tclear: both;\n\t\t}\n\n\t\t.", " {\n\t\t\twill-change: width, margin-left;\n\t\t}\n\n\t\t.", " table {\n\t\t\twill-change: width;\n\t\t}\n\t\t.", " > table {\n\t\t\tmargin: ", " 0 0 0;\n\t\t}\n\n\t\t.", " > table,\n\t\t.", " > table {\n\t\t\tmargin: ", " ", " 0 0;\n\t\t}\n\n\t\t/* support panel nested in table */\n\t\t", "\n\n\t\t/* avoid applying styles to nested tables (possible via extensions) */\n\t.", " > table,\n\t.", " > table,\n\t.", " > table {\n\t\t\tborder-collapse: collapse;\n\t\t\t", "\n\t\t\ttable-layout: fixed;\n\t\t\tfont-size: 1em;\n\t\t\twidth: 100%;\n\t\t\t", "\n\n\t\t\t&[data-autosize='true'] {\n\t\t\t\ttable-layout: auto;\n\t\t\t}\n\n\t\t\t& {\n\t\t\t\t* {\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\t\t\t\thr {\n\t\t\t\t\tbox-sizing: content-box;\n\t\t\t\t}\n\n\t\t\t\ttbody {\n\t\t\t\t\tborder-bottom: none;\n\t\t\t\t}\n\t\t\t\tth td {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\n\t\t\t\t> tbody > tr > th,\n\t\t\t\t> tbody > tr > td {\n\t\t\t\t\tmin-width: ", "px;\n\t\t\t\t\tfont-weight: ", ";\n\t\t\t\t\tvertical-align: top;\n\t\t\t\t\t", "\n\t\t\t\t\tborder: 1px solid ", ";\n\t\t\t\t\tborder-right-width: 0;\n\t\t\t\t\tborder-bottom-width: 0;\n\n\t\t\t\t\tpadding: ", ";\n\t\t\t\t\t/* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n\t\t\t\t\t", "\n\n\t\t\t\t\t", "\n\n\t\t\t\tth p:not(:first-of-type),\n\t\t\t\ttd p:not(:first-of-type) {\n\t\t\t\t\t\tmargin-top: ", ";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* Ensures nested tables are compatible with parent table background color - uses specificity to ensure tables nested by extensions are not affected */\n\t\t\t\t> tbody > tr > td {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\n\t\t\t\t", "\n\t\t\t\tth {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\ttext-align: left;\n\n\t\t\t\t\t/* only apply this styling to codeblocks in default background headercells */\n\t\t\t\t\t/* TODO this needs to be overhauled as it relies on unsafe selectors */\n\t\t\t\t\t", " {\n\t\t\t\t\t\t.", ":not(.danger) {\n\t\t\t\t\t\t\tbackground-color: ", ";\n\n\t\t\t\t\t\t\t:not(.", ") {\n\t\t\t\t\t\t\t\tbox-shadow: 0px 0px 0px 1px ", ";\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\tbackground-image: ", ";\n\n\t\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t.", " {\n\t\t\t\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* this is only relevant to the element taken care of by renderer */\n\t\t\t\t\t\t\t> [data-ds--code--code-block] {\n\t\t\t\t\t\t\t\tbackground-image: ", "!important;\n\n\t\t\t\t\t\t\t\tbackground-color: ", "!important;\n\n\t\t\t\t\t\t\t\t/* selector lives inside @atlaskit/code */\n\t\t\t\t\t\t\t\t--ds--code--line-number-bg-color: ", ";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t", "\n\t"])), (0, _tableCell.tableCellBackgroundStyleOverride)(), _TableSharedCssClassName.TableSharedCssClassName.TABLE_CONTAINER, "var(--ds-space-200, 16px)", (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "/* Fake side borders are not needed when the rounded overlay owns the outer border. */\n\t\t\t\t.".concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_RIGHT_BORDER, ",\n\t\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_LEFT_BORDER, " {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t\t\t") : ".".concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_RIGHT_BORDER, ",\n\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_LEFT_BORDER, " {\n\t\t\t\tdisplay: block;\n\t\t\t\twidth: 1px;\n\t\t\t\theight: calc(100% - ", "var(--ds-space-300, 24px)", ");\n\t\t\t\tbackground: ", "var(--ds-background-accent-gray-subtler, #DDDEE1)", ";\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: ", "var(--ds-space-300, 24px)", ";\n\t\t\t}\n\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_RIGHT_BORDER, " {\n\t\t\t\tright: 0;\n\t\t\t}\n\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_LEFT_BORDER, " {\n\t\t\t\tleft: 0;\n\t\t\t}\n\t\t\t.").concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_LEFT_BORDER, "[data-with-numbered-table='true'] {\n\t\t\t\tleft: ").concat(_editorSharedStyles.akEditorTableNumberColumnWidth - 1, "px;\n\t\t\t}"), _TableSharedCssClassName.TableSharedCssClassName.TABLE_CONTAINER, _editorSharedStyles.akEditorTableNumberColumnWidth - 1, _TableSharedCssClassName.TableSharedCssClassName.TABLE_RESIZER_CONTAINER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_RESIZER_CONTAINER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_NODE_WRAPPER, "var(--ds-space-300, 24px)", _TableSharedCssClassName.TableSharedCssClassName.TABLE_CONTAINER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_STICKY_WRAPPER, "var(--ds-space-300, 24px)", "var(--ds-space-100, 8px)", (0, _platformFeatureFlags.fg)('platform_editor_bordered_panel_nested_in_table') ? ".".concat(_TableSharedCssClassName.TableSharedCssClassName.TABLE_NODE_WRAPPER, " .ak-editor-panel {\n\t\t\tborder: ", "var(--ds-border-width, 1px)", " solid ", "var(--ds-border, #0B120E24)", ";\n\t\t}") : '', _TableSharedCssClassName.TableSharedCssClassName.TABLE_CONTAINER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_NODE_WRAPPER, _TableSharedCssClassName.TableSharedCssClassName.TABLE_STICKY_WRAPPER, (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "/* Keep a transparent border so the collapsed border model reserves the same 1px slot\n\t\t\t on the table edge; the ::after overlay draws the visible rounded border instead. */\n\t\t\tborder: ".concat(tableCellBorderWidth, "px solid transparent;") : "border: ".concat(tableCellBorderWidth, "px solid ", "var(--ds-background-accent-gray-subtler, #DDDEE1)", ";\n\t\t\tborder-left-color: transparent;\n\t\t\tborder-right-color: transparent;"), (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "position: relative;\n\n\t\t\t/* Table-width outer-border owner for overflow-safe rounded corners. */\n\t\t\t&::after {\n\t\t\t\tcontent: '';\n\t\t\t\tposition: absolute;\n\t\t\t\tinset: -0.5px;\n\t\t\t\tborder: ".concat(tableCellBorderWidth, "px solid ", "var(--ds-background-accent-gray-subtler, #DDDEE1)", ";\n\t\t\t\tborder-radius: ", "var(--ds-radius-xlarge, 12px)", ";\n\t\t\t\tpointer-events: none;\n\t\t\t\tz-index: 1;\n\t\t\t}\n\n\t\t\t/* When content-visibility is applied to the table (see editor-plugin-table nodeview), the\n\t\t\t implied `contain: paint` clips descendant painting to the table's border-box. The\n\t\t\t overlay above sits at `inset: -0.5px` (half a pixel outside), so it would be shaved \u2014\n\t\t\t most visibly along the bottom. Pull it flush to the edge so it paints inside the clip. */\n\t\t\t&[data-content-visibility]::after {\n\t\t\t\tinset: 0;\n\t\t\t}") : '', "var(--ds-background-neutral-subtle, #00000000)", tableCellMinWidth, "var(--ds-font-weight-regular, 400)", (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_menu_updates', 'isEnabled', true) ? "&[data-valign='middle'] {\n\t\t\t\t\t\t\t\tvertical-align: middle;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t&[data-valign='bottom'] {\n\t\t\t\t\t\t\t\tvertical-align: bottom;\n\t\t\t\t\t\t\t}" : '', "var(--ds-background-accent-gray-subtler, #DDDEE1)", "var(--ds-space-100, 8px)", browser.gecko || browser.ie || browser.mac && browser.chrome ? 'background-clip: padding-box;' : '', firstNodeWithNotMarginTop(), "var(--ds-space-150, 12px)", "var(--ds-surface, #FFFFFF)", (0, _expValEquals.expValEquals)('platform_editor_table_q4_loveability', 'isEnabled', true) ? "/* Let the wrapper overlay own the outer table perimeter.\n\t\t\t\t data-reaches-* attributes are set by the TableCell node view. */\n\t\t\t\t> tbody > tr > th[data-reaches-top],\n\t\t\t\t> tbody > tr > td[data-reaches-top] {\n\t\t\t\t\tborder-top-color: transparent;\n\t\t\t\t}\n\n\t\t\t\t> tbody > tr > th[data-reaches-left],\n\t\t\t\t> tbody > tr > td[data-reaches-left] {\n\t\t\t\t\tborder-left-color: transparent;\n\t\t\t\t}\n\n\t\t\t\t> tbody > tr > td[data-reaches-left]::after {\n\t\t\t\t\tborder-left-color: transparent;\n\t\t\t\t}\n\n\t\t\t\t> tbody > tr > td[data-reaches-bottom]::after,\n\t\t\t\t> tbody > tr > th[data-reaches-bottom]::after {\n\t\t\t\t\tborder-bottom-color: transparent;\n\t\t\t\t}\n\n\t\t\t\t/* The rounded-table overlay owns transparent perimeter borders.\n\t\t\t\t Paint edge cell backgrounds into that reserved border area so coloured\n\t\t\t\t first/last rows do not show the page background through 1px seams. */\n\t\t\t\t> tbody > tr > th[data-reaches-top],\n\t\t\t\t> tbody > tr > td[data-reaches-top],\n\t\t\t\t> tbody > tr > th[data-reaches-bottom],\n\t\t\t\t> tbody > tr > td[data-reaches-bottom] {\n\t\t\t\t\tbackground-clip: border-box;\n\t\t\t\t}" : '', "var(--ds-background-accent-gray-subtlest, #F0F1F2)", (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) ? '&:not(.danger)' : '&:not([style]):not(.danger)', _codeBlock.CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, "var(--ds-surface-raised, #FFFFFF)", _editorSharedStyles.akEditorSelectedNodeClassName, "var(--ds-border, #0B120E24)", _codeBlock.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER, (0, _editorSharedStyles.overflowShadow)({
|
|
73
73
|
leftCoverWidth: "var(--ds-space-300, 24px)"
|
|
74
74
|
}), "var(--ds-background-neutral, #0515240F)", _codeBlock.CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, "var(--ds-background-neutral, #0515240F)", (0, _editorSharedStyles.overflowShadow)({
|
|
75
75
|
leftCoverWidth: "var(--ds-space-300, 24px)"
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "118.
|
|
27
|
+
var packageVersion = "118.11.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -13,6 +13,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
16
17
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
18
|
var _providerFactory = require("../../provider-factory");
|
|
18
19
|
var _mentionWithProviders = require("./mention-with-providers");
|
|
@@ -20,6 +21,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
20
21
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
21
22
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @repo/internal/react/no-class-components */
|
|
22
23
|
var MENTION_PROVIDERS = ['mentionProvider', 'profilecardProvider'];
|
|
24
|
+
var GENERIC_MENTION_IDS = ['HipChat', 'all', 'here'];
|
|
23
25
|
var Mention = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
24
26
|
function Mention(props) {
|
|
25
27
|
var _this;
|
|
@@ -34,9 +36,26 @@ var Mention = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
34
36
|
localId = _this$props.localId,
|
|
35
37
|
userType = _this$props.userType,
|
|
36
38
|
isDisabled = _this$props.isDisabled,
|
|
37
|
-
disabledTooltip = _this$props.disabledTooltip
|
|
39
|
+
disabledTooltip = _this$props.disabledTooltip,
|
|
40
|
+
mentionNodeDataProvider = _this$props.mentionNodeDataProvider;
|
|
38
41
|
var mentionProvider = providers.mentionProvider,
|
|
39
42
|
profilecardProvider = providers.profilecardProvider;
|
|
43
|
+
var isAvatarEnabled = Boolean(mentionNodeDataProvider) && userType !== 'SPECIAL' && !GENERIC_MENTION_IDS.includes(id) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_node_avatar');
|
|
44
|
+
if (isAvatarEnabled && mentionNodeDataProvider) {
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_mentionWithProviders.MentionWithAvatarProviders, {
|
|
46
|
+
id: id,
|
|
47
|
+
text: text,
|
|
48
|
+
accessLevel: accessLevel,
|
|
49
|
+
localId: localId,
|
|
50
|
+
userType: userType,
|
|
51
|
+
isDisabled: isDisabled,
|
|
52
|
+
disabledTooltip: disabledTooltip,
|
|
53
|
+
eventHandlers: eventHandlers,
|
|
54
|
+
mentionProvider: mentionProvider,
|
|
55
|
+
mentionNodeDataProvider: mentionNodeDataProvider,
|
|
56
|
+
profilecardProvider: profilecardProvider
|
|
57
|
+
});
|
|
58
|
+
}
|
|
40
59
|
return /*#__PURE__*/_react.default.createElement(_mentionWithProviders.MentionWithProviders, {
|
|
41
60
|
id: id,
|
|
42
61
|
text: text,
|
|
@@ -47,11 +47,15 @@ function MentionWithProfileCard(_ref) {
|
|
|
47
47
|
id = _ref.id,
|
|
48
48
|
text = _ref.text,
|
|
49
49
|
accessLevel = _ref.accessLevel,
|
|
50
|
+
appType = _ref.appType,
|
|
51
|
+
avatarUrl = _ref.avatarUrl,
|
|
52
|
+
isAvatarImagePreShaped = _ref.isAvatarImagePreShaped,
|
|
50
53
|
mentionProvider = _ref.mentionProvider,
|
|
51
54
|
profilecardProvider = _ref.profilecardProvider,
|
|
52
55
|
onClick = _ref.onClick,
|
|
53
56
|
onMouseEnter = _ref.onMouseEnter,
|
|
54
57
|
onMouseLeave = _ref.onMouseLeave,
|
|
58
|
+
renderAvatarSlot = _ref.renderAvatarSlot,
|
|
55
59
|
localId = _ref.localId,
|
|
56
60
|
ssrPlaceholderId = _ref.ssrPlaceholderId,
|
|
57
61
|
userType = _ref.userType;
|
|
@@ -65,11 +69,15 @@ function MentionWithProfileCard(_ref) {
|
|
|
65
69
|
id: id,
|
|
66
70
|
text: text,
|
|
67
71
|
accessLevel: accessLevel,
|
|
72
|
+
appType: appType,
|
|
73
|
+
avatarUrl: avatarUrl,
|
|
74
|
+
isAvatarImagePreShaped: isAvatarImagePreShaped,
|
|
68
75
|
localId: localId,
|
|
69
76
|
mentionProvider: mentionProvider,
|
|
70
77
|
onClick: onClick,
|
|
71
78
|
onMouseEnter: onMouseEnter,
|
|
72
79
|
onMouseLeave: onMouseLeave,
|
|
80
|
+
renderAvatarSlot: renderAvatarSlot,
|
|
73
81
|
ssrPlaceholderId: ssrPlaceholderId
|
|
74
82
|
});
|
|
75
83
|
|
|
@@ -5,28 +5,78 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.MentionWithProviders = void 0;
|
|
8
|
+
exports.MentionWithProviders = exports.MentionWithAvatarProviders = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
13
|
var _element = require("@atlaskit/mention/element");
|
|
12
14
|
var _mentionWithProfilecard = _interopRequireDefault(require("./mention-with-profilecard"));
|
|
15
|
+
var _excluded = ["id", "mentionNodeDataProvider", "userType"];
|
|
13
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
17
|
var GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
id = _ref.id,
|
|
20
|
-
isDisabled = _ref.isDisabled,
|
|
21
|
-
mentionProvider = _ref.mentionProvider,
|
|
22
|
-
profilecardProviderResolver = _ref.profilecardProvider,
|
|
23
|
-
text = _ref.text,
|
|
24
|
-
localId = _ref.localId,
|
|
18
|
+
var useMentionNodeData = function useMentionNodeData(_ref) {
|
|
19
|
+
var _state$data;
|
|
20
|
+
var id = _ref.id,
|
|
21
|
+
mentionNodeDataProvider = _ref.mentionNodeDataProvider,
|
|
25
22
|
userType = _ref.userType;
|
|
26
|
-
var
|
|
23
|
+
var mention = (0, _react.useMemo)(function () {
|
|
24
|
+
return {
|
|
25
|
+
id: id,
|
|
26
|
+
userType: userType
|
|
27
|
+
};
|
|
28
|
+
}, [id, userType]);
|
|
29
|
+
var mentionKey = "".concat(userType !== null && userType !== void 0 ? userType : 'DEFAULT', ":").concat(id);
|
|
30
|
+
var synchronousData = (0, _react.useMemo)(function () {
|
|
31
|
+
return mentionNodeDataProvider.getMentionDataFromCache(mention);
|
|
32
|
+
}, [mention, mentionNodeDataProvider]);
|
|
33
|
+
var _useState = (0, _react.useState)(function () {
|
|
34
|
+
return {
|
|
35
|
+
data: synchronousData,
|
|
36
|
+
key: mentionKey
|
|
37
|
+
};
|
|
38
|
+
}),
|
|
27
39
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
state = _useState2[0],
|
|
41
|
+
setState = _useState2[1];
|
|
42
|
+
var data = state.key === mentionKey ? (_state$data = state.data) !== null && _state$data !== void 0 ? _state$data : synchronousData : synchronousData;
|
|
43
|
+
(0, _react.useEffect)(function () {
|
|
44
|
+
if (synchronousData) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
var isActive = true;
|
|
48
|
+
mentionNodeDataProvider.getMentionData(mention, function (payload) {
|
|
49
|
+
if (isActive && payload.data) {
|
|
50
|
+
setState({
|
|
51
|
+
data: payload.data,
|
|
52
|
+
key: mentionKey
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return function () {
|
|
57
|
+
isActive = false;
|
|
58
|
+
};
|
|
59
|
+
}, [mention, mentionKey, mentionNodeDataProvider, synchronousData]);
|
|
60
|
+
return data;
|
|
61
|
+
};
|
|
62
|
+
var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
63
|
+
var accessLevel = _ref2.accessLevel,
|
|
64
|
+
disabledTooltip = _ref2.disabledTooltip,
|
|
65
|
+
eventHandlers = _ref2.eventHandlers,
|
|
66
|
+
id = _ref2.id,
|
|
67
|
+
isDisabled = _ref2.isDisabled,
|
|
68
|
+
mentionNodeData = _ref2.mentionNodeData,
|
|
69
|
+
mentionProvider = _ref2.mentionProvider,
|
|
70
|
+
profilecardProviderResolver = _ref2.profilecardProvider,
|
|
71
|
+
_ref2$renderAvatarSlo = _ref2.renderAvatarSlot,
|
|
72
|
+
renderAvatarSlot = _ref2$renderAvatarSlo === void 0 ? false : _ref2$renderAvatarSlo,
|
|
73
|
+
text = _ref2.text,
|
|
74
|
+
localId = _ref2.localId,
|
|
75
|
+
userType = _ref2.userType;
|
|
76
|
+
var _useState3 = (0, _react.useState)(null),
|
|
77
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
78
|
+
profilecardProvider = _useState4[0],
|
|
79
|
+
setProfilecardProvider = _useState4[1];
|
|
30
80
|
var mountedRef = (0, _react.useRef)(true);
|
|
31
81
|
(0, _react.useLayoutEffect)(function () {
|
|
32
82
|
mountedRef.current = true;
|
|
@@ -61,11 +111,15 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
|
|
|
61
111
|
accessLevel: accessLevel,
|
|
62
112
|
localId: localId,
|
|
63
113
|
mentionProvider: mentionProvider,
|
|
114
|
+
appType: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.appType,
|
|
115
|
+
avatarUrl: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.avatarUrl,
|
|
116
|
+
isAvatarImagePreShaped: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isAvatarImagePreShaped,
|
|
64
117
|
isDisabled: true,
|
|
65
118
|
disabledTooltip: disabledTooltip,
|
|
66
119
|
onClick: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick,
|
|
67
120
|
onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
|
|
68
121
|
onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
|
|
122
|
+
renderAvatarSlot: renderAvatarSlot,
|
|
69
123
|
ssrPlaceholderId: ssrPlaceholderId
|
|
70
124
|
});
|
|
71
125
|
}
|
|
@@ -75,7 +129,10 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
|
|
|
75
129
|
accessLevel: accessLevel,
|
|
76
130
|
localId: localId,
|
|
77
131
|
userType: userType,
|
|
78
|
-
mentionProvider: mentionProvider
|
|
132
|
+
mentionProvider: mentionProvider,
|
|
133
|
+
appType: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.appType,
|
|
134
|
+
avatarUrl: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.avatarUrl,
|
|
135
|
+
isAvatarImagePreShaped: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isAvatarImagePreShaped
|
|
79
136
|
// Ignored via go/ees005
|
|
80
137
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
81
138
|
,
|
|
@@ -83,6 +140,26 @@ var MentionWithProviders = exports.MentionWithProviders = /*#__PURE__*/_react.de
|
|
|
83
140
|
onClick: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick,
|
|
84
141
|
onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
|
|
85
142
|
onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
|
|
143
|
+
renderAvatarSlot: renderAvatarSlot,
|
|
86
144
|
ssrPlaceholderId: ssrPlaceholderId
|
|
87
145
|
});
|
|
146
|
+
});
|
|
147
|
+
var MentionWithAvatarProviders = exports.MentionWithAvatarProviders = /*#__PURE__*/_react.default.memo(function (_ref3) {
|
|
148
|
+
var id = _ref3.id,
|
|
149
|
+
mentionNodeDataProvider = _ref3.mentionNodeDataProvider,
|
|
150
|
+
userType = _ref3.userType,
|
|
151
|
+
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
152
|
+
var mentionNodeData = useMentionNodeData({
|
|
153
|
+
id: id,
|
|
154
|
+
mentionNodeDataProvider: mentionNodeDataProvider,
|
|
155
|
+
userType: userType
|
|
156
|
+
});
|
|
157
|
+
return /*#__PURE__*/_react.default.createElement(MentionWithProviders
|
|
158
|
+
// eslint-disable-next-line react/jsx-props-no-spreading -- The treatment adds only resolved avatar data to the existing mention props.
|
|
159
|
+
, (0, _extends2.default)({}, props, {
|
|
160
|
+
id: id,
|
|
161
|
+
mentionNodeData: mentionNodeData,
|
|
162
|
+
renderAvatarSlot: true,
|
|
163
|
+
userType: userType
|
|
164
|
+
}));
|
|
88
165
|
});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.applyContentVisibility = applyContentVisibility;
|
|
8
|
+
exports.estimateExpandIntrinsicHeight = estimateExpandIntrinsicHeight;
|
|
9
|
+
exports.estimateMediaSingleIntrinsicSize = estimateMediaSingleIntrinsicSize;
|
|
10
|
+
exports.estimateTableIntrinsicHeight = estimateTableIntrinsicHeight;
|
|
11
|
+
exports.formatIntrinsicSize = formatIntrinsicSize;
|
|
12
|
+
exports.getContentVisibilityStyle = getContentVisibilityStyle;
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
|
+
var _utils = require("../media-single/utils");
|
|
16
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
+
// Rough per-node rendered-size constants (px), grounded in the real style defaults from
|
|
19
|
+
// `styles/shared/table.ts`, `EditorContentContainer/styles/expandStyles.ts` and
|
|
20
|
+
// `EditorContentContainer/styles/layout.ts`. These only need to be a decent first estimate: the
|
|
21
|
+
// `auto` keyword in `contain-intrinsic-*: auto <estimate>` makes the browser remember each
|
|
22
|
+
// element's real size after its first render, so any inaccuracy self-corrects on scroll. Where the
|
|
23
|
+
// estimate can't be exact we intentionally err slightly HIGH — over-reserving leaves a marginally
|
|
24
|
+
// long scrollbar that shrinks on scroll, whereas under-reserving makes content jump upward.
|
|
25
|
+
var TABLE_ROW_HEIGHT = 44; // row content: line-height + cell padding (space.100 ×2) + cell border
|
|
26
|
+
var TABLE_VERTICAL_MARGIN = 40; // tableMarginTop(24) + tableMarginBottom(16)
|
|
27
|
+
var TABLE_MIN_HEIGHT = 120;
|
|
28
|
+
var BLOCK_HEIGHT = 28; // a typical paragraph/block line + spacing
|
|
29
|
+
|
|
30
|
+
var EXPAND_HEADER_HEIGHT = 48; // min-height:25 + padding + margin of the title row
|
|
31
|
+
var EXPAND_CONTENT_PADDING = 8; // space.100 padding-top when expanded
|
|
32
|
+
|
|
33
|
+
var MEDIA_SINGLE_MIN_HEIGHT = 100;
|
|
34
|
+
var MEDIA_SINGLE_GUTTER = 12; // MEDIA_SINGLE_GUTTER_SIZE — gap between resizer handle and media
|
|
35
|
+
var MEDIA_SINGLE_VERTICAL_MARGIN = 24; // rich-media-item margin: space.150 top + bottom
|
|
36
|
+
var MEDIA_CAPTION_HEIGHT = 32; // caption line-height + vertical padding, when a caption is present
|
|
37
|
+
var DEFAULT_MEDIA_ASPECT_RATIO = 9 / 16; // used only when the media has no intrinsic dimensions
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The intrinsic size a nodeView reserves while off-screen (`contain-intrinsic-width`/`-height`).
|
|
41
|
+
* `width` is optional: for block-level wrappers (expand, layout) the inline size comes from the
|
|
42
|
+
* containing block regardless of size containment, so only `height` is meaningful; for
|
|
43
|
+
* content-sized boxes (the `<table>` element, the mediaSingle wrapper) the width matters and must
|
|
44
|
+
* be supplied or the box collapses to 0 wide while contained.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Estimate the rendered height of a table from its row count. Cell padding and cell borders are
|
|
49
|
+
* already folded into `TABLE_ROW_HEIGHT`; the table's block margins are added as a small buffer.
|
|
50
|
+
*/
|
|
51
|
+
function estimateTableIntrinsicHeight(node) {
|
|
52
|
+
var rows = node.childCount;
|
|
53
|
+
return Math.max(TABLE_MIN_HEIGHT, rows * TABLE_ROW_HEIGHT + TABLE_VERTICAL_MARGIN);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Estimate the rendered height of an expand. A collapsed expand reserves only its header row; an
|
|
58
|
+
* expanded one additionally reserves space for its child blocks. `expanded` is passed in by the
|
|
59
|
+
* caller because the two expand implementations track expanded state differently (a WeakMap in
|
|
60
|
+
* single-player vs the `__expanded` attribute in legacy).
|
|
61
|
+
*/
|
|
62
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
63
|
+
function estimateExpandIntrinsicHeight(node, expanded) {
|
|
64
|
+
if (!expanded) {
|
|
65
|
+
return EXPAND_HEADER_HEIGHT;
|
|
66
|
+
}
|
|
67
|
+
return EXPAND_HEADER_HEIGHT + node.childCount * BLOCK_HEIGHT + EXPAND_CONTENT_PADDING;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Estimate the rendered width AND height of a mediaSingle. Unlike the structural estimates above,
|
|
72
|
+
* media carries its real dimensions in the ADF: the child `media` node's `width`/`height` attrs
|
|
73
|
+
* give the intrinsic aspect ratio, and the rendered pixel width is computed with the exact same
|
|
74
|
+
* `calcMediaSinglePixelWidth` helper the renderer uses (honouring `width`/`widthType`/`layout` and
|
|
75
|
+
* the editor's content/container width). Height then follows from width × aspect ratio — plus a
|
|
76
|
+
* caption row when present and the mediaSingle's block margins — so this is the most accurate
|
|
77
|
+
* estimate of any node type. The pixel width is returned as the intrinsic width because the
|
|
78
|
+
* mediaSingle wrapper is content-sized. `lineLength` and `containerWidth` come from the width
|
|
79
|
+
* plugin's shared state.
|
|
80
|
+
*/
|
|
81
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
82
|
+
function estimateMediaSingleIntrinsicSize(node, lineLength, containerWidth) {
|
|
83
|
+
var _media$attrs, _media$attrs2, _node$attrs$width, _ref;
|
|
84
|
+
var media = node.firstChild;
|
|
85
|
+
var origWidth = Number(media === null || media === void 0 || (_media$attrs = media.attrs) === null || _media$attrs === void 0 ? void 0 : _media$attrs.width) || 0;
|
|
86
|
+
var origHeight = Number(media === null || media === void 0 || (_media$attrs2 = media.attrs) === null || _media$attrs2 === void 0 ? void 0 : _media$attrs2.height) || 0;
|
|
87
|
+
var aspectRatio = origWidth && origHeight ? origHeight / origWidth : DEFAULT_MEDIA_ASPECT_RATIO;
|
|
88
|
+
var pixelWidth = (0, _utils.calcMediaSinglePixelWidth)({
|
|
89
|
+
width: (_node$attrs$width = node.attrs.width) !== null && _node$attrs$width !== void 0 ? _node$attrs$width : undefined,
|
|
90
|
+
widthType: node.attrs.widthType,
|
|
91
|
+
origWidth: origWidth || lineLength || containerWidth,
|
|
92
|
+
layout: (_ref = node.attrs.layout) !== null && _ref !== void 0 ? _ref : 'center',
|
|
93
|
+
contentWidth: lineLength || undefined,
|
|
94
|
+
containerWidth: containerWidth || lineLength,
|
|
95
|
+
gutterOffset: MEDIA_SINGLE_GUTTER
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// A caption child (childCount > 1) sits below the media, and the mediaSingle block reserves
|
|
99
|
+
// vertical margin above and below regardless.
|
|
100
|
+
var captionHeight = node.childCount > 1 ? MEDIA_CAPTION_HEIGHT : 0;
|
|
101
|
+
var height = Math.max(MEDIA_SINGLE_MIN_HEIGHT, Math.round(pixelWidth * aspectRatio) + captionHeight + MEDIA_SINGLE_VERTICAL_MARGIN);
|
|
102
|
+
return {
|
|
103
|
+
width: Math.round(pixelWidth),
|
|
104
|
+
height: height
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Produce a single-axis `contain-intrinsic-width`/`-height` value using the `auto` keyword so the
|
|
110
|
+
* browser remembers the element's real size after its first render and only uses the estimate
|
|
111
|
+
* beforehand.
|
|
112
|
+
*/
|
|
113
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
114
|
+
function formatIntrinsicSize(px) {
|
|
115
|
+
return "auto ".concat(Math.round(px), "px");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The `content-visibility` / `contain-intrinsic-*` styles applied to an eligible node. Width and
|
|
120
|
+
* height are kept as separate `contain-intrinsic-width`/`-height` axes rather than the
|
|
121
|
+
* `contain-intrinsic-size` shorthand: the shorthand's single value is applied to BOTH axes, which
|
|
122
|
+
* forces a wrong width on content-sized boxes (e.g. a 500px-tall `<table>` would reserve 500px
|
|
123
|
+
* wide). `containIntrinsicWidth` is omitted for block-level wrappers whose width comes from layout.
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Resolve the `content-visibility` styles for a node, or `undefined` when the optimisation should
|
|
128
|
+
* not apply.
|
|
129
|
+
*
|
|
130
|
+
* Gating is delegated to limited mode: `limitedModeEnabled` should come from the limited-mode
|
|
131
|
+
* plugin's shared state, so this feature shares a single "large document" definition with limited
|
|
132
|
+
* mode rather than a bespoke threshold. The optimisation applies only when the feature gate is on
|
|
133
|
+
* AND limited mode is active.
|
|
134
|
+
*
|
|
135
|
+
* The intrinsic size is supplied lazily via `getIntrinsicSize` so callers can compute a
|
|
136
|
+
* per-instance estimate from the node's structure, and is only evaluated when actually applied.
|
|
137
|
+
*/
|
|
138
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
139
|
+
function getContentVisibilityStyle(limitedModeEnabled, getIntrinsicSize) {
|
|
140
|
+
if (!limitedModeEnabled || !(0, _isExperimentEnabled.isExperimentEnabled)('cc_editor_limited_mode_perf_improvements')) {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
var _getIntrinsicSize = getIntrinsicSize(),
|
|
144
|
+
width = _getIntrinsicSize.width,
|
|
145
|
+
height = _getIntrinsicSize.height;
|
|
146
|
+
return _objectSpread({
|
|
147
|
+
contentVisibility: 'auto',
|
|
148
|
+
containIntrinsicHeight: formatIntrinsicSize(height)
|
|
149
|
+
}, width !== undefined ? {
|
|
150
|
+
containIntrinsicWidth: formatIntrinsicSize(width)
|
|
151
|
+
} : {});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Imperatively apply the `content-visibility: auto` rendering optimisation to a node's top-level
|
|
156
|
+
* DOM element (for use in raw-DOM nodeViews), but only when both the feature gate is on and limited
|
|
157
|
+
* mode is active (see `getContentVisibilityStyle`).
|
|
158
|
+
*
|
|
159
|
+
* The intrinsic size uses the `auto` keyword so any initial inaccuracy self-corrects once the
|
|
160
|
+
* element has been rendered once. Safe to call repeatedly (e.g. on expand/collapse toggle) — it
|
|
161
|
+
* simply re-applies or, when ineligible, leaves the element untouched.
|
|
162
|
+
*/
|
|
163
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
164
|
+
function applyContentVisibility(dom, limitedModeEnabled, getIntrinsicSize) {
|
|
165
|
+
var _style$containIntrins;
|
|
166
|
+
var style = getContentVisibilityStyle(limitedModeEnabled, getIntrinsicSize);
|
|
167
|
+
if (!style) {
|
|
168
|
+
dom.style.contentVisibility = '';
|
|
169
|
+
dom.style.containIntrinsicHeight = '';
|
|
170
|
+
dom.style.containIntrinsicWidth = '';
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
dom.style.contentVisibility = style.contentVisibility;
|
|
174
|
+
dom.style.containIntrinsicHeight = style.containIntrinsicHeight;
|
|
175
|
+
dom.style.containIntrinsicWidth = (_style$containIntrins = style.containIntrinsicWidth) !== null && _style$containIntrins !== void 0 ? _style$containIntrins : '';
|
|
176
|
+
return true;
|
|
177
|
+
}
|