@atlaskit/editor-common 68.0.2 → 69.1.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 +42 -0
- package/codemods/69.0.0-update-validator-imports.ts +7 -0
- package/codemods/migrates/entry-points.ts +37 -0
- package/dist/cjs/styles/index.js +15 -1
- package/dist/cjs/styles/shared/code-block.js +58 -0
- package/dist/cjs/styles/shared/emoji.js +2 -1
- package/dist/cjs/styles/shared/panel.js +2 -1
- package/dist/cjs/ui/Mention/mention-with-profilecard.js +4 -2
- package/dist/cjs/ui/Popup/index.js +38 -1
- package/dist/cjs/ui/clear-next-sibling-margin-top.js +11 -4
- package/dist/cjs/ui/index.js +6 -0
- package/dist/cjs/utils/browser.js +4 -0
- package/dist/cjs/utils/index.js +0 -56
- package/dist/cjs/utils/performance/measure-render.js +52 -5
- package/dist/cjs/validator.js +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/styles/index.js +2 -1
- package/dist/es2019/styles/shared/code-block.js +94 -0
- package/dist/es2019/styles/shared/emoji.js +3 -2
- package/dist/es2019/styles/shared/panel.js +2 -1
- package/dist/es2019/ui/Mention/mention-with-profilecard.js +1 -1
- package/dist/es2019/ui/Popup/index.js +24 -1
- package/dist/es2019/ui/clear-next-sibling-margin-top.js +9 -1
- package/dist/es2019/ui/index.js +1 -1
- package/dist/es2019/utils/browser.js +4 -0
- package/dist/es2019/utils/index.js +0 -1
- package/dist/es2019/utils/performance/measure-render.js +52 -5
- package/dist/es2019/validator.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/styles/index.js +2 -1
- package/dist/esm/styles/shared/code-block.js +39 -0
- package/dist/esm/styles/shared/emoji.js +3 -2
- package/dist/esm/styles/shared/panel.js +2 -1
- package/dist/esm/ui/Mention/mention-with-profilecard.js +1 -1
- package/dist/esm/ui/Popup/index.js +40 -1
- package/dist/esm/ui/clear-next-sibling-margin-top.js +8 -2
- package/dist/esm/ui/index.js +1 -1
- package/dist/esm/utils/browser.js +4 -0
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/performance/measure-render.js +52 -5
- package/dist/esm/validator.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/provider-factory/card-provider.d.ts +1 -1
- package/dist/types/styles/index.d.ts +1 -0
- package/dist/types/styles/shared/code-block.d.ts +8 -0
- package/dist/types/styles/shared/emoji.d.ts +1 -0
- package/dist/types/styles/shared/panel.d.ts +1 -0
- package/dist/types/ui/Popup/index.d.ts +4 -0
- package/dist/types/ui/clear-next-sibling-margin-top.d.ts +1 -0
- package/dist/types/ui/index.d.ts +1 -1
- package/dist/types/utils/browser.d.ts +1 -12
- package/dist/types/utils/index.d.ts +0 -2
- package/dist/types/utils/performance/measure-render.d.ts +28 -1
- package/dist/types/validator.d.ts +1 -1
- package/package.json +12 -11
- package/report.api.md +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { akEditorCodeFontFamily, akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { DN20, DN400, DN50, DN800, N20, N30, N400, N800 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { themed } from '@atlaskit/theme/components';
|
|
5
|
+
import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
6
|
+
import { token } from '@atlaskit/tokens';
|
|
7
|
+
export const CodeBlockSharedCssClassName = {
|
|
8
|
+
CODEBLOCK_CONTAINER: 'code-block',
|
|
9
|
+
CODEBLOCK_LINE_NUMBER_GUTTER: 'line-number-gutter',
|
|
10
|
+
CODEBLOCK_CONTENT: 'code-content',
|
|
11
|
+
DS_CODEBLOCK: '[data-ds--code--code-block]'
|
|
12
|
+
};
|
|
13
|
+
export const codeBlockSharedStyles = props => css`
|
|
14
|
+
.${CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER} {
|
|
15
|
+
position: relative;
|
|
16
|
+
background-color: ${themed({
|
|
17
|
+
light: token('color.background.neutral', N20),
|
|
18
|
+
dark: token('color.background.neutral', DN50)
|
|
19
|
+
})(props)};
|
|
20
|
+
border-radius: ${borderRadius()}px;
|
|
21
|
+
counter-reset: line;
|
|
22
|
+
display: flex;
|
|
23
|
+
overflow-x: auto;
|
|
24
|
+
|
|
25
|
+
background-image: ${overflowShadow({
|
|
26
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-4118
|
|
27
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
28
|
+
background: themed({
|
|
29
|
+
light: N20,
|
|
30
|
+
dark: DN50
|
|
31
|
+
})(props),
|
|
32
|
+
width: '8px'
|
|
33
|
+
})};
|
|
34
|
+
|
|
35
|
+
--ds--code--bg-color: transparent;
|
|
36
|
+
|
|
37
|
+
background-repeat: no-repeat;
|
|
38
|
+
background-attachment: local, scroll, scroll;
|
|
39
|
+
background-size: 8px 100%, 8px 100%, 8px 100%;
|
|
40
|
+
background-position: 100% 0, 100% 0, 0 0;
|
|
41
|
+
font-family: ${akEditorCodeFontFamily};
|
|
42
|
+
margin: ${blockNodesVerticalMargin} 0 0 0;
|
|
43
|
+
min-width: ${akEditorTableCellMinWidth}px;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
|
|
46
|
+
.${CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER} {
|
|
47
|
+
flex-shrink: 0;
|
|
48
|
+
text-align: right;
|
|
49
|
+
background-color: ${themed({
|
|
50
|
+
light: token('color.background.neutral', N30),
|
|
51
|
+
dark: token('color.background.neutral', DN20)
|
|
52
|
+
})(props)};
|
|
53
|
+
padding: ${gridSize()}px;
|
|
54
|
+
|
|
55
|
+
span {
|
|
56
|
+
display: block;
|
|
57
|
+
line-height: 0;
|
|
58
|
+
font-size: 0;
|
|
59
|
+
|
|
60
|
+
::before {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
content: counter(line);
|
|
63
|
+
counter-increment: line;
|
|
64
|
+
color: ${themed({
|
|
65
|
+
light: token('color.text.subtlest', N400),
|
|
66
|
+
dark: token('color.text.subtlest', DN400)
|
|
67
|
+
})(props)};
|
|
68
|
+
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
69
|
+
line-height: 1.5rem;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.${CodeBlockSharedCssClassName.CODEBLOCK_CONTENT} {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex: 1;
|
|
77
|
+
|
|
78
|
+
code {
|
|
79
|
+
flex-grow: 1;
|
|
80
|
+
tab-size: 4;
|
|
81
|
+
cursor: text;
|
|
82
|
+
color: ${themed({
|
|
83
|
+
light: token('color.text', N800),
|
|
84
|
+
dark: token('color.text', DN800)
|
|
85
|
+
})(props)};
|
|
86
|
+
border-radius: ${borderRadius()}px;
|
|
87
|
+
margin: ${gridSize()}px;
|
|
88
|
+
white-space: pre;
|
|
89
|
+
font-size: ${relativeFontSizeToBase16(fontSize())};
|
|
90
|
+
line-height: 1.5rem;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { emojiImage, emojiNode, emojiSprite } from '@atlaskit/emoji';
|
|
1
|
+
import { emojiImage, emojiNode, emojiPlaceholder, emojiSprite } from '@atlaskit/emoji';
|
|
2
2
|
export const EmojiSharedCssClassName = {
|
|
3
3
|
EMOJI_CONTAINER: 'emojiView-content-wrap',
|
|
4
4
|
EMOJI_NODE: emojiNode,
|
|
5
5
|
EMOJI_SPRITE: emojiSprite,
|
|
6
|
-
EMOJI_IMAGE: emojiImage
|
|
6
|
+
EMOJI_IMAGE: emojiImage,
|
|
7
|
+
EMOJI_PLACEHOLDER: emojiPlaceholder
|
|
7
8
|
};
|
|
@@ -138,7 +138,8 @@ export const PanelSharedSelectors = {
|
|
|
138
138
|
emojiPopup: `[aria-label="Popup"]`,
|
|
139
139
|
searchEmoji: `[aria-label="Search emoji"]`,
|
|
140
140
|
orangeWarningIcon: `[aria-label=":warning:"]`,
|
|
141
|
-
yellowWarningIcon: `[aria-label=":warning:"] span:nth-child(1)
|
|
141
|
+
yellowWarningIcon: `[aria-label=":warning:"] span:nth-child(1)`,
|
|
142
|
+
copyButton: `button[aria-label="Copy"]`
|
|
142
143
|
};
|
|
143
144
|
|
|
144
145
|
const iconDynamicStyles = panelType => props => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { ResourcedMention } from '@atlaskit/mention';
|
|
3
|
-
import
|
|
3
|
+
import ProfileCardTrigger from '@atlaskit/profilecard/user';
|
|
4
4
|
export default function MentionWithProfileCard({
|
|
5
5
|
id,
|
|
6
6
|
text,
|
|
@@ -10,6 +10,8 @@ export default class Popup extends React.Component {
|
|
|
10
10
|
|
|
11
11
|
super(...args);
|
|
12
12
|
|
|
13
|
+
_defineProperty(this, "rafIds", new Set());
|
|
14
|
+
|
|
13
15
|
_defineProperty(this, "state", {
|
|
14
16
|
validPosition: true
|
|
15
17
|
});
|
|
@@ -24,7 +26,27 @@ export default class Popup extends React.Component {
|
|
|
24
26
|
this.initPopup(popup);
|
|
25
27
|
});
|
|
26
28
|
|
|
27
|
-
_defineProperty(this, "
|
|
29
|
+
_defineProperty(this, "cancelRequestAnimationFrames", () => {
|
|
30
|
+
for (const rafId of this.rafIds) {
|
|
31
|
+
cancelAnimationFrame(rafId);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
_defineProperty(this, "scheduledUpdatePosition", rafSchedule(props => {
|
|
36
|
+
if (!this.props.waitForExtraLayoutUpdates) {
|
|
37
|
+
this.updatePosition(this.props);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (this.props.scheduleExtraLayoutUpdates) {
|
|
41
|
+
// We need two requestAnimationFrame calls to ensure reflow/repaints
|
|
42
|
+
// are flushed to DOM before our popup position recalculations happen
|
|
43
|
+
const rafId = requestAnimationFrame(() => {
|
|
44
|
+
this.updatePosition(this.props);
|
|
45
|
+
this.rafIds.delete(rafId);
|
|
46
|
+
});
|
|
47
|
+
this.rafIds.add(rafId);
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
28
50
|
|
|
29
51
|
_defineProperty(this, "onResize", () => this.scheduledUpdatePosition(this.props));
|
|
30
52
|
|
|
@@ -182,6 +204,7 @@ export default class Popup extends React.Component {
|
|
|
182
204
|
}
|
|
183
205
|
|
|
184
206
|
this.scheduledUpdatePosition.cancel();
|
|
207
|
+
this.cancelRequestAnimationFrames();
|
|
185
208
|
}
|
|
186
209
|
|
|
187
210
|
renderPopup() {
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { css } from '@emotion/react'; // We use !important to ensure next sibling gets the margin reset no matter what
|
|
2
2
|
|
|
3
|
+
const marginTopReset = `margin-top: 0 !important;`;
|
|
3
4
|
export const clearNextSiblingMarginTopStyle = css`
|
|
4
5
|
& + * {
|
|
5
|
-
|
|
6
|
+
${marginTopReset}
|
|
7
|
+
}
|
|
8
|
+
`;
|
|
9
|
+
const textElements = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
10
|
+
const nextSiblingBlockMarkContentSelectors = textElements.map(elem => `+ .fabric-editor-block-mark > ${elem}`).join(',');
|
|
11
|
+
export const clearNextSiblingBlockMarkMarginTopStyle = css`
|
|
12
|
+
${nextSiblingBlockMarkContentSelectors} {
|
|
13
|
+
${marginTopReset}
|
|
6
14
|
}
|
|
7
15
|
`;
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -14,5 +14,5 @@ export { shadowObserverClassNames, ShadowObserver } from './OverflowShadow/shado
|
|
|
14
14
|
export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
|
|
15
15
|
export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef } from './Expand';
|
|
16
16
|
export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
|
|
17
|
-
export { clearNextSiblingMarginTopStyle } from './clear-next-sibling-margin-top';
|
|
17
|
+
export { clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from './clear-next-sibling-margin-top';
|
|
18
18
|
export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
|
|
@@ -3,12 +3,14 @@ const result = {
|
|
|
3
3
|
ie: false,
|
|
4
4
|
ie_version: 0,
|
|
5
5
|
gecko: false,
|
|
6
|
+
gecko_version: 0,
|
|
6
7
|
chrome: false,
|
|
7
8
|
chrome_version: 0,
|
|
8
9
|
android: false,
|
|
9
10
|
ios: false,
|
|
10
11
|
webkit: false,
|
|
11
12
|
safari: false,
|
|
13
|
+
safari_version: 0,
|
|
12
14
|
supportsIntersectionObserver: false,
|
|
13
15
|
supportsResizeObserver: false
|
|
14
16
|
};
|
|
@@ -21,12 +23,14 @@ if (typeof navigator !== 'undefined') {
|
|
|
21
23
|
let ie = result.ie = !!(ieUpTo10 || ie11up || ieEdge);
|
|
22
24
|
result.ie_version = ieUpTo10 ? document.documentMode || 6 : ie11up ? +ie11up[1] : ieEdge ? +ieEdge[1] : null;
|
|
23
25
|
result.gecko = !ie && /gecko\/\d/i.test(navigator.userAgent);
|
|
26
|
+
result.gecko_version = parseInt((navigator.userAgent.match(/Firefox\/(\d+)/) || [])[1], 10);
|
|
24
27
|
result.chrome = !ie && /Chrome\//.test(navigator.userAgent);
|
|
25
28
|
result.chrome_version = parseInt((navigator.userAgent.match(/Chrome\/(\d+)/) || [])[1], 10);
|
|
26
29
|
result.android = /Android \d/.test(navigator.userAgent);
|
|
27
30
|
result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
|
|
28
31
|
result.webkit = !ie && !!document.documentElement && 'WebkitAppearance' in document.documentElement.style;
|
|
29
32
|
result.safari = Boolean(navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') === -1 && navigator.userAgent.indexOf('FxiOS') === -1);
|
|
33
|
+
result.safari_version = parseInt((navigator.userAgent.match(/Version\/([0-9\._]+).*Safari/) || [])[1], 10);
|
|
30
34
|
result.supportsIntersectionObserver = typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype;
|
|
31
35
|
result.supportsResizeObserver = typeof window !== 'undefined' && 'ResizeObserver' in window && 'ResizeObserverEntry' in window;
|
|
32
36
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from './annotation';
|
|
2
2
|
export { getExtensionLozengeData } from './macro';
|
|
3
|
-
export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder } from './validator';
|
|
4
3
|
export { default as browser } from './browser';
|
|
5
4
|
export { default as ErrorReporter } from './error-reporter';
|
|
6
5
|
export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC } from './date';
|
|
@@ -13,7 +13,23 @@ import { isPerformanceAPIAvailable } from './is-performance-api-available';
|
|
|
13
13
|
* | startMark + scheduling rAF | | rAF callback, endMark
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export function measureRender(
|
|
16
|
+
export function measureRender(
|
|
17
|
+
/**
|
|
18
|
+
* Unique name for the measurement
|
|
19
|
+
*
|
|
20
|
+
* Important: if multiple measureRender events are fired at the same time
|
|
21
|
+
* with the same measure name -- the result will not be correct.
|
|
22
|
+
*/
|
|
23
|
+
measureName,
|
|
24
|
+
/**
|
|
25
|
+
* Call back fired when the measurement completes.
|
|
26
|
+
*
|
|
27
|
+
* Note: when this function is called when the Document.visibilityState is not
|
|
28
|
+
* visible -- the duration is likely to be misleading/inaccurate. This is due
|
|
29
|
+
* to the measurements use of the `requestAnimationFrame` api which only fires
|
|
30
|
+
* when the Document.visibilityState is visible.
|
|
31
|
+
*/
|
|
32
|
+
onMeasureComplete) {
|
|
17
33
|
if (!isPerformanceAPIAvailable()) {
|
|
18
34
|
return;
|
|
19
35
|
}
|
|
@@ -21,10 +37,29 @@ export function measureRender(measureName, onMeasureComplete) {
|
|
|
21
37
|
const startMark = `[START]: ${measureName}`;
|
|
22
38
|
const endMark = `[END]: ${measureName}`;
|
|
23
39
|
const startTime = performance.now();
|
|
24
|
-
performance.mark(startMark);
|
|
40
|
+
performance.mark(startMark); // If an editor is rendered when the document is not visible -- the callback passed to
|
|
41
|
+
// requestAnimationFrame will not fire until the document becomes visible again.
|
|
42
|
+
//
|
|
43
|
+
// For the purposes of using performance measurement -- this behaviour means the events
|
|
44
|
+
// which have been fired in the background are not useful -- and lead to other events
|
|
45
|
+
// being hard to draw conclusions from.
|
|
46
|
+
//
|
|
47
|
+
// To mitigate this -- we detect this state -- and fire a seperate callback when the
|
|
48
|
+
// measurement has occured when the render was in the backgroun
|
|
49
|
+
|
|
50
|
+
let distortedDuration = document.visibilityState !== 'visible';
|
|
51
|
+
|
|
52
|
+
function handleVisibilityChange() {
|
|
53
|
+
if (document.visibilityState !== 'visible') {
|
|
54
|
+
distortedDuration = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
25
59
|
requestAnimationFrame(() => {
|
|
26
60
|
requestAnimationFrame(() => {
|
|
27
61
|
performance.mark(endMark);
|
|
62
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
28
63
|
const duration = performance.now() - startTime;
|
|
29
64
|
|
|
30
65
|
try {
|
|
@@ -32,12 +67,24 @@ export function measureRender(measureName, onMeasureComplete) {
|
|
|
32
67
|
const entry = performance.getEntriesByName(measureName).pop();
|
|
33
68
|
|
|
34
69
|
if (!entry) {
|
|
35
|
-
onMeasureComplete(
|
|
70
|
+
onMeasureComplete({
|
|
71
|
+
duration,
|
|
72
|
+
startTime,
|
|
73
|
+
distortedDuration
|
|
74
|
+
});
|
|
36
75
|
} else {
|
|
37
|
-
onMeasureComplete(
|
|
76
|
+
onMeasureComplete({
|
|
77
|
+
duration: entry.duration,
|
|
78
|
+
startTime: entry.startTime,
|
|
79
|
+
distortedDuration
|
|
80
|
+
});
|
|
38
81
|
}
|
|
39
82
|
} catch (e) {
|
|
40
|
-
onMeasureComplete(
|
|
83
|
+
onMeasureComplete({
|
|
84
|
+
duration,
|
|
85
|
+
startTime,
|
|
86
|
+
distortedDuration
|
|
87
|
+
});
|
|
41
88
|
}
|
|
42
89
|
|
|
43
90
|
performance.clearMeasures(measureName);
|
package/dist/es2019/validator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder } from './utils/validator';
|
|
1
|
+
export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder, ADFStages } from './utils/validator';
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/styles/index.js
CHANGED
|
@@ -17,4 +17,5 @@ export { shadowSharedStyle } from './shared/shadow';
|
|
|
17
17
|
export { dateSharedStyle, DateSharedCssClassName } from './shared/date';
|
|
18
18
|
export { tasksAndDecisionsStyles, TaskDecisionSharedCssClassName } from './shared/task-decision';
|
|
19
19
|
export { StatusSharedCssClassName } from './shared/status';
|
|
20
|
-
export { smartCardSharedStyles, SmartCardSharedCssClassName } from './shared/smart-card';
|
|
20
|
+
export { smartCardSharedStyles, SmartCardSharedCssClassName } from './shared/smart-card';
|
|
21
|
+
export { CodeBlockSharedCssClassName, codeBlockSharedStyles } from './shared/code-block';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
|
+
import { akEditorCodeFontFamily, akEditorTableCellMinWidth, blockNodesVerticalMargin, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { DN20, DN400, DN50, DN800, N20, N30, N400, N800 } from '@atlaskit/theme/colors';
|
|
8
|
+
import { themed } from '@atlaskit/theme/components';
|
|
9
|
+
import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
|
|
10
|
+
import { token } from '@atlaskit/tokens';
|
|
11
|
+
export var CodeBlockSharedCssClassName = {
|
|
12
|
+
CODEBLOCK_CONTAINER: 'code-block',
|
|
13
|
+
CODEBLOCK_LINE_NUMBER_GUTTER: 'line-number-gutter',
|
|
14
|
+
CODEBLOCK_CONTENT: 'code-content',
|
|
15
|
+
DS_CODEBLOCK: '[data-ds--code--code-block]'
|
|
16
|
+
};
|
|
17
|
+
export var codeBlockSharedStyles = function codeBlockSharedStyles(props) {
|
|
18
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", " {\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n counter-reset: line;\n display: flex;\n overflow-x: auto;\n\n background-image: ", ";\n\n --ds--code--bg-color: transparent;\n\n background-repeat: no-repeat;\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n margin: ", " 0 0 0;\n min-width: ", "px;\n cursor: pointer;\n\n .", " {\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n ::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n color: ", ";\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n }\n"])), CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER, themed({
|
|
19
|
+
light: token('color.background.neutral', N20),
|
|
20
|
+
dark: token('color.background.neutral', DN50)
|
|
21
|
+
})(props), borderRadius(), overflowShadow({
|
|
22
|
+
// TODO: https://product-fabric.atlassian.net/browse/DSP-4118
|
|
23
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
24
|
+
background: themed({
|
|
25
|
+
light: N20,
|
|
26
|
+
dark: DN50
|
|
27
|
+
})(props),
|
|
28
|
+
width: '8px'
|
|
29
|
+
}), akEditorCodeFontFamily, blockNodesVerticalMargin, akEditorTableCellMinWidth, CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER, themed({
|
|
30
|
+
light: token('color.background.neutral', N30),
|
|
31
|
+
dark: token('color.background.neutral', DN20)
|
|
32
|
+
})(props), gridSize(), themed({
|
|
33
|
+
light: token('color.text.subtlest', N400),
|
|
34
|
+
dark: token('color.text.subtlest', DN400)
|
|
35
|
+
})(props), relativeFontSizeToBase16(fontSize()), CodeBlockSharedCssClassName.CODEBLOCK_CONTENT, themed({
|
|
36
|
+
light: token('color.text', N800),
|
|
37
|
+
dark: token('color.text', DN800)
|
|
38
|
+
})(props), borderRadius(), gridSize(), relativeFontSizeToBase16(fontSize()));
|
|
39
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { emojiImage, emojiNode, emojiSprite } from '@atlaskit/emoji';
|
|
1
|
+
import { emojiImage, emojiNode, emojiPlaceholder, emojiSprite } from '@atlaskit/emoji';
|
|
2
2
|
export var EmojiSharedCssClassName = {
|
|
3
3
|
EMOJI_CONTAINER: 'emojiView-content-wrap',
|
|
4
4
|
EMOJI_NODE: emojiNode,
|
|
5
5
|
EMOJI_SPRITE: emojiSprite,
|
|
6
|
-
EMOJI_IMAGE: emojiImage
|
|
6
|
+
EMOJI_IMAGE: emojiImage,
|
|
7
|
+
EMOJI_PLACEHOLDER: emojiPlaceholder
|
|
7
8
|
};
|
|
@@ -146,7 +146,8 @@ export var PanelSharedSelectors = {
|
|
|
146
146
|
emojiPopup: "[aria-label=\"Popup\"]",
|
|
147
147
|
searchEmoji: "[aria-label=\"Search emoji\"]",
|
|
148
148
|
orangeWarningIcon: "[aria-label=\":warning:\"]",
|
|
149
|
-
yellowWarningIcon: "[aria-label=\":warning:\"] span:nth-child(1)"
|
|
149
|
+
yellowWarningIcon: "[aria-label=\":warning:\"] span:nth-child(1)",
|
|
150
|
+
copyButton: "button[aria-label=\"Copy\"]"
|
|
150
151
|
};
|
|
151
152
|
|
|
152
153
|
var iconDynamicStyles = function iconDynamicStyles(panelType) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { ResourcedMention } from '@atlaskit/mention';
|
|
3
|
-
import
|
|
3
|
+
import ProfileCardTrigger from '@atlaskit/profilecard/user';
|
|
4
4
|
export default function MentionWithProfileCard(_ref) {
|
|
5
5
|
var id = _ref.id,
|
|
6
6
|
text = _ref.text,
|
|
@@ -10,6 +10,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
10
10
|
|
|
11
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
12
|
|
|
13
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
14
|
+
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
+
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
18
|
+
|
|
13
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
20
|
|
|
15
21
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -38,6 +44,8 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
38
44
|
|
|
39
45
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
40
46
|
|
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "rafIds", new Set());
|
|
48
|
+
|
|
41
49
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
42
50
|
validPosition: true
|
|
43
51
|
});
|
|
@@ -52,8 +60,38 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
52
60
|
_this.initPopup(popup);
|
|
53
61
|
});
|
|
54
62
|
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "cancelRequestAnimationFrames", function () {
|
|
64
|
+
var _iterator = _createForOfIteratorHelper(_this.rafIds),
|
|
65
|
+
_step;
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
69
|
+
var rafId = _step.value;
|
|
70
|
+
cancelAnimationFrame(rafId);
|
|
71
|
+
}
|
|
72
|
+
} catch (err) {
|
|
73
|
+
_iterator.e(err);
|
|
74
|
+
} finally {
|
|
75
|
+
_iterator.f();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
55
79
|
_defineProperty(_assertThisInitialized(_this), "scheduledUpdatePosition", rafSchedule(function (props) {
|
|
56
|
-
|
|
80
|
+
if (!_this.props.waitForExtraLayoutUpdates) {
|
|
81
|
+
_this.updatePosition(_this.props);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (_this.props.scheduleExtraLayoutUpdates) {
|
|
85
|
+
// We need two requestAnimationFrame calls to ensure reflow/repaints
|
|
86
|
+
// are flushed to DOM before our popup position recalculations happen
|
|
87
|
+
var rafId = requestAnimationFrame(function () {
|
|
88
|
+
_this.updatePosition(_this.props);
|
|
89
|
+
|
|
90
|
+
_this.rafIds.delete(rafId);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
_this.rafIds.add(rafId);
|
|
94
|
+
}
|
|
57
95
|
}));
|
|
58
96
|
|
|
59
97
|
_defineProperty(_assertThisInitialized(_this), "onResize", function () {
|
|
@@ -220,6 +258,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
220
258
|
}
|
|
221
259
|
|
|
222
260
|
this.scheduledUpdatePosition.cancel();
|
|
261
|
+
this.cancelRequestAnimationFrames();
|
|
223
262
|
}
|
|
224
263
|
}, {
|
|
225
264
|
key: "renderPopup",
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject;
|
|
3
|
+
var _templateObject, _templateObject2;
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/react'; // We use !important to ensure next sibling gets the margin reset no matter what
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var marginTopReset = "margin-top: 0 !important;";
|
|
8
|
+
export var clearNextSiblingMarginTopStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & + * {\n ", "\n }\n"])), marginTopReset);
|
|
9
|
+
var textElements = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
10
|
+
var nextSiblingBlockMarkContentSelectors = textElements.map(function (elem) {
|
|
11
|
+
return "+ .fabric-editor-block-mark > ".concat(elem);
|
|
12
|
+
}).join(',');
|
|
13
|
+
export var clearNextSiblingBlockMarkMarginTopStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " {\n ", "\n }\n"])), nextSiblingBlockMarkContentSelectors, marginTopReset);
|
package/dist/esm/ui/index.js
CHANGED
|
@@ -14,5 +14,5 @@ export { shadowObserverClassNames, ShadowObserver } from './OverflowShadow/shado
|
|
|
14
14
|
export { WithCreateAnalyticsEvent } from './WithCreateAnalyticsEvent';
|
|
15
15
|
export { messages as expandMessages, sharedExpandStyles, ExpandIconWrapper, expandLayoutWrapperStyle, ExpandLayoutWrapperWithRef } from './Expand';
|
|
16
16
|
export { ErrorMessage, HelperMessage, ValidMessage } from './Messages';
|
|
17
|
-
export { clearNextSiblingMarginTopStyle } from './clear-next-sibling-margin-top';
|
|
17
|
+
export { clearNextSiblingMarginTopStyle, clearNextSiblingBlockMarkMarginTopStyle } from './clear-next-sibling-margin-top';
|
|
18
18
|
export { IntlErrorBoundary, REACT_INTL_ERROR_MESSAGE } from './IntlErrorBoundary';
|
|
@@ -3,12 +3,14 @@ var result = {
|
|
|
3
3
|
ie: false,
|
|
4
4
|
ie_version: 0,
|
|
5
5
|
gecko: false,
|
|
6
|
+
gecko_version: 0,
|
|
6
7
|
chrome: false,
|
|
7
8
|
chrome_version: 0,
|
|
8
9
|
android: false,
|
|
9
10
|
ios: false,
|
|
10
11
|
webkit: false,
|
|
11
12
|
safari: false,
|
|
13
|
+
safari_version: 0,
|
|
12
14
|
supportsIntersectionObserver: false,
|
|
13
15
|
supportsResizeObserver: false
|
|
14
16
|
};
|
|
@@ -21,12 +23,14 @@ if (typeof navigator !== 'undefined') {
|
|
|
21
23
|
var ie = result.ie = !!(ieUpTo10 || ie11up || ieEdge);
|
|
22
24
|
result.ie_version = ieUpTo10 ? document.documentMode || 6 : ie11up ? +ie11up[1] : ieEdge ? +ieEdge[1] : null;
|
|
23
25
|
result.gecko = !ie && /gecko\/\d/i.test(navigator.userAgent);
|
|
26
|
+
result.gecko_version = parseInt((navigator.userAgent.match(/Firefox\/(\d+)/) || [])[1], 10);
|
|
24
27
|
result.chrome = !ie && /Chrome\//.test(navigator.userAgent);
|
|
25
28
|
result.chrome_version = parseInt((navigator.userAgent.match(/Chrome\/(\d+)/) || [])[1], 10);
|
|
26
29
|
result.android = /Android \d/.test(navigator.userAgent);
|
|
27
30
|
result.ios = !ie && /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
|
|
28
31
|
result.webkit = !ie && !!document.documentElement && 'WebkitAppearance' in document.documentElement.style;
|
|
29
32
|
result.safari = Boolean(navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') === -1 && navigator.userAgent.indexOf('FxiOS') === -1);
|
|
33
|
+
result.safari_version = parseInt((navigator.userAgent.match(/Version\/([0-9\._]+).*Safari/) || [])[1], 10);
|
|
30
34
|
result.supportsIntersectionObserver = typeof window !== 'undefined' && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype;
|
|
31
35
|
result.supportsResizeObserver = typeof window !== 'undefined' && 'ResizeObserver' in window && 'ResizeObserverEntry' in window;
|
|
32
36
|
}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from './annotation';
|
|
2
2
|
export { getExtensionLozengeData } from './macro';
|
|
3
|
-
export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder } from './validator';
|
|
4
3
|
export { default as browser } from './browser';
|
|
5
4
|
export { default as ErrorReporter } from './error-reporter';
|
|
6
5
|
export { isPastDate, timestampToIsoFormat, timestampToString, timestampToTaskContext, timestampToUTCDate, todayTimestampInUTC } from './date';
|
|
@@ -13,7 +13,23 @@ import { isPerformanceAPIAvailable } from './is-performance-api-available';
|
|
|
13
13
|
* | startMark + scheduling rAF | | rAF callback, endMark
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export function measureRender(
|
|
16
|
+
export function measureRender(
|
|
17
|
+
/**
|
|
18
|
+
* Unique name for the measurement
|
|
19
|
+
*
|
|
20
|
+
* Important: if multiple measureRender events are fired at the same time
|
|
21
|
+
* with the same measure name -- the result will not be correct.
|
|
22
|
+
*/
|
|
23
|
+
measureName,
|
|
24
|
+
/**
|
|
25
|
+
* Call back fired when the measurement completes.
|
|
26
|
+
*
|
|
27
|
+
* Note: when this function is called when the Document.visibilityState is not
|
|
28
|
+
* visible -- the duration is likely to be misleading/inaccurate. This is due
|
|
29
|
+
* to the measurements use of the `requestAnimationFrame` api which only fires
|
|
30
|
+
* when the Document.visibilityState is visible.
|
|
31
|
+
*/
|
|
32
|
+
onMeasureComplete) {
|
|
17
33
|
if (!isPerformanceAPIAvailable()) {
|
|
18
34
|
return;
|
|
19
35
|
}
|
|
@@ -21,10 +37,29 @@ export function measureRender(measureName, onMeasureComplete) {
|
|
|
21
37
|
var startMark = "[START]: ".concat(measureName);
|
|
22
38
|
var endMark = "[END]: ".concat(measureName);
|
|
23
39
|
var startTime = performance.now();
|
|
24
|
-
performance.mark(startMark);
|
|
40
|
+
performance.mark(startMark); // If an editor is rendered when the document is not visible -- the callback passed to
|
|
41
|
+
// requestAnimationFrame will not fire until the document becomes visible again.
|
|
42
|
+
//
|
|
43
|
+
// For the purposes of using performance measurement -- this behaviour means the events
|
|
44
|
+
// which have been fired in the background are not useful -- and lead to other events
|
|
45
|
+
// being hard to draw conclusions from.
|
|
46
|
+
//
|
|
47
|
+
// To mitigate this -- we detect this state -- and fire a seperate callback when the
|
|
48
|
+
// measurement has occured when the render was in the backgroun
|
|
49
|
+
|
|
50
|
+
var distortedDuration = document.visibilityState !== 'visible';
|
|
51
|
+
|
|
52
|
+
function handleVisibilityChange() {
|
|
53
|
+
if (document.visibilityState !== 'visible') {
|
|
54
|
+
distortedDuration = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
25
59
|
requestAnimationFrame(function () {
|
|
26
60
|
requestAnimationFrame(function () {
|
|
27
61
|
performance.mark(endMark);
|
|
62
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
28
63
|
var duration = performance.now() - startTime;
|
|
29
64
|
|
|
30
65
|
try {
|
|
@@ -32,12 +67,24 @@ export function measureRender(measureName, onMeasureComplete) {
|
|
|
32
67
|
var entry = performance.getEntriesByName(measureName).pop();
|
|
33
68
|
|
|
34
69
|
if (!entry) {
|
|
35
|
-
onMeasureComplete(
|
|
70
|
+
onMeasureComplete({
|
|
71
|
+
duration: duration,
|
|
72
|
+
startTime: startTime,
|
|
73
|
+
distortedDuration: distortedDuration
|
|
74
|
+
});
|
|
36
75
|
} else {
|
|
37
|
-
onMeasureComplete(
|
|
76
|
+
onMeasureComplete({
|
|
77
|
+
duration: entry.duration,
|
|
78
|
+
startTime: entry.startTime,
|
|
79
|
+
distortedDuration: distortedDuration
|
|
80
|
+
});
|
|
38
81
|
}
|
|
39
82
|
} catch (e) {
|
|
40
|
-
onMeasureComplete(
|
|
83
|
+
onMeasureComplete({
|
|
84
|
+
duration: duration,
|
|
85
|
+
startTime: startTime,
|
|
86
|
+
distortedDuration: distortedDuration
|
|
87
|
+
});
|
|
41
88
|
}
|
|
42
89
|
|
|
43
90
|
performance.clearMeasures(measureName);
|
package/dist/esm/validator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder } from './utils/validator';
|
|
1
|
+
export { getMarksByOrder, getValidContent, getValidDocument, getValidMark, getValidNode, getValidUnknownNode, isSameMark, isSubSupType, markOrder, ADFStages } from './utils/validator';
|
package/dist/esm/version.json
CHANGED