@atlaskit/renderer 109.31.3 → 109.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/react/index.js +8 -2
  3. package/dist/cjs/react/nodes/date.js +23 -39
  4. package/dist/cjs/react/nodes/emoji.js +41 -41
  5. package/dist/cjs/react/nodes/inlineCard.js +10 -25
  6. package/dist/cjs/react/nodes/mention.js +30 -36
  7. package/dist/cjs/react/nodes/status.js +30 -34
  8. package/dist/cjs/steps/index.js +26 -6
  9. package/dist/cjs/ui/Renderer/index.js +9 -3
  10. package/dist/cjs/ui/Renderer/style.js +18 -1
  11. package/dist/cjs/ui/annotations/element/mark.js +4 -2
  12. package/dist/cjs/ui/annotations/element/useInlineAnnotationProps.js +39 -0
  13. package/dist/es2019/react/index.js +8 -3
  14. package/dist/es2019/react/nodes/date.js +24 -23
  15. package/dist/es2019/react/nodes/emoji.js +35 -15
  16. package/dist/es2019/react/nodes/inlineCard.js +11 -26
  17. package/dist/es2019/react/nodes/mention.js +27 -15
  18. package/dist/es2019/react/nodes/status.js +26 -12
  19. package/dist/es2019/steps/index.js +26 -7
  20. package/dist/es2019/ui/Renderer/index.js +9 -3
  21. package/dist/es2019/ui/Renderer/style.js +21 -1
  22. package/dist/es2019/ui/annotations/element/mark.js +4 -2
  23. package/dist/es2019/ui/annotations/element/useInlineAnnotationProps.js +34 -0
  24. package/dist/esm/react/index.js +8 -2
  25. package/dist/esm/react/nodes/date.js +24 -41
  26. package/dist/esm/react/nodes/emoji.js +40 -39
  27. package/dist/esm/react/nodes/inlineCard.js +11 -26
  28. package/dist/esm/react/nodes/mention.js +31 -38
  29. package/dist/esm/react/nodes/status.js +31 -36
  30. package/dist/esm/steps/index.js +26 -6
  31. package/dist/esm/ui/Renderer/index.js +9 -3
  32. package/dist/esm/ui/Renderer/style.js +19 -1
  33. package/dist/esm/ui/annotations/element/mark.js +4 -2
  34. package/dist/esm/ui/annotations/element/useInlineAnnotationProps.js +33 -0
  35. package/dist/types/react/nodes/date.d.ts +2 -1
  36. package/dist/types/react/nodes/emoji.d.ts +10 -4
  37. package/dist/types/react/nodes/inlineCard.d.ts +4 -2
  38. package/dist/types/react/nodes/mention.d.ts +5 -5
  39. package/dist/types/react/nodes/status.d.ts +5 -5
  40. package/dist/types/steps/index.d.ts +1 -1
  41. package/dist/types/ui/Renderer/style.d.ts +1 -0
  42. package/dist/types/ui/annotations/element/mark.d.ts +4 -4
  43. package/dist/types/ui/annotations/element/useInlineAnnotationProps.d.ts +26 -0
  44. package/dist/types-ts4.5/react/nodes/date.d.ts +2 -1
  45. package/dist/types-ts4.5/react/nodes/emoji.d.ts +10 -4
  46. package/dist/types-ts4.5/react/nodes/inlineCard.d.ts +4 -2
  47. package/dist/types-ts4.5/react/nodes/mention.d.ts +5 -5
  48. package/dist/types-ts4.5/react/nodes/status.d.ts +5 -5
  49. package/dist/types-ts4.5/steps/index.d.ts +1 -1
  50. package/dist/types-ts4.5/ui/Renderer/style.d.ts +1 -0
  51. package/dist/types-ts4.5/ui/annotations/element/mark.d.ts +4 -4
  52. package/dist/types-ts4.5/ui/annotations/element/useInlineAnnotationProps.d.ts +26 -0
  53. package/package.json +9 -9
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.rendererStyles = exports.headingSizes = exports.TELEPOINTER_ID = exports.FullPagePadding = void 0;
9
9
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
10
  var _react = require("@emotion/react");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _constants = require("@atlaskit/theme/constants");
12
13
  var _colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
13
14
  var colors = _colors;
@@ -104,6 +105,22 @@ var breakoutWidthStyle = function breakoutWidthStyle() {
104
105
  var getShadowOverrides = function getShadowOverrides() {
105
106
  return (0, _react.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n\t\t/** Shadow overrides */\n\t\t&.", "::after, &.", "::before {\n\t\t\twidth: ", "px;\n\t\t\tbackground: linear-gradient(\n\t\t\t\t\tto left,\n\t\t\t\t\ttransparent 0,\n\t\t\t\t\t", " 140%\n\t\t\t\t),\n\t\t\t\tlinear-gradient(\n\t\t\t\t\tto right,\n\t\t\t\t\t", " 0px,\n\t\t\t\t\ttransparent 1px\n\t\t\t\t);\n\t\t}\n\n\t\t&.", "::after {\n\t\t\tbackground: linear-gradient(\n\t\t\t\t\tto right,\n\t\t\t\t\ttransparent 0,\n\t\t\t\t\t", " 140%\n\t\t\t\t),\n\t\t\t\tlinear-gradient(\n\t\t\t\t\tto left,\n\t\t\t\t\t", " 0px,\n\t\t\t\t\ttransparent 1px\n\t\t\t\t);\n\t\t\tright: 0px;\n\t\t}\n\t"])), _ui.shadowClassNames.RIGHT_SHADOW, _ui.shadowClassNames.LEFT_SHADOW, tableShadowWidth, "var(--ds-shadow-overflow-spread, ".concat(_colors.N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", _ui.shadowClassNames.RIGHT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(_colors.N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)");
106
107
  };
108
+ function getAnnotationStyles(_ref6) {
109
+ var allowAnnotations = _ref6.allowAnnotations;
110
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes')) {
111
+ return '';
112
+ }
113
+ return (0, _react.css)({
114
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
115
+ "& [data-mark-type='annotation'][data-mark-annotation-state='active'] [data-annotation-mark], & [data-annotation-draft-mark][data-annotation-inline-node]": {
116
+ background: "var(--ds-background-accent-yellow-subtler, ".concat(_colors.Y75, ")"),
117
+ borderBottom: "2px solid ".concat("var(--ds-border-accent-yellow, ".concat(_colors.Y300, ")")),
118
+ boxShadow: "var(--ds-shadow-overlay, ".concat("1px 2px 3px ".concat(_colors.N60A, ", -1px 2px 3px ").concat(_colors.N60A), ")"),
119
+ cursor: 'pointer',
120
+ padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-025, 2px)")
121
+ }
122
+ });
123
+ }
107
124
  var rendererStyles = exports.rendererStyles = function rendererStyles(wrapperProps) {
108
125
  return function (theme) {
109
126
  var _getGlobalTheme = (0, _tokens.getGlobalTheme)(),
@@ -115,7 +132,7 @@ var rendererStyles = exports.rendererStyles = function rendererStyles(wrapperPro
115
132
  var useBlockRenderForCodeBlock = wrapperProps.useBlockRenderForCodeBlock;
116
133
 
117
134
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression
118
- return (0, _react.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n\t\tfont-size: ", "px;\n\t\tline-height: 1.5rem;\n\t\tcolor: ", ";\n\n\t\t.", "::after {\n\t\t\t// we add a clearfix after ak-renderer-document in order to\n\t\t\t// contain internal floats (such as media images that are \"wrap-left\")\n\t\t\t// to just the renderer (and not spill outside of it)\n\t\t\tcontent: '';\n\t\t\tvisibility: hidden;\n\t\t\tdisplay: block;\n\t\t\theight: 0;\n\t\t\tclear: both;\n\t\t}\n\n\t\t", "\n\t\t", "\n\n .", " {\n\t\t\t", "\n\t\t}\n\n\t\t& h1 {\n\t\t\t", "\n\t\t}\n\n\t\t& h2 {\n\t\t\t", "\n\t\t}\n\n\t\t& h3 {\n\t\t\t", "\n\t\t}\n\n\t\t& h4 {\n\t\t\t", "\n\t\t}\n\n\t\t& h5 {\n\t\t\t", "\n\t\t}\n\n\t\t& h6 {\n\t\t\t", "\n\t\t}\n\n\t\t& span.akActionMark {\n\t\t\tcolor: ", ";\n\t\t\ttext-decoration: none;\n\n\t\t\t&:hover {\n\t\t\t\tcolor: ", ";\n\t\t\t\ttext-decoration: underline;\n\t\t\t}\n\n\t\t\t&:active {\n\t\t\t\tcolor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t& span.akActionMark {\n\t\t\tcursor: pointer;\n\t\t}\n\n\t\t& span[data-placeholder] {\n\t\t\tcolor: ", ";\n\t\t}\n\n\t\t", "\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", "\n\n\t\t& .UnknownBlock {\n\t\t\tfont-family: ", ";\n\t\t\tfont-size: ", ";\n\t\t\tfont-weight: 400;\n\t\t\twhite-space: pre-wrap;\n\t\t\tword-wrap: break-word;\n\t\t}\n\n\t\t& span.date-node {\n\t\t\tbackground: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tcolor: ", ";\n\t\t\tpadding: ", " ", ";\n\t\t\tmargin: 0 1px;\n\t\t\ttransition: background 0.3s;\n\t\t}\n\n\t\t& span.date-node-highlighted {\n\t\t\tbackground: ", ";\n\t\t\tcolor: ", ";\n\t\t}\n\n\t\t& .renderer-image {\n\t\t\tmax-width: 100%;\n\t\t\tdisplay: block;\n\t\t\tmargin: ", " 0;\n\t\t}\n\n\t\t.", ".rich-media-wrapped + .", ":not(.rich-media-wrapped) {\n\t\t\tclear: both;\n\t\t}\n\n\t\t& .code-block,\n\t\t& blockquote,\n\t\t& hr,\n\t\t& > div > div:not(.rich-media-wrapped),\n\t\t.", ".rich-media-wrapped + .rich-media-wrapped + *:not(.rich-media-wrapped),\n\t\t.", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n\t\t.", ".image-align-start,\n\t\t\t.", ".image-center,\n\t\t\t.", ".image-align-end {\n\t\t\tclear: both;\n\t\t}\n\n\t\t& .rich-media-wrapped {\n\t\t\t& + h1,\n\t\t\t& + h2,\n\t\t\t& + h3,\n\t\t\t& + h4,\n\t\t\t& + h5,\n\t\t\t& + h6 {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\t\t}\n\n\t\t", "\n\t\t/* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n\t\t\tmargin-left: 0;\n\t\t\tmargin-right: 0;\n\t\t}\n\n\t\t/* Breakout for tables and extensions */\n\t\t.", " > {\n\t\t\t", "\n\n\t\t\t* .", " {\n\t\t\t\toverflow-x: auto;\n\t\t\t}\n\n\t\t\t& .", ":first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t}\n\n\t\t.", " {\n\t\t\t.", " {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\tmargin-left: 50%;\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\toverflow-x: auto;\n\t\t\t}\n\n\t\t\t.", " .", " {\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t.", " .", " {\n\t\t\tz-index: 0;\n\t\t\ttransition: all 0.1s linear;\n\t\t\tdisplay: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n\t\t\t/** Shadow overrides */\n\t\t\t&.", "::after, &.", "::before {\n\t\t\t\ttop: ", "px;\n\t\t\t\theight: calc(100% - ", "px);\n\t\t\t\tz-index: ", ";\n\t\t\t}\n\n\t\t\t", "\n\n\t\t\t&\n .", ",\n &\n .", " {\n\t\t\t\theight: calc(100% - ", "px);\n\t\t\t}\n\n\t\t\t/**\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\t\t\ttable {\n\t\t\t\theight: 1px; /* will be ignored */\n\t\t\t\t", ";\n\t\t\t\tmargin-left: 0;\n\t\t\t\tmargin-right: 0;\n\t\t\t}\n\n\t\t\ttable tr:first-of-type {\n\t\t\t\theight: 100%;\n\n\t\t\t\ttd,\n\t\t\t\tth {\n\t\t\t\t\tposition: relative;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttable[data-number-column='true'] {\n\t\t\t\t.", " {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\tborder-right: 1px solid\n\t\t\t\t\t\t", ";\n\t\t\t\t\twidth: ", "px;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t\tcolor: ", ";\n\t\t\t\t\tfont-size: ", ";\n\t\t\t\t}\n\n\t\t\t\t.fixed .", " {\n\t\t\t\t\tborder-right: 0px none;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttr[data-header-row].fixed {\n\t\t\tposition: fixed !important;\n\t\t\tdisplay: flex;\n\t\t\toverflow: hidden;\n\t\t\tz-index: ", ";\n\n\t\t\tborder-right: 1px solid ", ";\n\t\t\tborder-bottom: 1px solid ", ";\n\n\t\t\t/* this is to compensate for the table border */\n\t\t\ttransform: translateX(-1px);\n\t\t}\n\n\t\t.sticky > th {\n\t\t\tz-index: ", ";\n\t\t\tposition: sticky !important;\n\t\t\ttop: 0;\n\t\t}\n\n\t\t/* Make the number column header sticky */\n\t\t.sticky > td {\n\t\t\tposition: sticky !important;\n\t\t\ttop: 0;\n\t\t}\n\n\t\t/* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n\t\t.sticky th,\n\t\t.sticky td {\n\t\t\tbox-shadow:\n\t\t\t\t0px 1px ", ",\n\t\t\t\t0px -0.5px ", ",\n\t\t\t\tinset -1px 0px ", ",\n\t\t\t\t0px -1px ", ";\n\t\t}\n\n\t\t/* this will remove jumpiness caused in Chrome for sticky headers */\n\t\t.fixed + tr {\n\t\t\tmin-height: 0px;\n\t\t}\n\n\t\t/*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n\t\t& .code-block {\n\t\t\tmax-width: 100%;\n\t\t\t/* -ms- properties are necessary until MS supports the latest version of the grid spec */\n\t\t\t/* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n\t\t\tdisplay: block;\n\t\t\t/* stylelint-enable */\n\n\t\t\tposition: relative;\n\t\t\tborder-radius: ", ";\n\n\t\t\t/*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n\t\t\tword-wrap: normal;\n\t\t}\n\n\t\t& .MediaGroup,\n\t\t& .code-block {\n\t\t\tmargin-top: ", ";\n\n\t\t\t&:first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t", "\n\n ", ";\n\t\t& [data-layout-section] {\n\t\t\tmargin-top: ", ";\n\t\t\t& > div + div {\n\t\t\t\tmargin-left: ", ";\n\t\t\t}\n\n\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t& > div + div {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t& .MediaGroup,\n\t\t\t& .code-block {\n\t\t\t\tmargin-top: ", ";\n\n\t\t\t\t&:first-child {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t& li {\n\t\t\t> .code-block {\n\t\t\t\tmargin: ", " 0 0 0;\n\t\t\t}\n\t\t\t> .code-block:first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\n\t\t\t> div:last-of-type.code-block {\n\t\t\t\tmargin-bottom: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n\t\t\t", "\n\t\t}\n\t"])), (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(colorMode), _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, (0, _styles.backgroundColorStyles)(colorMode), _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 : '');
135
+ return (0, _react.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n\t\tfont-size: ", "px;\n\t\tline-height: 1.5rem;\n\t\tcolor: ", ";\n\n\t\t.", "::after {\n\t\t\t// we add a clearfix after ak-renderer-document in order to\n\t\t\t// contain internal floats (such as media images that are \"wrap-left\")\n\t\t\t// to just the renderer (and not spill outside of it)\n\t\t\tcontent: '';\n\t\t\tvisibility: hidden;\n\t\t\tdisplay: block;\n\t\t\theight: 0;\n\t\t\tclear: both;\n\t\t}\n\n\t\t", "\n\t\t", "\n\n .", " {\n\t\t\t", "\n\t\t}\n\n\t\t& h1 {\n\t\t\t", "\n\t\t}\n\n\t\t& h2 {\n\t\t\t", "\n\t\t}\n\n\t\t& h3 {\n\t\t\t", "\n\t\t}\n\n\t\t& h4 {\n\t\t\t", "\n\t\t}\n\n\t\t& h5 {\n\t\t\t", "\n\t\t}\n\n\t\t& h6 {\n\t\t\t", "\n\t\t}\n\n\t\t& span.akActionMark {\n\t\t\tcolor: ", ";\n\t\t\ttext-decoration: none;\n\n\t\t\t&:hover {\n\t\t\t\tcolor: ", ";\n\t\t\t\ttext-decoration: underline;\n\t\t\t}\n\n\t\t\t&:active {\n\t\t\t\tcolor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t& span.akActionMark {\n\t\t\tcursor: pointer;\n\t\t}\n\n\t\t& span[data-placeholder] {\n\t\t\tcolor: ", ";\n\t\t}\n\n\t\t", "\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", ";\n\t\t", "\n\t\t", "\n\n\t\t& .UnknownBlock {\n\t\t\tfont-family: ", ";\n\t\t\tfont-size: ", ";\n\t\t\tfont-weight: 400;\n\t\t\twhite-space: pre-wrap;\n\t\t\tword-wrap: break-word;\n\t\t}\n\n\t\t& span.date-node {\n\t\t\tbackground: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tcolor: ", ";\n\t\t\tpadding: ", " ", ";\n\t\t\tmargin: 0 1px;\n\t\t\ttransition: background 0.3s;\n\t\t}\n\n\t\t& span.date-node-highlighted {\n\t\t\tbackground: ", ";\n\t\t\tcolor: ", ";\n\t\t}\n\n\t\t& .renderer-image {\n\t\t\tmax-width: 100%;\n\t\t\tdisplay: block;\n\t\t\tmargin: ", " 0;\n\t\t}\n\n\t\t.", ".rich-media-wrapped + .", ":not(.rich-media-wrapped) {\n\t\t\tclear: both;\n\t\t}\n\n\t\t& .code-block,\n\t\t& blockquote,\n\t\t& hr,\n\t\t& > div > div:not(.rich-media-wrapped),\n\t\t.", ".rich-media-wrapped + .rich-media-wrapped + *:not(.rich-media-wrapped),\n\t\t.", ".rich-media-wrapped + div:not(.rich-media-wrapped),\n\t\t.", ".image-align-start,\n\t\t\t.", ".image-center,\n\t\t\t.", ".image-align-end {\n\t\t\tclear: both;\n\t\t}\n\n\t\t& .rich-media-wrapped {\n\t\t\t& + h1,\n\t\t\t& + h2,\n\t\t\t& + h3,\n\t\t\t& + h4,\n\t\t\t& + h5,\n\t\t\t& + h6 {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\t\t}\n\n\t\t", "\n\t\t/* plugin styles */\n ", " &\n div[class^='image-wrap-'] + div[class^='image-wrap-'] {\n\t\t\tmargin-left: 0;\n\t\t\tmargin-right: 0;\n\t\t}\n\n\t\t/* Breakout for tables and extensions */\n\t\t.", " > {\n\t\t\t", "\n\n\t\t\t* .", " {\n\t\t\t\toverflow-x: auto;\n\t\t\t}\n\n\t\t\t& .", ":first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t}\n\n\t\t.", " {\n\t\t\t.", " {\n\t\t\t\tmargin-top: ", ";\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\tmargin-left: 50%;\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\toverflow-x: auto;\n\t\t\t}\n\n\t\t\t.", " .", " {\n\t\t\t\tdisplay: flex;\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t.", " .", " {\n\t\t\tz-index: 0;\n\t\t\ttransition: all 0.1s linear;\n\t\t\tdisplay: flex; /* needed to avoid position: fixed jumpiness in Chrome */\n\n\t\t\t/** Shadow overrides */\n\t\t\t&.", "::after, &.", "::before {\n\t\t\t\ttop: ", "px;\n\t\t\t\theight: calc(100% - ", "px);\n\t\t\t\tz-index: ", ";\n\t\t\t}\n\n\t\t\t", "\n\n\t\t\t&\n .", ",\n &\n .", " {\n\t\t\t\theight: calc(100% - ", "px);\n\t\t\t}\n\n\t\t\t/**\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\t\t\ttable {\n\t\t\t\theight: 1px; /* will be ignored */\n\t\t\t\t", ";\n\t\t\t\tmargin-left: 0;\n\t\t\t\tmargin-right: 0;\n\t\t\t}\n\n\t\t\ttable tr:first-of-type {\n\t\t\t\theight: 100%;\n\n\t\t\t\ttd,\n\t\t\t\tth {\n\t\t\t\t\tposition: relative;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttable[data-number-column='true'] {\n\t\t\t\t.", " {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t\tborder-right: 1px solid\n\t\t\t\t\t\t", ";\n\t\t\t\t\twidth: ", "px;\n\t\t\t\t\ttext-align: center;\n\t\t\t\t\tcolor: ", ";\n\t\t\t\t\tfont-size: ", ";\n\t\t\t\t}\n\n\t\t\t\t.fixed .", " {\n\t\t\t\t\tborder-right: 0px none;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttr[data-header-row].fixed {\n\t\t\tposition: fixed !important;\n\t\t\tdisplay: flex;\n\t\t\toverflow: hidden;\n\t\t\tz-index: ", ";\n\n\t\t\tborder-right: 1px solid ", ";\n\t\t\tborder-bottom: 1px solid ", ";\n\n\t\t\t/* this is to compensate for the table border */\n\t\t\ttransform: translateX(-1px);\n\t\t}\n\n\t\t.sticky > th {\n\t\t\tz-index: ", ";\n\t\t\tposition: sticky !important;\n\t\t\ttop: 0;\n\t\t}\n\n\t\t/* Make the number column header sticky */\n\t\t.sticky > td {\n\t\t\tposition: sticky !important;\n\t\t\ttop: 0;\n\t\t}\n\n\t\t/* add border for position: sticky\n and work around background-clip: padding-box\n bug for FF causing box-shadow bug in Chrome */\n\t\t.sticky th,\n\t\t.sticky td {\n\t\t\tbox-shadow:\n\t\t\t\t0px 1px ", ",\n\t\t\t\t0px -0.5px ", ",\n\t\t\t\tinset -1px 0px ", ",\n\t\t\t\t0px -1px ", ";\n\t\t}\n\n\t\t/* this will remove jumpiness caused in Chrome for sticky headers */\n\t\t.fixed + tr {\n\t\t\tmin-height: 0px;\n\t\t}\n\n\t\t/*\n * We wrap CodeBlock in a grid to prevent it from overflowing the container of the renderer.\n * See ED-4159.\n */\n\t\t& .code-block {\n\t\t\tmax-width: 100%;\n\t\t\t/* -ms- properties are necessary until MS supports the latest version of the grid spec */\n\t\t\t/* stylelint-disable value-no-vendor-prefix, declaration-block-no-duplicate-properties */\n\t\t\tdisplay: block;\n\t\t\t/* stylelint-enable */\n\n\t\t\tposition: relative;\n\t\t\tborder-radius: ", ";\n\n\t\t\t/*\n * The overall renderer has word-wrap: break; which causes issues with\n * code block line numbers in Safari / iOS.\n */\n\t\t\tword-wrap: normal;\n\t\t}\n\n\t\t& .MediaGroup,\n\t\t& .code-block {\n\t\t\tmargin-top: ", ";\n\n\t\t\t&:first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t", "\n\n ", ";\n\t\t& [data-layout-section] {\n\t\t\tmargin-top: ", ";\n\t\t\t& > div + div {\n\t\t\t\tmargin-left: ", ";\n\t\t\t}\n\n\t\t\t@media screen and (max-width: ", "px) {\n\t\t\t\t& > div + div {\n\t\t\t\t\tmargin-left: 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t& .MediaGroup,\n\t\t\t& .code-block {\n\t\t\t\tmargin-top: ", ";\n\n\t\t\t\t&:first-child {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t& li {\n\t\t\t> .code-block {\n\t\t\t\tmargin: ", " 0 0 0;\n\t\t\t}\n\t\t\t> .code-block:first-child {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\n\t\t\t> div:last-of-type.code-block {\n\t\t\t\tmargin-bottom: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&:not([data-node-type='decisionList']) > li,\n // This prevents https://product-fabric.atlassian.net/browse/ED-20924\n &:not(.", ") > li {\n\t\t\t", "\n\t\t}\n\t"])), (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(colorMode), _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, getAnnotationStyles(wrapperProps), (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
136
  };
120
137
  };
121
138
  var useGridRenderForCodeBlock = function useGridRenderForCodeBlock(codeBlockRenderAsBlock) {
@@ -47,7 +47,9 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
47
47
  // prevents from opening link URL inside webView in Safari
48
48
  event.preventDefault();
49
49
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes')) {
50
- event.stopPropagation();
50
+ if (event.target instanceof HTMLElement && event.target.closest('[data-inline-card]')) {
51
+ event.stopPropagation();
52
+ }
51
53
  }
52
54
  onClick({
53
55
  eventTarget: event.target,
@@ -66,6 +68,6 @@ var MarkComponent = exports.MarkComponent = function MarkComponent(_ref) {
66
68
  return (0, _react2.jsx)(useBlockLevel ? 'div' : 'mark', _objectSpread(_objectSpread(_objectSpread((0, _defineProperty2.default)({
67
69
  id: id
68
70
  }, (0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes') ? 'onClickCapture' : 'onClick', onMarkClick), accessibility), overriddenData), !useBlockLevel && {
69
- css: markStyles
71
+ css: [markStyles]
70
72
  }), children);
71
73
  };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useInlineAnnotationProps = useInlineAnnotationProps;
7
+ var _react = require("react");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
+ var _context = require("../context");
10
+ function useInlineAnnotationProps(props, _ref) {
11
+ var isInlineCard = _ref.isInlineCard;
12
+ var draftPosition = (0, _react.useContext)(_context.AnnotationsDraftContext);
13
+ if (!isInlineCard && !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
14
+ return {};
15
+ }
16
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes')) {
17
+ return {};
18
+ }
19
+ if (!props.dataAttributes) {
20
+ // the inlineCard component is currently used by the block card, embed card and card error boundary components
21
+ // when used via these components, no dataAttributes are passed (and we don't want it setup for inline comments)
22
+ return {};
23
+ }
24
+ var inlineCardPosition = props.dataAttributes['data-renderer-start-pos'] - 1;
25
+ var hasDraft = draftPosition && (draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.from) <= inlineCardPosition && (draftPosition === null || draftPosition === void 0 ? void 0 : draftPosition.to) >= inlineCardPosition + 1;
26
+ if (hasDraft) {
27
+ return {
28
+ 'data-renderer-mark': true,
29
+ 'data-annotation-draft-mark': true,
30
+ 'data-annotation-inline-node': true,
31
+ 'data-renderer-start-pos': inlineCardPosition
32
+ };
33
+ }
34
+ return {
35
+ 'data-annotation-inline-node': true,
36
+ 'data-annotation-mark': true,
37
+ 'data-renderer-start-pos': inlineCardPosition
38
+ };
39
+ }
@@ -187,7 +187,7 @@ export default class ReactSerializer {
187
187
  const path = parentInfo ? parentInfo.path : undefined;
188
188
  switch (node.type.name) {
189
189
  case 'date':
190
- return this.getDateProps(node, parentInfo);
190
+ return this.getDateProps(node, parentInfo, path);
191
191
  case 'hardBreak':
192
192
  return this.getHardBreakProps(node, path);
193
193
  case 'heading':
@@ -328,10 +328,15 @@ export default class ReactSerializer {
328
328
  isInsideMultiBodiedExtension
329
329
  };
330
330
  }
331
- getDateProps(node, parentInfo) {
331
+ getDateProps(node, parentInfo, path = []) {
332
332
  return {
333
333
  timestamp: node.attrs && node.attrs.timestamp,
334
- parentIsIncompleteTask: parentInfo && parentInfo.parentIsIncompleteTask
334
+ parentIsIncompleteTask: parentInfo && parentInfo.parentIsIncompleteTask,
335
+ dataAttributes: {
336
+ // We need to account for depth (path.length gives up depth) here
337
+ // but depth doesnt increment the pos, only accounted for.
338
+ 'data-renderer-start-pos': this.startPos + path.length
339
+ }
335
340
  };
336
341
  }
337
342
  getMediaSingleProps(node, path = []) {
@@ -1,32 +1,33 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import { PureComponent } from 'react';
2
+ import React, { memo } from 'react';
4
3
  import { DateSharedCssClassName } from '@atlaskit/editor-common/styles';
5
4
  import { isPastDate, timestampToString, timestampToTaskContext } from '@atlaskit/editor-common/utils';
6
5
  import { injectIntl } from 'react-intl-next';
7
6
  import { useTaskItemsFormatContext } from '../../ui/TaskItemsFormatContext';
8
- class Date extends PureComponent {
9
- render() {
10
- const {
11
- timestamp,
12
- parentIsIncompleteTask,
13
- intl
14
- } = this.props;
15
- const className = !!parentIsIncompleteTask && isPastDate(timestamp) ? 'date-node date-node-highlighted' : 'date-node';
16
- return (
17
- /*#__PURE__*/
7
+ import { useInlineAnnotationProps } from '../../ui/annotations/element/useInlineAnnotationProps';
8
+ const Date = /*#__PURE__*/memo(function Date(props) {
9
+ const inlineAnnotationProps = useInlineAnnotationProps(props, {
10
+ isInlineCard: false
11
+ });
12
+ const {
13
+ timestamp,
14
+ parentIsIncompleteTask,
15
+ intl
16
+ } = props;
17
+ const className = !!parentIsIncompleteTask && isPastDate(timestamp) ? 'date-node date-node-highlighted' : 'date-node';
18
+ return (
19
+ /*#__PURE__*/
20
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
21
+ React.createElement("span", _extends({
22
+ className: DateSharedCssClassName.DATE_WRAPPER
23
+ }, inlineAnnotationProps), /*#__PURE__*/React.createElement("span", {
18
24
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
19
- React.createElement("span", {
20
- className: DateSharedCssClassName.DATE_WRAPPER
21
- }, /*#__PURE__*/React.createElement("span", {
22
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
23
- className: className,
24
- "data-node-type": "date",
25
- "data-timestamp": timestamp
26
- }, parentIsIncompleteTask ? timestampToTaskContext(timestamp, intl) : timestampToString(timestamp, intl)))
27
- );
28
- }
29
- }
25
+ className: className,
26
+ "data-node-type": "date",
27
+ "data-timestamp": timestamp
28
+ }, parentIsIncompleteTask ? timestampToTaskContext(timestamp, intl) : timestampToString(timestamp, intl)))
29
+ );
30
+ });
30
31
  export const DateComponent = injectIntl(Date);
31
32
  function DateWithFormatContext(props) {
32
33
  const [isChecked] = useTaskItemsFormatContext();
@@ -1,17 +1,23 @@
1
- import React from 'react';
2
- import { PureComponent } from 'react';
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
+ import { memo } from 'react';
3
5
  import { Emoji } from '@atlaskit/editor-common/emoji';
4
- export default class EmojiItem extends PureComponent {
5
- render() {
6
- const {
7
- id,
8
- providers,
9
- shortName,
10
- text,
11
- fitToHeight,
12
- resourceConfig
13
- } = this.props;
14
- return /*#__PURE__*/React.createElement(Emoji, {
6
+ import { useInlineAnnotationProps } from '../../ui/annotations/element/useInlineAnnotationProps';
7
+ function EmojiItem(props) {
8
+ const {
9
+ id,
10
+ providers,
11
+ shortName,
12
+ text,
13
+ fitToHeight,
14
+ resourceConfig
15
+ } = props;
16
+ const inlineAnnotationProps = useInlineAnnotationProps(props, {
17
+ isInlineCard: false
18
+ });
19
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
20
+ return jsx("span", inlineAnnotationProps, jsx(Emoji, {
15
21
  allowTextFallback: true,
16
22
  id: id,
17
23
  shortName: shortName,
@@ -19,6 +25,20 @@ export default class EmojiItem extends PureComponent {
19
25
  providers: providers,
20
26
  fitToHeight: fitToHeight,
21
27
  resourceConfig: resourceConfig
22
- });
28
+ }));
23
29
  }
24
- }
30
+ return jsx(Emoji, {
31
+ allowTextFallback: true,
32
+ id: id,
33
+ shortName: shortName,
34
+ fallback: text,
35
+ providers: providers,
36
+ fitToHeight: fitToHeight,
37
+ resourceConfig: resourceConfig
38
+ });
39
+ }
40
+
41
+ // Working around an issue with pre existing tests using react-test-renderer
42
+ // https://github.com/facebook/react/issues/17301#issuecomment-557765213
43
+ EmojiItem.defaultProps = {};
44
+ export default /*#__PURE__*/memo(EmojiItem);
@@ -1,26 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
- import { css, jsx } from '@emotion/react';
3
+ import { jsx } from '@emotion/react';
4
4
  import { Card } from '@atlaskit/smart-card';
5
5
  import { CardSSR } from '@atlaskit/smart-card/ssr';
6
6
  import { UnsupportedInline } from '@atlaskit/editor-common/ui';
7
- import { N60A, Y300, Y75 } from '@atlaskit/theme/colors';
8
7
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
8
  import { CardErrorBoundary } from './fallback';
10
9
  import { withSmartCardStorage } from '../../ui/SmartCardStorage';
11
10
  import { getCardClickHandler } from '../utils/getCardClickHandler';
12
11
  import { AnalyticsContext } from '@atlaskit/analytics-next';
13
- const annotatedCard = css({
14
- // This is expected to be reworked as part of https://team.atlassian.com/project/ATLAS-61846/updates
15
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
16
- "[data-mark-type='annotation'][data-mark-annotation-state='active'] &": {
17
- background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
18
- borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y300})`}`,
19
- boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`,
20
- cursor: 'pointer',
21
- padding: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-025, 2px)"}`
22
- }
23
- });
12
+ import { useInlineAnnotationProps } from '../../ui/annotations/element/useInlineAnnotationProps';
24
13
  const InlineCard = props => {
25
14
  const {
26
15
  url,
@@ -50,21 +39,18 @@ const InlineCard = props => {
50
39
  // Below is added for the future implementation of Linking Platform namespaced analytic context
51
40
  location: 'renderer'
52
41
  };
42
+ const inlineAnnotationProps = useInlineAnnotationProps(props, {
43
+ isInlineCard: true
44
+ });
53
45
  if (ssr && url) {
54
- // platform.editor.allow-inline-comments-for-inline-nodes requires this change to work -- however this feature flag is only intended to go to HELLO (and is expected to last for Q4).
55
- // platform.editor.renderer-inline-card-ssr-fix_kqcwl is the feature flag that allows this change to be safely released more widely.
56
- // Once platform.editor.renderer-inline-card-ssr-fix_kqcwl reaches 100% we can remove both checks
57
46
  if (
58
47
  // eslint-disable-next-line @atlaskit/platform/no-invalid-feature-flag-usage
59
- getBooleanFF('platform.editor.renderer-inline-card-ssr-fix_kqcwl') ||
60
- // eslint-disable-next-line @atlaskit/platform/no-invalid-feature-flag-usage
61
48
  getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
62
- return jsx("span", {
49
+ return jsx("span", _extends({
63
50
  "data-inline-card": true,
64
51
  "data-card-data": data ? JSON.stringify(data) : undefined,
65
- "data-card-url": url,
66
- css: annotatedCard
67
- }, jsx(AnalyticsContext, {
52
+ "data-card-url": url
53
+ }, inlineAnnotationProps), jsx(AnalyticsContext, {
68
54
  data: analyticsData
69
55
  }, jsx(CardSSR, {
70
56
  appearance: "inline",
@@ -97,12 +83,11 @@ const InlineCard = props => {
97
83
  };
98
84
  return jsx(AnalyticsContext, {
99
85
  data: analyticsData
100
- }, jsx("span", {
86
+ }, jsx("span", _extends({
101
87
  "data-inline-card": true,
102
88
  "data-card-data": data ? JSON.stringify(data) : undefined,
103
- "data-card-url": url,
104
- css: getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') ? annotatedCard : undefined
105
- }, jsx(CardErrorBoundary, _extends({
89
+ "data-card-url": url
90
+ }, inlineAnnotationProps), jsx(CardErrorBoundary, _extends({
106
91
  unsupportedComponent: UnsupportedInline
107
92
  }, cardProps), jsx(Card, _extends({
108
93
  appearance: "inline",
@@ -1,23 +1,35 @@
1
- import React from 'react';
2
- import { PureComponent } from 'react';
1
+ import React, { memo } from 'react';
3
2
  import { Mention } from '@atlaskit/editor-common/mention';
4
- export default class MentionItem extends PureComponent {
5
- render() {
6
- const {
7
- eventHandlers,
8
- id,
9
- providers,
10
- text,
11
- accessLevel,
12
- localId
13
- } = this.props;
14
- return /*#__PURE__*/React.createElement(Mention, {
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
+ import { useInlineAnnotationProps } from '../../ui/annotations/element/useInlineAnnotationProps';
5
+ export default /*#__PURE__*/memo(function MentionItem(props) {
6
+ const {
7
+ eventHandlers,
8
+ id,
9
+ providers,
10
+ text,
11
+ accessLevel,
12
+ localId
13
+ } = props;
14
+ const inlineAnnotationProps = useInlineAnnotationProps(props, {
15
+ isInlineCard: false
16
+ });
17
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
18
+ return /*#__PURE__*/React.createElement("span", inlineAnnotationProps, /*#__PURE__*/React.createElement(Mention, {
15
19
  id: id,
16
20
  text: text,
17
21
  accessLevel: accessLevel,
18
22
  providers: providers,
19
23
  localId: localId,
20
24
  eventHandlers: eventHandlers && eventHandlers.mention
21
- });
25
+ }));
22
26
  }
23
- }
27
+ return /*#__PURE__*/React.createElement(Mention, {
28
+ id: id,
29
+ text: text,
30
+ accessLevel: accessLevel,
31
+ providers: providers,
32
+ localId: localId,
33
+ eventHandlers: eventHandlers && eventHandlers.mention
34
+ });
35
+ });
@@ -1,15 +1,19 @@
1
- import React from 'react';
2
- import { PureComponent } from 'react';
1
+ import React, { memo } from 'react';
3
2
  import { Status as AkStatus } from '@atlaskit/status/element';
4
3
  import { FabricElementsAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
5
- export default class Status extends PureComponent {
6
- render() {
7
- const {
8
- text,
9
- color,
10
- localId
11
- } = this.props;
12
- return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
+ import { useInlineAnnotationProps } from '../../ui/annotations/element/useInlineAnnotationProps';
6
+ export default /*#__PURE__*/memo(function Status(props) {
7
+ const {
8
+ text,
9
+ color,
10
+ localId
11
+ } = props;
12
+ const inlineAnnotationProps = useInlineAnnotationProps(props, {
13
+ isInlineCard: false
14
+ });
15
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
16
+ return /*#__PURE__*/React.createElement("span", inlineAnnotationProps, /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
13
17
  data: {
14
18
  userContext: 'document'
15
19
  }
@@ -18,6 +22,16 @@ export default class Status extends PureComponent {
18
22
  color: color,
19
23
  localId: localId,
20
24
  role: "presentation"
21
- }));
25
+ })));
22
26
  }
23
- }
27
+ return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
28
+ data: {
29
+ userContext: 'document'
30
+ }
31
+ }, /*#__PURE__*/React.createElement(AkStatus, {
32
+ text: text,
33
+ color: color,
34
+ localId: localId,
35
+ role: "presentation"
36
+ }));
37
+ });
@@ -74,7 +74,7 @@ function isNodeInlineTextMark(node) {
74
74
  * inline text mark.
75
75
  **/
76
76
 
77
- if (hasInlineCardDescendant(node)) {
77
+ if (hasInlineNodeDescendant(node)) {
78
78
  return false;
79
79
  }
80
80
  return true;
@@ -84,12 +84,18 @@ function isNodeInlineTextMark(node) {
84
84
  * This checks all the descendents of a node and returns true if it reaches
85
85
  * a descendant with the data-inline-card attribute set to 'true'.
86
86
  */
87
- function hasInlineCardDescendant(node) {
87
+ function hasInlineNodeDescendant(node) {
88
88
  if (isElementNode(node)) {
89
- if (node.dataset.inlineCard === 'true') {
90
- return true;
89
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
90
+ if (node.dataset.annotationInlineNode === 'true') {
91
+ return true;
92
+ }
93
+ } else {
94
+ if (node.dataset.inlineCard === 'true') {
95
+ return true;
96
+ }
91
97
  }
92
- return Array.from(node.childNodes).some(hasInlineCardDescendant);
98
+ return Array.from(node.childNodes).some(hasInlineNodeDescendant);
93
99
  }
94
100
  return false;
95
101
  }
@@ -121,11 +127,23 @@ function resolveNodePos(node) {
121
127
  function isRoot(element) {
122
128
  return !!element && element.classList.contains('ak-renderer-document');
123
129
  }
124
- export function resolvePos(node, offset) {
130
+ export function resolvePos(node, offset, findEnd = false) {
125
131
  // If the passed node doesn't exist, we should abort
126
132
  if (!node) {
127
133
  return false;
128
134
  }
135
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
136
+ var _node$parentElement;
137
+ const startPosAncestor = (_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 ? void 0 : _node$parentElement.closest('[data-renderer-start-pos');
138
+ const potentialParent = getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz') ? 'data-annotation-mark' : 'data-inline-card';
139
+ if (startPosAncestor !== null && startPosAncestor !== void 0 && startPosAncestor.hasAttribute(potentialParent)) {
140
+ if (findEnd) {
141
+ return parseInt((startPosAncestor === null || startPosAncestor === void 0 ? void 0 : startPosAncestor.getAttribute('data-renderer-start-pos')) || '-1', 10) + 1;
142
+ } else {
143
+ return parseInt((startPosAncestor === null || startPosAncestor === void 0 ? void 0 : startPosAncestor.getAttribute('data-renderer-start-pos')) || '-1', 10);
144
+ }
145
+ }
146
+ }
129
147
  if (node instanceof HTMLElement && isPositionPointer(node)) {
130
148
  return getStartPos(node) + offset;
131
149
  }
@@ -213,7 +231,8 @@ export function getPosFromRange(range, isCommentsOnMediaBugFixEnabled, isComment
213
231
  }
214
232
  }
215
233
  const from = resolvePos(startContainer, startOffset);
216
- const to = resolvePos(endContainer, endOffset);
234
+ const findEnd = true;
235
+ const to = resolvePos(endContainer, endOffset, findEnd);
217
236
  if (from === false || to === false) {
218
237
  return false;
219
238
  }
@@ -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.31.3";
40
+ const packageVersion = "109.32.0";
41
41
  export const defaultNodeComponents = nodeToReact;
42
42
  export class Renderer extends PureComponent {
43
43
  constructor(props) {
@@ -273,6 +273,7 @@ export class Renderer extends PureComponent {
273
273
  onComplete,
274
274
  onError,
275
275
  appearance,
276
+ allowAnnotations,
276
277
  adfStage,
277
278
  truncated,
278
279
  maxHeight,
@@ -355,6 +356,7 @@ export class Renderer extends PureComponent {
355
356
  }, jsx(SmartCardStorageProvider, null, jsx(ProviderFactoryProvider, {
356
357
  value: this.providerFactory
357
358
  }, jsx(RendererWrapper, {
359
+ allowAnnotations: allowAnnotations,
358
360
  appearance: appearance,
359
361
  allowNestedHeaderLinks: allowNestedHeaderLinks,
360
362
  allowColumnSorting: allowColumnSorting,
@@ -393,6 +395,7 @@ export class Renderer extends PureComponent {
393
395
  onError(e);
394
396
  }
395
397
  return jsx(RendererWrapper, {
398
+ allowAnnotations: allowAnnotations,
396
399
  appearance: appearance,
397
400
  allowCopyToClipboard: allowCopyToClipboard,
398
401
  allowWrapCodeBlock: allowWrapCodeBlock,
@@ -517,12 +520,15 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
517
520
  }, jsx("div", {
518
521
  ref: innerRef,
519
522
  onClick: onClick,
520
- onMouseDown: onMouseDown,
523
+ onMouseDown: onMouseDown
524
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
525
+ ,
521
526
  css: rendererStyles({
522
527
  appearance,
523
528
  allowNestedHeaderLinks,
524
529
  allowColumnSorting: !!allowColumnSorting,
525
- useBlockRenderForCodeBlock
530
+ useBlockRenderForCodeBlock,
531
+ allowAnnotations: props.allowAnnotations
526
532
  })
527
533
  }, children))));
528
534
  });
@@ -2,8 +2,10 @@
2
2
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
3
3
 
4
4
  import { css } from '@emotion/react';
5
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
6
  import { fontFamily, fontSize } from '@atlaskit/theme/constants';
6
7
  import * as colors from '@atlaskit/theme/colors';
8
+ import { N60A, Y300, Y75 } from '@atlaskit/theme/colors';
7
9
  import { headingSizes as headingSizesImport } from '@atlaskit/theme/typography';
8
10
  import { getGlobalTheme } from '@atlaskit/tokens';
9
11
  import { mediaInlineImageStyles } from '@atlaskit/editor-common/media-inline';
@@ -388,6 +390,23 @@ const getShadowOverrides = () => {
388
390
  }
389
391
  `;
390
392
  };
393
+ function getAnnotationStyles({
394
+ allowAnnotations
395
+ }) {
396
+ if (!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
397
+ return '';
398
+ }
399
+ return css({
400
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
401
+ "& [data-mark-type='annotation'][data-mark-annotation-state='active'] [data-annotation-mark], & [data-annotation-draft-mark][data-annotation-inline-node]": {
402
+ background: `var(--ds-background-accent-yellow-subtler, ${Y75})`,
403
+ borderBottom: `2px solid ${`var(--ds-border-accent-yellow, ${Y300})`}`,
404
+ boxShadow: `var(--ds-shadow-overlay, ${`1px 2px 3px ${N60A}, -1px 2px 3px ${N60A}`})`,
405
+ cursor: 'pointer',
406
+ padding: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-025, 2px)"}`
407
+ }
408
+ });
409
+ }
391
410
  export const rendererStyles = wrapperProps => theme => {
392
411
  const {
393
412
  colorMode
@@ -483,9 +502,10 @@ export const rendererStyles = wrapperProps => theme => {
483
502
  ${shadowSharedStyle};
484
503
  ${dateSharedStyle};
485
504
  ${textColorStyles};
486
- ${backgroundColorStyles(colorMode)};
505
+ ${backgroundColorStyles};
487
506
  ${tasksAndDecisionsStyles};
488
507
  ${smartCardSharedStyles}
508
+ ${getAnnotationStyles(wrapperProps)}
489
509
 
490
510
  & .UnknownBlock {
491
511
  font-family: ${fontFamily()};