UNPKG

@atlaskit/editor-plugin-show-diff

Version:

ShowDiff plugin for @atlaskit/editor-core

21 lines • 793 B
import { attrAwareTokenEncoder } from './attrAwareTokenEncoder'; import { markAwareTokenEncoder } from './markAwareTokenEncoder'; /** * Single place the token encoder is chosen, shared by `calculateDiffDecorations` and * `computeDiffChanges` so the two cannot drift. * * @param useAttrAwareEncoder Caller is running the smart classifier, which needs node attrs folded * into the token. Also used by the NCS version-history path to detect attribute-only node changes. */ export var selectTokenEncoder = function selectTokenEncoder(useAttrAwareEncoder) { if (useAttrAwareEncoder) { return { tokenEncoder: attrAwareTokenEncoder, shouldHideMarkOnlyDeletions: false }; } return { tokenEncoder: markAwareTokenEncoder, shouldHideMarkOnlyDeletions: true }; };