Skip to content
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

Merged
merged 6 commits into from
Mar 12, 2024
Merged

Comment UI refinement #9271

merged 6 commits into from
Mar 12, 2024

Conversation

kazcw
Copy link
Contributor

@kazcw kazcw commented Mar 4, 2024

  • Eliminate edit mode:
    • Beginning edit does not change appearance
    • Edit text as rendered, not as formatted in code
    • Soft-wrap the editor
    • Click-to-edit sets cursor in editor
  • Enter finishes edit
    • Shift+Enter inserts a newline
  • Click begins edit regardless of Ctrl

Pull Request Description

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

- 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
@kazcw kazcw added the -gui label Mar 4, 2024
@kazcw kazcw self-assigned this Mar 4, 2024
@kazcw kazcw linked an issue Mar 4, 2024 that may be closed by this pull request
Comment on lines 91 to 97
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')
}
Copy link
Contributor

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?

@kazcw kazcw added the CI: No changelog needed Do not require a changelog entry for this PR. label Mar 4, 2024
@kazcw kazcw marked this pull request as draft March 11, 2024 19:19
@kazcw kazcw marked this pull request as ready for review March 11, 2024 19:19
Comment on lines +79 to +80
if (props.editing) editor.value.focus()
else editor.value.contentDOM.blur()
Copy link
Contributor

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?

Copy link
Contributor Author

@kazcw kazcw Mar 12, 2024

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.

@kazcw kazcw merged commit be4f04f into develop Mar 12, 2024
32 of 35 checks passed
@kazcw kazcw deleted the wip/kw/comment-tweaks branch March 12, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-gui CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Component comments small fixes
3 participants