@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
32 lines (30 loc) • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.tableCellBackgroundStyleOverride = exports.mapBackgroundColors = void 0;
var _react = require("@emotion/react");
var _adfSchema = require("@atlaskit/adf-schema");
var _editorPalette = require("@atlaskit/editor-palette");
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled -- Pre-existing lint debt surfaced by this mechanical type-import-only PR. */
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
// This is used in order to support usage of DS tokens. Table cell background-color
// is set inline in '@atlaskit/adf-schema' and the color value is stored in ADF so
// it is not possible to use tokens there without polluting ADF.
// As table cell backgrounds are set inline, this should not break mobile as
// hexToEditorBackgroundPaletteColor() outputs a css variable with fallback hex.
var mapBackgroundColors = exports.mapBackgroundColors = function mapBackgroundColors() {
var cssString = '';
_adfSchema.tableBackgroundColorNames.forEach(function (value, key) {
var paletteColorValue = (0, _editorPalette.hexToEditorBackgroundPaletteColor)(value);
if (paletteColorValue) {
cssString += "\n td[colorname='".concat(key, "' i],\n th[colorname='").concat(key, "' i] {\n background-color: ").concat(paletteColorValue, " !important;\n }\n ");
}
});
return cssString;
};
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
var tableCellBackgroundStyleOverride = exports.tableCellBackgroundStyleOverride = function tableCellBackgroundStyleOverride() {
return (0, _react.css)(mapBackgroundColors());
};