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

feat(viewer): add Text, Markdown and Source Code viewer (read-only) #785

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Sep 3, 2024

☑️ Resolves

Includes features:

  • File types:
    • .md with extended markdown support
    • .txt with auto link only
    • Different source code files with monospaced font (depends on the server's mimetype detection)
  • Switch between 900px / fullwidth modes
  • Copying text content
  • Navigating/selecting like in a readonly contenteditable area
  • Handling empty files

🖼️ Screenshots

Text file

🌕 Light 🌑 Dark
image image

Markdown file

🌕 Light 🌑 Dark
image image

Full-width mode

image

Soft-wrap - MD

Enabled Disabled
image image
image image

Code (no highlighting)

🌕 Light 🌑 Dark
image image

Empty file

🌕 Light 🌑 Dark
image image

Copy content

copy

Navigation

The text is within contenteditable, so a user can select/copy/navigate like in a text editor. But it is readonly.

navigation

@ShGKme ShGKme added enhancement New feature or request 3. to review labels Sep 3, 2024
@ShGKme ShGKme self-assigned this Sep 3, 2024
@ShGKme ShGKme mentioned this pull request Sep 3, 2024
2 tasks
@ShGKme ShGKme changed the title feat(viewer): add support for Text, Markdown and Code feat(viewer): add Text, Markdown and Source Code viewer Sep 3, 2024
@ShGKme ShGKme mentioned this pull request Sep 3, 2024
48 tasks
@ShGKme
Copy link
Contributor Author

ShGKme commented Sep 4, 2024

Added many fixes separated into small commits. See PR description for new images.

  • More types for code from the suggestion
  • Changed icon from the suggestion
  • Fix Copy button (it wasn't actually implemented, lol)
  • Updated design to handle light theme
  • Improved wrap/non-wrap text view + added a control for it
  • Made menubar sticky on top instead of fixed on the corner
  • Some minor UI changes

@ShGKme ShGKme requested a review from Antreesy September 4, 2024 18:46
@ShGKme ShGKme changed the title feat(viewer): add Text, Markdown and Source Code viewer feat(viewer): add Text, Markdown and Source Code viewer (read-only) Sep 5, 2024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know where it belongs code-wise, but I faced the caching issue:

  • File is changed on server;
  • Client is still keeping the old version (was empty for me);

Maybe could be done in a follow-up, but how can it better be done? Sync button, null cache time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, a text file has no ETag change after its content was changed... So technically the cached value is valid...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking with the office team

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine if reopen after some short time, just not immediately after is was changes in the web-editor.

@ShGKme
Copy link
Contributor Author

ShGKme commented Sep 5, 2024

  • Fixed regression with no code format
  • Moved button to the right (removed 900px limitation)

Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good from my POV

Signed-off-by: Grigorii K. Shartsev <[email protected]>
@ShGKme ShGKme merged commit c88478f into main Sep 6, 2024
7 checks passed
@ShGKme ShGKme deleted the feat/viewer-text-code branch September 6, 2024 08:22
@ShGKme ShGKme mentioned this pull request Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants