@atlaskit/editor-common 74.32.0 → 74.33.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 +12 -0
- package/dist/cjs/card/MediaAndEmbedsToolbar/index.js +23 -7
- package/dist/cjs/guideline/index.js +13 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/styles/shared/media-single.js +2 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/MediaSingle/index.js +2 -7
- package/dist/cjs/ui/MediaSingle/styled.js +24 -2
- package/dist/cjs/ui/index.js +0 -6
- package/dist/cjs/utils/index.js +6 -0
- package/dist/cjs/utils/rich-media-utils.js +6 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/MediaAndEmbedsToolbar/index.js +23 -8
- package/dist/es2019/guideline/index.js +1 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/styles/shared/media-single.js +6 -5
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/MediaSingle/index.js +1 -4
- package/dist/es2019/ui/MediaSingle/styled.js +45 -2
- package/dist/es2019/ui/index.js +1 -1
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/rich-media-utils.js +3 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/MediaAndEmbedsToolbar/index.js +24 -8
- package/dist/esm/guideline/index.js +1 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/styles/shared/media-single.js +2 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/MediaSingle/index.js +1 -4
- package/dist/esm/ui/MediaSingle/styled.js +25 -3
- package/dist/esm/ui/index.js +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/rich-media-utils.js +3 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/card/MediaAndEmbedsToolbar/index.d.ts +1 -1
- package/dist/types/guideline/index.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +8 -0
- package/dist/types/ui/DropList/index.d.ts +1 -1
- package/dist/types/ui/MediaSingle/index.d.ts +1 -2
- package/dist/types/ui/MediaSingle/styled.d.ts +3 -1
- package/dist/types/ui/index.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/rich-media-utils.d.ts +1 -0
- package/dist/types-ts4.5/card/MediaAndEmbedsToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/guideline/index.d.ts +1 -0
- package/dist/types-ts4.5/types/feature-flags.d.ts +8 -0
- package/dist/types-ts4.5/ui/DropList/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/MediaSingle/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/MediaSingle/styled.d.ts +3 -1
- package/dist/types-ts4.5/ui/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/rich-media-utils.d.ts +1 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 74.33.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`936c30f8dc9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/936c30f8dc9) - support new image resize experience under feature flag
|
|
8
|
+
|
|
9
|
+
## 74.32.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 74.32.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
12
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -17,12 +18,15 @@ var _mediaFullWidth = _interopRequireDefault(require("@atlaskit/icon/glyph/edito
|
|
|
17
18
|
var _mediaWide = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/media-wide"));
|
|
18
19
|
var _mediaWrapLeft = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/media-wrap-left"));
|
|
19
20
|
var _mediaWrapRight = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/media-wrap-right"));
|
|
21
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
22
|
var _analytics = require("../../analytics");
|
|
21
23
|
var _coreUtils = require("../../core-utils");
|
|
22
24
|
var _messages = _interopRequireWildcard(require("../../messages"));
|
|
23
25
|
var _utils2 = require("../../utils");
|
|
24
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
27
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
30
|
// Workaround as we don't want to import this package into `editor-common`
|
|
27
31
|
// We'll get type errors if this gets out of sync with `editor-plugin-width`.
|
|
28
32
|
var alignmentIcons = [{
|
|
@@ -84,7 +88,10 @@ var makeAlign = function makeAlign(layout, nodeType, widthPluginDependencyApi, a
|
|
|
84
88
|
return false;
|
|
85
89
|
}
|
|
86
90
|
var nodeWidth = getNodeWidth(node, state.schema);
|
|
87
|
-
var newAttrs = (0,
|
|
91
|
+
var newAttrs = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') ? // with extended experience, change alignment does not change media single width
|
|
92
|
+
_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
93
|
+
layout: layout
|
|
94
|
+
}) : (0, _utils2.alignAttributes)(layout, node.attrs, undefined, nodeWidth, widthPluginState.lineLength);
|
|
88
95
|
var tr = state.tr.setNodeMarkup(state.selection.from, undefined, newAttrs);
|
|
89
96
|
tr.setMeta('scrollIntoView', false);
|
|
90
97
|
// when image captions are enabled, the wrong node gets selected after
|
|
@@ -113,18 +120,26 @@ var makeAlign = function makeAlign(layout, nodeType, widthPluginDependencyApi, a
|
|
|
113
120
|
return true;
|
|
114
121
|
};
|
|
115
122
|
};
|
|
116
|
-
var
|
|
123
|
+
var getToolbarLayout = function getToolbarLayout(layout) {
|
|
124
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') && _utils2.nonWrappedLayouts.includes(layout)) {
|
|
125
|
+
return 'center';
|
|
126
|
+
}
|
|
127
|
+
return layout;
|
|
128
|
+
};
|
|
129
|
+
var mapIconsToToolbarItem = function mapIconsToToolbarItem(icons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) {
|
|
117
130
|
return icons.map(function (toolbarItem) {
|
|
118
131
|
var id = toolbarItem.id,
|
|
119
132
|
value = toolbarItem.value;
|
|
120
|
-
return {
|
|
133
|
+
return _objectSpread({
|
|
121
134
|
id: id,
|
|
122
135
|
type: 'button',
|
|
123
136
|
icon: toolbarItem.icon,
|
|
124
137
|
title: intl.formatMessage(layoutToMessages[value]),
|
|
125
|
-
selected: layout === value,
|
|
138
|
+
selected: getToolbarLayout(layout) === value,
|
|
126
139
|
onClick: makeAlign(value, nodeType, widthPluginDependencyApi, analyticsApi)
|
|
127
|
-
}
|
|
140
|
+
}, isChangingLayoutDisabled && {
|
|
141
|
+
disabled: value !== 'center'
|
|
142
|
+
});
|
|
128
143
|
});
|
|
129
144
|
};
|
|
130
145
|
var shouldHideLayoutToolbar = function shouldHideLayoutToolbar(selection, _ref2, allowResizingInTables) {
|
|
@@ -134,13 +149,14 @@ var shouldHideLayoutToolbar = function shouldHideLayoutToolbar(selection, _ref2,
|
|
|
134
149
|
var buildLayoutButtons = function buildLayoutButtons(state, intl, nodeType, widthPluginDependencyApi, analyticsApi, allowResizing, allowResizingInTables) {
|
|
135
150
|
var allowWrapping = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
136
151
|
var allowAlignment = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
152
|
+
var isChangingLayoutDisabled = arguments.length > 9 ? arguments[9] : undefined;
|
|
137
153
|
var selection = state.selection;
|
|
138
154
|
if (!(selection instanceof _state.NodeSelection) || !selection.node || !nodeType || shouldHideLayoutToolbar(selection, state.schema, allowResizingInTables)) {
|
|
139
155
|
return [];
|
|
140
156
|
}
|
|
141
157
|
var layout = selection.node.attrs.layout;
|
|
142
|
-
var alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi) : [];
|
|
143
|
-
var wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi) : [];
|
|
158
|
+
var alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) : [];
|
|
159
|
+
var wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) : [];
|
|
144
160
|
var breakOutToolbarItems = !allowResizing ? mapIconsToToolbarItem(breakoutIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi) : [];
|
|
145
161
|
var items = [].concat((0, _toConsumableArray2.default)(alignmentToolbarItems), (0, _toConsumableArray2.default)(getSeparatorBetweenAlignmentAndWrapping(allowAlignment, allowWrapping)), (0, _toConsumableArray2.default)(wrappingToolbarItems), (0, _toConsumableArray2.default)(getSeparatorBeforeBreakoutItems(allowAlignment, allowWrapping, allowResizing)), (0, _toConsumableArray2.default)(breakOutToolbarItems));
|
|
146
162
|
return items;
|
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "createGuidesFromLengths", {
|
|
|
21
21
|
return _fixedGuideline.createGuidesFromLengths;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "findClosestSnap", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _snapping.findClosestSnap;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "generateDefaultGuidelines", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function get() {
|
|
@@ -45,6 +51,12 @@ Object.defineProperty(exports, "getGuidelinesWithHighlights", {
|
|
|
45
51
|
return _updateGuideline.getGuidelinesWithHighlights;
|
|
46
52
|
}
|
|
47
53
|
});
|
|
54
|
+
Object.defineProperty(exports, "getSnapWidth", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _snapping.getSnapWidth;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
48
60
|
Object.defineProperty(exports, "isVerticalPosition", {
|
|
49
61
|
enumerable: true,
|
|
50
62
|
get: function get() {
|
|
@@ -56,4 +68,5 @@ var _fixedGuideline = require("./fixedGuideline");
|
|
|
56
68
|
var _defaultGuideline = require("./defaultGuideline");
|
|
57
69
|
var _updateGuideline = require("./updateGuideline");
|
|
58
70
|
var _constants = require("./constants");
|
|
71
|
+
var _snapping = require("./snapping");
|
|
59
72
|
var _utils = require("./utils");
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "74.
|
|
19
|
+
var packageVersion = "74.33.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -7,9 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.richMediaClassName = exports.mediaSingleSharedStyle = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _templateObject;
|
|
11
12
|
var richMediaClassName = 'rich-media-item';
|
|
12
13
|
exports.richMediaClassName = richMediaClassName;
|
|
13
14
|
var wrappedMediaBreakoutPoint = 410;
|
|
14
|
-
var mediaSingleSharedStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n li .", " {\n margin: 0;\n }\n\n /* Hack for chrome to fix media single position\n inside a list when media is the first child */\n &.ua-chrome li > .mediaSingleView-content-wrap::before {\n content: '';\n display: block;\n height: 0;\n }\n\n &.ua-firefox {\n .mediaSingleView-content-wrap {\n user-select: none;\n }\n\n .captionView-content-wrap {\n user-select: text;\n }\n }\n\n .mediaSingleView-content-wrap[layout='center'] {\n clear: both;\n }\n\n table .", " {\n margin-top:
|
|
15
|
+
var mediaSingleSharedStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n li .", " {\n margin: 0;\n }\n\n /* Hack for chrome to fix media single position\n inside a list when media is the first child */\n &.ua-chrome li > .mediaSingleView-content-wrap::before {\n content: '';\n display: block;\n height: 0;\n }\n\n &.ua-firefox {\n .mediaSingleView-content-wrap {\n user-select: none;\n }\n\n .captionView-content-wrap {\n user-select: text;\n }\n }\n\n .mediaSingleView-content-wrap[layout='center'] {\n clear: both;\n }\n\n table .", " {\n margin-top: ", ";\n margin-bottom: ", ";\n clear: both;\n\n &.image-wrap-left,\n &.image-wrap-right {\n clear: none;\n\n &:first-child {\n margin-top: ", ";\n }\n }\n }\n\n .", ".image-wrap-right\n + .", ".image-wrap-left {\n clear: both;\n }\n\n .", ".image-wrap-left\n + .", ".image-wrap-right,\n .", ".image-wrap-right\n + .", ".image-wrap-left,\n .", ".image-wrap-left\n + .", ".image-wrap-left,\n .", ".image-wrap-right\n + .", ".image-wrap-right {\n margin-right: 0;\n margin-left: 0;\n }\n\n ", "\n"])), richMediaClassName, richMediaClassName, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') && "@media all and (max-width: ".concat(wrappedMediaBreakoutPoint, "px) {\n div.mediaSingleView-content-wrap[layout='wrap-left'],\n div.mediaSingleView-content-wrap[data-layout='wrap-left'],\n div.mediaSingleView-content-wrap[layout='wrap-right'],\n div.mediaSingleView-content-wrap[data-layout='wrap-right'] {\n float: none;\n overflow: auto;\n margin: 12px 0;\n }\n }"));
|
|
15
16
|
exports.mediaSingleSharedStyle = mediaSingleSharedStyle;
|
|
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
24
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
25
25
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "74.
|
|
27
|
+
var packageVersion = "74.33.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.IMAGE_AND_BORDER_ADJUSTMENT = exports.DEFAULT_IMAGE_WIDTH = exports.DEFAULT_IMAGE_HEIGHT = void 0;
|
|
8
8
|
exports.default = MediaSingle;
|
|
9
|
-
exports.shouldAddDefaultWrappedWidth = void 0;
|
|
10
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
10
|
var _react = _interopRequireDefault(require("react"));
|
|
12
11
|
var _react2 = require("@emotion/react");
|
|
@@ -14,7 +13,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
14
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
14
|
var _constants = require("../../media-single/constants");
|
|
16
15
|
var _utils = require("../../media-single/utils");
|
|
17
|
-
var
|
|
16
|
+
var _richMediaUtils = require("../../utils/rich-media-utils");
|
|
18
17
|
var _styled = require("./styled");
|
|
19
18
|
/** @jsx jsx */
|
|
20
19
|
|
|
@@ -29,10 +28,6 @@ var DEFAULT_IMAGE_HEIGHT = 200;
|
|
|
29
28
|
exports.DEFAULT_IMAGE_HEIGHT = DEFAULT_IMAGE_HEIGHT;
|
|
30
29
|
var IMAGE_AND_BORDER_ADJUSTMENT = 2;
|
|
31
30
|
exports.IMAGE_AND_BORDER_ADJUSTMENT = IMAGE_AND_BORDER_ADJUSTMENT;
|
|
32
|
-
var shouldAddDefaultWrappedWidth = function shouldAddDefaultWrappedWidth(layout, width, lineLength) {
|
|
33
|
-
return _grid.wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
|
|
34
|
-
};
|
|
35
|
-
exports.shouldAddDefaultWrappedWidth = shouldAddDefaultWrappedWidth;
|
|
36
31
|
function MediaSingle(_ref) {
|
|
37
32
|
var layout = _ref.layout,
|
|
38
33
|
width = _ref.width,
|
|
@@ -55,7 +50,7 @@ function MediaSingle(_ref) {
|
|
|
55
50
|
var isPixelWidth = (size === null || size === void 0 ? void 0 : size.widthType) === 'pixel';
|
|
56
51
|
var mediaSingleWidth = (size === null || size === void 0 ? void 0 : size.width) || pctWidth;
|
|
57
52
|
var children = _react.default.Children.toArray(propsChildren);
|
|
58
|
-
if (!mediaSingleWidth && shouldAddDefaultWrappedWidth(layout, width, editorWidth)) {
|
|
53
|
+
if (!mediaSingleWidth && (0, _richMediaUtils.shouldAddDefaultWrappedWidth)(layout, width, editorWidth)) {
|
|
59
54
|
// if width is not available, set to half of editor width
|
|
60
55
|
mediaSingleWidth = isPixelWidth ? editorWidth / 2 : 50;
|
|
61
56
|
}
|
|
@@ -13,6 +13,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
15
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
16
|
+
var _utils = require("../../utils");
|
|
16
17
|
var _breakout = require("../../utils/breakout");
|
|
17
18
|
var _excluded = ["children"];
|
|
18
19
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
@@ -87,6 +88,24 @@ function calcMaxWidth(layout, containerWidth) {
|
|
|
87
88
|
return '100%';
|
|
88
89
|
}
|
|
89
90
|
}
|
|
91
|
+
var getEffectiveFullWidth = function getEffectiveFullWidth(containerWidth, fullWidthMode) {
|
|
92
|
+
if (fullWidthMode) {
|
|
93
|
+
return '100%';
|
|
94
|
+
}
|
|
95
|
+
// There is always padding for renderer, so we don't need padding for it
|
|
96
|
+
var fullWidthPadding = _editorSharedStyles.akEditorGutterPadding * 2;
|
|
97
|
+
return "".concat(Math.min(containerWidth - fullWidthPadding, _editorSharedStyles.akEditorFullWidthLayoutWidth), "px");
|
|
98
|
+
};
|
|
99
|
+
var calcMaxWidthWhenResizing = function calcMaxWidthWhenResizing(containerWidth, fullWidthMode, isNestedNode) {
|
|
100
|
+
if (isNestedNode) {
|
|
101
|
+
return '100%';
|
|
102
|
+
}
|
|
103
|
+
// non-nested node can resize up to full width
|
|
104
|
+
return getEffectiveFullWidth(containerWidth, fullWidthMode);
|
|
105
|
+
};
|
|
106
|
+
var calcMaxWidthWhenNotResizing = function calcMaxWidthWhenNotResizing(containerWidth, mediaSingleWidth) {
|
|
107
|
+
return "".concat(Math.min(mediaSingleWidth, containerWidth - _editorSharedStyles.akEditorGutterPadding * 2), "px");
|
|
108
|
+
};
|
|
90
109
|
function calcMargin(layout) {
|
|
91
110
|
switch (layout) {
|
|
92
111
|
case 'wrap-right':
|
|
@@ -119,8 +138,11 @@ var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref) {
|
|
|
119
138
|
layout = _ref.layout,
|
|
120
139
|
pctWidth = _ref.pctWidth,
|
|
121
140
|
mediaSingleWidth = _ref.mediaSingleWidth,
|
|
122
|
-
width = _ref.width
|
|
123
|
-
|
|
141
|
+
width = _ref.width,
|
|
142
|
+
isExtendedResizeExperienceOn = _ref.isExtendedResizeExperienceOn,
|
|
143
|
+
_ref$isNestedNode = _ref.isNestedNode,
|
|
144
|
+
isNestedNode = _ref$isNestedNode === void 0 ? false : _ref$isNestedNode;
|
|
145
|
+
return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n &[class*='is-resizing'] {\n ", "\n }\n\n /* Handles responsiveness of non-nested, not-resizing nodes in editor */\n &[class*='not-resizing'] {\n ", "\n }\n\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), isExtendedResizeExperienceOn && "max-width: ".concat(calcMaxWidthWhenResizing(containerWidth, fullWidthMode, isNestedNode), ";\n\n ").concat(_utils.nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n\n .new-file-experience-wrapper {\n box-shadow: none;\n }"), !isNestedNode && "max-width: ".concat(layout !== 'full-width' && mediaSingleWidth && calcMaxWidthWhenNotResizing(containerWidth, mediaSingleWidth), ";\n\n ").concat(_utils.nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n\n // override min-width to counteract max-width set in old experience\n ").concat(layout === 'full-width' && "min-width: ".concat(getEffectiveFullWidth(containerWidth, fullWidthMode), " !important;"), ";"), float(layout), calcMargin(layout), isImageAligned(layout));
|
|
124
146
|
};
|
|
125
147
|
exports.MediaSingleDimensionHelper = MediaSingleDimensionHelper;
|
|
126
148
|
var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
|
package/dist/cjs/ui/index.js
CHANGED
|
@@ -347,12 +347,6 @@ Object.defineProperty(exports, "sharedExpandStyles", {
|
|
|
347
347
|
return _Expand.sharedExpandStyles;
|
|
348
348
|
}
|
|
349
349
|
});
|
|
350
|
-
Object.defineProperty(exports, "shouldAddDefaultWrappedWidth", {
|
|
351
|
-
enumerable: true,
|
|
352
|
-
get: function get() {
|
|
353
|
-
return _MediaSingle.shouldAddDefaultWrappedWidth;
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
350
|
Object.defineProperty(exports, "snapTo", {
|
|
357
351
|
enumerable: true,
|
|
358
352
|
get: function get() {
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -694,6 +694,12 @@ Object.defineProperty(exports, "nonNullable", {
|
|
|
694
694
|
return _editorCoreUtils.nonNullable;
|
|
695
695
|
}
|
|
696
696
|
});
|
|
697
|
+
Object.defineProperty(exports, "nonWrappedLayouts", {
|
|
698
|
+
enumerable: true,
|
|
699
|
+
get: function get() {
|
|
700
|
+
return _richMediaUtils.nonWrappedLayouts;
|
|
701
|
+
}
|
|
702
|
+
});
|
|
697
703
|
Object.defineProperty(exports, "normalizeUrl", {
|
|
698
704
|
enumerable: true,
|
|
699
705
|
get: function get() {
|
|
@@ -6,14 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.alignAttributes = void 0;
|
|
8
8
|
exports.calculateSnapPoints = calculateSnapPoints;
|
|
9
|
-
exports.nonWrappedLayouts = exports.isRichMediaInsideOfBlockNode = exports.floatingLayouts = void 0;
|
|
9
|
+
exports.shouldAddDefaultWrappedWidth = exports.nonWrappedLayouts = exports.isRichMediaInsideOfBlockNode = exports.floatingLayouts = void 0;
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
-
var _MediaSingle = require("../ui/MediaSingle");
|
|
14
13
|
var _grid = require("../ui/MediaSingle/grid");
|
|
15
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
+
var shouldAddDefaultWrappedWidth = function shouldAddDefaultWrappedWidth(layout, width, lineLength) {
|
|
17
|
+
return _grid.wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
|
|
18
|
+
};
|
|
19
|
+
exports.shouldAddDefaultWrappedWidth = shouldAddDefaultWrappedWidth;
|
|
17
20
|
var nonWrappedLayouts = ['center', 'wide', 'full-width'];
|
|
18
21
|
exports.nonWrappedLayouts = nonWrappedLayouts;
|
|
19
22
|
var floatingLayouts = ['wrap-left', 'wrap-right'];
|
|
@@ -40,7 +43,7 @@ var alignAttributes = function alignAttributes(layout, oldAttrs) {
|
|
|
40
43
|
var newLayoutIsNonWrapped = nonWrappedLayouts.indexOf(layout) > -1;
|
|
41
44
|
var newLayoutIsWrapped = _grid.wrappedLayouts.indexOf(layout) > -1;
|
|
42
45
|
var oldLayoutIsWrapped = _grid.wrappedLayouts.indexOf(oldLayout) > -1;
|
|
43
|
-
if (oldLayoutIsNonWrapped &&
|
|
46
|
+
if (oldLayoutIsNonWrapped && shouldAddDefaultWrappedWidth(layout, originalWidth, lineLength)) {
|
|
44
47
|
// 'full-width' or 'wide' or 'center' -> 'wrap-left' or 'wrap-right' or 'align-end' or 'align-start'
|
|
45
48
|
if (!width || width >= 100 || oldLayout !== 'center' // == 'full-width' or 'wide'
|
|
46
49
|
) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -8,10 +8,11 @@ import FullWidthIcon from '@atlaskit/icon/glyph/editor/media-full-width';
|
|
|
8
8
|
import WideIcon from '@atlaskit/icon/glyph/editor/media-wide';
|
|
9
9
|
import WrapLeftIcon from '@atlaskit/icon/glyph/editor/media-wrap-left';
|
|
10
10
|
import WrapRightIcon from '@atlaskit/icon/glyph/editor/media-wrap-right';
|
|
11
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
|
|
12
13
|
import { insideTable } from '../../core-utils';
|
|
13
14
|
import commonMessages, { mediaAndEmbedToolbarMessages as toolbarMessages } from '../../messages';
|
|
14
|
-
import { alignAttributes, isInLayoutColumn } from '../../utils';
|
|
15
|
+
import { alignAttributes, isInLayoutColumn, nonWrappedLayouts } from '../../utils';
|
|
15
16
|
|
|
16
17
|
// Workaround as we don't want to import this package into `editor-common`
|
|
17
18
|
// We'll get type errors if this gets out of sync with `editor-plugin-width`.
|
|
@@ -81,7 +82,12 @@ const makeAlign = (layout, nodeType, widthPluginDependencyApi, analyticsApi) =>
|
|
|
81
82
|
return false;
|
|
82
83
|
}
|
|
83
84
|
const nodeWidth = getNodeWidth(node, state.schema);
|
|
84
|
-
const newAttrs =
|
|
85
|
+
const newAttrs = getBooleanFF('platform.editor.media.extended-resize-experience') ?
|
|
86
|
+
// with extended experience, change alignment does not change media single width
|
|
87
|
+
{
|
|
88
|
+
...node.attrs,
|
|
89
|
+
layout
|
|
90
|
+
} : alignAttributes(layout, node.attrs, undefined, nodeWidth, widthPluginState.lineLength);
|
|
85
91
|
const tr = state.tr.setNodeMarkup(state.selection.from, undefined, newAttrs);
|
|
86
92
|
tr.setMeta('scrollIntoView', false);
|
|
87
93
|
// when image captions are enabled, the wrong node gets selected after
|
|
@@ -120,7 +126,13 @@ const makeAlign = (layout, nodeType, widthPluginDependencyApi, analyticsApi) =>
|
|
|
120
126
|
return true;
|
|
121
127
|
};
|
|
122
128
|
};
|
|
123
|
-
const
|
|
129
|
+
const getToolbarLayout = layout => {
|
|
130
|
+
if (getBooleanFF('platform.editor.media.extended-resize-experience') && nonWrappedLayouts.includes(layout)) {
|
|
131
|
+
return 'center';
|
|
132
|
+
}
|
|
133
|
+
return layout;
|
|
134
|
+
};
|
|
135
|
+
const mapIconsToToolbarItem = (icons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) => icons.map(toolbarItem => {
|
|
124
136
|
const {
|
|
125
137
|
id,
|
|
126
138
|
value
|
|
@@ -130,8 +142,11 @@ const mapIconsToToolbarItem = (icons, layout, intl, nodeType, widthPluginDepende
|
|
|
130
142
|
type: 'button',
|
|
131
143
|
icon: toolbarItem.icon,
|
|
132
144
|
title: intl.formatMessage(layoutToMessages[value]),
|
|
133
|
-
selected: layout === value,
|
|
134
|
-
onClick: makeAlign(value, nodeType, widthPluginDependencyApi, analyticsApi)
|
|
145
|
+
selected: getToolbarLayout(layout) === value,
|
|
146
|
+
onClick: makeAlign(value, nodeType, widthPluginDependencyApi, analyticsApi),
|
|
147
|
+
...(isChangingLayoutDisabled && {
|
|
148
|
+
disabled: value !== 'center'
|
|
149
|
+
})
|
|
135
150
|
};
|
|
136
151
|
});
|
|
137
152
|
const shouldHideLayoutToolbar = (selection, {
|
|
@@ -139,7 +154,7 @@ const shouldHideLayoutToolbar = (selection, {
|
|
|
139
154
|
}, allowResizingInTables) => {
|
|
140
155
|
return hasParentNodeOfType([nodes.bodiedExtension, nodes.listItem, nodes.expand, nodes.nestedExpand, ...(allowResizingInTables ? [] : [nodes.table])].filter(Boolean))(selection);
|
|
141
156
|
};
|
|
142
|
-
const buildLayoutButtons = (state, intl, nodeType, widthPluginDependencyApi, analyticsApi, allowResizing, allowResizingInTables, allowWrapping = true, allowAlignment = true) => {
|
|
157
|
+
const buildLayoutButtons = (state, intl, nodeType, widthPluginDependencyApi, analyticsApi, allowResizing, allowResizingInTables, allowWrapping = true, allowAlignment = true, isChangingLayoutDisabled) => {
|
|
143
158
|
const {
|
|
144
159
|
selection
|
|
145
160
|
} = state;
|
|
@@ -149,8 +164,8 @@ const buildLayoutButtons = (state, intl, nodeType, widthPluginDependencyApi, ana
|
|
|
149
164
|
const {
|
|
150
165
|
layout
|
|
151
166
|
} = selection.node.attrs;
|
|
152
|
-
const alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi) : [];
|
|
153
|
-
const wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi) : [];
|
|
167
|
+
const alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) : [];
|
|
168
|
+
const wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) : [];
|
|
154
169
|
const breakOutToolbarItems = !allowResizing ? mapIconsToToolbarItem(breakoutIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi) : [];
|
|
155
170
|
const items = [...alignmentToolbarItems, ...getSeparatorBetweenAlignmentAndWrapping(allowAlignment, allowWrapping), ...wrappingToolbarItems, ...getSeparatorBeforeBreakoutItems(allowAlignment, allowWrapping, allowResizing), ...breakOutToolbarItems];
|
|
156
171
|
return items;
|
|
@@ -3,4 +3,5 @@ export { createFixedGuidelinesFromLengths, createGuidesFromLengths } from './fix
|
|
|
3
3
|
export { generateDefaultGuidelines } from './defaultGuideline';
|
|
4
4
|
export { getGuidelinesWithHighlights } from './updateGuideline';
|
|
5
5
|
export { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
|
|
6
|
+
export { getSnapWidth, findClosestSnap } from './snapping';
|
|
6
7
|
export { isVerticalPosition, getContainerWidthOrFullEditorWidth } from './utils';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "74.
|
|
3
|
+
const packageVersion = "74.33.0";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
const richMediaClassName = 'rich-media-item';
|
|
3
4
|
const wrappedMediaBreakoutPoint = 410;
|
|
4
5
|
const mediaSingleSharedStyle = css`
|
|
@@ -29,8 +30,8 @@ const mediaSingleSharedStyle = css`
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
table .${richMediaClassName} {
|
|
32
|
-
margin-top: 12px;
|
|
33
|
-
margin-bottom: 12px;
|
|
33
|
+
margin-top: ${"var(--ds-space-150, 12px)"};
|
|
34
|
+
margin-bottom: ${"var(--ds-space-150, 12px)"};
|
|
34
35
|
clear: both;
|
|
35
36
|
|
|
36
37
|
&.image-wrap-left,
|
|
@@ -38,7 +39,7 @@ const mediaSingleSharedStyle = css`
|
|
|
38
39
|
clear: none;
|
|
39
40
|
|
|
40
41
|
&:first-child {
|
|
41
|
-
margin-top: 12px;
|
|
42
|
+
margin-top: ${"var(--ds-space-150, 12px)"};
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -60,7 +61,7 @@ const mediaSingleSharedStyle = css`
|
|
|
60
61
|
margin-left: 0;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
${!getBooleanFF('platform.editor.media.extended-resize-experience') && `@media all and (max-width: ${wrappedMediaBreakoutPoint}px) {
|
|
64
65
|
div.mediaSingleView-content-wrap[layout='wrap-left'],
|
|
65
66
|
div.mediaSingleView-content-wrap[data-layout='wrap-left'],
|
|
66
67
|
div.mediaSingleView-content-wrap[layout='wrap-right'],
|
|
@@ -69,6 +70,6 @@ const mediaSingleSharedStyle = css`
|
|
|
69
70
|
overflow: auto;
|
|
70
71
|
margin: 12px 0;
|
|
71
72
|
}
|
|
72
|
-
}
|
|
73
|
+
}`}
|
|
73
74
|
`;
|
|
74
75
|
export { mediaSingleSharedStyle, richMediaClassName };
|
|
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
8
8
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
9
9
|
import Layer from '../Layer';
|
|
10
10
|
const packageName = "@atlaskit/editor-common";
|
|
11
|
-
const packageVersion = "74.
|
|
11
|
+
const packageVersion = "74.33.0";
|
|
12
12
|
const halfFocusRing = 1;
|
|
13
13
|
const dropOffset = '0, 8';
|
|
14
14
|
class DropList extends Component {
|
|
@@ -5,7 +5,7 @@ import classnames from 'classnames';
|
|
|
5
5
|
import { akEditorMediaResizeHandlerPaddingWide, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { MEDIA_SINGLE_GUTTER_SIZE } from '../../media-single/constants';
|
|
7
7
|
import { getMediaSinglePixelWidth } from '../../media-single/utils';
|
|
8
|
-
import {
|
|
8
|
+
import { shouldAddDefaultWrappedWidth } from '../../utils/rich-media-utils';
|
|
9
9
|
import { MediaSingleDimensionHelper, MediaWrapper } from './styled';
|
|
10
10
|
export const DEFAULT_IMAGE_WIDTH = 250;
|
|
11
11
|
export const DEFAULT_IMAGE_HEIGHT = 200;
|
|
@@ -15,9 +15,6 @@ export const DEFAULT_IMAGE_HEIGHT = 200;
|
|
|
15
15
|
Read more: https://product-fabric.atlassian.net/browse/MEX-2481
|
|
16
16
|
*/
|
|
17
17
|
export const IMAGE_AND_BORDER_ADJUSTMENT = 2;
|
|
18
|
-
export const shouldAddDefaultWrappedWidth = (layout, width, lineLength) => {
|
|
19
|
-
return wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
|
|
20
|
-
};
|
|
21
18
|
export default function MediaSingle({
|
|
22
19
|
layout,
|
|
23
20
|
width,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { nonWrappedLayouts } from '../../utils';
|
|
5
6
|
import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';
|
|
6
7
|
function float(layout) {
|
|
7
8
|
switch (layout) {
|
|
@@ -69,6 +70,24 @@ function calcMaxWidth(layout, containerWidth) {
|
|
|
69
70
|
return '100%';
|
|
70
71
|
}
|
|
71
72
|
}
|
|
73
|
+
const getEffectiveFullWidth = (containerWidth, fullWidthMode) => {
|
|
74
|
+
if (fullWidthMode) {
|
|
75
|
+
return '100%';
|
|
76
|
+
}
|
|
77
|
+
// There is always padding for renderer, so we don't need padding for it
|
|
78
|
+
const fullWidthPadding = akEditorGutterPadding * 2;
|
|
79
|
+
return `${Math.min(containerWidth - fullWidthPadding, akEditorFullWidthLayoutWidth)}px`;
|
|
80
|
+
};
|
|
81
|
+
const calcMaxWidthWhenResizing = (containerWidth, fullWidthMode, isNestedNode) => {
|
|
82
|
+
if (isNestedNode) {
|
|
83
|
+
return '100%';
|
|
84
|
+
}
|
|
85
|
+
// non-nested node can resize up to full width
|
|
86
|
+
return getEffectiveFullWidth(containerWidth, fullWidthMode);
|
|
87
|
+
};
|
|
88
|
+
const calcMaxWidthWhenNotResizing = (containerWidth, mediaSingleWidth) => {
|
|
89
|
+
return `${Math.min(mediaSingleWidth, containerWidth - akEditorGutterPadding * 2)}px`;
|
|
90
|
+
};
|
|
72
91
|
function calcMargin(layout) {
|
|
73
92
|
switch (layout) {
|
|
74
93
|
case 'wrap-right':
|
|
@@ -100,7 +119,9 @@ export const MediaSingleDimensionHelper = ({
|
|
|
100
119
|
layout,
|
|
101
120
|
pctWidth,
|
|
102
121
|
mediaSingleWidth,
|
|
103
|
-
width
|
|
122
|
+
width,
|
|
123
|
+
isExtendedResizeExperienceOn,
|
|
124
|
+
isNestedNode = false
|
|
104
125
|
}) => css`
|
|
105
126
|
/* For nested rich media items, set max-width to 100% */
|
|
106
127
|
tr &,
|
|
@@ -114,6 +135,28 @@ export const MediaSingleDimensionHelper = ({
|
|
|
114
135
|
min-width: 100%;
|
|
115
136
|
`}
|
|
116
137
|
max-width: ${calcMaxWidth(layout, containerWidth)};
|
|
138
|
+
&[class*='is-resizing'] {
|
|
139
|
+
${isExtendedResizeExperienceOn && `max-width: ${calcMaxWidthWhenResizing(containerWidth, fullWidthMode, isNestedNode)};
|
|
140
|
+
|
|
141
|
+
${nonWrappedLayouts.includes(layout) && `margin-left: 50%;
|
|
142
|
+
transform: translateX(-50%);`}
|
|
143
|
+
|
|
144
|
+
.new-file-experience-wrapper {
|
|
145
|
+
box-shadow: none;
|
|
146
|
+
}`}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Handles responsiveness of non-nested, not-resizing nodes in editor */
|
|
150
|
+
&[class*='not-resizing'] {
|
|
151
|
+
${!isNestedNode && `max-width: ${layout !== 'full-width' && mediaSingleWidth && calcMaxWidthWhenNotResizing(containerWidth, mediaSingleWidth)};
|
|
152
|
+
|
|
153
|
+
${nonWrappedLayouts.includes(layout) && `margin-left: 50%;
|
|
154
|
+
transform: translateX(-50%);`}
|
|
155
|
+
|
|
156
|
+
// override min-width to counteract max-width set in old experience
|
|
157
|
+
${layout === 'full-width' && `min-width: ${getEffectiveFullWidth(containerWidth, fullWidthMode)} !important;`};`}
|
|
158
|
+
}
|
|
159
|
+
|
|
117
160
|
float: ${float(layout)};
|
|
118
161
|
margin: ${calcMargin(layout)};
|
|
119
162
|
${isImageAligned(layout)};
|
package/dist/es2019/ui/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as Caption } from './Caption';
|
|
2
|
-
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT
|
|
2
|
+
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT } from './MediaSingle';
|
|
3
3
|
export { MediaSingleDimensionHelper } from './MediaSingle/styled';
|
|
4
4
|
export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid, calcMediaPxWidth, wrappedLayouts } from './MediaSingle/grid';
|
|
5
5
|
export { mediaLinkStyle } from './MediaSingle/link';
|
|
@@ -42,7 +42,7 @@ export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLink
|
|
|
42
42
|
export const pmHistoryPluginKey = 'history$';
|
|
43
43
|
export { gridTypeForLayout } from './grid';
|
|
44
44
|
export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent } from './document';
|
|
45
|
-
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes } from './rich-media-utils';
|
|
45
|
+
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts } from './rich-media-utils';
|
|
46
46
|
export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
47
47
|
export { canRenderDatasource } from './datasource';
|
|
48
48
|
export { filterCommand, walkPrevNode, walkNextNode, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp } from './commands';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
2
|
import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
|
|
3
|
-
import { shouldAddDefaultWrappedWidth } from '../ui/MediaSingle';
|
|
4
3
|
import { calcPxFromColumns, wrappedLayouts } from '../ui/MediaSingle/grid';
|
|
4
|
+
export const shouldAddDefaultWrappedWidth = (layout, width, lineLength) => {
|
|
5
|
+
return wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
|
|
6
|
+
};
|
|
5
7
|
export const nonWrappedLayouts = ['center', 'wide', 'full-width'];
|
|
6
8
|
export const floatingLayouts = ['wrap-left', 'wrap-right'];
|
|
7
9
|
export const isRichMediaInsideOfBlockNode = (view, pos) => {
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2
5
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
6
|
import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
7
|
import { DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
@@ -9,10 +12,11 @@ import FullWidthIcon from '@atlaskit/icon/glyph/editor/media-full-width';
|
|
|
9
12
|
import WideIcon from '@atlaskit/icon/glyph/editor/media-wide';
|
|
10
13
|
import WrapLeftIcon from '@atlaskit/icon/glyph/editor/media-wrap-left';
|
|
11
14
|
import WrapRightIcon from '@atlaskit/icon/glyph/editor/media-wrap-right';
|
|
15
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
16
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
|
|
13
17
|
import { insideTable } from '../../core-utils';
|
|
14
18
|
import commonMessages, { mediaAndEmbedToolbarMessages as toolbarMessages } from '../../messages';
|
|
15
|
-
import { alignAttributes, isInLayoutColumn } from '../../utils';
|
|
19
|
+
import { alignAttributes, isInLayoutColumn, nonWrappedLayouts } from '../../utils';
|
|
16
20
|
|
|
17
21
|
// Workaround as we don't want to import this package into `editor-common`
|
|
18
22
|
// We'll get type errors if this gets out of sync with `editor-plugin-width`.
|
|
@@ -75,7 +79,10 @@ var makeAlign = function makeAlign(layout, nodeType, widthPluginDependencyApi, a
|
|
|
75
79
|
return false;
|
|
76
80
|
}
|
|
77
81
|
var nodeWidth = getNodeWidth(node, state.schema);
|
|
78
|
-
var newAttrs =
|
|
82
|
+
var newAttrs = getBooleanFF('platform.editor.media.extended-resize-experience') ? // with extended experience, change alignment does not change media single width
|
|
83
|
+
_objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
84
|
+
layout: layout
|
|
85
|
+
}) : alignAttributes(layout, node.attrs, undefined, nodeWidth, widthPluginState.lineLength);
|
|
79
86
|
var tr = state.tr.setNodeMarkup(state.selection.from, undefined, newAttrs);
|
|
80
87
|
tr.setMeta('scrollIntoView', false);
|
|
81
88
|
// when image captions are enabled, the wrong node gets selected after
|
|
@@ -104,18 +111,26 @@ var makeAlign = function makeAlign(layout, nodeType, widthPluginDependencyApi, a
|
|
|
104
111
|
return true;
|
|
105
112
|
};
|
|
106
113
|
};
|
|
107
|
-
var
|
|
114
|
+
var getToolbarLayout = function getToolbarLayout(layout) {
|
|
115
|
+
if (getBooleanFF('platform.editor.media.extended-resize-experience') && nonWrappedLayouts.includes(layout)) {
|
|
116
|
+
return 'center';
|
|
117
|
+
}
|
|
118
|
+
return layout;
|
|
119
|
+
};
|
|
120
|
+
var mapIconsToToolbarItem = function mapIconsToToolbarItem(icons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) {
|
|
108
121
|
return icons.map(function (toolbarItem) {
|
|
109
122
|
var id = toolbarItem.id,
|
|
110
123
|
value = toolbarItem.value;
|
|
111
|
-
return {
|
|
124
|
+
return _objectSpread({
|
|
112
125
|
id: id,
|
|
113
126
|
type: 'button',
|
|
114
127
|
icon: toolbarItem.icon,
|
|
115
128
|
title: intl.formatMessage(layoutToMessages[value]),
|
|
116
|
-
selected: layout === value,
|
|
129
|
+
selected: getToolbarLayout(layout) === value,
|
|
117
130
|
onClick: makeAlign(value, nodeType, widthPluginDependencyApi, analyticsApi)
|
|
118
|
-
}
|
|
131
|
+
}, isChangingLayoutDisabled && {
|
|
132
|
+
disabled: value !== 'center'
|
|
133
|
+
});
|
|
119
134
|
});
|
|
120
135
|
};
|
|
121
136
|
var shouldHideLayoutToolbar = function shouldHideLayoutToolbar(selection, _ref2, allowResizingInTables) {
|
|
@@ -125,13 +140,14 @@ var shouldHideLayoutToolbar = function shouldHideLayoutToolbar(selection, _ref2,
|
|
|
125
140
|
var buildLayoutButtons = function buildLayoutButtons(state, intl, nodeType, widthPluginDependencyApi, analyticsApi, allowResizing, allowResizingInTables) {
|
|
126
141
|
var allowWrapping = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
127
142
|
var allowAlignment = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
143
|
+
var isChangingLayoutDisabled = arguments.length > 9 ? arguments[9] : undefined;
|
|
128
144
|
var selection = state.selection;
|
|
129
145
|
if (!(selection instanceof NodeSelection) || !selection.node || !nodeType || shouldHideLayoutToolbar(selection, state.schema, allowResizingInTables)) {
|
|
130
146
|
return [];
|
|
131
147
|
}
|
|
132
148
|
var layout = selection.node.attrs.layout;
|
|
133
|
-
var alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi) : [];
|
|
134
|
-
var wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi) : [];
|
|
149
|
+
var alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) : [];
|
|
150
|
+
var wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi, isChangingLayoutDisabled) : [];
|
|
135
151
|
var breakOutToolbarItems = !allowResizing ? mapIconsToToolbarItem(breakoutIcons, layout, intl, nodeType, widthPluginDependencyApi, analyticsApi) : [];
|
|
136
152
|
var items = [].concat(_toConsumableArray(alignmentToolbarItems), _toConsumableArray(getSeparatorBetweenAlignmentAndWrapping(allowAlignment, allowWrapping)), _toConsumableArray(wrappingToolbarItems), _toConsumableArray(getSeparatorBeforeBreakoutItems(allowAlignment, allowWrapping, allowResizing)), _toConsumableArray(breakOutToolbarItems));
|
|
137
153
|
return items;
|
|
@@ -3,4 +3,5 @@ export { createFixedGuidelinesFromLengths, createGuidesFromLengths } from './fix
|
|
|
3
3
|
export { generateDefaultGuidelines } from './defaultGuideline';
|
|
4
4
|
export { getGuidelinesWithHighlights } from './updateGuideline';
|
|
5
5
|
export { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
|
|
6
|
+
export { getSnapWidth, findClosestSnap } from './snapping';
|
|
6
7
|
export { isVerticalPosition, getContainerWidthOrFullEditorWidth } from './utils';
|
|
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "74.
|
|
9
|
+
var packageVersion = "74.33.0";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
var richMediaClassName = 'rich-media-item';
|
|
5
6
|
var wrappedMediaBreakoutPoint = 410;
|
|
6
|
-
var mediaSingleSharedStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n li .", " {\n margin: 0;\n }\n\n /* Hack for chrome to fix media single position\n inside a list when media is the first child */\n &.ua-chrome li > .mediaSingleView-content-wrap::before {\n content: '';\n display: block;\n height: 0;\n }\n\n &.ua-firefox {\n .mediaSingleView-content-wrap {\n user-select: none;\n }\n\n .captionView-content-wrap {\n user-select: text;\n }\n }\n\n .mediaSingleView-content-wrap[layout='center'] {\n clear: both;\n }\n\n table .", " {\n margin-top:
|
|
7
|
+
var mediaSingleSharedStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n li .", " {\n margin: 0;\n }\n\n /* Hack for chrome to fix media single position\n inside a list when media is the first child */\n &.ua-chrome li > .mediaSingleView-content-wrap::before {\n content: '';\n display: block;\n height: 0;\n }\n\n &.ua-firefox {\n .mediaSingleView-content-wrap {\n user-select: none;\n }\n\n .captionView-content-wrap {\n user-select: text;\n }\n }\n\n .mediaSingleView-content-wrap[layout='center'] {\n clear: both;\n }\n\n table .", " {\n margin-top: ", ";\n margin-bottom: ", ";\n clear: both;\n\n &.image-wrap-left,\n &.image-wrap-right {\n clear: none;\n\n &:first-child {\n margin-top: ", ";\n }\n }\n }\n\n .", ".image-wrap-right\n + .", ".image-wrap-left {\n clear: both;\n }\n\n .", ".image-wrap-left\n + .", ".image-wrap-right,\n .", ".image-wrap-right\n + .", ".image-wrap-left,\n .", ".image-wrap-left\n + .", ".image-wrap-left,\n .", ".image-wrap-right\n + .", ".image-wrap-right {\n margin-right: 0;\n margin-left: 0;\n }\n\n ", "\n"])), richMediaClassName, richMediaClassName, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, richMediaClassName, !getBooleanFF('platform.editor.media.extended-resize-experience') && "@media all and (max-width: ".concat(wrappedMediaBreakoutPoint, "px) {\n div.mediaSingleView-content-wrap[layout='wrap-left'],\n div.mediaSingleView-content-wrap[data-layout='wrap-left'],\n div.mediaSingleView-content-wrap[layout='wrap-right'],\n div.mediaSingleView-content-wrap[data-layout='wrap-right'] {\n float: none;\n overflow: auto;\n margin: 12px 0;\n }\n }"));
|
|
7
8
|
export { mediaSingleSharedStyle, richMediaClassName };
|
|
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
|
|
|
18
18
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
19
19
|
import Layer from '../Layer';
|
|
20
20
|
var packageName = "@atlaskit/editor-common";
|
|
21
|
-
var packageVersion = "74.
|
|
21
|
+
var packageVersion = "74.33.0";
|
|
22
22
|
var halfFocusRing = 1;
|
|
23
23
|
var dropOffset = '0, 8';
|
|
24
24
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
import { akEditorMediaResizeHandlerPaddingWide, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
7
7
|
import { MEDIA_SINGLE_GUTTER_SIZE } from '../../media-single/constants';
|
|
8
8
|
import { getMediaSinglePixelWidth } from '../../media-single/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { shouldAddDefaultWrappedWidth } from '../../utils/rich-media-utils';
|
|
10
10
|
import { MediaSingleDimensionHelper, MediaWrapper } from './styled';
|
|
11
11
|
export var DEFAULT_IMAGE_WIDTH = 250;
|
|
12
12
|
export var DEFAULT_IMAGE_HEIGHT = 200;
|
|
@@ -16,9 +16,6 @@ export var DEFAULT_IMAGE_HEIGHT = 200;
|
|
|
16
16
|
Read more: https://product-fabric.atlassian.net/browse/MEX-2481
|
|
17
17
|
*/
|
|
18
18
|
export var IMAGE_AND_BORDER_ADJUSTMENT = 2;
|
|
19
|
-
export var shouldAddDefaultWrappedWidth = function shouldAddDefaultWrappedWidth(layout, width, lineLength) {
|
|
20
|
-
return wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
|
|
21
|
-
};
|
|
22
19
|
export default function MediaSingle(_ref) {
|
|
23
20
|
var layout = _ref.layout,
|
|
24
21
|
width = _ref.width,
|
|
@@ -5,7 +5,8 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
|
-
import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
|
|
9
|
+
import { nonWrappedLayouts } from '../../utils';
|
|
9
10
|
import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';
|
|
10
11
|
function float(layout) {
|
|
11
12
|
switch (layout) {
|
|
@@ -77,6 +78,24 @@ function calcMaxWidth(layout, containerWidth) {
|
|
|
77
78
|
return '100%';
|
|
78
79
|
}
|
|
79
80
|
}
|
|
81
|
+
var getEffectiveFullWidth = function getEffectiveFullWidth(containerWidth, fullWidthMode) {
|
|
82
|
+
if (fullWidthMode) {
|
|
83
|
+
return '100%';
|
|
84
|
+
}
|
|
85
|
+
// There is always padding for renderer, so we don't need padding for it
|
|
86
|
+
var fullWidthPadding = akEditorGutterPadding * 2;
|
|
87
|
+
return "".concat(Math.min(containerWidth - fullWidthPadding, akEditorFullWidthLayoutWidth), "px");
|
|
88
|
+
};
|
|
89
|
+
var calcMaxWidthWhenResizing = function calcMaxWidthWhenResizing(containerWidth, fullWidthMode, isNestedNode) {
|
|
90
|
+
if (isNestedNode) {
|
|
91
|
+
return '100%';
|
|
92
|
+
}
|
|
93
|
+
// non-nested node can resize up to full width
|
|
94
|
+
return getEffectiveFullWidth(containerWidth, fullWidthMode);
|
|
95
|
+
};
|
|
96
|
+
var calcMaxWidthWhenNotResizing = function calcMaxWidthWhenNotResizing(containerWidth, mediaSingleWidth) {
|
|
97
|
+
return "".concat(Math.min(mediaSingleWidth, containerWidth - akEditorGutterPadding * 2), "px");
|
|
98
|
+
};
|
|
80
99
|
function calcMargin(layout) {
|
|
81
100
|
switch (layout) {
|
|
82
101
|
case 'wrap-right':
|
|
@@ -109,8 +128,11 @@ export var MediaSingleDimensionHelper = function MediaSingleDimensionHelper(_ref
|
|
|
109
128
|
layout = _ref.layout,
|
|
110
129
|
pctWidth = _ref.pctWidth,
|
|
111
130
|
mediaSingleWidth = _ref.mediaSingleWidth,
|
|
112
|
-
width = _ref.width
|
|
113
|
-
|
|
131
|
+
width = _ref.width,
|
|
132
|
+
isExtendedResizeExperienceOn = _ref.isExtendedResizeExperienceOn,
|
|
133
|
+
_ref$isNestedNode = _ref.isNestedNode,
|
|
134
|
+
isNestedNode = _ref$isNestedNode === void 0 ? false : _ref$isNestedNode;
|
|
135
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* For nested rich media items, set max-width to 100% */\n tr &,\n [data-layout-column] &,\n [data-node-type='expand'] & {\n max-width: 100%;\n }\n\n width: ", ";\n ", "\n max-width: ", ";\n &[class*='is-resizing'] {\n ", "\n }\n\n /* Handles responsiveness of non-nested, not-resizing nodes in editor */\n &[class*='not-resizing'] {\n ", "\n }\n\n float: ", ";\n margin: ", ";\n ", ";\n\n &:not(.is-resizing) {\n transition: width 100ms ease-in;\n }\n"])), mediaSingleWidth || pctWidth ? calcResizedWidth(layout, width || 0, containerWidth) : calcLegacyWidth(layout, width || 0, containerWidth, fullWidthMode, isResized), layout === 'full-width' && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 100%;\n "]))), calcMaxWidth(layout, containerWidth), isExtendedResizeExperienceOn && "max-width: ".concat(calcMaxWidthWhenResizing(containerWidth, fullWidthMode, isNestedNode), ";\n\n ").concat(nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n\n .new-file-experience-wrapper {\n box-shadow: none;\n }"), !isNestedNode && "max-width: ".concat(layout !== 'full-width' && mediaSingleWidth && calcMaxWidthWhenNotResizing(containerWidth, mediaSingleWidth), ";\n\n ").concat(nonWrappedLayouts.includes(layout) && "margin-left: 50%;\n transform: translateX(-50%);", "\n\n // override min-width to counteract max-width set in old experience\n ").concat(layout === 'full-width' && "min-width: ".concat(getEffectiveFullWidth(containerWidth, fullWidthMode), " !important;"), ";"), float(layout), calcMargin(layout), isImageAligned(layout));
|
|
114
136
|
};
|
|
115
137
|
var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
|
|
116
138
|
var hasFallbackContainer = _ref2.hasFallbackContainer,
|
package/dist/esm/ui/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as Caption } from './Caption';
|
|
2
|
-
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT
|
|
2
|
+
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT } from './MediaSingle';
|
|
3
3
|
export { MediaSingleDimensionHelper } from './MediaSingle/styled';
|
|
4
4
|
export { layoutSupportsWidth, calcPxFromColumns, calcPctFromPx, calcPxFromPct, calcColumnsFromPx, snapToGrid, calcMediaPxWidth, wrappedLayouts } from './MediaSingle/grid';
|
|
5
5
|
export { mediaLinkStyle } from './MediaSingle/link';
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -42,7 +42,7 @@ export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLink
|
|
|
42
42
|
export var pmHistoryPluginKey = 'history$';
|
|
43
43
|
export { gridTypeForLayout } from './grid';
|
|
44
44
|
export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent } from './document';
|
|
45
|
-
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes } from './rich-media-utils';
|
|
45
|
+
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts } from './rich-media-utils';
|
|
46
46
|
export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
47
47
|
export { canRenderDatasource } from './datasource';
|
|
48
48
|
export { filterCommand, walkPrevNode, walkNextNode, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp } from './commands';
|
|
@@ -3,8 +3,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
|
|
6
|
-
import { shouldAddDefaultWrappedWidth } from '../ui/MediaSingle';
|
|
7
6
|
import { calcPxFromColumns, wrappedLayouts } from '../ui/MediaSingle/grid';
|
|
7
|
+
export var shouldAddDefaultWrappedWidth = function shouldAddDefaultWrappedWidth(layout, width, lineLength) {
|
|
8
|
+
return wrappedLayouts.indexOf(layout) > -1 && lineLength && width && width > 0.5 * lineLength;
|
|
9
|
+
};
|
|
8
10
|
export var nonWrappedLayouts = ['center', 'wide', 'full-width'];
|
|
9
11
|
export var floatingLayouts = ['wrap-left', 'wrap-right'];
|
|
10
12
|
export var isRichMediaInsideOfBlockNode = function isRichMediaInsideOfBlockNode(view, pos) {
|
package/dist/esm/version.json
CHANGED
|
@@ -7,5 +7,5 @@ type WidthPluginType = NextEditorPlugin<'width', {
|
|
|
7
7
|
sharedState: EditorContainerWidth | undefined;
|
|
8
8
|
}>;
|
|
9
9
|
type WidthPluginDependencyApi = PluginDependenciesAPI<WidthPluginType> | undefined;
|
|
10
|
-
declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean) => FloatingToolbarItem<Command>[];
|
|
10
|
+
declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean, isChangingLayoutDisabled?: boolean) => FloatingToolbarItem<Command>[];
|
|
11
11
|
export default buildLayoutButtons;
|
|
@@ -4,4 +4,5 @@ export { generateDefaultGuidelines } from './defaultGuideline';
|
|
|
4
4
|
export { getGuidelinesWithHighlights } from './updateGuideline';
|
|
5
5
|
export { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
|
|
6
6
|
export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, } from './types';
|
|
7
|
+
export { getSnapWidth, findClosestSnap } from './snapping';
|
|
7
8
|
export { isVerticalPosition, getContainerWidthOrFullEditorWidth, } from './utils';
|
|
@@ -416,6 +416,14 @@ export type FeatureFlags = {
|
|
|
416
416
|
* @default false
|
|
417
417
|
*/
|
|
418
418
|
useFragmentMarkBreakoutWidthStylingFix?: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* @description
|
|
421
|
+
* Enable the new editor media resize experience.
|
|
422
|
+
*
|
|
423
|
+
* @see https://product-fabric.atlassian.net/browse/ED-18316
|
|
424
|
+
* @default false
|
|
425
|
+
*/
|
|
426
|
+
extendedMediaResizeExperience?: boolean | undefined;
|
|
419
427
|
};
|
|
420
428
|
export type FeatureFlagKey = keyof FeatureFlags;
|
|
421
429
|
export type GetEditorFeatureFlags = () => FeatureFlags;
|
|
@@ -16,5 +16,5 @@ export type OpenChangedEvent = {
|
|
|
16
16
|
isOpen: boolean;
|
|
17
17
|
event: MouseEvent | KeyboardEvent;
|
|
18
18
|
};
|
|
19
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "id" | "children" | "
|
|
19
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "id" | "children" | "testId" | "position" | "analyticsContext" | "shouldFitContainer" | "trigger" | "isOpen" | "onPositioned" | "onOpenChange"> & import("react").RefAttributes<any>>;
|
|
20
20
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import { RichMediaLayout as MediaSingleLayout
|
|
4
|
+
import { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
5
5
|
import type { MediaSingleSize, MediaSingleWidthType } from './types';
|
|
6
6
|
export declare const DEFAULT_IMAGE_WIDTH = 250;
|
|
7
7
|
export declare const DEFAULT_IMAGE_HEIGHT = 200;
|
|
@@ -27,6 +27,5 @@ export interface Props {
|
|
|
27
27
|
hasFallbackContainer?: boolean;
|
|
28
28
|
handleMediaSingleRef?: React.RefObject<HTMLDivElement>;
|
|
29
29
|
}
|
|
30
|
-
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
31
30
|
export type { MediaSingleWidthType, MediaSingleSize };
|
|
32
31
|
export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength: editorWidth, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
|
|
@@ -31,12 +31,14 @@ export interface MediaSingleWrapperProps {
|
|
|
31
31
|
mediaSingleWidth?: number;
|
|
32
32
|
width?: number;
|
|
33
33
|
innerRef?: ((elem: HTMLDivElement) => void) | RefObject<HTMLDivElement>;
|
|
34
|
+
isExtendedResizeExperienceOn?: boolean;
|
|
35
|
+
isNestedNode?: boolean;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Can't use `.attrs` to handle highly dynamic styles because we are still
|
|
37
39
|
* supporting `styled-components` v1.
|
|
38
40
|
*/
|
|
39
|
-
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
41
|
+
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, isExtendedResizeExperienceOn, isNestedNode, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
40
42
|
export interface MediaWrapperProps {
|
|
41
43
|
paddingBottom?: string;
|
|
42
44
|
height?: number;
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as Caption } from './Caption';
|
|
2
|
-
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT,
|
|
2
|
+
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, } from './MediaSingle';
|
|
3
3
|
export type { Props as MediaSingleProps, MediaSingleWidthType, MediaSingleSize, } from './MediaSingle';
|
|
4
4
|
export { MediaSingleDimensionHelper } from './MediaSingle/styled';
|
|
5
5
|
export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
|
|
@@ -52,7 +52,7 @@ export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLink
|
|
|
52
52
|
export declare const pmHistoryPluginKey = "history$";
|
|
53
53
|
export { gridTypeForLayout } from './grid';
|
|
54
54
|
export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent, } from './document';
|
|
55
|
-
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, } from './rich-media-utils';
|
|
55
|
+
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts, } from './rich-media-utils';
|
|
56
56
|
export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
57
57
|
export { canRenderDatasource } from './datasource';
|
|
58
58
|
export { filterCommand, walkPrevNode, walkNextNode, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, } from './commands';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RichMediaAttributes, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
2
2
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { SnapPointsProps } from '../types';
|
|
4
|
+
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
4
5
|
export declare const nonWrappedLayouts: RichMediaLayout[];
|
|
5
6
|
export declare const floatingLayouts: string[];
|
|
6
7
|
export declare const isRichMediaInsideOfBlockNode: (view: EditorView, pos: number | boolean) => boolean;
|
|
@@ -7,5 +7,5 @@ type WidthPluginType = NextEditorPlugin<'width', {
|
|
|
7
7
|
sharedState: EditorContainerWidth | undefined;
|
|
8
8
|
}>;
|
|
9
9
|
type WidthPluginDependencyApi = PluginDependenciesAPI<WidthPluginType> | undefined;
|
|
10
|
-
declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean) => FloatingToolbarItem<Command>[];
|
|
10
|
+
declare const buildLayoutButtons: (state: EditorState, intl: IntlShape, nodeType: NodeType, widthPluginDependencyApi: WidthPluginDependencyApi, analyticsApi: EditorAnalyticsAPI | undefined, allowResizing?: boolean, allowResizingInTables?: boolean, allowWrapping?: boolean, allowAlignment?: boolean, isChangingLayoutDisabled?: boolean) => FloatingToolbarItem<Command>[];
|
|
11
11
|
export default buildLayoutButtons;
|
|
@@ -4,4 +4,5 @@ export { generateDefaultGuidelines } from './defaultGuideline';
|
|
|
4
4
|
export { getGuidelinesWithHighlights } from './updateGuideline';
|
|
5
5
|
export { MEDIA_DYNAMIC_GUIDELINE_PREFIX } from './constants';
|
|
6
6
|
export type { WidthTypes, Position, GuidelineConfig, GuidelinePluginState, GuidelinePluginOptions, DisplayGuideline, DisplayGrid, VerticalPosition, HorizontalPosition, } from './types';
|
|
7
|
+
export { getSnapWidth, findClosestSnap } from './snapping';
|
|
7
8
|
export { isVerticalPosition, getContainerWidthOrFullEditorWidth, } from './utils';
|
|
@@ -416,6 +416,14 @@ export type FeatureFlags = {
|
|
|
416
416
|
* @default false
|
|
417
417
|
*/
|
|
418
418
|
useFragmentMarkBreakoutWidthStylingFix?: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* @description
|
|
421
|
+
* Enable the new editor media resize experience.
|
|
422
|
+
*
|
|
423
|
+
* @see https://product-fabric.atlassian.net/browse/ED-18316
|
|
424
|
+
* @default false
|
|
425
|
+
*/
|
|
426
|
+
extendedMediaResizeExperience?: boolean | undefined;
|
|
419
427
|
};
|
|
420
428
|
export type FeatureFlagKey = keyof FeatureFlags;
|
|
421
429
|
export type GetEditorFeatureFlags = () => FeatureFlags;
|
|
@@ -16,5 +16,5 @@ export type OpenChangedEvent = {
|
|
|
16
16
|
isOpen: boolean;
|
|
17
17
|
event: MouseEvent | KeyboardEvent;
|
|
18
18
|
};
|
|
19
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "id" | "children" | "
|
|
19
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "id" | "children" | "testId" | "position" | "analyticsContext" | "shouldFitContainer" | "trigger" | "isOpen" | "onPositioned" | "onOpenChange"> & import("react").RefAttributes<any>>;
|
|
20
20
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import { RichMediaLayout as MediaSingleLayout
|
|
4
|
+
import { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
|
|
5
5
|
import type { MediaSingleSize, MediaSingleWidthType } from './types';
|
|
6
6
|
export declare const DEFAULT_IMAGE_WIDTH = 250;
|
|
7
7
|
export declare const DEFAULT_IMAGE_HEIGHT = 200;
|
|
@@ -27,6 +27,5 @@ export interface Props {
|
|
|
27
27
|
hasFallbackContainer?: boolean;
|
|
28
28
|
handleMediaSingleRef?: React.RefObject<HTMLDivElement>;
|
|
29
29
|
}
|
|
30
|
-
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
31
30
|
export type { MediaSingleWidthType, MediaSingleSize };
|
|
32
31
|
export default function MediaSingle({ layout, width, height, containerWidth, isLoading, pctWidth, size, className, children: propsChildren, nodeType, fullWidthMode, lineLength: editorWidth, hasFallbackContainer, handleMediaSingleRef, }: Props): jsx.JSX.Element;
|
|
@@ -31,12 +31,14 @@ export interface MediaSingleWrapperProps {
|
|
|
31
31
|
mediaSingleWidth?: number;
|
|
32
32
|
width?: number;
|
|
33
33
|
innerRef?: ((elem: HTMLDivElement) => void) | RefObject<HTMLDivElement>;
|
|
34
|
+
isExtendedResizeExperienceOn?: boolean;
|
|
35
|
+
isNestedNode?: boolean;
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Can't use `.attrs` to handle highly dynamic styles because we are still
|
|
37
39
|
* supporting `styled-components` v1.
|
|
38
40
|
*/
|
|
39
|
-
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
41
|
+
export declare const MediaSingleDimensionHelper: ({ containerWidth, fullWidthMode, isResized, layout, pctWidth, mediaSingleWidth, width, isExtendedResizeExperienceOn, isNestedNode, }: MediaSingleWrapperProps) => import("@emotion/react").SerializedStyles;
|
|
40
42
|
export interface MediaWrapperProps {
|
|
41
43
|
paddingBottom?: string;
|
|
42
44
|
height?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as Caption } from './Caption';
|
|
2
|
-
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT,
|
|
2
|
+
export { default as MediaSingle, DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, IMAGE_AND_BORDER_ADJUSTMENT, } from './MediaSingle';
|
|
3
3
|
export type { Props as MediaSingleProps, MediaSingleWidthType, MediaSingleSize, } from './MediaSingle';
|
|
4
4
|
export { MediaSingleDimensionHelper } from './MediaSingle/styled';
|
|
5
5
|
export type { MediaSingleWrapperProps as MediaSingleDimensionHelperProps } from './MediaSingle/styled';
|
|
@@ -52,7 +52,7 @@ export { isFromCurrentDomain, LinkMatcher, normalizeUrl, linkifyContent, getLink
|
|
|
52
52
|
export declare const pmHistoryPluginKey = "history$";
|
|
53
53
|
export { gridTypeForLayout } from './grid';
|
|
54
54
|
export { nodesBetweenChanged, getStepRange, isEmptyDocument, processRawValue, hasDocAsParent, bracketTyped, hasVisibleContent, } from './document';
|
|
55
|
-
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, } from './rich-media-utils';
|
|
55
|
+
export { floatingLayouts, isRichMediaInsideOfBlockNode, calculateSnapPoints, alignAttributes, nonWrappedLayouts, } from './rich-media-utils';
|
|
56
56
|
export { sanitizeNodeForPrivacy } from './filter/privacy-filter';
|
|
57
57
|
export { canRenderDatasource } from './datasource';
|
|
58
58
|
export { filterCommand, walkPrevNode, walkNextNode, isEmptySelectionAtStart, isEmptySelectionAtEnd, insertContentDeleteRange, deleteEmptyParagraphAndMoveBlockUp, } from './commands';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RichMediaAttributes, RichMediaLayout } from '@atlaskit/adf-schema';
|
|
2
2
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { SnapPointsProps } from '../types';
|
|
4
|
+
export declare const shouldAddDefaultWrappedWidth: (layout: RichMediaLayout, width?: number, lineLength?: number) => boolean | 0 | undefined;
|
|
4
5
|
export declare const nonWrappedLayouts: RichMediaLayout[];
|
|
5
6
|
export declare const floatingLayouts: string[];
|
|
6
7
|
export declare const isRichMediaInsideOfBlockNode: (view: EditorView, pos: number | boolean) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "74.
|
|
3
|
+
"version": "74.33.0",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@atlaskit/icon": "^21.12.0",
|
|
98
98
|
"@atlaskit/icon-object": "^6.3.0",
|
|
99
99
|
"@atlaskit/in-product-testing": "^0.2.0",
|
|
100
|
-
"@atlaskit/link-datasource": "^0.
|
|
100
|
+
"@atlaskit/link-datasource": "^0.32.0",
|
|
101
101
|
"@atlaskit/link-picker": "^1.25.0",
|
|
102
102
|
"@atlaskit/media-card": "^76.1.0",
|
|
103
103
|
"@atlaskit/media-client": "^23.1.0",
|
|
@@ -191,6 +191,9 @@
|
|
|
191
191
|
"platform.linking-platform.datasource-jira_issues": {
|
|
192
192
|
"type": "boolean"
|
|
193
193
|
},
|
|
194
|
+
"platform.editor.media.extended-resize-experience": {
|
|
195
|
+
"type": "boolean"
|
|
196
|
+
},
|
|
194
197
|
"platform.linking-platform.datasource-assets_objects": {
|
|
195
198
|
"type": "boolean"
|
|
196
199
|
}
|