@atlaskit/renderer 109.25.5 → 109.27.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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 109.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#97196](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97196)
8
+ [`b9e49dbef2a3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b9e49dbef2a3) -
9
+ [ED-23179] Added background mark react view to renderer
10
+
11
+ ### Patch Changes
12
+
13
+ - [#98285](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98285)
14
+ [`0225618cf16f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0225618cf16f) -
15
+ [ux] Add auto scale when table resized and numbered column enabled.
16
+ - Updated dependencies
17
+
18
+ ## 109.26.0
19
+
20
+ ### Minor Changes
21
+
22
+ - [#98890](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98890)
23
+ [`9a61210caecb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9a61210caecb) -
24
+ Updating parameters of the applyDraftMode() function to return a step if an annotationId is
25
+ passed in
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+
3
31
  ## 109.25.5
4
32
 
5
33
  ### Patch Changes
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = BackgroundColor;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _adfSchema = require("@atlaskit/adf-schema");
13
+ var _editorPalette = require("@atlaskit/editor-palette");
14
+ var _tokens = require("@atlaskit/tokens");
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
+ function BackgroundColor(props) {
18
+ var _useThemeObserver = (0, _tokens.useThemeObserver)(),
19
+ colorMode = _useThemeObserver.colorMode;
20
+ var paletteColorValue;
21
+
22
+ /**
23
+ * Documents can contain custom colors when content has been migrated from the old editor, or created via APIs.
24
+ *
25
+ * This behaviour predates the introduction of dark mode.
26
+ *
27
+ * Without the inversion logic below, text with custom colors, can be hard to read when the user loads the page in dark mode.
28
+ *
29
+ * This introduces inversion of the presentation of the custom text background colors when the user is in dark mode.
30
+ *
31
+ * This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
32
+ * how we detect text background colors copied from external editor sources. Where we load the background color from a
33
+ * separate attribute (data-background-custom-color), instead of the inline style.
34
+ *
35
+ * See the following document for more details on this behaviour
36
+ * https://hello.atlassian.net/wiki/spaces/CCECO/pages/2908658046/Unsupported+custom+text+colors+in+dark+theme+Editor+Job+Story
37
+ */
38
+ var tokenColor = (0, _editorPalette.hexToEditorTextBackgroundPaletteColor)(props.color);
39
+ if (tokenColor) {
40
+ paletteColorValue = tokenColor;
41
+ } else {
42
+ if (colorMode === 'dark') {
43
+ // if we have a custom color, we need to check if we are in dark mode
44
+ paletteColorValue = (0, _adfSchema.getDarkModeLCHColor)(props.color);
45
+ } else {
46
+ // if we are in light mode, we can just set the color
47
+ paletteColorValue = props.color;
48
+ }
49
+ }
50
+ var style = (0, _react.useMemo)(function () {
51
+ return (0, _defineProperty2.default)({}, '--custom-palette-color', paletteColorValue);
52
+ }, [paletteColorValue]);
53
+ return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, props.dataAttributes, {
54
+ "data-background-custom-color": props.color,
55
+ className: "fabric-background-color-mark",
56
+ style: style
57
+ }), props.children);
58
+ }
@@ -11,6 +11,12 @@ Object.defineProperty(exports, "Annotation", {
11
11
  return _annotation.default;
12
12
  }
13
13
  });
14
+ Object.defineProperty(exports, "BackgroundColor", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _backgroundColor.default;
18
+ }
19
+ });
14
20
  Object.defineProperty(exports, "Border", {
15
21
  enumerable: true,
16
22
  get: function get() {
@@ -109,6 +115,7 @@ var _strike = _interopRequireDefault(require("./strike"));
109
115
  var _strong = _interopRequireDefault(require("./strong"));
110
116
  var _subsup = _interopRequireDefault(require("./subsup"));
111
117
  var _textColor = _interopRequireDefault(require("./textColor"));
118
+ var _backgroundColor = _interopRequireDefault(require("./backgroundColor"));
112
119
  var _underline = _interopRequireDefault(require("./underline"));
113
120
  var _breakout = _interopRequireDefault(require("./breakout"));
114
121
  var _alignment = _interopRequireDefault(require("./alignment"));
@@ -132,6 +139,7 @@ var markToReact = exports.markToReact = {
132
139
  strong: _strong.default,
133
140
  subsup: _subsup.default,
134
141
  textColor: _textColor.default,
142
+ backgroundColor: _backgroundColor.default,
135
143
  underline: _underline.default,
136
144
  annotation: _annotation.default,
137
145
  border: _border.default,
@@ -5,12 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.calcScalePercent = exports.Colgroup = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
9
  var _react = _interopRequireDefault(require("react"));
9
10
  var _styles = require("@atlaskit/editor-common/styles");
10
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
11
12
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
12
13
  var _table = require("../table");
13
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
+ var _useFeatureFlags = require("../../../use-feature-flags");
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; }
14
18
  // we allow scaling down column widths by no more than 30%
15
19
  // this intends to reduce unwanted scrolling in the Renderer in these scenarios:
16
20
  // User A creates a table with column widths → User B views it on a smaller screen
@@ -51,7 +55,8 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
51
55
  tableNode = props.tableNode,
52
56
  rendererAppearance = props.rendererAppearance,
53
57
  isInsideOfBlockNode = props.isInsideOfBlockNode,
54
- isinsideMultiBodiedExtension = props.isinsideMultiBodiedExtension;
58
+ isinsideMultiBodiedExtension = props.isinsideMultiBodiedExtension,
59
+ isTableScalingEnabled = props.isTableScalingEnabled;
55
60
  if (!columnWidths) {
56
61
  return [];
57
62
  }
@@ -68,6 +73,30 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
68
73
  } else if (!tableResized) {
69
74
  return null;
70
75
  }
76
+
77
+ // when table resized and number column is enabled, we need to scale down the table in render
78
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.scale-table-when-number-column-in-table-resized_y4qh2') && isTableScalingEnabled && isNumberColumnEnabled && tableResized) {
79
+ var scalePercentage = +((tableContainerWidth - _editorSharedStyles.akEditorTableNumberColumnWidth) / tableContainerWidth).toFixed(2);
80
+ var targetMaxWidth = tableContainerWidth - _editorSharedStyles.akEditorTableNumberColumnWidth;
81
+ var totalWidthAfterScale = 0;
82
+ var newScaledTargetWidths = columnWidths.map(function (width) {
83
+ var newWidth = Math.floor(width * scalePercentage);
84
+ totalWidthAfterScale += newWidth;
85
+ return newWidth;
86
+ });
87
+ var diff = targetMaxWidth - totalWidthAfterScale;
88
+ targetWidths = newScaledTargetWidths;
89
+ if (diff > 0 || diff < 0 && Math.abs(diff) < _styles.tableCellMinWidth) {
90
+ var updated = false;
91
+ targetWidths = targetWidths.map(function (width) {
92
+ if (!updated && width + diff > _styles.tableCellMinWidth) {
93
+ updated = true;
94
+ width += diff;
95
+ }
96
+ return width;
97
+ });
98
+ }
99
+ }
71
100
  targetWidths = targetWidths || columnWidths;
72
101
 
73
102
  // @see ED-6056
@@ -113,10 +142,13 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
113
142
  var Colgroup = exports.Colgroup = function Colgroup(props) {
114
143
  var columnWidths = props.columnWidths,
115
144
  isNumberColumnEnabled = props.isNumberColumnEnabled;
145
+ var flags = (0, _useFeatureFlags.useFeatureFlags)();
116
146
  if (!columnWidths) {
117
147
  return null;
118
148
  }
119
- var colStyles = renderScaleDownColgroup(props);
149
+ var colStyles = renderScaleDownColgroup(_objectSpread(_objectSpread({}, props), {}, {
150
+ isTableScalingEnabled: !!(flags && 'tablePreserveWidth' in flags && flags.tablePreserveWidth)
151
+ }));
120
152
  if (!colStyles) {
121
153
  return null;
122
154
  }
@@ -56,7 +56,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
56
56
  var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
57
57
  var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
58
58
  var packageName = "@atlaskit/renderer";
59
- var packageVersion = "109.25.5";
59
+ var packageVersion = "109.27.0";
60
60
  var defaultNodeComponents = exports.defaultNodeComponents = _nodes.nodeToReact;
61
61
  var Renderer = exports.Renderer = /*#__PURE__*/function (_PureComponent) {
62
62
  (0, _inherits2.default)(Renderer, _PureComponent);
@@ -63,7 +63,7 @@ var headingSizes = exports.headingSizes = {
63
63
  };
64
64
  var headingAnchorStyle = function headingAnchorStyle(headingTag) {
65
65
  return (// TODO Delete this comment after verifying space token -> previous value `margin-left: 6px`
66
- (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n /**\n * The copy link button doesn't reserve space in the DOM so that\n * the text alignment isn't impacted by the button/icon's space.\n */\n .", " {\n position: absolute;\n height: ", "em;\n\n margin-left: ", ";\n\n button {\n padding-left: 0;\n padding-right: 0;\n }\n }\n\n /**\n * Applies hover effects to the heading anchor link button\n * to fade in when the user rolls over the heading.\n *\n * The link is persistent on mobile, so we use feature detection\n * to enable hover effects for systems that support it (desktop).\n *\n * @see https://caniuse.com/mdn-css_at-rules_media_hover\n */\n @media (hover: hover) and (pointer: fine) {\n .", " {\n > button {\n opacity: 0;\n transform: translate(-8px, 0px);\n transition: opacity 0.2s ease 0s, transform 0.2s ease 0s;\n }\n }\n\n &:hover {\n .", " > button {\n opacity: 1;\n transform: none !important;\n }\n }\n }\n\n /**\n * Adds the visibility of the button when in focus through keyboard navigation.\n */\n .", " {\n button:focus {\n opacity: 1;\n transform: none !important;\n }\n }\n "])), _headingAnchor.HeadingAnchorWrapperClassName, headingSizes[headingTag].lineHeight, "var(--ds-space-075, 6px)", _headingAnchor.HeadingAnchorWrapperClassName, _headingAnchor.HeadingAnchorWrapperClassName, _headingAnchor.HeadingAnchorWrapperClassName)
66
+ (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n /**\n * The copy link button doesn't reserve space in the DOM so that\n * the text alignment isn't impacted by the button/icon's space.\n */\n .", " {\n position: absolute;\n height: ", "em;\n\n margin-left: ", ";\n\n button {\n padding-left: 0;\n padding-right: 0;\n }\n }\n\n /**\n * Applies hover effects to the heading anchor link button\n * to fade in when the user rolls over the heading.\n *\n * The link is persistent on mobile, so we use feature detection\n * to enable hover effects for systems that support it (desktop).\n *\n * @see https://caniuse.com/mdn-css_at-rules_media_hover\n */\n @media (hover: hover) and (pointer: fine) {\n .", " {\n > button {\n opacity: 0;\n transform: translate(-8px, 0px);\n transition:\n opacity 0.2s ease 0s,\n transform 0.2s ease 0s;\n }\n }\n\n &:hover {\n .", " > button {\n opacity: 1;\n transform: none !important;\n }\n }\n }\n\n /**\n * Adds the visibility of the button when in focus through keyboard navigation.\n */\n .", " {\n button:focus {\n opacity: 1;\n transform: none !important;\n }\n }\n "])), _headingAnchor.HeadingAnchorWrapperClassName, headingSizes[headingTag].lineHeight, "var(--ds-space-075, 6px)", _headingAnchor.HeadingAnchorWrapperClassName, _headingAnchor.HeadingAnchorWrapperClassName, _headingAnchor.HeadingAnchorWrapperClassName)
67
67
  );
68
68
  };
69
69
  var alignedHeadingAnchorStyle = function alignedHeadingAnchorStyle(_ref) {
@@ -116,7 +116,7 @@ var rendererStyles = exports.rendererStyles = function rendererStyles(wrapperPro
116
116
  var useBlockRenderForCodeBlock = wrapperProps.useBlockRenderForCodeBlock;
117
117
 
118
118
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression
119
- return (0, _react.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\n\n ", "\n ", "\n\n .", " {\n ", "\n }\n\n & h1 {\n ", "\n }\n\n & h2 {\n ", "\n }\n\n & h3 {\n ", "\n }\n\n & h4 {\n ", "\n }\n\n & h5 {\n ", "\n }\n\n & h6 {\n ", "\n }\n\n & span.akActionMark {\n color: ", ";\n text-decoration: none;\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:active {\n color: ", ";\n }\n }\n\n & span.akActionMark {\n cursor: pointer;\n }\n\n & span[data-placeholder] {\n color: ", ";\n }\n\n ", "\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", "\n\n & .UnknownBlock {\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n & span.date-node {\n background: ", ";\n border-radius: ", ";\n color: ", ";\n padding: ", " ", ";\n margin: 0 1px;\n transition: background 0.3s;\n }\n\n & span.date-node-highlighted {\n background: ", ";\n color: ", ";\n }\n\n & .renderer-image {\n max-width: 100%;\n display: block;\n margin: ", " 0;\n }\n\n .", ".rich-media-wrapped\n + .", ":not(.rich-media-wrapped) {\n clear: both;\n }\n\n & .code-block,\n & blockquote,\n & hr,\n & > div > div:not(.rich-media-wrapped),\n .", ".rich-media-wrapped\n + .rich-media-wrapped\n + *:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n .", ".image-align-start,\n .", ".image-center,\n .", ".image-align-end {\n clear: both;\n }\n\n & .rich-media-wrapped {\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n margin-top: ", ";\n }\n }\n\n ", "\n /* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n margin-left: 0;\n margin-right: 0;\n }\n\n /* Breakout for tables and extensions */\n .", " > {\n ", "\n\n * .", " {\n overflow-x: auto;\n }\n\n & .", ":first-child {\n margin-top: 0;\n }\n }\n\n .", " {\n .", " {\n margin-top: ", ";\n }\n\n .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .", " {\n overflow-x: auto;\n }\n\n .", "\n .", " {\n display: flex;\n }\n }\n\n ", "\n\n .", " .", " {\n z-index: 0;\n transition: all 0.1s linear;\n display: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n /** Shadow overrides */\n &.", "::after,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n ", "\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\n }\n\n /**\n * A hack for making all the <th /> heights equal in case some have shorter\n * content than others.\n *\n * This is done to make sort buttons fill entire <th />.\n */\n table {\n height: 1px; /* will be ignored */\n ", ";\n margin-left: 0;\n margin-right: 0;\n }\n\n table tr:first-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\n width: ", "px;\n text-align: center;\n color: ", ";\n font-size: ", ";\n }\n\n .fixed .", " {\n border-right: 0px none;\n }\n }\n }\n\n tr[data-header-row].fixed {\n position: fixed !important;\n display: flex;\n overflow: hidden;\n z-index: ", ";\n\n border-right: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n\n /* this is to compensate for the table border */\n transform: translateX(-1px);\n }\n\n .sticky > th {\n z-index: ", ";\n position: sticky !important;\n top: 0;\n }\n\n /* Make the number column header sticky */\n .sticky > td {\n position: sticky !important;\n top: 0;\n }\n\n /* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n .sticky th,\n .sticky td {\n box-shadow: 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 0px -1px ", ";\n }\n\n /* this will remove jumpiness caused in Chrome for sticky headers */\n .fixed + tr {\n min-height: 0px;\n }\n\n /*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n & .code-block {\n max-width: 100%;\n /* -ms- properties are necessary until MS supports the latest version of the grid spec */\n /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n display: block;\n /* stylelint-enable */\n\n position: relative;\n border-radius: ", ";\n\n /*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n word-wrap: normal;\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n\n ", "\n\n ", "\n\n ", ";\n & [data-layout-section] {\n margin-top: ", ";\n & > div + div {\n margin-left: ", ";\n }\n\n @media screen and (max-width: ", "px) {\n & > div + div {\n margin-left: 0;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n }\n\n & li {\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n &:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n ", "\n }\n "])), (0, _editorSharedStyles.editorFontSize)(themeProps), "var(--ds-text, ".concat(colors.N800, ")"), _consts.RendererCssClassName.DOCUMENT, fullPageStyles(wrapperProps, themeProps), fullWidthStyles(wrapperProps), _consts.RendererCssClassName.DOCUMENT, _mediaInline.mediaInlineImageStyles, headingAnchorStyle('h1'), headingAnchorStyle('h2'), headingAnchorStyle('h3'), headingAnchorStyle('h4'), headingAnchorStyle('h5'), headingAnchorStyle('h6'), "var(--ds-link, ".concat(colors.B400, ")"), "var(--ds-link, ".concat(colors.B300, ")"), "var(--ds-link-pressed, ".concat(colors.B500, ")"), "var(--ds-text-subtlest, ".concat(colors.N200, ")"), telepointerStyles(), _styles.whitespaceSharedStyles, _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)(), (0, _styles.ruleSharedStyles)(), _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.blockMarksSharedStyles, (0, _styles.codeMarkSharedStyles)(), _styles.shadowSharedStyle, _styles.dateSharedStyle, _styles.textColorStyles, _styles.backgroundColorStyles, _styles.tasksAndDecisionsStyles, _styles.smartCardSharedStyles, (0, _constants.fontFamily)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), "var(--ds-background-neutral, ".concat(colors.N30A, ")"), "var(--ds-border-radius-100, 3px)", "var(--ds-text, ".concat(colors.N800, ")"), "var(--ds-space-025, 2px)", "var(--ds-space-050, 4px)", "var(--ds-background-danger, ".concat(colors.R50, ")"), "var(--ds-text-danger, ".concat(colors.R500, ")"), "var(--ds-space-300, 24px)", _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-space-100, 8px)", alignedHeadingAnchorStyle(wrapperProps), _styles.mediaSingleSharedStyle, _consts.RendererCssClassName.DOCUMENT, breakoutWidthStyle(), _consts.RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER, _consts.RendererCssClassName.EXTENSION, _consts.RendererCssClassName.DOCUMENT, _consts.RendererCssClassName.EXTENSION, _editorSharedStyles.blockNodesVerticalMargin, _consts.RendererCssClassName.EXTENSION_CENTER_ALIGN, _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, _ui.shadowObserverClassNames.SHADOW_CONTAINER, _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, (0, _styles.tableSharedStyle)(), _consts.RendererCssClassName.DOCUMENT, _styles.TableSharedCssClassName.TABLE_CONTAINER, _ui.shadowClassNames.RIGHT_SHADOW, _ui.shadowClassNames.LEFT_SHADOW, _styles.tableMarginTop - 1, _styles.tableMarginTop, _editorSharedStyles.akEditorStickyHeaderZIndex, getShadowOverrides(), _ui.shadowObserverClassNames.SENTINEL_LEFT, _ui.shadowObserverClassNames.SENTINEL_RIGHT, _styles.tableMarginTop, tableSortableColumnStyle(wrapperProps), _consts.RendererCssClassName.NUMBER_COLUMN, "var(--ds-background-neutral, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), _editorSharedStyles.akEditorTableNumberColumnWidth, "var(--ds-text-subtlest, ".concat(colors.N200, ")"), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), _consts.RendererCssClassName.NUMBER_COLUMN, _editorSharedStyles.akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), _editorSharedStyles.akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-border-radius-100, 3px)", _editorSharedStyles.blockNodesVerticalMargin, useGridRenderForCodeBlock(useBlockRenderForCodeBlock), (0, _lightWeightCodeBlock.getLightWeightCodeBlockStylesForRootRendererStyleSheet)(), _styles.columnLayoutSharedStyle, "var(--ds-space-250, 20px)", "var(--ds-space-400, 32px)", _editorSharedStyles.gridMediumMaxWidth, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
119
+ return (0, _react.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\n\n ", "\n ", "\n\n .", " {\n ", "\n }\n\n & h1 {\n ", "\n }\n\n & h2 {\n ", "\n }\n\n & h3 {\n ", "\n }\n\n & h4 {\n ", "\n }\n\n & h5 {\n ", "\n }\n\n & h6 {\n ", "\n }\n\n & span.akActionMark {\n color: ", ";\n text-decoration: none;\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:active {\n color: ", ";\n }\n }\n\n & span.akActionMark {\n cursor: pointer;\n }\n\n & span[data-placeholder] {\n color: ", ";\n }\n\n ", "\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", "\n\n & .UnknownBlock {\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n & span.date-node {\n background: ", ";\n border-radius: ", ";\n color: ", ";\n padding: ", " ", ";\n margin: 0 1px;\n transition: background 0.3s;\n }\n\n & span.date-node-highlighted {\n background: ", ";\n color: ", ";\n }\n\n & .renderer-image {\n max-width: 100%;\n display: block;\n margin: ", " 0;\n }\n\n .", ".rich-media-wrapped\n + .", ":not(.rich-media-wrapped) {\n clear: both;\n }\n\n & .code-block,\n & blockquote,\n & hr,\n & > div > div:not(.rich-media-wrapped),\n .", ".rich-media-wrapped\n + .rich-media-wrapped\n + *:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n .", ".image-align-start,\n .", ".image-center,\n .", ".image-align-end {\n clear: both;\n }\n\n & .rich-media-wrapped {\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n margin-top: ", ";\n }\n }\n\n ", "\n /* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n margin-left: 0;\n margin-right: 0;\n }\n\n /* Breakout for tables and extensions */\n .", " > {\n ", "\n\n * .", " {\n overflow-x: auto;\n }\n\n & .", ":first-child {\n margin-top: 0;\n }\n }\n\n .", " {\n .", " {\n margin-top: ", ";\n }\n\n .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .", " {\n overflow-x: auto;\n }\n\n .", "\n .", " {\n display: flex;\n }\n }\n\n ", "\n\n .", " .", " {\n z-index: 0;\n transition: all 0.1s linear;\n display: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n /** Shadow overrides */\n &.", "::after,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n ", "\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\n }\n\n /**\n * A hack for making all the <th /> heights equal in case some have shorter\n * content than others.\n *\n * This is done to make sort buttons fill entire <th />.\n */\n table {\n height: 1px; /* will be ignored */\n ", ";\n margin-left: 0;\n margin-right: 0;\n }\n\n table tr:first-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\n width: ", "px;\n text-align: center;\n color: ", ";\n font-size: ", ";\n }\n\n .fixed .", " {\n border-right: 0px none;\n }\n }\n }\n\n tr[data-header-row].fixed {\n position: fixed !important;\n display: flex;\n overflow: hidden;\n z-index: ", ";\n\n border-right: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n\n /* this is to compensate for the table border */\n transform: translateX(-1px);\n }\n\n .sticky > th {\n z-index: ", ";\n position: sticky !important;\n top: 0;\n }\n\n /* Make the number column header sticky */\n .sticky > td {\n position: sticky !important;\n top: 0;\n }\n\n /* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n .sticky th,\n .sticky td {\n box-shadow:\n 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 0px -1px ", ";\n }\n\n /* this will remove jumpiness caused in Chrome for sticky headers */\n .fixed + tr {\n min-height: 0px;\n }\n\n /*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n & .code-block {\n max-width: 100%;\n /* -ms- properties are necessary until MS supports the latest version of the grid spec */\n /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n display: block;\n /* stylelint-enable */\n\n position: relative;\n border-radius: ", ";\n\n /*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n word-wrap: normal;\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n\n ", "\n\n ", "\n\n ", ";\n & [data-layout-section] {\n margin-top: ", ";\n & > div + div {\n margin-left: ", ";\n }\n\n @media screen and (max-width: ", "px) {\n & > div + div {\n margin-left: 0;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n }\n\n & li {\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n &:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n ", "\n }\n "])), (0, _editorSharedStyles.editorFontSize)(themeProps), "var(--ds-text, ".concat(colors.N800, ")"), _consts.RendererCssClassName.DOCUMENT, fullPageStyles(wrapperProps, themeProps), fullWidthStyles(wrapperProps), _consts.RendererCssClassName.DOCUMENT, _mediaInline.mediaInlineImageStyles, headingAnchorStyle('h1'), headingAnchorStyle('h2'), headingAnchorStyle('h3'), headingAnchorStyle('h4'), headingAnchorStyle('h5'), headingAnchorStyle('h6'), "var(--ds-link, ".concat(colors.B400, ")"), "var(--ds-link, ".concat(colors.B300, ")"), "var(--ds-link-pressed, ".concat(colors.B500, ")"), "var(--ds-text-subtlest, ".concat(colors.N200, ")"), telepointerStyles(), _styles.whitespaceSharedStyles, _styles.blockquoteSharedStyles, (0, _styles.headingsSharedStyles)(), (0, _styles.ruleSharedStyles)(), _styles.paragraphSharedStyles, _styles.listsSharedStyles, _styles.indentationSharedStyles, _styles.blockMarksSharedStyles, (0, _styles.codeMarkSharedStyles)(), _styles.shadowSharedStyle, _styles.dateSharedStyle, _styles.textColorStyles, _styles.backgroundColorStyles, _styles.tasksAndDecisionsStyles, _styles.smartCardSharedStyles, (0, _constants.fontFamily)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), "var(--ds-background-neutral, ".concat(colors.N30A, ")"), "var(--ds-border-radius-100, 3px)", "var(--ds-text, ".concat(colors.N800, ")"), "var(--ds-space-025, 2px)", "var(--ds-space-050, 4px)", "var(--ds-background-danger, ".concat(colors.R50, ")"), "var(--ds-text-danger, ".concat(colors.R500, ")"), "var(--ds-space-300, 24px)", _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, "var(--ds-space-100, 8px)", alignedHeadingAnchorStyle(wrapperProps), _styles.mediaSingleSharedStyle, _consts.RendererCssClassName.DOCUMENT, breakoutWidthStyle(), _consts.RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER, _consts.RendererCssClassName.EXTENSION, _consts.RendererCssClassName.DOCUMENT, _consts.RendererCssClassName.EXTENSION, _editorSharedStyles.blockNodesVerticalMargin, _consts.RendererCssClassName.EXTENSION_CENTER_ALIGN, _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, _ui.shadowObserverClassNames.SHADOW_CONTAINER, _styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, (0, _styles.tableSharedStyle)(), _consts.RendererCssClassName.DOCUMENT, _styles.TableSharedCssClassName.TABLE_CONTAINER, _ui.shadowClassNames.RIGHT_SHADOW, _ui.shadowClassNames.LEFT_SHADOW, _styles.tableMarginTop - 1, _styles.tableMarginTop, _editorSharedStyles.akEditorStickyHeaderZIndex, getShadowOverrides(), _ui.shadowObserverClassNames.SENTINEL_LEFT, _ui.shadowObserverClassNames.SENTINEL_RIGHT, _styles.tableMarginTop, tableSortableColumnStyle(wrapperProps), _consts.RendererCssClassName.NUMBER_COLUMN, "var(--ds-background-neutral, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), _editorSharedStyles.akEditorTableNumberColumnWidth, "var(--ds-text-subtlest, ".concat(colors.N200, ")"), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), _consts.RendererCssClassName.NUMBER_COLUMN, _editorSharedStyles.akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), _editorSharedStyles.akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableToolbar, ")"), "var(--ds-border-radius-100, 3px)", _editorSharedStyles.blockNodesVerticalMargin, useGridRenderForCodeBlock(useBlockRenderForCodeBlock), (0, _lightWeightCodeBlock.getLightWeightCodeBlockStylesForRootRendererStyleSheet)(), _styles.columnLayoutSharedStyle, "var(--ds-space-250, 20px)", "var(--ds-space-400, 32px)", _editorSharedStyles.gridMediumMaxWidth, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _editorSharedStyles.blockNodesVerticalMargin, _styles.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _utils.browser.safari ? _styles.codeBlockInListSafariFix : '');
120
120
  };
121
121
  };
122
122
  var useGridRenderForCodeBlock = function useGridRenderForCodeBlock(codeBlockRenderAsBlock) {
@@ -65,8 +65,7 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
65
65
  }
66
66
  return result;
67
67
  }, [documentPosition, generateIndexMatch]);
68
- var applyDraftModeCallback = (0, _react.useCallback)(function () {
69
- var keepNativeSelection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
68
+ var applyDraftModeCallback = (0, _react.useCallback)(function (options) {
70
69
  if (!documentPosition || !isAnnotationAllowed) {
71
70
  if (createAnalyticsEvent) {
72
71
  createAnalyticsEvent({
@@ -77,7 +76,7 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
77
76
  eventType: _analytics.EVENT_TYPE.TRACK
78
77
  }).fire(_analyticsListeners.FabricChannel.editor);
79
78
  }
80
- return;
79
+ return false;
81
80
  }
82
81
  setDraftDocumentPosition(documentPosition);
83
82
  applyAnnotationDraftAt(documentPosition);
@@ -94,7 +93,7 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
94
93
  }).fire(_analyticsListeners.FabricChannel.editor);
95
94
  }
96
95
  window.requestAnimationFrame(function () {
97
- if (keepNativeSelection) {
96
+ if (options.keepNativeSelection) {
98
97
  (0, _draft.updateWindowSelectionAroundDraft)(documentPosition);
99
98
  } else {
100
99
  var sel = window.getSelection();
@@ -103,7 +102,16 @@ var Mounter = exports.Mounter = /*#__PURE__*/_react.default.memo(function (props
103
102
  }
104
103
  }
105
104
  });
106
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, actions, range]);
105
+ var positionToAnnotate = draftDocumentPosition || documentPosition;
106
+ if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
107
+ return false;
108
+ }
109
+ var annotation = {
110
+ annotationId: options.annotationId,
111
+ annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
112
+ };
113
+ return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
114
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range]);
107
115
  var removeDraftModeCallback = (0, _react.useCallback)(function () {
108
116
  clearAnnotationDraft();
109
117
  setDraftDocumentPosition(null);
@@ -74,8 +74,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
74
74
  }
75
75
  return result;
76
76
  }, [documentPosition, generateIndexMatch]);
77
- var applyDraftModeCallback = (0, _react.useCallback)(function () {
78
- var keepNativeSelection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
77
+ var applyDraftModeCallback = (0, _react.useCallback)(function (options) {
79
78
  if (!documentPosition || !isAnnotationAllowed) {
80
79
  if (createAnalyticsEvent) {
81
80
  createAnalyticsEvent({
@@ -86,7 +85,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
86
85
  eventType: _analytics.EVENT_TYPE.TRACK
87
86
  }).fire(_analyticsListeners.FabricChannel.editor);
88
87
  }
89
- return;
88
+ return false;
90
89
  }
91
90
  setDraftDocumentPosition(documentPosition);
92
91
  applyAnnotationDraftAt(documentPosition);
@@ -103,7 +102,7 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
103
102
  }).fire(_analyticsListeners.FabricChannel.editor);
104
103
  }
105
104
  window.requestAnimationFrame(function () {
106
- if (keepNativeSelection) {
105
+ if (options.keepNativeSelection) {
107
106
  (0, _draft.updateWindowSelectionAroundDraft)(documentPosition);
108
107
  } else {
109
108
  var sel = window.getSelection();
@@ -112,7 +111,16 @@ var SelectionInlineCommentMounter = exports.SelectionInlineCommentMounter = /*#_
112
111
  }
113
112
  }
114
113
  });
115
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, actions, range]);
114
+ var positionToAnnotate = draftDocumentPosition || documentPosition;
115
+ if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
116
+ return false;
117
+ }
118
+ var annotation = {
119
+ annotationId: options.annotationId,
120
+ annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
121
+ };
122
+ return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
123
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range]);
116
124
  var removeDraftModeCallback = (0, _react.useCallback)(function () {
117
125
  clearAnnotationDraft();
118
126
  setDraftDocumentPosition(null);
@@ -0,0 +1,48 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useMemo } from 'react';
3
+ import { getDarkModeLCHColor } from '@atlaskit/adf-schema';
4
+ import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
5
+ import { useThemeObserver } from '@atlaskit/tokens';
6
+ export default function BackgroundColor(props) {
7
+ const {
8
+ colorMode
9
+ } = useThemeObserver();
10
+ let paletteColorValue;
11
+
12
+ /**
13
+ * Documents can contain custom colors when content has been migrated from the old editor, or created via APIs.
14
+ *
15
+ * This behaviour predates the introduction of dark mode.
16
+ *
17
+ * Without the inversion logic below, text with custom colors, can be hard to read when the user loads the page in dark mode.
18
+ *
19
+ * This introduces inversion of the presentation of the custom text background colors when the user is in dark mode.
20
+ *
21
+ * This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
22
+ * how we detect text background colors copied from external editor sources. Where we load the background color from a
23
+ * separate attribute (data-background-custom-color), instead of the inline style.
24
+ *
25
+ * See the following document for more details on this behaviour
26
+ * https://hello.atlassian.net/wiki/spaces/CCECO/pages/2908658046/Unsupported+custom+text+colors+in+dark+theme+Editor+Job+Story
27
+ */
28
+ const tokenColor = hexToEditorTextBackgroundPaletteColor(props.color);
29
+ if (tokenColor) {
30
+ paletteColorValue = tokenColor;
31
+ } else {
32
+ if (colorMode === 'dark') {
33
+ // if we have a custom color, we need to check if we are in dark mode
34
+ paletteColorValue = getDarkModeLCHColor(props.color);
35
+ } else {
36
+ // if we are in light mode, we can just set the color
37
+ paletteColorValue = props.color;
38
+ }
39
+ }
40
+ const style = useMemo(() => ({
41
+ ['--custom-palette-color']: paletteColorValue
42
+ }), [paletteColorValue]);
43
+ return /*#__PURE__*/React.createElement("span", _extends({}, props.dataAttributes, {
44
+ "data-background-custom-color": props.color,
45
+ className: "fabric-background-color-mark",
46
+ style: style
47
+ }), props.children);
48
+ }
@@ -5,6 +5,7 @@ import Strike from './strike';
5
5
  import Strong from './strong';
6
6
  import Subsup from './subsup';
7
7
  import TextColor from './textColor';
8
+ import BackgroundColor from './backgroundColor';
8
9
  import Underline from './underline';
9
10
  import Breakout from './breakout';
10
11
  import Alignment from './alignment';
@@ -26,6 +27,7 @@ export const markToReact = {
26
27
  strong: Strong,
27
28
  subsup: Subsup,
28
29
  textColor: TextColor,
30
+ backgroundColor: BackgroundColor,
29
31
  underline: Underline,
30
32
  annotation: Annotation,
31
33
  border: Border,
@@ -42,4 +44,4 @@ export const markToReact = {
42
44
  export const toReact = mark => {
43
45
  return markToReact[mark.type.name];
44
46
  };
45
- export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
47
+ export { Code, Em, Link, Strike, Strong, Subsup, TextColor, BackgroundColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
@@ -4,7 +4,7 @@ import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from
4
4
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
5
5
  import { isTableResizingEnabled } from '../table';
6
6
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
-
7
+ import { useFeatureFlags } from '../../../use-feature-flags';
8
8
  // we allow scaling down column widths by no more than 30%
9
9
  // this intends to reduce unwanted scrolling in the Renderer in these scenarios:
10
10
  // User A creates a table with column widths → User B views it on a smaller screen
@@ -45,7 +45,8 @@ const renderScaleDownColgroup = props => {
45
45
  tableNode,
46
46
  rendererAppearance,
47
47
  isInsideOfBlockNode,
48
- isinsideMultiBodiedExtension
48
+ isinsideMultiBodiedExtension,
49
+ isTableScalingEnabled
49
50
  } = props;
50
51
  if (!columnWidths) {
51
52
  return [];
@@ -63,6 +64,30 @@ const renderScaleDownColgroup = props => {
63
64
  } else if (!tableResized) {
64
65
  return null;
65
66
  }
67
+
68
+ // when table resized and number column is enabled, we need to scale down the table in render
69
+ if (getBooleanFF('platform.editor.scale-table-when-number-column-in-table-resized_y4qh2') && isTableScalingEnabled && isNumberColumnEnabled && tableResized) {
70
+ const scalePercentage = +((tableContainerWidth - akEditorTableNumberColumnWidth) / tableContainerWidth).toFixed(2);
71
+ const targetMaxWidth = tableContainerWidth - akEditorTableNumberColumnWidth;
72
+ let totalWidthAfterScale = 0;
73
+ const newScaledTargetWidths = columnWidths.map(width => {
74
+ const newWidth = Math.floor(width * scalePercentage);
75
+ totalWidthAfterScale += newWidth;
76
+ return newWidth;
77
+ });
78
+ const diff = targetMaxWidth - totalWidthAfterScale;
79
+ targetWidths = newScaledTargetWidths;
80
+ if (diff > 0 || diff < 0 && Math.abs(diff) < tableCellMinWidth) {
81
+ let updated = false;
82
+ targetWidths = targetWidths.map(width => {
83
+ if (!updated && width + diff > tableCellMinWidth) {
84
+ updated = true;
85
+ width += diff;
86
+ }
87
+ return width;
88
+ });
89
+ }
90
+ }
66
91
  targetWidths = targetWidths || columnWidths;
67
92
 
68
93
  // @see ED-6056
@@ -110,10 +135,14 @@ export const Colgroup = props => {
110
135
  columnWidths,
111
136
  isNumberColumnEnabled
112
137
  } = props;
138
+ const flags = useFeatureFlags();
113
139
  if (!columnWidths) {
114
140
  return null;
115
141
  }
116
- const colStyles = renderScaleDownColgroup(props);
142
+ const colStyles = renderScaleDownColgroup({
143
+ ...props,
144
+ isTableScalingEnabled: !!(flags && 'tablePreserveWidth' in flags && flags.tablePreserveWidth)
145
+ });
117
146
  if (!colStyles) {
118
147
  return null;
119
148
  }
@@ -37,7 +37,7 @@ import { nodeToReact } from '../../react/nodes';
37
37
  export const NORMAL_SEVERITY_THRESHOLD = 2000;
38
38
  export const DEGRADED_SEVERITY_THRESHOLD = 3000;
39
39
  const packageName = "@atlaskit/renderer";
40
- const packageVersion = "109.25.5";
40
+ const packageVersion = "109.27.0";
41
41
  export const defaultNodeComponents = nodeToReact;
42
42
  export class Renderer extends PureComponent {
43
43
  constructor(props) {
@@ -118,7 +118,9 @@ css`
118
118
  > button {
119
119
  opacity: 0;
120
120
  transform: translate(-8px, 0px);
121
- transition: opacity 0.2s ease 0s, transform 0.2s ease 0s;
121
+ transition:
122
+ opacity 0.2s ease 0s,
123
+ transform 0.2s ease 0s;
122
124
  }
123
125
  }
124
126
 
@@ -682,7 +684,8 @@ export const rendererStyles = wrapperProps => theme => {
682
684
  bug for FF causing box-shadow bug in Chrome */
683
685
  .sticky th,
684
686
  .sticky td {
685
- box-shadow: 0px 1px
687
+ box-shadow:
688
+ 0px 1px
686
689
  ${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`},
687
690
  0px -0.5px ${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`},
688
691
  inset -1px 0px ${`var(--ds-background-accent-gray-subtler, ${akEditorTableToolbar})`},
@@ -53,7 +53,7 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
53
53
  }
54
54
  return result;
55
55
  }, [documentPosition, generateIndexMatch]);
56
- const applyDraftModeCallback = useCallback((keepNativeSelection = true) => {
56
+ const applyDraftModeCallback = useCallback(options => {
57
57
  if (!documentPosition || !isAnnotationAllowed) {
58
58
  if (createAnalyticsEvent) {
59
59
  createAnalyticsEvent({
@@ -64,7 +64,7 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
64
64
  eventType: EVENT_TYPE.TRACK
65
65
  }).fire(FabricChannel.editor);
66
66
  }
67
- return;
67
+ return false;
68
68
  }
69
69
  setDraftDocumentPosition(documentPosition);
70
70
  applyAnnotationDraftAt(documentPosition);
@@ -81,7 +81,7 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
81
81
  }).fire(FabricChannel.editor);
82
82
  }
83
83
  window.requestAnimationFrame(() => {
84
- if (keepNativeSelection) {
84
+ if (options.keepNativeSelection) {
85
85
  updateWindowSelectionAroundDraft(documentPosition);
86
86
  } else {
87
87
  const sel = window.getSelection();
@@ -90,7 +90,16 @@ export const Mounter = /*#__PURE__*/React.memo(props => {
90
90
  }
91
91
  }
92
92
  });
93
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, actions, range]);
93
+ const positionToAnnotate = draftDocumentPosition || documentPosition;
94
+ if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
95
+ return false;
96
+ }
97
+ const annotation = {
98
+ annotationId: options.annotationId,
99
+ annotationType: AnnotationTypes.INLINE_COMMENT
100
+ };
101
+ return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
102
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range]);
94
103
  const removeDraftModeCallback = useCallback(() => {
95
104
  clearAnnotationDraft();
96
105
  setDraftDocumentPosition(null);
@@ -62,7 +62,7 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
62
62
  }
63
63
  return result;
64
64
  }, [documentPosition, generateIndexMatch]);
65
- const applyDraftModeCallback = useCallback((keepNativeSelection = true) => {
65
+ const applyDraftModeCallback = useCallback(options => {
66
66
  if (!documentPosition || !isAnnotationAllowed) {
67
67
  if (createAnalyticsEvent) {
68
68
  createAnalyticsEvent({
@@ -73,7 +73,7 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
73
73
  eventType: EVENT_TYPE.TRACK
74
74
  }).fire(FabricChannel.editor);
75
75
  }
76
- return;
76
+ return false;
77
77
  }
78
78
  setDraftDocumentPosition(documentPosition);
79
79
  applyAnnotationDraftAt(documentPosition);
@@ -90,7 +90,7 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
90
90
  }).fire(FabricChannel.editor);
91
91
  }
92
92
  window.requestAnimationFrame(() => {
93
- if (keepNativeSelection) {
93
+ if (options.keepNativeSelection) {
94
94
  updateWindowSelectionAroundDraft(documentPosition);
95
95
  } else {
96
96
  const sel = window.getSelection();
@@ -99,7 +99,16 @@ export const SelectionInlineCommentMounter = /*#__PURE__*/React.memo(props => {
99
99
  }
100
100
  }
101
101
  });
102
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, actions, range]);
102
+ const positionToAnnotate = draftDocumentPosition || documentPosition;
103
+ if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
104
+ return false;
105
+ }
106
+ const annotation = {
107
+ annotationId: options.annotationId,
108
+ annotationType: AnnotationTypes.INLINE_COMMENT
109
+ };
110
+ return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
111
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range]);
103
112
  const removeDraftModeCallback = useCallback(() => {
104
113
  clearAnnotationDraft();
105
114
  setDraftDocumentPosition(null);
@@ -0,0 +1,48 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import React, { useMemo } from 'react';
4
+ import { getDarkModeLCHColor } from '@atlaskit/adf-schema';
5
+ import { hexToEditorTextBackgroundPaletteColor } from '@atlaskit/editor-palette';
6
+ import { useThemeObserver } from '@atlaskit/tokens';
7
+ export default function BackgroundColor(props) {
8
+ var _useThemeObserver = useThemeObserver(),
9
+ colorMode = _useThemeObserver.colorMode;
10
+ var paletteColorValue;
11
+
12
+ /**
13
+ * Documents can contain custom colors when content has been migrated from the old editor, or created via APIs.
14
+ *
15
+ * This behaviour predates the introduction of dark mode.
16
+ *
17
+ * Without the inversion logic below, text with custom colors, can be hard to read when the user loads the page in dark mode.
18
+ *
19
+ * This introduces inversion of the presentation of the custom text background colors when the user is in dark mode.
20
+ *
21
+ * This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
22
+ * how we detect text background colors copied from external editor sources. Where we load the background color from a
23
+ * separate attribute (data-background-custom-color), instead of the inline style.
24
+ *
25
+ * See the following document for more details on this behaviour
26
+ * https://hello.atlassian.net/wiki/spaces/CCECO/pages/2908658046/Unsupported+custom+text+colors+in+dark+theme+Editor+Job+Story
27
+ */
28
+ var tokenColor = hexToEditorTextBackgroundPaletteColor(props.color);
29
+ if (tokenColor) {
30
+ paletteColorValue = tokenColor;
31
+ } else {
32
+ if (colorMode === 'dark') {
33
+ // if we have a custom color, we need to check if we are in dark mode
34
+ paletteColorValue = getDarkModeLCHColor(props.color);
35
+ } else {
36
+ // if we are in light mode, we can just set the color
37
+ paletteColorValue = props.color;
38
+ }
39
+ }
40
+ var style = useMemo(function () {
41
+ return _defineProperty({}, '--custom-palette-color', paletteColorValue);
42
+ }, [paletteColorValue]);
43
+ return /*#__PURE__*/React.createElement("span", _extends({}, props.dataAttributes, {
44
+ "data-background-custom-color": props.color,
45
+ className: "fabric-background-color-mark",
46
+ style: style
47
+ }), props.children);
48
+ }
@@ -5,6 +5,7 @@ import Strike from './strike';
5
5
  import Strong from './strong';
6
6
  import Subsup from './subsup';
7
7
  import TextColor from './textColor';
8
+ import BackgroundColor from './backgroundColor';
8
9
  import Underline from './underline';
9
10
  import Breakout from './breakout';
10
11
  import Alignment from './alignment';
@@ -26,6 +27,7 @@ export var markToReact = {
26
27
  strong: Strong,
27
28
  subsup: Subsup,
28
29
  textColor: TextColor,
30
+ backgroundColor: BackgroundColor,
29
31
  underline: Underline,
30
32
  annotation: Annotation,
31
33
  border: Border,
@@ -42,4 +44,4 @@ export var markToReact = {
42
44
  export var toReact = function toReact(mark) {
43
45
  return markToReact[mark.type.name];
44
46
  };
45
- export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
47
+ export { Code, Em, Link, Strike, Strong, Subsup, TextColor, BackgroundColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
@@ -1,10 +1,13 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ 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; }
3
+ 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) { _defineProperty(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; }
1
4
  import React from 'react';
2
5
  import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
3
6
  import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
4
7
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
5
8
  import { isTableResizingEnabled } from '../table';
6
9
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
-
10
+ import { useFeatureFlags } from '../../../use-feature-flags';
8
11
  // we allow scaling down column widths by no more than 30%
9
12
  // this intends to reduce unwanted scrolling in the Renderer in these scenarios:
10
13
  // User A creates a table with column widths → User B views it on a smaller screen
@@ -45,7 +48,8 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
45
48
  tableNode = props.tableNode,
46
49
  rendererAppearance = props.rendererAppearance,
47
50
  isInsideOfBlockNode = props.isInsideOfBlockNode,
48
- isinsideMultiBodiedExtension = props.isinsideMultiBodiedExtension;
51
+ isinsideMultiBodiedExtension = props.isinsideMultiBodiedExtension,
52
+ isTableScalingEnabled = props.isTableScalingEnabled;
49
53
  if (!columnWidths) {
50
54
  return [];
51
55
  }
@@ -62,6 +66,30 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
62
66
  } else if (!tableResized) {
63
67
  return null;
64
68
  }
69
+
70
+ // when table resized and number column is enabled, we need to scale down the table in render
71
+ if (getBooleanFF('platform.editor.scale-table-when-number-column-in-table-resized_y4qh2') && isTableScalingEnabled && isNumberColumnEnabled && tableResized) {
72
+ var scalePercentage = +((tableContainerWidth - akEditorTableNumberColumnWidth) / tableContainerWidth).toFixed(2);
73
+ var targetMaxWidth = tableContainerWidth - akEditorTableNumberColumnWidth;
74
+ var totalWidthAfterScale = 0;
75
+ var newScaledTargetWidths = columnWidths.map(function (width) {
76
+ var newWidth = Math.floor(width * scalePercentage);
77
+ totalWidthAfterScale += newWidth;
78
+ return newWidth;
79
+ });
80
+ var diff = targetMaxWidth - totalWidthAfterScale;
81
+ targetWidths = newScaledTargetWidths;
82
+ if (diff > 0 || diff < 0 && Math.abs(diff) < tableCellMinWidth) {
83
+ var updated = false;
84
+ targetWidths = targetWidths.map(function (width) {
85
+ if (!updated && width + diff > tableCellMinWidth) {
86
+ updated = true;
87
+ width += diff;
88
+ }
89
+ return width;
90
+ });
91
+ }
92
+ }
65
93
  targetWidths = targetWidths || columnWidths;
66
94
 
67
95
  // @see ED-6056
@@ -107,10 +135,13 @@ var renderScaleDownColgroup = function renderScaleDownColgroup(props) {
107
135
  export var Colgroup = function Colgroup(props) {
108
136
  var columnWidths = props.columnWidths,
109
137
  isNumberColumnEnabled = props.isNumberColumnEnabled;
138
+ var flags = useFeatureFlags();
110
139
  if (!columnWidths) {
111
140
  return null;
112
141
  }
113
- var colStyles = renderScaleDownColgroup(props);
142
+ var colStyles = renderScaleDownColgroup(_objectSpread(_objectSpread({}, props), {}, {
143
+ isTableScalingEnabled: !!(flags && 'tablePreserveWidth' in flags && flags.tablePreserveWidth)
144
+ }));
114
145
  if (!colStyles) {
115
146
  return null;
116
147
  }
@@ -47,7 +47,7 @@ import { nodeToReact } from '../../react/nodes';
47
47
  export var NORMAL_SEVERITY_THRESHOLD = 2000;
48
48
  export var DEGRADED_SEVERITY_THRESHOLD = 3000;
49
49
  var packageName = "@atlaskit/renderer";
50
- var packageVersion = "109.25.5";
50
+ var packageVersion = "109.27.0";
51
51
  export var defaultNodeComponents = nodeToReact;
52
52
  export var Renderer = /*#__PURE__*/function (_PureComponent) {
53
53
  _inherits(Renderer, _PureComponent);
@@ -54,7 +54,7 @@ export var headingSizes = {
54
54
  };
55
55
  var headingAnchorStyle = function headingAnchorStyle(headingTag) {
56
56
  return (// TODO Delete this comment after verifying space token -> previous value `margin-left: 6px`
57
- css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n /**\n * The copy link button doesn't reserve space in the DOM so that\n * the text alignment isn't impacted by the button/icon's space.\n */\n .", " {\n position: absolute;\n height: ", "em;\n\n margin-left: ", ";\n\n button {\n padding-left: 0;\n padding-right: 0;\n }\n }\n\n /**\n * Applies hover effects to the heading anchor link button\n * to fade in when the user rolls over the heading.\n *\n * The link is persistent on mobile, so we use feature detection\n * to enable hover effects for systems that support it (desktop).\n *\n * @see https://caniuse.com/mdn-css_at-rules_media_hover\n */\n @media (hover: hover) and (pointer: fine) {\n .", " {\n > button {\n opacity: 0;\n transform: translate(-8px, 0px);\n transition: opacity 0.2s ease 0s, transform 0.2s ease 0s;\n }\n }\n\n &:hover {\n .", " > button {\n opacity: 1;\n transform: none !important;\n }\n }\n }\n\n /**\n * Adds the visibility of the button when in focus through keyboard navigation.\n */\n .", " {\n button:focus {\n opacity: 1;\n transform: none !important;\n }\n }\n "])), HeadingAnchorWrapperClassName, headingSizes[headingTag].lineHeight, "var(--ds-space-075, 6px)", HeadingAnchorWrapperClassName, HeadingAnchorWrapperClassName, HeadingAnchorWrapperClassName)
57
+ css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n /**\n * The copy link button doesn't reserve space in the DOM so that\n * the text alignment isn't impacted by the button/icon's space.\n */\n .", " {\n position: absolute;\n height: ", "em;\n\n margin-left: ", ";\n\n button {\n padding-left: 0;\n padding-right: 0;\n }\n }\n\n /**\n * Applies hover effects to the heading anchor link button\n * to fade in when the user rolls over the heading.\n *\n * The link is persistent on mobile, so we use feature detection\n * to enable hover effects for systems that support it (desktop).\n *\n * @see https://caniuse.com/mdn-css_at-rules_media_hover\n */\n @media (hover: hover) and (pointer: fine) {\n .", " {\n > button {\n opacity: 0;\n transform: translate(-8px, 0px);\n transition:\n opacity 0.2s ease 0s,\n transform 0.2s ease 0s;\n }\n }\n\n &:hover {\n .", " > button {\n opacity: 1;\n transform: none !important;\n }\n }\n }\n\n /**\n * Adds the visibility of the button when in focus through keyboard navigation.\n */\n .", " {\n button:focus {\n opacity: 1;\n transform: none !important;\n }\n }\n "])), HeadingAnchorWrapperClassName, headingSizes[headingTag].lineHeight, "var(--ds-space-075, 6px)", HeadingAnchorWrapperClassName, HeadingAnchorWrapperClassName, HeadingAnchorWrapperClassName)
58
58
  );
59
59
  };
60
60
  var alignedHeadingAnchorStyle = function alignedHeadingAnchorStyle(_ref) {
@@ -107,7 +107,7 @@ export var rendererStyles = function rendererStyles(wrapperProps) {
107
107
  var useBlockRenderForCodeBlock = wrapperProps.useBlockRenderForCodeBlock;
108
108
 
109
109
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression
110
- return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\n\n ", "\n ", "\n\n .", " {\n ", "\n }\n\n & h1 {\n ", "\n }\n\n & h2 {\n ", "\n }\n\n & h3 {\n ", "\n }\n\n & h4 {\n ", "\n }\n\n & h5 {\n ", "\n }\n\n & h6 {\n ", "\n }\n\n & span.akActionMark {\n color: ", ";\n text-decoration: none;\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:active {\n color: ", ";\n }\n }\n\n & span.akActionMark {\n cursor: pointer;\n }\n\n & span[data-placeholder] {\n color: ", ";\n }\n\n ", "\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", "\n\n & .UnknownBlock {\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n & span.date-node {\n background: ", ";\n border-radius: ", ";\n color: ", ";\n padding: ", " ", ";\n margin: 0 1px;\n transition: background 0.3s;\n }\n\n & span.date-node-highlighted {\n background: ", ";\n color: ", ";\n }\n\n & .renderer-image {\n max-width: 100%;\n display: block;\n margin: ", " 0;\n }\n\n .", ".rich-media-wrapped\n + .", ":not(.rich-media-wrapped) {\n clear: both;\n }\n\n & .code-block,\n & blockquote,\n & hr,\n & > div > div:not(.rich-media-wrapped),\n .", ".rich-media-wrapped\n + .rich-media-wrapped\n + *:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n .", ".image-align-start,\n .", ".image-center,\n .", ".image-align-end {\n clear: both;\n }\n\n & .rich-media-wrapped {\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n margin-top: ", ";\n }\n }\n\n ", "\n /* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n margin-left: 0;\n margin-right: 0;\n }\n\n /* Breakout for tables and extensions */\n .", " > {\n ", "\n\n * .", " {\n overflow-x: auto;\n }\n\n & .", ":first-child {\n margin-top: 0;\n }\n }\n\n .", " {\n .", " {\n margin-top: ", ";\n }\n\n .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .", " {\n overflow-x: auto;\n }\n\n .", "\n .", " {\n display: flex;\n }\n }\n\n ", "\n\n .", " .", " {\n z-index: 0;\n transition: all 0.1s linear;\n display: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n /** Shadow overrides */\n &.", "::after,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n ", "\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\n }\n\n /**\n * A hack for making all the <th /> heights equal in case some have shorter\n * content than others.\n *\n * This is done to make sort buttons fill entire <th />.\n */\n table {\n height: 1px; /* will be ignored */\n ", ";\n margin-left: 0;\n margin-right: 0;\n }\n\n table tr:first-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\n width: ", "px;\n text-align: center;\n color: ", ";\n font-size: ", ";\n }\n\n .fixed .", " {\n border-right: 0px none;\n }\n }\n }\n\n tr[data-header-row].fixed {\n position: fixed !important;\n display: flex;\n overflow: hidden;\n z-index: ", ";\n\n border-right: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n\n /* this is to compensate for the table border */\n transform: translateX(-1px);\n }\n\n .sticky > th {\n z-index: ", ";\n position: sticky !important;\n top: 0;\n }\n\n /* Make the number column header sticky */\n .sticky > td {\n position: sticky !important;\n top: 0;\n }\n\n /* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n .sticky th,\n .sticky td {\n box-shadow: 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 0px -1px ", ";\n }\n\n /* this will remove jumpiness caused in Chrome for sticky headers */\n .fixed + tr {\n min-height: 0px;\n }\n\n /*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n & .code-block {\n max-width: 100%;\n /* -ms- properties are necessary until MS supports the latest version of the grid spec */\n /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n display: block;\n /* stylelint-enable */\n\n position: relative;\n border-radius: ", ";\n\n /*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n word-wrap: normal;\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n\n ", "\n\n ", "\n\n ", ";\n & [data-layout-section] {\n margin-top: ", ";\n & > div + div {\n margin-left: ", ";\n }\n\n @media screen and (max-width: ", "px) {\n & > div + div {\n margin-left: 0;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n }\n\n & li {\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n &:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n ", "\n }\n "])), editorFontSize(themeProps), "var(--ds-text, ".concat(colors.N800, ")"), RendererCssClassName.DOCUMENT, fullPageStyles(wrapperProps, themeProps), fullWidthStyles(wrapperProps), RendererCssClassName.DOCUMENT, mediaInlineImageStyles, headingAnchorStyle('h1'), headingAnchorStyle('h2'), headingAnchorStyle('h3'), headingAnchorStyle('h4'), headingAnchorStyle('h5'), headingAnchorStyle('h6'), "var(--ds-link, ".concat(colors.B400, ")"), "var(--ds-link, ".concat(colors.B300, ")"), "var(--ds-link-pressed, ".concat(colors.B500, ")"), "var(--ds-text-subtlest, ".concat(colors.N200, ")"), telepointerStyles(), whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles(), ruleSharedStyles(), paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, codeMarkSharedStyles(), shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, tasksAndDecisionsStyles, smartCardSharedStyles, fontFamily(), relativeFontSizeToBase16(fontSize()), "var(--ds-background-neutral, ".concat(colors.N30A, ")"), "var(--ds-border-radius-100, 3px)", "var(--ds-text, ".concat(colors.N800, ")"), "var(--ds-space-025, 2px)", "var(--ds-space-050, 4px)", "var(--ds-background-danger, ".concat(colors.R50, ")"), "var(--ds-text-danger, ".concat(colors.R500, ")"), "var(--ds-space-300, 24px)", richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, "var(--ds-space-100, 8px)", alignedHeadingAnchorStyle(wrapperProps), mediaSingleSharedStyle, RendererCssClassName.DOCUMENT, breakoutWidthStyle(), RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER, RendererCssClassName.EXTENSION, RendererCssClassName.DOCUMENT, RendererCssClassName.EXTENSION, blockNodesVerticalMargin, RendererCssClassName.EXTENSION_CENTER_ALIGN, TableSharedCssClassName.TABLE_NODE_WRAPPER, shadowObserverClassNames.SHADOW_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, tableSharedStyle(), RendererCssClassName.DOCUMENT, TableSharedCssClassName.TABLE_CONTAINER, shadowClassNames.RIGHT_SHADOW, shadowClassNames.LEFT_SHADOW, tableMarginTop - 1, tableMarginTop, akEditorStickyHeaderZIndex, getShadowOverrides(), shadowObserverClassNames.SENTINEL_LEFT, shadowObserverClassNames.SENTINEL_RIGHT, tableMarginTop, tableSortableColumnStyle(wrapperProps), RendererCssClassName.NUMBER_COLUMN, "var(--ds-background-neutral, ".concat(akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), akEditorTableNumberColumnWidth, "var(--ds-text-subtlest, ".concat(colors.N200, ")"), relativeFontSizeToBase16(fontSize()), RendererCssClassName.NUMBER_COLUMN, akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableToolbar, ")"), "var(--ds-border-radius-100, 3px)", blockNodesVerticalMargin, useGridRenderForCodeBlock(useBlockRenderForCodeBlock), getLightWeightCodeBlockStylesForRootRendererStyleSheet(), columnLayoutSharedStyle, "var(--ds-space-250, 20px)", "var(--ds-space-400, 32px)", gridMediumMaxWidth, blockNodesVerticalMargin, blockNodesVerticalMargin, blockNodesVerticalMargin, SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, browser.safari ? codeBlockInListSafariFix : '');
110
+ return css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n font-size: ", "px;\n line-height: 1.5rem;\n color: ", ";\n\n .", "::after {\n // we add a clearfix after ak-renderer-document in order to\n // contain internal floats (such as media images that are \"wrap-left\")\n // to just the renderer (and not spill outside of it)\n content: '';\n visibility: hidden;\n display: block;\n height: 0;\n clear: both;\n }\n\n ", "\n ", "\n\n .", " {\n ", "\n }\n\n & h1 {\n ", "\n }\n\n & h2 {\n ", "\n }\n\n & h3 {\n ", "\n }\n\n & h4 {\n ", "\n }\n\n & h5 {\n ", "\n }\n\n & h6 {\n ", "\n }\n\n & span.akActionMark {\n color: ", ";\n text-decoration: none;\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:active {\n color: ", ";\n }\n }\n\n & span.akActionMark {\n cursor: pointer;\n }\n\n & span[data-placeholder] {\n color: ", ";\n }\n\n ", "\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", ";\n ", "\n\n & .UnknownBlock {\n font-family: ", ";\n font-size: ", ";\n font-weight: 400;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n\n & span.date-node {\n background: ", ";\n border-radius: ", ";\n color: ", ";\n padding: ", " ", ";\n margin: 0 1px;\n transition: background 0.3s;\n }\n\n & span.date-node-highlighted {\n background: ", ";\n color: ", ";\n }\n\n & .renderer-image {\n max-width: 100%;\n display: block;\n margin: ", " 0;\n }\n\n .", ".rich-media-wrapped\n + .", ":not(.rich-media-wrapped) {\n clear: both;\n }\n\n & .code-block,\n & blockquote,\n & hr,\n & > div > div:not(.rich-media-wrapped),\n .", ".rich-media-wrapped\n + .rich-media-wrapped\n + *:not(.rich-media-wrapped),\n .", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n .", ".image-align-start,\n .", ".image-center,\n .", ".image-align-end {\n clear: both;\n }\n\n & .rich-media-wrapped {\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n margin-top: ", ";\n }\n }\n\n ", "\n /* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n margin-left: 0;\n margin-right: 0;\n }\n\n /* Breakout for tables and extensions */\n .", " > {\n ", "\n\n * .", " {\n overflow-x: auto;\n }\n\n & .", ":first-child {\n margin-top: 0;\n }\n }\n\n .", " {\n .", " {\n margin-top: ", ";\n }\n\n .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n .", " {\n overflow-x: auto;\n }\n\n .", "\n .", " {\n display: flex;\n }\n }\n\n ", "\n\n .", " .", " {\n z-index: 0;\n transition: all 0.1s linear;\n display: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n /** Shadow overrides */\n &.", "::after,\n &.", "::before {\n top: ", "px;\n height: calc(100% - ", "px);\n z-index: ", ";\n }\n\n ", "\n\n &\n .", ",\n &\n .", " {\n height: calc(100% - ", "px);\n }\n\n /**\n * A hack for making all the <th /> heights equal in case some have shorter\n * content than others.\n *\n * This is done to make sort buttons fill entire <th />.\n */\n table {\n height: 1px; /* will be ignored */\n ", ";\n margin-left: 0;\n margin-right: 0;\n }\n\n table tr:first-of-type {\n height: 100%;\n\n td,\n th {\n position: relative;\n }\n }\n\n table[data-number-column='true'] {\n .", " {\n background-color: ", ";\n border-right: 1px solid\n ", ";\n width: ", "px;\n text-align: center;\n color: ", ";\n font-size: ", ";\n }\n\n .fixed .", " {\n border-right: 0px none;\n }\n }\n }\n\n tr[data-header-row].fixed {\n position: fixed !important;\n display: flex;\n overflow: hidden;\n z-index: ", ";\n\n border-right: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n\n /* this is to compensate for the table border */\n transform: translateX(-1px);\n }\n\n .sticky > th {\n z-index: ", ";\n position: sticky !important;\n top: 0;\n }\n\n /* Make the number column header sticky */\n .sticky > td {\n position: sticky !important;\n top: 0;\n }\n\n /* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n .sticky th,\n .sticky td {\n box-shadow:\n 0px 1px\n ", ",\n 0px -0.5px ", ",\n inset -1px 0px ", ",\n 0px -1px ", ";\n }\n\n /* this will remove jumpiness caused in Chrome for sticky headers */\n .fixed + tr {\n min-height: 0px;\n }\n\n /*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n & .code-block {\n max-width: 100%;\n /* -ms- properties are necessary until MS supports the latest version of the grid spec */\n /* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n display: block;\n /* stylelint-enable */\n\n position: relative;\n border-radius: ", ";\n\n /*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n word-wrap: normal;\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n\n ", "\n\n ", "\n\n ", ";\n & [data-layout-section] {\n margin-top: ", ";\n & > div + div {\n margin-left: ", ";\n }\n\n @media screen and (max-width: ", "px) {\n & > div + div {\n margin-left: 0;\n }\n }\n\n & .MediaGroup,\n & .code-block {\n margin-top: ", ";\n\n &:first-child {\n margin-top: 0;\n }\n }\n }\n\n & li {\n > .code-block {\n margin: ", " 0 0 0;\n }\n > .code-block:first-child {\n margin-top: 0;\n }\n\n > div:last-of-type.code-block {\n margin-bottom: ", ";\n }\n }\n\n &:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n ", "\n }\n "])), editorFontSize(themeProps), "var(--ds-text, ".concat(colors.N800, ")"), RendererCssClassName.DOCUMENT, fullPageStyles(wrapperProps, themeProps), fullWidthStyles(wrapperProps), RendererCssClassName.DOCUMENT, mediaInlineImageStyles, headingAnchorStyle('h1'), headingAnchorStyle('h2'), headingAnchorStyle('h3'), headingAnchorStyle('h4'), headingAnchorStyle('h5'), headingAnchorStyle('h6'), "var(--ds-link, ".concat(colors.B400, ")"), "var(--ds-link, ".concat(colors.B300, ")"), "var(--ds-link-pressed, ".concat(colors.B500, ")"), "var(--ds-text-subtlest, ".concat(colors.N200, ")"), telepointerStyles(), whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles(), ruleSharedStyles(), paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, codeMarkSharedStyles(), shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, tasksAndDecisionsStyles, smartCardSharedStyles, fontFamily(), relativeFontSizeToBase16(fontSize()), "var(--ds-background-neutral, ".concat(colors.N30A, ")"), "var(--ds-border-radius-100, 3px)", "var(--ds-text, ".concat(colors.N800, ")"), "var(--ds-space-025, 2px)", "var(--ds-space-050, 4px)", "var(--ds-background-danger, ".concat(colors.R50, ")"), "var(--ds-text-danger, ".concat(colors.R500, ")"), "var(--ds-space-300, 24px)", richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, "var(--ds-space-100, 8px)", alignedHeadingAnchorStyle(wrapperProps), mediaSingleSharedStyle, RendererCssClassName.DOCUMENT, breakoutWidthStyle(), RendererCssClassName.EXTENSION_OVERFLOW_CONTAINER, RendererCssClassName.EXTENSION, RendererCssClassName.DOCUMENT, RendererCssClassName.EXTENSION, blockNodesVerticalMargin, RendererCssClassName.EXTENSION_CENTER_ALIGN, TableSharedCssClassName.TABLE_NODE_WRAPPER, shadowObserverClassNames.SHADOW_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, tableSharedStyle(), RendererCssClassName.DOCUMENT, TableSharedCssClassName.TABLE_CONTAINER, shadowClassNames.RIGHT_SHADOW, shadowClassNames.LEFT_SHADOW, tableMarginTop - 1, tableMarginTop, akEditorStickyHeaderZIndex, getShadowOverrides(), shadowObserverClassNames.SENTINEL_LEFT, shadowObserverClassNames.SENTINEL_RIGHT, tableMarginTop, tableSortableColumnStyle(wrapperProps), RendererCssClassName.NUMBER_COLUMN, "var(--ds-background-neutral, ".concat(akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), akEditorTableNumberColumnWidth, "var(--ds-text-subtlest, ".concat(colors.N200, ")"), relativeFontSizeToBase16(fontSize()), RendererCssClassName.NUMBER_COLUMN, akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), akEditorStickyHeaderZIndex, "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableToolbar, ")"), "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableToolbar, ")"), "var(--ds-border-radius-100, 3px)", blockNodesVerticalMargin, useGridRenderForCodeBlock(useBlockRenderForCodeBlock), getLightWeightCodeBlockStylesForRootRendererStyleSheet(), columnLayoutSharedStyle, "var(--ds-space-250, 20px)", "var(--ds-space-400, 32px)", gridMediumMaxWidth, blockNodesVerticalMargin, blockNodesVerticalMargin, blockNodesVerticalMargin, SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, browser.safari ? codeBlockInListSafariFix : '');
111
111
  };
112
112
  };
113
113
  var useGridRenderForCodeBlock = function useGridRenderForCodeBlock(codeBlockRenderAsBlock) {
@@ -55,8 +55,7 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
55
55
  }
56
56
  return result;
57
57
  }, [documentPosition, generateIndexMatch]);
58
- var applyDraftModeCallback = useCallback(function () {
59
- var keepNativeSelection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
58
+ var applyDraftModeCallback = useCallback(function (options) {
60
59
  if (!documentPosition || !isAnnotationAllowed) {
61
60
  if (createAnalyticsEvent) {
62
61
  createAnalyticsEvent({
@@ -67,7 +66,7 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
67
66
  eventType: EVENT_TYPE.TRACK
68
67
  }).fire(FabricChannel.editor);
69
68
  }
70
- return;
69
+ return false;
71
70
  }
72
71
  setDraftDocumentPosition(documentPosition);
73
72
  applyAnnotationDraftAt(documentPosition);
@@ -84,7 +83,7 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
84
83
  }).fire(FabricChannel.editor);
85
84
  }
86
85
  window.requestAnimationFrame(function () {
87
- if (keepNativeSelection) {
86
+ if (options.keepNativeSelection) {
88
87
  updateWindowSelectionAroundDraft(documentPosition);
89
88
  } else {
90
89
  var sel = window.getSelection();
@@ -93,7 +92,16 @@ export var Mounter = /*#__PURE__*/React.memo(function (props) {
93
92
  }
94
93
  }
95
94
  });
96
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, actions, range]);
95
+ var positionToAnnotate = draftDocumentPosition || documentPosition;
96
+ if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
97
+ return false;
98
+ }
99
+ var annotation = {
100
+ annotationId: options.annotationId,
101
+ annotationType: AnnotationTypes.INLINE_COMMENT
102
+ };
103
+ return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
104
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range]);
97
105
  var removeDraftModeCallback = useCallback(function () {
98
106
  clearAnnotationDraft();
99
107
  setDraftDocumentPosition(null);
@@ -64,8 +64,7 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
64
64
  }
65
65
  return result;
66
66
  }, [documentPosition, generateIndexMatch]);
67
- var applyDraftModeCallback = useCallback(function () {
68
- var keepNativeSelection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
67
+ var applyDraftModeCallback = useCallback(function (options) {
69
68
  if (!documentPosition || !isAnnotationAllowed) {
70
69
  if (createAnalyticsEvent) {
71
70
  createAnalyticsEvent({
@@ -76,7 +75,7 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
76
75
  eventType: EVENT_TYPE.TRACK
77
76
  }).fire(FabricChannel.editor);
78
77
  }
79
- return;
78
+ return false;
80
79
  }
81
80
  setDraftDocumentPosition(documentPosition);
82
81
  applyAnnotationDraftAt(documentPosition);
@@ -93,7 +92,7 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
93
92
  }).fire(FabricChannel.editor);
94
93
  }
95
94
  window.requestAnimationFrame(function () {
96
- if (keepNativeSelection) {
95
+ if (options.keepNativeSelection) {
97
96
  updateWindowSelectionAroundDraft(documentPosition);
98
97
  } else {
99
98
  var sel = window.getSelection();
@@ -102,7 +101,16 @@ export var SelectionInlineCommentMounter = /*#__PURE__*/React.memo(function (pro
102
101
  }
103
102
  }
104
103
  });
105
- }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, actions, range]);
104
+ var positionToAnnotate = draftDocumentPosition || documentPosition;
105
+ if (!positionToAnnotate || !applyAnnotation || !options.annotationId) {
106
+ return false;
107
+ }
108
+ var annotation = {
109
+ annotationId: options.annotationId,
110
+ annotationType: AnnotationTypes.INLINE_COMMENT
111
+ };
112
+ return applyAnnotation(positionToAnnotate, annotation, isCommentsOnMediaBugFixEnabled);
113
+ }, [documentPosition, isAnnotationAllowed, applyAnnotationDraftAt, createAnalyticsEvent, applyAnnotation, draftDocumentPosition, isCommentsOnMediaBugFixEnabled, actions, range]);
106
114
  var removeDraftModeCallback = useCallback(function () {
107
115
  clearAnnotationDraft();
108
116
  setDraftDocumentPosition(null);
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { TextColorAttributes } from '@atlaskit/adf-schema';
3
+ import type { MarkProps } from '../types';
4
+ export default function BackgroundColor(props: MarkProps<TextColorAttributes>): JSX.Element;
@@ -7,6 +7,7 @@ import Strike from './strike';
7
7
  import Strong from './strong';
8
8
  import Subsup from './subsup';
9
9
  import TextColor from './textColor';
10
+ import BackgroundColor from './backgroundColor';
10
11
  import Underline from './underline';
11
12
  import Breakout from './breakout';
12
13
  import UnsupportedMark from './unsupportedMark';
@@ -19,4 +20,4 @@ export declare const markToReact: {
19
20
  [key: string]: ComponentType<React.PropsWithChildren<any>>;
20
21
  };
21
22
  export declare const toReact: (mark: Mark) => ComponentType<React.PropsWithChildren<any>>;
22
- export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark, };
23
+ export { Code, Em, Link, Strike, Strong, Subsup, TextColor, BackgroundColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark, };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { TextColorAttributes } from '@atlaskit/adf-schema';
3
+ import type { MarkProps } from '../types';
4
+ export default function BackgroundColor(props: MarkProps<TextColorAttributes>): JSX.Element;
@@ -7,6 +7,7 @@ import Strike from './strike';
7
7
  import Strong from './strong';
8
8
  import Subsup from './subsup';
9
9
  import TextColor from './textColor';
10
+ import BackgroundColor from './backgroundColor';
10
11
  import Underline from './underline';
11
12
  import Breakout from './breakout';
12
13
  import UnsupportedMark from './unsupportedMark';
@@ -19,4 +20,4 @@ export declare const markToReact: {
19
20
  [key: string]: ComponentType<React.PropsWithChildren<any>>;
20
21
  };
21
22
  export declare const toReact: (mark: Mark) => ComponentType<React.PropsWithChildren<any>>;
22
- export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark, };
23
+ export { Code, Em, Link, Strike, Strong, Subsup, TextColor, BackgroundColor, Underline, Breakout, Annotation, Border, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "109.25.5",
3
+ "version": "109.27.0",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,13 +31,13 @@
31
31
  "@atlaskit/analytics-next": "^9.3.0",
32
32
  "@atlaskit/button": "^17.14.0",
33
33
  "@atlaskit/code": "^15.2.0",
34
- "@atlaskit/editor-common": "^79.2.0",
34
+ "@atlaskit/editor-common": "^80.0.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.12.0",
36
36
  "@atlaskit/editor-palette": "1.6.0",
37
37
  "@atlaskit/editor-prosemirror": "4.0.1",
38
- "@atlaskit/editor-shared-styles": "^2.10.0",
38
+ "@atlaskit/editor-shared-styles": "^2.11.0",
39
39
  "@atlaskit/emoji": "^67.6.0",
40
- "@atlaskit/icon": "^22.1.0",
40
+ "@atlaskit/icon": "^22.2.0",
41
41
  "@atlaskit/link-datasource": "^2.1.0",
42
42
  "@atlaskit/media-card": "^77.11.0",
43
43
  "@atlaskit/media-client": "^27.0.0",
@@ -47,12 +47,12 @@
47
47
  "@atlaskit/media-ui": "^25.10.0",
48
48
  "@atlaskit/media-viewer": "^48.5.0",
49
49
  "@atlaskit/platform-feature-flags": "^0.2.0",
50
- "@atlaskit/smart-card": "^26.63.0",
50
+ "@atlaskit/smart-card": "^26.67.0",
51
51
  "@atlaskit/status": "^1.4.0",
52
52
  "@atlaskit/task-decision": "^17.10.0",
53
53
  "@atlaskit/theme": "^12.8.0",
54
- "@atlaskit/tokens": "^1.47.0",
55
- "@atlaskit/tooltip": "^18.3.0",
54
+ "@atlaskit/tokens": "^1.48.0",
55
+ "@atlaskit/tooltip": "^18.4.0",
56
56
  "@babel/runtime": "^7.0.0",
57
57
  "@emotion/react": "^11.7.1",
58
58
  "lodash": "^4.17.21",
@@ -138,6 +138,9 @@
138
138
  "platform.editor.renderer-error-boundary-for-dom-errors": {
139
139
  "type": "boolean"
140
140
  },
141
+ "platform.editor.scale-table-when-number-column-in-table-resized_y4qh2": {
142
+ "type": "boolean"
143
+ },
141
144
  "platform.editor.table.preserve-widths-with-lock-button": {
142
145
  "type": "boolean"
143
146
  }