-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: move editor insert logic to useSpecialContent
composable
#9444
base: develop
Are you sure you want to change the base?
Conversation
@chatwoot/frontend hey folks, need your review on this. PTAL and let me know if there are any avenues for improvement, the plan is to rewrite this component completely in 4 to 5 iterations and ensure good tests |
@pranavrajs PTAL |
@pranavrajs @muhsin-k need your review on this |
const getCannedResponseNode = (editorView, content, from, to, variables) => { | ||
const updatedMessage = replaceVariablesInMessage({ | ||
message: content, | ||
variables: variables, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variables: variables, | |
variables, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code LGTM and tested locally.
This PR makes the following changes
createState
to aeditorHelpers
, we didn't need it inside the component anywayinsertMentionNode
,insertCannedResponse
andinsertVariable
and replace with with a composable with abstracted insertion logicuseSpecialContent
composable along with tests for itMotivation
The editor is one of the most complicated UI components we have, however it is too big of a component to be maintained meaningfully, and is largely untested. Refactoring it piece by piece will minimise the risk as well as get it ready for Vue 3 migration