@atlaskit/editor-plugin-show-diff
Version:
ShowDiff plugin for @atlaskit/editor-core
53 lines (50 loc) • 2.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.resolveInlineChangedStyleLegacy = exports.getAtomicInlineNodeClassNameLegacy = void 0;
var _standard = require("./colorSchemes/standard");
var _traditional = require("./colorSchemes/traditional");
/**
* Pre-refactor `createInlineChangedDecoration` styling code, preserved verbatim for the OFF cohort
* of `platform_editor_show_diff_color_scheme_refactor`.
*
* This module exists so the OFF cohort keeps running the code that shipped before the
* `colorSchemeRegistry` + `factory.ts` migration. Standard deleted styles are resolved at runtime
* only so the ADF-safety gate can select the equivalent longhand; with that gate off, their CSS
* remains unchanged. Delete the whole file at experiment cleanup (EDITOR-8281).
*/
/**
* Pre-refactor inline `style` computation for `createInlineChangedDecoration`.
*/
var resolveInlineChangedStyleLegacy = exports.resolveInlineChangedStyleLegacy = function resolveInlineChangedStyleLegacy(_ref) {
var colorScheme = _ref.colorScheme,
hideAddedDiffsUnderline = _ref.hideAddedDiffsUnderline,
isActive = _ref.isActive,
isInserted = _ref.isInserted;
if (isInserted) {
if (colorScheme === 'traditional') {
return isActive ? _traditional.traditionalInsertStyleActive : _traditional.traditionalInsertStyle;
}
return isActive ? hideAddedDiffsUnderline ? _standard.editingStyleActiveExtendedNoUnderline : _standard.editingStyleActiveExtended : hideAddedDiffsUnderline ? _standard.editingStyleExtendedNoUnderline : _standard.editingStyleExtended;
}
if (colorScheme === 'traditional') {
return (0, _traditional.getDeletedTraditionalInlineStyle)(false);
}
return (isActive ? (0, _standard.getStandardDeletedContentStyleActive)() : (0, _standard.getStandardDeletedContentStyle)()) + _standard.deletedInlineContentStyleExtended;
};
/**
* Pre-refactor class names for an atomic inline node decoration (date, emoji, mention, status).
* The colour was carried by the per-scheme `-traditional` class rather than by an inline CSS
* variable on the same element.
*/
var getAtomicInlineNodeClassNameLegacy = exports.getAtomicInlineNodeClassNameLegacy = function getAtomicInlineNodeClassNameLegacy(inlineNodeName, colorScheme) {
var classNames = ['show-diff-atomic-inline-changed'];
if (inlineNodeName) {
classNames.push("show-diff-atomic-inline-changed-".concat(inlineNodeName));
}
if (colorScheme === 'traditional') {
classNames.push('show-diff-atomic-inline-changed-traditional');
}
return classNames.join(' ');
};