Skip to content

Conversation

@SayadSindid
Copy link

In regard to #237

Localization should probably be added for each preset name don't know how to do.

Support could be added for the (.)\n+(?!-)(.) indicated in the guide in order to change the "regex filter text replacement field" when this regex is selected.

Additional features:
Maybe support for multiples custom preset made by the user?

Note: First pull request
If anything is wrong feel free to explain

Copy link
Owner

@killergerbah killergerbah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!
This is close, but a new setting is not necessary to store the selected preset. Please use useState instead.

import NoteTypeTutorialBubble from './NoteTypeTutorialBubble';

const regexPresetsList = [
{ name: 'No preset', regex: '' },
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These strings need to be localizable.

@SayadSindid
Copy link
Author

Added the possibility to localize and changed the logic to use state instead of having a new setting.

@SayadSindid SayadSindid requested a review from killergerbah June 15, 2025 15:31
onChange={(event) => {
handleSettingChanged('subtitleRegexFilter', event.target.value);
if (selectedRegexPresetName !== regexPresetsList[0].name) {
setSelectedRegexPresetName(regexPresetsList[0].name);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's risky to update state from inside the render function. You should consider using useEffect instead.
Also, ideally if the user types in one of the presets manually the correct one gets selected. This code is selecting the first preset no matter what.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants