@atlaskit/editor-common 63.0.0 → 65.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 +52 -0
- package/dist/cjs/i18n/cs.js +3 -3
- package/dist/cjs/i18n/da.js +3 -3
- package/dist/cjs/i18n/de.js +3 -3
- package/dist/cjs/i18n/en_ZZ.js +27 -0
- package/dist/cjs/i18n/es.js +3 -3
- package/dist/cjs/i18n/fi.js +3 -3
- package/dist/cjs/i18n/fr.js +3 -3
- package/dist/cjs/i18n/hu.js +3 -3
- package/dist/cjs/i18n/it.js +3 -3
- package/dist/cjs/i18n/ja.js +3 -3
- package/dist/cjs/i18n/ko.js +3 -3
- package/dist/cjs/i18n/nb.js +3 -3
- package/dist/cjs/i18n/nl.js +3 -3
- package/dist/cjs/i18n/pl.js +3 -3
- package/dist/cjs/i18n/pt_BR.js +3 -3
- package/dist/cjs/i18n/ru.js +3 -3
- package/dist/cjs/i18n/sv.js +3 -3
- package/dist/cjs/i18n/th.js +3 -3
- package/dist/cjs/i18n/tr.js +3 -3
- package/dist/cjs/i18n/uk.js +3 -3
- package/dist/cjs/i18n/vi.js +3 -3
- package/dist/cjs/i18n/zh.js +3 -2
- package/dist/cjs/i18n/zh_TW.js +3 -3
- package/dist/cjs/index.js +1 -29
- package/dist/cjs/safe-plugin/index.js +42 -0
- package/dist/cjs/styles/index.js +0 -8
- package/dist/cjs/styles/shared/annotation.js +25 -17
- package/dist/cjs/styles/shared/block-marks.js +2 -2
- package/dist/cjs/styles/shared/blockquote.js +2 -2
- package/dist/cjs/styles/shared/code-mark.js +9 -5
- package/dist/cjs/styles/shared/column-layout.js +2 -2
- package/dist/cjs/styles/shared/date.js +2 -2
- package/dist/cjs/styles/shared/headings.js +5 -2
- package/dist/cjs/styles/shared/indentation.js +2 -2
- package/dist/cjs/styles/shared/lists.js +4 -2
- package/dist/cjs/styles/shared/media-single.js +2 -2
- package/dist/cjs/styles/shared/paragraph.js +2 -2
- package/dist/cjs/styles/shared/shadow.js +2 -2
- package/dist/cjs/styles/shared/table.js +37 -33
- package/dist/cjs/styles/shared/task-decision.js +2 -2
- package/dist/cjs/styles/shared/text-color.js +2 -2
- package/dist/cjs/styles/shared/whitespace.js +2 -2
- package/dist/cjs/types/collab.js +5 -0
- package/dist/cjs/ui/BaseTheme/index.js +27 -11
- package/dist/cjs/ui/Caption/index.js +10 -7
- package/dist/cjs/ui/MediaSingle/index.js +3 -1
- package/dist/cjs/ui/MediaSingle/link.js +4 -6
- package/dist/cjs/ui/Mention/index.js +1 -3
- package/dist/cjs/ui/Mention/mention-with-profilecard.js +33 -194
- package/dist/cjs/ui/Mention/mention-with-providers.js +1 -5
- package/dist/cjs/ui/Messages/index.js +25 -22
- package/dist/cjs/ui/UnsupportedBlock/index.js +9 -6
- package/dist/cjs/ui/UnsupportedInline/index.js +8 -6
- package/dist/cjs/ui/WidthProvider/index.js +8 -9
- package/dist/cjs/ui/clear-next-sibling-margin-top.js +4 -5
- package/dist/cjs/ui/index.js +12 -12
- package/dist/cjs/utils/browser.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/i18n/cs.js +3 -3
- package/dist/es2019/i18n/da.js +3 -3
- package/dist/es2019/i18n/de.js +3 -3
- package/dist/es2019/i18n/en_ZZ.js +19 -0
- package/dist/es2019/i18n/es.js +3 -3
- package/dist/es2019/i18n/fi.js +3 -3
- package/dist/es2019/i18n/fr.js +3 -3
- package/dist/es2019/i18n/hu.js +3 -3
- package/dist/es2019/i18n/it.js +3 -3
- package/dist/es2019/i18n/ja.js +3 -3
- package/dist/es2019/i18n/ko.js +3 -3
- package/dist/es2019/i18n/nb.js +3 -3
- package/dist/es2019/i18n/nl.js +3 -3
- package/dist/es2019/i18n/pl.js +3 -3
- package/dist/es2019/i18n/pt_BR.js +3 -3
- package/dist/es2019/i18n/ru.js +3 -3
- package/dist/es2019/i18n/sv.js +3 -3
- package/dist/es2019/i18n/th.js +3 -3
- package/dist/es2019/i18n/tr.js +3 -3
- package/dist/es2019/i18n/uk.js +3 -3
- package/dist/es2019/i18n/vi.js +3 -3
- package/dist/es2019/i18n/zh.js +3 -2
- package/dist/es2019/i18n/zh_TW.js +3 -3
- package/dist/es2019/index.js +2 -7
- package/dist/es2019/safe-plugin/index.js +10 -0
- package/dist/es2019/styles/index.js +0 -1
- package/dist/es2019/styles/shared/annotation.js +11 -11
- package/dist/es2019/styles/shared/block-marks.js +3 -2
- package/dist/es2019/styles/shared/blockquote.js +1 -1
- package/dist/es2019/styles/shared/code-mark.js +14 -11
- package/dist/es2019/styles/shared/column-layout.js +1 -1
- package/dist/es2019/styles/shared/date.js +1 -1
- package/dist/es2019/styles/shared/headings.js +8 -8
- package/dist/es2019/styles/shared/indentation.js +1 -1
- package/dist/es2019/styles/shared/lists.js +17 -1
- package/dist/es2019/styles/shared/media-single.js +1 -1
- package/dist/es2019/styles/shared/paragraph.js +1 -1
- package/dist/es2019/styles/shared/shadow.js +1 -1
- package/dist/es2019/styles/shared/table.js +14 -12
- package/dist/es2019/styles/shared/task-decision.js +1 -1
- package/dist/es2019/styles/shared/text-color.js +1 -1
- package/dist/es2019/styles/shared/whitespace.js +1 -1
- package/dist/es2019/types/collab.js +1 -0
- package/dist/es2019/ui/BaseTheme/index.js +16 -5
- package/dist/es2019/ui/Caption/index.js +11 -5
- package/dist/es2019/ui/MediaSingle/index.js +3 -1
- package/dist/es2019/ui/MediaSingle/link.js +3 -4
- package/dist/es2019/ui/Mention/index.js +1 -3
- package/dist/es2019/ui/Mention/mention-with-profilecard.js +33 -146
- package/dist/es2019/ui/Mention/mention-with-providers.js +1 -5
- package/dist/es2019/ui/Messages/index.js +30 -22
- package/dist/es2019/ui/UnsupportedBlock/index.js +9 -5
- package/dist/es2019/ui/UnsupportedInline/index.js +8 -5
- package/dist/es2019/ui/WidthProvider/index.js +10 -8
- package/dist/es2019/ui/clear-next-sibling-margin-top.js +2 -2
- package/dist/es2019/ui/index.js +2 -2
- package/dist/es2019/utils/browser.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/i18n/cs.js +3 -3
- package/dist/esm/i18n/da.js +3 -3
- package/dist/esm/i18n/de.js +3 -3
- package/dist/esm/i18n/en_ZZ.js +19 -0
- package/dist/esm/i18n/es.js +3 -3
- package/dist/esm/i18n/fi.js +3 -3
- package/dist/esm/i18n/fr.js +3 -3
- package/dist/esm/i18n/hu.js +3 -3
- package/dist/esm/i18n/it.js +3 -3
- package/dist/esm/i18n/ja.js +3 -3
- package/dist/esm/i18n/ko.js +3 -3
- package/dist/esm/i18n/nb.js +3 -3
- package/dist/esm/i18n/nl.js +3 -3
- package/dist/esm/i18n/pl.js +3 -3
- package/dist/esm/i18n/pt_BR.js +3 -3
- package/dist/esm/i18n/ru.js +3 -3
- package/dist/esm/i18n/sv.js +3 -3
- package/dist/esm/i18n/th.js +3 -3
- package/dist/esm/i18n/tr.js +3 -3
- package/dist/esm/i18n/uk.js +3 -3
- package/dist/esm/i18n/vi.js +3 -3
- package/dist/esm/i18n/zh.js +3 -2
- package/dist/esm/i18n/zh_TW.js +3 -3
- package/dist/esm/index.js +2 -7
- package/dist/esm/safe-plugin/index.js +27 -0
- package/dist/esm/styles/index.js +0 -1
- package/dist/esm/styles/shared/annotation.js +21 -17
- package/dist/esm/styles/shared/block-marks.js +2 -2
- package/dist/esm/styles/shared/blockquote.js +1 -1
- package/dist/esm/styles/shared/code-mark.js +9 -6
- package/dist/esm/styles/shared/column-layout.js +1 -1
- package/dist/esm/styles/shared/date.js +1 -1
- package/dist/esm/styles/shared/headings.js +4 -2
- package/dist/esm/styles/shared/indentation.js +1 -1
- package/dist/esm/styles/shared/lists.js +3 -2
- package/dist/esm/styles/shared/media-single.js +1 -1
- package/dist/esm/styles/shared/paragraph.js +1 -1
- package/dist/esm/styles/shared/shadow.js +1 -1
- package/dist/esm/styles/shared/table.js +37 -33
- package/dist/esm/styles/shared/task-decision.js +1 -1
- package/dist/esm/styles/shared/text-color.js +1 -1
- package/dist/esm/styles/shared/whitespace.js +1 -1
- package/dist/esm/types/collab.js +1 -0
- package/dist/esm/ui/BaseTheme/index.js +23 -12
- package/dist/esm/ui/Caption/index.js +10 -5
- package/dist/esm/ui/MediaSingle/index.js +3 -1
- package/dist/esm/ui/MediaSingle/link.js +2 -3
- package/dist/esm/ui/Mention/index.js +1 -3
- package/dist/esm/ui/Mention/mention-with-profilecard.js +33 -189
- package/dist/esm/ui/Mention/mention-with-providers.js +1 -5
- package/dist/esm/ui/Messages/index.js +26 -20
- package/dist/esm/ui/UnsupportedBlock/index.js +9 -5
- package/dist/esm/ui/UnsupportedInline/index.js +8 -5
- package/dist/esm/ui/WidthProvider/index.js +7 -6
- package/dist/esm/ui/clear-next-sibling-margin-top.js +2 -2
- package/dist/esm/ui/index.js +2 -2
- package/dist/esm/utils/browser.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/__tests_external__/page-objects/Editor.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/EditorMedia.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/EditorSmartLink.d.ts +0 -1
- package/dist/types/__tests_external__/page-objects/Renderer.d.ts +0 -1
- package/dist/types/collab/types.d.ts +14 -2
- package/dist/types/collab.d.ts +1 -1
- package/dist/types/i18n/cs.d.ts +2 -2
- package/dist/types/i18n/da.d.ts +2 -2
- package/dist/types/i18n/de.d.ts +2 -2
- package/dist/types/i18n/en_ZZ.d.ts +19 -0
- package/dist/types/i18n/es.d.ts +2 -2
- package/dist/types/i18n/fi.d.ts +2 -2
- package/dist/types/i18n/fr.d.ts +2 -2
- package/dist/types/i18n/hu.d.ts +2 -2
- package/dist/types/i18n/it.d.ts +2 -2
- package/dist/types/i18n/ja.d.ts +2 -2
- package/dist/types/i18n/ko.d.ts +2 -2
- package/dist/types/i18n/nb.d.ts +2 -2
- package/dist/types/i18n/nl.d.ts +2 -2
- package/dist/types/i18n/pl.d.ts +2 -2
- package/dist/types/i18n/pt_BR.d.ts +2 -2
- package/dist/types/i18n/ru.d.ts +2 -2
- package/dist/types/i18n/sv.d.ts +2 -2
- package/dist/types/i18n/th.d.ts +2 -2
- package/dist/types/i18n/tr.d.ts +2 -2
- package/dist/types/i18n/uk.d.ts +2 -2
- package/dist/types/i18n/vi.d.ts +2 -2
- package/dist/types/i18n/zh.d.ts +2 -2
- package/dist/types/i18n/zh_TW.d.ts +2 -2
- package/dist/types/index.d.ts +1 -14
- package/dist/types/safe-plugin/index.d.ts +6 -0
- package/dist/types/styles/index.d.ts +0 -1
- package/dist/types/styles/shared/annotation.d.ts +5 -4
- package/dist/types/styles/shared/block-marks.d.ts +1 -1
- package/dist/types/styles/shared/blockquote.d.ts +1 -1
- package/dist/types/styles/shared/code-mark.d.ts +2 -1
- package/dist/types/styles/shared/column-layout.d.ts +1 -1
- package/dist/types/styles/shared/date.d.ts +1 -1
- package/dist/types/styles/shared/headings.d.ts +2 -1
- package/dist/types/styles/shared/indentation.d.ts +1 -1
- package/dist/types/styles/shared/lists.d.ts +1 -1
- package/dist/types/styles/shared/media-single.d.ts +1 -1
- package/dist/types/styles/shared/panel.d.ts +1 -1
- package/dist/types/styles/shared/paragraph.d.ts +1 -1
- package/dist/types/styles/shared/rule.d.ts +1 -1
- package/dist/types/styles/shared/shadow.d.ts +1 -1
- package/dist/types/styles/shared/table.d.ts +2 -1
- package/dist/types/styles/shared/task-decision.d.ts +1 -1
- package/dist/types/styles/shared/text-color.d.ts +1 -1
- package/dist/types/styles/shared/whitespace.d.ts +1 -1
- package/dist/types/types/collab.d.ts +8 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/ui/Caption/index.d.ts +3 -1
- package/dist/types/ui/Expand/index.d.ts +2 -2
- package/dist/types/ui/MediaSingle/index.d.ts +2 -1
- package/dist/types/ui/MediaSingle/link.d.ts +1 -2
- package/dist/types/ui/MediaSingle/styled.d.ts +2 -2
- package/dist/types/ui/Mention/index.d.ts +0 -3
- package/dist/types/ui/Mention/mention-with-profilecard.d.ts +2 -25
- package/dist/types/ui/Mention/mention-with-providers.d.ts +0 -3
- package/dist/types/ui/Messages/index.d.ts +5 -3
- package/dist/types/ui/UnsupportedBlock/index.d.ts +1 -0
- package/dist/types/ui/UnsupportedInline/index.d.ts +1 -0
- package/dist/types/ui/WidthProvider/index.d.ts +3 -1
- package/dist/types/ui/clear-next-sibling-margin-top.d.ts +1 -2
- package/dist/types/ui/index.d.ts +3 -3
- package/dist/types/utils/getModeFromTheme.d.ts +1 -1
- package/package.json +18 -16
- package/safe-plugin/package.json +7 -0
- package/dist/cjs/styles/shared/inline-nodes.js +0 -17
- package/dist/es2019/styles/shared/inline-nodes.js +0 -7
- package/dist/esm/styles/shared/inline-nodes.js +0 -7
- package/dist/types/styles/shared/inline-nodes.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from '
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
2
|
import { tableCellContentDomSelector, tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
|
|
3
3
|
import { akEditorBreakoutPadding, akEditorFullWidthLayoutWidth, akEditorTableBorder, akEditorTableBorderDark, akEditorTableNumberColumnWidth, akEditorTableToolbar, akEditorTableToolbarDark, akEditorWideLayoutWidth, getTableCellBackgroundDarkModeColors, overflowShadow } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { DN20 } from '@atlaskit/theme/colors';
|
|
@@ -26,7 +26,8 @@ export const TableSharedCssClassName = {
|
|
|
26
26
|
TABLE_CELL_WRAPPER: tableCellSelector,
|
|
27
27
|
TABLE_HEADER_CELL_WRAPPER: tableHeaderSelector
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
const tableSharedStyle = props => css`
|
|
30
31
|
.${TableSharedCssClassName.TABLE_CONTAINER} {
|
|
31
32
|
position: relative;
|
|
32
33
|
margin: 0 auto ${tableMarginBottom}px;
|
|
@@ -53,7 +54,7 @@ const tableSharedStyle = css`
|
|
|
53
54
|
${themed({
|
|
54
55
|
light: akEditorTableBorder,
|
|
55
56
|
dark: akEditorTableBorderDark
|
|
56
|
-
})};
|
|
57
|
+
})(props)};
|
|
57
58
|
table-layout: fixed;
|
|
58
59
|
font-size: 1em;
|
|
59
60
|
width: 100%;
|
|
@@ -85,7 +86,7 @@ const tableSharedStyle = css`
|
|
|
85
86
|
${themed({
|
|
86
87
|
light: akEditorTableBorder,
|
|
87
88
|
dark: akEditorTableBorderDark
|
|
88
|
-
})};
|
|
89
|
+
})(props)};
|
|
89
90
|
border-right-width: 0;
|
|
90
91
|
border-bottom-width: 0;
|
|
91
92
|
padding: ${tableCellPadding}px;
|
|
@@ -94,7 +95,7 @@ const tableSharedStyle = css`
|
|
|
94
95
|
|
|
95
96
|
${themed({
|
|
96
97
|
dark: getTableCellBackgroundDarkModeColors
|
|
97
|
-
})};
|
|
98
|
+
})(props)};
|
|
98
99
|
|
|
99
100
|
> *:first-child {
|
|
100
101
|
margin-top: 0;
|
|
@@ -117,7 +118,7 @@ const tableSharedStyle = css`
|
|
|
117
118
|
background-color: ${themed({
|
|
118
119
|
light: akEditorTableToolbar,
|
|
119
120
|
dark: akEditorTableToolbarDark
|
|
120
|
-
})};
|
|
121
|
+
})(props)};
|
|
121
122
|
text-align: left;
|
|
122
123
|
|
|
123
124
|
/* only apply this styling to codeblocks in default background headercells */
|
|
@@ -128,7 +129,7 @@ const tableSharedStyle = css`
|
|
|
128
129
|
background: themed({
|
|
129
130
|
light: 'rgb(235, 237, 240)',
|
|
130
131
|
dark: 'rgb(36, 47, 66)'
|
|
131
|
-
}),
|
|
132
|
+
})(props),
|
|
132
133
|
width: `${gridSize()}px`
|
|
133
134
|
})};
|
|
134
135
|
background-attachment: local, scroll, scroll;
|
|
@@ -136,13 +137,13 @@ const tableSharedStyle = css`
|
|
|
136
137
|
background-color: ${themed({
|
|
137
138
|
light: 'rgb(235, 237, 240)',
|
|
138
139
|
dark: 'rgb(36, 47, 66)'
|
|
139
|
-
})};
|
|
140
|
+
})(props)};
|
|
140
141
|
|
|
141
142
|
.line-number-gutter {
|
|
142
143
|
background-color: ${themed({
|
|
143
144
|
light: 'rgb(226, 229, 233)',
|
|
144
145
|
dark: DN20
|
|
145
|
-
})};
|
|
146
|
+
})(props)};
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
/* this is only relevant to the element taken care of by renderer */
|
|
@@ -151,20 +152,20 @@ const tableSharedStyle = css`
|
|
|
151
152
|
background: themed({
|
|
152
153
|
light: 'rgb(235, 237, 240)',
|
|
153
154
|
dark: 'rgb(36, 47, 66)'
|
|
154
|
-
}),
|
|
155
|
+
})(props),
|
|
155
156
|
width: `${gridSize()}px`
|
|
156
157
|
})}!important;
|
|
157
158
|
|
|
158
159
|
background-color: ${themed({
|
|
159
160
|
light: 'rgb(235, 237, 240)',
|
|
160
161
|
dark: 'rgb(36, 47, 66)'
|
|
161
|
-
})}!important;
|
|
162
|
+
})(props)}!important;
|
|
162
163
|
|
|
163
164
|
// selector lives inside @atlaskit/code
|
|
164
165
|
--ds--code--line-number-bg-color: ${themed({
|
|
165
166
|
light: 'rgb(226, 229, 233)',
|
|
166
167
|
dark: DN20
|
|
167
|
-
})};
|
|
168
|
+
})(props)};
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
171
|
}
|
|
@@ -172,6 +173,7 @@ const tableSharedStyle = css`
|
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
`;
|
|
176
|
+
|
|
175
177
|
export const calcTableWidth = (layout, containerWidth, addControllerPadding = true) => {
|
|
176
178
|
switch (layout) {
|
|
177
179
|
case 'full-width':
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
-
import { ThemeProvider } from '
|
|
2
|
+
import { ThemeProvider } from '@emotion/react';
|
|
3
|
+
import { ThemeProvider as DeprecatedThemeProvider } from 'styled-components';
|
|
3
4
|
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import {
|
|
5
|
+
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
6
|
+
import { CHANNEL, fontSize } from '@atlaskit/theme/constants';
|
|
5
7
|
import { WidthConsumer } from '../WidthProvider';
|
|
6
8
|
|
|
7
9
|
function mapBreakpointToFontSize(breakpoint) {
|
|
@@ -35,13 +37,22 @@ export function BaseThemeWrapper({
|
|
|
35
37
|
baseFontSize,
|
|
36
38
|
children
|
|
37
39
|
}) {
|
|
40
|
+
const {
|
|
41
|
+
mode
|
|
42
|
+
} = useGlobalTheme();
|
|
38
43
|
const memoizedTheme = useMemo(() => ({
|
|
39
44
|
baseFontSize: dynamicTextSizing ? mapBreakpointToFontSize(breakpoint) : baseFontSize || mapBreakpointToFontSize('S'),
|
|
40
|
-
layoutMaxWidth: dynamicTextSizing ? mapBreakpointToLayoutMaxWidth(breakpoint) : akEditorDefaultLayoutWidth
|
|
41
|
-
|
|
45
|
+
layoutMaxWidth: dynamicTextSizing ? mapBreakpointToLayoutMaxWidth(breakpoint) : akEditorDefaultLayoutWidth,
|
|
46
|
+
// Below is used for editor dark mode.
|
|
47
|
+
[CHANNEL]: {
|
|
48
|
+
mode
|
|
49
|
+
}
|
|
50
|
+
}), [breakpoint, dynamicTextSizing, baseFontSize, mode]);
|
|
42
51
|
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
43
52
|
theme: memoizedTheme
|
|
44
|
-
},
|
|
53
|
+
}, /*#__PURE__*/React.createElement(DeprecatedThemeProvider, {
|
|
54
|
+
theme: memoizedTheme
|
|
55
|
+
}, children));
|
|
45
56
|
}
|
|
46
57
|
export function BaseTheme({
|
|
47
58
|
children,
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
2
4
|
import React from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
3
6
|
import { injectIntl } from 'react-intl-next';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
7
|
import { N200, N400 } from '@atlaskit/theme/colors';
|
|
6
8
|
import { messages } from './messages';
|
|
7
|
-
const
|
|
9
|
+
const captionWrapperStyle = css`
|
|
8
10
|
margin-top: 8px;
|
|
9
11
|
text-align: center;
|
|
10
12
|
position: relative;
|
|
11
13
|
color: ${N400};
|
|
12
14
|
`;
|
|
13
|
-
const
|
|
15
|
+
const placeholderStyle = css`
|
|
14
16
|
color: ${N200};
|
|
15
17
|
position: absolute;
|
|
16
18
|
top: 0;
|
|
@@ -28,10 +30,14 @@ export class CaptionComponent extends React.Component {
|
|
|
28
30
|
}
|
|
29
31
|
} = this.props;
|
|
30
32
|
const showPlaceholder = !selected && !hasContent;
|
|
31
|
-
return
|
|
33
|
+
return jsx("div", _extends({
|
|
32
34
|
"data-media-caption": true,
|
|
33
35
|
"data-testid": "media-caption"
|
|
34
|
-
}, dataAttributes
|
|
36
|
+
}, dataAttributes, {
|
|
37
|
+
css: captionWrapperStyle
|
|
38
|
+
}), showPlaceholder ? jsx("p", {
|
|
39
|
+
css: placeholderStyle
|
|
40
|
+
}, formatMessage(messages.placeholder)) : null, children);
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
}
|
|
@@ -21,7 +21,8 @@ export default function MediaSingle({
|
|
|
21
21
|
nodeType = 'mediaSingle',
|
|
22
22
|
fullWidthMode,
|
|
23
23
|
lineLength,
|
|
24
|
-
hasFallbackContainer = true
|
|
24
|
+
hasFallbackContainer = true,
|
|
25
|
+
handleMediaSingleRef
|
|
25
26
|
}) {
|
|
26
27
|
const children = React.Children.toArray(propsChildren);
|
|
27
28
|
|
|
@@ -74,6 +75,7 @@ export default function MediaSingle({
|
|
|
74
75
|
|
|
75
76
|
const [media, caption] = children;
|
|
76
77
|
return /*#__PURE__*/React.createElement(MediaSingleWrapper, {
|
|
78
|
+
innerRef: handleMediaSingleRef,
|
|
77
79
|
width: width,
|
|
78
80
|
layout: layout,
|
|
79
81
|
containerWidth: containerWidth,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
export const mediaLinkStyle = css`
|
|
3
3
|
position: absolute;
|
|
4
4
|
background: transparent;
|
|
5
5
|
top: 0;
|
|
@@ -9,5 +9,4 @@ export const MediaLink = styled.a`
|
|
|
9
9
|
cursor: pointer;
|
|
10
10
|
width: 100%;
|
|
11
11
|
height: 100%;
|
|
12
|
-
`;
|
|
13
|
-
MediaLink.displayName = 'MediaLink';
|
|
12
|
+
`;
|
|
@@ -11,7 +11,6 @@ export default class Mention extends PureComponent {
|
|
|
11
11
|
accessLevel,
|
|
12
12
|
eventHandlers,
|
|
13
13
|
id,
|
|
14
|
-
portal,
|
|
15
14
|
text
|
|
16
15
|
} = this.props;
|
|
17
16
|
const {
|
|
@@ -24,8 +23,7 @@ export default class Mention extends PureComponent {
|
|
|
24
23
|
accessLevel: accessLevel,
|
|
25
24
|
eventHandlers: eventHandlers,
|
|
26
25
|
mentionProvider: mentionProvider,
|
|
27
|
-
profilecardProvider: profilecardProvider
|
|
28
|
-
portal: portal
|
|
26
|
+
profilecardProvider: profilecardProvider
|
|
29
27
|
});
|
|
30
28
|
});
|
|
31
29
|
|
|
@@ -1,148 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
3
|
-
import { findDOMNode } from 'react-dom';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
4
2
|
import { ResourcedMention } from '@atlaskit/mention';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
event.stopPropagation();
|
|
40
|
-
const [popupAlignX, popupAlignY] = this.calculateLayerPosition();
|
|
41
|
-
this.setState({
|
|
42
|
-
popupAlignX,
|
|
43
|
-
popupAlignY,
|
|
44
|
-
visible: true
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
_defineProperty(this, "hideProfilecard", () => {
|
|
49
|
-
this.setState({
|
|
50
|
-
visible: false
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
calculateLayerPosition() {
|
|
56
|
-
const domNodeCentreCoords = this.getDomNodeCenterCoords();
|
|
57
|
-
const visibleAreaCentreCoords = this.getVisibleAreaCentreCoords();
|
|
58
|
-
const popupAlignY = domNodeCentreCoords.y > visibleAreaCentreCoords.y ? 'top' : 'bottom';
|
|
59
|
-
const popupAlignX = domNodeCentreCoords.x > visibleAreaCentreCoords.x ? 'right' : 'left';
|
|
60
|
-
return [popupAlignX, popupAlignY];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getDomNodeCenterCoords() {
|
|
64
|
-
const rect = this.domNode.getBoundingClientRect();
|
|
65
|
-
return {
|
|
66
|
-
x: rect.left + rect.width / 2,
|
|
67
|
-
y: rect.top + rect.height / 2
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
getVisibleAreaCentreCoords() {
|
|
72
|
-
return {
|
|
73
|
-
x: window.innerWidth / 2,
|
|
74
|
-
y: window.innerHeight / 2
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
getActions(id, text, accessLevel) {
|
|
79
|
-
const {
|
|
80
|
-
profilecardProvider
|
|
81
|
-
} = this.props;
|
|
82
|
-
const actions = profilecardProvider.getActions(id, text, accessLevel);
|
|
83
|
-
return actions.map(action => {
|
|
84
|
-
return { ...action,
|
|
85
|
-
callback: () => {
|
|
86
|
-
this.setState({
|
|
87
|
-
visible: false
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
if (action && action.callback) {
|
|
91
|
-
action.callback();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
render() {
|
|
99
|
-
const {
|
|
100
|
-
accessLevel,
|
|
101
|
-
id,
|
|
102
|
-
mentionProvider,
|
|
103
|
-
profilecardProvider,
|
|
104
|
-
text,
|
|
105
|
-
onClick,
|
|
106
|
-
onMouseEnter,
|
|
107
|
-
onMouseLeave,
|
|
108
|
-
portal
|
|
109
|
-
} = this.props;
|
|
110
|
-
const {
|
|
111
|
-
popupAlignX,
|
|
112
|
-
popupAlignY,
|
|
113
|
-
target,
|
|
114
|
-
visible
|
|
115
|
-
} = this.state;
|
|
116
|
-
const {
|
|
117
|
-
cloudId,
|
|
118
|
-
resourceClient
|
|
119
|
-
} = profilecardProvider;
|
|
120
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
121
|
-
ref: this.handleRef,
|
|
122
|
-
onClick: this.showProfilecard
|
|
123
|
-
}, /*#__PURE__*/React.createElement(ResourcedMention, {
|
|
124
|
-
ref: this.handleMentionNodeRef,
|
|
125
|
-
id: id,
|
|
126
|
-
text: text,
|
|
127
|
-
accessLevel: accessLevel,
|
|
128
|
-
mentionProvider: mentionProvider,
|
|
129
|
-
onClick: onClick,
|
|
130
|
-
onMouseEnter: onMouseEnter,
|
|
131
|
-
onMouseLeave: onMouseLeave
|
|
132
|
-
}), target && portal && visible && /*#__PURE__*/React.createElement(Popup, {
|
|
133
|
-
offset: [0, 8],
|
|
134
|
-
target: target,
|
|
135
|
-
mountTo: portal,
|
|
136
|
-
alignX: popupAlignX,
|
|
137
|
-
alignY: popupAlignY
|
|
138
|
-
}, /*#__PURE__*/React.createElement(ProfilecardResourcedWithListeners, {
|
|
139
|
-
handleClickOutside: this.hideProfilecard,
|
|
140
|
-
handleEscapeKeydown: this.hideProfilecard,
|
|
141
|
-
cloudId: cloudId,
|
|
142
|
-
userId: id,
|
|
143
|
-
resourceClient: resourceClient,
|
|
144
|
-
actions: this.getActions(id, text, accessLevel)
|
|
145
|
-
})));
|
|
146
|
-
}
|
|
147
|
-
|
|
3
|
+
import { ProfileCardTrigger } from '@atlaskit/profilecard';
|
|
4
|
+
export default function MentionWithProfileCard({
|
|
5
|
+
id,
|
|
6
|
+
text,
|
|
7
|
+
accessLevel,
|
|
8
|
+
mentionProvider,
|
|
9
|
+
profilecardProvider,
|
|
10
|
+
onClick,
|
|
11
|
+
onMouseEnter,
|
|
12
|
+
onMouseLeave
|
|
13
|
+
}) {
|
|
14
|
+
const {
|
|
15
|
+
cloudId,
|
|
16
|
+
resourceClient
|
|
17
|
+
} = profilecardProvider;
|
|
18
|
+
const actions = useMemo(() => profilecardProvider.getActions(id, text, accessLevel), [accessLevel, id, profilecardProvider, text]);
|
|
19
|
+
return /*#__PURE__*/React.createElement(ProfileCardTrigger, {
|
|
20
|
+
cloudId: cloudId,
|
|
21
|
+
userId: id,
|
|
22
|
+
resourceClient: resourceClient,
|
|
23
|
+
actions: actions,
|
|
24
|
+
trigger: "click",
|
|
25
|
+
position: "bottom-end"
|
|
26
|
+
}, /*#__PURE__*/React.createElement(ResourcedMention, {
|
|
27
|
+
id: id,
|
|
28
|
+
text: text,
|
|
29
|
+
accessLevel: accessLevel,
|
|
30
|
+
mentionProvider: mentionProvider,
|
|
31
|
+
onClick: onClick,
|
|
32
|
+
onMouseEnter: onMouseEnter,
|
|
33
|
+
onMouseLeave: onMouseLeave
|
|
34
|
+
}));
|
|
148
35
|
}
|
|
@@ -51,11 +51,9 @@ export default class MentionWithProviders extends PureComponent {
|
|
|
51
51
|
render() {
|
|
52
52
|
const {
|
|
53
53
|
accessLevel,
|
|
54
|
-
userType,
|
|
55
54
|
eventHandlers,
|
|
56
55
|
id,
|
|
57
56
|
mentionProvider,
|
|
58
|
-
portal,
|
|
59
57
|
text
|
|
60
58
|
} = this.props;
|
|
61
59
|
const {
|
|
@@ -70,10 +68,8 @@ export default class MentionWithProviders extends PureComponent {
|
|
|
70
68
|
id: id,
|
|
71
69
|
text: text,
|
|
72
70
|
accessLevel: accessLevel,
|
|
73
|
-
userType: userType,
|
|
74
71
|
mentionProvider: mentionProvider,
|
|
75
|
-
profilecardProvider: profilecardProvider
|
|
76
|
-
portal: portal
|
|
72
|
+
profilecardProvider: profilecardProvider
|
|
77
73
|
}, actionHandlers));
|
|
78
74
|
}
|
|
79
75
|
|
|
@@ -1,48 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import SuccessIcon from '@atlaskit/icon/glyph/editor/success';
|
|
4
4
|
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
5
5
|
import { G400, N200, R400 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
7
7
|
import { h200 } from '@atlaskit/theme/typography';
|
|
8
|
-
const
|
|
9
|
-
${
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (props.valid) {
|
|
16
|
-
return G400;
|
|
17
|
-
}
|
|
8
|
+
const errorColor = css`
|
|
9
|
+
color: ${R400};
|
|
10
|
+
`;
|
|
11
|
+
const validColor = css`
|
|
12
|
+
color: ${G400};
|
|
13
|
+
`;
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
}
|
|
15
|
+
const messageStyle = props => css`
|
|
16
|
+
${h200(props)} font-weight: normal;
|
|
17
|
+
color: ${N200};
|
|
21
18
|
margin-top: ${gridSize() / 2}px;
|
|
22
19
|
display: flex;
|
|
23
20
|
justify-content: baseline;
|
|
24
21
|
`;
|
|
25
|
-
|
|
22
|
+
|
|
23
|
+
const iconWrapperStyle = css`
|
|
26
24
|
display: flex;
|
|
27
25
|
margin-right: 4px;
|
|
28
26
|
`;
|
|
29
27
|
export const HelperMessage = ({
|
|
30
28
|
children
|
|
31
|
-
}) =>
|
|
29
|
+
}) => jsx("div", {
|
|
30
|
+
css: messageStyle
|
|
31
|
+
}, children);
|
|
32
32
|
export const ErrorMessage = ({
|
|
33
33
|
children
|
|
34
|
-
}) =>
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
}) => jsx("div", {
|
|
35
|
+
css: theme => {
|
|
36
|
+
return [messageStyle(theme), errorColor];
|
|
37
|
+
}
|
|
38
|
+
}, jsx("span", {
|
|
39
|
+
css: iconWrapperStyle
|
|
40
|
+
}, jsx(ErrorIcon, {
|
|
37
41
|
size: "small",
|
|
38
42
|
label: "error",
|
|
39
43
|
"aria-label": "error"
|
|
40
44
|
})), children);
|
|
41
45
|
export const ValidMessage = ({
|
|
42
46
|
children
|
|
43
|
-
}) =>
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
}) => jsx("div", {
|
|
48
|
+
css: theme => {
|
|
49
|
+
return [messageStyle(theme), validColor];
|
|
50
|
+
}
|
|
51
|
+
}, jsx("span", {
|
|
52
|
+
css: iconWrapperStyle
|
|
53
|
+
}, jsx(SuccessIcon, {
|
|
46
54
|
size: "small",
|
|
47
55
|
label: "success"
|
|
48
56
|
})), children);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React, { useCallback, useRef } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
2
4
|
import { injectIntl } from 'react-intl-next';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
5
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
5
6
|
import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
|
|
6
7
|
import { N30, N50 } from '@atlaskit/theme/colors';
|
|
@@ -10,7 +11,7 @@ import { unsupportedContentMessages } from '../../messages/unsupportedContent';
|
|
|
10
11
|
import { ACTION_SUBJECT_ID } from '../../utils/analytics';
|
|
11
12
|
import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
|
|
12
13
|
import { getUnsupportedContent } from '../unsupported-content-helper';
|
|
13
|
-
const
|
|
14
|
+
const blockNodeStyle = css`
|
|
14
15
|
align-items: center;
|
|
15
16
|
background: ${N30};
|
|
16
17
|
border: 1px dashed ${N50};
|
|
@@ -43,15 +44,18 @@ const UnsupportedBlockNode = ({
|
|
|
43
44
|
});
|
|
44
45
|
const originalNodeType = node === null || node === void 0 ? void 0 : node.attrs.originalValue.type;
|
|
45
46
|
const tooltipOnShowHandler = useCallback(() => dispatchAnalyticsEvent && trackUnsupportedContentTooltipDisplayedFor(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.ON_UNSUPPORTED_BLOCK, originalNodeType), [dispatchAnalyticsEvent, originalNodeType]);
|
|
46
|
-
return
|
|
47
|
+
return jsx("div", {
|
|
48
|
+
css: blockNodeStyle,
|
|
49
|
+
className: "unsupported"
|
|
50
|
+
}, message, jsx(Tooltip, {
|
|
47
51
|
content: tooltipContent,
|
|
48
52
|
hideTooltipOnClick: false,
|
|
49
53
|
position: "bottom",
|
|
50
54
|
onShow: tooltipOnShowHandler,
|
|
51
55
|
strategy: "absolute"
|
|
52
|
-
},
|
|
56
|
+
}, jsx("span", {
|
|
53
57
|
style: style
|
|
54
|
-
},
|
|
58
|
+
}, jsx(QuestionsIcon, {
|
|
55
59
|
label: "?",
|
|
56
60
|
size: "small"
|
|
57
61
|
}))));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React, { useCallback, useRef } from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
2
4
|
import { injectIntl } from 'react-intl-next';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
5
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
5
6
|
import QuestionsIcon from '@atlaskit/icon/glyph/question-circle';
|
|
6
7
|
import { N30, N50 } from '@atlaskit/theme/colors';
|
|
@@ -10,7 +11,7 @@ import { unsupportedContentMessages } from '../../messages/unsupportedContent';
|
|
|
10
11
|
import { ACTION_SUBJECT_ID } from '../../utils/analytics';
|
|
11
12
|
import { trackUnsupportedContentTooltipDisplayedFor } from '../../utils/track-unsupported-content';
|
|
12
13
|
import { getUnsupportedContent } from '../unsupported-content-helper';
|
|
13
|
-
const
|
|
14
|
+
const inlineNodeStyle = css`
|
|
14
15
|
align-items: center;
|
|
15
16
|
background: ${N30};
|
|
16
17
|
border: 1px dashed ${N50};
|
|
@@ -40,15 +41,17 @@ const UnsupportedInlineNode = ({
|
|
|
40
41
|
});
|
|
41
42
|
const originalNodeType = node === null || node === void 0 ? void 0 : node.attrs.originalValue.type;
|
|
42
43
|
const tooltipOnShowHandler = useCallback(() => dispatchAnalyticsEvent && trackUnsupportedContentTooltipDisplayedFor(dispatchAnalyticsEvent, ACTION_SUBJECT_ID.ON_UNSUPPORTED_INLINE, originalNodeType), [dispatchAnalyticsEvent, originalNodeType]);
|
|
43
|
-
return
|
|
44
|
+
return jsx("span", {
|
|
45
|
+
css: inlineNodeStyle
|
|
46
|
+
}, message, jsx(Tooltip, {
|
|
44
47
|
content: tooltipContent,
|
|
45
48
|
hideTooltipOnClick: false,
|
|
46
49
|
position: "bottom",
|
|
47
50
|
onShow: tooltipOnShowHandler,
|
|
48
51
|
strategy: "absolute"
|
|
49
|
-
},
|
|
52
|
+
}, jsx("span", {
|
|
50
53
|
style: style
|
|
51
|
-
},
|
|
54
|
+
}, jsx(QuestionsIcon, {
|
|
52
55
|
label: "?",
|
|
53
56
|
size: "small"
|
|
54
57
|
}))));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
2
4
|
import React from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
3
6
|
import rafSchedule from 'raf-schd';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
7
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
6
8
|
const SCROLLBAR_WIDTH = 30;
|
|
7
9
|
export function getBreakpoint(width = 0) {
|
|
@@ -27,10 +29,6 @@ const {
|
|
|
27
29
|
Provider,
|
|
28
30
|
Consumer
|
|
29
31
|
} = WidthContext;
|
|
30
|
-
const RelativeContainer = /*#__PURE__*/React.memo(styled.div`
|
|
31
|
-
position: relative;
|
|
32
|
-
width: 100%;
|
|
33
|
-
`);
|
|
34
32
|
export class WidthProvider extends React.Component {
|
|
35
33
|
constructor(props) {
|
|
36
34
|
super(props);
|
|
@@ -54,12 +52,16 @@ export class WidthProvider extends React.Component {
|
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
render() {
|
|
57
|
-
return
|
|
55
|
+
return jsx("div", {
|
|
56
|
+
css: css`
|
|
57
|
+
position: relative;
|
|
58
|
+
width: 100%;
|
|
59
|
+
`,
|
|
58
60
|
className: this.props.className
|
|
59
|
-
},
|
|
61
|
+
}, jsx(WidthObserver, {
|
|
60
62
|
setWidth: this.setWidth,
|
|
61
63
|
offscreen: true
|
|
62
|
-
}),
|
|
64
|
+
}), jsx(Provider, {
|
|
63
65
|
value: createWidthContext(this.state.width)
|
|
64
66
|
}, this.props.children));
|
|
65
67
|
}
|