@atlaskit/editor-core 187.35.2 → 187.35.3
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 +6 -0
- package/dist/cjs/plugins/media/toolbar/index.js +8 -1
- package/dist/cjs/plugins/media/toolbar/utils.js +15 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/media/toolbar/index.js +10 -2
- package/dist/es2019/plugins/media/toolbar/utils.js +12 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/media/toolbar/index.js +9 -2
- package/dist/esm/plugins/media/toolbar/utils.js +12 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/media/toolbar/utils.d.ts +1 -0
- package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.35.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1a4a64498ae`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1a4a64498ae) - fix media floating toolbar cut off issue on align right and wrap right
|
|
8
|
+
|
|
3
9
|
## 187.35.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -449,6 +449,7 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
449
449
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
450
450
|
providerFactory = options.providerFactory,
|
|
451
451
|
allowMediaInline = options.allowMediaInline,
|
|
452
|
+
allowResizing = options.allowResizing,
|
|
452
453
|
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
453
454
|
var mediaPluginState = _pluginKey.stateKey.getState(state);
|
|
454
455
|
var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
|
|
@@ -512,9 +513,15 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
512
513
|
};
|
|
513
514
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags);
|
|
514
515
|
}
|
|
515
|
-
|
|
516
|
+
var toolbarConfig = _objectSpread(_objectSpread({}, baseToolbar), {}, {
|
|
516
517
|
items: items,
|
|
517
518
|
scrollable: true
|
|
518
519
|
});
|
|
520
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.extended-resize-experience') && allowResizing) {
|
|
521
|
+
return _objectSpread(_objectSpread({}, toolbarConfig), {}, {
|
|
522
|
+
width: mediaPluginState.isResizing ? undefined : (0, _utils2.getMaxToolbarWidth)()
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
return toolbarConfig;
|
|
519
526
|
};
|
|
520
527
|
exports.floatingToolbar = floatingToolbar;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.removeMediaGroupNode = exports.getSelectedMediaSingle = exports.getSelectedMediaContainerNodeAttrs = exports.getPixelWidthOfElement = exports.downloadMedia = exports.calcNewLayout = void 0;
|
|
7
|
+
exports.removeMediaGroupNode = exports.getSelectedMediaSingle = exports.getSelectedMediaContainerNodeAttrs = exports.getPixelWidthOfElement = exports.getMaxToolbarWidth = exports.downloadMedia = exports.calcNewLayout = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _mediaClient = require("@atlaskit/media-client");
|
|
@@ -101,4 +101,17 @@ var calcNewLayout = function calcNewLayout(width, layout, contentWidth) {
|
|
|
101
101
|
}
|
|
102
102
|
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
103
103
|
};
|
|
104
|
-
exports.calcNewLayout = calcNewLayout;
|
|
104
|
+
exports.calcNewLayout = calcNewLayout;
|
|
105
|
+
var maxToolbarFitWidth = 0;
|
|
106
|
+
var getMaxToolbarWidth = function getMaxToolbarWidth() {
|
|
107
|
+
var toolbar = document.querySelector("div[aria-label=\"Media floating controls\"]");
|
|
108
|
+
var toolbarWidth = toolbar === null || toolbar === void 0 ? void 0 : toolbar.getBoundingClientRect().width;
|
|
109
|
+
if (!toolbar) {
|
|
110
|
+
maxToolbarFitWidth = 0;
|
|
111
|
+
}
|
|
112
|
+
if (toolbarWidth && toolbarWidth > maxToolbarFitWidth) {
|
|
113
|
+
maxToolbarFitWidth = toolbarWidth;
|
|
114
|
+
}
|
|
115
|
+
return maxToolbarFitWidth;
|
|
116
|
+
};
|
|
117
|
+
exports.getMaxToolbarWidth = getMaxToolbarWidth;
|
|
@@ -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.35.
|
|
9
|
+
var version = "187.35.3";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
@@ -18,7 +18,7 @@ import { messages } from '@atlaskit/media-ui';
|
|
|
18
18
|
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
19
19
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
20
20
|
import { FilePreviewItem } from './filePreviewItem';
|
|
21
|
-
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement, calcNewLayout } from './utils';
|
|
21
|
+
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement, calcNewLayout, getMaxToolbarWidth } from './utils';
|
|
22
22
|
import { isVideo } from '../utils/media-single';
|
|
23
23
|
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
|
|
24
24
|
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
@@ -466,6 +466,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
466
466
|
allowAltTextOnImages,
|
|
467
467
|
providerFactory,
|
|
468
468
|
allowMediaInline,
|
|
469
|
+
allowResizing,
|
|
469
470
|
getEditorFeatureFlags
|
|
470
471
|
} = options;
|
|
471
472
|
const mediaPluginState = stateKey.getState(state);
|
|
@@ -529,9 +530,16 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
|
|
|
529
530
|
};
|
|
530
531
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags);
|
|
531
532
|
}
|
|
532
|
-
|
|
533
|
+
const toolbarConfig = {
|
|
533
534
|
...baseToolbar,
|
|
534
535
|
items,
|
|
535
536
|
scrollable: true
|
|
536
537
|
};
|
|
538
|
+
if (getBooleanFF('platform.editor.media.extended-resize-experience') && allowResizing) {
|
|
539
|
+
return {
|
|
540
|
+
...toolbarConfig,
|
|
541
|
+
width: mediaPluginState.isResizing ? undefined : getMaxToolbarWidth()
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
return toolbarConfig;
|
|
537
545
|
};
|
|
@@ -71,4 +71,16 @@ export const calcNewLayout = (width, layout, contentWidth, fullWidthMode = false
|
|
|
71
71
|
return 'wide';
|
|
72
72
|
}
|
|
73
73
|
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
74
|
+
};
|
|
75
|
+
let maxToolbarFitWidth = 0;
|
|
76
|
+
export const getMaxToolbarWidth = () => {
|
|
77
|
+
const toolbar = document.querySelector(`div[aria-label="Media floating controls"]`);
|
|
78
|
+
const toolbarWidth = toolbar === null || toolbar === void 0 ? void 0 : toolbar.getBoundingClientRect().width;
|
|
79
|
+
if (!toolbar) {
|
|
80
|
+
maxToolbarFitWidth = 0;
|
|
81
|
+
}
|
|
82
|
+
if (toolbarWidth && toolbarWidth > maxToolbarFitWidth) {
|
|
83
|
+
maxToolbarFitWidth = toolbarWidth;
|
|
84
|
+
}
|
|
85
|
+
return maxToolbarFitWidth;
|
|
74
86
|
};
|
|
@@ -22,7 +22,7 @@ import { messages } from '@atlaskit/media-ui';
|
|
|
22
22
|
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
23
23
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
24
24
|
import { FilePreviewItem } from './filePreviewItem';
|
|
25
|
-
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement, calcNewLayout } from './utils';
|
|
25
|
+
import { downloadMedia, getSelectedMediaSingle, removeMediaGroupNode, getPixelWidthOfElement, calcNewLayout, getMaxToolbarWidth } from './utils';
|
|
26
26
|
import { isVideo } from '../utils/media-single';
|
|
27
27
|
import { changeInlineToMediaCard, changeMediaCardToInline, removeInlineCard, setBorderMark, toggleBorderMark } from './commands';
|
|
28
28
|
import { MediaInlineNodeSelector, MediaSingleNodeSelector } from '../nodeviews/styles';
|
|
@@ -442,6 +442,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
442
442
|
allowAltTextOnImages = options.allowAltTextOnImages,
|
|
443
443
|
providerFactory = options.providerFactory,
|
|
444
444
|
allowMediaInline = options.allowMediaInline,
|
|
445
|
+
allowResizing = options.allowResizing,
|
|
445
446
|
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
446
447
|
var mediaPluginState = stateKey.getState(state);
|
|
447
448
|
var mediaLinkingState = getMediaLinkingState(state);
|
|
@@ -505,8 +506,14 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
505
506
|
};
|
|
506
507
|
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags);
|
|
507
508
|
}
|
|
508
|
-
|
|
509
|
+
var toolbarConfig = _objectSpread(_objectSpread({}, baseToolbar), {}, {
|
|
509
510
|
items: items,
|
|
510
511
|
scrollable: true
|
|
511
512
|
});
|
|
513
|
+
if (getBooleanFF('platform.editor.media.extended-resize-experience') && allowResizing) {
|
|
514
|
+
return _objectSpread(_objectSpread({}, toolbarConfig), {}, {
|
|
515
|
+
width: mediaPluginState.isResizing ? undefined : getMaxToolbarWidth()
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
return toolbarConfig;
|
|
512
519
|
};
|
|
@@ -88,4 +88,16 @@ export var calcNewLayout = function calcNewLayout(width, layout, contentWidth) {
|
|
|
88
88
|
return 'wide';
|
|
89
89
|
}
|
|
90
90
|
return isWrappedLayout && width !== contentWidth ? layout : 'center';
|
|
91
|
+
};
|
|
92
|
+
var maxToolbarFitWidth = 0;
|
|
93
|
+
export var getMaxToolbarWidth = function getMaxToolbarWidth() {
|
|
94
|
+
var toolbar = document.querySelector("div[aria-label=\"Media floating controls\"]");
|
|
95
|
+
var toolbarWidth = toolbar === null || toolbar === void 0 ? void 0 : toolbar.getBoundingClientRect().width;
|
|
96
|
+
if (!toolbar) {
|
|
97
|
+
maxToolbarFitWidth = 0;
|
|
98
|
+
}
|
|
99
|
+
if (toolbarWidth && toolbarWidth > maxToolbarFitWidth) {
|
|
100
|
+
maxToolbarFitWidth = toolbarWidth;
|
|
101
|
+
}
|
|
102
|
+
return maxToolbarFitWidth;
|
|
91
103
|
};
|
|
@@ -8,3 +8,4 @@ export declare const removeMediaGroupNode: (state: EditorState) => import("prose
|
|
|
8
8
|
export declare const getSelectedMediaSingle: (state: EditorState) => import("prosemirror-utils/dist/types").FindResult;
|
|
9
9
|
export declare const getPixelWidthOfElement: (editorView: EditorView, pos: number, mediaWidth: number) => number;
|
|
10
10
|
export declare const calcNewLayout: (width: number, layout: RichMediaLayout, contentWidth: number, fullWidthMode?: boolean) => RichMediaLayout;
|
|
11
|
+
export declare const getMaxToolbarWidth: () => number;
|
|
@@ -8,3 +8,4 @@ export declare const removeMediaGroupNode: (state: EditorState) => import("prose
|
|
|
8
8
|
export declare const getSelectedMediaSingle: (state: EditorState) => import("prosemirror-utils/dist/types").FindResult;
|
|
9
9
|
export declare const getPixelWidthOfElement: (editorView: EditorView, pos: number, mediaWidth: number) => number;
|
|
10
10
|
export declare const calcNewLayout: (width: number, layout: RichMediaLayout, contentWidth: number, fullWidthMode?: boolean) => RichMediaLayout;
|
|
11
|
+
export declare const getMaxToolbarWidth: () => number;
|