@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
105 lines (102 loc) • 3.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.widthToToolbarSize = exports.toolbarSizeToWidth = void 0;
var _types = require("@atlaskit/editor-common/types");
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
var _isFullPage = require("../../utils/is-full-page");
// Toolbar sizes for full page editor a little bit different, because it has more buttons e.g. actions button...
var toolbarSizesFullPageNext = [{
width: _types.ToolbarWidthsFullPageNext.XXL,
size: _types.ToolbarSize.XXL
}, {
width: _types.ToolbarWidthsFullPageNext.XL,
size: _types.ToolbarSize.XL
}, {
width: _types.ToolbarWidthsFullPageNext.L,
size: _types.ToolbarSize.L
}, {
width: _types.ToolbarWidthsFullPageNext.M,
size: _types.ToolbarSize.M
}, {
width: _types.ToolbarWidthsFullPageNext.S,
size: _types.ToolbarSize.S
}];
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
/** @deprecated
* To be removed as part of ED-25129 in favour of toolbarSizesFullPageNext along with references
* to platform_editor_toolbar_responsive_fixes feature gate
*/
var toolbarSizesFullPage = [{
width: _types.ToolbarWidthsFullPage.XXL,
size: _types.ToolbarSize.XXL
}, {
width: _types.ToolbarWidthsFullPage.XL,
size: _types.ToolbarSize.XL
}, {
width: _types.ToolbarWidthsFullPage.L,
size: _types.ToolbarSize.L
}, {
width: _types.ToolbarWidthsFullPage.M,
size: _types.ToolbarSize.M
}, {
width: _types.ToolbarWidthsFullPage.S,
size: _types.ToolbarSize.S
}];
var toolbarSizesNext = [{
width: _types.ToolbarWidthsNext.XXL,
size: _types.ToolbarSize.XXL
}, {
width: _types.ToolbarWidthsNext.XL,
size: _types.ToolbarSize.XL
}, {
width: _types.ToolbarWidthsNext.L,
size: _types.ToolbarSize.L
}, {
width: _types.ToolbarWidthsNext.M,
size: _types.ToolbarSize.M
}, {
width: _types.ToolbarWidthsNext.S,
size: _types.ToolbarSize.S
}];
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
/** @deprecated
* To be removed as part of ED-25129 in favour of toolbarSizesNext along with references
* to platform_editor_toolbar_responsive_fixes feature gate
*/
var toolbarSizes = [{
width: _types.ToolbarWidths.XXL,
size: _types.ToolbarSize.XXL
}, {
width: _types.ToolbarWidths.XL,
size: _types.ToolbarSize.XL
}, {
width: _types.ToolbarWidths.L,
size: _types.ToolbarSize.L
}, {
width: _types.ToolbarWidths.M,
size: _types.ToolbarSize.M
}, {
width: _types.ToolbarWidths.S,
size: _types.ToolbarSize.S
}];
var toolbarSizesForAppearance = function toolbarSizesForAppearance(appearance) {
return (0, _isFullPage.isFullPage)(appearance) ? (0, _platformFeatureFlags.fg)('platform_editor_toolbar_responsive_fixes') ? toolbarSizesFullPageNext : toolbarSizesFullPage : (0, _platformFeatureFlags.fg)('platform_editor_toolbar_responsive_fixes') ? toolbarSizesNext : toolbarSizes;
};
var toolbarSizeToWidth = exports.toolbarSizeToWidth = function toolbarSizeToWidth(toolbarSize, appearance) {
return (toolbarSizesForAppearance(appearance).find(function (_ref) {
var size = _ref.size;
return toolbarSize === size;
}) || {
width: _types.ToolbarWidths.S
}).width;
};
var widthToToolbarSize = exports.widthToToolbarSize = function widthToToolbarSize(toolbarWidth, appearance) {
return (toolbarSizesForAppearance(appearance).find(function (_ref2) {
var width = _ref2.width;
return toolbarWidth > width;
}) || {
size: _types.ToolbarSize.XXXS
}).size;
};