@atlaskit/editor-core 187.8.13 → 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 +10 -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/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/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/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/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/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;
|
|
@@ -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
|
};
|