@atlaskit/editor-core 187.8.11 → 187.9.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 +16 -0
- package/dist/cjs/plugins/floating-toolbar/index.js +1 -3
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +33 -23
- package/dist/cjs/plugins/media/toolbar/index.js +16 -2
- package/dist/cjs/plugins/media/toolbar/utils.js +7 -2
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +574 -0
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/guidelines.js +117 -0
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +15 -0
- package/dist/cjs/ui/ElementBrowser/components/ElementSearch.js +5 -3
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
- package/dist/cjs/ui/Resizer/ResizeLabel/index.js +20 -0
- package/dist/cjs/ui/Resizer/ResizeLabel/styles.js +17 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/floating-toolbar/index.js +1 -1
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +34 -23
- package/dist/es2019/plugins/media/toolbar/index.js +19 -3
- package/dist/es2019/plugins/media/toolbar/utils.js +7 -1
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +493 -0
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/guidelines.js +108 -0
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +8 -0
- package/dist/es2019/ui/ElementBrowser/components/ElementSearch.js +5 -3
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +9 -6
- package/dist/es2019/ui/Resizer/ResizeLabel/index.js +12 -0
- package/dist/es2019/ui/Resizer/ResizeLabel/styles.js +25 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/floating-toolbar/index.js +1 -3
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +33 -23
- package/dist/esm/plugins/media/toolbar/index.js +17 -3
- package/dist/esm/plugins/media/toolbar/utils.js +5 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +564 -0
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/guidelines.js +108 -0
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.js +8 -0
- package/dist/esm/ui/ElementBrowser/components/ElementSearch.js +5 -3
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +8 -6
- package/dist/esm/ui/Resizer/ResizeLabel/index.js +12 -0
- package/dist/esm/ui/Resizer/ResizeLabel/styles.js +7 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/labs/next/presets/universal.d.ts +1 -2
- package/dist/types/plugins/floating-toolbar/index.d.ts +3 -1
- package/dist/types/plugins/media/index.d.ts +2 -0
- package/dist/types/plugins/media/nodeviews/styles.d.ts +1 -1
- package/dist/types/plugins/media/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/media/toolbar/utils.d.ts +1 -0
- package/dist/types/plugins/media/types.d.ts +1 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +61 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +4 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +7 -0
- package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -0
- package/dist/types/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
- package/dist/types/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
- package/dist/types/ui/Resizer/ResizeLabel/index.d.ts +8 -0
- package/dist/types/ui/Resizer/ResizeLabel/styles.d.ts +3 -0
- package/dist/types-ts4.5/labs/next/presets/universal.d.ts +1 -2
- package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/index.d.ts +2 -0
- package/dist/types-ts4.5/plugins/media/nodeviews/styles.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +61 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/guidelines.d.ts +4 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/resizable-media-single-messages.d.ts +7 -0
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/ElementBrowser/components/ElementSearch.d.ts +2 -1
- package/dist/types-ts4.5/ui/ElementBrowser/components/StatelessElementBrowser.d.ts +4 -4
- package/dist/types-ts4.5/ui/Resizer/ResizeLabel/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/Resizer/ResizeLabel/styles.d.ts +3 -0
- package/package.json +2 -2
- package/report.api.md +7 -4
- package/tmp/api-report-tmp.d.ts +5 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.messages = void 0;
|
|
7
|
+
var _reactIntlNext = require("react-intl-next");
|
|
8
|
+
var messages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
+
fullWidthImage: {
|
|
10
|
+
id: 'fabric.editor.image.fullWidthImage',
|
|
11
|
+
defaultMessage: 'Full width image',
|
|
12
|
+
description: 'The image has reached its full width'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
exports.messages = messages;
|
|
@@ -29,6 +29,7 @@ function ElementSearch(_ref) {
|
|
|
29
29
|
formatMessage = _ref.intl.formatMessage,
|
|
30
30
|
focus = _ref.focus,
|
|
31
31
|
onClick = _ref.onClick,
|
|
32
|
+
onKeyDown = _ref.onKeyDown,
|
|
32
33
|
searchTerm = _ref.searchTerm;
|
|
33
34
|
var ref = (0, _useFocus.default)(focus);
|
|
34
35
|
var onChange = function onChange(_ref2) {
|
|
@@ -44,6 +45,7 @@ function ElementSearch(_ref) {
|
|
|
44
45
|
onChange: onChange,
|
|
45
46
|
onClick: onClick,
|
|
46
47
|
onFocus: onFocus,
|
|
48
|
+
onKeyDown: onKeyDown,
|
|
47
49
|
onBlur: onBlur,
|
|
48
50
|
elemBeforeInput: (0, _react2.jsx)("div", {
|
|
49
51
|
css: elementBeforeInput,
|
|
@@ -75,10 +77,10 @@ var placeHolderMessage = {
|
|
|
75
77
|
description: 'Search field placeholder'
|
|
76
78
|
};
|
|
77
79
|
var styledShortcut = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n padding: ", "px ", "px;\n width: ", "px;\n"])), _styles.shortcutStyle, _constants.GRID_SIZE / 2, _constants.GRID_SIZE, _constants.GRID_SIZE * 6);
|
|
78
|
-
var wrapper = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px
|
|
80
|
+
var wrapper = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n border-radius: ", "px;\n flex: 1 1 100%;\n overflow: visible;\n & > [data-ds--text-field--input] {\n margin-bottom: 3px;\n font-size: ", ";\n padding: ", "px ", " ", "px 0;\n }\n }\n"])), _constants.GRID_SIZE * 6, _constants.GRID_SIZE, (0, _editorSharedStyles.relativeFontSizeToBase16)(14), _constants.GRID_SIZE, "var(--ds-space-075, 6px)", _constants.GRID_SIZE);
|
|
79
81
|
var wrapperInline = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n & > [data-ds--text-field--container] {\n height: ", "px;\n flex: none;\n overflow: revert;\n }\n"])), _constants.GRID_SIZE * 5);
|
|
80
|
-
var elementBeforeInput = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin: 1px
|
|
81
|
-
var elementAfterInput = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0
|
|
82
|
+
var elementBeforeInput = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin: 1px ", " 0 ", ";\n color: ", ";\n\n // Custom SearchIcon style\n span,\n svg {\n height: 20px;\n width: 20px;\n }\n"])), "var(--ds-space-075, 6px)", "var(--ds-space-100, 8px)", "var(--ds-icon, ".concat(_colors.N200, ")"));
|
|
83
|
+
var elementAfterInput = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 ", ";\n height: ", ";\n text-align: center;\n"])), "var(--ds-space-100, 8px)", _constants.SEARCH_ITEM_HEIGHT_WIDTH);
|
|
82
84
|
var MemoizedElementSearchWithAnalytics = /*#__PURE__*/(0, _react.memo)((0, _analyticsNext.withAnalyticsContext)({
|
|
83
85
|
component: 'Searchbar'
|
|
84
86
|
})((0, _reactIntlNext.injectIntl)(ElementSearch)));
|
|
@@ -30,7 +30,7 @@ var baseBrowserContainerStyles = (0, _react2.css)(_templateObject2 || (_template
|
|
|
30
30
|
var mobileElementBrowserContainer = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex-direction: column;\n"])), baseBrowserContainerStyles);
|
|
31
31
|
var elementBrowserContainer = (0, _react2.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex-direction: row;\n"])), baseBrowserContainerStyles);
|
|
32
32
|
var baseSidebarStyles = (0, _react2.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n\n overflow-x: auto;\n overflow-y: hidden;\n"])));
|
|
33
|
-
var mobileSideBar = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex: 0 0 ", ";\n padding:
|
|
33
|
+
var mobileSideBar = (0, _react2.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex: 0 0 ", ";\n padding: ", " ", " 0\n ", ";\n"])), baseSidebarStyles, _constants.INLINE_SIDEBAR_HEIGHT, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)");
|
|
34
34
|
var mobileSideBarShowCategories = (0, _react2.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n"])));
|
|
35
35
|
var sideBar = (0, _react2.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex: 0 0 'auto';\n"])), baseSidebarStyles);
|
|
36
36
|
var sideBarShowCategories = (0, _react2.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n flex: 0 0 ", ";\n"])), baseSidebarStyles, _constants.SIDEBAR_WIDTH);
|
|
@@ -43,6 +43,7 @@ var categoryListWrapper = (0, _react2.css)(_templateObject15 || (_templateObject
|
|
|
43
43
|
function StatelessElementBrowser(props) {
|
|
44
44
|
var items = props.items,
|
|
45
45
|
onSelectItem = props.onSelectItem,
|
|
46
|
+
onInsertItem = props.onInsertItem,
|
|
46
47
|
viewMoreItem = props.viewMoreItem;
|
|
47
48
|
var _useContainerWidth = (0, _useContainerWidth2.default)(),
|
|
48
49
|
containerWidth = _useContainerWidth.containerWidth,
|
|
@@ -92,10 +93,11 @@ function StatelessElementBrowser(props) {
|
|
|
92
93
|
if (e.key !== 'Enter') {
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
95
|
-
if (
|
|
96
|
-
|
|
96
|
+
if (onInsertItem && selectedItem != null) {
|
|
97
|
+
onInsertItem(selectedItem);
|
|
97
98
|
}
|
|
98
|
-
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
}, [onInsertItem, selectedItem]);
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
103
|
* On arrow key selection and clicks the selectedItemIndex will change.
|
|
@@ -156,13 +158,13 @@ function MobileBrowser(_ref) {
|
|
|
156
158
|
viewMoreItem = _ref.viewMoreItem;
|
|
157
159
|
return (0, _react2.jsx)("div", {
|
|
158
160
|
css: mobileElementBrowserContainer,
|
|
159
|
-
onKeyPress: onKeyPress,
|
|
160
161
|
onKeyDown: onKeyDown,
|
|
161
162
|
"data-testid": "mobile__element-browser"
|
|
162
163
|
}, (0, _react2.jsx)("div", {
|
|
163
164
|
css: showCategories ? [mobileSideBar, mobileSideBarShowCategories] : mobileSideBar
|
|
164
165
|
}, showSearch && (0, _react2.jsx)(_ElementSearch.default, {
|
|
165
166
|
onSearch: onSearch,
|
|
167
|
+
onKeyDown: onKeyPress,
|
|
166
168
|
mode: mode,
|
|
167
169
|
focus: focusOnSearch,
|
|
168
170
|
onClick: setFocusOnSearch,
|
|
@@ -235,13 +237,13 @@ function DesktopBrowser(_ref2) {
|
|
|
235
237
|
createAnalyticsEvent: createAnalyticsEvent
|
|
236
238
|
}))), (0, _react2.jsx)("div", {
|
|
237
239
|
css: mainContent,
|
|
238
|
-
onKeyPress: onKeyPress,
|
|
239
240
|
onKeyDown: onKeyDown,
|
|
240
241
|
"data-testid": "main-content"
|
|
241
242
|
}, showSearch && (0, _react2.jsx)("div", {
|
|
242
243
|
css: searchContainer
|
|
243
244
|
}, (0, _react2.jsx)(_ElementSearch.default, {
|
|
244
245
|
onSearch: onSearch,
|
|
246
|
+
onKeyDown: onKeyPress,
|
|
245
247
|
mode: mode,
|
|
246
248
|
focus: focusOnSearch,
|
|
247
249
|
onClick: setFocusOnSearch,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _styles = require("./styles");
|
|
9
|
+
/** @jsx jsx */
|
|
10
|
+
|
|
11
|
+
var ResizeLabelBreakoutWidth = 110;
|
|
12
|
+
var ResizeLabel = function ResizeLabel(props) {
|
|
13
|
+
return (0, _react.jsx)("div", {
|
|
14
|
+
css: _styles.wrapper
|
|
15
|
+
}, (0, _react.jsx)("span", {
|
|
16
|
+
css: [_styles.text, props.containerWidth < ResizeLabelBreakoutWidth && _styles.smallText]
|
|
17
|
+
}, props.label));
|
|
18
|
+
};
|
|
19
|
+
var _default = ResizeLabel;
|
|
20
|
+
exports.default = _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.wrapper = exports.text = exports.smallText = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
11
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
12
|
+
var wrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n font-size: ", ";\n width: 100%;\n text-align: center;\n position: absolute;\n transform: translateY(-125%);\n top: 0;\n"])), "var(--ds-font-size-100, 14px)");
|
|
13
|
+
exports.wrapper = wrapper;
|
|
14
|
+
var text = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: inline-block;\n border-radius: 6px;\n min-width: 75px;\n background-color: ", ";\n color: ", ";\n padding: ", " ", ";\n letter-spacing: 0.5px;\n"])), "var(--ds-text-accent-blue, ".concat(_colors.B300, ")"), "var(--ds-text-inverse, white)", "var(--ds-space-050, 4px)", "var(--ds-space-200, 16px)");
|
|
15
|
+
exports.text = text;
|
|
16
|
+
var smallText = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n letter-spacing: -0.5px;\n font-size: ", ";\n min-width: 27px;\n padding: ", " ", ";\n"])), "var(--ds-font-size-050, 8px)", "var(--ds-space-0, 0px)", "var(--ds-space-025, 2px)");
|
|
17
|
+
exports.smallText = smallText;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.
|
|
9
|
+
var version = "187.9.0";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { jsx } from '@emotion/react';
|
|
@@ -8,6 +7,7 @@ import { MediaSingle, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaski
|
|
|
8
7
|
import { browser, floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
9
8
|
import { isNodeSelectedOrInRange } from '../../../utils/nodes';
|
|
10
9
|
import { setNodeSelection, setTextSelection } from '../../../utils';
|
|
10
|
+
import ResizableMediaSingleNext from '../ui/ResizableMediaSingle/ResizableMediaSingleNext';
|
|
11
11
|
import ResizableMediaSingle from '../ui/ResizableMediaSingle';
|
|
12
12
|
import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
|
|
13
13
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
@@ -22,6 +22,8 @@ import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
|
22
22
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
23
23
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
24
24
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
25
|
+
import { getMediaSinglePixelWidth } from '@atlaskit/editor-common/media-single';
|
|
26
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
27
|
export default class MediaSingleNode extends Component {
|
|
26
28
|
constructor(...args) {
|
|
27
29
|
super(...args);
|
|
@@ -133,7 +135,8 @@ export default class MediaSingleNode extends Component {
|
|
|
133
135
|
const tr = state.tr.setNodeMarkup(pos, undefined, {
|
|
134
136
|
...this.props.node.attrs,
|
|
135
137
|
layout,
|
|
136
|
-
width
|
|
138
|
+
width,
|
|
139
|
+
widthType: 'pixel'
|
|
137
140
|
});
|
|
138
141
|
tr.setMeta('scrollIntoView', false);
|
|
139
142
|
/**
|
|
@@ -220,14 +223,21 @@ export default class MediaSingleNode extends Component {
|
|
|
220
223
|
view: {
|
|
221
224
|
state
|
|
222
225
|
},
|
|
223
|
-
view
|
|
226
|
+
view,
|
|
227
|
+
pluginInjectionApi,
|
|
228
|
+
width: containerWidth,
|
|
229
|
+
lineLength,
|
|
230
|
+
dispatchAnalyticsEvent
|
|
224
231
|
} = this.props;
|
|
225
232
|
const {
|
|
226
233
|
layout,
|
|
227
|
-
|
|
234
|
+
widthType,
|
|
235
|
+
width: mediaSingleWidthAttribute
|
|
228
236
|
} = node.attrs;
|
|
229
237
|
const childNode = node.firstChild;
|
|
230
238
|
const attrs = childNode.attrs;
|
|
239
|
+
|
|
240
|
+
// original width and height of child media node (scaled)
|
|
231
241
|
let {
|
|
232
242
|
width,
|
|
233
243
|
height
|
|
@@ -259,15 +269,29 @@ export default class MediaSingleNode extends Component {
|
|
|
259
269
|
width = DEFAULT_IMAGE_WIDTH;
|
|
260
270
|
height = DEFAULT_IMAGE_HEIGHT;
|
|
261
271
|
}
|
|
272
|
+
const isSelected = selected();
|
|
262
273
|
const mediaSingleProps = {
|
|
263
274
|
layout,
|
|
264
275
|
width,
|
|
265
276
|
height,
|
|
266
|
-
containerWidth:
|
|
267
|
-
lineLength: this.
|
|
268
|
-
pctWidth:
|
|
277
|
+
containerWidth: containerWidth,
|
|
278
|
+
lineLength: this.getLineLength(view, getPos()) || lineLength,
|
|
279
|
+
pctWidth: mediaSingleWidthAttribute,
|
|
269
280
|
fullWidthMode,
|
|
270
|
-
hasFallbackContainer: false
|
|
281
|
+
hasFallbackContainer: false,
|
|
282
|
+
mediaSingleWidth: mediaSingleWidthAttribute && getMediaSinglePixelWidth(mediaSingleWidthAttribute, lineLength, widthType)
|
|
283
|
+
};
|
|
284
|
+
const ResizableMediaSingleProps = {
|
|
285
|
+
view: view,
|
|
286
|
+
getPos: getPos,
|
|
287
|
+
updateSize: this.updateSize,
|
|
288
|
+
gridSize: 12,
|
|
289
|
+
viewMediaClientConfig: this.state.viewMediaClientConfig,
|
|
290
|
+
allowBreakoutSnapPoints: mediaOptions && mediaOptions.allowBreakoutSnapPoints,
|
|
291
|
+
selected: isSelected,
|
|
292
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
293
|
+
pluginInjectionApi: pluginInjectionApi,
|
|
294
|
+
...mediaSingleProps
|
|
271
295
|
};
|
|
272
296
|
let canResize = !!this.props.mediaOptions.allowResizing;
|
|
273
297
|
if (!this.props.mediaOptions.allowResizingInTables) {
|
|
@@ -282,12 +306,10 @@ export default class MediaSingleNode extends Component {
|
|
|
282
306
|
canResize = canResize && !disabledNode;
|
|
283
307
|
}
|
|
284
308
|
}
|
|
285
|
-
const lineLength = this.getLineLength(view, getPos()) || this.props.lineLength;
|
|
286
|
-
const isSelected = selected();
|
|
287
309
|
const shouldShowPlaceholder = getMediaFeatureFlag('captions', mediaOptions.featureFlags) && node.childCount !== 2 && isSelected && state.selection instanceof NodeSelection;
|
|
288
310
|
const MediaChildren = jsx("figure", {
|
|
289
311
|
ref: this.mediaSingleWrapperRef,
|
|
290
|
-
css: figureWrapper,
|
|
312
|
+
css: [figureWrapper],
|
|
291
313
|
className: MediaSingleNodeSelector,
|
|
292
314
|
onClick: this.onMediaSingleClicked
|
|
293
315
|
}, jsx("div", {
|
|
@@ -296,18 +318,7 @@ export default class MediaSingleNode extends Component {
|
|
|
296
318
|
ref: this.captionPlaceHolderRef,
|
|
297
319
|
onClick: this.clickPlaceholder
|
|
298
320
|
}));
|
|
299
|
-
return canResize ? jsx(ResizableMediaSingle,
|
|
300
|
-
lineLength: lineLength,
|
|
301
|
-
view: this.props.view,
|
|
302
|
-
getPos: getPos,
|
|
303
|
-
updateSize: this.updateSize,
|
|
304
|
-
gridSize: 12,
|
|
305
|
-
viewMediaClientConfig: this.state.viewMediaClientConfig,
|
|
306
|
-
allowBreakoutSnapPoints: mediaOptions && mediaOptions.allowBreakoutSnapPoints,
|
|
307
|
-
selected: isSelected,
|
|
308
|
-
dispatchAnalyticsEvent: this.props.dispatchAnalyticsEvent,
|
|
309
|
-
pluginInjectionApi: this.props.pluginInjectionApi
|
|
310
|
-
}), MediaChildren) : jsx(MediaSingle, mediaSingleProps, MediaChildren);
|
|
321
|
+
return canResize ? getBooleanFF('platform.editor.media.extended-resize-experience') ? jsx(ResizableMediaSingleNext, ResizableMediaSingleProps, MediaChildren) : jsx(ResizableMediaSingle, ResizableMediaSingleProps, MediaChildren) : jsx(MediaSingle, mediaSingleProps, MediaChildren);
|
|
311
322
|
}
|
|
312
323
|
}
|
|
313
324
|
_defineProperty(MediaSingleNode, "defaultProps", {
|
|
@@ -16,8 +16,9 @@ import { LinkToolbarAppearance } from './linking-toolbar-appearance';
|
|
|
16
16
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
17
17
|
import { messages } from '@atlaskit/media-ui';
|
|
18
18
|
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
19
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
19
20
|
import { FilePreviewItem } from './filePreviewItem';
|
|
20
|
-
import { downloadMedia, removeMediaGroupNode } from './utils';
|
|
21
|
+
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode } from './utils';
|
|
21
22
|
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
|
|
22
23
|
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
23
24
|
import ImageBorderItem from '../ui/ImageBorder';
|
|
@@ -231,7 +232,22 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
231
232
|
}
|
|
232
233
|
if (allowAdvancedToolBarOptions) {
|
|
233
234
|
var _pluginInjectionApi$d;
|
|
234
|
-
const
|
|
235
|
+
const widthPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width;
|
|
236
|
+
let isChangingLayoutDisabled = false;
|
|
237
|
+
if (getBooleanFF('platform.editor.media.extended-resize-experience')) {
|
|
238
|
+
var _widthPlugin$sharedSt;
|
|
239
|
+
const contentWidth = widthPlugin === null || widthPlugin === void 0 ? void 0 : (_widthPlugin$sharedSt = widthPlugin.sharedState.currentState()) === null || _widthPlugin$sharedSt === void 0 ? void 0 : _widthPlugin$sharedSt.lineLength;
|
|
240
|
+
const selectedNode = getSelectedMediaSingle(state);
|
|
241
|
+
if (selectedNode && contentWidth) {
|
|
242
|
+
const {
|
|
243
|
+
width
|
|
244
|
+
} = selectedNode.node.attrs;
|
|
245
|
+
if (width >= contentWidth) {
|
|
246
|
+
isChangingLayoutDisabled = true;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const layoutButtons = buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPlugin, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions, allowResizing, allowResizingInTables, true, true, isChangingLayoutDisabled);
|
|
235
251
|
toolbarButtons = [...toolbarButtons, ...layoutButtons];
|
|
236
252
|
if (layoutButtons.length) {
|
|
237
253
|
toolbarButtons.push({
|
|
@@ -342,7 +358,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
342
358
|
const {
|
|
343
359
|
hoverDecoration
|
|
344
360
|
} = (_pluginInjectionApi$d4 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d4 !== void 0 ? _pluginInjectionApi$d4 : {};
|
|
345
|
-
if (!mediaPluginState) {
|
|
361
|
+
if (!mediaPluginState || mediaPluginState.isResizing) {
|
|
346
362
|
return;
|
|
347
363
|
}
|
|
348
364
|
const nodeType = allowMediaInline ? [mediaInline, mediaSingle, media] : [mediaSingle];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getMediaClient } from '@atlaskit/media-client';
|
|
2
|
-
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
+
import { findParentNodeOfType, removeParentNodeOfType, removeSelectedNode, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
export const getSelectedMediaContainerNodeAttrs = mediaPluginState => {
|
|
4
4
|
const selectedNode = mediaPluginState.selectedMediaContainerNode();
|
|
5
5
|
if (selectedNode && selectedNode.attrs) {
|
|
@@ -40,4 +40,10 @@ export const removeMediaGroupNode = state => {
|
|
|
40
40
|
tr = removeSelectedNode(tr);
|
|
41
41
|
}
|
|
42
42
|
return tr;
|
|
43
|
+
};
|
|
44
|
+
export const getSelectedMediaSingle = state => {
|
|
45
|
+
const {
|
|
46
|
+
mediaSingle
|
|
47
|
+
} = state.schema.nodes;
|
|
48
|
+
return findSelectedNodeOfType(mediaSingle)(state.selection) || findParentNodeOfType(mediaSingle)(state.selection);
|
|
43
49
|
};
|