-
Notifications
You must be signed in to change notification settings - Fork 323
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
Comment UI refinement #9271
Comment UI refinement #9271
Conversation
- Eliminate edit mode: - Beginning edit does not change appearance - Edit text as rendered, not as formatted in code - Enter finishes edit - Shift+Enter inserts a newline - Click begins edit regardless of Ctrl
export function rawTextToCooked(raw: string) { | ||
return raw.replaceAll(/(?<!\n)\n(?!\n)/g, ' ').replaceAll(/\n(\n+)/g, '$1') | ||
} | ||
|
||
export function cookedTextToRaw(cooked: string) { | ||
return cooked.replaceAll('\n', '\n\n') | ||
} |
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.
Could you please add little docs to explain what is the difference?
if (props.editing) editor.value.focus() | ||
else editor.value.contentDOM.blur() |
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.
This looks little strange as a watchEffect
. Could this focus/blur be moved to the interaction methods? Or is there any reason for it being here in particular?
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.
@Frizi
Watching the prop ensures that focus/blur is updated when we begin/end editing for any reason, e.g:
- If the edit-comment menu icon is clicked, that sets the prop, so the comment is focused when editing begins
- There are various ways editing can be ended, some of them will set a new focus inherently but some don't; if there were any case where we missed unfocusing the comment, a weird state would result in which the app thinks the comment is not being edited but the user still sees a cursor.
Pull Request Description
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.