I have a text template like this:
I live in the middle of the {sea|city}, and I am {happy|sad}.
I need to have a text input where user will be able to edit this text but instead of {sea|city} or any other similar pattern there should be a select input with dropdown where user should be able to pick between available options or remove the select input at all.
But in case the user decides to delete the select input, the token {sea|city} should be removed from the original text as well so I can save it on backend.
I tried to split the text so that I have a select option where it is needed and multiple text inputs between them, but this makes the text hard to edit because the user has to jump from one input to another, I need to make the user feel lake it is one whole input not multiple separated inputs.
Are there any approaches or libraries that I ca use for that ?