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

Conversations improvement #89

Merged
merged 11 commits into from
Dec 27, 2023
Merged

Conversations improvement #89

merged 11 commits into from
Dec 27, 2023

Conversation

kurwjan
Copy link
Collaborator

@kurwjan kurwjan commented Dec 23, 2023

Teil von bessere UI/UX (#40)

Textformatierung

Ich benutze marked, um den Lanis-Syntax zu Markdown-Syntax umzuwandeln. Dann benutze ich styled_text um Widgets mit dem Text zu erstellen. Ist es ist ineffizient? Ja, aber glaube es ist unnötig einen eigenen Parser zu machen mit RegEx oder mit einer String/Char for loop.

@kurwjan kurwjan added the enhancement New feature or request label Dec 23, 2023
@kurwjan kurwjan self-assigned this Dec 23, 2023
@kurwjan
Copy link
Collaborator Author

kurwjan commented Dec 23, 2023

String convertLanisSyntax(String lanisStyledText) {
    final markdown = Markdown.map(
      {
        "**": (text, match) => "<bold>$text</bold>",
        "__": (text, match) => "<underline>$text</underline>",
        "~~": (text, match) => "<italic>$text</italic>",
        "--": (text, match) => "<remove>$text</remove>",
        r"regexp: - .(.*)": (text, match) => "<bullet>$text</bullet>", //wird schon gemacht
        "`": (text, match) => "<code>$text</code>",
        r"regexp: _(\d) ": (text, match) => "<superscript>$text</superscript>",
        r"regexp: _\((\d*)\)": (text, match) => "<superscript>$text</superscript>",
        r"regexp: \^(\d) ": (text, match) => "<subscript>$text</subscript>",
        r"regexp: \^\((\d*)\)": (text, match) => "<subscript>$text</subscript>",
      }
    );

    print(markdown.apply(lanisStyledText));

    return markdown.apply(lanisStyledText);
  }

@kurwjan
Copy link
Collaborator Author

kurwjan commented Dec 26, 2023

Das sollte eigentlich easy sein mit StyledText. Für links und so weiß ich nicht wie ich es genau mache, aber ich glaube mit Linkify suche ich links und emails heraus und tuhe sie in einen tag rein.

@kurwjan
Copy link
Collaborator Author

kurwjan commented Dec 27, 2023

Vorher:
Screenshot from 2023-12-27 14-33-41

Nacher:
Screenshot from 2023-12-27 14-34-27

@alessioC42
Copy link
Owner

sieht sick aus!

+ Now only bullets that are at the start of the string will be formatted.
@kurwjan kurwjan marked this pull request as ready for review December 27, 2023 17:13
@kurwjan kurwjan mentioned this pull request Dec 27, 2023
7 tasks
Copy link
Owner

@alessioC42 alessioC42 left a comment

Choose a reason for hiding this comment

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

Ich kann es nicht wirklich testen...
Aber da das Text-Styling nicht nur in Conversations verwendet wird, wäre es meiner Meinung nach besser, ein eigenes Widget in Shared zu machen. So könnte man es leichter wiederverwenden. Vor allem für eventuelle zukünftige Applets und Mein Unterricht.

@kurwjan
Copy link
Collaborator Author

kurwjan commented Dec 27, 2023

Hab gemacht

@alessioC42 alessioC42 merged commit 2d5557b into main Dec 27, 2023
@alessioC42 alessioC42 deleted the conversations_improvement branch December 27, 2023 22:42
@alessioC42 alessioC42 mentioned this pull request Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants