Skip to content

Commit

Permalink
fix: mirror symbols only if mask changes in postfix-postprocessor
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Belokopytov committed Nov 25, 2024
1 parent 19d1434 commit 44b9c67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 1 addition & 2 deletions projects/kit/src/lib/processors/postfix-postprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export function maskitoPostfixPostprocessorGenerator(
'',
);
const postfixWasModified =
!value.endsWith(postfix) &&
initialElementState.selection[1] >= initialValueBeforePostfix.length;
initialElementState.selection[1] > initialValueBeforePostfix.length;
const alreadyExistedValueBeforePostfix = findCommonBeginningSubstr(
initialValueBeforePostfix,
value,
Expand Down
13 changes: 11 additions & 2 deletions projects/kit/src/lib/utils/extract-affixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ export function extractAffixes(
const [extractedPrefix = ''] = value.match(prefixRegExp) ?? [];
const [extractedPostfix = ''] = value.match(postfixRegExp) ?? [];

const cleanValue = value.replace(prefixRegExp, '').replace(postfixRegExp, '');
if (extractedPrefix || extractedPostfix) {
return {
extractedPrefix,
extractedPostfix,
cleanValue: value.slice(
extractedPrefix.length,
extractedPostfix.length ? -extractedPostfix.length : Infinity,
),
};
}

return {extractedPrefix, extractedPostfix, cleanValue};
return {extractedPrefix, extractedPostfix, cleanValue: value};
}

0 comments on commit 44b9c67

Please sign in to comment.