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(CodeBlock): Fixed code insert #251

Merged
merged 3 commits into from
Jun 3, 2024
Merged

fix(CodeBlock): Fixed code insert #251

merged 3 commits into from
Jun 3, 2024

Conversation

makhnatkin
Copy link
Collaborator

@makhnatkin makhnatkin commented May 31, 2024

When inserting a copied block of code from the preview, the language is correctly set, provided that it was previously set.

@makhnatkin makhnatkin requested a review from d3m1d0v May 31, 2024 10:11
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

const getLangOfNode = (node: Element) => {
return (
node.getAttribute(CodeBlockNodeAttr.Lang) ||
node.firstElementChild?.getAttribute('class')?.split(' ')?.[1] ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add additional checks that firstElementChild is <code/> element, it has hljs classname, etc ?

@makhnatkin makhnatkin merged commit df9848e into main Jun 3, 2024
3 checks passed
@makhnatkin makhnatkin deleted the fix-code-insert branch June 3, 2024 14:15
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.

None yet

3 participants