Skip to content

Commit

Permalink
Don't render cursor placeholder for code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Jul 30, 2023
1 parent bc8ade2 commit b061579
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { v4 } from 'uuid';
import React from 'react';
import type { Node } from 'unist';
import { css } from '@emotion/css';
import type { Parent, Text } from 'mdast';
import type { Parent, Text, InlineCode, Code } from 'mdast';
import ReactMarkdown from 'react-markdown';
import { EuiText } from '@elastic/eui';

Expand Down Expand Up @@ -51,11 +51,11 @@ const loadingCursorPlugin = () => {
});
}

if (node.type !== 'text') {
if (node.type !== 'text' && node.type !== 'inlineCode' && node.type !== 'code') {
return;
}

const textNode = node as Text;
const textNode = node as Text | InlineCode | Code;

const indexOfCursor = textNode.value.indexOf(CURSOR);
if (indexOfCursor === -1) {
Expand Down

0 comments on commit b061579

Please sign in to comment.