@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
46 lines • 1.48 kB
JavaScript
import MinusIcon from '@atlaskit/icon/core/minus';
import SmartLinkCardIcon from '@atlaskit/icon/core/smart-link-card';
import SmartLinkEmbedIcon from '@atlaskit/icon/core/smart-link-embed';
import SmartLinkInlineIcon from '@atlaskit/icon/core/smart-link-inline';
import { cardMessages as messages } from '../messages';
export var appearancePropsMap = {
url: {
title: messages.urlTitle,
icon: MinusIcon
},
inline: {
title: messages.inlineTitle,
icon: SmartLinkInlineIcon
},
block: {
title: messages.blockTitle,
icon: SmartLinkCardIcon
},
embed: {
title: messages.embedTitle,
icon: SmartLinkEmbedIcon
}
};
export var getButtonGroupOption = function getButtonGroupOption(intl, areAnyNewToolbarFlagsEnabled, dispatchCommand, _ref) {
var disabled = _ref.disabled,
_onClick = _ref.onClick,
selected = _ref.selected,
appearance = _ref.appearance,
testId = _ref.testId,
tooltip = _ref.tooltip;
var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'],
title = _appearancePropsMap.title,
icon = _appearancePropsMap.icon;
return {
title: intl.formatMessage(title),
icon: icon,
onClick: function onClick() {
return dispatchCommand(_onClick);
},
disabled: Boolean(disabled),
tooltipContent: tooltip || null,
testId: testId,
selected: selected,
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
};
};