@atlaskit/renderer 152.2.2 → 152.2.4

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,25 @@
1
1
  # @atlaskit/renderer
2
2
 
3
+ ## 152.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`67557f74cffc4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/67557f74cffc4) -
8
+ [EDITOR-9048] preserve divider color, style and weight attributes in the renderer behind
9
+ platform_editor_lovability_dividers_attributes.
10
+ - Updated dependencies
11
+
12
+ ## 152.2.3
13
+
14
+ ### Patch Changes
15
+
16
+ - [`afd887e901de1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/afd887e901de1) -
17
+ Discover annotations in legacy content macros and refresh their state when nested annotations are
18
+ added while platform_editor_fix_lcm_editor_annotations is enabled. Editor-scoped renderers can
19
+ load nested LCM annotations independently of the renderer experiment.
20
+
21
+ Allow the ProseMirror test editor helper to be checked with unused declaration checks enabled.
22
+
3
23
  ## 152.2.2
4
24
 
5
25
  ### Patch Changes
@@ -23,10 +23,6 @@ var _getRendererRangeInlineNodeNames = require("./get-renderer-range-inline-node
23
23
  var _matchesUtils = require("./matches-utils");
24
24
  var _selection = require("./selection");
25
25
  var RendererActions = exports.default = /*#__PURE__*/function () {
26
- // Any kind of refence is allowed
27
- // Ignored via go/ees005
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
-
30
26
  function RendererActions() {
31
27
  var initFromContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
32
28
  (0, _classCallCheck2.default)(this, RendererActions);
@@ -34,6 +30,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
34
30
  // This module can only be used when wrapped with
35
31
  // the <RendererContext> component for now.
36
32
  (0, _defineProperty2.default)(this, "initFromContext", false);
33
+ (0, _defineProperty2.default)(this, "includeLegacyContentAnnotations", false);
37
34
  this.initFromContext = initFromContext;
38
35
  this.transformer = new _JSONTransformer.JSONTransformer();
39
36
  }
@@ -42,6 +39,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
42
39
  return (0, _createClass2.default)(RendererActions, [{
43
40
  key: "_privateRegisterRenderer",
44
41
  value: function _privateRegisterRenderer(ref, doc, schema, onAnalyticsEvent) {
42
+ var includeLegacyContentAnnotations = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
45
43
  if (!this.initFromContext) {
46
44
  return;
47
45
  } else if (!this.ref) {
@@ -52,6 +50,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
52
50
  this.doc = doc;
53
51
  this.schema = schema;
54
52
  this.onAnalyticsEvent = onAnalyticsEvent;
53
+ this.includeLegacyContentAnnotations = includeLegacyContentAnnotations;
55
54
  }
56
55
  }, {
57
56
  key: "_privateUnregisterRenderer",
@@ -59,6 +58,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
59
58
  this.doc = undefined;
60
59
  this.ref = undefined;
61
60
  this.schema = undefined;
61
+ this.includeLegacyContentAnnotations = false;
62
62
  }
63
63
 
64
64
  /**
@@ -303,7 +303,7 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
303
303
  if (!annotationMarkType) {
304
304
  return [];
305
305
  }
306
- if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_fix_lcm_renderer_annotations')) {
306
+ if (this.includeLegacyContentAnnotations || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_fix_lcm_renderer_annotations')) {
307
307
  var _marks = [];
308
308
  doc.descendants(function (node) {
309
309
  var annotationsMark = node.marks.filter(function (m) {
@@ -6,8 +6,32 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = Rule;
8
8
  var _react = _interopRequireDefault(require("react"));
9
+ var _text = require("@atlaskit/editor-palette/text");
10
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
9
11
  function Rule() {
12
+ var _hexToEditorTextPalet;
13
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
14
+ color = _ref.color,
15
+ localId = _ref.localId,
16
+ style = _ref.style,
17
+ weight = _ref.weight;
18
+ if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_dividers_attributes')) {
19
+ return /*#__PURE__*/_react.default.createElement("hr", {
20
+ role: "presentation"
21
+ });
22
+ }
23
+ var paletteColor = color && ((_hexToEditorTextPalet = (0, _text.hexToEditorTextPaletteColor)(color)) !== null && _hexToEditorTextPalet !== void 0 ? _hexToEditorTextPalet : color);
24
+ var paletteStyle = paletteColor ? {
25
+ '--custom-palette-color': paletteColor
26
+ } : undefined;
10
27
  return /*#__PURE__*/_react.default.createElement("hr", {
11
- role: "presentation"
28
+ role: "presentation",
29
+ "data-color": color || undefined,
30
+ "data-local-id": localId || undefined,
31
+ "data-style": style || undefined,
32
+ "data-weight": weight !== null && weight !== void 0 ? weight : undefined
33
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
34
+ ,
35
+ style: paletteStyle
12
36
  });
13
37
  }
@@ -646,6 +646,74 @@ var ruleSharedStyles = (0, _react.css)({
646
646
  }
647
647
  });
648
648
 
649
+ // these masks need to be aligned with editor-core/styles/ruleWithAttrs.ts
650
+
651
+ var dashedStrokeMask = 'linear-gradient(to right, black 0, black 4px, transparent 4px, transparent 10px)';
652
+ var fadeStrokeMask = 'linear-gradient(to right, transparent 0%, black 27.4%, black 74%, transparent 100%)';
653
+
654
+ // dotted strokes
655
+ var dottedStrokeMaskSmall = 'radial-gradient(circle at center, black 0.5px, transparent 0.6px)';
656
+ var dottedStrokeMaskMedium = 'radial-gradient(circle at center, black 1px, transparent 1.1px)';
657
+ var dottedStrokeMaskLarge = 'radial-gradient(circle at center, black 1.5px, transparent 1.6px)';
658
+
659
+ // sketch strokes
660
+ var sketchStrokePath = 'M0.00161171 1.0107C6.6387 1 9.94061 5.16958 16.6371 5.16958C23.3336 5.16958 26.5761 1.00913 33.2726 1.0107C39.3797 1.01213 42.4198 4.22998 48.5219 4.47643C55.9487 4.77638 59.8075 0.780687 67.2368 1.0107C73.6051 1.20786 76.8081 4.42122 83.1792 4.47643C89.815 4.53393 93.1788 1.06378 99.8147 1.0107C106.716 0.95549 110.244 4.6564 117.143 4.47643C123.248 4.31717 126.289 1.21517 132.393 1.0107C139.555 0.770735 143.25 4.64894 150.414 4.47643C156.784 4.32307 159.986 1.06591 166.357 1.0107C172.993 0.953195 176.356 4.47655 182.992 4.47643C189.628 4.47632 192.992 1.01007 199.628 1.01007C206.264 1.01007 209.627 4.47632 216.263 4.47643C222.899 4.47655 226.263 1.0107 232.899 1.0107';
661
+ var sketchStrokeMaskSmall = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 233 7'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1' d='".concat(sketchStrokePath, "'/%3E%3C/svg%3E\")");
662
+ var sketchStrokeMaskMedium = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 233 7'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' d='".concat(sketchStrokePath, "'/%3E%3C/svg%3E\")");
663
+ var sketchStrokeMaskLarge = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -1 233 8'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' d='".concat(sketchStrokePath, "'/%3E%3C/svg%3E\")");
664
+ var ruleWithAttrsStyles = (0, _react.css)({
665
+ '& hr[data-color]': {
666
+ backgroundColor: 'var(--custom-palette-color)'
667
+ },
668
+ '& hr[data-style="dashed"]': {
669
+ maskImage: dashedStrokeMask,
670
+ maskRepeat: 'repeat-x',
671
+ maskSize: '10px 100%'
672
+ },
673
+ '& hr[data-style="dotted"]': {
674
+ maskImage: dottedStrokeMaskMedium,
675
+ maskPosition: 'center',
676
+ maskRepeat: 'repeat-x',
677
+ maskSize: '6px 2px'
678
+ },
679
+ '& hr[data-style="sketch"]': {
680
+ height: "calc(2px + ".concat("var(--ds-space-050, 4px)", " + ", "var(--ds-space-050, 4px)", ")"),
681
+ maskImage: sketchStrokeMaskMedium,
682
+ maskPosition: 'center',
683
+ maskRepeat: 'repeat-x',
684
+ maskSize: '233px 7px'
685
+ },
686
+ '& hr[data-style="fade"]': {
687
+ maskImage: fadeStrokeMask,
688
+ maskRepeat: 'no-repeat',
689
+ maskSize: '100% 100%'
690
+ },
691
+ '& hr[data-weight="1"]': {
692
+ height: '1px'
693
+ },
694
+ '& hr[data-weight="3"]': {
695
+ height: '3px'
696
+ },
697
+ '& hr[data-style="dotted"][data-weight="1"]': {
698
+ maskImage: dottedStrokeMaskSmall,
699
+ maskSize: '6px 1px'
700
+ },
701
+ '& hr[data-style="dotted"][data-weight="3"]': {
702
+ maskImage: dottedStrokeMaskLarge,
703
+ maskSize: '6px 3px'
704
+ },
705
+ // Sketch needs a mask per weight because CSS cannot change the SVG stroke width.
706
+ '& hr[data-style="sketch"][data-weight="1"]': {
707
+ height: "calc(1px + ".concat("var(--ds-space-050, 4px)", " + ", "var(--ds-space-050, 4px)", ")"),
708
+ maskImage: sketchStrokeMaskSmall
709
+ },
710
+ '& hr[data-style="sketch"][data-weight="3"]': {
711
+ height: "calc(3px + ".concat("var(--ds-space-050, 4px)", " + ", "var(--ds-space-050, 4px)", ")"),
712
+ maskImage: sketchStrokeMaskLarge,
713
+ maskSize: '233px 8px'
714
+ }
715
+ });
716
+
649
717
  // When cleaning up `platform_editor_content_mode_button_mvp` simplify the name/ use the other paragraph style name
650
718
  var paragraphSharedStylesWithEditorUGC = (0, _react.css)({
651
719
  '& p': {
@@ -2308,7 +2376,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
2308
2376
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- CSS custom properties for UGC font tokens
2309
2377
  '--ak-renderer-editor-font-small-text': _editorUgcTokenNames.editorUGCTokensRefreshed['editor.font.body.small']
2310
2378
  },
2311
- css: [(0, _expValEquals.expValEquals)('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_important_in_render_ext') ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !(0, _table2.isTableResizingEnabled)(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_important_in_render_ext') ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !(0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2379
+ css: [(0, _expValEquals.expValEquals)('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_important_in_render_ext') ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !(0, _table2.isTableResizingEnabled)(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_remove_important_in_render_ext') ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_dividers_attributes') && ruleWithAttrsStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !(0, _expValEquals.expValEquals)('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2312
2380
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
2313
2381
  textHighlightPaddingStyles, tasksAndDecisionsStyles, (0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, (0, _fg.fg)('editor_inline_comments_on_inline_nodes') && ((0, _expValEquals.expValEquals)('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
2314
2382
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
@@ -49,6 +49,7 @@ var _annotations = require("../annotations");
49
49
  var _collapsibleHeadings = require("../collapsible-headings");
50
50
  var _useScrollToBlock = require("../hooks/useScrollToBlock");
51
51
  var _RendererActionsContext = require("../RendererActionsContext");
52
+ var _includeLegacyContentAnnotationsContext = require("../RendererActionsContext/include-legacy-content-annotations-context");
52
53
  var _SmartCardStorage = require("../SmartCardStorage");
53
54
  var _analyticsUtils = require("./analytics-utils");
54
55
  var _breakoutSsr = require("./breakout-ssr");
@@ -79,7 +80,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
79
80
  var TABLE_INFO_TIMEOUT = 10000;
80
81
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
81
82
  var packageName = "@atlaskit/renderer";
82
- var packageVersion = "152.2.1";
83
+ var packageVersion = "152.2.4";
83
84
  var setAsQueryContainerStyles = (0, _react2.css)({
84
85
  containerName: 'ak-renderer-wrapper',
85
86
  containerType: 'inline-size'
@@ -827,6 +828,7 @@ function RendererActionsInternalUpdater(_ref2) {
827
828
  onAnalyticsEvent = _ref2.onAnalyticsEvent;
828
829
  var rootRendererContextValue = _react.default.useContext(RootRendererContext);
829
830
  var actions = (0, _react.useContext)(_RendererActionsContext.RendererContext);
831
+ var includeLegacyContentAnnotations = _react.default.useContext(_includeLegacyContentAnnotationsContext.IncludeLegacyContentAnnotationsContext);
830
832
  var rendererRef = (0, _react.useRef)(null);
831
833
 
832
834
  // This doc is used by the renderer actions when applying comments to the document.
@@ -840,14 +842,14 @@ function RendererActionsInternalUpdater(_ref2) {
840
842
  var _doc = rootRendererContextValue ? rootRendererContextValue.doc : doc;
841
843
  (0, _react.useLayoutEffect)(function () {
842
844
  if (_doc) {
843
- actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent);
845
+ actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent, includeLegacyContentAnnotations);
844
846
  } else {
845
847
  actions._privateUnregisterRenderer();
846
848
  }
847
849
  return function () {
848
850
  return actions._privateUnregisterRenderer();
849
851
  };
850
- }, [actions, schema, _doc, onAnalyticsEvent]);
852
+ }, [actions, schema, _doc, onAnalyticsEvent, includeLegacyContentAnnotations]);
851
853
 
852
854
  // Memoised so nested renderers don't re-render on every root renderer render
853
855
  // when the doc itself is unchanged.
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.IncludeLegacyContentAnnotationsContext = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var IncludeLegacyContentAnnotationsContext = exports.IncludeLegacyContentAnnotationsContext = /*#__PURE__*/_react.default.createContext(false);
@@ -13,18 +13,22 @@ var _useAnalyticsEvents2 = require("@atlaskit/analytics-next/useAnalyticsEvents"
13
13
  var _enums = require("@atlaskit/editor-common/analytics/types/enums");
14
14
  var _fg = require("@atlaskit/platform-feature-flags/fg");
15
15
  var _index = _interopRequireDefault(require("../../actions/index"));
16
+ var _includeLegacyContentAnnotationsContext = require("./include-legacy-content-annotations-context");
16
17
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
18
  /* eslint-disable jsdoc/require-jsdoc */
18
19
 
19
20
  var RendererContext = exports.RendererContext = /*#__PURE__*/_react.default.createContext(new _index.default());
20
21
  function RendererActionsContext(_ref) {
21
22
  var children = _ref.children,
22
- context = _ref.context;
23
+ context = _ref.context,
24
+ includeLegacyContentAnnotations = _ref.includeLegacyContentAnnotations;
23
25
  var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
24
26
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
25
27
  var actions = (0, _react.useMemo)(function () {
26
28
  return new _index.default(true);
27
29
  }, []);
30
+ var inheritedIncludeLegacyContentAnnotations = _react.default.useContext(_includeLegacyContentAnnotationsContext.IncludeLegacyContentAnnotationsContext);
31
+ var shouldIncludeLegacyContentAnnotations = includeLegacyContentAnnotations !== null && includeLegacyContentAnnotations !== void 0 ? includeLegacyContentAnnotations : inheritedIncludeLegacyContentAnnotations;
28
32
 
29
33
  // Remove this eventually when root cause is assessed
30
34
  if (_react.default.Children.count(children) > 1 && (0, _fg.fg)('confluence_frontend_fix_view_page_slo')) {
@@ -47,8 +51,10 @@ function RendererActionsContext(_ref) {
47
51
  }).fire(_types.FabricChannel.editor);
48
52
  }
49
53
  }
50
- return /*#__PURE__*/_react.default.createElement(RendererContext.Provider, {
54
+ return /*#__PURE__*/_react.default.createElement(_includeLegacyContentAnnotationsContext.IncludeLegacyContentAnnotationsContext.Provider, {
55
+ value: shouldIncludeLegacyContentAnnotations
56
+ }, /*#__PURE__*/_react.default.createElement(RendererContext.Provider, {
51
57
  value: context || actions
52
- }, (0, _fg.fg)('confluence_frontend_fix_view_page_slo') ? _react.default.Children.only(children) : children);
58
+ }, (0, _fg.fg)('confluence_frontend_fix_view_page_slo') ? _react.default.Children.only(children) : children));
53
59
  }
54
60
  var RendererActionsContextConsumer = exports.RendererActionsContextConsumer = RendererContext.Consumer;
@@ -13,21 +13,18 @@ import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-nod
13
13
  import { getIndexMatch, isBlockAnnotationTarget } from './matches-utils';
14
14
  import { getSelectionContext } from './selection';
15
15
  export default class RendererActions {
16
- // Any kind of refence is allowed
17
- // Ignored via go/ees005
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
-
20
16
  constructor(initFromContext = false) {
21
17
  // This is our psuedo feature flag for now
22
18
  // This module can only be used when wrapped with
23
19
  // the <RendererContext> component for now.
24
20
  _defineProperty(this, "initFromContext", false);
21
+ _defineProperty(this, "includeLegacyContentAnnotations", false);
25
22
  this.initFromContext = initFromContext;
26
23
  this.transformer = new JSONTransformer();
27
24
  }
28
25
 
29
26
  //#region private
30
- _privateRegisterRenderer(ref, doc, schema, onAnalyticsEvent) {
27
+ _privateRegisterRenderer(ref, doc, schema, onAnalyticsEvent, includeLegacyContentAnnotations = false) {
31
28
  if (!this.initFromContext) {
32
29
  return;
33
30
  } else if (!this.ref) {
@@ -38,11 +35,13 @@ export default class RendererActions {
38
35
  this.doc = doc;
39
36
  this.schema = schema;
40
37
  this.onAnalyticsEvent = onAnalyticsEvent;
38
+ this.includeLegacyContentAnnotations = includeLegacyContentAnnotations;
41
39
  }
42
40
  _privateUnregisterRenderer() {
43
41
  this.doc = undefined;
44
42
  this.ref = undefined;
45
43
  this.schema = undefined;
44
+ this.includeLegacyContentAnnotations = false;
46
45
  }
47
46
 
48
47
  /**
@@ -279,7 +278,7 @@ export default class RendererActions {
279
278
  if (!annotationMarkType) {
280
279
  return [];
281
280
  }
282
- if (isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
281
+ if (this.includeLegacyContentAnnotations || isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
283
282
  const marks = [];
284
283
  doc.descendants(node => {
285
284
  const annotationsMark = node.marks.filter(m => m.type === annotationMarkType);
@@ -1,6 +1,30 @@
1
1
  import React from 'react';
2
- export default function Rule() {
2
+ import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette/text';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
+ export default function Rule({
5
+ color,
6
+ localId,
7
+ style,
8
+ weight
9
+ } = {}) {
10
+ var _hexToEditorTextPalet;
11
+ if (!isExperimentEnabled('platform_editor_lovability_dividers_attributes')) {
12
+ return /*#__PURE__*/React.createElement("hr", {
13
+ role: "presentation"
14
+ });
15
+ }
16
+ const paletteColor = color && ((_hexToEditorTextPalet = hexToEditorTextPaletteColor(color)) !== null && _hexToEditorTextPalet !== void 0 ? _hexToEditorTextPalet : color);
17
+ const paletteStyle = paletteColor ? {
18
+ '--custom-palette-color': paletteColor
19
+ } : undefined;
3
20
  return /*#__PURE__*/React.createElement("hr", {
4
- role: "presentation"
21
+ role: "presentation",
22
+ "data-color": color || undefined,
23
+ "data-local-id": localId || undefined,
24
+ "data-style": style || undefined,
25
+ "data-weight": weight !== null && weight !== void 0 ? weight : undefined
26
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
27
+ ,
28
+ style: paletteStyle
5
29
  });
6
30
  }
@@ -754,6 +754,74 @@ const ruleSharedStyles = css({
754
754
  }
755
755
  });
756
756
 
757
+ // these masks need to be aligned with editor-core/styles/ruleWithAttrs.ts
758
+
759
+ const dashedStrokeMask = 'linear-gradient(to right, black 0, black 4px, transparent 4px, transparent 10px)';
760
+ const fadeStrokeMask = 'linear-gradient(to right, transparent 0%, black 27.4%, black 74%, transparent 100%)';
761
+
762
+ // dotted strokes
763
+ const dottedStrokeMaskSmall = 'radial-gradient(circle at center, black 0.5px, transparent 0.6px)';
764
+ const dottedStrokeMaskMedium = 'radial-gradient(circle at center, black 1px, transparent 1.1px)';
765
+ const dottedStrokeMaskLarge = 'radial-gradient(circle at center, black 1.5px, transparent 1.6px)';
766
+
767
+ // sketch strokes
768
+ const sketchStrokePath = 'M0.00161171 1.0107C6.6387 1 9.94061 5.16958 16.6371 5.16958C23.3336 5.16958 26.5761 1.00913 33.2726 1.0107C39.3797 1.01213 42.4198 4.22998 48.5219 4.47643C55.9487 4.77638 59.8075 0.780687 67.2368 1.0107C73.6051 1.20786 76.8081 4.42122 83.1792 4.47643C89.815 4.53393 93.1788 1.06378 99.8147 1.0107C106.716 0.95549 110.244 4.6564 117.143 4.47643C123.248 4.31717 126.289 1.21517 132.393 1.0107C139.555 0.770735 143.25 4.64894 150.414 4.47643C156.784 4.32307 159.986 1.06591 166.357 1.0107C172.993 0.953195 176.356 4.47655 182.992 4.47643C189.628 4.47632 192.992 1.01007 199.628 1.01007C206.264 1.01007 209.627 4.47632 216.263 4.47643C222.899 4.47655 226.263 1.0107 232.899 1.0107';
769
+ const sketchStrokeMaskSmall = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 233 7'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1' d='${sketchStrokePath}'/%3E%3C/svg%3E")`;
770
+ const sketchStrokeMaskMedium = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 233 7'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' d='${sketchStrokePath}'/%3E%3C/svg%3E")`;
771
+ const sketchStrokeMaskLarge = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -1 233 8'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' d='${sketchStrokePath}'/%3E%3C/svg%3E")`;
772
+ const ruleWithAttrsStyles = css({
773
+ '& hr[data-color]': {
774
+ backgroundColor: 'var(--custom-palette-color)'
775
+ },
776
+ '& hr[data-style="dashed"]': {
777
+ maskImage: dashedStrokeMask,
778
+ maskRepeat: 'repeat-x',
779
+ maskSize: '10px 100%'
780
+ },
781
+ '& hr[data-style="dotted"]': {
782
+ maskImage: dottedStrokeMaskMedium,
783
+ maskPosition: 'center',
784
+ maskRepeat: 'repeat-x',
785
+ maskSize: '6px 2px'
786
+ },
787
+ '& hr[data-style="sketch"]': {
788
+ height: `calc(2px + ${"var(--ds-space-050, 4px)"} + ${"var(--ds-space-050, 4px)"})`,
789
+ maskImage: sketchStrokeMaskMedium,
790
+ maskPosition: 'center',
791
+ maskRepeat: 'repeat-x',
792
+ maskSize: '233px 7px'
793
+ },
794
+ '& hr[data-style="fade"]': {
795
+ maskImage: fadeStrokeMask,
796
+ maskRepeat: 'no-repeat',
797
+ maskSize: '100% 100%'
798
+ },
799
+ '& hr[data-weight="1"]': {
800
+ height: '1px'
801
+ },
802
+ '& hr[data-weight="3"]': {
803
+ height: '3px'
804
+ },
805
+ '& hr[data-style="dotted"][data-weight="1"]': {
806
+ maskImage: dottedStrokeMaskSmall,
807
+ maskSize: '6px 1px'
808
+ },
809
+ '& hr[data-style="dotted"][data-weight="3"]': {
810
+ maskImage: dottedStrokeMaskLarge,
811
+ maskSize: '6px 3px'
812
+ },
813
+ // Sketch needs a mask per weight because CSS cannot change the SVG stroke width.
814
+ '& hr[data-style="sketch"][data-weight="1"]': {
815
+ height: `calc(1px + ${"var(--ds-space-050, 4px)"} + ${"var(--ds-space-050, 4px)"})`,
816
+ maskImage: sketchStrokeMaskSmall
817
+ },
818
+ '& hr[data-style="sketch"][data-weight="3"]': {
819
+ height: `calc(3px + ${"var(--ds-space-050, 4px)"} + ${"var(--ds-space-050, 4px)"})`,
820
+ maskImage: sketchStrokeMaskLarge,
821
+ maskSize: '233px 8px'
822
+ }
823
+ });
824
+
757
825
  // When cleaning up `platform_editor_content_mode_button_mvp` simplify the name/ use the other paragraph style name
758
826
  const paragraphSharedStylesWithEditorUGC = css({
759
827
  '& p': {
@@ -2930,7 +2998,7 @@ export const RendererStyleContainer = props => {
2930
2998
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- CSS custom properties for UGC font tokens
2931
2999
  '--ak-renderer-editor-font-small-text': editorUGCTokensRefreshed['editor.font.body.small']
2932
3000
  },
2933
- css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, isExperimentEnabled('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
3001
+ css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, isExperimentEnabled('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, isExperimentEnabled('platform_editor_lovability_dividers_attributes') && ruleWithAttrsStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2934
3002
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
2935
3003
  textHighlightPaddingStyles, tasksAndDecisionsStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, fg('editor_inline_comments_on_inline_nodes') && (expValEquals('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
2936
3004
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
@@ -43,6 +43,7 @@ import { AnnotationsPositionContext, AnnotationsWrapper } from '../annotations';
43
43
  import { CollapsibleHeadingsProvider } from '../collapsible-headings';
44
44
  import { useScrollToBlock } from '../hooks/useScrollToBlock';
45
45
  import { RendererContext as ActionsContext, RendererActionsContext } from '../RendererActionsContext';
46
+ import { IncludeLegacyContentAnnotationsContext } from '../RendererActionsContext/include-legacy-content-annotations-context';
46
47
  import { Provider as SmartCardStorageProvider } from '../SmartCardStorage';
47
48
  import { getHeightInfoPayload, getWidthInfoPayload } from './analytics-utils';
48
49
  import { BreakoutSSRInlineScript } from './breakout-ssr';
@@ -64,7 +65,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
64
65
  const TABLE_INFO_TIMEOUT = 10000;
65
66
  const RENDER_EVENT_SAMPLE_RATE = 0.1;
66
67
  const packageName = "@atlaskit/renderer";
67
- const packageVersion = "152.2.1";
68
+ const packageVersion = "152.2.4";
68
69
  const setAsQueryContainerStyles = css({
69
70
  containerName: 'ak-renderer-wrapper',
70
71
  containerType: 'inline-size'
@@ -821,6 +822,7 @@ function RendererActionsInternalUpdater({
821
822
  }) {
822
823
  const rootRendererContextValue = React.useContext(RootRendererContext);
823
824
  const actions = useContext(ActionsContext);
825
+ const includeLegacyContentAnnotations = React.useContext(IncludeLegacyContentAnnotationsContext);
824
826
  const rendererRef = useRef(null);
825
827
 
826
828
  // This doc is used by the renderer actions when applying comments to the document.
@@ -834,12 +836,12 @@ function RendererActionsInternalUpdater({
834
836
  const _doc = rootRendererContextValue ? rootRendererContextValue.doc : doc;
835
837
  useLayoutEffect(() => {
836
838
  if (_doc) {
837
- actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent);
839
+ actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent, includeLegacyContentAnnotations);
838
840
  } else {
839
841
  actions._privateUnregisterRenderer();
840
842
  }
841
843
  return () => actions._privateUnregisterRenderer();
842
- }, [actions, schema, _doc, onAnalyticsEvent]);
844
+ }, [actions, schema, _doc, onAnalyticsEvent, includeLegacyContentAnnotations]);
843
845
 
844
846
  // Memoised so nested renderers don't re-render on every root renderer render
845
847
  // when the doc itself is unchanged.
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export const IncludeLegacyContentAnnotationsContext = /*#__PURE__*/React.createContext(false);
@@ -6,15 +6,19 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents'
6
6
  import { EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
7
7
  import { fg } from '@atlaskit/platform-feature-flags/fg';
8
8
  import RendererActions from '../../actions/index';
9
+ import { IncludeLegacyContentAnnotationsContext } from './include-legacy-content-annotations-context';
9
10
  export const RendererContext = /*#__PURE__*/React.createContext(new RendererActions());
10
11
  export function RendererActionsContext({
11
12
  children,
12
- context
13
+ context,
14
+ includeLegacyContentAnnotations
13
15
  }) {
14
16
  const {
15
17
  createAnalyticsEvent
16
18
  } = useAnalyticsEvents();
17
19
  const actions = useMemo(() => new RendererActions(true), []);
20
+ const inheritedIncludeLegacyContentAnnotations = React.useContext(IncludeLegacyContentAnnotationsContext);
21
+ const shouldIncludeLegacyContentAnnotations = includeLegacyContentAnnotations !== null && includeLegacyContentAnnotations !== void 0 ? includeLegacyContentAnnotations : inheritedIncludeLegacyContentAnnotations;
18
22
 
19
23
  // Remove this eventually when root cause is assessed
20
24
  if (React.Children.count(children) > 1 && fg('confluence_frontend_fix_view_page_slo')) {
@@ -38,8 +42,10 @@ export function RendererActionsContext({
38
42
  }).fire(FabricChannel.editor);
39
43
  }
40
44
  }
41
- return /*#__PURE__*/React.createElement(RendererContext.Provider, {
45
+ return /*#__PURE__*/React.createElement(IncludeLegacyContentAnnotationsContext.Provider, {
46
+ value: shouldIncludeLegacyContentAnnotations
47
+ }, /*#__PURE__*/React.createElement(RendererContext.Provider, {
42
48
  value: context || actions
43
- }, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children);
49
+ }, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children));
44
50
  }
45
51
  export const RendererActionsContextConsumer = RendererContext.Consumer;
@@ -16,10 +16,6 @@ import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-nod
16
16
  import { getIndexMatch, isBlockAnnotationTarget } from './matches-utils';
17
17
  import { getSelectionContext as _getSelectionContext } from './selection';
18
18
  var RendererActions = /*#__PURE__*/function () {
19
- // Any kind of refence is allowed
20
- // Ignored via go/ees005
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
-
23
19
  function RendererActions() {
24
20
  var initFromContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
25
21
  _classCallCheck(this, RendererActions);
@@ -27,6 +23,7 @@ var RendererActions = /*#__PURE__*/function () {
27
23
  // This module can only be used when wrapped with
28
24
  // the <RendererContext> component for now.
29
25
  _defineProperty(this, "initFromContext", false);
26
+ _defineProperty(this, "includeLegacyContentAnnotations", false);
30
27
  this.initFromContext = initFromContext;
31
28
  this.transformer = new JSONTransformer();
32
29
  }
@@ -35,6 +32,7 @@ var RendererActions = /*#__PURE__*/function () {
35
32
  return _createClass(RendererActions, [{
36
33
  key: "_privateRegisterRenderer",
37
34
  value: function _privateRegisterRenderer(ref, doc, schema, onAnalyticsEvent) {
35
+ var includeLegacyContentAnnotations = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
38
36
  if (!this.initFromContext) {
39
37
  return;
40
38
  } else if (!this.ref) {
@@ -45,6 +43,7 @@ var RendererActions = /*#__PURE__*/function () {
45
43
  this.doc = doc;
46
44
  this.schema = schema;
47
45
  this.onAnalyticsEvent = onAnalyticsEvent;
46
+ this.includeLegacyContentAnnotations = includeLegacyContentAnnotations;
48
47
  }
49
48
  }, {
50
49
  key: "_privateUnregisterRenderer",
@@ -52,6 +51,7 @@ var RendererActions = /*#__PURE__*/function () {
52
51
  this.doc = undefined;
53
52
  this.ref = undefined;
54
53
  this.schema = undefined;
54
+ this.includeLegacyContentAnnotations = false;
55
55
  }
56
56
 
57
57
  /**
@@ -296,7 +296,7 @@ var RendererActions = /*#__PURE__*/function () {
296
296
  if (!annotationMarkType) {
297
297
  return [];
298
298
  }
299
- if (isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
299
+ if (this.includeLegacyContentAnnotations || isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
300
300
  var _marks = [];
301
301
  doc.descendants(function (node) {
302
302
  var annotationsMark = node.marks.filter(function (m) {
@@ -1,6 +1,30 @@
1
1
  import React from 'react';
2
+ import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette/text';
3
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
2
4
  export default function Rule() {
5
+ var _hexToEditorTextPalet;
6
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
7
+ color = _ref.color,
8
+ localId = _ref.localId,
9
+ style = _ref.style,
10
+ weight = _ref.weight;
11
+ if (!isExperimentEnabled('platform_editor_lovability_dividers_attributes')) {
12
+ return /*#__PURE__*/React.createElement("hr", {
13
+ role: "presentation"
14
+ });
15
+ }
16
+ var paletteColor = color && ((_hexToEditorTextPalet = hexToEditorTextPaletteColor(color)) !== null && _hexToEditorTextPalet !== void 0 ? _hexToEditorTextPalet : color);
17
+ var paletteStyle = paletteColor ? {
18
+ '--custom-palette-color': paletteColor
19
+ } : undefined;
3
20
  return /*#__PURE__*/React.createElement("hr", {
4
- role: "presentation"
21
+ role: "presentation",
22
+ "data-color": color || undefined,
23
+ "data-local-id": localId || undefined,
24
+ "data-style": style || undefined,
25
+ "data-weight": weight !== null && weight !== void 0 ? weight : undefined
26
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
27
+ ,
28
+ style: paletteStyle
5
29
  });
6
30
  }
@@ -639,6 +639,74 @@ var ruleSharedStyles = css({
639
639
  }
640
640
  });
641
641
 
642
+ // these masks need to be aligned with editor-core/styles/ruleWithAttrs.ts
643
+
644
+ var dashedStrokeMask = 'linear-gradient(to right, black 0, black 4px, transparent 4px, transparent 10px)';
645
+ var fadeStrokeMask = 'linear-gradient(to right, transparent 0%, black 27.4%, black 74%, transparent 100%)';
646
+
647
+ // dotted strokes
648
+ var dottedStrokeMaskSmall = 'radial-gradient(circle at center, black 0.5px, transparent 0.6px)';
649
+ var dottedStrokeMaskMedium = 'radial-gradient(circle at center, black 1px, transparent 1.1px)';
650
+ var dottedStrokeMaskLarge = 'radial-gradient(circle at center, black 1.5px, transparent 1.6px)';
651
+
652
+ // sketch strokes
653
+ var sketchStrokePath = 'M0.00161171 1.0107C6.6387 1 9.94061 5.16958 16.6371 5.16958C23.3336 5.16958 26.5761 1.00913 33.2726 1.0107C39.3797 1.01213 42.4198 4.22998 48.5219 4.47643C55.9487 4.77638 59.8075 0.780687 67.2368 1.0107C73.6051 1.20786 76.8081 4.42122 83.1792 4.47643C89.815 4.53393 93.1788 1.06378 99.8147 1.0107C106.716 0.95549 110.244 4.6564 117.143 4.47643C123.248 4.31717 126.289 1.21517 132.393 1.0107C139.555 0.770735 143.25 4.64894 150.414 4.47643C156.784 4.32307 159.986 1.06591 166.357 1.0107C172.993 0.953195 176.356 4.47655 182.992 4.47643C189.628 4.47632 192.992 1.01007 199.628 1.01007C206.264 1.01007 209.627 4.47632 216.263 4.47643C222.899 4.47655 226.263 1.0107 232.899 1.0107';
654
+ var sketchStrokeMaskSmall = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 233 7'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1' d='".concat(sketchStrokePath, "'/%3E%3C/svg%3E\")");
655
+ var sketchStrokeMaskMedium = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 233 7'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' d='".concat(sketchStrokePath, "'/%3E%3C/svg%3E\")");
656
+ var sketchStrokeMaskLarge = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -1 233 8'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' d='".concat(sketchStrokePath, "'/%3E%3C/svg%3E\")");
657
+ var ruleWithAttrsStyles = css({
658
+ '& hr[data-color]': {
659
+ backgroundColor: 'var(--custom-palette-color)'
660
+ },
661
+ '& hr[data-style="dashed"]': {
662
+ maskImage: dashedStrokeMask,
663
+ maskRepeat: 'repeat-x',
664
+ maskSize: '10px 100%'
665
+ },
666
+ '& hr[data-style="dotted"]': {
667
+ maskImage: dottedStrokeMaskMedium,
668
+ maskPosition: 'center',
669
+ maskRepeat: 'repeat-x',
670
+ maskSize: '6px 2px'
671
+ },
672
+ '& hr[data-style="sketch"]': {
673
+ height: "calc(2px + ".concat("var(--ds-space-050, 4px)", " + ", "var(--ds-space-050, 4px)", ")"),
674
+ maskImage: sketchStrokeMaskMedium,
675
+ maskPosition: 'center',
676
+ maskRepeat: 'repeat-x',
677
+ maskSize: '233px 7px'
678
+ },
679
+ '& hr[data-style="fade"]': {
680
+ maskImage: fadeStrokeMask,
681
+ maskRepeat: 'no-repeat',
682
+ maskSize: '100% 100%'
683
+ },
684
+ '& hr[data-weight="1"]': {
685
+ height: '1px'
686
+ },
687
+ '& hr[data-weight="3"]': {
688
+ height: '3px'
689
+ },
690
+ '& hr[data-style="dotted"][data-weight="1"]': {
691
+ maskImage: dottedStrokeMaskSmall,
692
+ maskSize: '6px 1px'
693
+ },
694
+ '& hr[data-style="dotted"][data-weight="3"]': {
695
+ maskImage: dottedStrokeMaskLarge,
696
+ maskSize: '6px 3px'
697
+ },
698
+ // Sketch needs a mask per weight because CSS cannot change the SVG stroke width.
699
+ '& hr[data-style="sketch"][data-weight="1"]': {
700
+ height: "calc(1px + ".concat("var(--ds-space-050, 4px)", " + ", "var(--ds-space-050, 4px)", ")"),
701
+ maskImage: sketchStrokeMaskSmall
702
+ },
703
+ '& hr[data-style="sketch"][data-weight="3"]': {
704
+ height: "calc(3px + ".concat("var(--ds-space-050, 4px)", " + ", "var(--ds-space-050, 4px)", ")"),
705
+ maskImage: sketchStrokeMaskLarge,
706
+ maskSize: '233px 8px'
707
+ }
708
+ });
709
+
642
710
  // When cleaning up `platform_editor_content_mode_button_mvp` simplify the name/ use the other paragraph style name
643
711
  var paragraphSharedStylesWithEditorUGC = css({
644
712
  '& p': {
@@ -2301,7 +2369,7 @@ export var RendererStyleContainer = function RendererStyleContainer(props) {
2301
2369
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- CSS custom properties for UGC font tokens
2302
2370
  '--ak-renderer-editor-font-small-text': editorUGCTokensRefreshed['editor.font.body.small']
2303
2371
  },
2304
- css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, isExperimentEnabled('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2372
+ css: [expValEquals('confluence_ttvc_inline_extensions', 'isEnabled', true) ? baseFontStyle : originalBaseFontLineHeight, baseStyles, fontSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingAnchorStyles : headingAnchorStylesDuplicateAnchor, headingAnchorButtonFocusVisibleStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? hideHeadingCopyLinkWrapperStyles : hideHeadingCopyLinkWrapperStylesDuplicateAnchor, appearance === 'full-page' && isPreviewPanelResponsivenessOn && rendererFullPageStylesWithReducedPadding, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && rendererFullPageStyles, appearance === 'full-width' && (isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? rendererFullWidthStyles : oldRendererFullWidthStyles), (appearance === 'full-width' || appearance === 'max') && !isTableResizingEnabled(appearance) && rendererFullWidthStylesForTableResizing, appearance === 'max' && (isExperimentEnabled('platform_editor_remove_important_in_render_ext') ? rendererMaxWidthStyles : oldRendererMaxWidthStyles), rovoTelepointerStyles, whitespaceSharedStyles, blockquoteSharedStyles, headingsSharedStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingWrapperInlineFlowStyles, isExperimentEnabled('platform_editor_heading_link_target_size') && headingAnchorWrapperTargetSizeStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? headingWithAlignmentStyles : headingWithAlignmentStylesDuplicateAnchor, ruleSharedStyles, isExperimentEnabled('platform_editor_lovability_dividers_attributes') && ruleWithAttrsStyles, contentMode === 'compact' && extensionStyle, contentMode === 'compact' ? paragraphStylesUGCScaledMargin : paragraphSharedStylesWithEditorUGC, listsSharedStyles, browser.gecko && listsSharedStylesForGekko, listItemHiddenMarkerStyles, indentationSharedStyles, indentationSharedStylesWithMarginFix, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? blockMarksSharedStyles : blockMarksSharedStylesDuplicateAnchor, codeMarkSharedStyles, shadowSharedStyle, dateSharedStyle, textColorStyles, backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && highlightLinksUnsetStyles,
2305
2373
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
2306
2374
  textHighlightPaddingStyles, tasksAndDecisionsStyles, expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) && headingPanelStyles, smartCardStyles, smartCardStylesAvatarFix, headerSmartCardStyles, smartCardStylesAvatarMarginFix, smartCardStylesAvatarListZeroMarginTop, fg('editor_inline_comments_on_inline_nodes') && (expValEquals('confluence_fe_renderer_inline_node_mark_color_fix', 'isEnabled', true) ? rendererAnnotationStyles : rendererAnnotationStylesOld),
2307
2375
  // eslint-disable-next-line @atlaskit/platform/no-preconditioning
@@ -48,6 +48,7 @@ import { AnnotationsPositionContext, AnnotationsWrapper } from '../annotations';
48
48
  import { CollapsibleHeadingsProvider } from '../collapsible-headings';
49
49
  import { useScrollToBlock } from '../hooks/useScrollToBlock';
50
50
  import { RendererContext as ActionsContext, RendererActionsContext } from '../RendererActionsContext';
51
+ import { IncludeLegacyContentAnnotationsContext } from '../RendererActionsContext/include-legacy-content-annotations-context';
51
52
  import { Provider as SmartCardStorageProvider } from '../SmartCardStorage';
52
53
  import { getHeightInfoPayload, getWidthInfoPayload } from './analytics-utils';
53
54
  import { BreakoutSSRInlineScript } from './breakout-ssr';
@@ -69,7 +70,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
69
70
  var TABLE_INFO_TIMEOUT = 10000;
70
71
  var RENDER_EVENT_SAMPLE_RATE = 0.1;
71
72
  var packageName = "@atlaskit/renderer";
72
- var packageVersion = "152.2.1";
73
+ var packageVersion = "152.2.4";
73
74
  var setAsQueryContainerStyles = css({
74
75
  containerName: 'ak-renderer-wrapper',
75
76
  containerType: 'inline-size'
@@ -817,6 +818,7 @@ function RendererActionsInternalUpdater(_ref2) {
817
818
  onAnalyticsEvent = _ref2.onAnalyticsEvent;
818
819
  var rootRendererContextValue = React.useContext(RootRendererContext);
819
820
  var actions = useContext(ActionsContext);
821
+ var includeLegacyContentAnnotations = React.useContext(IncludeLegacyContentAnnotationsContext);
820
822
  var rendererRef = useRef(null);
821
823
 
822
824
  // This doc is used by the renderer actions when applying comments to the document.
@@ -830,14 +832,14 @@ function RendererActionsInternalUpdater(_ref2) {
830
832
  var _doc = rootRendererContextValue ? rootRendererContextValue.doc : doc;
831
833
  useLayoutEffect(function () {
832
834
  if (_doc) {
833
- actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent);
835
+ actions._privateRegisterRenderer(rendererRef, _doc, schema, onAnalyticsEvent, includeLegacyContentAnnotations);
834
836
  } else {
835
837
  actions._privateUnregisterRenderer();
836
838
  }
837
839
  return function () {
838
840
  return actions._privateUnregisterRenderer();
839
841
  };
840
- }, [actions, schema, _doc, onAnalyticsEvent]);
842
+ }, [actions, schema, _doc, onAnalyticsEvent, includeLegacyContentAnnotations]);
841
843
 
842
844
  // Memoised so nested renderers don't re-render on every root renderer render
843
845
  // when the doc itself is unchanged.
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export var IncludeLegacyContentAnnotationsContext = /*#__PURE__*/React.createContext(false);
@@ -6,15 +6,19 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents'
6
6
  import { EVENT_TYPE } from '@atlaskit/editor-common/analytics/types/enums';
7
7
  import { fg } from '@atlaskit/platform-feature-flags/fg';
8
8
  import RendererActions from '../../actions/index';
9
+ import { IncludeLegacyContentAnnotationsContext } from './include-legacy-content-annotations-context';
9
10
  export var RendererContext = /*#__PURE__*/React.createContext(new RendererActions());
10
11
  export function RendererActionsContext(_ref) {
11
12
  var children = _ref.children,
12
- context = _ref.context;
13
+ context = _ref.context,
14
+ includeLegacyContentAnnotations = _ref.includeLegacyContentAnnotations;
13
15
  var _useAnalyticsEvents = useAnalyticsEvents(),
14
16
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
15
17
  var actions = useMemo(function () {
16
18
  return new RendererActions(true);
17
19
  }, []);
20
+ var inheritedIncludeLegacyContentAnnotations = React.useContext(IncludeLegacyContentAnnotationsContext);
21
+ var shouldIncludeLegacyContentAnnotations = includeLegacyContentAnnotations !== null && includeLegacyContentAnnotations !== void 0 ? includeLegacyContentAnnotations : inheritedIncludeLegacyContentAnnotations;
18
22
 
19
23
  // Remove this eventually when root cause is assessed
20
24
  if (React.Children.count(children) > 1 && fg('confluence_frontend_fix_view_page_slo')) {
@@ -37,8 +41,10 @@ export function RendererActionsContext(_ref) {
37
41
  }).fire(FabricChannel.editor);
38
42
  }
39
43
  }
40
- return /*#__PURE__*/React.createElement(RendererContext.Provider, {
44
+ return /*#__PURE__*/React.createElement(IncludeLegacyContentAnnotationsContext.Provider, {
45
+ value: shouldIncludeLegacyContentAnnotations
46
+ }, /*#__PURE__*/React.createElement(RendererContext.Provider, {
41
47
  value: context || actions
42
- }, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children);
48
+ }, fg('confluence_frontend_fix_view_page_slo') ? React.Children.only(children) : children));
43
49
  }
44
50
  export var RendererActionsContextConsumer = RendererContext.Consumer;
@@ -58,8 +58,9 @@ export default class RendererActions implements RendererActionsOptions, Annotati
58
58
  private schema?;
59
59
  private ref?;
60
60
  private onAnalyticsEvent?;
61
+ private includeLegacyContentAnnotations;
61
62
  constructor(initFromContext?: boolean);
62
- _privateRegisterRenderer(ref: React.MutableRefObject<null>, doc: Node, schema: Schema, onAnalyticsEvent?: (event: AnalyticsEventPayload) => void): void;
63
+ _privateRegisterRenderer(ref: React.MutableRefObject<null>, doc: Node, schema: Schema, onAnalyticsEvent?: (event: AnalyticsEventPayload) => void, includeLegacyContentAnnotations?: boolean): void;
63
64
  _privateUnregisterRenderer(): void;
64
65
  /**
65
66
  * Validate whether we can create an annotation between two positions
@@ -1,2 +1,3 @@
1
1
  import React from 'react';
2
- export default function Rule(): React.JSX.Element;
2
+ import type { RuleAttributes } from '@atlaskit/adf-schema/rule';
3
+ export default function Rule({ color, localId, style, weight, }?: RuleAttributes): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const IncludeLegacyContentAnnotationsContext: React.Context<boolean>;
@@ -4,7 +4,8 @@ import RendererActions from '../../actions/index';
4
4
  export declare const RendererContext: React.Context<RendererActions>;
5
5
  type RendererActionsContextProps = PropsWithChildren<{
6
6
  context?: RendererActions;
7
+ includeLegacyContentAnnotations?: boolean;
7
8
  }>;
8
- export declare function RendererActionsContext({ children, context, }: RendererActionsContextProps): React.JSX.Element;
9
+ export declare function RendererActionsContext({ children, context, includeLegacyContentAnnotations, }: RendererActionsContextProps): React.JSX.Element;
9
10
  export declare const RendererActionsContextConsumer: React.Consumer<RendererActions>;
10
11
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/renderer",
3
- "version": "152.2.2",
3
+ "version": "152.2.4",
4
4
  "description": "Renderer component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/feature-gate-js-client": "^7.0.0",
54
54
  "@atlaskit/icon": "^38.0.0",
55
55
  "@atlaskit/link": "^5.1.0",
56
- "@atlaskit/link-datasource": "^7.5.0",
56
+ "@atlaskit/link-datasource": "^7.7.0",
57
57
  "@atlaskit/link-extractors": "^5.0.0",
58
58
  "@atlaskit/linking-common": "^13.0.0",
59
59
  "@atlaskit/media-card": "^82.1.0",
@@ -68,13 +68,13 @@
68
68
  "@atlaskit/platform-feature-flags-react": "^1.2.0",
69
69
  "@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
70
70
  "@atlaskit/react-compiler-gating": "^0.2.0",
71
- "@atlaskit/react-ufo": "^8.1.0",
72
- "@atlaskit/smart-card": "^46.7.0",
71
+ "@atlaskit/react-ufo": "^8.3.0",
72
+ "@atlaskit/smart-card": "^46.9.0",
73
73
  "@atlaskit/status": "^5.14.0",
74
74
  "@atlaskit/task-decision": "^21.13.0",
75
75
  "@atlaskit/theme": "^28.2.0",
76
- "@atlaskit/tmp-editor-statsig": "^246.0.0",
77
- "@atlaskit/tokens": "^20.7.0",
76
+ "@atlaskit/tmp-editor-statsig": "^246.1.0",
77
+ "@atlaskit/tokens": "^20.8.0",
78
78
  "@atlaskit/tooltip": "^24.4.0",
79
79
  "@atlaskit/visually-hidden": "^4.4.0",
80
80
  "@babel/runtime": "^7.0.0",
@@ -88,7 +88,7 @@
88
88
  "uuid": "^11.1.1"
89
89
  },
90
90
  "peerDependencies": {
91
- "@atlaskit/editor-common": "^133.6.0",
91
+ "@atlaskit/editor-common": "^133.7.0",
92
92
  "@atlaskit/link-provider": "^6.0.0",
93
93
  "@atlaskit/media-core": "^39.0.0",
94
94
  "react": "^18.2.0 || ^19.2.0",