@atlaskit/editor-plugin-media 0.4.10 → 0.5.1
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 +17 -0
- package/dist/cjs/nodeviews/mediaInline.js +17 -1
- package/dist/cjs/nodeviews/mediaSingle.js +11 -10
- package/dist/cjs/nodeviews/styles.js +5 -4
- package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +15 -14
- package/dist/cjs/toolbar/index.js +28 -1
- package/dist/cjs/toolbar/layout-group.js +7 -5
- package/dist/cjs/toolbar/linking-toolbar-appearance.js +12 -11
- package/dist/cjs/ui/CaptionPlaceholder/index.js +3 -2
- package/dist/cjs/ui/ImageBorder/index.js +23 -20
- package/dist/cjs/ui/Media/DropPlaceholder.js +5 -4
- package/dist/cjs/ui/MediaLinkingToolbar.js +15 -13
- package/dist/cjs/ui/PixelEntry/index.js +18 -15
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +4 -1
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -4
- package/dist/cjs/ui/ResizableMediaSingle/index.js +5 -4
- package/dist/cjs/utils/media-files.js +24 -3
- package/dist/cjs/utils/media-single.js +6 -3
- package/dist/es2019/nodeviews/mediaInline.js +17 -1
- package/dist/es2019/nodeviews/mediaSingle.js +12 -9
- package/dist/es2019/nodeviews/styles.js +6 -5
- package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +17 -15
- package/dist/es2019/toolbar/index.js +26 -1
- package/dist/es2019/toolbar/layout-group.js +7 -6
- package/dist/es2019/toolbar/linking-toolbar-appearance.js +13 -12
- package/dist/es2019/ui/CaptionPlaceholder/index.js +4 -3
- package/dist/es2019/ui/ImageBorder/index.js +22 -20
- package/dist/es2019/ui/Media/DropPlaceholder.js +6 -5
- package/dist/es2019/ui/MediaLinkingToolbar.js +14 -13
- package/dist/es2019/ui/PixelEntry/index.js +17 -15
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +3 -1
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -3
- package/dist/es2019/ui/ResizableMediaSingle/index.js +5 -3
- package/dist/es2019/utils/media-files.js +24 -3
- package/dist/es2019/utils/media-single.js +6 -2
- package/dist/esm/nodeviews/mediaInline.js +17 -1
- package/dist/esm/nodeviews/mediaSingle.js +12 -9
- package/dist/esm/nodeviews/styles.js +6 -5
- package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +17 -15
- package/dist/esm/toolbar/index.js +28 -1
- package/dist/esm/toolbar/layout-group.js +7 -6
- package/dist/esm/toolbar/linking-toolbar-appearance.js +13 -12
- package/dist/esm/ui/CaptionPlaceholder/index.js +4 -3
- package/dist/esm/ui/ImageBorder/index.js +22 -20
- package/dist/esm/ui/Media/DropPlaceholder.js +6 -5
- package/dist/esm/ui/MediaLinkingToolbar.js +14 -13
- package/dist/esm/ui/PixelEntry/index.js +17 -15
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaMigrationNotification.js +3 -1
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +5 -3
- package/dist/esm/ui/ResizableMediaSingle/index.js +5 -3
- package/dist/esm/utils/media-files.js +24 -3
- package/dist/esm/utils/media-single.js +6 -3
- package/package.json +4 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
2
3
|
import { ButtonGroup } from '@atlaskit/button';
|
|
3
4
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator } from '@atlaskit/editor-common/ui';
|
|
4
5
|
const containerStyles = css({
|
|
@@ -9,19 +10,19 @@ export const LayoutGroup = ({
|
|
|
9
10
|
dispatchCommand,
|
|
10
11
|
hide
|
|
11
12
|
}) => {
|
|
12
|
-
return
|
|
13
|
+
return jsx("div", {
|
|
13
14
|
css: containerStyles
|
|
14
|
-
},
|
|
15
|
+
}, jsx(ButtonGroup, null, layoutButtons.map((item, idx) => {
|
|
15
16
|
switch (item.type) {
|
|
16
17
|
case 'separator':
|
|
17
|
-
return
|
|
18
|
+
return jsx(FloatingToolbarSeparator, {
|
|
18
19
|
key: idx
|
|
19
20
|
});
|
|
20
21
|
case 'button':
|
|
21
22
|
const ButtonIcon = item.icon;
|
|
22
|
-
return
|
|
23
|
+
return jsx(Button, {
|
|
23
24
|
key: idx,
|
|
24
|
-
icon: item.icon ?
|
|
25
|
+
icon: item.icon ? jsx(ButtonIcon, {
|
|
25
26
|
label: item.title
|
|
26
27
|
}) : undefined,
|
|
27
28
|
title: item.title,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React, { Fragment, useEffect, useState } from 'react';
|
|
2
|
-
import { css } from '@emotion/react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
4
5
|
import { addLink, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
5
6
|
import { linkMessages, linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
@@ -48,42 +49,42 @@ export const LinkToolbarAppearance = ({
|
|
|
48
49
|
const isValidUrl = isSafeUrl(mediaLinkingState.link);
|
|
49
50
|
const title = intl.formatMessage(linkToolbarMessages.editLink);
|
|
50
51
|
const linkTitle = intl.formatMessage(isValidUrl ? linkMessages.openLink : linkToolbarMessages.unableToOpenLink);
|
|
51
|
-
return
|
|
52
|
+
return jsx(Fragment, null, jsx("div", {
|
|
52
53
|
css: wrapper
|
|
53
|
-
},
|
|
54
|
+
}, jsx(ToolbarButton, {
|
|
54
55
|
onClick: onEditLink,
|
|
55
56
|
title: title,
|
|
56
|
-
tooltipContent:
|
|
57
|
+
tooltipContent: jsx(ToolTipContent, {
|
|
57
58
|
description: title,
|
|
58
59
|
keymap: addLink
|
|
59
60
|
}),
|
|
60
61
|
testId: "edit-link-button"
|
|
61
|
-
}, title)),
|
|
62
|
+
}, title)), jsx("div", {
|
|
62
63
|
css: wrapper
|
|
63
|
-
},
|
|
64
|
+
}, jsx(Separator, null)), jsx(ToolbarButton, {
|
|
64
65
|
target: "_blank",
|
|
65
66
|
href: isValidUrl ? mediaLinkingState.link : undefined,
|
|
66
67
|
disabled: !isValidUrl,
|
|
67
68
|
onClick: onOpenLink,
|
|
68
69
|
title: linkTitle,
|
|
69
|
-
icon:
|
|
70
|
+
icon: jsx(OpenIcon, {
|
|
70
71
|
label: linkTitle
|
|
71
72
|
}),
|
|
72
73
|
className: "hyperlink-open-link"
|
|
73
|
-
}),
|
|
74
|
+
}), jsx(Separator, null));
|
|
74
75
|
} else {
|
|
75
76
|
const title = intl.formatMessage(linkToolbarMessages.addLink);
|
|
76
|
-
return
|
|
77
|
+
return jsx(Fragment, null, jsx(ToolbarButton, {
|
|
77
78
|
testId: "add-link-button",
|
|
78
79
|
onClick: onAddLink,
|
|
79
80
|
title: title,
|
|
80
|
-
tooltipContent:
|
|
81
|
+
tooltipContent: jsx(ToolTipContent, {
|
|
81
82
|
description: title,
|
|
82
83
|
keymap: addLink
|
|
83
84
|
}),
|
|
84
|
-
icon:
|
|
85
|
+
icon: jsx(LinkIcon, {
|
|
85
86
|
label: title
|
|
86
87
|
})
|
|
87
|
-
}),
|
|
88
|
+
}), jsx(Separator, null));
|
|
88
89
|
}
|
|
89
90
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { css } from '@emotion/react';
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
5
|
import { CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
|
|
5
6
|
import { N200 } from '@atlaskit/theme/colors';
|
|
@@ -14,11 +15,11 @@ const placeholder = css`
|
|
|
14
15
|
export default /*#__PURE__*/React.forwardRef(({
|
|
15
16
|
onClick
|
|
16
17
|
}, ref) => {
|
|
17
|
-
return
|
|
18
|
+
return jsx("span", {
|
|
18
19
|
ref: ref,
|
|
19
20
|
css: placeholder,
|
|
20
21
|
onClick: onClick,
|
|
21
22
|
"data-id": CAPTION_PLACEHOLDER_ID,
|
|
22
23
|
"data-testid": "caption-placeholder"
|
|
23
|
-
},
|
|
24
|
+
}, jsx(FormattedMessage, messages.placeholder));
|
|
24
25
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import { useRef, useState } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
2
4
|
import { BorderIcon } from '@atlaskit/editor-common/icons';
|
|
3
5
|
import { DropdownMenuSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
4
6
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
@@ -48,14 +50,14 @@ const ImageBorder = ({
|
|
|
48
50
|
value: {
|
|
49
51
|
name: 'color'
|
|
50
52
|
},
|
|
51
|
-
elemAfter:
|
|
53
|
+
elemAfter: jsx("div", {
|
|
52
54
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
53
|
-
},
|
|
55
|
+
}, jsx("div", {
|
|
54
56
|
css: contextualMenuColorIcon(color && hexToEditorBorderPaletteColor(color))
|
|
55
|
-
}), isColorSubmenuOpen &&
|
|
57
|
+
}), isColorSubmenuOpen && jsx("div", {
|
|
56
58
|
css: contextualSubMenu(0),
|
|
57
59
|
ref: handleSubMenuRef
|
|
58
|
-
},
|
|
60
|
+
}, jsx(ColorPalette, {
|
|
59
61
|
onClick: color => {
|
|
60
62
|
setBorder({
|
|
61
63
|
color
|
|
@@ -74,22 +76,22 @@ const ImageBorder = ({
|
|
|
74
76
|
value: {
|
|
75
77
|
name: 'size'
|
|
76
78
|
},
|
|
77
|
-
elemAfter:
|
|
79
|
+
elemAfter: jsx("div", {
|
|
78
80
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
79
|
-
},
|
|
81
|
+
}, jsx("div", {
|
|
80
82
|
css: contextualMenuArrow
|
|
81
|
-
}), isSizeSubmenuOpen &&
|
|
83
|
+
}), isSizeSubmenuOpen && jsx("div", {
|
|
82
84
|
css: contextualSubMenu(1),
|
|
83
85
|
ref: handleSubMenuRef
|
|
84
86
|
}, borderSizeOptions.map(({
|
|
85
87
|
name,
|
|
86
88
|
value
|
|
87
|
-
}, idx) =>
|
|
89
|
+
}, idx) => jsx(Tooltip, {
|
|
88
90
|
key: idx,
|
|
89
91
|
content: name
|
|
90
|
-
},
|
|
92
|
+
}, jsx("span", {
|
|
91
93
|
css: buttonWrapperStyle
|
|
92
|
-
},
|
|
94
|
+
}, jsx("button", {
|
|
93
95
|
css: buttonStyle(value === size),
|
|
94
96
|
"aria-label": name,
|
|
95
97
|
role: "radio",
|
|
@@ -103,7 +105,7 @@ const ImageBorder = ({
|
|
|
103
105
|
onMouseDown: e => {
|
|
104
106
|
e.preventDefault();
|
|
105
107
|
}
|
|
106
|
-
},
|
|
108
|
+
}, jsx("div", {
|
|
107
109
|
css: line(value, value === size),
|
|
108
110
|
role: "presentation"
|
|
109
111
|
})))))))
|
|
@@ -116,47 +118,47 @@ const ImageBorder = ({
|
|
|
116
118
|
const fitTolerance = 10;
|
|
117
119
|
const fitWidth = menuItemDimensions.width;
|
|
118
120
|
const fitHeight = items.length * (menuItemDimensions.height + itemSpacing);
|
|
119
|
-
return
|
|
121
|
+
return jsx("div", null, jsx("div", {
|
|
120
122
|
css: toolbarButtonWrapper({
|
|
121
123
|
enabled,
|
|
122
124
|
isOpen
|
|
123
125
|
})
|
|
124
|
-
},
|
|
126
|
+
}, jsx(ToolbarButton, {
|
|
125
127
|
className: "image-border-toolbar-btn",
|
|
126
128
|
selected: enabled,
|
|
127
129
|
onClick: toggleBorder,
|
|
128
130
|
spacing: "compact",
|
|
129
131
|
"aria-label": enabled ? formatMessage(messages.removeBorder) : formatMessage(messages.addBorder),
|
|
130
|
-
iconBefore:
|
|
132
|
+
iconBefore: jsx(BorderIcon, {
|
|
131
133
|
label: ""
|
|
132
134
|
}),
|
|
133
135
|
title: enabled ? formatMessage(messages.removeBorder) : formatMessage(messages.addBorder)
|
|
134
|
-
}),
|
|
136
|
+
}), jsx("div", {
|
|
135
137
|
ref: popupTarget
|
|
136
|
-
},
|
|
138
|
+
}, jsx(ToolbarButton, {
|
|
137
139
|
className: "image-border-toolbar-dropdown",
|
|
138
140
|
selected: enabled || isOpen,
|
|
139
141
|
"aria-label": formatMessage(messages.borderOptions),
|
|
140
142
|
title: formatMessage(messages.borderOptions),
|
|
141
143
|
spacing: "compact",
|
|
142
|
-
iconBefore:
|
|
144
|
+
iconBefore: jsx(ExpandIcon, {
|
|
143
145
|
label: ""
|
|
144
146
|
}),
|
|
145
147
|
onClick: () => {
|
|
146
148
|
setIsOpen(!isOpen);
|
|
147
149
|
}
|
|
148
|
-
}))),
|
|
150
|
+
}))), jsx(Popup, {
|
|
149
151
|
target: popupTarget.current ? popupTarget.current : undefined,
|
|
150
152
|
fitWidth: fitWidth + fitTolerance,
|
|
151
153
|
fitHeight: fitHeight + fitTolerance,
|
|
152
154
|
forcePlacement: true,
|
|
153
155
|
stick: true
|
|
154
|
-
},
|
|
156
|
+
}, jsx("div", {
|
|
155
157
|
onMouseLeave: () => {
|
|
156
158
|
setIsColorSubmenuOpen(false);
|
|
157
159
|
setIsSizeSubmenuOpen(false);
|
|
158
160
|
}
|
|
159
|
-
},
|
|
161
|
+
}, jsx(DropdownMenu
|
|
160
162
|
//This needs be removed when the a11y is completely handled
|
|
161
163
|
//Disabling key navigation now as it works only partially
|
|
162
164
|
//Same with packages/editor/editor-plugin-table/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
2
3
|
import { injectIntl } from 'react-intl-next';
|
|
3
4
|
import { hexToRgba } from '@atlaskit/adf-schema';
|
|
4
5
|
import DocumentFilledIcon from '@atlaskit/icon/glyph/document-filled';
|
|
@@ -31,9 +32,9 @@ const IconWrapperComponent = props => {
|
|
|
31
32
|
const {
|
|
32
33
|
dropPlaceholderLabel
|
|
33
34
|
} = dropPlaceholderMessages;
|
|
34
|
-
return
|
|
35
|
+
return jsx("div", {
|
|
35
36
|
css: iconWrapper
|
|
36
|
-
},
|
|
37
|
+
}, jsx(DocumentFilledIcon, {
|
|
37
38
|
label: intl.formatMessage(dropPlaceholderLabel),
|
|
38
39
|
size: "medium"
|
|
39
40
|
}));
|
|
@@ -41,6 +42,6 @@ const IconWrapperComponent = props => {
|
|
|
41
42
|
const IntlIconWrapper = injectIntl(IconWrapperComponent);
|
|
42
43
|
export default (({
|
|
43
44
|
type = 'group'
|
|
44
|
-
}) => type === 'single' ?
|
|
45
|
+
}) => type === 'single' ? jsx("div", {
|
|
45
46
|
css: dropLine
|
|
46
|
-
}) :
|
|
47
|
+
}) : jsx(IntlIconWrapper, null));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
/** @jsx jsx */
|
|
2
3
|
import React, { Fragment } from 'react';
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
4
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
import { container, containerWithProvider, inputWrapper, RecentSearch } from '@atlaskit/editor-common/link';
|
|
6
7
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
@@ -96,28 +97,28 @@ export class LinkAddToolbar extends React.PureComponent {
|
|
|
96
97
|
const formatLinkAddressText = formatMessage(mediaLinkToolbarMessages.backLink);
|
|
97
98
|
const formatUnlinkText = formatMessage(linkToolbarMessages.unlink);
|
|
98
99
|
const errorsList = this.state.validationErrors.map(function (error, index) {
|
|
99
|
-
return
|
|
100
|
+
return jsx(ErrorMessage, {
|
|
100
101
|
key: index
|
|
101
102
|
}, error);
|
|
102
103
|
});
|
|
103
|
-
return
|
|
104
|
+
return jsx("div", {
|
|
104
105
|
className: "recent-list"
|
|
105
|
-
},
|
|
106
|
+
}, jsx("div", {
|
|
106
107
|
css: [container, !!activityProvider && containerWithProvider]
|
|
107
|
-
},
|
|
108
|
+
}, jsx("div", {
|
|
108
109
|
css: inputWrapper
|
|
109
|
-
},
|
|
110
|
+
}, jsx("span", {
|
|
110
111
|
css: buttonWrapper
|
|
111
|
-
},
|
|
112
|
+
}, jsx(Button, {
|
|
112
113
|
title: formatLinkAddressText,
|
|
113
|
-
icon:
|
|
114
|
+
icon: jsx(ChevronLeftLargeIcon, {
|
|
114
115
|
label: formatLinkAddressText
|
|
115
116
|
}),
|
|
116
117
|
onClick: () => this.handleOnBack({
|
|
117
118
|
url: value,
|
|
118
119
|
inputMethod: currentInputMethod
|
|
119
120
|
})
|
|
120
|
-
})),
|
|
121
|
+
})), jsx(PanelTextInput, {
|
|
121
122
|
testId: "media-link-input",
|
|
122
123
|
placeholder: getPlaceholder(!!activityProvider),
|
|
123
124
|
autoFocus: true,
|
|
@@ -139,13 +140,13 @@ export class LinkAddToolbar extends React.PureComponent {
|
|
|
139
140
|
onChange(value);
|
|
140
141
|
},
|
|
141
142
|
onKeyDown: onKeyDown
|
|
142
|
-
}), normalizeUrl(displayUrl) &&
|
|
143
|
+
}), normalizeUrl(displayUrl) && jsx(Fragment, null, jsx(Separator, null), jsx(Button, {
|
|
143
144
|
title: formatUnlinkText,
|
|
144
|
-
icon:
|
|
145
|
+
icon: jsx(EditorUnlinkIcon, {
|
|
145
146
|
label: formatUnlinkText
|
|
146
147
|
}),
|
|
147
148
|
onClick: this.handleUnlink
|
|
148
|
-
}))), !!errorsList.length &&
|
|
149
|
+
}))), !!errorsList.length && jsx("section", {
|
|
149
150
|
css: validationWrapper
|
|
150
151
|
}, errorsList), renderRecentList()));
|
|
151
152
|
});
|
|
@@ -177,7 +178,7 @@ export class LinkAddToolbar extends React.PureComponent {
|
|
|
177
178
|
providerFactory,
|
|
178
179
|
displayUrl
|
|
179
180
|
} = this.props;
|
|
180
|
-
return
|
|
181
|
+
return jsx(RecentSearch, {
|
|
181
182
|
defaultUrl: normalizeUrl(displayUrl),
|
|
182
183
|
providerFactory: providerFactory,
|
|
183
184
|
onSubmit: this.handleSubmit,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/** @jsx jsx */
|
|
2
3
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
3
5
|
import Button from '@atlaskit/button';
|
|
4
6
|
import Form, { Field } from '@atlaskit/form';
|
|
5
7
|
import Textfield from '@atlaskit/textfield';
|
|
@@ -93,37 +95,37 @@ export const PixelEntry = ({
|
|
|
93
95
|
onChange && onChange(isInvalidInputValid);
|
|
94
96
|
}, [minWidth, maxWidth, onChange, ratioWidth, ratioHeight]);
|
|
95
97
|
if (showMigration) {
|
|
96
|
-
return
|
|
98
|
+
return jsx(Tooltip, {
|
|
97
99
|
content: formatMessage(messages.migrationButtonTooltip)
|
|
98
|
-
},
|
|
100
|
+
}, jsx(Button, {
|
|
99
101
|
appearance: "warning",
|
|
100
102
|
spacing: "compact",
|
|
101
103
|
onClick: onMigrate,
|
|
102
104
|
testId: PIXELENTRY_MIGRATION_BUTTON_TESTID
|
|
103
105
|
}, formatMessage(messages.migrationButtonText)));
|
|
104
106
|
}
|
|
105
|
-
return
|
|
107
|
+
return jsx("div", {
|
|
106
108
|
css: pixelEntryForm
|
|
107
|
-
},
|
|
109
|
+
}, jsx(Form, {
|
|
108
110
|
onSubmit: handleOnSubmit
|
|
109
111
|
}, ({
|
|
110
112
|
formProps
|
|
111
113
|
}) => {
|
|
112
|
-
return
|
|
114
|
+
return jsx("form", formProps, jsx("div", {
|
|
113
115
|
css: pixelSizingWrapper
|
|
114
|
-
},
|
|
116
|
+
}, jsx(Field, {
|
|
115
117
|
key: "inputWidth",
|
|
116
118
|
name: "inputWidth",
|
|
117
119
|
defaultValue: computedWidth
|
|
118
120
|
}, ({
|
|
119
121
|
fieldProps
|
|
120
|
-
}) =>
|
|
122
|
+
}) => jsx(Tooltip, {
|
|
121
123
|
hideTooltipOnMouseDown: true,
|
|
122
124
|
content: formatMessage(messages.inputWidthTooltip, {
|
|
123
125
|
maxWidth
|
|
124
126
|
}),
|
|
125
127
|
position: "top"
|
|
126
|
-
},
|
|
128
|
+
}, jsx(Textfield, _extends({}, fieldProps, {
|
|
127
129
|
css: [pixelSizingWidthInput, pixelSizingInput],
|
|
128
130
|
appearance: "none",
|
|
129
131
|
isCompact: true,
|
|
@@ -132,26 +134,26 @@ export const PixelEntry = ({
|
|
|
132
134
|
"aria-label": formatMessage(messages.inputWidthAriaLabel, {
|
|
133
135
|
maxWidth
|
|
134
136
|
})
|
|
135
|
-
})))),
|
|
137
|
+
})))), jsx("span", {
|
|
136
138
|
css: pixelSizingLabel
|
|
137
|
-
}, "x"),
|
|
139
|
+
}, "x"), jsx(Field, {
|
|
138
140
|
key: "inputHeight",
|
|
139
141
|
name: "inputHeight",
|
|
140
142
|
defaultValue: computedHeight
|
|
141
143
|
}, ({
|
|
142
144
|
fieldProps
|
|
143
|
-
}) =>
|
|
145
|
+
}) => jsx(Tooltip, {
|
|
144
146
|
hideTooltipOnMouseDown: true,
|
|
145
147
|
content: formatMessage(messages.inputHeightTooltip),
|
|
146
148
|
position: "top"
|
|
147
|
-
},
|
|
149
|
+
}, jsx(Textfield, _extends({}, fieldProps, {
|
|
148
150
|
css: [pixelSizingHeightInput, pixelSizingInput],
|
|
149
151
|
appearance: "none",
|
|
150
152
|
isCompact: true,
|
|
151
153
|
onChange: handleOnChange('inputHeight'),
|
|
152
154
|
pattern: "\\d*",
|
|
153
155
|
"aria-label": formatMessage(messages.inputHeightAriaLabel)
|
|
154
|
-
})))),
|
|
156
|
+
})))), jsx(Button, {
|
|
155
157
|
css: pixelEntryHiddenSubmit,
|
|
156
158
|
type: "submit"
|
|
157
159
|
}, formatMessage(messages.submitButtonText))));
|
|
@@ -162,7 +164,7 @@ export const FullWidthDisplay = ({
|
|
|
162
164
|
formatMessage
|
|
163
165
|
}
|
|
164
166
|
}) => {
|
|
165
|
-
return
|
|
167
|
+
return jsx("div", {
|
|
166
168
|
css: pixelSizingFullWidthLabelStyles
|
|
167
|
-
},
|
|
169
|
+
}, jsx("span", null, formatMessage(messages.fullWidthLabel)));
|
|
168
170
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
1
3
|
import { resizableMediaMigrationNotificationStyle } from './styles';
|
|
2
4
|
export const ResizableMediaMigrationNotification = () => {
|
|
3
|
-
return
|
|
5
|
+
return jsx("div", {
|
|
4
6
|
"data-testid": "resizable-media-migration-notification",
|
|
5
7
|
css: [resizableMediaMigrationNotificationStyle]
|
|
6
8
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
/** @jsx jsx */
|
|
2
3
|
import React from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
3
5
|
import classnames from 'classnames';
|
|
4
6
|
import throttle from 'lodash/throttle';
|
|
5
7
|
import memoizeOne from 'memoize-one';
|
|
@@ -420,7 +422,7 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
420
422
|
|
|
421
423
|
// while is not resizing, we take 100% as min-width if the container width is less than the min-width
|
|
422
424
|
const minViewWidth = isResizing ? minWidth : `min(${minWidth}px, 100%)`;
|
|
423
|
-
return
|
|
425
|
+
return jsx("div", {
|
|
424
426
|
css: wrapperStyle({
|
|
425
427
|
layout,
|
|
426
428
|
containerWidth: containerWidth || origWidth,
|
|
@@ -429,7 +431,7 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
429
431
|
isNestedNode,
|
|
430
432
|
isExtendedResizeExperienceOn: true
|
|
431
433
|
})
|
|
432
|
-
},
|
|
434
|
+
}, jsx(ResizerNext, {
|
|
433
435
|
minWidth: minViewWidth,
|
|
434
436
|
maxWidth: maxWidth,
|
|
435
437
|
className: resizerNextClassName,
|
|
@@ -445,7 +447,7 @@ class ResizableMediaSingleNext extends React.Component {
|
|
|
445
447
|
isHandleVisible: selected,
|
|
446
448
|
handlePositioning: isNestedNode ? 'adjacent' : undefined,
|
|
447
449
|
handleHighlight: "full-height"
|
|
448
|
-
}, children, showLegacyNotification &&
|
|
450
|
+
}, children, showLegacyNotification && jsx(ResizableMediaMigrationNotification, null)));
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
453
|
export default ResizableMediaSingleNext;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
/** @jsx jsx */
|
|
3
4
|
import React from 'react';
|
|
5
|
+
import { jsx } from '@emotion/react';
|
|
4
6
|
import { calculateOffsetLeft } from '@atlaskit/editor-common/media-single';
|
|
5
7
|
import { calcColumnsFromPx, calcMediaPxWidth, calcPctFromPx, handleSides, imageAlignmentMap, Resizer, snapTo, wrappedLayouts } from '@atlaskit/editor-common/ui';
|
|
6
8
|
import { calculateSnapPoints } from '@atlaskit/editor-common/utils';
|
|
@@ -309,7 +311,7 @@ export default class ResizableMediaSingle extends React.Component {
|
|
|
309
311
|
}
|
|
310
312
|
};
|
|
311
313
|
};
|
|
312
|
-
return
|
|
314
|
+
return jsx("div", {
|
|
313
315
|
ref: this.saveWrapper,
|
|
314
316
|
css: wrapperStyle({
|
|
315
317
|
layout,
|
|
@@ -317,7 +319,7 @@ export default class ResizableMediaSingle extends React.Component {
|
|
|
317
319
|
containerWidth: containerWidth || origWidth,
|
|
318
320
|
fullWidthMode
|
|
319
321
|
})
|
|
320
|
-
},
|
|
322
|
+
}, jsx(Resizer, _extends({}, this.props, {
|
|
321
323
|
displayGrid: this.displayGrid,
|
|
322
324
|
ratio: ratio,
|
|
323
325
|
width: initialWidth,
|
|
@@ -333,7 +335,7 @@ export default class ResizableMediaSingle extends React.Component {
|
|
|
333
335
|
// press “Up“ key will result cursor focus on an invalid position, (on the resize handler)
|
|
334
336
|
// This workaround adds an empty div inside the resize handler to prevent the issue.
|
|
335
337
|
,
|
|
336
|
-
handleComponentFunc: () =>
|
|
338
|
+
handleComponentFunc: () => jsx("div", {
|
|
337
339
|
contentEditable: false
|
|
338
340
|
}),
|
|
339
341
|
handleStyles: nestedInTableHandleStyles(this.isNestedInTable())
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/media-inline';
|
|
2
3
|
import { atTheBeginningOfBlock, atTheEndOfBlock, atTheEndOfDoc, endPositionOfParent, startPositionOfParent } from '@atlaskit/editor-common/selection';
|
|
3
4
|
import { findFarthestParentNode, insideTableCell, isInLayoutColumn, isInListItem, isSupportedInParent, setNodeSelection, setTextSelection } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import { canInsert, hasParentNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { isImage } from './is-type';
|
|
6
9
|
import { copyOptionalAttrsFromMediaState, isInsidePotentialEmptyParagraph, isSelectionNonMediaBlockNode, posOfMediaGroupNearby, posOfParentMediaGroup, posOfPrecedingMediaGroup } from './media-common';
|
|
7
10
|
export const canInsertMediaInline = state => {
|
|
8
11
|
const node = state.schema.nodes.mediaInline.create({});
|
|
@@ -96,12 +99,30 @@ export const insertMediaInlineNode = editorAnalyticsAPI => (view, mediaState, co
|
|
|
96
99
|
return false;
|
|
97
100
|
}
|
|
98
101
|
const {
|
|
99
|
-
id
|
|
102
|
+
id,
|
|
103
|
+
dimensions,
|
|
104
|
+
scaleFactor = 1
|
|
100
105
|
} = mediaState;
|
|
101
|
-
|
|
106
|
+
let mediaInlineAttrs = {
|
|
102
107
|
id,
|
|
103
108
|
collection
|
|
104
|
-
}
|
|
109
|
+
};
|
|
110
|
+
if (
|
|
111
|
+
// TODO: replace it with new shouldShowInlineImage
|
|
112
|
+
getBooleanFF('platform.editor.media.inline-image.base-support') && isImage(mediaState.fileMimeType)) {
|
|
113
|
+
const {
|
|
114
|
+
width,
|
|
115
|
+
height
|
|
116
|
+
} = dimensions || {
|
|
117
|
+
width: undefined,
|
|
118
|
+
height: undefined
|
|
119
|
+
};
|
|
120
|
+
const scaledWidth = width ? Math.round(width / scaleFactor) : DEFAULT_IMAGE_WIDTH;
|
|
121
|
+
const scaledHeight = height ? Math.round(height / scaleFactor) : DEFAULT_IMAGE_HEIGHT;
|
|
122
|
+
mediaInlineAttrs.width = scaledWidth;
|
|
123
|
+
mediaInlineAttrs.height = scaledHeight;
|
|
124
|
+
}
|
|
125
|
+
const mediaInlineNode = mediaInline.create(mediaInlineAttrs);
|
|
105
126
|
const space = state.schema.text(' ');
|
|
106
127
|
let pos = state.selection.$to.pos;
|
|
107
128
|
|
|
@@ -130,7 +130,8 @@ export const createMediaSingleNode = (schema, collection, maxWidth, minWidth, al
|
|
|
130
130
|
id,
|
|
131
131
|
dimensions,
|
|
132
132
|
contextId,
|
|
133
|
-
scaleFactor = 1
|
|
133
|
+
scaleFactor = 1,
|
|
134
|
+
fileName
|
|
134
135
|
} = mediaState;
|
|
135
136
|
const {
|
|
136
137
|
width,
|
|
@@ -150,7 +151,10 @@ export const createMediaSingleNode = (schema, collection, maxWidth, minWidth, al
|
|
|
150
151
|
collection,
|
|
151
152
|
contextId,
|
|
152
153
|
width: scaledWidth,
|
|
153
|
-
height: height && Math.round(height / scaleFactor)
|
|
154
|
+
height: height && Math.round(height / scaleFactor),
|
|
155
|
+
...(getBooleanFF('platform.editor.a11y-media_er96o') && fileName && {
|
|
156
|
+
alt: fileName
|
|
157
|
+
})
|
|
154
158
|
});
|
|
155
159
|
const mediaSingleAttrs = alignLeftOnInsert ? {
|
|
156
160
|
layout: 'align-start'
|
|
@@ -14,9 +14,11 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
15
|
import React, { useEffect, useState } from 'react';
|
|
16
16
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
17
|
+
import { MediaInlineImageCard, shouldShowInlineImage } from '@atlaskit/editor-common/media-inline';
|
|
17
18
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
18
19
|
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
19
20
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
21
|
+
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
20
22
|
import { MediaInlineCardLoadingView } from '@atlaskit/media-ui';
|
|
21
23
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
22
24
|
import { MediaInlineNodeSelector } from './styles';
|
|
@@ -147,7 +149,11 @@ export var MediaInline = function MediaInline(props) {
|
|
|
147
149
|
}();
|
|
148
150
|
var _props$node$attrs = props.node.attrs,
|
|
149
151
|
id = _props$node$attrs.id,
|
|
150
|
-
collection = _props$node$attrs.collection
|
|
152
|
+
collection = _props$node$attrs.collection,
|
|
153
|
+
type = _props$node$attrs.type,
|
|
154
|
+
alt = _props$node$attrs.alt,
|
|
155
|
+
width = _props$node$attrs.width,
|
|
156
|
+
height = _props$node$attrs.height;
|
|
151
157
|
var identifier = {
|
|
152
158
|
id: id,
|
|
153
159
|
mediaItemType: 'file',
|
|
@@ -167,6 +173,16 @@ export var MediaInline = function MediaInline(props) {
|
|
|
167
173
|
isSelected: false
|
|
168
174
|
});
|
|
169
175
|
}
|
|
176
|
+
if (shouldShowInlineImage(type)) {
|
|
177
|
+
return /*#__PURE__*/React.createElement(MediaInlineImageCard, {
|
|
178
|
+
mediaClient: getMediaClient(viewMediaClientConfig),
|
|
179
|
+
identifier: identifier,
|
|
180
|
+
isSelected: props.isSelected,
|
|
181
|
+
alt: alt,
|
|
182
|
+
width: width,
|
|
183
|
+
height: height
|
|
184
|
+
});
|
|
185
|
+
}
|
|
170
186
|
return /*#__PURE__*/React.createElement(MediaInlineCard, {
|
|
171
187
|
isSelected: props.isSelected,
|
|
172
188
|
identifier: identifier,
|