@atlaskit/renderer 82.0.0 → 84.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +100 -0
- package/dist/cjs/actions/matches-utils.js +1 -1
- package/dist/cjs/analytics/enums.js +1 -1
- package/dist/cjs/analytics/events.js +1 -1
- package/dist/cjs/i18n/index.js +26 -26
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/messages.js +4 -4
- package/dist/cjs/react/index.js +32 -12
- package/dist/cjs/react/marks/annotation.js +1 -1
- package/dist/cjs/react/marks/breakout.js +1 -1
- package/dist/cjs/react/marks/code.js +26 -4
- package/dist/cjs/react/marks/fragment.js +21 -0
- package/dist/cjs/react/marks/index.js +28 -19
- package/dist/cjs/react/nodes/codeBlock.js +17 -3
- package/dist/cjs/react/nodes/codeBlockCopyButton.js +2 -2
- package/dist/cjs/react/nodes/copy-text-provider.js +1 -1
- package/dist/cjs/react/nodes/date.js +2 -2
- package/dist/cjs/react/nodes/doc.js +1 -1
- package/dist/cjs/react/nodes/extension.js +1 -1
- package/dist/cjs/react/nodes/heading-anchor.js +2 -2
- package/dist/cjs/react/nodes/heading.js +2 -4
- package/dist/cjs/react/nodes/index.js +31 -22
- package/dist/cjs/react/nodes/media.js +4 -2
- package/dist/cjs/react/nodes/mediaSingle/index.js +3 -3
- package/dist/cjs/react/nodes/panel.js +4 -6
- package/dist/cjs/react/nodes/table/colgroup.js +1 -1
- package/dist/cjs/react/nodes/table/sticky.js +1 -1
- package/dist/cjs/react/nodes/tableCell.js +1 -1
- package/dist/cjs/react/nodes/text-wrapper.js +5 -6
- package/dist/cjs/react/renderer-node.js +1 -1
- package/dist/cjs/react/utils/links.js +1 -1
- package/dist/cjs/renderer-context.js +1 -1
- package/dist/cjs/steps/index.js +2 -2
- package/dist/cjs/text/nodes/index.js +1 -1
- package/dist/cjs/ui/Expand.js +2 -2
- package/dist/cjs/ui/MediaCard.js +12 -6
- package/dist/cjs/ui/Renderer/breakout-ssr.js +1 -1
- package/dist/cjs/ui/Renderer/index.js +11 -11
- package/dist/cjs/ui/Renderer/style.js +2 -2
- package/dist/cjs/ui/RendererActionsContext/index.js +1 -1
- package/dist/cjs/ui/SortingIcon.js +2 -2
- package/dist/cjs/ui/active-header-id-provider.js +1 -1
- package/dist/cjs/ui/annotations/context.js +1 -1
- package/dist/cjs/ui/annotations/draft/component.js +7 -7
- package/dist/cjs/ui/annotations/draft/index.js +4 -4
- package/dist/cjs/ui/annotations/draft/text.js +1 -1
- package/dist/cjs/ui/annotations/hooks/index.js +8 -8
- package/dist/cjs/ui/annotations/hooks/use-events.js +4 -2
- package/dist/cjs/ui/annotations/index.js +5 -5
- package/dist/cjs/utils.js +2 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/messages.js +1 -1
- package/dist/es2019/react/index.js +29 -8
- package/dist/es2019/react/marks/code.js +15 -3
- package/dist/es2019/react/marks/fragment.js +10 -0
- package/dist/es2019/react/marks/index.js +4 -2
- package/dist/es2019/react/nodes/codeBlock.js +13 -3
- package/dist/es2019/react/nodes/codeBlockCopyButton.js +1 -1
- package/dist/es2019/react/nodes/date.js +1 -1
- package/dist/es2019/react/nodes/heading-anchor.js +1 -1
- package/dist/es2019/react/nodes/heading.js +2 -3
- package/dist/es2019/react/nodes/media.js +4 -2
- package/dist/es2019/react/nodes/mediaSingle/index.js +1 -1
- package/dist/es2019/react/nodes/panel.js +5 -6
- package/dist/es2019/react/nodes/text-wrapper.js +7 -6
- package/dist/es2019/ui/Expand.js +1 -1
- package/dist/es2019/ui/MediaCard.js +11 -5
- package/dist/es2019/ui/Renderer/index.js +10 -10
- package/dist/es2019/ui/Renderer/style.js +1 -1
- package/dist/es2019/ui/SortingIcon.js +1 -1
- package/dist/es2019/ui/annotations/draft/component.js +6 -6
- package/dist/es2019/ui/annotations/hooks/use-events.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/messages.js +1 -1
- package/dist/esm/react/index.js +31 -12
- package/dist/esm/react/marks/code.js +15 -3
- package/dist/esm/react/marks/fragment.js +10 -0
- package/dist/esm/react/marks/index.js +4 -2
- package/dist/esm/react/nodes/codeBlock.js +13 -3
- package/dist/esm/react/nodes/codeBlockCopyButton.js +1 -1
- package/dist/esm/react/nodes/date.js +1 -1
- package/dist/esm/react/nodes/heading-anchor.js +1 -1
- package/dist/esm/react/nodes/heading.js +2 -3
- package/dist/esm/react/nodes/media.js +4 -2
- package/dist/esm/react/nodes/mediaSingle/index.js +1 -1
- package/dist/esm/react/nodes/panel.js +5 -6
- package/dist/esm/react/nodes/text-wrapper.js +7 -6
- package/dist/esm/ui/Expand.js +1 -1
- package/dist/esm/ui/MediaCard.js +11 -5
- package/dist/esm/ui/Renderer/index.js +10 -10
- package/dist/esm/ui/Renderer/style.js +1 -1
- package/dist/esm/ui/SortingIcon.js +1 -1
- package/dist/esm/ui/annotations/draft/component.js +6 -6
- package/dist/esm/ui/annotations/hooks/use-events.js +3 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/react/index.d.ts +1 -0
- package/dist/types/react/marks/alignment.d.ts +1 -0
- package/dist/types/react/marks/annotation.d.ts +1 -0
- package/dist/types/react/marks/code.d.ts +15 -1
- package/dist/types/react/marks/data-consumer.d.ts +1 -0
- package/dist/types/react/marks/em.d.ts +1 -0
- package/dist/types/react/marks/fragment.d.ts +4 -0
- package/dist/types/react/marks/indentation.d.ts +1 -0
- package/dist/types/react/marks/index.d.ts +2 -1
- package/dist/types/react/marks/link.d.ts +1 -0
- package/dist/types/react/marks/strike.d.ts +1 -0
- package/dist/types/react/marks/strong.d.ts +1 -0
- package/dist/types/react/marks/subsup.d.ts +1 -0
- package/dist/types/react/marks/textColor.d.ts +1 -0
- package/dist/types/react/marks/underline.d.ts +1 -0
- package/dist/types/react/marks/unsupportedMark.d.ts +1 -0
- package/dist/types/react/marks/unsupportedNodeAttribute.d.ts +1 -0
- package/dist/types/react/nodes/blockCard.d.ts +1 -0
- package/dist/types/react/nodes/caption.d.ts +1 -0
- package/dist/types/react/nodes/codeBlock.d.ts +12 -3
- package/dist/types/react/nodes/codeBlockCopyButton.d.ts +3 -3
- package/dist/types/react/nodes/date.d.ts +3 -3
- package/dist/types/react/nodes/decisionItem.d.ts +1 -0
- package/dist/types/react/nodes/doc.d.ts +1 -0
- package/dist/types/react/nodes/embedCard.d.ts +1 -0
- package/dist/types/react/nodes/heading-anchor.d.ts +4 -4
- package/dist/types/react/nodes/heading.d.ts +1 -0
- package/dist/types/react/nodes/index.d.ts +8 -8
- package/dist/types/react/nodes/mediaSingle/index.d.ts +3 -3
- package/dist/types/react/nodes/paragraph.d.ts +1 -0
- package/dist/types/react/nodes/placeholder.d.ts +1 -0
- package/dist/types/react/nodes/rule.d.ts +1 -0
- package/dist/types/react/nodes/table/colgroup.d.ts +1 -0
- package/dist/types/react/nodes/text-wrapper.d.ts +3 -3
- package/dist/types/renderer-context.d.ts +3 -1
- package/dist/types/types/mediaOptions.d.ts +7 -1
- package/dist/types/ui/Expand.d.ts +3 -3
- package/dist/types/ui/MediaCard.d.ts +2 -0
- package/dist/types/ui/Renderer/breakout-ssr.d.ts +1 -0
- package/dist/types/ui/SortingIcon.d.ts +1 -0
- package/dist/types/ui/annotations/draft/component.d.ts +1 -1
- package/dist/types/ui/renderer-props.d.ts +1 -1
- package/package.json +23 -23
|
@@ -2,10 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React, { useContext, useLayoutEffect, useRef } from 'react';
|
|
4
4
|
import { PureComponent } from 'react';
|
|
5
|
-
import { IntlProvider } from 'react-intl';
|
|
6
5
|
import { getSchemaBasedOnStage } from '@atlaskit/adf-schema';
|
|
7
6
|
import { reduce } from '@atlaskit/adf-utils';
|
|
8
|
-
import { UnsupportedBlock, ProviderFactory, BaseTheme, WidthProvider, getAnalyticsAppearance, getAnalyticsEventSeverity, WithCreateAnalyticsEvent, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking } from '@atlaskit/editor-common';
|
|
7
|
+
import { UnsupportedBlock, ProviderFactory, BaseTheme, WidthProvider, getAnalyticsAppearance, getAnalyticsEventSeverity, WithCreateAnalyticsEvent, getResponseEndTime, startMeasure, stopMeasure, shouldForceTracking, IntlNextErrorBoundary, LegacyToNextIntlProvider, IntlLegacyFallbackProvider } from '@atlaskit/editor-common';
|
|
9
8
|
import { normalizeFeatureFlags } from '@atlaskit/editor-common/normalize-feature-flags';
|
|
10
9
|
import { akEditorFullPageDefaultFontSize } from '@atlaskit/editor-shared-styles';
|
|
11
10
|
import { IframeWidthObserverFallbackWrapper, IframeWrapperConsumer } from '@atlaskit/width-detector';
|
|
@@ -147,7 +146,7 @@ export class Renderer extends PureComponent {
|
|
|
147
146
|
const nextMedia = nextProps.media || {};
|
|
148
147
|
const media = this.props.media || {};
|
|
149
148
|
|
|
150
|
-
if (nextProps.portal !== this.props.portal || nextProps.appearance !== this.props.appearance || nextProps.stickyHeaders !== this.props.stickyHeaders || nextProps.disableActions !== this.props.disableActions || nextProps.
|
|
149
|
+
if (nextProps.portal !== this.props.portal || nextProps.appearance !== this.props.appearance || nextProps.stickyHeaders !== this.props.stickyHeaders || nextProps.disableActions !== this.props.disableActions || nextProps.allowCustomPanels !== this.props.allowCustomPanels || nextProps.allowHeadingAnchorLinks !== this.props.allowHeadingAnchorLinks || nextMedia.allowLinking !== media.allowLinking) {
|
|
151
150
|
this.serializer = new ReactSerializer(this.deriveSerializerProps(nextProps));
|
|
152
151
|
}
|
|
153
152
|
}
|
|
@@ -183,7 +182,7 @@ export class Renderer extends PureComponent {
|
|
|
183
182
|
surroundTextNodesWithTextWrapper: allowAnnotationsDraftMode,
|
|
184
183
|
media: props.media,
|
|
185
184
|
allowCopyToClipboard: props.allowCopyToClipboard,
|
|
186
|
-
allowCustomPanels: props.
|
|
185
|
+
allowCustomPanels: props.allowCustomPanels,
|
|
187
186
|
allowAnnotations: props.allowAnnotations,
|
|
188
187
|
allowSelectAllTrap: props.allowSelectAllTrap,
|
|
189
188
|
allowPlaceholderText: props.allowPlaceholderText
|
|
@@ -206,7 +205,7 @@ export class Renderer extends PureComponent {
|
|
|
206
205
|
allowPlaceholderText,
|
|
207
206
|
allowColumnSorting,
|
|
208
207
|
allowCopyToClipboard,
|
|
209
|
-
|
|
208
|
+
allowCustomPanels
|
|
210
209
|
} = this.props;
|
|
211
210
|
const allowNestedHeaderLinks = isNestedHeaderLinksEnabled(allowHeadingAnchorLinks);
|
|
212
211
|
/**
|
|
@@ -270,7 +269,7 @@ export class Renderer extends PureComponent {
|
|
|
270
269
|
value: this.featureFlags(this.props.featureFlags)
|
|
271
270
|
}, /*#__PURE__*/React.createElement(CopyTextProvider, null, /*#__PURE__*/React.createElement(ActiveHeaderIdProvider, {
|
|
272
271
|
value: getActiveHeadingId(allowHeadingAnchorLinks)
|
|
273
|
-
}, /*#__PURE__*/React.createElement(
|
|
272
|
+
}, /*#__PURE__*/React.createElement(LegacyToNextIntlProvider, null, /*#__PURE__*/React.createElement(IntlLegacyFallbackProvider, null, /*#__PURE__*/React.createElement(AnalyticsContext.Provider, {
|
|
274
273
|
value: {
|
|
275
274
|
fireAnalyticsEvent: event => this.fireAnalyticsEvent(event)
|
|
276
275
|
}
|
|
@@ -280,7 +279,7 @@ export class Renderer extends PureComponent {
|
|
|
280
279
|
allowNestedHeaderLinks: allowNestedHeaderLinks,
|
|
281
280
|
allowColumnSorting: allowColumnSorting,
|
|
282
281
|
allowCopyToClipboard: allowCopyToClipboard,
|
|
283
|
-
allowCustomPanels:
|
|
282
|
+
allowCustomPanels: allowCustomPanels,
|
|
284
283
|
allowPlaceholderText: allowPlaceholderText,
|
|
285
284
|
innerRef: this.editorRef,
|
|
286
285
|
onClick: handleWrapperOnClick,
|
|
@@ -291,7 +290,7 @@ export class Renderer extends PureComponent {
|
|
|
291
290
|
doc: pmDoc,
|
|
292
291
|
schema: schema,
|
|
293
292
|
onAnalyticsEvent: this.fireAnalyticsEvent
|
|
294
|
-
}, result))))))));
|
|
293
|
+
}, result)))))))));
|
|
295
294
|
return truncated ? /*#__PURE__*/React.createElement(TruncatedWrapper, {
|
|
296
295
|
height: maxHeight,
|
|
297
296
|
fadeHeight: fadeOutHeight
|
|
@@ -340,14 +339,15 @@ const RendererWithAnalytics = /*#__PURE__*/React.memo(props => /*#__PURE__*/Reac
|
|
|
340
339
|
}
|
|
341
340
|
}, /*#__PURE__*/React.createElement(WithCreateAnalyticsEvent, {
|
|
342
341
|
render: createAnalyticsEvent => {
|
|
342
|
+
// `IntlNextErrorBoundary` only captures Internationalisation errors, leaving others for `ErrorBoundary`.
|
|
343
343
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
344
344
|
component: ACTION_SUBJECT.RENDERER,
|
|
345
345
|
rethrowError: true,
|
|
346
346
|
fallbackComponent: null,
|
|
347
347
|
createAnalyticsEvent: createAnalyticsEvent
|
|
348
|
-
}, /*#__PURE__*/React.createElement(Renderer, _extends({}, props, {
|
|
348
|
+
}, /*#__PURE__*/React.createElement(IntlNextErrorBoundary, null, /*#__PURE__*/React.createElement(Renderer, _extends({}, props, {
|
|
349
349
|
createAnalyticsEvent: createAnalyticsEvent
|
|
350
|
-
})));
|
|
350
|
+
}))));
|
|
351
351
|
}
|
|
352
352
|
})));
|
|
353
353
|
const RendererWithIframeFallbackWrapper = /*#__PURE__*/React.memo(props => {
|
|
@@ -59,7 +59,7 @@ export const applyAnnotationOnText = ({
|
|
|
59
59
|
export const TextWithAnnotationDraft = ({
|
|
60
60
|
startPos,
|
|
61
61
|
endPos,
|
|
62
|
-
|
|
62
|
+
children
|
|
63
63
|
}) => {
|
|
64
64
|
const textPosition = React.useMemo(() => ({
|
|
65
65
|
start: startPos,
|
|
@@ -75,21 +75,21 @@ export const TextWithAnnotationDraft = ({
|
|
|
75
75
|
}, [nextDraftPosition, textPosition]);
|
|
76
76
|
|
|
77
77
|
if (shouldApplyAnnotationAt === false || !nextDraftPosition) {
|
|
78
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
78
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
if (shouldApplyAnnotationAt === InsertDraftPosition.AROUND_TEXT) {
|
|
82
82
|
return /*#__PURE__*/React.createElement(AnnotationDraft, {
|
|
83
83
|
key: 0,
|
|
84
84
|
draftPosition: nextDraftPosition
|
|
85
|
-
},
|
|
85
|
+
}, children);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
const offsets = calcTextSplitOffset(nextDraftPosition, textPosition,
|
|
89
|
-
const texts = splitText(
|
|
88
|
+
const offsets = calcTextSplitOffset(nextDraftPosition, textPosition, children);
|
|
89
|
+
const texts = splitText(children, offsets);
|
|
90
90
|
|
|
91
91
|
if (!texts) {
|
|
92
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
92
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
const components = applyAnnotationOnText({
|
|
@@ -20,8 +20,10 @@ export const useAnnotationStateByTypeEvent = ({
|
|
|
20
20
|
|
|
21
21
|
const nextStates = Object.values(payload).reduce((acc, curr) => {
|
|
22
22
|
if (curr.annotationType === type) {
|
|
23
|
+
// Check for empty state to prevent additional renders
|
|
24
|
+
const isEmpty = curr.state === null || curr.state === undefined;
|
|
23
25
|
return { ...acc,
|
|
24
|
-
[curr.id]: curr.state
|
|
26
|
+
[curr.id]: !isEmpty ? curr.state : states[curr.id]
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/messages.js
CHANGED
package/dist/esm/react/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import { getMarksByOrder, isSameMark, calcTableColumnWidths } from '@atlaskit/ed
|
|
|
19
19
|
import { getText } from '../utils';
|
|
20
20
|
import { findChildrenByType } from 'prosemirror-utils';
|
|
21
21
|
import { insideBreakoutLayout } from './renderer-node';
|
|
22
|
+
import { isCodeMark } from './marks/code';
|
|
22
23
|
|
|
23
24
|
function mergeMarks(marksAndNodes) {
|
|
24
25
|
return marksAndNodes.reduce(function (acc, markOrNode) {
|
|
@@ -144,13 +145,22 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
144
145
|
|
|
145
146
|
var extraProps = {
|
|
146
147
|
isInline: node === null || node === void 0 ? void 0 : node.isInline
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
var
|
|
148
|
+
}; // currently the only mark which has custom props is the code mark
|
|
149
|
+
|
|
150
|
+
var markSpecificProps = isCodeMark(mark) ? {
|
|
151
|
+
// The appearance being mobile indicates we are in an renderer being
|
|
152
|
+
// rendered by mobile bridge in a web view.
|
|
153
|
+
// The tooltip is likely to have unexpected behaviour there, with being cut
|
|
154
|
+
// off, so we disable it. This is also to keep the behaviour consistent with
|
|
155
|
+
// the rendering in the mobile Native Renderer.
|
|
156
|
+
codeBidiWarningTooltipEnabled: _this.appearance !== 'mobile'
|
|
157
|
+
} : {};
|
|
158
|
+
|
|
159
|
+
var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
150
160
|
eventHandlers: _this.eventHandlers,
|
|
151
161
|
fireAnalyticsEvent: _this.fireAnalyticsEvent,
|
|
152
162
|
markKey: key
|
|
153
|
-
}, otherAttrs), extraProps), {}, {
|
|
163
|
+
}, otherAttrs), extraProps), markSpecificProps), {}, {
|
|
154
164
|
dataAttributes: {
|
|
155
165
|
'data-renderer-mark': true
|
|
156
166
|
}
|
|
@@ -334,9 +344,8 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
334
344
|
return /*#__PURE__*/React.createElement(TextWrapperComponent, {
|
|
335
345
|
key: textKey,
|
|
336
346
|
startPos: startPos + parentDepth,
|
|
337
|
-
endPos: endPos + parentDepth
|
|
338
|
-
|
|
339
|
-
});
|
|
347
|
+
endPos: endPos + parentDepth
|
|
348
|
+
}, mark.text);
|
|
340
349
|
}
|
|
341
350
|
|
|
342
351
|
return mark.text || '';
|
|
@@ -421,7 +430,8 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
421
430
|
}, {
|
|
422
431
|
key: "getMediaProps",
|
|
423
432
|
value: function getMediaProps(node) {
|
|
424
|
-
var _this6 = this
|
|
433
|
+
var _this6 = this,
|
|
434
|
+
_this$media;
|
|
425
435
|
|
|
426
436
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
427
437
|
var link = node.type.schema.marks.link;
|
|
@@ -437,7 +447,8 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
437
447
|
isLinkMark: isLinkMark,
|
|
438
448
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
439
449
|
featureFlags: this.media && this.media.featureFlags,
|
|
440
|
-
shouldOpenMediaViewer: this.shouldOpenMediaViewer
|
|
450
|
+
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
451
|
+
ssr: (_this$media = this.media) === null || _this$media === void 0 ? void 0 : _this$media.ssr
|
|
441
452
|
});
|
|
442
453
|
}
|
|
443
454
|
}, {
|
|
@@ -464,13 +475,14 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
464
475
|
}, {
|
|
465
476
|
key: "getMediaGroupProps",
|
|
466
477
|
value: function getMediaGroupProps(node) {
|
|
467
|
-
var _this$
|
|
478
|
+
var _this$media2, _this$media3;
|
|
468
479
|
|
|
469
480
|
return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
|
|
470
481
|
shouldOpenMediaViewer: this.shouldOpenMediaViewer,
|
|
471
482
|
allowAltTextOnImages: this.allowAltTextOnImages,
|
|
472
483
|
featureFlags: this.media && this.media.featureFlags,
|
|
473
|
-
enableDownloadButton: (_this$
|
|
484
|
+
enableDownloadButton: (_this$media2 = this.media) === null || _this$media2 === void 0 ? void 0 : _this$media2.enableDownloadButton,
|
|
485
|
+
ssr: (_this$media3 = this.media) === null || _this$media3 === void 0 ? void 0 : _this$media3.ssr
|
|
474
486
|
});
|
|
475
487
|
}
|
|
476
488
|
}, {
|
|
@@ -504,8 +516,15 @@ var ReactSerializer = /*#__PURE__*/function () {
|
|
|
504
516
|
}, {
|
|
505
517
|
key: "getCodeBlockProps",
|
|
506
518
|
value: function getCodeBlockProps(node) {
|
|
519
|
+
// The appearance being mobile indicates we are in an renderer being
|
|
520
|
+
// rendered by mobile bridge in a web view.
|
|
521
|
+
// The tooltip is likely to have unexpected behaviour there, with being cut
|
|
522
|
+
// off, so we disable it. This is also to keep the behaviour consistent with
|
|
523
|
+
// the rendering in the mobile Native Renderer.
|
|
524
|
+
var codeBidiWarningTooltipEnabled = this.appearance !== 'mobile';
|
|
507
525
|
return _objectSpread(_objectSpread({}, this.getProps(node)), {}, {
|
|
508
|
-
text: node.textContent
|
|
526
|
+
text: node.textContent,
|
|
527
|
+
codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
|
|
509
528
|
});
|
|
510
529
|
}
|
|
511
530
|
}, {
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { injectIntl } from 'react-intl-next';
|
|
3
4
|
import AkCode from '@atlaskit/code/inline';
|
|
4
|
-
|
|
5
|
+
import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { useFeatureFlags } from '../../use-feature-flags';
|
|
7
|
+
export var isCodeMark = function isCodeMark(mark) {
|
|
8
|
+
return mark && mark.type && mark.type.name === 'code';
|
|
9
|
+
};
|
|
10
|
+
export function CodeWithIntl(props) {
|
|
11
|
+
var featureFlags = useFeatureFlags();
|
|
12
|
+
var codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
|
|
5
13
|
return /*#__PURE__*/React.createElement(AkCode, _extends({
|
|
6
|
-
className: "code"
|
|
14
|
+
className: "code",
|
|
15
|
+
codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
|
|
16
|
+
codeBidiWarningLabel: codeBidiWarningLabel,
|
|
17
|
+
codeBidiWarningTooltipEnabled: props.codeBidiWarningTooltipEnabled
|
|
7
18
|
}, props.dataAttributes), props.children);
|
|
8
|
-
}
|
|
19
|
+
}
|
|
20
|
+
export default injectIntl(CodeWithIntl);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export default function FragmentMark(props) {
|
|
4
|
+
var WrapperElement = props.isInline ? 'span' : 'div';
|
|
5
|
+
return /*#__PURE__*/React.createElement(WrapperElement, _extends({
|
|
6
|
+
"data-localId": props.localId,
|
|
7
|
+
"data-name": props.name,
|
|
8
|
+
"data-mark-type": "fragment"
|
|
9
|
+
}, props.dataAttributes), props.children);
|
|
10
|
+
}
|
|
@@ -12,6 +12,7 @@ import Indentation from './indentation';
|
|
|
12
12
|
import UnsupportedMark from './unsupportedMark';
|
|
13
13
|
import UnsupportedNodeAttribute from './unsupportedNodeAttribute';
|
|
14
14
|
import DataConsumer from './data-consumer';
|
|
15
|
+
import FragmentMark from './fragment';
|
|
15
16
|
import Annotation, { isAnnotationMark } from './annotation'; // Stage0
|
|
16
17
|
|
|
17
18
|
import ConfluenceInlineComment from './confluence-inline-comment';
|
|
@@ -32,9 +33,10 @@ export var markToReact = {
|
|
|
32
33
|
indentation: Indentation,
|
|
33
34
|
unsupportedMark: UnsupportedMark,
|
|
34
35
|
unsupportedNodeAttribute: UnsupportedNodeAttribute,
|
|
35
|
-
dataConsumer: DataConsumer
|
|
36
|
+
dataConsumer: DataConsumer,
|
|
37
|
+
fragment: FragmentMark
|
|
36
38
|
};
|
|
37
39
|
export var toReact = function toReact(mark) {
|
|
38
40
|
return markToReact[mark.type.name];
|
|
39
41
|
};
|
|
40
|
-
export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer };
|
|
42
|
+
export { Code, Em, Link, Strike, Strong, Subsup, TextColor, Underline, Breakout, Annotation, UnsupportedMark, isAnnotationMark, UnsupportedNodeAttribute, DataConsumer, FragmentMark };
|
|
@@ -3,19 +3,25 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import { injectIntl } from 'react-intl-next';
|
|
6
7
|
import styled from 'styled-components';
|
|
7
8
|
import { CodeBlock as AkCodeBlock } from '@atlaskit/code';
|
|
8
9
|
import { overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
9
10
|
import { N20, DN50 } from '@atlaskit/theme/colors';
|
|
10
11
|
import { themed } from '@atlaskit/theme/components';
|
|
11
12
|
import { fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
13
|
+
import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
|
|
14
|
+
import { useFeatureFlags } from '../../use-feature-flags';
|
|
12
15
|
import CopyButton from './codeBlockCopyButton';
|
|
13
16
|
|
|
14
17
|
function CodeBlock(props) {
|
|
15
18
|
var text = props.text,
|
|
16
19
|
language = props.language,
|
|
17
20
|
_props$allowCopyToCli = props.allowCopyToClipboard,
|
|
18
|
-
allowCopyToClipboard = _props$allowCopyToCli === void 0 ? false : _props$allowCopyToCli
|
|
21
|
+
allowCopyToClipboard = _props$allowCopyToCli === void 0 ? false : _props$allowCopyToCli,
|
|
22
|
+
codeBidiWarningTooltipEnabled = props.codeBidiWarningTooltipEnabled;
|
|
23
|
+
var featureFlags = useFeatureFlags();
|
|
24
|
+
var codeBidiWarningLabel = props.intl.formatMessage(codeBidiWarningMessages.label);
|
|
19
25
|
var className = ['code-block', props.className].join(' ');
|
|
20
26
|
return /*#__PURE__*/React.createElement("div", {
|
|
21
27
|
className: className
|
|
@@ -23,11 +29,15 @@ function CodeBlock(props) {
|
|
|
23
29
|
content: text
|
|
24
30
|
}) : null, /*#__PURE__*/React.createElement(AkCodeBlock, {
|
|
25
31
|
language: language,
|
|
26
|
-
text: text
|
|
32
|
+
text: text,
|
|
33
|
+
codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
|
|
34
|
+
codeBidiWarningLabel: codeBidiWarningLabel,
|
|
35
|
+
codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
|
|
27
36
|
}));
|
|
28
37
|
}
|
|
29
38
|
|
|
30
|
-
|
|
39
|
+
var IntlCodeBlock = injectIntl(CodeBlock);
|
|
40
|
+
export default styled(IntlCodeBlock)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n tab-size: 4;\n [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n background-image: ", ";\n background-attachment: local, scroll, scroll;\n background-position: 100% 0, 100% 0, 0 0;\n }\n"])), relativeFontSizeToBase16(fontSize()), overflowShadow({
|
|
31
41
|
background: themed({
|
|
32
42
|
light: N20,
|
|
33
43
|
dark: DN50
|
|
@@ -4,7 +4,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
4
4
|
var _templateObject;
|
|
5
5
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
|
-
import { injectIntl } from 'react-intl';
|
|
7
|
+
import { injectIntl } from 'react-intl-next';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
9
|
import Tooltip from '@atlaskit/tooltip';
|
|
10
10
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
@@ -11,7 +11,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { PureComponent } from 'react';
|
|
13
13
|
import { isPastDate, timestampToString, timestampToTaskContext, DateSharedCssClassName } from '@atlaskit/editor-common';
|
|
14
|
-
import { injectIntl } from 'react-intl';
|
|
14
|
+
import { injectIntl } from 'react-intl-next';
|
|
15
15
|
|
|
16
16
|
var Date = /*#__PURE__*/function (_PureComponent) {
|
|
17
17
|
_inherits(Date, _PureComponent);
|
|
@@ -22,7 +22,7 @@ import styled from 'styled-components';
|
|
|
22
22
|
import { N200, N500, B400 } from '@atlaskit/theme/colors';
|
|
23
23
|
import LinkIcon from '@atlaskit/icon/glyph/link';
|
|
24
24
|
import Tooltip from '@atlaskit/tooltip';
|
|
25
|
-
import { injectIntl } from 'react-intl';
|
|
25
|
+
import { injectIntl } from 'react-intl-next';
|
|
26
26
|
import { headingAnchorLinkMessages } from '../../messages';
|
|
27
27
|
export var HeadingAnchorWrapperClassName = 'heading-anchor-wrapper';
|
|
28
28
|
var CopyAnchorWrapperWithRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import HeadingAnchor from './heading-anchor';
|
|
4
|
-
import Url from 'url-parse';
|
|
5
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics/enums';
|
|
6
5
|
import AnalyticsContext from '../../analytics/analyticsContext';
|
|
7
6
|
import { CopyTextConsumer } from './copy-text-provider';
|
|
8
7
|
|
|
9
8
|
var getCurrentUrlWithHash = function getCurrentUrlWithHash() {
|
|
10
9
|
var hash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11
|
-
var url = new
|
|
12
|
-
url.
|
|
10
|
+
var url = new URL(window.location.href);
|
|
11
|
+
url.hash = encodeURIComponent(hash);
|
|
13
12
|
return url.href;
|
|
14
13
|
};
|
|
15
14
|
|
|
@@ -44,7 +44,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
44
44
|
alt = _this$props.alt,
|
|
45
45
|
featureFlags = _this$props.featureFlags,
|
|
46
46
|
allowMediaViewer = _this$props.shouldOpenMediaViewer,
|
|
47
|
-
enableDownloadButton = _this$props.enableDownloadButton
|
|
47
|
+
enableDownloadButton = _this$props.enableDownloadButton,
|
|
48
|
+
ssr = _this$props.ssr;
|
|
48
49
|
|
|
49
50
|
var linkMark = _this.props.marks.find(_this.props.isLinkMark);
|
|
50
51
|
|
|
@@ -59,7 +60,8 @@ var Media = /*#__PURE__*/function (_PureComponent) {
|
|
|
59
60
|
eventHandlers: eventHandlers,
|
|
60
61
|
alt: allowAltTextOnImages ? alt : undefined,
|
|
61
62
|
featureFlags: featureFlags,
|
|
62
|
-
shouldEnableDownloadButton: enableDownloadButton
|
|
63
|
+
shouldEnableDownloadButton: enableDownloadButton,
|
|
64
|
+
ssr: ssr
|
|
63
65
|
}));
|
|
64
66
|
return linkHref ? /*#__PURE__*/React.createElement(MediaLink, {
|
|
65
67
|
href: linkHref,
|
|
@@ -14,7 +14,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
14
14
|
import { mapBreakpointToLayoutMaxWidth, WidthConsumer } from '@atlaskit/editor-common';
|
|
15
15
|
import { akEditorFullWidthLayoutWidth, getAkEditorFullPageMaxWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
16
16
|
import { Component, default as React } from 'react';
|
|
17
|
-
import { injectIntl } from 'react-intl';
|
|
17
|
+
import { injectIntl } from 'react-intl-next';
|
|
18
18
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
19
19
|
import { ExtendedUIMediaSingle } from './styles';
|
|
20
20
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
@@ -17,17 +17,16 @@ import EmojiItem from './emoji'; // AFP-2532 TODO: Fix automatic suppressions be
|
|
|
17
17
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
18
18
|
|
|
19
19
|
import { themed } from '@atlaskit/theme';
|
|
20
|
+
import { getPanelBackgroundDarkModeColors } from '@atlaskit/editor-common';
|
|
20
21
|
var PanelStyled = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (props) {
|
|
21
22
|
if (props['data-panel-type'] !== PanelType.CUSTOM || !props.backgroundColor) {
|
|
22
23
|
return '';
|
|
23
|
-
}
|
|
24
|
+
} // Similar to mainDynamicStyles()
|
|
24
25
|
|
|
25
|
-
var border = themed({
|
|
26
|
-
light: 'none',
|
|
27
|
-
dark: "1px solid rgba(255, 255, 255, 0.4)"
|
|
28
|
-
})(props); // Similar to mainDynamicStyles()
|
|
29
26
|
|
|
30
|
-
return "\n &[data-panel-type=".concat(PanelType.CUSTOM, "] {\n background-color: ").concat(props.backgroundColor, ";\n
|
|
27
|
+
return "\n &[data-panel-type=".concat(PanelType.CUSTOM, "] {\n background-color: ").concat(props.backgroundColor, ";\n ").concat(themed({
|
|
28
|
+
dark: getPanelBackgroundDarkModeColors
|
|
29
|
+
}), ";\n }\n ");
|
|
31
30
|
});
|
|
32
31
|
var panelIcons = {
|
|
33
32
|
info: InfoIcon,
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextWithAnnotationDraft } from '../../ui/annotations';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var TextWrapper = function TextWrapper(props) {
|
|
4
5
|
var startPos = props.startPos,
|
|
5
6
|
endPos = props.endPos;
|
|
6
|
-
var
|
|
7
|
+
var children = props.children;
|
|
7
8
|
|
|
8
|
-
if (!
|
|
9
|
+
if (!children) {
|
|
9
10
|
return null;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
return /*#__PURE__*/React.createElement(TextWithAnnotationDraft, {
|
|
13
|
-
text: text,
|
|
14
14
|
startPos: startPos,
|
|
15
15
|
endPos: endPos
|
|
16
|
-
});
|
|
17
|
-
}
|
|
16
|
+
}, children);
|
|
17
|
+
};
|
|
18
|
+
|
|
18
19
|
export default TextWrapper;
|
package/dist/esm/ui/Expand.js
CHANGED
|
@@ -13,7 +13,7 @@ import { expandMessages, sharedExpandStyles, WidthProvider, ExpandIconWrapper, E
|
|
|
13
13
|
import { akEditorLineHeight, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
14
14
|
import { PLATFORM, MODE } from '../analytics/events';
|
|
15
15
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '../analytics/enums';
|
|
16
|
-
import { injectIntl } from 'react-intl';
|
|
16
|
+
import { injectIntl } from 'react-intl-next';
|
|
17
17
|
import { ActiveHeaderIdConsumer } from './active-header-id-provider';
|
|
18
18
|
import _uniqueId from 'lodash/uniqueId';
|
|
19
19
|
var Title = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n outline: none;\n border: none;\n font-size: ", ";\n line-height: ", ";\n font-weight: normal;\n display: flex;\n flex: 1;\n margin: 0;\n padding: 0 0 0 ", "px;\n text-align: left;\n"])), relativeFontSizeToBase16(fontSize()), akEditorLineHeight, gridSize() / 2);
|
package/dist/esm/ui/MediaCard.js
CHANGED
|
@@ -262,7 +262,8 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
262
262
|
imageStatus = _this$props4.imageStatus,
|
|
263
263
|
disableOverlay = _this$props4.disableOverlay,
|
|
264
264
|
alt = _this$props4.alt,
|
|
265
|
-
featureFlags = _this$props4.featureFlags
|
|
265
|
+
featureFlags = _this$props4.featureFlags,
|
|
266
|
+
ssr = _this$props4.ssr;
|
|
266
267
|
|
|
267
268
|
if (imageStatus === 'loading' || !url) {
|
|
268
269
|
return this.renderLoadingCard();
|
|
@@ -287,7 +288,8 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
287
288
|
mediaViewerDataSource: {
|
|
288
289
|
list: Array.from(mediaIdentifierMap.values())
|
|
289
290
|
},
|
|
290
|
-
featureFlags: featureFlags
|
|
291
|
+
featureFlags: featureFlags,
|
|
292
|
+
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
291
293
|
});
|
|
292
294
|
}
|
|
293
295
|
/**
|
|
@@ -302,7 +304,7 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
302
304
|
value: function render() {
|
|
303
305
|
var _this$state = this.state,
|
|
304
306
|
contextIdentifierProvider = _this$state.contextIdentifierProvider,
|
|
305
|
-
|
|
307
|
+
mediaClientConfigInState = _this$state.mediaClientConfig,
|
|
306
308
|
fileState = _this$state.fileState;
|
|
307
309
|
var _this$props5 = this.props,
|
|
308
310
|
id = _this$props5.id,
|
|
@@ -318,7 +320,8 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
318
320
|
originalDimensions = _this$props5.originalDimensions,
|
|
319
321
|
forceOpenMediaViewer = _this$props5.shouldOpenMediaViewer,
|
|
320
322
|
featureFlags = _this$props5.featureFlags,
|
|
321
|
-
shouldEnableDownloadButton = _this$props5.shouldEnableDownloadButton
|
|
323
|
+
shouldEnableDownloadButton = _this$props5.shouldEnableDownloadButton,
|
|
324
|
+
ssr = _this$props5.ssr;
|
|
322
325
|
var isMobile = rendererAppearance === 'mobile';
|
|
323
326
|
var shouldPlayInline = useInlinePlayer !== undefined ? useInlinePlayer : true;
|
|
324
327
|
var isInlinePlayer = isMobile ? false : shouldPlayInline;
|
|
@@ -333,6 +336,8 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
333
336
|
return null;
|
|
334
337
|
}
|
|
335
338
|
|
|
339
|
+
var mediaClientConfig = !!ssr ? ssr.config : mediaClientConfigInState;
|
|
340
|
+
|
|
336
341
|
if (!mediaClientConfig || !id) {
|
|
337
342
|
return this.renderLoadingCard();
|
|
338
343
|
}
|
|
@@ -374,7 +379,8 @@ export var MediaCardInternal = /*#__PURE__*/function (_Component) {
|
|
|
374
379
|
list: Array.from(mediaIdentifierMap.values())
|
|
375
380
|
},
|
|
376
381
|
featureFlags: featureFlags,
|
|
377
|
-
shouldEnableDownloadButton: shouldEnableDownloadButton
|
|
382
|
+
shouldEnableDownloadButton: shouldEnableDownloadButton,
|
|
383
|
+
ssr: ssr === null || ssr === void 0 ? void 0 : ssr.mode
|
|
378
384
|
}));
|
|
379
385
|
}
|
|
380
386
|
}]);
|