UNPKG

@atlaskit/editor-plugin-show-diff

Version:

ShowDiff plugin for @atlaskit/editor-core

47 lines (45 loc) • 2.52 kB
/** * 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). */ import { deletedInlineContentStyleExtended, editingStyleActiveExtended, editingStyleActiveExtendedNoUnderline, editingStyleExtended, editingStyleExtendedNoUnderline, getStandardDeletedContentStyle, getStandardDeletedContentStyleActive } from './colorSchemes/standard'; import { getDeletedTraditionalInlineStyle, traditionalInsertStyle, traditionalInsertStyleActive } from './colorSchemes/traditional'; /** * Pre-refactor inline `style` computation for `createInlineChangedDecoration`. */ export var resolveInlineChangedStyleLegacy = function resolveInlineChangedStyleLegacy(_ref) { var colorScheme = _ref.colorScheme, hideAddedDiffsUnderline = _ref.hideAddedDiffsUnderline, isActive = _ref.isActive, isInserted = _ref.isInserted; if (isInserted) { if (colorScheme === 'traditional') { return isActive ? traditionalInsertStyleActive : traditionalInsertStyle; } return isActive ? hideAddedDiffsUnderline ? editingStyleActiveExtendedNoUnderline : editingStyleActiveExtended : hideAddedDiffsUnderline ? editingStyleExtendedNoUnderline : editingStyleExtended; } if (colorScheme === 'traditional') { return getDeletedTraditionalInlineStyle(false); } return (isActive ? getStandardDeletedContentStyleActive() : getStandardDeletedContentStyle()) + 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. */ export var 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(' '); };