feat: trigger writing assistant without highlighting text completed#359
feat: trigger writing assistant without highlighting text completed#359
Conversation
|
💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe. |
There was a problem hiding this comment.
PR Summary
This pull request implements a feature to trigger the writing assistant without highlighting text, addressing issue #349. Key changes include:
- Added placeholder text in EditorManager.tsx suggesting to press 'space' for AI writing assistant when the current line is empty
- Updated WritingAssistantFloatingMenu.tsx to handle space key presses for triggering the assistant on empty lines
- Implemented cursor position management and escape key functionality in WritingAssistantFloatingMenu.tsx
- Enhanced positioning logic for the writing assistant menu to improve user experience
- Integrated support for both highlighted text and empty line triggers, making the assistant more versatile
These changes significantly improve the writing assistant's accessibility and usability, aligning with the requested functionality in the related issue.
2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
| return () => { | ||
| editor.off('update', handleUpdate) | ||
| editor.off('selectionUpdate', handleUpdate) | ||
| } |
There was a problem hiding this comment.
style: Consider using a cleanup function that doesn't require disabling eslint
joseplayero
left a comment
There was a problem hiding this comment.
looks nice. made a small comment on the prompt.
some extra thoughts:
- some users may not like seeing the 'press space' text in every new line so maybe we think through ways to allow them to hide it (either in settings or like the message hides after being shown once per note)
- there is a small bug when resizing screen and the message changing places
| if (!selectedText.trim()) return | ||
| let selectedText = highlightData.text | ||
| if (!selectedText.trim() && isSpaceTrigger) { | ||
| selectedText = '' |
There was a problem hiding this comment.
this PR means selectedText can be empty. i dont think the prompts we have should still include """ ${selectedText} """ when selectedText is empty
There was a problem hiding this comment.
I modified how it handles customized prompts, please take a look
joseplayero
left a comment
There was a problem hiding this comment.
lg @weilirs
one thought on this
the backlink extension code could be moved at some point to the EditorManager file because it does very similar things to what you're doing in this PR and moving it would clean up lots of our code (especially in how we pass around the suggestion state )
|
/tip $20 |
Okay, I'll take a look |
|
@weilirs: You just got a $20 tip! 👉 Complete your Algora onboarding to collect your payment. |
fix #349
/claim #349
trigger.writing.assistant.without.highlighting.text.mov