@atlaskit/renderer 112.6.11 → 112.6.13
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 +16 -0
- package/dist/cjs/actions/index.js +1 -0
- package/dist/cjs/react/marks/link.js +4 -1
- package/dist/cjs/ui/Renderer/index.js +350 -9
- package/dist/es2019/actions/index.js +1 -0
- package/dist/es2019/react/marks/link.js +4 -1
- package/dist/es2019/ui/Renderer/index.js +349 -10
- package/dist/esm/actions/index.js +1 -0
- package/dist/esm/react/marks/link.js +4 -1
- package/dist/esm/ui/Renderer/index.js +351 -10
- package/package.json +9 -3
|
@@ -4,7 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
* @jsxRuntime classic
|
|
5
5
|
* @jsx jsx
|
|
6
6
|
*/
|
|
7
|
-
import React, { Fragment, useContext, useLayoutEffect, useRef, PureComponent } from 'react';
|
|
7
|
+
import React, { Fragment, useContext, useLayoutEffect, useRef, PureComponent, useCallback, useMemo, useEffect } from 'react';
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
|
|
@@ -45,7 +45,7 @@ import { countNodes } from './count-nodes';
|
|
|
45
45
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
46
46
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
47
47
|
const packageName = "@atlaskit/renderer";
|
|
48
|
-
const packageVersion = "112.6.
|
|
48
|
+
const packageVersion = "112.6.13";
|
|
49
49
|
const setAsQueryContainerStyles = css({
|
|
50
50
|
containerName: 'ak-renderer-wrapper',
|
|
51
51
|
containerType: 'inline-size',
|
|
@@ -56,6 +56,7 @@ export const defaultNodeComponents = nodeToReact;
|
|
|
56
56
|
/**
|
|
57
57
|
* Exported due to enzyme test reliance on this component.
|
|
58
58
|
*/
|
|
59
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
59
60
|
export class __RendererClassComponent extends PureComponent {
|
|
60
61
|
constructor(props) {
|
|
61
62
|
super(props);
|
|
@@ -418,6 +419,341 @@ export class __RendererClassComponent extends PureComponent {
|
|
|
418
419
|
}
|
|
419
420
|
}
|
|
420
421
|
}
|
|
422
|
+
const handleMouseTripleClickInTables = event => {
|
|
423
|
+
var _parentElement3, _parentElement4;
|
|
424
|
+
if (browser.ios || browser.android) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
const badBrowser = browser.chrome || browser.safari;
|
|
428
|
+
const tripleClick = event.detail >= 3;
|
|
429
|
+
if (!(badBrowser && tripleClick)) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
const selection = window.getSelection();
|
|
433
|
+
if (!selection) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
const {
|
|
437
|
+
type,
|
|
438
|
+
anchorNode,
|
|
439
|
+
focusNode
|
|
440
|
+
} = selection;
|
|
441
|
+
const rangeSelection = Boolean(type === 'Range' && anchorNode && focusNode);
|
|
442
|
+
if (!rangeSelection) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
const target = event.target;
|
|
446
|
+
const tableCell = target.closest('td,th');
|
|
447
|
+
const clickedInCell = Boolean(tableCell);
|
|
448
|
+
if (!clickedInCell) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const anchorInCell = tableCell.contains(anchorNode);
|
|
452
|
+
const focusInCell = tableCell.contains(focusNode);
|
|
453
|
+
const selectionStartsOrEndsOutsideClickedCell = !(anchorInCell && focusInCell);
|
|
454
|
+
if (!selectionStartsOrEndsOutsideClickedCell) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Ensure that selecting text in the renderer doesn't trigger onUnhandledClick
|
|
459
|
+
// This logic originated in jira-frontend:
|
|
460
|
+
// src/packages/issue/issue-view/src/views/field/rich-text/rich-text-inline-edit-view.js
|
|
461
|
+
|
|
462
|
+
// The selection is required to be checked in `onMouseDown` and here. If not here, a new
|
|
463
|
+
// selection isn't reported; if not in `onMouseDown`, a click outside the selection will
|
|
464
|
+
// return an empty selection, which will erroneously fire onUnhandledClick.
|
|
465
|
+
|
|
466
|
+
const elementToSelect = anchorInCell ? (_parentElement3 = anchorNode.parentElement) === null || _parentElement3 === void 0 ? void 0 : _parentElement3.closest('div,p') : focusInCell ? (_parentElement4 = focusNode.parentElement) === null || _parentElement4 === void 0 ? void 0 : _parentElement4.closest('div,p') : tableCell;
|
|
467
|
+
if (elementToSelect) {
|
|
468
|
+
selection.selectAllChildren(elementToSelect);
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Handle clicks inside renderer. If the click isn't on media, in the media picker, or on a
|
|
474
|
+
* link, call the onUnhandledClick eventHandler (which in Jira for example, may switch the
|
|
475
|
+
* renderer out for the editor).
|
|
476
|
+
* @param event Click event anywhere inside renderer
|
|
477
|
+
*/
|
|
478
|
+
const handleWrapperOnClick = (event, props, mouseDownSelection) => {
|
|
479
|
+
var _props$eventHandlers;
|
|
480
|
+
const targetElement = event.target;
|
|
481
|
+
handleMouseTripleClickInTables(event);
|
|
482
|
+
|
|
483
|
+
// ED-14862: When a user triple clicks to select a line of content inside a
|
|
484
|
+
// a table cell, but the browser incorrectly moves the selection start or end into
|
|
485
|
+
// a different table cell, we manually set the selection back to within the original
|
|
486
|
+
// table cell the user intended to target
|
|
487
|
+
if (!((_props$eventHandlers = props.eventHandlers) !== null && _props$eventHandlers !== void 0 && _props$eventHandlers.onUnhandledClick)) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
if (!(targetElement instanceof window.Element)) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
const rendererWrapper = event.currentTarget;
|
|
494
|
+
const isInteractiveElementInTree = findInTree(targetElement, rendererWrapper, isInteractiveElement);
|
|
495
|
+
if (isInteractiveElementInTree) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// Ensure that selecting text in the renderer doesn't trigger onUnhandledClick
|
|
500
|
+
// This logic originated in jira-frontend:
|
|
501
|
+
// src/packages/issue/issue-view/src/views/field/rich-text/rich-text-inline-edit-view.js
|
|
502
|
+
|
|
503
|
+
// The selection is required to be checked in `onMouseDown` and here. If not here, a new
|
|
504
|
+
// selection isn't reported; if not in `onMouseDown`, a click outside the selection will
|
|
505
|
+
// return an empty selection, which will erroneously fire onUnhandledClick.
|
|
506
|
+
const windowSelection = window.getSelection();
|
|
507
|
+
const selection = windowSelection !== null ? windowSelection.toString() : undefined;
|
|
508
|
+
const hasSelection = selection && selection.length !== 0;
|
|
509
|
+
const hasSelectionMouseDown = mouseDownSelection.current && mouseDownSelection.current.length !== 0;
|
|
510
|
+
const allowEditBasedOnSelection = !hasSelection && !hasSelectionMouseDown;
|
|
511
|
+
if (allowEditBasedOnSelection) {
|
|
512
|
+
props.eventHandlers.onUnhandledClick(event);
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
const RendererFunctionalComponent = props => {
|
|
516
|
+
let mouseDownSelection = useRef(undefined);
|
|
517
|
+
const providerFactory = useMemo(() => props.dataProviders || new ProviderFactory(), [props.dataProviders]);
|
|
518
|
+
const createRendererContext = useMemo(() => (featureFlags, isTopLevelRenderer) => {
|
|
519
|
+
const normalizedFeatureFlags = normalizeFeatureFlags(featureFlags);
|
|
520
|
+
return {
|
|
521
|
+
featureFlags: normalizedFeatureFlags,
|
|
522
|
+
isTopLevelRenderer: isTopLevelRenderer === undefined
|
|
523
|
+
};
|
|
524
|
+
}, []);
|
|
525
|
+
const fireAnalyticsEvent = useCallback(event => {
|
|
526
|
+
const {
|
|
527
|
+
createAnalyticsEvent
|
|
528
|
+
} = props;
|
|
529
|
+
if (createAnalyticsEvent) {
|
|
530
|
+
const channel = FabricChannel.editor;
|
|
531
|
+
createAnalyticsEvent(event).fire(channel);
|
|
532
|
+
}
|
|
533
|
+
}, [props]);
|
|
534
|
+
const deriveSerializerProps = useCallback(props => {
|
|
535
|
+
const stickyHeaders = props.stickyHeaders ? props.stickyHeaders === true ? {} : props.stickyHeaders : undefined;
|
|
536
|
+
const {
|
|
537
|
+
annotationProvider
|
|
538
|
+
} = props;
|
|
539
|
+
const allowAnnotationsDraftMode = Boolean(annotationProvider && annotationProvider.inlineComment && annotationProvider.inlineComment.allowDraftMode);
|
|
540
|
+
const {
|
|
541
|
+
featureFlags
|
|
542
|
+
} = createRendererContext(props.featureFlags, props.isTopLevelRenderer);
|
|
543
|
+
return {
|
|
544
|
+
startPos: props.startPos,
|
|
545
|
+
providers: providerFactory,
|
|
546
|
+
eventHandlers: props.eventHandlers,
|
|
547
|
+
extensionHandlers: props.extensionHandlers,
|
|
548
|
+
portal: props.portal,
|
|
549
|
+
objectContext: {
|
|
550
|
+
adDoc: props.document,
|
|
551
|
+
schema: props.schema,
|
|
552
|
+
...props.rendererContext
|
|
553
|
+
},
|
|
554
|
+
appearance: props.appearance,
|
|
555
|
+
disableHeadingIDs: props.disableHeadingIDs,
|
|
556
|
+
disableActions: props.disableActions,
|
|
557
|
+
allowHeadingAnchorLinks: props.allowHeadingAnchorLinks,
|
|
558
|
+
allowColumnSorting: props.allowColumnSorting,
|
|
559
|
+
fireAnalyticsEvent: fireAnalyticsEvent,
|
|
560
|
+
shouldOpenMediaViewer: props.shouldOpenMediaViewer,
|
|
561
|
+
allowAltTextOnImages: props.allowAltTextOnImages,
|
|
562
|
+
stickyHeaders,
|
|
563
|
+
allowMediaLinking: props.media && props.media.allowLinking,
|
|
564
|
+
surroundTextNodesWithTextWrapper: allowAnnotationsDraftMode,
|
|
565
|
+
media: props.media,
|
|
566
|
+
emojiResourceConfig: props.emojiResourceConfig,
|
|
567
|
+
smartLinks: props.smartLinks,
|
|
568
|
+
allowCopyToClipboard: props.allowCopyToClipboard,
|
|
569
|
+
allowWrapCodeBlock: props.allowWrapCodeBlock,
|
|
570
|
+
allowCustomPanels: props.allowCustomPanels,
|
|
571
|
+
allowAnnotations: props.allowAnnotations,
|
|
572
|
+
allowSelectAllTrap: props.allowSelectAllTrap,
|
|
573
|
+
allowPlaceholderText: props.allowPlaceholderText,
|
|
574
|
+
nodeComponents: props.nodeComponents,
|
|
575
|
+
allowWindowedCodeBlock: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.allowWindowedCodeBlock,
|
|
576
|
+
isInsideOfInlineExtension: props.isInsideOfInlineExtension,
|
|
577
|
+
textHighlighter: props.UNSTABLE_textHighlighter,
|
|
578
|
+
allowTableAlignment: props.UNSTABLE_allowTableAlignment,
|
|
579
|
+
allowTableResizing: props.UNSTABLE_allowTableResizing
|
|
580
|
+
};
|
|
581
|
+
}, [createRendererContext, providerFactory, fireAnalyticsEvent]);
|
|
582
|
+
const serializer = useMemo(() => {
|
|
583
|
+
var _props$startPos;
|
|
584
|
+
return new ReactSerializer(deriveSerializerProps({
|
|
585
|
+
...props,
|
|
586
|
+
startPos: (_props$startPos = props.startPos) !== null && _props$startPos !== void 0 ? _props$startPos : 0
|
|
587
|
+
}));
|
|
588
|
+
}, [deriveSerializerProps, props]);
|
|
589
|
+
const localRef = useRef(null);
|
|
590
|
+
const editorRef = props.innerRef || localRef;
|
|
591
|
+
const id = useMemo(() => uuid(), []);
|
|
592
|
+
const renderedMeasurementDistortedDurationMonitor = useMemo(() => getDistortedDurationMonitor(), []);
|
|
593
|
+
|
|
594
|
+
// we are doing this to ensure it runs as
|
|
595
|
+
// early as possible in the React lifecycle
|
|
596
|
+
// to avoid any other side effects
|
|
597
|
+
const measureStarted = useRef(false);
|
|
598
|
+
const startAnalyticsMeasure = () => {
|
|
599
|
+
startMeasure(`Renderer Render Time: ${id}`);
|
|
600
|
+
};
|
|
601
|
+
if (!measureStarted.current) {
|
|
602
|
+
startAnalyticsMeasure();
|
|
603
|
+
measureStarted.current = true;
|
|
604
|
+
}
|
|
605
|
+
const anchorLinkAnalytics = useCallback(() => {
|
|
606
|
+
const hash = window.location.hash && decodeURIComponent(window.location.hash.slice(1));
|
|
607
|
+
const disableHeadingIDs = props.disableHeadingIDs;
|
|
608
|
+
if (!disableHeadingIDs && hash && editorRef && editorRef.current instanceof HTMLElement) {
|
|
609
|
+
const anchorLinkElement = document.getElementById(hash);
|
|
610
|
+
if (anchorLinkElement && editorRef.current.contains(anchorLinkElement)) {
|
|
611
|
+
fireAnalyticsEvent({
|
|
612
|
+
action: ACTION.VIEWED,
|
|
613
|
+
actionSubject: ACTION_SUBJECT.ANCHOR_LINK,
|
|
614
|
+
attributes: {
|
|
615
|
+
platform: PLATFORM.WEB,
|
|
616
|
+
mode: MODE.RENDERER
|
|
617
|
+
},
|
|
618
|
+
eventType: EVENT_TYPE.UI
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}, [props.disableHeadingIDs, editorRef, fireAnalyticsEvent]);
|
|
623
|
+
const getSchema = useMemo(() => {
|
|
624
|
+
return (schema, adfStage) => {
|
|
625
|
+
if (schema) {
|
|
626
|
+
return schema;
|
|
627
|
+
}
|
|
628
|
+
return getSchemaBasedOnStage(adfStage);
|
|
629
|
+
};
|
|
630
|
+
}, []);
|
|
631
|
+
const onMouseDownEditView = () => {
|
|
632
|
+
const windowSelection = window.getSelection();
|
|
633
|
+
mouseDownSelection.current = windowSelection !== null ? windowSelection.toString() : undefined;
|
|
634
|
+
};
|
|
635
|
+
const {
|
|
636
|
+
dataProviders,
|
|
637
|
+
analyticsEventSeverityTracking
|
|
638
|
+
} = props;
|
|
639
|
+
useEffect(() => {
|
|
640
|
+
let rafID;
|
|
641
|
+
const handleAnalytics = () => {
|
|
642
|
+
fireAnalyticsEvent({
|
|
643
|
+
action: ACTION.STARTED,
|
|
644
|
+
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
645
|
+
attributes: {
|
|
646
|
+
platform: PLATFORM.WEB
|
|
647
|
+
},
|
|
648
|
+
eventType: EVENT_TYPE.UI
|
|
649
|
+
});
|
|
650
|
+
rafID = requestAnimationFrame(() => {
|
|
651
|
+
stopMeasure(`Renderer Render Time: ${id}`, duration => {
|
|
652
|
+
var _analyticsEventSeveri3, _analyticsEventSeveri4;
|
|
653
|
+
const forceSeverityTracking = typeof analyticsEventSeverityTracking === 'undefined' && shouldForceTracking();
|
|
654
|
+
const severity = !!forceSeverityTracking || analyticsEventSeverityTracking !== null && analyticsEventSeverityTracking !== void 0 && analyticsEventSeverityTracking.enabled ? getAnalyticsEventSeverity(duration, (_analyticsEventSeveri3 = analyticsEventSeverityTracking === null || analyticsEventSeverityTracking === void 0 ? void 0 : analyticsEventSeverityTracking.severityNormalThreshold) !== null && _analyticsEventSeveri3 !== void 0 ? _analyticsEventSeveri3 : NORMAL_SEVERITY_THRESHOLD, (_analyticsEventSeveri4 = analyticsEventSeverityTracking === null || analyticsEventSeverityTracking === void 0 ? void 0 : analyticsEventSeverityTracking.severityDegradedThreshold) !== null && _analyticsEventSeveri4 !== void 0 ? _analyticsEventSeveri4 : DEGRADED_SEVERITY_THRESHOLD) : undefined;
|
|
655
|
+
const isTTRTrackingExplicitlyDisabled = (analyticsEventSeverityTracking === null || analyticsEventSeverityTracking === void 0 ? void 0 : analyticsEventSeverityTracking.enabled) === false;
|
|
656
|
+
if (!isTTRTrackingExplicitlyDisabled) {
|
|
657
|
+
fireAnalyticsEvent({
|
|
658
|
+
action: ACTION.RENDERED,
|
|
659
|
+
actionSubject: ACTION_SUBJECT.RENDERER,
|
|
660
|
+
attributes: {
|
|
661
|
+
platform: PLATFORM.WEB,
|
|
662
|
+
duration,
|
|
663
|
+
distortedDuration: renderedMeasurementDistortedDurationMonitor.distortedDuration,
|
|
664
|
+
ttfb: getResponseEndTime(),
|
|
665
|
+
nodes: countNodes(props.document),
|
|
666
|
+
severity
|
|
667
|
+
},
|
|
668
|
+
eventType: EVENT_TYPE.OPERATIONAL
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
renderedMeasurementDistortedDurationMonitor.cleanup();
|
|
672
|
+
});
|
|
673
|
+
anchorLinkAnalytics();
|
|
674
|
+
});
|
|
675
|
+
};
|
|
676
|
+
handleAnalytics();
|
|
677
|
+
return () => {
|
|
678
|
+
if (rafID) {
|
|
679
|
+
window.cancelAnimationFrame(rafID);
|
|
680
|
+
}
|
|
681
|
+
if (dataProviders) {
|
|
682
|
+
providerFactory.destroy();
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
// we are going to ignore this because I'm doing this on purpose
|
|
686
|
+
// having a dependency array means we run stopMeasure twice per render
|
|
687
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
688
|
+
}, []);
|
|
689
|
+
try {
|
|
690
|
+
var _createRendererContex, _props$media;
|
|
691
|
+
const schema = getSchema(props.schema, props.adfStage);
|
|
692
|
+
const {
|
|
693
|
+
result,
|
|
694
|
+
stat,
|
|
695
|
+
pmDoc
|
|
696
|
+
} = renderDocument(props.document, serializer, schema, props.adfStage, props.useSpecBasedValidator, id, fireAnalyticsEvent, props.unsupportedContentLevelsTracking, props.appearance, props.includeNodesCountInStats);
|
|
697
|
+
if (props.onComplete) {
|
|
698
|
+
props.onComplete(stat);
|
|
699
|
+
}
|
|
700
|
+
const rendererOutput = jsx(RendererContextProvider, {
|
|
701
|
+
value: createRendererContext(props.featureFlags, props.isTopLevelRenderer)
|
|
702
|
+
}, jsx(ActiveHeaderIdProvider, {
|
|
703
|
+
value: getActiveHeadingId(props.allowHeadingAnchorLinks)
|
|
704
|
+
}, jsx(AnalyticsContext.Provider, {
|
|
705
|
+
value: {
|
|
706
|
+
fireAnalyticsEvent: event => fireAnalyticsEvent(event)
|
|
707
|
+
}
|
|
708
|
+
}, jsx(SmartCardStorageProvider, null, jsx(ProviderFactoryProvider, {
|
|
709
|
+
value: providerFactory
|
|
710
|
+
}, jsx(RendererWrapper, {
|
|
711
|
+
allowAnnotations: props.allowAnnotations,
|
|
712
|
+
appearance: props.appearance,
|
|
713
|
+
allowNestedHeaderLinks: isNestedHeaderLinksEnabled(props.allowHeadingAnchorLinks),
|
|
714
|
+
allowColumnSorting: props.allowColumnSorting,
|
|
715
|
+
allowCopyToClipboard: props.allowCopyToClipboard,
|
|
716
|
+
allowWrapCodeBlock: props.allowWrapCodeBlock,
|
|
717
|
+
allowCustomPanels: props.allowCustomPanels,
|
|
718
|
+
allowPlaceholderText: props.allowPlaceholderText,
|
|
719
|
+
useBlockRenderForCodeBlock: (_createRendererContex = createRendererContext(props.featureFlags, props.isTopLevelRenderer).featureFlags.useBlockRenderForCodeBlock) !== null && _createRendererContex !== void 0 ? _createRendererContex : true,
|
|
720
|
+
addTelepointer: props.addTelepointer,
|
|
721
|
+
innerRef: editorRef,
|
|
722
|
+
onClick: event => handleWrapperOnClick(event, props, mouseDownSelection),
|
|
723
|
+
onMouseDown: onMouseDownEditView,
|
|
724
|
+
ssr: (_props$media = props.media) === null || _props$media === void 0 ? void 0 : _props$media.ssr,
|
|
725
|
+
isInsideOfInlineExtension: props.isInsideOfInlineExtension,
|
|
726
|
+
isTopLevelRenderer: createRendererContext(props.featureFlags, props.isTopLevelRenderer).isTopLevelRenderer
|
|
727
|
+
}, props.enableSsrInlineScripts ? jsx(BreakoutSSRInlineScript, null) : null, jsx(RendererActionsInternalUpdater, {
|
|
728
|
+
doc: pmDoc,
|
|
729
|
+
schema: schema,
|
|
730
|
+
onAnalyticsEvent: fireAnalyticsEvent
|
|
731
|
+
}, result)))))));
|
|
732
|
+
let rendererResult = props.truncated ? jsx(TruncatedWrapper, {
|
|
733
|
+
height: props.maxHeight,
|
|
734
|
+
fadeHeight: props.fadeOutHeight
|
|
735
|
+
}, rendererOutput) : rendererOutput;
|
|
736
|
+
return jsx(Fragment, null, rendererResult);
|
|
737
|
+
} catch (e) {
|
|
738
|
+
var _createRendererContex2;
|
|
739
|
+
if (props.onError) {
|
|
740
|
+
props.onError(e);
|
|
741
|
+
}
|
|
742
|
+
return jsx(RendererWrapper, {
|
|
743
|
+
allowAnnotations: props.allowAnnotations,
|
|
744
|
+
appearance: props.appearance,
|
|
745
|
+
allowCopyToClipboard: props.allowCopyToClipboard,
|
|
746
|
+
allowWrapCodeBlock: props.allowWrapCodeBlock,
|
|
747
|
+
allowPlaceholderText: props.allowPlaceholderText,
|
|
748
|
+
allowColumnSorting: props.allowColumnSorting,
|
|
749
|
+
allowNestedHeaderLinks: isNestedHeaderLinksEnabled(props.allowHeadingAnchorLinks),
|
|
750
|
+
useBlockRenderForCodeBlock: (_createRendererContex2 = createRendererContext(props.featureFlags, props.isTopLevelRenderer).featureFlags.useBlockRenderForCodeBlock) !== null && _createRendererContex2 !== void 0 ? _createRendererContex2 : true,
|
|
751
|
+
addTelepointer: props.addTelepointer,
|
|
752
|
+
onClick: event => handleWrapperOnClick(event, props, mouseDownSelection),
|
|
753
|
+
isTopLevelRenderer: createRendererContext(props.featureFlags, props.isTopLevelRenderer).isTopLevelRenderer
|
|
754
|
+
}, jsx(UnsupportedBlock, null));
|
|
755
|
+
}
|
|
756
|
+
};
|
|
421
757
|
export function Renderer(props) {
|
|
422
758
|
const {
|
|
423
759
|
startPos
|
|
@@ -425,13 +761,15 @@ export function Renderer(props) {
|
|
|
425
761
|
const {
|
|
426
762
|
isTopLevelRenderer
|
|
427
763
|
} = useRendererContext();
|
|
428
|
-
return (
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
764
|
+
return fg('platform_editor_react18_renderer') ? jsx(RendererFunctionalComponent, _extends({}, props, {
|
|
765
|
+
startPos: startPos,
|
|
766
|
+
isTopLevelRenderer: isTopLevelRenderer
|
|
767
|
+
})) :
|
|
768
|
+
// eslint-disable-next-line react/jsx-pascal-case
|
|
769
|
+
jsx(__RendererClassComponent, _extends({}, props, {
|
|
770
|
+
startPos: startPos,
|
|
771
|
+
isTopLevelRenderer: isTopLevelRenderer
|
|
772
|
+
}));
|
|
435
773
|
}
|
|
436
774
|
|
|
437
775
|
// Usage notes:
|
|
@@ -481,7 +819,7 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
|
|
|
481
819
|
return telepointer;
|
|
482
820
|
};
|
|
483
821
|
const initialUpdate = React.useRef(true);
|
|
484
|
-
|
|
822
|
+
useEffect(() => {
|
|
485
823
|
// We must check if window is defined, if it isn't we are in a SSR environment
|
|
486
824
|
// and we don't want to add the telepointer
|
|
487
825
|
if (typeof window !== 'undefined' && addTelepointer && innerRef !== null && innerRef !== void 0 && innerRef.current) {
|
|
@@ -634,5 +972,6 @@ const RendererWithAnnotationSelection = props => {
|
|
|
634
972
|
}))));
|
|
635
973
|
};
|
|
636
974
|
|
|
975
|
+
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
|
|
637
976
|
/* @deprecated using this version of the renderer causes the RendererActions to inaccessible from any consumers */
|
|
638
977
|
export default RendererWithAnnotationSelection;
|
|
@@ -10,6 +10,7 @@ import { B400, B300, B500 } from '@atlaskit/theme/colors';
|
|
|
10
10
|
import { getEventHandler } from '../../utils';
|
|
11
11
|
import { PLATFORM, MODE } from '../../analytics/events';
|
|
12
12
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import LinkUrl from '@atlaskit/smart-card/link-url';
|
|
14
15
|
import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
15
16
|
var anchorStyles = css({
|
|
@@ -68,5 +69,7 @@ export default function Link(props) {
|
|
|
68
69
|
handler(e, href);
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
|
-
}, anchorProps, dataAttributes
|
|
72
|
+
}, anchorProps, dataAttributes, fg('platform_editor_hyperlink_underline') && {
|
|
73
|
+
isLinkComponent: true
|
|
74
|
+
}), props.children));
|
|
72
75
|
}
|