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

fix: styles added to incorrectly parsed emoji block #19

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

Q1w1N
Copy link
Collaborator

@Q1w1N Q1w1N commented Nov 25, 2024

Summary

Added tests and fixed the issue with invalid_blocks

Test plan

Tested with example app and websocket

@Q1w1N Q1w1N force-pushed the fix/slack-code-blocks/emoji-parsing-issue branch from eeeff43 to e70d1d4 Compare November 25, 2024 13:15
@@ -149,6 +153,8 @@ export const renderTopLevelTokens = (token: Token, richTextBlocksBuilder: RichTe
}
};

const stylableElementTypes = ['channel', 'link', 'text', 'user', 'usergroup'];
Copy link
Member

Choose a reason for hiding this comment

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

q: How is this code detecting that we are not in a code-block and styling is allowed?

Copy link
Collaborator Author

@Q1w1N Q1w1N Nov 26, 2024

Choose a reason for hiding this comment

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

This only prevents styling an element that should not be styles (also generates invalid_block error).
Styling element inside block is fixed by the line

if (rawText.match(codespanRegex)) {
    return [{ type: 'text', text: rawText }];
  }

Copy link
Member

Choose a reason for hiding this comment

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

this is for codespans, what about codeblocks?

@Q1w1N Q1w1N force-pushed the fix/slack-code-blocks/emoji-parsing-issue branch from b4b9b3b to ebc7f74 Compare November 26, 2024 14:42
@Q1w1N Q1w1N merged commit 9a55f52 into main Nov 26, 2024
1 check passed
@Q1w1N Q1w1N deleted the fix/slack-code-blocks/emoji-parsing-issue branch November 26, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants